diff --git a/.github/workflows/ant.yml b/.github/workflows/ant.yml index 9179c3ba4ec..8c5f152ddf3 100644 --- a/.github/workflows/ant.yml +++ b/.github/workflows/ant.yml @@ -7,7 +7,7 @@ jobs: build: strategy: matrix: - java: [1.8, 11] + java: [1.8, 11, 17] os: [ubuntu-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ac149ef5ec6..440f9611b52 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -13,7 +13,7 @@ jobs: build: strategy: matrix: - java: [1.8, 11] + java: [1.8, 11, 17] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} env: diff --git a/components/formats-bsd/src/loci/formats/in/JPEGReader.java b/components/formats-bsd/src/loci/formats/in/JPEGReader.java index 49f37174e5c..4c9f8a0006a 100644 --- a/components/formats-bsd/src/loci/formats/in/JPEGReader.java +++ b/components/formats-bsd/src/loci/formats/in/JPEGReader.java @@ -180,7 +180,7 @@ public void close(boolean fileOnly) throws IOException { // -- Helper reader -- - static class DefaultJPEGReader extends ImageIOReader { + public static class DefaultJPEGReader extends ImageIOReader { public DefaultJPEGReader() { super("JPEG", new String[] {"jpg", "jpeg", "jpe"}); suffixNecessary = false; diff --git a/components/formats-gpl/src/loci/formats/in/CV7000Reader.java b/components/formats-gpl/src/loci/formats/in/CV7000Reader.java index 9d034ae47e2..9da19ebf004 100644 --- a/components/formats-gpl/src/loci/formats/in/CV7000Reader.java +++ b/components/formats-gpl/src/loci/formats/in/CV7000Reader.java @@ -79,7 +79,6 @@ public class CV7000Reader extends FormatReader { // -- Fields -- private String[] allFiles; - private Location parent; private MinimalTiffReader reader; private String wppPath; private String detailPath; @@ -239,7 +238,7 @@ protected void initFile(String id) throws FormatException, IOException { String wpiXML = readSanitizedXML(id); XMLTools.parseXML(wpiXML, plate); - parent = new Location(id).getAbsoluteFile().getParentFile(); + Location parent = new Location(id).getAbsoluteFile().getParentFile(); allFiles = parent.list(true); Arrays.sort(allFiles); for (int i=0; i channelInfos; @@ -120,9 +119,9 @@ public class CellVoyagerReader extends FormatReader private List< Integer > timePoints; - private Location measurementResultFile; + private String measurementResultFile; - private Location omeMeasurementFile; + private String omeMeasurementFile; public CellVoyagerReader() { @@ -148,8 +147,6 @@ public byte[] openBytes( final int no, final byte[] buf, final int x, final int final AreaInfo area = well.areas.get( areaIndex ); final MinimalTiffReader tiffReader = new MinimalTiffReader(); - imageFolder = new Location(currentId).getAbsoluteFile().getParentFile(); - imageFolder = new Location(imageFolder, "Image"); for ( final FieldInfo field : area.fields ) { @@ -274,7 +271,7 @@ protected void initFile( final String id ) throws FormatException, IOException { super.initFile( id ); - measurementFolder = new Location( id ).getAbsoluteFile(); + Location measurementFolder = new Location( id ).getAbsoluteFile(); if ( !measurementFolder.exists() ) { throw new IOException( "File " + id + " does not exist." ); } if ( !measurementFolder.isDirectory() ) { @@ -283,22 +280,26 @@ protected void initFile( final String id ) throws FormatException, IOException measurementFolder = measurementFolder.getParentFile(); } } - imageFolder = new Location(measurementFolder, "Image"); + imageFolder = new Location(measurementFolder, "Image").getAbsolutePath(); - measurementResultFile = new Location( measurementFolder, "MeasurementResult.xml" ); - if ( !measurementResultFile.exists() ) { throw new IOException( "Could not find " + measurementResultFile + " in folder." ); } + Location measurementResult = new Location( measurementFolder, "MeasurementResult.xml" ); + if ( !measurementResult.exists() ) { throw new IOException( "Could not find " + measurementResult + " in folder." ); } + else { + measurementResultFile = measurementResult.getAbsolutePath(); + } - omeMeasurementFile = new Location( measurementFolder, "MeasurementResult.ome.xml" ); - if ( !omeMeasurementFile.exists() ) { throw new IOException( "Could not find " + omeMeasurementFile + " in folder." ); } + Location omeMeasurement = new Location( measurementFolder, "MeasurementResult.ome.xml" ); + if ( !omeMeasurement.exists() ) { throw new IOException( "Could not find " + omeMeasurement + " in folder." ); } + else { + omeMeasurementFile = omeMeasurement.getAbsolutePath(); + } /* * Open MeasurementSettings file */ - RandomAccessInputStream result = - new RandomAccessInputStream(measurementResultFile.getAbsolutePath()); Document msDocument = null; - try { + try (RandomAccessInputStream result = new RandomAccessInputStream(measurementResultFile)) { msDocument = XMLTools.parseDOM(result); } catch (ParserConfigurationException e) { @@ -307,9 +308,6 @@ protected void initFile( final String id ) throws FormatException, IOException catch (SAXException e) { throw new IOException(e); } - finally { - result.close(); - } msDocument.getDocumentElement().normalize(); @@ -329,10 +327,9 @@ protected void initFile( final String id ) throws FormatException, IOException * Open OME metadata file */ - RandomAccessInputStream measurement = - new RandomAccessInputStream(omeMeasurementFile.getAbsolutePath()); + Document omeDocument = null; - try { + try (RandomAccessInputStream measurement = new RandomAccessInputStream(omeMeasurementFile)) { omeDocument = XMLTools.parseDOM(measurement); } catch (ParserConfigurationException e) { @@ -341,9 +338,6 @@ protected void initFile( final String id ) throws FormatException, IOException catch (SAXException e) { throw new IOException(e); } - finally { - measurement.close(); - } omeDocument.getDocumentElement().normalize(); /* @@ -361,7 +355,7 @@ public String[] getSeriesUsedFiles( final boolean noPixels ) if ( noPixels ) { - return new String[] { measurementResultFile.getAbsolutePath(), omeMeasurementFile.getAbsolutePath() }; + return new String[] { measurementResultFile, omeMeasurementFile }; } else { @@ -371,8 +365,8 @@ public String[] getSeriesUsedFiles( final boolean noPixels ) final AreaInfo area = wells.get( wellIndex ).areas.get( areaIndex ); final int nFields = area.fields.size(); ArrayList images = new ArrayList(); - images.add(measurementResultFile.getAbsolutePath()); - images.add(omeMeasurementFile.getAbsolutePath()); + images.add(measurementResultFile); + images.add(omeMeasurementFile); for ( final Integer timepoint : timePoints ) { diff --git a/components/formats-gpl/src/loci/formats/in/PrairieReader.java b/components/formats-gpl/src/loci/formats/in/PrairieReader.java index 5b091a16af9..d044da40235 100644 --- a/components/formats-gpl/src/loci/formats/in/PrairieReader.java +++ b/components/formats-gpl/src/loci/formats/in/PrairieReader.java @@ -91,7 +91,7 @@ public class PrairieReader extends FormatReader { private TiffReader tiff; /** The associated XML files. */ - private Location xmlFile, cfgFile, envFile; + private String xmlFile, cfgFile, envFile; /** Format-specific metadata. */ private PrairieMetadata meta; @@ -215,9 +215,9 @@ public String[] getSeriesUsedFiles(boolean noPixels) { // add metadata files to the used files list final ArrayList usedFiles = new ArrayList(); - if (xmlFile != null) usedFiles.add(xmlFile.getAbsolutePath()); - if (cfgFile != null) usedFiles.add(cfgFile.getAbsolutePath()); - if (envFile != null) usedFiles.add(envFile.getAbsolutePath()); + if (xmlFile != null) usedFiles.add(xmlFile); + if (cfgFile != null) usedFiles.add(cfgFile); + if (envFile != null) usedFiles.add(envFile); if (!noPixels) { // add TIFF files to the used files list @@ -319,15 +319,15 @@ protected void initFile(String id) throws FormatException, IOException { tiff = new TiffReader(); if (checkSuffix(id, XML_SUFFIX)) { - xmlFile = new Location(id); + xmlFile = new Location(id).getAbsolutePath(); findMetadataFiles(); } else if (checkSuffix(id, CFG_SUFFIX)) { - cfgFile = new Location(id); + cfgFile = new Location(id).getAbsolutePath(); findMetadataFiles(); } else if (checkSuffix(id, ENV_SUFFIX)) { - envFile = new Location(id); + envFile = new Location(id).getAbsolutePath(); findMetadataFiles(); } else { @@ -344,7 +344,7 @@ else if (checkSuffix(id, ENV_SUFFIX)) { } } - currentId = xmlFile.getAbsolutePath(); + currentId = xmlFile; parsePrairieMetadata(); populateCoreMetadata(); @@ -356,9 +356,24 @@ else if (checkSuffix(id, ENV_SUFFIX)) { private void findMetadataFiles() { LOGGER.info("Finding metadata files"); - if (xmlFile == null) xmlFile = find(XML_SUFFIX); - if (cfgFile == null) cfgFile = find(CFG_SUFFIX); - if (envFile == null) envFile = find(ENV_SUFFIX); + if (xmlFile == null) { + Location xml = find(XML_SUFFIX); + if (xml != null) { + xmlFile = xml.getAbsolutePath(); + } + } + if (cfgFile == null) { + Location cfg = find(CFG_SUFFIX); + if (cfg != null) { + cfgFile = cfg.getAbsolutePath(); + } + } + if (envFile == null) { + Location env = find(ENV_SUFFIX); + if (env != null) { + envFile = env.getAbsolutePath(); + } + } } /** @@ -368,11 +383,19 @@ private void findMetadataFiles() { private void parsePrairieMetadata() throws FormatException, IOException { LOGGER.info("Parsing Prairie metadata"); - final Document xml, cfg, env; + Document xml = null; + Document cfg = null; + Document env = null; try { - xml = parseDOM(xmlFile); - cfg = parseDOM(cfgFile); - env = parseDOM(envFile); + if (xmlFile != null) { + xml = parseDOM(new Location(xmlFile)); + } + if (cfgFile != null) { + cfg = parseDOM(new Location(cfgFile)); + } + if (envFile != null) { + env = parseDOM(new Location(envFile)); + } } catch (ParserConfigurationException exc) { throw new FormatException(exc); @@ -725,7 +748,7 @@ private void warnFilename(final Sequence sequence, final int index, /** Gets the absolute path to the filename of the given {@link PFile}. */ private String getPath(final PFile file) { - final Location f = new Location(xmlFile.getParent(), file.getFilename()); + final Location f = new Location(new Location(xmlFile).getParent(), file.getFilename()); return f.getAbsolutePath(); } diff --git a/components/formats-gpl/src/loci/formats/in/VolocityReader.java b/components/formats-gpl/src/loci/formats/in/VolocityReader.java index d8554b55919..6950f9b4f99 100644 --- a/components/formats-gpl/src/loci/formats/in/VolocityReader.java +++ b/components/formats-gpl/src/loci/formats/in/VolocityReader.java @@ -69,7 +69,7 @@ public class VolocityReader extends FormatReader { private ArrayList stacks; private ArrayList extraFiles; private Object[][] sampleTable, stringTable; - private Location dir = null; + private String dir = null; private ArrayList timestamps = new ArrayList(); @@ -258,13 +258,14 @@ protected void initFile(String id) throws FormatException, IOException { extraFiles.add(file.getAbsolutePath()); Location parentDir = file.getParentFile(); - dir = new Location(parentDir, DATA_DIR); + Location dataDir = new Location(parentDir, DATA_DIR); + dir = dataDir.getAbsolutePath(); - if (dir.exists()) { - String[] files = dir.list(true); + if (dataDir.exists()) { + String[] files = dataDir.list(true); for (String f : files) { if (!checkSuffix(f, "aisf") && !checkSuffix(f, "atsf")) { - extraFiles.add(new Location(dir, f).getAbsolutePath()); + extraFiles.add(new Location(dataDir, f).getAbsolutePath()); } } } @@ -851,7 +852,7 @@ private RandomAccessInputStream getStream(int row) throws IOException { return data; } - private String getFile(Integer parent, Location dir) { + private String getFile(Integer parent, String dir) { for (int row=0; row org.kohsuke file-leak-detector - 1.13 + 1.15 jar-with-dependencies @@ -165,4 +165,22 @@ -6 + + + + central + Central Repository + https://repo.maven.apache.org/maven2 + + + ome + OME Artifactory + https://artifacts.openmicroscopy.org/artifactory/maven/ + + + imagej.public + Jenkins repository + https://repo.jenkins-ci.org/releases/ + + diff --git a/pom.xml b/pom.xml index 2483aed71e1..9234603c8b5 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ 5.3.7 5.3.2 0.1.3 - 0.4.1 + 0.4.2 0.2.4 2.7.2 3.28.0