Revision: 15912
http://gate.svn.sourceforge.net/gate/?rev=15912&view=rev
Author: valyt
Date: 2012-07-03 14:04:40 +0000 (Tue, 03 Jul 2012)
Log Message:
-----------
When a feature key/value is a collection taht contains a null value, don't
write it out (instead of just fairing an NPE, as it does now).
Modified Paths:
--------------
gate/trunk/src/gate/corpora/DocumentStaxUtils.java
Modified: gate/trunk/src/gate/corpora/DocumentStaxUtils.java
===================================================================
--- gate/trunk/src/gate/corpora/DocumentStaxUtils.java 2012-07-03 03:10:55 UTC
(rev 15911)
+++ gate/trunk/src/gate/corpora/DocumentStaxUtils.java 2012-07-03 14:04:40 UTC
(rev 15912)
@@ -1308,7 +1308,7 @@
Set keySet = features.keySet();
Iterator keySetIterator = keySet.iterator();
- while(keySetIterator.hasNext()) {
+ FEATURES:while(keySetIterator.hasNext()) {
Object key = keySetIterator.next();
Object value = features.get(key);
if(key != null && value != null) {
@@ -1352,6 +1352,7 @@
Iterator iter = ((Collection)key).iterator();
if(iter.hasNext()) {
item = iter.next();
+ if(item == null) continue FEATURES;
if(item instanceof java.lang.Number)
keyItemClassName = item.getClass().getName();
else keyItemClassName = String.class.getName();
@@ -1359,6 +1360,7 @@
}// End if
while(iter.hasNext()) {
item = iter.next();
+ if(item == null) continue FEATURES;
keyStrBuff.append(";").append(item.toString());
}// End while
key2String = keyStrBuff.toString();
@@ -1371,6 +1373,7 @@
Iterator iter = ((Collection)value).iterator();
if(iter.hasNext()) {
item = iter.next();
+ if(item == null) continue FEATURES;
if(item instanceof java.lang.Number
|| item instanceof java.lang.Boolean)
valueItemClassName = item.getClass().getName();
@@ -1379,6 +1382,7 @@
}// End if
while(iter.hasNext()) {
item = iter.next();
+ if(item == null) continue FEATURES;
valueStrBuff.append(";").append(item.toString());
}// End while
value2String = valueStrBuff.toString();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs