Skip to content

Commit

Permalink
BDVReader: ensure getCurrentFile always returns the XML file
Browse files Browse the repository at this point in the history
  • Loading branch information
sbesson committed Jul 23, 2024
1 parent 32b4801 commit 96927e0
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions components/formats-bsd/src/loci/formats/in/BDVReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ public BDVReader() {
/* @see loci.formats.FormatReader#initFile(String) */
@Override
protected void initFile(String id) throws FormatException, IOException {
super.initFile(id);
if (checkSuffix(id, "h5")) {
id = fetchXMLId();
id = fetchXMLId(id);
}
super.initFile(id);
store = makeFilterMetadata();
in = new RandomAccessInputStream(id);
in.setEncoding("ASCII");
Expand Down Expand Up @@ -165,9 +165,9 @@ protected void initFile(String id) throws FormatException, IOException {
}
}

private String fetchXMLId() throws FormatException {
String xmlId = currentId;
Location location = new Location(currentId);
private String fetchXMLId(String id) throws FormatException {
String xmlId = id;
Location location = new Location(id);
Location parent = location.getParentFile();
String baseName = location.getName();
baseName = baseName.substring(0, baseName.indexOf("."));
Expand All @@ -188,7 +188,7 @@ public String[] getUsedFiles(boolean noPixels) {
String xmlId = currentId;
if (checkSuffix(currentId, "h5")) {
try {
xmlId = fetchXMLId();
xmlId = fetchXMLId(currentId);
} catch (FormatException e) {
LOGGER.error("Unable to locate associated BDV XML for file: " + currentId);
}
Expand Down

0 comments on commit 96927e0

Please sign in to comment.