Author: kono
Date: 2012-08-16 14:34:03 -0700 (Thu, 16 Aug 2012)
New Revision: 30208

Modified:
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/VisualStyleSerializer.java
Log:
Type checker added  to avoid class cast exception caused by invalid data type.

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/VisualStyleSerializer.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/VisualStyleSerializer.java
        2012-08-16 20:13:43 UTC (rev 30207)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/VisualStyleSerializer.java
        2012-08-16 21:34:03 UTC (rev 30208)
@@ -310,8 +310,16 @@
                                                for (Map.Entry<?, ?> entry : 
map.entrySet()) {
                                                        DiscreteMappingEntry 
entryModel = new DiscreteMappingEntry();
                                                        
entryModel.setAttributeValue(entry.getKey().toString());
-                                                       
entryModel.setValue(vp.toSerializableString(entry.getValue()));
-       
+                                                       final Object value = 
entry.getValue();
+                                                       if (value == null)
+                                                               continue;
+
+                                                       if (value != null && 
vp.getRange().getType() != value.getClass())
+                                                               
logger.warn("Invalid value: Expected Data Type is " + vp.getRange().getType()
+                                                                               
+ ", but actual value is " + value.getClass());
+                                                       else
+                                                               
entryModel.setValue(vp.toSerializableString(value));
+
                                                        
dmModel.getDiscreteMappingEntry().add(entryModel);
                                                }
        

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