chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1606112 [2/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-binding...
Date Fri, 27 Jun 2014 14:51:24 GMT
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.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/browser/ObjectService.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.server.impl.browser;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
 import static org.apache.chemistry.opencmis.commons.impl.Constants.MEDIATYPE_OCTETSTREAM;
 import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_ACL;
 import static org.apache.chemistry.opencmis.commons.impl.Constants.PARAM_ALLOWABLE_ACTIONS;
@@ -423,7 +425,7 @@ public class ObjectService {
             List<String> objectIds = cp.getValues(Constants.CONTROL_OBJECT_ID);
             List<String> changeTokens = cp.getValues(Constants.CONTROL_CHANGE_TOKEN);
 
-            if (objectIds == null || objectIds.size() == 0) {
+            if (isNullOrEmpty(objectIds)) {
                 throw new CmisInvalidArgumentException("No object ids provided!");
             }
 
@@ -739,7 +741,7 @@ public class ObjectService {
 
             response.setStatus(HttpServletResponse.SC_OK);
 
-            if ((ftd != null) && (ftd.getIds() != null) && (ftd.getIds().size()
> 0)) {
+            if (ftd != null && isNotEmpty(ftd.getIds())) {
                 JSONObject jsonObject = JSONConverter.convert(ftd);
                 writeJSON(jsonObject, request, response);
                 return;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/WebSphereAuthHandler.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/WebSphereAuthHandler.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/WebSphereAuthHandler.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/WebSphereAuthHandler.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.server.impl.webservices;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.io.StringReader;
 import java.util.HashMap;
 import java.util.List;
@@ -60,7 +62,7 @@ public class WebSphereAuthHandler extend
 
         if (requestHeaders != null) {
             List<String> secHeaders = requestHeaders.get(WSSE_SECURITY);
-            if (secHeaders != null && secHeaders.size() > 0) {
+            if (isNotEmpty(secHeaders)) {
                 try {
                     Unmarshaller unmarshaller = WSSE_CONTEXT.createUnmarshaller();
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.server.support;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
@@ -97,7 +99,7 @@ public final class TypeValidator {
                 }
             }
 
-            if (propDef.getChoices() != null && propDef.getChoices().size() >
0) {
+            if (isNotEmpty(propDef.getChoices())) {
                 validateChoices(propDef, prop);
             }
         }
@@ -166,10 +168,10 @@ public final class TypeValidator {
         private List<T> getAllowedValues(List<Choice<T>> choices) {
             List<T> allowedValues = new ArrayList<T>(choices.size());
             for (Choice<T> choice : choices) {
-                if (choice.getValue() != null && !choice.getValue().isEmpty()) {
+                if (isNotEmpty(choice.getValue())) {
                     allowedValues.add(choice.getValue().get(0));
                 }
-                if (choice.getChoice() != null && !choice.getChoice().isEmpty())
{
+                if (isNotEmpty(choice.getChoice())) {
                     List<Choice<T>> x = choice.getChoice();
                     allowedValues.addAll(getAllowedValues(x));
                 }
@@ -372,7 +374,7 @@ public final class TypeValidator {
     }
 
     protected static void validateAllowedTypes(TypeDefinition typeDef, List<String>
allowedTypes, String description) {
-        if (null == allowedTypes || allowedTypes.size() == 0) {
+        if (isNullOrEmpty(allowedTypes)) {
             return; // all types are allowed
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/src/test/java/org/apache/chemistry/opencmis/fit/tck/AbstractTckIT.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.fit.tck;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
@@ -157,7 +158,7 @@ public abstract class AbstractTckIT exte
     }
 
     public static CmisTestResultStatus getWorst(List<CmisTestResult> results) {
-        if ((results == null) || (results.isEmpty())) {
+        if (isNullOrEmpty(results)) {
             return CmisTestResultStatus.OK;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractCmisTest.java
Fri Jun 27 14:51:22 2014
@@ -245,7 +245,7 @@ public abstract class AbstractCmisTest i
     }
 
     protected CmisTestResult assertListNotEmpty(List<?> list, CmisTestResult success,
CmisTestResult failure) {
-        if (list != null && list.size() > 0) {
+        if (list != null && !list.isEmpty()) {
             return success;
         }
 
@@ -256,6 +256,15 @@ public abstract class AbstractCmisTest i
         }
     }
 
+    protected CmisTestResult assertListNullOrEmpty(List<?> list, CmisTestResult success,
CmisTestResult failure) {
+        if (list == null || list.isEmpty()) {
+            return success;
+        }
+
+        return addResultChild(failure, createResult(CmisTestResultStatus.INFO, "List is not
empty!"));
+
+    }
+
     protected CmisTestResult assertEquals(Object expected, Object actual, CmisTestResult
success, CmisTestResult failure) {
         if (isEqual(expected, actual)) {
             return success;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.tck.impl;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.FAILURE;
 import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.INFO;
 import static org.apache.chemistry.opencmis.tck.CmisTestResultStatus.OK;
@@ -1264,7 +1266,7 @@ public abstract class AbstractSessionTes
 
     private void checkRelationships(Session session, List<CmisTestResult> results,
CmisObject object) {
         if (object instanceof Relationship) {
-            if (object.getRelationships() != null && !object.getRelationships().isEmpty())
{
+            if (isNotEmpty(object.getRelationships())) {
                 addResult(results, createResult(FAILURE, "A relationship has relationships!"));
                 return;
             }
@@ -1533,9 +1535,9 @@ public abstract class AbstractSessionTes
         }
 
         f = createResult(FAILURE, "Version history must have at least one version!");
-        addResult(results, assertIsTrue(versions.size() > 0, null, f));
+        addResult(results, assertListNotEmpty(versions, null, f));
 
-        if (versions.size() > 0) {
+        if (!versions.isEmpty()) {
             // get latest version
             Document lastestVersion = doc.getObjectOfLatestVersion(false, SELECT_ALL_NO_CACHE_OC);
             addResult(results,
@@ -1782,13 +1784,13 @@ public abstract class AbstractSessionTes
             if ((propertyCheck == PropertyCheckEnum.MUST_BE_SET)
                     || (propertyCheck == PropertyCheckEnum.STRING_MUST_NOT_BE_EMPTY)) {
                 f = createResult(FAILURE, "Property has no value!");
-                addResult(results, assertIsTrue(property.getValues().size() > 0, null,
f));
+                addResult(results, assertListNotEmpty(property.getValues(), null, f));
             } else if (propertyCheck == PropertyCheckEnum.STRING_SHOULD_NOT_BE_EMPTY) {
                 f = createResult(WARNING, "Property has no value!");
-                addResult(results, assertIsTrue(property.getValues().size() > 0, null,
f));
+                addResult(results, assertListNotEmpty(property.getValues(), null, f));
             } else if (propertyCheck == PropertyCheckEnum.MUST_NOT_BE_SET) {
                 f = createResult(FAILURE, "Property has a value!");
-                addResult(results, assertIsTrue(property.getValues().size() == 0, null, f));
+                addResult(results, assertIsTrue(property.getValues().isEmpty(), null, f));
             }
 
             boolean isString = ((property.getDefinition().getPropertyType() == PropertyType.STRING)
@@ -1820,7 +1822,7 @@ public abstract class AbstractSessionTes
             } else {
                 if (property.getDefinition().isRequired().booleanValue()) {
                     f = createResult(FAILURE, "Property is required but has no value!");
-                    addResult(results, assertIsTrue(property.getValues().size() > 0, null,
f));
+                    addResult(results, assertListNotEmpty(property.getValues(), null, f));
                 }
             }
         }
@@ -1972,13 +1974,13 @@ public abstract class AbstractSessionTes
                     List<Folder> parents = fileableChild.getParents();
 
                     f = createResult(FAILURE, "Child has no parents! Id: " + child.getId());
-                    addResult(results, assertIsTrue(parents.size() > 0, null, f));
+                    addResult(results, assertListNotEmpty(parents, null, f));
 
                     boolean foundParent = false;
                     for (Folder parent : parents) {
                         if (parent == null) {
                             f = createResult(FAILURE, "One of childs parents is null! Id:
" + child.getId());
-                            addResult(results, assertIsTrue(parents.size() > 0, null,
f));
+                            addResult(results, assertListNotEmpty(parents, null, f));
                         } else if (folder.getId().equals(parent.getId())) {
                             foundParent = true;
                             break;
@@ -1987,7 +1989,7 @@ public abstract class AbstractSessionTes
 
                     if (!foundParent) {
                         f = createResult(FAILURE, "Folder is not found in childs parents!
Id: " + child.getId());
-                        addResult(results, assertIsTrue(parents.size() > 0, null, f));
+                        addResult(results, assertListNotEmpty(parents, null, f));
                     }
 
                 }
@@ -2001,7 +2003,7 @@ public abstract class AbstractSessionTes
                 // get object by path and compare
                 List<String> paths = ((FileableCmisObject) child).getPaths();
 
-                if (paths == null || paths.isEmpty()) {
+                if (isNullOrEmpty(paths)) {
                     addResult(results, createResult(FAILURE, "Child has no path! " + child.getId()));
                 } else {
                     for (String path : paths) {
@@ -3284,7 +3286,7 @@ public abstract class AbstractSessionTes
     }
 
     protected CmisTestResultStatus getWorst(List<CmisTestResult> results) {
-        if ((results == null) || (results.isEmpty())) {
+        if (isNullOrEmpty(results)) {
             return CmisTestResultStatus.OK;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/DeleteTreeTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/DeleteTreeTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/DeleteTreeTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/DeleteTreeTest.java
Fri Jun 27 14:51:22 2014
@@ -66,7 +66,7 @@ public class DeleteTreeTest extends Abst
         List<String> failedIds = testFolder.deleteTree(true, UnfileObject.DELETE, true);
 
         // check failed ids
-        if (failedIds != null && failedIds.size() > 0) {
+        if (failedIds != null && !failedIds.isEmpty()) {
             f = createResult(FAILURE, "deleteTree() could not delete " + failedIds.size()
+ " out of " + numOfDocuments
                     + " objects in the folder!");
             addResult(assertEquals(0, failedIds.size(), null, f));

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/OperationContextTest.java
Fri Jun 27 14:51:22 2014
@@ -121,15 +121,15 @@ public class OperationContextTest extend
 
         f = createResult(CmisTestResultStatus.WARNING,
                 "getObject() delivered policies, although they have not been requested.");
-        addResult(assertIsTrue(doc1.getPolicies() == null || doc1.getPolicies().isEmpty(),
null, f));
+        addResult(assertListNullOrEmpty(doc1.getPolicies(), null, f));
 
         f = createResult(CmisTestResultStatus.WARNING,
                 "getObject() delivered relationships, although they have not been requested.");
-        addResult(assertIsTrue(doc1.getRelationships() == null || doc1.getRelationships().isEmpty(),
null, f));
+        addResult(assertListNullOrEmpty(doc1.getRelationships(), null, f));
 
         f = createResult(CmisTestResultStatus.WARNING,
                 "getObject() delivered renditions, although they have not been requested.");
-        addResult(assertIsTrue(doc1.getRenditions() == null || doc1.getRenditions().isEmpty(),
null, f));
+        addResult(assertListNullOrEmpty(doc1.getRenditions(), null, f));
 
         // get the test folder children with the OperationContext
         for (CmisObject child : testFolder.getChildren(context)) {
@@ -151,15 +151,15 @@ public class OperationContextTest extend
                 addResult(assertNull(child.getAllowableActions(), null, f));
 
                 f = createResult(CmisTestResultStatus.INFO, "getChildren() delivered policies,
which is not required.");
-                addResult(assertIsTrue(child.getPolicies() == null || child.getPolicies().isEmpty(),
null, f));
+                addResult(assertListNullOrEmpty(child.getPolicies(), null, f));
 
                 f = createResult(CmisTestResultStatus.WARNING,
                         "getChildren() delivered relationships, although they have not been
requested.");
-                addResult(assertIsTrue(child.getRelationships() == null || child.getRelationships().isEmpty(),
null, f));
+                addResult(assertListNullOrEmpty(child.getRelationships(), null, f));
 
                 f = createResult(CmisTestResultStatus.WARNING,
                         "getChildren() delivered renditions, although they have not been
requested.");
-                addResult(assertIsTrue(child.getRenditions() == null || child.getRenditions().isEmpty(),
null, f));
+                addResult(assertListNullOrEmpty(child.getRenditions(), null, f));
 
                 break;
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/types/BaseTypesTest.java
Fri Jun 27 14:51:22 2014
@@ -71,7 +71,7 @@ public class BaseTypesTest extends Abstr
                 addResult(createResult(FAILURE, "Base type has an invalid id: " + typeId));
             }
 
-            if (typeDef.getPropertyDefinitions() != null && typeDef.getPropertyDefinitions().size()
> 0) {
+            if (typeDef.getPropertyDefinitions() != null && !typeDef.getPropertyDefinitions().isEmpty())
{
                 addResult(createResult(WARNING, "Property type definitions were not requested
but delivered. Type id: "
                         + typeId));
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersionDeleteTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersionDeleteTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersionDeleteTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersionDeleteTest.java
Fri Jun 27 14:51:22 2014
@@ -106,7 +106,7 @@ public class VersionDeleteTest extends A
                 + "!");
         addResult(assertEquals(version, versions.size(), null, f));
 
-        if (versions.size() > 0) {
+        if (!versions.isEmpty()) {
             f = createResult(FAILURE, "Newly created version " + version + " is not the latest
version!");
             addResult(assertEquals(newVersion.getId(), versions.get(0).getId(), null, f));
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningSmokeTest.java
Fri Jun 27 14:51:22 2014
@@ -111,7 +111,7 @@ public class VersioningSmokeTest extends
             f = createResult(FAILURE, "Version series should have 2 versions but has " +
versions.size() + "!");
             addResult(assertEquals(2, versions.size(), null, f));
 
-            if (versions.size() > 0) {
+            if (!versions.isEmpty()) {
                 f = createResult(FAILURE,
                         "Version history order is incorrect! The first version should be
the new version.");
                 addResult(assertEquals(newVersion.getId(), versions.get(0).getId(), null,
f));

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/loremipsum/LoremIpsum.java
Fri Jun 27 14:51:22 2014
@@ -495,13 +495,12 @@ public class LoremIpsum {
             previous.len2 = wi.len;
         }
 
-        if (chains.size() > 0) {
-            this.chains = chains;
-            this.starts = starts;
-        } else {
+        if (chains.isEmpty()) {
             throw new RuntimeException("Invalid sample text.");
         }
 
+        this.chains = chains;
+        this.starts = starts;
     }
 
     /**

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java
Fri Jun 27 14:51:22 2014
@@ -134,8 +134,11 @@ public class LoginDialog extends JDialog
                         }
                     });
 
-                    if (repositories.size() > 0) {
-
+                    if (repositories.isEmpty()) {
+                        repositoryBox.setEnabled(false);
+                        loginButton.setEnabled(false);
+                        getRootPane().setDefaultButton(loadRepositoryButton);
+                    } else {
                         for (Repository repository : repositories) {
                             repositoryBox.addItem(repository);
                         }
@@ -143,10 +146,6 @@ public class LoginDialog extends JDialog
                         repositoryBox.setEnabled(true);
                         loginButton.setEnabled(true);
                         getRootPane().setDefaultButton(loginButton);
-                    } else {
-                        repositoryBox.setEnabled(false);
-                        loginButton.setEnabled(false);
-                        getRootPane().setDefaultButton(loadRepositoryButton);
                     }
 
                     currentTab.afterLoadRepositories(repositories);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/QueryFrame.java
Fri Jun 27 14:51:22 2014
@@ -350,7 +350,7 @@ public class QueryFrame extends JFrame {
 
             if (value instanceof List<?>) {
                 List<?> values = (List<?>) value;
-                if (values.size() == 0) {
+                if (values.isEmpty()) {
                     return;
                 }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/RepositoryInfoFrame.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,9 @@
  */
 package org.apache.chemistry.opencmis.workbench;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
+
 import java.awt.Dimension;
 import java.util.List;
 import java.util.Map;
@@ -247,7 +250,7 @@ public class RepositoryInfoFrame extends
                 }
             }
 
-            if (repInfo.getExtensionFeatures() != null && !repInfo.getExtensionFeatures().isEmpty())
{
+            if (isNotEmpty(repInfo.getExtensionFeatures())) {
                 JTree extensionFeaturesTree = new JTree();
                 extensionFeaturesTree.setRootVisible(false);
                 extensionFeaturesTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
@@ -279,7 +282,7 @@ public class RepositoryInfoFrame extends
                         efNode.add(new DefaultMutableTreeNode("URL: " + ef.getUrl()));
                     }
 
-                    if (ef.getFeatureData() != null && !ef.getFeatureData().isEmpty())
{
+                    if (isNotEmpty(ef.getFeatureData())) {
                         DefaultMutableTreeNode dataNode = new DefaultMutableTreeNode("Feature
Data");
                         efNode.add(dataNode);
 
@@ -294,7 +297,7 @@ public class RepositoryInfoFrame extends
                 addComponent("Extension Features:", new JScrollPane(extensionFeaturesTree));
             }
 
-            if (repInfo.getExtensions() != null && !repInfo.getExtensions().isEmpty())
{
+            if (isNotEmpty(repInfo.getExtensions())) {
                 JTree extensionsTree = new JTree();
                 extensionsTree.setRootVisible(false);
                 extensionsTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
@@ -309,7 +312,7 @@ public class RepositoryInfoFrame extends
         }
 
         private void addExtension(DefaultMutableTreeNode parent, List<CmisExtensionElement>
extensions) {
-            if ((extensions == null) || (extensions.isEmpty())) {
+            if (isNullOrEmpty(extensions)) {
                 return;
             }
 
@@ -317,7 +320,7 @@ public class RepositoryInfoFrame extends
                 DefaultMutableTreeNode node = new DefaultMutableTreeNode(new ExtensionNode(ext));
                 parent.add(node);
 
-                if (ext.getChildren().size() > 0) {
+                if (isNotEmpty(ext.getChildren())) {
                     addExtension(node, ext.getChildren());
                 }
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.workbench;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+
 import java.awt.BorderLayout;
 import java.awt.Cursor;
 import java.awt.Dimension;
@@ -417,7 +419,7 @@ public class TypesFrame extends JFrame {
 
         List<ValidationError> typeResult = TypeUtils.validateTypeDefinition(type);
 
-        if (typeResult.size() > 0) {
+        if (isNotEmpty(typeResult)) {
             sb.append("\nType Definition:\n");
 
             for (ValidationError error : typeResult) {
@@ -431,7 +433,7 @@ public class TypesFrame extends JFrame {
             for (PropertyDefinition<?> propDef : type.getPropertyDefinitions().values())
{
                 List<ValidationError> propResult = TypeUtils.validatePropertyDefinition(propDef);
 
-                if (propResult.size() > 0) {
+                if (isNotEmpty(propResult)) {
                     sb.append("\nProperty Definition '" + propDef.getId() + "':\n");
 
                     for (ValidationError error : propResult) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ExtensionsPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ExtensionsPanel.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ExtensionsPanel.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ExtensionsPanel.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,9 @@
  */
 package org.apache.chemistry.opencmis.workbench.details;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNotEmpty;
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.isNullOrEmpty;
+
 import java.awt.Color;
 import java.util.List;
 
@@ -68,7 +71,7 @@ public class ExtensionsPanel extends JPa
 
                     // object extensions
                     extensions = object.getExtensions(ExtensionLevel.OBJECT);
-                    if ((extensions != null) && (!extensions.isEmpty())) {
+                    if (isNotEmpty(extensions)) {
                         DefaultMutableTreeNode objectRootNode = new DefaultMutableTreeNode("Object");
                         addExtension(objectRootNode, extensions);
                         rootNode.add(objectRootNode);
@@ -76,7 +79,7 @@ public class ExtensionsPanel extends JPa
 
                     // property extensions
                     extensions = object.getExtensions(ExtensionLevel.PROPERTIES);
-                    if ((extensions != null) && (!extensions.isEmpty())) {
+                    if (isNotEmpty(extensions)) {
                         DefaultMutableTreeNode propertiesRootNode = new DefaultMutableTreeNode("Properties");
                         addExtension(propertiesRootNode, extensions);
                         rootNode.add(propertiesRootNode);
@@ -84,7 +87,7 @@ public class ExtensionsPanel extends JPa
 
                     // allowable actions extensions
                     extensions = object.getExtensions(ExtensionLevel.ALLOWABLE_ACTIONS);
-                    if ((extensions != null) && (!extensions.isEmpty())) {
+                    if (isNotEmpty(extensions)) {
                         DefaultMutableTreeNode allowableActionsRootNode = new DefaultMutableTreeNode(
                                 "Allowable Actions");
                         addExtension(allowableActionsRootNode, extensions);
@@ -93,7 +96,7 @@ public class ExtensionsPanel extends JPa
 
                     // ACL extensions
                     extensions = object.getExtensions(ExtensionLevel.ACL);
-                    if ((extensions != null) && (!extensions.isEmpty())) {
+                    if (isNotEmpty(extensions)) {
                         DefaultMutableTreeNode aclRootNode = new DefaultMutableTreeNode("ACL");
                         addExtension(aclRootNode, extensions);
                         rootNode.add(aclRootNode);
@@ -101,7 +104,7 @@ public class ExtensionsPanel extends JPa
 
                     // policies extensions
                     extensions = object.getExtensions(ExtensionLevel.POLICIES);
-                    if ((extensions != null) && (!extensions.isEmpty())) {
+                    if (isNotEmpty(extensions)) {
                         DefaultMutableTreeNode policiesRootNode = new DefaultMutableTreeNode("Policies");
                         addExtension(policiesRootNode, extensions);
                         rootNode.add(policiesRootNode);
@@ -116,7 +119,7 @@ public class ExtensionsPanel extends JPa
     }
 
     private void addExtension(DefaultMutableTreeNode parent, List<CmisExtensionElement>
extensions) {
-        if ((extensions == null) || (extensions.isEmpty())) {
+        if (isNullOrEmpty(extensions)) {
             return;
         }
 
@@ -124,7 +127,7 @@ public class ExtensionsPanel extends JPa
             DefaultMutableTreeNode node = new DefaultMutableTreeNode(new ExtensionNode(ext));
             parent.add(node);
 
-            if (ext.getChildren().size() > 0) {
+            if (isNotEmpty(ext.getChildren())) {
                 addExtension(node, ext.getChildren());
             }
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/details/ObjectPanel.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.workbench.details;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
 import groovy.ui.Console;
 
 import java.awt.BorderLayout;
@@ -172,7 +173,7 @@ public class ObjectPanel extends InfoPan
                                     public void run() {
                                         try {
                                             List<String> paths = pathObject.getPaths();
-                                            if ((paths == null) || (paths.size() == 0)) {
+                                            if (isNullOrEmpty(paths)) {
                                                 pathsList.setList(Collections.singletonList("(unfiled)"));
                                             } else {
                                                 pathsList.setList(paths);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientModel.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.workbench.model;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.io.BufferedInputStream;
 import java.io.File;
 import java.io.FileInputStream;
@@ -174,7 +176,7 @@ public class ClientModel {
             } else {
                 if (selectedObject instanceof FileableCmisObject) {
                     List<Folder> parents = ((FileableCmisObject) selectedObject).getParents();
-                    if (parents != null && parents.size() > 0) {
+                    if (isNotEmpty(parents)) {
                         folderObject = parents.get(0);
                     } else {
                         setCurrentFolder(null, new ArrayList<CmisObject>(0));
@@ -413,7 +415,7 @@ public class ClientModel {
     }
 
     public synchronized CmisObject getFromCurrentChildren(String id) {
-        if ((currentChildren == null) || (currentChildren.isEmpty())) {
+        if (isNullOrEmpty(currentChildren)) {
             return null;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java?rev=1606112&r1=1606111&r2=1606112&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/swing/InfoPanel.java
Fri Jun 27 14:51:22 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.chemistry.opencmis.workbench.swing;
 
+import static org.apache.chemistry.opencmis.commons.impl.CollectionsHelper.*;
+
 import java.awt.Color;
 import java.awt.Cursor;
 import java.awt.Desktop;
@@ -201,7 +203,7 @@ public abstract class InfoPanel extends 
         public void setList(Collection<?> list) {
             clear();
 
-            if (list == null || list.size() == 0) {
+            if (isNullOrEmpty(list)) {
                 return;
             }
 



Mime
View raw message