Author: noelr
Date: 2009-08-14 07:58:05 -0700 (Fri, 14 Aug 2009)
New Revision: 17824

Added:
   cytoscape/trunk/testData/Bug1929TestD.cys
Modified:
   cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java
   cytoscape/trunk/tests/cytoscape/data/readers/CytoscapeSessionReaderTest.java
Log:
Updated fix for Bug 1929 to handle spaces correctly

Modified: cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java      
2009-08-14 14:11:16 UTC (rev 17823)
+++ cytoscape/trunk/src/cytoscape/data/readers/CytoscapeSessionReader.java      
2009-08-14 14:58:05 UTC (rev 17824)
@@ -277,6 +277,7 @@
                     // All other "/" are eliminated by 
CytoscapeSessionWriter.getValidFileName
                     // URLEncoding the remainder of entryName makes sure the 
URL is valid
                     // without the need to eliminate additional characters 
when creating the filename.
+                    // Spaces require special treatment, need to be encoded as 
"%20" not "+"
                     int sp;
                     String entryDir;
                     String entryRest;
@@ -289,7 +290,7 @@
                         entryRest = entryRest.substring(sp + 1);
                     }
 
-                    URL networkURL = new URL("jar:" + sourceURL.toString() + 
"!/" + entryDir + URLEncoder.encode(entryRest, "UTF-8"));
+                    URL networkURL = new URL("jar:" + sourceURL.toString() + 
"!/" + entryDir + URLEncoder.encode(entryRest, "UTF-8").replace("+", "%20"));
                     networkURLs.put(entryName, networkURL);
                     networkCounter++;
                 } else if (entryName.endsWith(BOOKMARKS_FILE)) {
@@ -622,13 +623,18 @@
                                              .getComponents();
 
                for (int i = 0; i < desktopFrames.length; i++) {
-                       JInternalFrame frame = (JInternalFrame) 
desktopFrames[i];
-                       NetworkFrame nFrame = (NetworkFrame) 
frameMap.get(frame.getTitle());
+            Component cmp;
 
-                       if (nFrame != null) {
-                               frame.setSize(nFrame.getWidth().intValue(), 
nFrame.getHeight().intValue());
-                               frame.setLocation(nFrame.getX().intValue(), 
nFrame.getY().intValue());
-                       }
+            cmp = desktopFrames[i];
+            if (cmp instanceof JInternalFrame) {
+                JInternalFrame frame = (JInternalFrame)cmp;
+                NetworkFrame nFrame = frameMap.get(frame.getTitle());
+
+                if (nFrame != null) {
+                    frame.setSize(nFrame.getWidth().intValue(), 
nFrame.getHeight().intValue());
+                    frame.setLocation(nFrame.getX().intValue(), 
nFrame.getY().intValue());
+                }
+            }
                }
        }
 

Added: cytoscape/trunk/testData/Bug1929TestD.cys
===================================================================
(Binary files differ)


Property changes on: cytoscape/trunk/testData/Bug1929TestD.cys
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: 
cytoscape/trunk/tests/cytoscape/data/readers/CytoscapeSessionReaderTest.java
===================================================================
--- 
cytoscape/trunk/tests/cytoscape/data/readers/CytoscapeSessionReaderTest.java    
    2009-08-14 14:11:16 UTC (rev 17823)
+++ 
cytoscape/trunk/tests/cytoscape/data/readers/CytoscapeSessionReaderTest.java    
    2009-08-14 14:58:05 UTC (rev 17824)
@@ -52,28 +52,37 @@
     // one of the PluginManager tests when run using "ant test"
     // All tests function undisturbed when run using "ant test-slow"
 //    public void testBug0001929a() throws Exception {
-//             CytoscapeSessionReader sr;
+//               CytoscapeSessionReader sr;
 //
-//     Cytoscape.buildOntologyServer();
-//     sr = new CytoscapeSessionReader("testData/Bug1929TestA.cys", null);
+//       Cytoscape.buildOntologyServer();
+//       sr = new CytoscapeSessionReader("testData/Bug1929TestA.cys", null);
 //        sr.read();
 //    }
 //
 //    public void testBug0001929b() throws Exception {
-//             CytoscapeSessionReader sr;
+//               CytoscapeSessionReader sr;
 //
 //        //new CytoscapeInit().init(null);
-//     Cytoscape.buildOntologyServer();
-//     sr = new CytoscapeSessionReader("testData/Bug1929TestB.cys", null);
+//       Cytoscape.buildOntologyServer();
+//       sr = new CytoscapeSessionReader("testData/Bug1929TestB.cys", null);
 //        sr.read();
 //    }
 //
 //    public void testBug0001929c() throws Exception {
-//             CytoscapeSessionReader sr;
+//               CytoscapeSessionReader sr;
 //
 //        //new CytoscapeInit().init(null);
-//     Cytoscape.buildOntologyServer();
-//     sr = new CytoscapeSessionReader("testData/Bug1929TestC.cys", null);
+//       Cytoscape.buildOntologyServer();
+//       sr = new CytoscapeSessionReader("testData/Bug1929TestC.cys", null);
 //        sr.read();
 //    }
+//
+//    public void testBug0001929d() throws Exception {
+//        CytoscapeSessionReader sr;
+//
+//        //new CytoscapeInit().init(null);
+//       Cytoscape.buildOntologyServer();
+//       sr = new CytoscapeSessionReader("testData/Bug1929TestD.cys", null);
+//        sr.read();
+//    }
 }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to