oodt-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mattm...@apache.org
Subject svn commit: r1128938 - in /oodt/trunk: CHANGES.txt filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
Date Sun, 29 May 2011 19:10:12 GMT
Author: mattmann
Date: Sun May 29 19:10:12 2011
New Revision: 1128938

URL: http://svn.apache.org/viewvc?rev=1128938&view=rev
Log:
- fix for OODT-197 Null descriptions from elements.xml cause NPE when writing elements.xml
file back out

Modified:
    oodt/trunk/CHANGES.txt
    oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java

Modified: oodt/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/oodt/trunk/CHANGES.txt?rev=1128938&r1=1128937&r2=1128938&view=diff
==============================================================================
--- oodt/trunk/CHANGES.txt (original)
+++ oodt/trunk/CHANGES.txt Sun May 29 19:10:12 2011
@@ -4,6 +4,9 @@ Apache OODT Change Log
 Release 0.3-SNAPSHOT (in progress)
 --------------------------------------------
 
+* OODT-197 Null descriptions from elements.xml cause NPE when writing 
+  elements.xml file back out (mattmann, Michael Starch)
+
 * OODT-193 PGE ExternMetExtractor MetWriter (bfoster, mattmann)
 
 * OODT-192 PGE FilenameExtractorMetWriter (mattmann)

Modified: oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
URL: http://svn.apache.org/viewvc/oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java?rev=1128938&r1=1128937&r2=1128938&view=diff
==============================================================================
--- oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
(original)
+++ oodt/trunk/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
Sun May 29 19:10:12 2011
@@ -290,17 +290,17 @@ public final class XmlStructFactory {
             for (Iterator<org.apache.oodt.cas.filemgr.structs.Element> i = elements.iterator();
i.hasNext();) {
                 org.apache.oodt.cas.filemgr.structs.Element element = i.next();
                 Element elementElem = document.createElement("element");
-                elementElem.setAttribute("id", element.getElementId());
-                elementElem.setAttribute("name", element.getElementName());
+                elementElem.setAttribute("id", friendlyXml(element.getElementId()));
+                elementElem.setAttribute("name", friendlyXml(element.getElementName()));
 
                 Element descriptionElem = document.createElement("description");
-                descriptionElem.appendChild(document.createTextNode(element
-                        .getDescription()));
+                descriptionElem.appendChild(document.createTextNode(friendlyXml(element
+                        .getDescription())));
                 elementElem.appendChild(descriptionElem);
 
                 Element dcElementElem = document.createElement("dcElement");
-                dcElementElem.appendChild(document.createTextNode(element
-                        .getDCElement() != null ? element.getDCElement() : ""));
+                dcElementElem.appendChild(document.createTextNode(friendlyXml(element
+                        .getDCElement())));
                 elementElem.appendChild(dcElementElem);
                 
                 root.appendChild(elementElem);
@@ -423,5 +423,9 @@ public final class XmlStructFactory {
         productTypeElementMap.put(typeId, elementList);
         return productTypeElementMap;
     }
+    
+    private static String friendlyXml(String value){
+      return value != null ? value:"";
+    }
 
 }



Mime
View raw message