abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r433333 - /incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
Date Mon, 21 Aug 2006 19:26:24 GMT
Author: jmsnell
Date: Mon Aug 21 12:26:23 2006
New Revision: 433333

URL: http://svn.apache.org/viewvc?rev=433333&view=rev
Log:
Fix NPE's and remove attributes is value == null

Modified:
    incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java

Modified: incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java?rev=433333&r1=433332&r2=433333&view=diff
==============================================================================
--- incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
(original)
+++ incubator/abdera/java/trunk/parser/src/main/java/org/apache/abdera/parser/stax/FOMLink.java
Mon Aug 21 12:26:23 2006
@@ -148,7 +148,10 @@
   }
 
   public void setHrefLang(String lang) {
-    setAttributeValue(HREFLANG, lang);
+    if (lang != null)
+      setAttributeValue(HREFLANG, lang);
+    else 
+      removeAttribute(HREFLANG);
   }
 
   public String getTitle() {
@@ -156,7 +159,10 @@
   }
 
   public void setTitle(String title) {
-    setAttributeValue(ATITLE, title);
+    if (title != null)
+      setAttributeValue(ATITLE, title);
+    else 
+      removeAttribute(ATITLE);
   }
 
   public long getLength() {
@@ -165,7 +171,10 @@
   }
 
   public void setLength(long length) {
-    setAttributeValue(LENGTH, (length >= 0) ? String.valueOf(length) : "0");
+    if (length > -1)
+      setAttributeValue(LENGTH, (length >= 0) ? String.valueOf(length) : "0");
+    else
+      removeAttribute(LENGTH);
   }
 
   



Mime
View raw message