Skip to content
Snippets Groups Projects
Commit 396894b4 authored by kaloyane's avatar kaloyane
Browse files

[LMS-2446] bugfix: prevent unsynchronized state changes in the BioFormat readers instances

SVN: 22343
parent ba6cd00d
No related branches found
No related tags found
No related merge requests found
......@@ -61,20 +61,23 @@ final class BioFormatsImageUtils
*/
public static IFormatReader tryToCreateReaderForFile(String fileName)
{
for (IFormatReader reader : READERS)
synchronized (READERS)
{
try
for (IFormatReader reader : READERS)
{
if (reader.isThisType(fileName))
try
{
return createReader(reader.getClass());
}
if (reader.isThisType(fileName))
{
return createReader(reader.getClass());
}
} finally
{
// "r.isThisType(fileName)" line can open a file handle,
// so we need to close it
closeOpenedFiles(reader);
} finally
{
// "r.isThisType(fileName)" line can open a file handle,
// so we need to close it
closeOpenedFiles(reader);
}
}
}
return null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment