Return-Path: X-Original-To: apmail-chemistry-commits-archive@www.apache.org Delivered-To: apmail-chemistry-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7F76E10CB1 for ; Mon, 19 Aug 2013 22:12:51 +0000 (UTC) Received: (qmail 61185 invoked by uid 500); 19 Aug 2013 22:12:51 -0000 Delivered-To: apmail-chemistry-commits-archive@chemistry.apache.org Received: (qmail 61135 invoked by uid 500); 19 Aug 2013 22:12:51 -0000 Mailing-List: contact commits-help@chemistry.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@chemistry.apache.org Delivered-To: mailing list commits@chemistry.apache.org Received: (qmail 61127 invoked by uid 99); 19 Aug 2013 22:12:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Aug 2013 22:12:51 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Aug 2013 22:12:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 004882388A3D; Mon, 19 Aug 2013 22:12:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1515639 [1/3] - in /chemistry/opencmis/trunk: chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-android/chemistry-opencmis-android-clien... Date: Mon, 19 Aug 2013 22:12:09 -0000 To: commits@chemistry.apache.org From: fmui@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20130819221214.004882388A3D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fmui Date: Mon Aug 19 22:12:07 2013 New Revision: 1515639 URL: http://svn.apache.org/r1515639 Log: more code clean up Added: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/test/java/org/apache/chemistry/opencmis/commons/impl/misc/IOUtilsTest.java (with props) Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Output.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.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/util/AbstractIterator.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/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.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/JSONConstants.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/MimeHelper.java chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.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/XMLConstants.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/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/ObjectDataImpl.java chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/PermissionDefinitionDataImpl.java chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/JSONValue.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/AtomDocumentBase.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/AbstractBrowserServiceCall.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/ControlParser.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/MultipartParser.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/webservices/ObjectService.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ExceptionHelper.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-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/QueryStringHttpServletRequestWrapper.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStreamFactory.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/MultipartParserTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/main/java/org/apache/chemistry/opencmis/inmemory/server/InMemoryServiceFactoryImpl.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/AclTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/ObjectCreator.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/ProcessQueryTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-inmemory/src/test/java/org/apache/chemistry/opencmis/inmemory/query/QueryParseTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrBinary.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrDocument.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrService.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrTypeManager.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrUnversionedDocument.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/JcrVersionBase.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PathManager.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/PropertyHelper.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/impl/DefaultUnversionedDocumentTypeHandler.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/EvaluatorBase.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/EvaluatorXPath.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/IdentifierMapBase.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/ParseTreeWalker.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/query/QueryTranslator.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrDocumentTypeHandler.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrFolderTypeHandler.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrTypeHandler.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/type/JcrTypeHandlerManager.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/main/java/org/apache/chemistry/opencmis/jcr/util/Iterables.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/chemistry/opencmis/jcr/JcrObservationJournalTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/chemistry/opencmis/jcr/query/QueryTranslatorTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/chemistry/opencmis/jcr/query/XPathBuilderTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-jcr/src/test/java/org/apache/jackrabbit/core/security/TestSecurityManager.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/filter/LoggingFilter.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactoryTest.java chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/test/java/org/apache/chemistry/opencmis/server/support/query/StringUtilTest.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-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/WrapperCmisTestGroup.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/report/AbstractCmisTestReport.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/CmisTckAntTask.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/control/ACLSmokeTest.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/crud/SetAndDeleteContentTest.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersionDeleteTest.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/tests/versioning/VersioningStateCreateTest.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/AbstractMetadataParser.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/parser/MetadataParserTika.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalGenerator.java chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/repository/ObjectGenerator.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/InfoDialog.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/LoginDialog.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/PropertyEditorFrame.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/TypesFrame.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/Workbench.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ObjectListener.java chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/CMIS.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/counttypes.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/download.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/getdescendants.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/ping.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/query.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/startup.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/stats.groovy chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/resources/scripts/upload.groovy Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java Mon Aug 19 22:12:07 2013 @@ -45,6 +45,7 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException; import org.apache.chemistry.opencmis.commons.impl.Base64; import org.apache.chemistry.opencmis.commons.impl.DateTimeHelper; +import org.apache.chemistry.opencmis.commons.impl.IOUtils; import org.apache.chemistry.opencmis.commons.impl.XMLConstants; import org.apache.chemistry.opencmis.commons.impl.XMLConverter; import org.apache.chemistry.opencmis.commons.impl.XMLUtils; @@ -58,7 +59,7 @@ import android.util.Xml; */ public class AtomEntryWriter { - public static final String ENCODING = "UTF-8"; + public static final String ENCODING = IOUtils.UTF8; private static final int BUFFER_SIZE = 64 * 1024; Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/CmisAtomPubConstants.java Mon Aug 19 22:12:07 2013 @@ -85,7 +85,7 @@ public final class CmisAtomPubConstants // Android Parser Specific public static final String TAG_PROPERTY = "property"; - public static final String ATTR__PROPERTY_ID = "id"; + public static final String ATTR_PROPERTY_ID = "id"; public static final String ATTR_PROPERTY_LOCALNAME = "localName"; public static final String ATTR_PROPERTY_DISPLAYNAME = "displayName"; public static final String ATTR_PROPERTY_QUERYNAME = "queryName"; Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/LinkCache.java Mon Aug 19 22:12:07 2013 @@ -19,8 +19,6 @@ package org.apache.chemistry.opencmis.client.bindings.spi.atompub; import java.io.Serializable; -import java.io.UnsupportedEncodingException; -import java.net.URLEncoder; import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -33,6 +31,7 @@ import org.apache.chemistry.opencmis.cli import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; import org.apache.chemistry.opencmis.commons.SessionParameter; import org.apache.chemistry.opencmis.commons.impl.Constants; +import org.apache.chemistry.opencmis.commons.impl.IOUtils; import org.apache.chemistry.opencmis.commons.impl.UrlBuilder; /** @@ -150,8 +149,7 @@ public class LinkCache implements Serial String[] params = link.substring(i + 1).split("&"); for (String param : params) { String[] parts = param.split("=", 2); - if (parts[0].equals(Constants.PARAM_STREAM_ID) - && parts.length == 2) { + if (parts[0].equals(Constants.PARAM_STREAM_ID) && parts.length == 2) { return parts[1]; } } @@ -282,11 +280,7 @@ public class LinkCache implements Serial String paramValue = UrlBuilder.normalizeParameter(parameters.get(param.toString())); if (paramValue != null) { - try { - result.append(URLEncoder.encode(paramValue, "UTF-8")); - } catch (UnsupportedEncodingException e) { - result.append(paramValue); - } + result.append(IOUtils.encodeURL(paramValue)); } param = new StringBuilder(); @@ -332,7 +326,7 @@ public class LinkCache implements Serial /* * (non-Javadoc) - * + * * @see java.lang.Object#toString() */ @Override Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java Mon Aug 19 22:12:07 2013 @@ -23,7 +23,6 @@ import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketTimeoutException; -import java.net.UnknownHostException; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.SSLSocket; @@ -106,7 +105,7 @@ public class ApacheClientHttpInvoker ext // build new socket factory return new LayeredSocketFactory() { - public boolean isSecure(Socket sock) throws IllegalArgumentException { + public boolean isSecure(Socket sock) { return true; } @@ -114,8 +113,7 @@ public class ApacheClientHttpInvoker ext return (SSLSocket) sf.createSocket(); } - public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException, - UnknownHostException { + public Socket createSocket(Socket socket, String host, int port, boolean autoClose) throws IOException { SSLSocket sslSocket = (SSLSocket) sf.createSocket(socket, host, port, autoClose); verify(hv, host, sslSocket); @@ -123,7 +121,7 @@ public class ApacheClientHttpInvoker ext } public Socket connectSocket(Socket sock, String host, int port, InetAddress localAddress, int localPort, - HttpParams params) throws IOException, UnknownHostException, ConnectTimeoutException { + HttpParams params) throws IOException { SSLSocket sslSocket = (SSLSocket) (sock != null ? sock : createSocket()); if (localAddress != null || localPort > 0) { Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConverter.java Mon Aug 19 22:12:07 2013 @@ -162,7 +162,7 @@ public final class XMLConverter { // --------------- public static void writeRepositoryInfo(XmlSerializer writer, CmisVersion cmisVersion, String namespace, - RepositoryInfo source) throws IllegalArgumentException, IllegalStateException, IOException { + RepositoryInfo source) throws IOException { if (source == null) { return; } @@ -210,7 +210,7 @@ public final class XMLConverter { } public static void writeRepositoryCapabilities(XmlSerializer writer, CmisVersion cmisVersion, - RepositoryCapabilities source) throws IllegalArgumentException, IllegalStateException, IOException { + RepositoryCapabilities source) throws IOException { if (source == null) { return; } @@ -300,7 +300,7 @@ public final class XMLConverter { } public static void writeAclCapabilities(XmlSerializer writer, CmisVersion cmisVersion, AclCapabilities source) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { if (source == null) { return; } @@ -343,7 +343,7 @@ public final class XMLConverter { } public static void writeExtendedFeatures(XmlSerializer writer, CmisVersion cmisVersion, ExtensionFeature source) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { if (source == null) { return; } @@ -375,7 +375,7 @@ public final class XMLConverter { // -------------------------- public static void writeTypeDefinition(XmlSerializer writer, CmisVersion cmisVersion, String namespace, - TypeDefinition source) throws IllegalArgumentException, IllegalStateException, IOException { + TypeDefinition source) throws IOException { if (source == null) { return; } @@ -472,7 +472,7 @@ public final class XMLConverter { } public static void writePropertyDefinition(XmlSerializer writer, CmisVersion cmisVersion, - PropertyDefinition source) throws IllegalArgumentException, IllegalStateException, IOException { + PropertyDefinition source) throws IOException { if (source == null) { return; } @@ -603,8 +603,7 @@ public final class XMLConverter { } @SuppressWarnings("unchecked") - public static void writeChoice(XmlSerializer writer, PropertyType propType, Choice source) - throws IllegalArgumentException, IllegalStateException, IOException { + public static void writeChoice(XmlSerializer writer, PropertyType propType, Choice source) throws IOException { if (source == null) { return; } @@ -665,12 +664,12 @@ public final class XMLConverter { // ----------------------- public static void writeObject(XmlSerializer writer, CmisVersion cmisVersion, String namespace, ObjectData source) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { writeObject(writer, cmisVersion, false, TAG_OBJECT, namespace, source); } public static void writeObject(XmlSerializer writer, CmisVersion cmisVersion, boolean root, String name, - String namespace, ObjectData source) throws IllegalArgumentException, IllegalStateException, IOException { + String namespace, ObjectData source) throws IOException { if (source == null) { return; @@ -772,7 +771,7 @@ public final class XMLConverter { @SuppressWarnings("unchecked") public static void writeProperty(XmlSerializer writer, PropertyData source, boolean isDefaultValue) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { if (source == null) { return; } @@ -860,7 +859,7 @@ public final class XMLConverter { } public static void writeAllowableActions(XmlSerializer writer, CmisVersion cmisVersion, boolean root, - AllowableActions source) throws IllegalArgumentException, IllegalStateException, IOException { + AllowableActions source) throws IOException { if (source == null) { return; } @@ -890,7 +889,7 @@ public final class XMLConverter { } public static void writeAcl(XmlSerializer writer, CmisVersion cmisVersion, boolean root, Acl source) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { if (source == null) { return; } @@ -939,7 +938,7 @@ public final class XMLConverter { // ------------- public static void writeQuery(XmlSerializer writer, CmisVersion cmisVersion, QueryTypeImpl source) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { if (source == null) { return; } @@ -966,7 +965,7 @@ public final class XMLConverter { // ------------------- public static void writeBulkUpdate(XmlSerializer writer, String namespace, BulkUpdateImpl bulkUpdate) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { if (bulkUpdate == null || bulkUpdate.getObjectIdAndChangeToken() == null) { return; } @@ -1040,7 +1039,7 @@ public final class XMLConverter { } private static void writeExtensionElement(XmlSerializer writer, CmisExtensionElement source, LinkedList ns) - throws IllegalArgumentException, IllegalStateException, IOException { + throws IOException { if (source == null || source.getName() == null) { return; } @@ -2134,7 +2133,7 @@ public final class XMLConverter { } }; - private static abstract class ChoiceAtomPubXMLWalker extends XMLWalker> { + private abstract static class ChoiceAtomPubXMLWalker extends XMLWalker> { public void addToChoiceList(XmlPullParser parser, AbstractPropertyDefinition propDef) throws XmlPullParserException { @@ -2572,7 +2571,7 @@ public final class XMLConverter { } }; - private static abstract class PropertyAtomPubXMLWalker> extends XMLWalker { + private abstract static class PropertyAtomPubXMLWalker> extends XMLWalker { protected abstract T createTarget(XmlPullParser parser, QName name); @@ -2614,7 +2613,7 @@ public final class XMLConverter { }; - private static abstract class PropertyStringAtomPubXMLWalker> extends + private abstract static class PropertyStringAtomPubXMLWalker> extends PropertyAtomPubXMLWalker { @Override protected void addValue(XmlPullParser parser, T target) throws XmlPullParserException { Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/StandardAuthenticationProvider.java Mon Aug 19 22:12:07 2013 @@ -18,7 +18,6 @@ */ package org.apache.chemistry.opencmis.client.bindings.spi; -import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -30,6 +29,7 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; import org.apache.chemistry.opencmis.commons.impl.Base64; import org.apache.chemistry.opencmis.commons.impl.DateTimeHelper; +import org.apache.chemistry.opencmis.commons.impl.IOUtils; import org.apache.chemistry.opencmis.commons.impl.XMLUtils; import org.w3c.dom.Document; import org.w3c.dom.Element; @@ -218,13 +218,8 @@ public class StandardAuthenticationProvi password = ""; } - try { - return Collections.singletonList("Basic " - + Base64.encodeBytes((username + ":" + password).getBytes("UTF-8"))); - } catch (UnsupportedEncodingException e) { - // shouldn't happen... - throw new CmisRuntimeException("Unsupported encoding 'UTF-8'", e); - } + return Collections + .singletonList("Basic " + Base64.encodeBytes(IOUtils.getUTF8Bytes(username + ":" + password))); } /** Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.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/browser/AbstractBrowserBindingService.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AbstractBrowserBindingService.java Mon Aug 19 22:12:07 2013 @@ -59,6 +59,7 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.impl.dataobjects.RepositoryInfoBrowserBindingImpl; import org.apache.chemistry.opencmis.commons.impl.json.JSONObject; import org.apache.chemistry.opencmis.commons.impl.json.parser.ContainerFactory; +import org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParseException; import org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParser; /** @@ -206,9 +207,12 @@ public abstract class AbstractBrowserBin protected CmisBaseException convertStatusCode(int code, String message, String errorContent, Throwable t) { Object obj = null; try { - JSONParser parser = new JSONParser(); - obj = parser.parse(errorContent); - } catch (Exception pe) { + if (errorContent != null) { + JSONParser parser = new JSONParser(); + obj = parser.parse(errorContent); + } + } catch (JSONParseException pe) { + // error content is not valid JSON -> ignore } if (obj instanceof JSONObject) { Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.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/browser/FormDataWriter.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java Mon Aug 19 22:12:07 2013 @@ -36,6 +36,7 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.data.Properties; import org.apache.chemistry.opencmis.commons.data.PropertyData; import org.apache.chemistry.opencmis.commons.impl.Constants; +import org.apache.chemistry.opencmis.commons.impl.IOUtils; import org.apache.chemistry.opencmis.commons.impl.MimeHelper; import org.apache.chemistry.opencmis.commons.impl.UrlBuilder; @@ -218,7 +219,7 @@ public class FormDataWriter { public void write(OutputStream out) throws IOException { if (contentStream == null || contentStream.getStream() == null) { boolean first = true; - byte[] amp = "&".getBytes("UTF-8"); + byte[] amp = IOUtils.getUTF8Bytes("&"); for (Map.Entry param : parameters.entrySet()) { if (first) { @@ -227,7 +228,7 @@ public class FormDataWriter { out.write(amp); } - out.write((param.getKey() + "=" + URLEncoder.encode(param.getValue(), "UTF-8")).getBytes("UTF-8")); + out.write(IOUtils.getUTF8Bytes(param.getKey() + "=" + URLEncoder.encode(param.getValue(), "UTF-8"))); } } else { writeLine(out); @@ -287,6 +288,6 @@ public class FormDataWriter { private void writeLine(OutputStream out, String s) throws IOException { s = (s == null ? CRLF : s + CRLF); - out.write(s.getBytes("UTF-8")); + out.write(IOUtils.getUTF8Bytes(s)); } } Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.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/http/AbstractApacheClientHttpInvoker.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/AbstractApacheClientHttpInvoker.java Mon Aug 19 22:12:07 2013 @@ -296,7 +296,7 @@ public abstract class AbstractApacheClie // get the response return new Response(respCode, response.getStatusLine().getReasonPhrase(), responseHeaders, inputStream, errorStream); - } catch (Exception e) { + } catch (IOException e) { throw new CmisConnectionException("Cannot access " + url + ": " + e.getMessage(), e); } } Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Output.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/http/Output.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Output.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Output.java Mon Aug 19 22:12:07 2013 @@ -24,5 +24,6 @@ import java.io.OutputStream; * Output interface. */ public interface Output { - void write(OutputStream out) throws Exception; // NOPMD + @SuppressWarnings("PMD.SignatureDeclareThrowsException") + void write(OutputStream out) throws Exception; } \ No newline at end of file Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.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/webservices/MultiFilingServiceImpl.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/MultiFilingServiceImpl.java Mon Aug 19 22:12:07 2013 @@ -21,6 +21,8 @@ package org.apache.chemistry.opencmis.cl import static org.apache.chemistry.opencmis.commons.impl.WSConverter.convertExtensionHolder; import static org.apache.chemistry.opencmis.commons.impl.WSConverter.setExtensionValues; +import javax.xml.ws.Holder; + import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession; import org.apache.chemistry.opencmis.commons.data.ExtensionsData; import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; @@ -29,8 +31,6 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.impl.jaxb.MultiFilingServicePort; import org.apache.chemistry.opencmis.commons.spi.MultiFilingService; -import javax.xml.ws.Holder; - /** * MultiFiling Service Web Services client. */ Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.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/framework/AbstractCmisTestCase.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractCmisTestCase.java Mon Aug 19 22:12:07 2013 @@ -18,7 +18,18 @@ */ package org.apache.chemistry.opencmis.client.bindings.framework; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; +import java.io.InputStream; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Enumeration; +import java.util.List; +import java.util.Set; + import junit.framework.TestCase; + import org.apache.chemistry.opencmis.commons.PropertyIds; import org.apache.chemistry.opencmis.commons.data.Ace; import org.apache.chemistry.opencmis.commons.data.Acl; @@ -54,16 +65,6 @@ import org.apache.chemistry.opencmis.com import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.FileInputStream; -import java.io.InputStream; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.List; -import java.util.Set; - /** * Base test case for CMIS tests. * Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.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/framework/AbstractSimpleReadOnlyTests.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadOnlyTests.java Mon Aug 19 22:12:07 2013 @@ -18,6 +18,10 @@ */ package org.apache.chemistry.opencmis.client.bindings.framework; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + import org.apache.chemistry.opencmis.commons.PropertyIds; import org.apache.chemistry.opencmis.commons.data.Acl; import org.apache.chemistry.opencmis.commons.data.AllowableActions; @@ -42,10 +46,6 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships; import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - /** * Simple read-only tests. * Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.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/framework/AbstractSimpleReadWriteTests.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/test/java/org/apache/chemistry/opencmis/client/bindings/framework/AbstractSimpleReadWriteTests.java Mon Aug 19 22:12:07 2013 @@ -18,6 +18,10 @@ */ package org.apache.chemistry.opencmis.client.bindings.framework; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + import org.apache.chemistry.opencmis.commons.PropertyIds; import org.apache.chemistry.opencmis.commons.data.Ace; import org.apache.chemistry.opencmis.commons.data.Acl; @@ -32,10 +36,6 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException; import org.apache.chemistry.opencmis.commons.spi.Holder; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - /** * Simple read-write test. */ Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.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/ObjectIdImpl.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/ObjectIdImpl.java Mon Aug 19 22:12:07 2013 @@ -35,7 +35,11 @@ public class ObjectIdImpl implements Obj * Constructor. */ public ObjectIdImpl(String id) { - setId(id); + if (id == null || id.length() == 0) { + throw new IllegalArgumentException("Id must be set!"); + } + + this.id = id; } public String getId() { @@ -46,7 +50,7 @@ public class ObjectIdImpl implements Obj * Sets the id. */ public void setId(String id) { - if ((id == null) || (id.length() == 0)) { + if (id == null || id.length() == 0) { throw new IllegalArgumentException("Id must be set!"); } 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=1515639&r1=1515638&r2=1515639&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 Mon Aug 19 22:12:07 2013 @@ -213,7 +213,7 @@ public class SessionImpl implements Sess Object of = objectFactoryClass.newInstance(); if (!(of instanceof ObjectFactory)) { - throw new Exception("Class does not implement ObjectFactory!"); + throw new InstantiationException("Class does not implement ObjectFactory!"); } ((ObjectFactory) of).initialize(this, parameters); @@ -237,7 +237,7 @@ public class SessionImpl implements Sess Object of = cacheClass.newInstance(); if (!(of instanceof Cache)) { - throw new Exception("Class does not implement Cache!"); + throw new InstantiationException("Class does not implement Cache!"); } ((Cache) of).initialize(this, parameters); @@ -497,7 +497,7 @@ public class SessionImpl implements Sess public ItemIterable getTypeChildren(final String typeId, final boolean includePropertyDefinitions) { final RepositoryService repositoryService = getBinding().getRepositoryService(); - final ObjectFactory objectFactory = this.getObjectFactory(); + final ObjectFactory of = this.getObjectFactory(); return new CollectionIterable(new AbstractPageFetcher(this.getDefaultContext() .getMaxItemsPerPage()) { @@ -513,7 +513,7 @@ public class SessionImpl implements Sess // convert type definitions List page = new ArrayList(tdl.getList().size()); for (TypeDefinition typeDefinition : tdl.getList()) { - page.add(objectFactory.convertTypeDefinition(typeDefinition)); + page.add(of.convertTypeDefinition(typeDefinition)); } return new AbstractPageFetcher.Page(page, tdl.getNumItems(), tdl.hasMoreItems()) { @@ -589,7 +589,7 @@ public class SessionImpl implements Sess } final DiscoveryService discoveryService = getBinding().getDiscoveryService(); - final ObjectFactory objectFactory = this.getObjectFactory(); + final ObjectFactory of = this.getObjectFactory(); final OperationContext ctxt = new OperationContextImpl(context); return new CollectionIterable(new AbstractPageFetcher(ctxt.getMaxItemsPerPage()) { @@ -611,7 +611,7 @@ public class SessionImpl implements Sess continue; } - page.add(objectFactory.convertQueryResult(objectData)); + page.add(of.convertQueryResult(objectData)); } } @@ -632,7 +632,7 @@ public class SessionImpl implements Sess } final DiscoveryService discoveryService = getBinding().getDiscoveryService(); - final ObjectFactory objectFactory = this.getObjectFactory(); + final ObjectFactory of = this.getObjectFactory(); final OperationContext ctxt = new OperationContextImpl(context); final StringBuilder statement = new StringBuilder("SELECT "); @@ -677,7 +677,7 @@ public class SessionImpl implements Sess continue; } - page.add(objectFactory.convertObject(objectData, ctxt)); + page.add(of.convertObject(objectData, ctxt)); } } Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.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/util/AbstractIterator.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/util/AbstractIterator.java Mon Aug 19 22:12:07 2013 @@ -54,9 +54,9 @@ public abstract class AbstractIterator page = getCurrentPage(); - if (page != null) { - List items = page.getItems(); + Page currentPage = getCurrentPage(); + if (currentPage != null) { + List items = currentPage.getItems(); if (items != null) { return items.size(); } @@ -67,11 +67,11 @@ public abstract class AbstractIterator page = getCurrentPage(); - if (page != null) { + Page currentPage = getCurrentPage(); + if (currentPage != null) { // set number of items - if (page.getTotalNumItems() != null) { - totalNumItems = page.getTotalNumItems(); + if (currentPage.getTotalNumItems() != null) { + totalNumItems = currentPage.getTotalNumItems(); } } } @@ -81,10 +81,10 @@ public abstract class AbstractIterator page = getCurrentPage(); - if (page != null) { - if (page.getHasMoreItems() != null) { - hasMoreItems = page.getHasMoreItems(); + Page currentPage = getCurrentPage(); + if (currentPage != null) { + if (currentPage.getHasMoreItems() != null) { + hasMoreItems = currentPage.getHasMoreItems(); } } } 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=1515639&r1=1515638&r2=1515639&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 Mon Aug 19 22:12:07 2013 @@ -28,7 +28,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintStream; -import java.io.UnsupportedEncodingException; import java.math.BigInteger; import java.util.HashMap; import java.util.Map; @@ -45,6 +44,7 @@ import org.apache.chemistry.opencmis.com import org.apache.chemistry.opencmis.commons.enums.VersioningState; import org.apache.chemistry.opencmis.commons.exceptions.CmisBaseException; import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; +import org.apache.chemistry.opencmis.commons.impl.IOUtils; import org.apache.chemistry.opencmis.commons.impl.MimeTypes; import org.apache.chemistry.opencmis.commons.impl.dataobjects.ContentStreamImpl; @@ -181,11 +181,7 @@ public final class FileUtils { byte[] contentBytes = new byte[0]; if (content != null) { - try { - contentBytes = content.getBytes("UTF-8"); - } catch (UnsupportedEncodingException e) { - contentBytes = content.getBytes(); - } + contentBytes = IOUtils.getUTF8Bytes(content); } ByteArrayInputStream bais = new ByteArrayInputStream(contentBytes); Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/test/java/org/apache/chemistry/opencmis/client/runtime/ItemIterableTest.java Mon Aug 19 22:12:07 2013 @@ -18,6 +18,11 @@ */ package org.apache.chemistry.opencmis.client.runtime; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + import java.io.IOException; import java.util.ArrayList; import java.util.Iterator; @@ -27,12 +32,10 @@ import java.util.Properties; import org.apache.chemistry.opencmis.client.api.ItemIterable; import org.apache.chemistry.opencmis.client.runtime.util.AbstractPageFetcher; import org.apache.chemistry.opencmis.client.runtime.util.CollectionIterable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.apache.log4j.PropertyConfigurator; import org.junit.Test; - -import static org.junit.Assert.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ItemIterableTest { Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.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/Base64.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.java Mon Aug 19 22:12:07 2013 @@ -18,6 +18,9 @@ */ package org.apache.chemistry.opencmis.commons.impl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + /** *

