Details
-
Type: Bug
-
Status: Being tested
-
Priority: Blocker
-
Resolution: Unresolved
-
Affects Version/s: 2.11.1.1
-
Component/s: jalview-j2s
-
Labels:None
-
Urgency:Urgent
Description
When reading a gzipped file in jalview.io.FileParse.parse(Object, DataSourceType) occurs in JalviewJS, the contents of the file are obtained as a byte array. Doing the obvious thing to check whether this is a GzipStream (e.g. doing
if (bytes != null)
{
// this will be from JavaScript
inFile = file;
// dataIn = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes))); // this line changed ...
try
{
dataIn = checkForGzipStream(new ByteArrayInputStream(bytes)); // ... to this (requires try)
} catch (Exception e)
{
e.printStackTrace();
}
dataName = fileStr;
}
)
results in the following error in JalviewJS:
TypeError: this.$in.read$BA$I$I is not a function
@swingjs/j2s/java/io/InputStreamReader.js:50:22
@swingjs/j2s/java/io/BufferedReader.js:56:12
@swingjs/j2s/java/io/BufferedReader.js:68:10
@swingjs/j2s/jalview/io/FileParse.js:112:8
@swingjs/j2s/jalview/io/FileParse.js:103:46
@swingjs/j2s/jalview/io/FileParse.js:210:56
@swingjs/j2s/jalview/io/FileParse.js:197:54
J2S.LoadClazz/Clazz.new_@http://localhost:9001/swingjs/swingjs2.js:14562:19
@swingjs/j2s/jalview/io/IdentifyFile.js:17:14
@swingjs/j2s/jalview/io/FileLoader.js:122:35
@swingjs/j2s/java/lang/Thread.js:144:13
ff@swingjs/j2s/swingjs/JSToolkit.js:160:8
Error whilst identifying ./test2.fa.gz
java.io.IOException: Failed to read data from source: UNINITIALISED SOURCE
anonymous.anonymous(Unknown Source)
lost.missing(Unknown Source)
Exception whilst opening file './test2.fa.gz
jalview.io.FileFormatException: Failed to read data from source: UNINITIALISED SOURCE
anonymous.anonymous(Unknown Source)
This appears to occur when creating the ByteArrayInputStream from the byte array. Unfortunately this needs to be done to create a GZIPInputStream used to gunzip the file contents.
Likely to be fixed by SwingJS implementing this.$in.read$BA$I$I which I think is BufferedReader.read(.,.,.)
if (bytes != null)
{
// this will be from JavaScript
inFile = file;
// dataIn = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(bytes))); // this line changed ...
try
{
dataIn = checkForGzipStream(new ByteArrayInputStream(bytes)); // ... to this (requires try)
} catch (Exception e)
{
e.printStackTrace();
}
dataName = fileStr;
}
)
results in the following error in JalviewJS:
TypeError: this.$in.read$BA$I$I is not a function
@swingjs/j2s/java/io/InputStreamReader.js:50:22
@swingjs/j2s/java/io/BufferedReader.js:56:12
@swingjs/j2s/java/io/BufferedReader.js:68:10
@swingjs/j2s/jalview/io/FileParse.js:112:8
@swingjs/j2s/jalview/io/FileParse.js:103:46
@swingjs/j2s/jalview/io/FileParse.js:210:56
@swingjs/j2s/jalview/io/FileParse.js:197:54
J2S.LoadClazz/Clazz.new_@http://localhost:9001/swingjs/swingjs2.js:14562:19
@swingjs/j2s/jalview/io/IdentifyFile.js:17:14
@swingjs/j2s/jalview/io/FileLoader.js:122:35
@swingjs/j2s/java/lang/Thread.js:144:13
ff@swingjs/j2s/swingjs/JSToolkit.js:160:8
Error whilst identifying ./test2.fa.gz
java.io.IOException: Failed to read data from source: UNINITIALISED SOURCE
anonymous.anonymous(Unknown Source)
lost.missing(Unknown Source)
Exception whilst opening file './test2.fa.gz
jalview.io.FileFormatException: Failed to read data from source: UNINITIALISED SOURCE
anonymous.anonymous(Unknown Source)
This appears to occur when creating the ByteArrayInputStream from the byte array. Unfortunately this needs to be done to create a GZIPInputStream used to gunzip the file contents.
Likely to be fixed by SwingJS implementing this.$in.read$BA$I$I which I think is BufferedReader.read(.,.,.)
Attachments
Issue Links
- blocks
-
JAL-2656 More robust recognition of GZipped files - for local files and data retrieved via URL
- Closed