Details
-
Type: Improvement
-
Status: Closed
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 2.11.3.0
-
Fix Version/s: 2.11.3.0
-
Component/s: Command Line Interface
-
Labels:None
Description
The CLI should gracefully report problems encountered during image export. Right now, each exporter handles any exceptions (out of memory errors, other kinds of exception) at the point of export and directly raises error dialogs, sets status bars, or prints to stdout. Instead, each image IO/export op could raise an export exception that is handled by which ever UI initiated the operation.
e.g.
} catch (OutOfMemoryError err)
{
System.out.println("########################\n" + "OUT OF MEMORY "
+ generatedFile + "\n" + "########################");
new OOMWarning("Creating Image for " + generatedFile, err);
} catch (Exception e)
{
setProgressMessage(MessageManager
.formatMessage("info.error_creating_file", getDescription()));
e.printStackTrace();
}
should instead create new ImageExportException("info.error_creating_file",ex).
HISTORY
This was originally raised as an exception whilst debugging a problem withJAL-4160 - the new CLI:
I tried the following on a shadowjar built from commit: a1b2001f5f89248bdaa2f1e10d4a7a2d6a1163d8
(base) M-000981:jalview jprocter$ java -jar build/libs/jalview-all-TEST-j11.jar --open examples/uniref50.fa --colour gecos-flower --image printable.eps
Java version: 11.0.16.1
Java home: /usr/local/Cellar/openjdk@11/11.0.16.1_1/libexec/openjdk.jdk/Contents/Home
Java arch: x86_64 Mac OS X 12.6.3
Jalview non-release version: TEST (Source git-commit:a1b2001f5f [develop])
Setting initial log level to INFO
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
INFO - Loaded Sequence Ontology from so-xp-simple.obo.zip (106ms)
INFO - Getting messages for lang: en_GB
INFO - Writing printable.eps
Error creating EPS file: java.lang.NullPointerException
INFO - Successfully completed commands in headless mode
Two problems with the above output:
1 - the EPS was not actually created - there was an exception which whilst being reported, had no stacktrace (regardless of whether I added --debug to the command line options)
2 - the final 'sucessfully completed commands in headless mode' is clearly not actually true, since there was an error during image generation!
The EPS error appears when --gui is provided, so something has been broken somewhere.
I also tried the same with --quiet:
(base) M-000981:jalview jprocter$ java -jar build/libs/jalview-all-TEST-j11.jar --quiet --open examples/uniref50.fa --colour gecos-flower --image printable.eps
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
INFO - Loaded Sequence Ontology from so-xp-simple.obo.zip (93ms)
INFO - Getting messages for lang: en_GB
INFO - Writing printable.eps
INFO - Successfully completed commands in headless mode
This output is even more misleading, since the message reporting the exception occurred was squashed.
e.g.
} catch (OutOfMemoryError err)
{
System.out.println("########################\n" + "OUT OF MEMORY "
+ generatedFile + "\n" + "########################");
new OOMWarning("Creating Image for " + generatedFile, err);
} catch (Exception e)
{
setProgressMessage(MessageManager
.formatMessage("info.error_creating_file", getDescription()));
e.printStackTrace();
}
should instead create new ImageExportException("info.error_creating_file",ex).
HISTORY
This was originally raised as an exception whilst debugging a problem with
I tried the following on a shadowjar built from commit: a1b2001f5f89248bdaa2f1e10d4a7a2d6a1163d8
(base) M-000981:jalview jprocter$ java -jar build/libs/jalview-all-TEST-j11.jar --open examples/uniref50.fa --colour gecos-flower --image printable.eps
Java version: 11.0.16.1
Java home: /usr/local/Cellar/openjdk@11/11.0.16.1_1/libexec/openjdk.jdk/Contents/Home
Java arch: x86_64 Mac OS X 12.6.3
Jalview non-release version: TEST (Source git-commit:a1b2001f5f [develop])
Setting initial log level to INFO
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
INFO - Loaded Sequence Ontology from so-xp-simple.obo.zip (106ms)
INFO - Getting messages for lang: en_GB
INFO - Writing printable.eps
Error creating EPS file: java.lang.NullPointerException
INFO - Successfully completed commands in headless mode
Two problems with the above output:
1 - the EPS was not actually created - there was an exception which whilst being reported, had no stacktrace (regardless of whether I added --debug to the command line options)
2 - the final 'sucessfully completed commands in headless mode' is clearly not actually true, since there was an error during image generation!
The EPS error appears when --gui is provided, so something has been broken somewhere.
I also tried the same with --quiet:
(base) M-000981:jalview jprocter$ java -jar build/libs/jalview-all-TEST-j11.jar --quiet --open examples/uniref50.fa --colour gecos-flower --image printable.eps
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
INFO - Loaded Sequence Ontology from so-xp-simple.obo.zip (93ms)
INFO - Getting messages for lang: en_GB
INFO - Writing printable.eps
INFO - Successfully completed commands in headless mode
This output is even more misleading, since the message reporting the exception occurred was squashed.
Attachments
Issue Links
- blocks
-
JAL-4196 fix synchronization issues for structure viewers, tests, and new cli
- Closed