* Encodes and decodes to and from Base64 notation. @@ -32,6 +35,8 @@ package org.apache.chemistry.opencmis.co */ public final class Base64 { + protected static final Logger LOG = LoggerFactory.getLogger(Base64.class); + /* ******** P U B L I C F I E L D S ******** */ /** No options specified. Value is zero. */ @@ -1221,7 +1226,7 @@ public final class Base64 { } // end try catch (java.io.IOException e) { - e.printStackTrace(); + LOG.error(e.getMessage(), e); // Just return originally-decoded bytes } // end catch finally { Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.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/Constants.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Constants.java Mon Aug 19 22:12:07 2013 @@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.co /** * Constants for CMIS server and client. */ +@SuppressWarnings("PMD.AvoidDuplicateLiterals") public final class Constants { /** 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=1515639&r1=1515638&r2=1515639&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 Mon Aug 19 22:12:07 2013 @@ -18,19 +18,80 @@ */ package org.apache.chemistry.opencmis.commons.impl; +import java.io.BufferedReader; import java.io.Closeable; import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; import java.io.Reader; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.chemistry.opencmis.commons.data.ContentStream; +import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; public final class IOUtils { + /** UTF-8 character set name. */ + public static final String UTF8 = "UTF-8"; + private IOUtils() { } /** + * Return UTF-8 bytes of the given string or throws a + * {@link CmisRuntimeException} if the charset 'UTF-8' is not available. + */ + public static byte[] getUTF8Bytes(String s) { + if (s == null) { + return null; + } + + try { + return s.getBytes(UTF8); + } catch (UnsupportedEncodingException e) { + throw new CmisRuntimeException("Unsupported encoding 'UTF-8'!", e); + } + } + + /** + * URL encodes the given string or throws a {@link CmisRuntimeException} if + * the charset 'UTF-8' is not available. + */ + public static String encodeURL(String s) { + if (s == null) { + return null; + } + + try { + return URLEncoder.encode(s, UTF8); + } catch (UnsupportedEncodingException e) { + throw new CmisRuntimeException("Unsupported encoding 'UTF-8'!", e); + } + } + + /** + * URL dencodes the given string or throws a {@link CmisRuntimeException} if + * the charset 'UTF-8' is not available. + */ + public static String decodeURL(String s) { + if (s == null) { + return null; + } + + try { + return URLDecoder.decode(s, UTF8); + } catch (UnsupportedEncodingException e) { + throw new CmisRuntimeException("Unsupported encoding 'UTF-8'!", e); + } + } + + /** * Closes a stream and ignores any exceptions. */ @SuppressWarnings("PMD.EmptyCatchBlock") @@ -95,4 +156,189 @@ public final class IOUtils { IOUtils.closeQuietly(reader); } } + + /** + * Reads lines from an UTF-8 encoded stream. + * + * @param stream + * the stream + * @param handler + * a handler the processes each line. + */ + public static void readLinesFromStream(InputStream stream, LineHandler handler) throws IOException { + if (stream == null) { + return; + } + + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(stream, UTF8)); + + String line; + while ((line = reader.readLine()) != null) { + if (!handler.handle(line)) { + break; + } + } + } finally { + closeQuietly(reader); + } + } + + /** + * Reads the first line from a stream. + */ + public static String readFirstLine(InputStream stream) throws IOException { + final StringBuilder result = new StringBuilder(); + + readLinesFromStream(stream, new LineHandler() { + public boolean handle(String line) { + result.append(line); + return false; + } + }); + + return result.toString(); + } + + /** + * Reads all lines from a stream. + */ + public static String readAllLines(InputStream stream) throws IOException { + final StringBuilder result = new StringBuilder(); + + readLinesFromStream(stream, new LineHandler() { + public boolean handle(String line) { + result.append(line); + result.append('\n'); + return true; + } + }); + + return result.toString(); + } + + /** + * Reads all lines from a stream and removes the header. + */ + public static String readAllLinesAndRemoveHeader(InputStream stream) throws IOException { + final StringBuilder result = new StringBuilder(); + + readLinesFromStream(stream, new SkipHeaderLineHandler() { + public boolean handle(String line) { + if (!isHeaderLine(line)) { + result.append(line); + result.append('\n'); + } + return true; + } + }); + + return result.toString(); + } + + /** + * Reads all lines from a stream and ignore all comments. + */ + public static String readAllLinesAndIgnoreComments(InputStream stream) throws IOException { + final StringBuilder result = new StringBuilder(); + + readLinesFromStream(stream, new IgnoreCommentsLineHandler() { + public boolean handle(String line) { + if (!isComment(line)) { + result.append(line); + result.append('\n'); + } + return true; + } + }); + + return result.toString(); + } + + /** + * Reads all lines from a stream and ignore all comments. + */ + public static List readAllLinesAsList(InputStream stream) throws IOException { + final List result = new ArrayList(); + + readLinesFromStream(stream, new IgnoreCommentsLineHandler() { + public boolean handle(String line) { + if (!isComment(line)) { + result.add(line); + } + return true; + } + }); + + return result; + } + + /** + * Reads all lines from a stream and ignore all comments. + */ + public static Map readAllLinesAsMap(InputStream stream) throws IOException { + final Map result = new HashMap(); + + readLinesFromStream(stream, new IgnoreCommentsLineHandler() { + public boolean handle(String line) { + if (!isComment(line)) { + int x = line.indexOf('='); + if (x < 0) { + result.put(line.trim(), ""); + } else { + result.put(line.substring(0, x).trim(), line.substring(x + 1).trim()); + } + } + return true; + } + }); + + return result; + } + + public interface LineHandler { + /** + * Handles a line. + * + * @param line + * the line to handle + * + * @return true if the next line should be processed, + * false if the processing should stop. + */ + boolean handle(String line); + } + + public abstract static class SkipHeaderLineHandler implements LineHandler { + + private boolean header = true; + + public boolean isHeaderLine(String line) { + if (!header) { + return false; + } + + String trim = line.trim(); + if (trim.length() == 0) { + header = false; + return true; + } + + char c = trim.charAt(0); + return (c == '/') || (c == '*') || (c == '#'); + } + } + + public abstract static class IgnoreCommentsLineHandler implements LineHandler { + + public boolean isComment(String line) { + String trim = line.trim(); + if (trim.length() == 0) { + return true; + } + + return trim.charAt(0) == '#'; + } + } } Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConstants.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/JSONConstants.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConstants.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConstants.java Mon Aug 19 22:12:07 2013 @@ -26,6 +26,7 @@ import org.apache.chemistry.opencmis.com /** * JSON object constants. */ +@SuppressWarnings("PMD.AvoidDuplicateLiterals") public final class JSONConstants { public static final String ERROR_EXCEPTION = "exception"; 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=1515639&r1=1515638&r2=1515639&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 Mon Aug 19 22:12:07 2013 @@ -1563,6 +1563,7 @@ public final class JSONConverter { setIfNotNull(JSON_PROPERTY_TYPE_MAX_LENGTH, ((PropertyStringDefinition) propertyDefinition).getMaxLength(), result); } else if (propertyDefinition instanceof PropertyIdDefinition) { + // nothing to do } else if (propertyDefinition instanceof PropertyIntegerDefinition) { setIfNotNull(JSON_PROPERTY_TYPE_MIN_VALUE, ((PropertyIntegerDefinition) propertyDefinition).getMinValue(), result); @@ -1578,13 +1579,18 @@ public final class JSONConverter { result.put(JSON_PROPERTY_TYPE_PRECISION, precision.value()); } } else if (propertyDefinition instanceof PropertyBooleanDefinition) { + // nothing to do } else if (propertyDefinition instanceof PropertyDateTimeDefinition) { DateTimeResolution resolution = ((PropertyDateTimeDefinition) propertyDefinition).getDateTimeResolution(); if (resolution != null) { result.put(JSON_PROPERTY_TYPE_RESOLUTION, resolution.value()); } } else if (propertyDefinition instanceof PropertyHtmlDefinition) { + // nothing to do } else if (propertyDefinition instanceof PropertyUriDefinition) { + // nothing to do + } else { + assert false; } // default value @@ -2488,11 +2494,16 @@ public final class JSONConverter { } result.setObjects(objects); - result.setHasMoreItems(getBoolean(json, isQueryResult ? JSON_QUERYRESULTLIST_NUM_ITEMS - : JSON_OBJECTLIST_HAS_MORE_ITEMS)); - result.setNumItems(getInteger(json, isQueryResult ? JSON_QUERYRESULTLIST_NUM_ITEMS : JSON_OBJECTLIST_NUM_ITEMS)); - convertExtension(json, result, isQueryResult ? QUERYRESULTLIST_KEYS : OBJECTLIST_KEYS); + if (isQueryResult) { + result.setHasMoreItems(getBoolean(json, JSON_QUERYRESULTLIST_NUM_ITEMS)); + result.setNumItems(getInteger(json, JSON_QUERYRESULTLIST_NUM_ITEMS)); + convertExtension(json, result, QUERYRESULTLIST_KEYS); + } else { + result.setHasMoreItems(getBoolean(json, JSON_OBJECTLIST_HAS_MORE_ITEMS)); + result.setNumItems(getInteger(json, JSON_OBJECTLIST_NUM_ITEMS)); + convertExtension(json, result, OBJECTLIST_KEYS); + } return result; } Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.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/MimeHelper.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeHelper.java Mon Aug 19 22:12:07 2013 @@ -28,6 +28,8 @@ import java.util.HashMap; import java.util.Locale; import java.util.Map; +import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; + /** * MIME helper class. */ @@ -274,7 +276,8 @@ public final class MimeHelper { try { return boundaryStr.getBytes("ISO-8859-1"); } catch (UnsupportedEncodingException e) { - return boundaryStr.getBytes(); + // shouldn't happen... + throw new CmisRuntimeException("Unsupported encoding 'ISO-8859-1'", e); } } } @@ -310,21 +313,21 @@ public final class MimeHelper { public static final int QUOTEDSTRING = -2; - private final int _type; + private final int type; - private final String _value; + private final String value; public Token(int type, String value) { - _type = type; - _value = value; + this.type = type; + this.value = value; } public int getType() { - return _type; + return type; } public String getValue() { - return _value; + return value; } } @@ -536,6 +539,7 @@ public final class MimeHelper { private void eatWhiteSpace() { // skip to end of whitespace while (++pos < header.length() && WHITE.indexOf(header.charAt(pos)) != -1) { + // just read } } } Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.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/UrlBuilder.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/UrlBuilder.java Mon Aug 19 22:12:07 2013 @@ -18,16 +18,13 @@ */ package org.apache.chemistry.opencmis.commons.impl; -import java.io.UnsupportedEncodingException; import java.net.URI; -import java.net.URLEncoder; import org.apache.chemistry.opencmis.commons.enums.AclPropagation; import org.apache.chemistry.opencmis.commons.enums.IncludeRelationships; import org.apache.chemistry.opencmis.commons.enums.RelationshipDirection; import org.apache.chemistry.opencmis.commons.enums.UnfileObject; import org.apache.chemistry.opencmis.commons.enums.VersioningState; -import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException; /** * Utility class that helps building URLs. @@ -125,11 +122,7 @@ public class UrlBuilder { } queryPart.append(name); queryPart.append('='); - try { - queryPart.append(URLEncoder.encode(valueStr, "UTF-8")); - } catch (UnsupportedEncodingException e) { - throw new CmisRuntimeException("Unsupported encoding 'UTF-8'.", e); - } + queryPart.append(IOUtils.encodeURL(valueStr)); return this; } 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=1515639&r1=1515638&r2=1515639&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 Mon Aug 19 22:12:07 2013 @@ -273,26 +273,26 @@ public final class WSConverter { private static final Logger LOG = LoggerFactory.getLogger(WSConverter.class); - private static Class STREAM_DATA_HANDLER_CLASS_1; - private static Method STREAM_DATA_HANDLER_READ_METHOD_1; - private static Class STREAM_DATA_HANDLER_CLASS_2; - private static Method STREAM_DATA_HANDLER_READ_METHOD_2; + private static Class streamDataHandlerClass1; + private static Method streamDataHandlerReadMethod1; + private static Class streamDataHandlerClass2; + private static Method streamDataHandlerReadMethod2; static { try { - STREAM_DATA_HANDLER_CLASS_1 = Class.forName("org.jvnet.staxex.StreamingDataHandler"); - STREAM_DATA_HANDLER_READ_METHOD_1 = STREAM_DATA_HANDLER_CLASS_1.getMethod("readOnce", new Class[0]); + streamDataHandlerClass1 = Class.forName("org.jvnet.staxex.StreamingDataHandler"); + streamDataHandlerReadMethod1 = streamDataHandlerClass1.getMethod("readOnce", new Class[0]); } catch (Exception e) { - STREAM_DATA_HANDLER_CLASS_1 = null; - STREAM_DATA_HANDLER_READ_METHOD_1 = null; + streamDataHandlerClass1 = null; + streamDataHandlerReadMethod1 = null; } try { - STREAM_DATA_HANDLER_CLASS_2 = Class.forName("com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler"); - STREAM_DATA_HANDLER_READ_METHOD_2 = STREAM_DATA_HANDLER_CLASS_2.getMethod("readOnce", new Class[0]); + streamDataHandlerClass2 = Class.forName("com.sun.xml.internal.org.jvnet.staxex.StreamingDataHandler"); + streamDataHandlerReadMethod2 = streamDataHandlerClass2.getMethod("readOnce", new Class[0]); } catch (Exception e) { - STREAM_DATA_HANDLER_CLASS_2 = null; - STREAM_DATA_HANDLER_READ_METHOD_2 = null; + streamDataHandlerClass2 = null; + streamDataHandlerReadMethod2 = null; } } @@ -2611,12 +2611,12 @@ public final class WSConverter { DataHandler streamDataHandler = contentStream.getStream(); if (streamDataHandler != null) { try { - if (STREAM_DATA_HANDLER_CLASS_1 != null && STREAM_DATA_HANDLER_CLASS_1.isInstance(streamDataHandler)) { - result.setStream((InputStream) STREAM_DATA_HANDLER_READ_METHOD_1.invoke(streamDataHandler, + if (streamDataHandlerClass1 != null && streamDataHandlerClass1.isInstance(streamDataHandler)) { + result.setStream((InputStream) streamDataHandlerReadMethod1.invoke(streamDataHandler, (Object[]) null)); - } else if (STREAM_DATA_HANDLER_CLASS_2 != null - && STREAM_DATA_HANDLER_CLASS_2.isInstance(streamDataHandler)) { - result.setStream((InputStream) STREAM_DATA_HANDLER_READ_METHOD_2.invoke(streamDataHandler, + } else if (streamDataHandlerClass2 != null + && streamDataHandlerClass2.isInstance(streamDataHandler)) { + result.setStream((InputStream) streamDataHandlerReadMethod2.invoke(streamDataHandler, (Object[]) null)); } else { result.setStream(contentStream.getStream().getInputStream()); Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.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/XMLConstants.java?rev=1515639&r1=1515638&r2=1515639&view=diff ============================================================================== --- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.java (original) +++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLConstants.java Mon Aug 19 22:12:07 2013 @@ -18,6 +18,7 @@ */ package org.apache.chemistry.opencmis.commons.impl; +@SuppressWarnings("PMD.AvoidDuplicateLiterals") public final class XMLConstants { private XMLConstants() {