chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1745771 - in /chemistry/opencmis/trunk: chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/ chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apa...
Date Fri, 27 May 2016 16:31:25 GMT
Author: fmui
Date: Fri May 27 16:31:25 2016
New Revision: 1745771

URL: http://svn.apache.org/viewvc?rev=1745771&view=rev
Log:
minor improvements

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstraints.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstraints.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstraints.java?rev=1745771&r1=1745770&r2=1745771&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstraints.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstraints.java
Fri May 27 16:31:25 2016
@@ -28,26 +28,39 @@ public final class XMLConstraints {
     public static final int MAX_EXTENSIONS_WIDTH;
     public static final int MAX_EXTENSIONS_DEPTH;
 
+    public static final int MAX_EXTENSIONS_WIDTH_DEFAULT = 1000;
+    public static final int MAX_EXTENSIONS_DEPTH_DEFAULT = 100;
+
     public static final String MAX_EXTENSIONS_WIDTH_SYSTEM_PROPERTY = "org.apache.chemistry.opencmis.XMLConstraints.maxExtensionWith";
     public static final String MAX_EXTENSIONS_DEPTH_SYSTEM_PROPERTY = "org.apache.chemistry.opencmis.XMLConstraints.maxExtensionDepth";
 
     static {
-        int maxWidth = 1000;
+        int maxWidth = MAX_EXTENSIONS_WIDTH_DEFAULT;
         try {
             String maxWidthStr = System.getProperty(MAX_EXTENSIONS_WIDTH_SYSTEM_PROPERTY);
             if (maxWidthStr != null) {
                 maxWidth = Integer.parseInt(maxWidthStr);
+
+                // check for sane values
+                if (maxWidth < 1 || maxWidth > 100000) {
+                    maxWidth = MAX_EXTENSIONS_WIDTH_DEFAULT;
+                }
             }
         } catch (Exception e) {
             // ignore
         }
         MAX_EXTENSIONS_WIDTH = maxWidth;
 
-        int maxDepth = 100;
+        int maxDepth = MAX_EXTENSIONS_DEPTH_DEFAULT;
         try {
             String maxDepthStr = System.getProperty(MAX_EXTENSIONS_DEPTH_SYSTEM_PROPERTY);
             if (maxDepthStr != null) {
                 maxDepth = Integer.parseInt(maxDepthStr);
+
+                // check for sane values
+                if (maxDepth < 1 || maxDepth > 10000) {
+                    maxDepth = MAX_EXTENSIONS_DEPTH_DEFAULT;
+                }
             }
         } catch (Exception e) {
             // ignore

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java?rev=1745771&r1=1745770&r2=1745771&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/AbstractService.java
Fri May 27 16:31:25 2016
@@ -162,6 +162,9 @@ public abstract class AbstractService {
                 MessageContext.SERVLET_RESPONSE);
 
         CsrfManager cm = (CsrfManager) request.getAttribute(CmisWebServicesServlet.CSRF_MANAGER);
+        if (cm == null) {
+            throw new CmisRuntimeException("Cannot get CSRF manager!");
+        }
 
         cm.check(request, response, isRepositoryInfoRequest, false);
     }



Mime
View raw message