wink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r1029772 - in /incubator/wink/trunk: wink-common/src/main/java/org/apache/wink/common/model/atom/ wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/
Date Mon, 01 Nov 2010 17:58:16 GMT
Author: bluk
Date: Mon Nov  1 17:58:15 2010
New Revision: 1029772

URL: http://svn.apache.org/viewvc?rev=1029772&view=rev
Log:
Lazily initialize AtomCommonAttributes(SimpleContent)

See [WINK-325]

Thanks to Kaloyan Kolev for reporting the issue.

Modified:
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributes.java
    incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributesSimpleContent.java
    incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JAXBCollectionJSONTest.java
    incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JacksonJAXBTest.java

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributes.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributes.java?rev=1029772&r1=1029771&r2=1029772&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributes.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributes.java
Mon Nov  1 17:58:15 2010
@@ -73,7 +73,7 @@ public class AtomCommonAttributes {
     @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
     protected String           lang;
     @XmlAnyAttribute
-    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+    private Map<QName, String> otherAttributes;
 
     public AtomCommonAttributes() {
     }
@@ -135,6 +135,9 @@ public class AtomCommonAttributes {
      * @return always non-null
      */
     public Map<QName, String> getOtherAttributes() {
+        if (otherAttributes == null) {
+            otherAttributes = new HashMap<QName, String>();
+        }
         return otherAttributes;
     }
 

Modified: incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributesSimpleContent.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributesSimpleContent.java?rev=1029772&r1=1029771&r2=1029772&view=diff
==============================================================================
--- incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributesSimpleContent.java
(original)
+++ incubator/wink/trunk/wink-common/src/main/java/org/apache/wink/common/model/atom/AtomCommonAttributesSimpleContent.java
Mon Nov  1 17:58:15 2010
@@ -75,7 +75,7 @@ public class AtomCommonAttributesSimpleC
     @XmlAttribute(namespace = "http://www.w3.org/XML/1998/namespace")
     protected String           lang;
     @XmlAnyAttribute
-    private Map<QName, String> otherAttributes = new HashMap<QName, String>();
+    private Map<QName, String> otherAttributes;
 
     public AtomCommonAttributesSimpleContent() {
     }
@@ -153,6 +153,9 @@ public class AtomCommonAttributesSimpleC
      * @return always non-null
      */
     public Map<QName, String> getOtherAttributes() {
+        if (otherAttributes == null) {
+            otherAttributes = new HashMap<QName, String>();
+        }
         return otherAttributes;
     }
 

Modified: incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JAXBCollectionJSONTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JAXBCollectionJSONTest.java?rev=1029772&r1=1029771&r2=1029772&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JAXBCollectionJSONTest.java
(original)
+++ incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JAXBCollectionJSONTest.java
Mon Nov  1 17:58:15 2010
@@ -72,24 +72,24 @@ public class JAXBCollectionJSONTest exte
                                                             + "</entry>";
 
     private static final String ENTRY_STR_JSON_1    =
-                                                        "{\"base\":\"http://b216:8080/reporting/reports\","
+ "\"otherAttributes\":{},"
+                                                        "{\"base\":\"http://b216:8080/reporting/reports\","
+ ""
                                                             + "\"id\":\"toptenvalidators\","
                                                             + "\"updated\":1251743402000,"
-                                                            + "\"title\":{\"lang\":\"en\",\"otherAttributes\":{},\"type\":\"text\"},"
+                                                            + "\"title\":{\"lang\":\"en\",\"type\":\"text\"},"
                                                             + "\"published\":1251743402000,"
-                                                            + "\"link\":[{\"otherAttributes\":{},\"rel\":\"alternate\",\"type\":\"application/json\",\"href\":\"http://b216:8080/reporting/reports/toptenvalidators?alt=application/json\"}],"
+                                                            + "\"link\":[{\"rel\":\"alternate\",\"type\":\"application/json\",\"href\":\"http://b216:8080/reporting/reports/toptenvalidators?alt=application/json\"}],"
                                                             + "\"author\":[{\"name\":\"admin
1\"}],"
-                                                            + "\"category\":[{\"otherAttributes\":{},\"term\":\"urn:com:systinet:reporting:kind:definition\",\"scheme\":\"urn:com:systinet:reporting:kind\",\"label\":\"report
definition\"}]"
+                                                            + "\"category\":[{\"term\":\"urn:com:systinet:reporting:kind:definition\",\"scheme\":\"urn:com:systinet:reporting:kind\",\"label\":\"report
definition\"}]"
                                                             + "}";
     private static final String ENTRY_STR_JSON_2    =
-                                                        "{\"base\":\"http://b216:8080/reporting/reports\","
+ "\"otherAttributes\":{},"
+                                                        "{\"base\":\"http://b216:8080/reporting/reports\","
+ ""
                                                             + "\"id\":\"toptenvalidators\","
                                                             + "\"updated\":1251743402000,"
-                                                            + "\"title\":{\"lang\":\"en\",\"otherAttributes\":{},\"type\":\"text\"},"
+                                                            + "\"title\":{\"lang\":\"en\",\"type\":\"text\"},"
                                                             + "\"published\":1251743402000,"
-                                                            + "\"link\":[{\"otherAttributes\":{},\"rel\":\"alternate\",\"type\":\"application/json\",\"href\":\"http://b216:8080/reporting/reports/toptenvalidators?alt=application/json\"}],"
+                                                            + "\"link\":[{\"rel\":\"alternate\",\"type\":\"application/json\",\"href\":\"http://b216:8080/reporting/reports/toptenvalidators?alt=application/json\"}],"
                                                             + "\"author\":[{\"name\":\"admin
2\"}],"
-                                                            + "\"category\":[{\"otherAttributes\":{},\"term\":\"urn:com:systinet:reporting:kind:definition\",\"scheme\":\"urn:com:systinet:reporting:kind\",\"label\":\"report
definition\"}]"
+                                                            + "\"category\":[{\"term\":\"urn:com:systinet:reporting:kind:definition\",\"scheme\":\"urn:com:systinet:reporting:kind\",\"label\":\"report
definition\"}]"
                                                             + "}";
 
     private static final String ENTRY_STR_JSON_GET  =

Modified: incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JacksonJAXBTest.java
URL: http://svn.apache.org/viewvc/incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JacksonJAXBTest.java?rev=1029772&r1=1029771&r2=1029772&view=diff
==============================================================================
--- incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JacksonJAXBTest.java
(original)
+++ incubator/wink/trunk/wink-providers/wink-jackson-provider/src/test/java/org/apache/wink/providers/jackson/internal/JacksonJAXBTest.java
Mon Nov  1 17:58:15 2010
@@ -220,18 +220,18 @@ public class JacksonJAXBTest extends Moc
                                                             + "</entry>\n";
 
     private static final String ENTRY_STR_JSON_POST =
-                                                        "{" + "\"id\":\"top ten validators\",\"updated\":@TIME_JSON@,\"title\":{\"lang\":\"en\",\"otherAttributes\":{},\"any\":[\"top
ten validators\"],\"type\":\"text\"}"
+                                                        "{" + "\"id\":\"top ten validators\",\"updated\":@TIME_JSON@,\"title\":{\"lang\":\"en\",\"any\":[\"top
ten validators\"],\"type\":\"text\"}"
                                                             + "}";
 
     private static final String ENTRY_STR_JSON      =
-                                                        "{\"base\":\"http://b216:8080/reporting/reports\","
+ "\"otherAttributes\":{},"
+                                                        "{\"base\":\"http://b216:8080/reporting/reports\","
+ ""
                                                             + "\"id\":\"toptenvalidators\","
                                                             + "\"updated\":1251743402000,"
-                                                            + "\"title\":{\"lang\":\"en\",\"otherAttributes\":{},\"type\":\"text\"},"
+                                                            + "\"title\":{\"lang\":\"en\",\"type\":\"text\"},"
                                                             + "\"published\":1251743402000,"
-                                                            + "\"link\":[{\"otherAttributes\":{},\"rel\":\"alternate\",\"type\":\"application/json\",\"href\":\"http://b216:8080/reporting/reports/toptenvalidators?alt=application/json\"}],"
+                                                            + "\"link\":[{\"rel\":\"alternate\",\"type\":\"application/json\",\"href\":\"http://b216:8080/reporting/reports/toptenvalidators?alt=application/json\"}],"
                                                             + "\"author\":[{\"name\":\"admin\"}],"
-                                                            + "\"category\":[{\"otherAttributes\":{},\"term\":\"urn:com:systinet:reporting:kind:definition\",\"scheme\":\"urn:com:systinet:reporting:kind\",\"label\":\"report
definition\"}]"
+                                                            + "\"category\":[{\"term\":\"urn:com:systinet:reporting:kind:definition\",\"scheme\":\"urn:com:systinet:reporting:kind\",\"label\":\"report
definition\"}]"
                                                             + "}";
 
     private static final String ENTRY_STR_JSON_GET  =



Mime
View raw message