You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2013/08/14 23:45:03 UTC
svn commit: r1514061 [1/2] - in /chemistry/opencmis/trunk:
chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/
chemistry-opencmis-client/chemistry-opencmis-client-bindings...
Author: fmui
Date: Wed Aug 14 21:45:01 2013
New Revision: 1514061
URL: http://svn.apache.org/r1514061
Log:
more code clean up
Modified:
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.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-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ItemTypeImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/SecondaryTypeImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/FileUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/OperationContextUtils.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-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CmisEnumHelper.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/DateTimeHelper.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/IOUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
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-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamImpl.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/ConverterTest.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MimeHelperTest.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MiscTest.java
chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/NavigationService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/ObjectService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/PolicyService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RelationshipService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/RepositoryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/VersioningService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AclService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/DiscoveryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultiFilingService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/NavigationService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ObjectService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/PolicyService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RelationshipService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/RepositoryService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/VersioningService.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/AbstractServiceCall.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/BasicAuthCallContextHandler.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/HttpUtils.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/CmisServiceWrapper.java
chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-browser/src/main/java/org/apache/chemistry/opencmis/browser/BrowseServlet.java
chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-fit/pom.xml
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.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/cache/impl/CacheImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/cache/impl/CacheImpl.java Wed Aug 14 21:45:01 2013
@@ -306,6 +306,8 @@ public class CacheImpl implements Cache
// ---- internal ----
private static String getFormattedKeys(String[] keys) {
+ assert keys != null;
+
StringBuilder sb = new StringBuilder();
for (String k : keys) {
if (sb.length() > 0) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.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/impl/CmisBindingsHelper.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/CmisBindingsHelper.java Wed Aug 14 21:45:01 2013
@@ -61,6 +61,8 @@ public final class CmisBindingsHelper {
* @return the SPI object
*/
public static CmisSpi getSPI(BindingSession session) {
+ assert session != null;
+
// fetch from session
CmisSpi spi = (CmisSpi) session.get(SPI_OBJECT);
if (spi != null) {
@@ -92,6 +94,8 @@ public final class CmisBindingsHelper {
session.writeUnlock();
}
+ assert spi != null;
+
return spi;
}
@@ -99,6 +103,8 @@ public final class CmisBindingsHelper {
* Gets the HTTP Invoker object from the session.
*/
public static HttpInvoker getHttpInvoker(BindingSession session) {
+ assert session != null;
+
HttpInvoker invoker = (HttpInvoker) session.get(HTTP_INVOKER_OBJECT);
if (invoker != null) {
@@ -129,6 +135,8 @@ public final class CmisBindingsHelper {
session.writeUnlock();
}
+ assert invoker != null;
+
return invoker;
}
@@ -136,6 +144,8 @@ public final class CmisBindingsHelper {
* Returns a CMIS version if the user set one, <code>null</code> otherwise.
*/
public static CmisVersion getForcedCmisVersion(BindingSession session) {
+ assert session != null;
+
return (CmisVersion) session.get(FORCE_CMIS_VERSION);
}
@@ -144,6 +154,8 @@ public final class CmisBindingsHelper {
* if no authentication provider is set.
*/
public static AuthenticationProvider getAuthenticationProvider(BindingSession session) {
+ assert session != null;
+
return (AuthenticationProvider) session.get(AUTHENTICATION_PROVIDER_OBJECT);
}
@@ -151,6 +163,8 @@ public final class CmisBindingsHelper {
* Returns the repository info cache from the session.
*/
public static RepositoryInfoCache getRepositoryInfoCache(BindingSession session) {
+ assert session != null;
+
return (RepositoryInfoCache) session.get(REPOSITORY_INFO_CACHE);
}
@@ -158,6 +172,8 @@ public final class CmisBindingsHelper {
* Returns the type definition cache from the session.
*/
public static TypeDefinitionCache getTypeDefinitionCache(BindingSession session) {
+ assert session != null;
+
return (TypeDefinitionCache) session.get(TYPE_DEFINTION_CACHE);
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.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/impl/RepositoryInfoCache.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryInfoCache.java Wed Aug 14 21:45:01 2013
@@ -46,6 +46,8 @@ public class RepositoryInfoCache impleme
* the session object
*/
public RepositoryInfoCache(BindingSession session) {
+ assert session != null;
+
int repCount = session.get(SessionParameter.CACHE_SIZE_REPOSITORIES, CACHE_SIZE_REPOSITORIES);
if (repCount < 1) {
repCount = CACHE_SIZE_REPOSITORIES;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.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/impl/RepositoryServiceImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/RepositoryServiceImpl.java Wed Aug 14 21:45:01 2013
@@ -47,6 +47,8 @@ public class RepositoryServiceImpl imple
* Constructor.
*/
public RepositoryServiceImpl(BindingSession session) {
+ assert session != null;
+
this.session = session;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.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/impl/TypeDefinitionCache.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/impl/TypeDefinitionCache.java Wed Aug 14 21:45:01 2013
@@ -47,6 +47,8 @@ public class TypeDefinitionCache impleme
* the session object
*/
public TypeDefinitionCache(BindingSession session) {
+ assert session != null;
+
int repCount = session.get(SessionParameter.CACHE_SIZE_REPOSITORIES, CACHE_SIZE_REPOSITORIES);
if (repCount < 1) {
repCount = CACHE_SIZE_REPOSITORIES;
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=1514061&r1=1514060&r2=1514061&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 Wed Aug 14 21:45:01 2013
@@ -337,7 +337,6 @@ public final class CmisHttpCookie implem
@Override
void validate(String v, CmisHttpCookie cookie) {
- return;
}
});
attributeSet.put("secure", new Setter() {
@@ -387,7 +386,6 @@ public final class CmisHttpCookie implem
@Override
void validate(String v, CmisHttpCookie cookie) {
- return;
}
});
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/atompub/AtomPubTestBindingFactory.java Wed Aug 14 21:45:01 2013
@@ -25,10 +25,6 @@ import org.apache.chemistry.opencmis.cli
import org.apache.chemistry.opencmis.commons.SessionParameter;
import org.apache.chemistry.opencmis.commons.spi.CmisBinding;
-/**
- * @author <a href="mailto:fmueller@opentext.com">Florian Müller</a>
- *
- */
public class AtomPubTestBindingFactory {
private AtomPubTestBindingFactory() {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.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/runtime/AbstractCmisObject.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/AbstractCmisObject.java Wed Aug 14 21:45:01 2013
@@ -213,7 +213,7 @@ public abstract class AbstractCmisObject
* Returns the session object.
*/
protected SessionImpl getSession() {
- return this.session;
+ return session;
}
/**
@@ -229,7 +229,7 @@ public abstract class AbstractCmisObject
protected ObjectType getObjectType() {
readLock();
try {
- return this.objectType;
+ return objectType;
} finally {
readUnlock();
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.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/runtime/SessionImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/SessionImpl.java Wed Aug 14 21:45:01 2013
@@ -174,7 +174,7 @@ public class SessionImpl implements Sess
}
private Locale determineLocale(Map<String, String> parameters) {
- Locale locale = null;
+ Locale result = null;
String language = parameters.get(SessionParameter.LOCALE_ISO639_LANGUAGE);
String country = parameters.get(SessionParameter.LOCALE_ISO3166_COUNTRY);
@@ -182,22 +182,22 @@ public class SessionImpl implements Sess
if (variant != null) {
// all 3 parameter must not be null and valid
- locale = new Locale(language, country, variant);
+ result = new Locale(language, country, variant);
} else {
if (country != null) {
// 2 parameter must not be null and valid
- locale = new Locale(language, country);
+ result = new Locale(language, country);
} else {
if (language != null) {
// 1 parameter must not be null and valid
- locale = new Locale(language);
+ result = new Locale(language);
} else {
- locale = Locale.getDefault();
+ result = Locale.getDefault();
}
}
}
- return locale;
+ return result;
}
private ObjectFactory createObjectFactory() {
@@ -262,7 +262,8 @@ public class SessionImpl implements Sess
}
public ObjectFactory getObjectFactory() {
- return this.objectFactory;
+ assert objectFactory != null;
+ return objectFactory;
}
public ItemIterable<Document> getCheckedOutDocs() {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.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/runtime/cache/CacheImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/cache/CacheImpl.java Wed Aug 14 21:45:01 2013
@@ -60,6 +60,8 @@ public class CacheImpl implements Cache
}
public void initialize(Session session, Map<String, String> parameters) {
+ assert parameters != null;
+
lock.writeLock().lock();
try {
// cache size
@@ -273,7 +275,7 @@ public class CacheImpl implements Cache
}
public void remove(String objectId) {
- if(objectId == null) {
+ if (objectId == null) {
return;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.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/runtime/objecttype/DocumentTypeImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/DocumentTypeImpl.java Wed Aug 14 21:45:01 2013
@@ -39,6 +39,9 @@ public class DocumentTypeImpl extends Do
private final ObjectTypeHelper helper;
public DocumentTypeImpl(Session session, DocumentTypeDefinition typeDefinition) {
+ assert session != null;
+ assert typeDefinition != null;
+
initialize(typeDefinition);
setContentStreamAllowed(typeDefinition.getContentStreamAllowed());
setIsVersionable(typeDefinition.isVersionable());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.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/runtime/objecttype/FolderTypeImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/FolderTypeImpl.java Wed Aug 14 21:45:01 2013
@@ -21,8 +21,8 @@ package org.apache.chemistry.opencmis.cl
import java.util.List;
import org.apache.chemistry.opencmis.client.api.FolderType;
-import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.client.api.ItemIterable;
+import org.apache.chemistry.opencmis.client.api.ObjectType;
import org.apache.chemistry.opencmis.client.api.Session;
import org.apache.chemistry.opencmis.client.api.Tree;
import org.apache.chemistry.opencmis.commons.definitions.FolderTypeDefinition;
@@ -38,6 +38,9 @@ public class FolderTypeImpl extends Fold
private final ObjectTypeHelper helper;
public FolderTypeImpl(Session session, FolderTypeDefinition typeDefinition) {
+ assert session != null;
+ assert typeDefinition != null;
+
initialize(typeDefinition);
helper = new ObjectTypeHelper(session, this);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ItemTypeImpl.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/runtime/objecttype/ItemTypeImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ItemTypeImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ItemTypeImpl.java Wed Aug 14 21:45:01 2013
@@ -35,6 +35,9 @@ public class ItemTypeImpl extends ItemTy
private final ObjectTypeHelper helper;
public ItemTypeImpl(Session session, ItemTypeDefinition typeDefinition) {
+ assert session != null;
+ assert typeDefinition != null;
+
initialize(typeDefinition);
helper = new ObjectTypeHelper(session, this);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.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/runtime/objecttype/ObjectTypeHelper.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/ObjectTypeHelper.java Wed Aug 14 21:45:01 2013
@@ -41,6 +41,9 @@ public class ObjectTypeHelper implements
private ObjectType parentType;
public ObjectTypeHelper(Session session, ObjectType objectType) {
+ assert session != null;
+ assert objectType != null;
+
this.session = session;
this.objectType = objectType;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.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/runtime/objecttype/PolicyTypeImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/PolicyTypeImpl.java Wed Aug 14 21:45:01 2013
@@ -39,6 +39,9 @@ public class PolicyTypeImpl extends Poli
private final ObjectTypeHelper helper;
public PolicyTypeImpl(Session session, PolicyTypeDefinition typeDefinition) {
+ assert session != null;
+ assert typeDefinition != null;
+
initialize(typeDefinition);
helper = new ObjectTypeHelper(session, this);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.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/runtime/objecttype/RelationshipTypeImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/RelationshipTypeImpl.java Wed Aug 14 21:45:01 2013
@@ -42,6 +42,9 @@ public class RelationshipTypeImpl extend
private List<ObjectType> allowedTargetTypes;
public RelationshipTypeImpl(Session session, RelationshipTypeDefinition typeDefinition) {
+ assert session != null;
+ assert typeDefinition != null;
+
initialize(typeDefinition);
setAllowedSourceTypes(typeDefinition.getAllowedSourceTypeIds());
setAllowedTargetTypes(typeDefinition.getAllowedTargetTypeIds());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/SecondaryTypeImpl.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/runtime/objecttype/SecondaryTypeImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/SecondaryTypeImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/objecttype/SecondaryTypeImpl.java Wed Aug 14 21:45:01 2013
@@ -17,6 +17,9 @@ public class SecondaryTypeImpl extends S
private final ObjectTypeHelper helper;
public SecondaryTypeImpl(Session session, SecondaryTypeDefinition typeDefinition) {
+ assert session != null;
+ assert typeDefinition != null;
+
initialize(typeDefinition);
helper = new ObjectTypeHelper(session, this);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.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/runtime/repository/ObjectFactoryImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/ObjectFactoryImpl.java Wed Aug 14 21:45:01 2013
@@ -113,6 +113,8 @@ public class ObjectFactoryImpl implement
}
public void initialize(Session session, Map<String, String> parameters) {
+ assert session != null;
+
this.session = session;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.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/runtime/repository/RepositoryImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/repository/RepositoryImpl.java Wed Aug 14 21:45:01 2013
@@ -48,6 +48,8 @@ public class RepositoryImpl extends Repo
ObjectFactory objectFactory, AuthenticationProvider authenticationProvider, Cache cache) {
super(data);
+ assert sessionFactory != null;
+
this.parameters = new HashMap<String, String>(parameters);
this.parameters.put(SessionParameter.REPOSITORY_ID, getId());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/FileUtils.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/FileUtils.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/FileUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/FileUtils.java Wed Aug 14 21:45:01 2013
@@ -51,7 +51,7 @@ import org.apache.chemistry.opencmis.com
/**
* A set of utility methods that simplify file and folder operations.
*/
-public class FileUtils {
+public final class FileUtils {
private FileUtils() {
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/OperationContextUtils.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/OperationContextUtils.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/OperationContextUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/OperationContextUtils.java Wed Aug 14 21:45:01 2013
@@ -31,7 +31,7 @@ import org.apache.chemistry.opencmis.com
* Constants and methods to create and manipulate {@link OperationContext}
* objects.
*/
-public class OperationContextUtils {
+public final class OperationContextUtils {
public static final String PROPERTIES_STAR = "*";
public static final String RENDITION_NONE = "cmis:none";
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=1514061&r1=1514060&r2=1514061&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 Wed Aug 14 21:45:01 2013
@@ -61,7 +61,7 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParseException;
import org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParser;
-public class TypeUtils {
+public final class TypeUtils {
private TypeUtils() {
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CmisEnumHelper.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/CmisEnumHelper.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CmisEnumHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/CmisEnumHelper.java Wed Aug 14 21:45:01 2013
@@ -49,7 +49,10 @@ import org.apache.chemistry.opencmis.com
/**
* Helper methods to turn a value into a CMIS enum.
*/
-public class CmisEnumHelper {
+public final class CmisEnumHelper {
+
+ private CmisEnumHelper() {
+ }
@SuppressWarnings("unchecked")
public static <E extends Enum<?>> E fromValue(final String value, final Class<E> clazz) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/DateTimeHelper.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/DateTimeHelper.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/DateTimeHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/DateTimeHelper.java Wed Aug 14 21:45:01 2013
@@ -28,7 +28,7 @@ import java.util.TimeZone;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-public class DateTimeHelper {
+public final class DateTimeHelper {
private static final TimeZone GMT = TimeZone.getTimeZone("GMT");
@@ -57,6 +57,9 @@ public class DateTimeHelper {
private static final Pattern HTTP_DATETIME3 = Pattern
.compile("\\w{3} (\\w{3}) ([0-3 ]\\d) ([0-2]\\d):([0-5]\\d):([0-5]\\d) (\\d{4})");
+ private DateTimeHelper() {
+ }
+
/**
* Parses a xsd:dateTime string.
*/
@@ -281,6 +284,9 @@ public class DateTimeHelper {
}
private static void add2d(final StringBuilder sb, int value) {
+ assert sb != null;
+ assert value >= 0;
+
if (value < 10) {
sb.append('0');
}
@@ -288,6 +294,9 @@ public class DateTimeHelper {
}
private static void add3d(final StringBuilder sb, int value) {
+ assert sb != null;
+ assert value >= 0;
+
if (value < 10) {
sb.append('0');
}
@@ -298,6 +307,9 @@ public class DateTimeHelper {
}
private static void add4d(final StringBuilder sb, int value) {
+ assert sb != null;
+ assert value >= 0;
+
if (value < 10) {
sb.append('0');
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/IOUtils.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/IOUtils.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/IOUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/IOUtils.java Wed Aug 14 21:45:01 2013
@@ -25,11 +25,15 @@ import java.io.Reader;
import org.apache.chemistry.opencmis.commons.data.ContentStream;
-public class IOUtils {
+public final class IOUtils {
+
+ private IOUtils() {
+ }
/**
* Closes a stream and ignores any exceptions.
*/
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public static void closeQuietly(final Closeable closeable) {
try {
if (closeable != null) {
@@ -53,9 +57,14 @@ public class IOUtils {
/**
* Consumes and closes the provided stream.
*/
+ @SuppressWarnings({ "PMD.EmptyCatchBlock", "PMD.EmptyWhileStmt" })
public static void consumeAndClose(final InputStream stream) {
+ if (stream == null) {
+ return;
+ }
+
try {
- byte[] buffer = new byte[4096];
+ final byte[] buffer = new byte[4096];
while (stream.read(buffer) > -1) {
}
} catch (IOException e) {
@@ -68,9 +77,14 @@ public class IOUtils {
/**
* Consumes and closes the provided reader.
*/
+ @SuppressWarnings({ "PMD.EmptyCatchBlock", "PMD.EmptyWhileStmt" })
public static void consumeAndClose(final Reader reader) {
+ if (reader == null) {
+ return;
+ }
+
try {
- char[] buffer = new char[4096];
+ final char[] buffer = new char[4096];
while (reader.read(buffer) > -1) {
}
} catch (IOException e) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.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/JSONConverter.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java Wed Aug 14 21:45:01 2013
@@ -1634,6 +1634,8 @@ public final class JSONConverter {
* Converts choices.
*/
private static <T> JSONArray convertChoices(final List<Choice<T>> choices, final Cardinality cardinality) {
+ assert cardinality != null;
+
if (choices == null) {
return null;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.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/MimeTypes.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.java Wed Aug 14 21:45:01 2013
@@ -457,6 +457,8 @@ public final class MimeTypes {
mime = EXT2MIME.get("");
}
+ assert mime != null;
+
return mime;
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.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/WSConverter.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java Wed Aug 14 21:45:01 2013
@@ -1354,6 +1354,8 @@ public final class WSConverter {
* Converts a choices list.
*/
private static void convertChoiceDecimalList(List<Choice<BigDecimal>> choices, List<CmisChoiceDecimal> target) {
+ assert target != null;
+
if (choices == null) {
return;
}
@@ -1401,6 +1403,8 @@ public final class WSConverter {
* Converts a choices list.
*/
private static void convertChoiceBooleanList(List<Choice<Boolean>> choices, List<CmisChoiceBoolean> target) {
+ assert target != null;
+
if (choices == null) {
return;
}
@@ -1449,6 +1453,8 @@ public final class WSConverter {
*/
private static void convertChoiceDateTimeList(List<Choice<GregorianCalendar>> choices,
List<CmisChoiceDateTime> target) {
+ assert target != null;
+
if (choices == null) {
return;
}
@@ -1496,6 +1502,8 @@ public final class WSConverter {
* Converts a choices list.
*/
private static void convertChoiceHtmlList(List<Choice<String>> choices, List<CmisChoiceHtml> target) {
+ assert target != null;
+
if (choices == null) {
return;
}
@@ -1543,6 +1551,8 @@ public final class WSConverter {
* Converts a choices list.
*/
private static void convertChoiceUriList(List<Choice<String>> choices, List<CmisChoiceUri> target) {
+ assert target != null;
+
if (choices == null) {
return;
}
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=1514061&r1=1514060&r2=1514061&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 Wed Aug 14 21:45:01 2013
@@ -18,8 +18,8 @@
*/
package org.apache.chemistry.opencmis.commons.impl;
-public class XMLConstraints {
-
+public final class XMLConstraints {
+
public static final int MAX_STRING_LENGTH = 100 * 1024;
public static final int MAX_EXTENSIONS_WIDTH = 100;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.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/XMLConverter.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Wed Aug 14 21:45:01 2013
@@ -149,7 +149,7 @@ import org.apache.chemistry.opencmis.com
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class XMLConverter {
+public final class XMLConverter {
private static final Logger LOG = LoggerFactory.getLogger(XMLConverter.class);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.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/XMLUtils.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java Wed Aug 14 21:45:01 2013
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
-public class XMLUtils {
+public final class XMLUtils {
private static final Logger LOG = LoggerFactory.getLogger(XMLUtils.class);
@@ -70,6 +70,9 @@ public class XMLUtils {
XML_OUTPUT_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.FALSE);
}
+ private XMLUtils() {
+ }
+
// --------------
// --- writer ---
// --------------
@@ -78,6 +81,8 @@ public class XMLUtils {
* Creates a new XML writer.
*/
public static XMLStreamWriter createWriter(OutputStream out) throws XMLStreamException {
+ assert out != null;
+
return XML_OUTPUT_FACTORY.createXMLStreamWriter(out, "UTF-8");
}
@@ -85,6 +90,8 @@ public class XMLUtils {
* Starts a XML document.
*/
public static void startXmlDocument(XMLStreamWriter writer) throws XMLStreamException {
+ assert writer != null;
+
writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
@@ -97,6 +104,8 @@ public class XMLUtils {
* Ends a XML document.
*/
public static void endXmlDocument(XMLStreamWriter writer) throws XMLStreamException {
+ assert writer != null;
+
writer.writeEndDocument();
writer.close();
}
@@ -106,6 +115,8 @@ public class XMLUtils {
*/
public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, String value)
throws XMLStreamException {
+ assert writer != null;
+
if (value == null) {
return;
}
@@ -124,6 +135,8 @@ public class XMLUtils {
*/
public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, BigInteger value)
throws XMLStreamException {
+ assert writer != null;
+
if (value == null) {
return;
}
@@ -136,6 +149,8 @@ public class XMLUtils {
*/
public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, BigDecimal value)
throws XMLStreamException {
+ assert writer != null;
+
if (value == null) {
return;
}
@@ -148,6 +163,8 @@ public class XMLUtils {
*/
public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag,
GregorianCalendar value) throws XMLStreamException {
+ assert writer != null;
+
if (value == null) {
return;
}
@@ -160,6 +177,8 @@ public class XMLUtils {
*/
public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, Boolean value)
throws XMLStreamException {
+ assert writer != null;
+
if (value == null) {
return;
}
@@ -172,6 +191,8 @@ public class XMLUtils {
*/
public static void write(XMLStreamWriter writer, String prefix, String namespace, String tag, Enum<?> value)
throws XMLStreamException {
+ assert writer != null;
+
if (value == null) {
return;
}
@@ -201,6 +222,8 @@ public class XMLUtils {
* Moves the parser to the next element.
*/
public static boolean next(XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
if (parser.hasNext()) {
try {
parser.next();
@@ -218,6 +241,8 @@ public class XMLUtils {
* Skips a tag or subtree.
*/
public static void skip(XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
int level = 1;
while (next(parser)) {
int event = parser.getEventType();
@@ -241,6 +266,8 @@ public class XMLUtils {
* <code>false</code> otherwise
*/
public static boolean findNextStartElemenet(XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
while (true) {
int event = parser.getEventType();
@@ -260,6 +287,9 @@ public class XMLUtils {
* Parses a tag that contains text.
*/
public static String readText(XMLStreamReader parser, int maxLength) throws XMLStreamException {
+ assert parser != null;
+ assert maxLength >= 0;
+
StringBuilder sb = new StringBuilder();
next(parser);
@@ -281,7 +311,7 @@ public class XMLUtils {
sb.append(chars, offset, len);
}
} else if (event == XMLStreamReader.START_ELEMENT) {
- throw new RuntimeException("Unexpected tag: " + parser.getName());
+ throw new XMLStreamException("Unexpected tag: " + parser.getName());
}
if (!next(parser)) {
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.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/XMLWalker.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLWalker.java Wed Aug 14 21:45:01 2013
@@ -41,6 +41,8 @@ import org.apache.chemistry.opencmis.com
public abstract class XMLWalker<T> {
public T walk(XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
final T result = prepareTarget(parser, parser.getName());
next(parser);
@@ -72,20 +74,29 @@ public abstract class XMLWalker<T> {
}
protected boolean isCmisNamespace(QName name) {
+ assert name != null;
+
return XMLConstants.NAMESPACE_CMIS.hashCode() == name.getNamespaceURI().hashCode()
&& XMLConstants.NAMESPACE_CMIS.equals(name.getNamespaceURI());
}
protected boolean isAtomNamespace(QName name) {
+ assert name != null;
+
return XMLConstants.NAMESPACE_ATOM.hashCode() == name.getNamespaceURI().hashCode()
&& XMLConstants.NAMESPACE_ATOM.equals(name.getNamespaceURI());
}
protected boolean isTag(QName name, String tag) {
+ assert name != null;
+ assert tag != null;
+
return tag.hashCode() == name.getLocalPart().hashCode() && tag.equals(name.getLocalPart());
}
protected void handleExtension(XMLStreamReader parser, ExtensionsData extData) throws XMLStreamException {
+ assert parser != null;
+
List<CmisExtensionElement> extensions = extData.getExtensions();
if (extensions == null) {
extensions = new ArrayList<CmisExtensionElement>();
@@ -101,6 +112,8 @@ public abstract class XMLWalker<T> {
private CmisExtensionElement handleExtensionLevel(final XMLStreamReader parser, final int level)
throws XMLStreamException {
+ assert parser != null;
+
final QName name = parser.getName();
Map<String, String> attributes = null;
StringBuilder sb = new StringBuilder();
@@ -170,10 +183,14 @@ public abstract class XMLWalker<T> {
}
protected String readText(final XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
return XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH);
}
protected Boolean readBoolean(final XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
String value = readText(parser);
if ("true".equals(value) || "1".equals(value)) {
@@ -188,6 +205,8 @@ public abstract class XMLWalker<T> {
}
protected BigInteger readInteger(final XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
String value = readText(parser);
try {
@@ -198,6 +217,8 @@ public abstract class XMLWalker<T> {
}
protected BigDecimal readDecimal(final XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
String value = readText(parser);
try {
@@ -208,6 +229,8 @@ public abstract class XMLWalker<T> {
}
protected GregorianCalendar readDateTime(final XMLStreamReader parser) throws XMLStreamException {
+ assert parser != null;
+
String value = readText(parser);
GregorianCalendar result = DateTimeHelper.parseXmlDateTime(value);
@@ -219,6 +242,9 @@ public abstract class XMLWalker<T> {
}
public <E extends Enum<E>> E readEnum(final XMLStreamReader parser, final Class<E> clazz) throws XMLStreamException {
+ assert parser != null;
+ assert clazz != null;
+
return CmisEnumHelper.fromValue(readText(parser), clazz);
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.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/dataobjects/AbstractTypeDefinition.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java Wed Aug 14 21:45:01 2013
@@ -53,6 +53,8 @@ public abstract class AbstractTypeDefini
private TypeMutability typeMutability;
public void initialize(TypeDefinition typeDefinition) {
+ assert typeDefinition != null;
+
setId(typeDefinition.getId());
setLocalName(typeDefinition.getLocalName());
setLocalNamespace(typeDefinition.getLocalNamespace());
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamImpl.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/dataobjects/ContentStreamImpl.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ContentStreamImpl.java Wed Aug 14 21:45:01 2013
@@ -34,7 +34,7 @@ public class ContentStreamImpl extends A
private String filename;
private BigInteger length;
- private String mimeType;
+ private String mimetype;
private transient InputStream stream;
/**
@@ -47,10 +47,10 @@ public class ContentStreamImpl extends A
* Constructor.
*/
public ContentStreamImpl(String filename, BigInteger length, String mimetype, InputStream stream) {
- setLength(length);
- setMimeType(mimetype);
- setFileName(filename);
- setStream(stream);
+ this.filename = filename;
+ this.length = length;
+ this.mimetype = mimetype;
+ this.stream = stream;
}
/**
@@ -64,10 +64,11 @@ public class ContentStreamImpl extends A
// cannot happen
bytes = string.getBytes();
}
- setLength(BigInteger.valueOf(bytes.length));
- setMimeType(mimetype);
- setFileName(filename);
- setStream(new ByteArrayInputStream(bytes));
+
+ this.filename = filename;
+ this.length = BigInteger.valueOf(bytes.length);
+ this.mimetype = mimetype;
+ this.stream = new ByteArrayInputStream(bytes);
}
public String getFileName() {
@@ -91,11 +92,11 @@ public class ContentStreamImpl extends A
}
public String getMimeType() {
- return mimeType;
+ return mimetype;
}
public void setMimeType(String mimeType) {
- this.mimeType = mimeType;
+ this.mimetype = mimeType;
}
public InputStream getStream() {
@@ -108,7 +109,7 @@ public class ContentStreamImpl extends A
@Override
public String toString() {
- return "ContentStream [filename=" + filename + ", length=" + length + ", MIME type=" + mimeType
+ return "ContentStream [filename=" + filename + ", length=" + length + ", MIME type=" + mimetype
+ ", has stream=" + (stream != null) + "]" + super.toString();
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/ConverterTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/ConverterTest.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/ConverterTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/ConverterTest.java Wed Aug 14 21:45:01 2013
@@ -54,12 +54,14 @@ import org.apache.chemistry.opencmis.com
import org.apache.chemistry.opencmis.commons.impl.dataobjects.PermissionMappingDataImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryCapabilitiesImpl;
import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoImpl;
+import org.junit.Test;
/**
* Tests converter methods.
*/
public class ConverterTest extends TestCase {
+ @Test
public void testRepositoryInfo() throws Exception {
// dry run
RepositoryInfoImpl obj1 = new RepositoryInfoImpl();
@@ -130,6 +132,7 @@ public class ConverterTest extends TestC
assertDataObjectsEquals("RepositoryInfo", obj1, obj2);
}
+ @Test
public void testTypeDefinition() throws Exception {
// dry run
DocumentTypeDefinitionImpl obj1 = new DocumentTypeDefinitionImpl();
@@ -161,6 +164,7 @@ public class ConverterTest extends TestC
assertDataObjectsEquals("TypeDefinition", obj1, obj2);
}
+ @Test
public void testObject() throws Exception {
// dry run
ObjectDataImpl obj1 = new ObjectDataImpl();
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MimeHelperTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MimeHelperTest.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MimeHelperTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MimeHelperTest.java Wed Aug 14 21:45:01 2013
@@ -31,72 +31,55 @@ import java.util.Map;
import junit.framework.TestCase;
+import org.junit.Test;
+
public class MimeHelperTest extends TestCase {
+ @Test
public void testEncodeContentDisposition() {
- assertEquals("inline; filename=foo.bar",
- encodeContentDisposition("inline", "foo.bar"));
- assertEquals("attachment; filename=foo.bar",
- encodeContentDisposition(null, "foo.bar"));
- assertEquals("attachment; filename*=UTF-8''caf%C3%A9.pdf",
- encodeContentDisposition(null, "caf\u00e9.pdf"));
- assertEquals(
- "attachment; filename*=UTF-8''%20%27%2A%25%20abc%20%C2%81%C2%82%0D%0A%09",
+ assertEquals("inline; filename=foo.bar", encodeContentDisposition("inline", "foo.bar"));
+ assertEquals("attachment; filename=foo.bar", encodeContentDisposition(null, "foo.bar"));
+ assertEquals("attachment; filename*=UTF-8''caf%C3%A9.pdf", encodeContentDisposition(null, "caf\u00e9.pdf"));
+ assertEquals("attachment; filename*=UTF-8''%20%27%2A%25%20abc%20%C2%81%C2%82%0D%0A%09",
encodeContentDisposition(null, " '*% abc \u0081\u0082\r\n\t"));
}
+ @Test
public void testDecodeContentDisposition() {
Map<String, String> params = new HashMap<String, String>();
Map<String, String> expected = new HashMap<String, String>();
- assertEquals("attachment",
- decodeContentDisposition("attachment; a=b; c=d", params));
+ assertEquals("attachment", decodeContentDisposition("attachment; a=b; c=d", params));
expected.put("a", "b");
expected.put("c", "d");
assertEquals(expected, params);
params.clear();
expected.clear();
- assertEquals(
- "inline",
- decodeContentDisposition(
- " inline ; a = \"b b\" (this is a comment) ; c =d;",
- params));
+ assertEquals("inline", decodeContentDisposition(" inline ; a = \"b b\" (this is a comment) ; c =d;", params));
expected.put("a", "b b");
expected.put("c", "d");
assertEquals(expected, params);
params.clear();
expected.clear();
- assertEquals(
- "inline",
- decodeContentDisposition(
- "inline; modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\"",
- params));
- assertEquals(Collections.singletonMap("modification-date",
- "Wed, 12 Feb 1997 16:29:51 -0500"), params);
+ assertEquals("inline",
+ decodeContentDisposition("inline; modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\"", params));
+ assertEquals(Collections.singletonMap("modification-date", "Wed, 12 Feb 1997 16:29:51 -0500"), params);
params.clear();
}
+ @Test
public void testDecodeContentDispositionFilename() {
assertNull(decodeContentDispositionFilename("attachment; a=b; c=d;"));
assertNull(decodeContentDispositionFilename("inline"));
assertNull(decodeContentDispositionFilename("inline; modification-date=\"Wed, 12 Feb 1997 16:29:51 -0500\""));
- assertEquals(
- "foo.bar",
- decodeContentDispositionFilename("attachment; filename=foo.bar"));
- assertEquals(
- "foo.bar",
- decodeContentDispositionFilename("attachment; filename = \"foo.bar\""));
- assertEquals(
- "foo.bar",
+ assertEquals("foo.bar", decodeContentDispositionFilename("attachment; filename=foo.bar"));
+ assertEquals("foo.bar", decodeContentDispositionFilename("attachment; filename = \"foo.bar\""));
+ assertEquals("foo.bar",
decodeContentDispositionFilename(" guess ; filename = (this is rfc822 a comment) \"foo.bar\""));
- assertEquals(
- "caf\u00e9.pdf",
- decodeContentDispositionFilename("foo; filename*=UTF-8''caf%C3%A9.pdf"));
- assertEquals(
- "caf\u00e9.pdf",
- decodeContentDispositionFilename("bar; filename*=ISO-8859-1''caf%E9.pdf"));
+ assertEquals("caf\u00e9.pdf", decodeContentDispositionFilename("foo; filename*=UTF-8''caf%C3%A9.pdf"));
+ assertEquals("caf\u00e9.pdf", decodeContentDispositionFilename("bar; filename*=ISO-8859-1''caf%E9.pdf"));
}
}
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MiscTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MiscTest.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MiscTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/MiscTest.java Wed Aug 14 21:45:01 2013
@@ -25,18 +25,21 @@ package org.apache.chemistry.opencmis.co
import junit.framework.TestCase;
import org.apache.chemistry.opencmis.commons.impl.UrlBuilder;
+import org.junit.Test;
/**
* Tests miscellaneous details.
*/
public class MiscTest extends TestCase {
+ @Test
public void testUrlBuilder() {
assertEquals("http://host/test", (new UrlBuilder("http://host/test")).toString());
assertEquals("http://host/test?query=value", (new UrlBuilder("http://host/test?query=value")).toString());
assertEquals("http://host/test", (new UrlBuilder("http://host/test?")).toString());
}
+ @Test
public void testUrlBuilderAddParameter() {
UrlBuilder urlBuilder;
@@ -54,6 +57,7 @@ public class MiscTest extends TestCase {
assertEquals("http://host/test?query=caf%C3%A9+cr%C3%A8me", urlBuilder.toString());
}
+ @Test
public void testUrlBuilderAddPath() {
UrlBuilder urlBuilder;
@@ -83,6 +87,7 @@ public class MiscTest extends TestCase {
assertEquals("http://host/test/path/caf%C3%A9%20d%40d", urlBuilder.toString());
}
+ @Test
public void testUrlBuilderAddPathSegment() {
UrlBuilder urlBuilder;
Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/xml/AbstractXMLConverterTest.java Wed Aug 14 21:45:01 2013
@@ -259,7 +259,7 @@ public abstract class AbstractXMLConvert
*/
protected String format(byte[] xmlDocument) throws TransformerException {
TransformerFactory tf = TransformerFactory.newInstance();
- tf.setAttribute("indent-number", new Integer(2));
+ tf.setAttribute("indent-number", Integer.valueOf(2));
Transformer transformer = tf.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.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/atompub/AclService.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AclService.java Wed Aug 14 21:45:01 2013
@@ -57,6 +57,12 @@ public class AclService {
public static class GetAcl extends AclServiceCall {
public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
HttpServletResponse response) throws Exception {
+ assert context != null;
+ assert service != null;
+ assert repositoryId != null;
+ assert request != null;
+ assert response != null;
+
// get parameters
String objectId = getStringParameter(request, Constants.PARAM_ID);
Boolean onlyBasicPermissions = getBooleanParameter(request, Constants.PARAM_ONLY_BASIC_PERMISSIONS);
@@ -83,6 +89,7 @@ public class AclService {
public static class ApplyAcl extends AclServiceCall {
public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
HttpServletResponse response) throws Exception {
+
// get parameters
String objectId = getStringParameter(request, Constants.PARAM_ID);
AclPropagation aclPropagation = getEnumParameter(request, Constants.PARAM_ACL_PROPAGATION,
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.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/atompub/DiscoveryService.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/DiscoveryService.java Wed Aug 14 21:45:01 2013
@@ -54,6 +54,12 @@ public class DiscoveryService {
public static class Query extends AbstractAtomPubServiceCall {
public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
HttpServletResponse response) throws Exception {
+ assert context != null;
+ assert service != null;
+ assert repositoryId != null;
+ assert request != null;
+ assert response != null;
+
// get parameters
String statement = null;
Boolean searchAllVersions = null;
@@ -208,6 +214,12 @@ public class DiscoveryService {
public static class GetContentChanges extends AbstractAtomPubServiceCall {
public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
HttpServletResponse response) throws Exception {
+ assert context != null;
+ assert service != null;
+ assert repositoryId != null;
+ assert request != null;
+ assert response != null;
+
// get parameters
String changeLogToken = getStringParameter(request, Constants.PARAM_CHANGE_LOG_TOKEN);
Boolean includeProperties = getBooleanParameter(request, Constants.PARAM_PROPERTIES);
Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.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/atompub/MultiFilingService.java?rev=1514061&r1=1514060&r2=1514061&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/MultiFilingService.java Wed Aug 14 21:45:01 2013
@@ -43,6 +43,12 @@ public class MultiFilingService {
public static class RemoveObjectFromFolder extends AbstractAtomPubServiceCall {
public void serve(CallContext context, CmisService service, String repositoryId, HttpServletRequest request,
HttpServletResponse response) throws Exception {
+ assert context != null;
+ assert service != null;
+ assert repositoryId != null;
+ assert request != null;
+ assert response != null;
+
// get parameters
String removeFrom = getStringParameter(request, Constants.PARAM_REMOVE_FROM);