Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
46063a74
Commit
46063a74
authored
13 years ago
by
kaloyane
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: close flex files after reading the metadata
SVN: 23448
parent
1c94ef78
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
image_readers/source/java/ch/systemsx/cisd/imagereaders/bioformats/FlexHelper.java
+19
-10
19 additions, 10 deletions
.../ch/systemsx/cisd/imagereaders/bioformats/FlexHelper.java
with
19 additions
and
10 deletions
image_readers/source/java/ch/systemsx/cisd/imagereaders/bioformats/FlexHelper.java
+
19
−
10
View file @
46063a74
...
@@ -28,9 +28,11 @@ import javax.xml.xpath.XPathConstants;
...
@@ -28,9 +28,11 @@ import javax.xml.xpath.XPathConstants;
import
javax.xml.xpath.XPathExpression
;
import
javax.xml.xpath.XPathExpression
;
import
javax.xml.xpath.XPathFactory
;
import
javax.xml.xpath.XPathFactory
;
import
loci.common.RandomAccessInputStream
;
import
loci.formats.tiff.IFDList
;
import
loci.formats.tiff.IFDList
;
import
loci.formats.tiff.TiffParser
;
import
loci.formats.tiff.TiffParser
;
import
org.apache.commons.io.IOUtils
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.Document
;
import
org.w3c.dom.NodeList
;
import
org.w3c.dom.NodeList
;
import
org.xml.sax.InputSource
;
import
org.xml.sax.InputSource
;
...
@@ -63,15 +65,15 @@ public class FlexHelper
...
@@ -63,15 +65,15 @@ public class FlexHelper
private
static
final
String
SELECT_TILE_YCOORDS
=
"//Sublayouts/Sublayout/Field/OffsetY/text()"
;
private
static
final
String
SELECT_TILE_YCOORDS
=
"//Sublayouts/Sublayout/Field/OffsetY/text()"
;
private
final
String
file
Name
;
private
final
String
file
;
private
final
String
metadataXML
;
private
final
String
metadataXML
;
private
final
Document
metadata
;
private
final
Document
metadata
;
public
FlexHelper
(
String
file
Name
)
public
FlexHelper
(
String
file
)
{
{
this
.
file
Name
=
file
Name
;
this
.
file
=
file
;
try
try
{
{
this
.
metadataXML
=
readMetadata
();
this
.
metadataXML
=
readMetadata
();
...
@@ -157,15 +159,22 @@ public class FlexHelper
...
@@ -157,15 +159,22 @@ public class FlexHelper
private
String
readMetadata
()
throws
Exception
private
String
readMetadata
()
throws
Exception
{
{
TiffParser
tiffParser
=
new
TiffParser
(
fileName
);
RandomAccessInputStream
in
=
new
RandomAccessInputStream
(
file
);
final
IFDList
ifds
=
tiffParser
.
getIFDs
();
try
if
(
ifds
!=
null
&&
ifds
.
get
(
0
)
!=
null
)
{
{
return
ifds
.
get
(
0
).
getIFDStringValue
(
FLEX
);
TiffParser
tiffParser
=
new
TiffParser
(
in
);
}
else
final
IFDList
ifds
=
tiffParser
.
getIFDs
();
if
(
ifds
!=
null
&&
ifds
.
get
(
0
)
!=
null
)
{
return
ifds
.
get
(
0
).
getIFDStringValue
(
FLEX
);
}
else
{
throw
new
IllegalArgumentException
(
"Cannot parse Flex XML metadata from file "
+
file
);
}
}
finally
{
{
throw
new
IllegalArgumentException
(
"Cannot parse Flex XML metadata from file "
IOUtils
.
closeQuietly
(
in
);
+
fileName
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment