chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1762069 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/jav...
Date Fri, 23 Sep 2016 15:34:40 GMT
Author: fmui
Date: Fri Sep 23 15:34:40 2016
New Revision: 1762069

URL: http://svn.apache.org/viewvc?rev=1762069&view=rev
Log:
a few small improvments

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieStoreImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisHttpCookie.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/fractal/FractalGenerator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/loremipsum/LoremIpsum.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java?rev=1762069&r1=1762068&r2=1762069&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java
Fri Sep 23 15:34:40 2016
@@ -137,7 +137,9 @@ public class StandardAuthenticationProvi
         try {
             // cookies
             if (cookieManager != null) {
-                cookieManager.put(url, headers);
+                if (headers != null && headers.size() > 0) {
+                    cookieManager.put(url, headers);
+                }
             }
 
             // CSRF header

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieStoreImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieStoreImpl.java?rev=1762069&r1=1762068&r2=1762069&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieStoreImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisCookieStoreImpl.java
Fri Sep 23 15:34:40 2016
@@ -100,7 +100,7 @@ public class CmisCookieStoreImpl impleme
             if (cookie.hasExpired()) {
                 iter.remove();
             } else if ((!cookie.getSecure() || isSecure) && cookie.getDomain() !=
null) {
-                String cookieDomain = cookie.getDomain().toLowerCase();
+                String cookieDomain = cookie.getDomain().toLowerCase(Locale.ENGLISH);
 
                 if (isIPAddress(uriHost) && uriHost.equals(cookieDomain)) {
                     cookies.add(cookie);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisHttpCookie.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisHttpCookie.java?rev=1762069&r1=1762068&r2=1762069&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisHttpCookie.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/cookies/CmisHttpCookie.java
Fri Sep 23 15:34:40 2016
@@ -108,8 +108,8 @@ public final class CmisHttpCookie implem
         if (domain == null || host == null) {
             return false;
         }
-        String newDomain = domain.toLowerCase();
-        String newHost = host.toLowerCase();
+        String newDomain = domain.toLowerCase(Locale.ENGLISH);
+        String newHost = host.toLowerCase(Locale.ENGLISH);
 
         return newDomain.equals(newHost)
                 || (isValidDomain(newDomain) && effDomainMatches(newDomain, newHost)
&& isValidHost(newDomain, newHost));
@@ -253,7 +253,7 @@ public final class CmisHttpCookie implem
                     }
                 }
 
-                Setter setter = cookie.attributeSet.get(attrName.toLowerCase());
+                Setter setter = cookie.attributeSet.get(attrName.toLowerCase(Locale.ENGLISH));
                 if (setter != null && !setter.isSet()) {
                     String attrValue = matcher.group(2);
                     setter.validate(attrValue, cookie);
@@ -607,15 +607,15 @@ public final class CmisHttpCookie implem
     /**
      * Answers hash code of this http cookie. The result is calculated as below:
      * 
-     * getName().toLowerCase().hashCode() + getDomain().toLowerCase().hashCode()
-     * + getPath().hashCode()
+     * getName().toLowerCase(Locale.ENGLISH).hashCode() +
+     * getDomain().toLowerCase(Locale.ENGLISH).hashCode() + getPath().hashCode()
      * 
      * @return the hash code of this cookie
      */
     @Override
     public int hashCode() {
-        int hashCode = name.toLowerCase().hashCode();
-        hashCode += domain == null ? 0 : domain.toLowerCase().hashCode();
+        int hashCode = name.toLowerCase(Locale.ENGLISH).hashCode();
+        hashCode += domain == null ? 0 : domain.toLowerCase(Locale.ENGLISH).hashCode();
         hashCode += path == null ? 0 : path.hashCode();
         return hashCode;
     }
@@ -623,7 +623,8 @@ public final class CmisHttpCookie implem
     private boolean isValidName(String n) {
         // name cannot be empty or begin with '$' or equals the reserved
         // attributes (case-insensitive)
-        boolean isValid = !(n.length() == 0 || n.charAt(0) == '$' || attributeSet.containsKey(n.toLowerCase()));
+        boolean isValid = !(n.length() == 0 || n.charAt(0) == '$' || attributeSet.containsKey(n
+                .toLowerCase(Locale.ENGLISH)));
         if (isValid) {
             for (int i = 0; i < n.length(); i++) {
                 char nameChar = n.charAt(i);
@@ -680,7 +681,7 @@ public final class CmisHttpCookie implem
      *            the domain pattern
      */
     public void setDomain(String pattern) {
-        domain = pattern == null ? null : pattern.toLowerCase();
+        domain = pattern == null ? null : pattern.toLowerCase(Locale.ENGLISH);
     }
 
     /**

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java?rev=1762069&r1=1762068&r2=1762069&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java
Fri Sep 23 15:34:40 2016
@@ -206,10 +206,16 @@ public final class TypeUtils {
 
         if (type.isControllablePolicy() == null) {
             errors.add(new ValidationError("controllablePolicy", "ControllablePolicy flag
must be set."));
+        } else if (type.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY
+                && Boolean.TRUE.equals(type.isControllablePolicy())) {
+            errors.add(new ValidationError("controllablePolicy",
+                    "ControllablePolicy flag must be FALSE for secondary types."));
         }
 
         if (type.isControllableAcl() == null) {
             errors.add(new ValidationError("controllableACL", "ControllableACL flag must
be set."));
+        } else if (type.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY && Boolean.TRUE.equals(type.isControllableAcl()))
{
+            errors.add(new ValidationError("controllableACL", "ControllableACL flag must
be FALSE for secondary types."));
         }
 
         if (type.isFulltextIndexed() == null) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/fractal/FractalGenerator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/fractal/FractalGenerator.java?rev=1762069&r1=1762068&r2=1762069&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/fractal/FractalGenerator.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/fractal/FractalGenerator.java
Fri Sep 23 15:34:40 2016
@@ -133,14 +133,16 @@ public class FractalGenerator {
     }
 
     private void randomizeRect(ComplexRectangle rect) {
+        SecureRandom rnd = new SecureRandom();
+        
         double jitterFactor = 0.15; // +/- 15%
-        double ran = Math.random() * jitterFactor + (1.0 - jitterFactor);
+        double ran = rnd.nextDouble() * jitterFactor + (1.0 - jitterFactor);
         double width = rect.getWidth() * ran;
-        ran = Math.random() * jitterFactor + (1.0 - jitterFactor);
+        ran = rnd.nextDouble() * jitterFactor + (1.0 - jitterFactor);
         double height = rect.getHeight() * ran;
-        ran = Math.random() * jitterFactor + (1.0 - jitterFactor);
+        ran = rnd.nextDouble() * jitterFactor + (1.0 - jitterFactor);
         double r1 = (rect.getWidth() - width) * ran + rect.getRMin();
-        ran = Math.random() * jitterFactor + (1.0 - jitterFactor);
+        ran = rnd.nextDouble() * jitterFactor + (1.0 - jitterFactor);
         double i1 = (rect.getHeight() - height) * ran + rect.getIMin();
         rect.set(r1, r1 + width, i1, i1 + height);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/loremipsum/LoremIpsum.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/loremipsum/LoremIpsum.java?rev=1762069&r1=1762068&r2=1762069&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/loremipsum/LoremIpsum.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/content/loremipsum/LoremIpsum.java
Fri Sep 23 15:34:40 2016
@@ -675,10 +675,12 @@ public class LoremIpsum {
      *            The sigma of the distribution.
      */
     private static double randomNormal(double mu, double sigma) {
+        SecureRandom rnd = new SecureRandom();
+
         double z = 0.0d;
         while (true) {
-            double u1 = Math.random();
-            double u2 = 1.0d - Math.random();
+            double u1 = rnd.nextDouble();
+            double u2 = 1.0d - rnd.nextDouble();
             z = NV_MAGICCONST_ * (u1 - 0.5d) / u2;
             double zz = z * z / 4.0d;
             if (zz <= -Math.log(u2)) {



Mime
View raw message