Author: clopes
Date: 2012-10-23 09:40:59 -0700 (Tue, 23 Oct 2012)
New Revision: 30694

Modified:
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
Log:
Fixes #1539 (ClassCastException when opening a Cy2 session that has nested 
networks and discrete mappings for attribute "has_nested_network"):
It now always recreates the attribute "has_nested_network" as a Boolean-typed 
column when loading sessions or importing XGMML files; the value "yes" is 
converted to true.

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
 2012-10-22 23:04:02 UTC (rev 30693)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/ObjectTypeMap.java
 2012-10-23 16:40:59 UTC (rev 30694)
@@ -69,9 +69,10 @@
     }
     
     public static boolean fromXGMMLBoolean(final String s) {
-       // should be only "1", but let's be nice and also accept "true"
+       // Should be only "1", but let's be nice and also accept "true"
        // 
http://www.cs.rpi.edu/research/groups/pb/punin/public_html/XGMML/draft-xgmml-20001006.html#BT
-       return s != null && s.matches("(?i)1|true");
+       // We also accept "yes", because of Cy2 "has_nested_network" attribute
+       return s != null && s.matches("(?i)1|true|yes");
     }
 
     public static String toXGMMLBoolean(final Boolean value) {

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
    2012-10-22 23:04:02 UTC (rev 30693)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/AttributeValueUtil.java
    2012-10-23 16:40:59 UTC (rev 30694)
@@ -172,7 +172,11 @@
        ParseState parseState = ParseState.NONE;
        
        final String name = atts.getValue("name");
-       final String type = atts.getValue("type");
+       String type = atts.getValue("type");
+       
+       if ("has_nested_network".equals(name))
+               type = ObjectType.BOOLEAN.getName();
+       
        final boolean isEquation = 
ObjectTypeMap.fromXGMMLBoolean(atts.getValue("cy:equation"));
        final boolean isHidden = 
ObjectTypeMap.fromXGMMLBoolean(atts.getValue("cy:hidden"));
         

-- 
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