Uploaded image for project: 'Jalview'
  1. Jalview
  2. JAL-3744

Cannot read Gzip file in JalviewJS

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Being tested
    • Priority: Blocker
    • Resolution: Unresolved
    • Affects Version/s: 2.11.1.1
    • Fix Version/s: 2.11.1_js, 2.11.2
    • 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(.,.,.)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jprocter Jim Procter
              Reporter:
              soares Ben Soares
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated: