JAL-3026-JAL-3063 JAXB unmarshaller fix
authorhansonr <hansonr@STO24954W.ad.stolaf.edu>
Wed, 7 Nov 2018 13:40:57 +0000 (07:40 -0600)
committerhansonr <hansonr@STO24954W.ad.stolaf.edu>
Wed, 7 Nov 2018 18:02:57 +0000 (12:02 -0600)
src/jalview/project/Jalview2XML.java
swingjs/SwingJS-site.zip
swingjs/timestamp
swingjs/ver/3.2.4/SwingJS-site.zip
swingjs/ver/3.2.4/timestamp
temp/java50.jvx [new file with mode: 0644]
temp/java50b.jvx [new file with mode: 0644]

index 194cbf2..47a07a0 100644 (file)
@@ -1617,6 +1617,7 @@ public class Jalview2XML
       // using save and then load
       try
       {
+       fileName = fileName.replace('\\', '/');
         System.out.println("Writing jar entry " + fileName);
         JarEntry entry = new JarEntry(fileName);
         jout.putNextEntry(entry);
@@ -1797,6 +1798,7 @@ public class Jalview2XML
   {
     if (jout != null)
     {
+      jarEntryName = jarEntryName.replace('\\','/');
       System.out.println("Writing jar entry " + jarEntryName);
       jout.putNextEntry(new JarEntry(jarEntryName));
       DataOutputStream dout = new DataOutputStream(jout);
@@ -2523,68 +2525,52 @@ public class Jalview2XML
     return af;
   }
 
-  @SuppressWarnings("unused")
-private jarInputStreamProvider createjarInputStreamProvider(
-          final Object ofile) throws MalformedURLException
-  {
-       
-         // BH 2018 allow for bytes already attached to File object
-       final String file = ofile.toString();
-       byte[] bytes = /** @j2sNative ofile._bytes ||*/null;
-       if (bytes != null) {
-
-           return new jarInputStreamProvider()
-           {
-
-             @Override
-             public JarInputStream getJarInputStream() throws IOException
-             {
-                 return new JarInputStream(new ByteArrayInputStream(bytes));
-             }
-
-             @Override
-             public String getFilename()
-             {
-               return file;
-             }
-           };
-
+       @SuppressWarnings("unused")
+       private jarInputStreamProvider createjarInputStreamProvider(final Object ofile) throws MalformedURLException {
+
+               // BH 2018 allow for bytes already attached to File object
+               try {
+                       String file = (ofile instanceof File ? ((File) ofile).getCanonicalPath() : ofile.toString());
+                       byte[] bytes = /** @j2sNative ofile._bytes || */
+                                       null;
+                       URL url = null;
+                       errorMessage = null;
+                       uniqueSetSuffix = null;
+                       seqRefIds = null;
+                       viewportsAdded.clear();
+                       frefedSequence = null;
+
+                       if (file.startsWith("http://")) {
+                               url = new URL(file);
+                       }
+                       final URL _url = url;
+                       return new jarInputStreamProvider() {
+
+                               @Override
+                               public JarInputStream getJarInputStream() throws IOException {
+                                       if (bytes != null) {
+                                               System.out.println("Jalview2XML: opening byte jarInputStream for bytes.length=" + bytes.length);
+                                               return new JarInputStream(new ByteArrayInputStream(bytes));
+                                       }
+                                       if (_url != null) {
+                                               System.out.println("Jalview2XML: opening url jarInputStream for " + _url);
+                                               return new JarInputStream(_url.openStream());
+                                       } else {
+                                               System.out.println("Jalview2XML: opening file jarInputStream for " + file);
+                                               return new JarInputStream(new FileInputStream(file));
+                                       }
+                               }
+
+                               @Override
+                               public String getFilename() {
+                                       return file;
+                               }
+                       };
+               } catch (IOException e) {
+                       e.printStackTrace();
+                       return null;
+               }
        }
-    URL url = null;
-    errorMessage = null;
-    uniqueSetSuffix = null;
-    seqRefIds = null;
-    viewportsAdded.clear();
-    frefedSequence = null;
-
-    if (file.startsWith("http://"))
-    {
-      url = new URL(file);
-    }
-    final URL _url = url;
-    return new jarInputStreamProvider()
-    {
-
-      @Override
-      public JarInputStream getJarInputStream() throws IOException
-      {
-        if (_url != null)
-        {
-          return new JarInputStream(_url.openStream());
-        }
-        else
-        {
-          return new JarInputStream(new FileInputStream(file));
-        }
-      }
-
-      @Override
-      public String getFilename()
-      {
-        return file;
-      }
-    };
-  }
 
   /**
    * Recover jalview session from a jalview project archive. Caller may
@@ -2622,6 +2608,7 @@ private jarInputStreamProvider createjarInputStreamProvider(
         for (int i = 0; i < entryCount; i++)
         {
           jarentry = jin.getNextJarEntry();
+          System.out.println("Jalview2XML#loadJalviewAlign: jarentry=" + (jarentry == null ? null : jarentry.getName()));
         }
 
         if (jarentry != null && jarentry.getName().endsWith(".xml"))
@@ -2637,7 +2624,7 @@ private jarInputStreamProvider createjarInputStreamProvider(
           JAXBElement<JalviewModel> jbe = um
                   .unmarshal(streamReader, JalviewModel.class);
           JalviewModel object = jbe.getValue();
-
+          System.out.println("processing JalviewModel object=" + object);
           /*
           Unmarshaller unmar = new Unmarshaller(object);
           unmar.setValidation(false);
@@ -2984,6 +2971,7 @@ private jarInputStreamProvider createjarInputStreamProvider(
       do
       {
         entry = jin.getNextJarEntry();
+       System.out.println("Jalview2XML#copyJarEntry: jarentry=" + (entry == null ? null : entry.getName()));
       } while (entry != null && !entry.getName().equals(jarEntryName));
       if (entry != null)
       {
@@ -5821,6 +5809,7 @@ private jarInputStreamProvider createjarInputStreamProvider(
       do
       {
         entry = jin.getNextJarEntry();
+       System.out.println("Jalview2XML#readJarEntry: jarentry=" + (entry == null ? null : entry.getName()));
       } while (entry != null && !entry.getName().equals(jarEntryName));
 
       if (entry != null)
index cc475bd..8cc1b55 100644 (file)
Binary files a/swingjs/SwingJS-site.zip and b/swingjs/SwingJS-site.zip differ
index ddd7e58..d13d0d7 100644 (file)
@@ -1 +1 @@
-20181106221821 
+20181107115918 
index cc475bd..8cc1b55 100644 (file)
Binary files a/swingjs/ver/3.2.4/SwingJS-site.zip and b/swingjs/ver/3.2.4/SwingJS-site.zip differ
index ddd7e58..d13d0d7 100644 (file)
@@ -1 +1 @@
-20181106221821 
+20181107115918 
diff --git a/temp/java50.jvx b/temp/java50.jvx
new file mode 100644 (file)
index 0000000..8bd396a
Binary files /dev/null and b/temp/java50.jvx differ
diff --git a/temp/java50b.jvx b/temp/java50b.jvx
new file mode 100644 (file)
index 0000000..3926122
Binary files /dev/null and b/temp/java50b.jvx differ