cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject git commit: [CXF-5580] Trunk: Checking the legacy depth properties in JSONProvider only
Date Fri, 28 Feb 2014 14:21:02 GMT
Repository: cxf
Updated Branches:
  refs/heads/master 94297be9d -> 276343f2b


[CXF-5580] Trunk: Checking the legacy depth properties in JSONProvider only


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/276343f2
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/276343f2
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/276343f2

Branch: refs/heads/master
Commit: 276343f2bbe1daecefcc1c18d5cb5e48b75a90d4
Parents: 94297be
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Fri Feb 28 14:20:47 2014 +0000
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Fri Feb 28 14:20:47 2014 +0000

----------------------------------------------------------------------
 .../jaxrs/provider/AbstractJAXBProvider.java    | 25 +----------------
 .../cxf/jaxrs/provider/json/JSONProvider.java   | 28 ++++++++++++++++++++
 2 files changed, 29 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/276343f2/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
----------------------------------------------------------------------
diff --git a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
index 4d7796a..90149ec 100644
--- a/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
+++ b/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/provider/AbstractJAXBProvider.java
@@ -799,30 +799,7 @@ public abstract class AbstractJAXBProvider<T> extends AbstractConfigurableProvid
     }
     
     protected DocumentDepthProperties getDepthProperties() {
-        if (depthProperties != null) {
-            return depthProperties;
-        }
-        if (getContext() != null) {
-            String totalElementCountStr = (String)getContext().getContextualProperty(
-                DocumentDepthProperties.TOTAL_ELEMENT_COUNT);
-            String innerElementCountStr = (String)getContext().getContextualProperty(
-                DocumentDepthProperties.INNER_ELEMENT_COUNT);
-            String elementLevelStr = (String)getContext().getContextualProperty(
-                DocumentDepthProperties.INNER_ELEMENT_LEVEL);
-            if (totalElementCountStr != null || innerElementCountStr != null || elementLevelStr
!= null) {
-                try {
-                    int totalElementCount = totalElementCountStr != null 
-                        ? Integer.valueOf(totalElementCountStr) : -1;
-                    int elementLevel = elementLevelStr != null ? Integer.valueOf(elementLevelStr)
: -1;
-                    int innerElementCount = innerElementCountStr != null 
-                        ? Integer.valueOf(innerElementCountStr) : -1;
-                    return new DocumentDepthProperties(totalElementCount, elementLevel, innerElementCount);
-                } catch (Exception ex) {
-                    throw ExceptionUtils.toInternalServerErrorException(ex, null);
-                }
-            }
-        }
-        return null;
+        return depthProperties;
     }
     
     public void setValidateBeforeWrite(boolean validateBeforeWrite) {

http://git-wip-us.apache.org/repos/asf/cxf/blob/276343f2/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
index 1ad3f0e..a1051c2 100644
--- a/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
+++ b/rt/rs/extensions/providers/src/main/java/org/apache/cxf/jaxrs/provider/json/JSONProvider.java
@@ -71,6 +71,7 @@ import org.apache.cxf.jaxrs.utils.HttpUtils;
 import org.apache.cxf.jaxrs.utils.InjectionUtils;
 import org.apache.cxf.jaxrs.utils.JAXBUtils;
 import org.apache.cxf.message.MessageUtils;
+import org.apache.cxf.staxutils.DocumentDepthProperties;
 import org.apache.cxf.staxutils.StaxUtils;
 import org.apache.cxf.staxutils.W3CDOMStreamWriter;
 import org.codehaus.jettison.JSONSequenceTooLargeException;
@@ -647,4 +648,31 @@ public class JSONProvider<T> extends AbstractJAXBProvider<T>
 {
         this.ignoreEmptyArrayValues = ignoreEmptyArrayElements;
     }
 
+    protected DocumentDepthProperties getDepthProperties() {
+        DocumentDepthProperties depthProperties = super.getDepthProperties();
+        if (depthProperties != null) {
+            return depthProperties;
+        }
+        if (getContext() != null) {
+            String totalElementCountStr = (String)getContext().getContextualProperty(
+                DocumentDepthProperties.TOTAL_ELEMENT_COUNT);
+            String innerElementCountStr = (String)getContext().getContextualProperty(
+                DocumentDepthProperties.INNER_ELEMENT_COUNT);
+            String elementLevelStr = (String)getContext().getContextualProperty(
+                DocumentDepthProperties.INNER_ELEMENT_LEVEL);
+            if (totalElementCountStr != null || innerElementCountStr != null || elementLevelStr
!= null) {
+                try {
+                    int totalElementCount = totalElementCountStr != null 
+                        ? Integer.valueOf(totalElementCountStr) : -1;
+                    int elementLevel = elementLevelStr != null ? Integer.valueOf(elementLevelStr)
: -1;
+                    int innerElementCount = innerElementCountStr != null 
+                        ? Integer.valueOf(innerElementCountStr) : -1;
+                    return new DocumentDepthProperties(totalElementCount, elementLevel, innerElementCount);
+                } catch (Exception ex) {
+                    throw ExceptionUtils.toInternalServerErrorException(ex, null);
+                }
+            }
+        }
+        return null;
+    }
 }


Mime
View raw message