chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1498960 [1/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-client/chemistry-opencmis-client-binding...
Date Tue, 02 Jul 2013 14:39:21 GMT
Author: fmui
Date: Tue Jul  2 14:39:20 2013
New Revision: 1498960

URL: http://svn.apache.org/r1498960
Log:
more code clean up

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/HttpRequestMockHelper.java   (with props)
Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/DiscoveryServiceImpl.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/browser/MultiFilingServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/PolicyServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.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/XMLWalker.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/Yylex.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.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/BrowserCallContextImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ProtectionRequestWrapper.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/CheckServletInputStreamTest.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-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.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/CmisTestResultImpl.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-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.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/details/AbstractDetailsTable.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.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/atompub/AtomEntryWriter.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomEntryWriter.java Tue Jul  2 14:39:20 2013
@@ -28,11 +28,13 @@ import static org.apache.chemistry.openc
 
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.GregorianCalendar;
 import java.util.TimeZone;
 
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamWriter;
 
 import org.apache.chemistry.opencmis.commons.PropertyIds;
@@ -135,8 +137,10 @@ public class AtomEntryWriter {
 
     /**
      * Writes the entry to an output stream.
+     * 
+     * @throws XMLStreamException
      */
-    public void write(OutputStream out) throws Exception {
+    public void write(OutputStream out) throws XMLStreamException, IOException {
         XMLStreamWriter writer = XMLUtils.createWriter(out);
 
         XMLUtils.startXmlDocument(writer);
@@ -227,7 +231,7 @@ public class AtomEntryWriter {
         return result;
     }
 
-    private void writeContent(XMLStreamWriter writer) throws Exception {
+    private void writeContent(XMLStreamWriter writer) throws XMLStreamException, IOException {
         @SuppressWarnings("resource")
         Base64.InputStream b64stream = new Base64.InputStream(stream, Base64.ENCODE);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.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/atompub/AtomPubParser.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java Tue Jul  2 14:39:20 2013
@@ -50,6 +50,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomAcl;
@@ -92,7 +93,7 @@ public class AtomPubParser {
     /**
      * Parses the stream.
      */
-    public void parse() throws Exception {
+    public void parse() throws XMLStreamException {
         XMLStreamReader parser = XMLUtils.createParser(stream);
 
         try {
@@ -160,7 +161,7 @@ public class AtomPubParser {
     /**
      * Parses a service document.
      */
-    private static ServiceDoc parseServiceDoc(XMLStreamReader parser) throws Exception {
+    private static ServiceDoc parseServiceDoc(XMLStreamReader parser) throws XMLStreamException {
         ServiceDoc result = new ServiceDoc();
 
         XMLUtils.next(parser);
@@ -194,7 +195,7 @@ public class AtomPubParser {
     /**
      * Parses a workspace element in a service document.
      */
-    private static RepositoryWorkspace parseWorkspace(XMLStreamReader parser) throws Exception {
+    private static RepositoryWorkspace parseWorkspace(XMLStreamReader parser) throws XMLStreamException {
         RepositoryWorkspace workspace = new RepositoryWorkspace();
 
         XMLUtils.next(parser);
@@ -228,7 +229,7 @@ public class AtomPubParser {
     /**
      * Parses an Atom feed.
      */
-    private AtomFeed parseFeed(XMLStreamReader parser) throws Exception {
+    private AtomFeed parseFeed(XMLStreamReader parser) throws XMLStreamException {
         AtomFeed result = new AtomFeed();
 
         XMLUtils.next(parser);
@@ -272,7 +273,7 @@ public class AtomPubParser {
     /**
      * Parses an Atom entry.
      */
-    private AtomEntry parseEntry(XMLStreamReader parser) throws Exception {
+    private AtomEntry parseEntry(XMLStreamReader parser) throws XMLStreamException {
         AtomEntry result = new AtomEntry();
 
         XMLUtils.next(parser);
@@ -310,21 +311,21 @@ public class AtomPubParser {
     /**
      * Parses an Allowable Actions document.
      */
-    private static AtomAllowableActions parseAllowableActions(XMLStreamReader parser) throws Exception {
+    private static AtomAllowableActions parseAllowableActions(XMLStreamReader parser) throws XMLStreamException {
         return new AtomAllowableActions(XMLConverter.convertAllowableActions(parser));
     }
 
     /**
      * Parses an ACL document.
      */
-    private static AtomAcl parseACL(XMLStreamReader parser) throws Exception {
+    private static AtomAcl parseACL(XMLStreamReader parser) throws XMLStreamException {
         return new AtomAcl(XMLConverter.convertAcl(parser));
     }
 
     /**
      * Parses an element.
      */
-    private AtomElement parseElement(XMLStreamReader parser) throws Exception {
+    private AtomElement parseElement(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
 
         if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
@@ -355,7 +356,7 @@ public class AtomPubParser {
     /**
      * Parses a children element.
      */
-    private AtomElement parseChildren(XMLStreamReader parser) throws Exception {
+    private AtomElement parseChildren(XMLStreamReader parser) throws XMLStreamException {
         AtomElement result = null;
         QName childName = parser.getName();
 
@@ -393,7 +394,7 @@ public class AtomPubParser {
     /**
      * Parses a workspace element.
      */
-    private static AtomElement parseWorkspaceElement(XMLStreamReader parser) throws Exception {
+    private static AtomElement parseWorkspaceElement(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
 
         if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
@@ -421,7 +422,7 @@ public class AtomPubParser {
     /**
      * Parses a collection tag.
      */
-    private static AtomElement parseCollection(XMLStreamReader parser) throws Exception {
+    private static AtomElement parseCollection(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
         Map<String, String> result = new HashMap<String, String>();
 
@@ -456,7 +457,7 @@ public class AtomPubParser {
     /**
      * Parses a template tag.
      */
-    private static AtomElement parseTemplate(XMLStreamReader parser) throws Exception {
+    private static AtomElement parseTemplate(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
         Map<String, String> result = new HashMap<String, String>();
 
@@ -494,7 +495,7 @@ public class AtomPubParser {
     /**
      * Parses a link tag.
      */
-    private static AtomElement parseLink(XMLStreamReader parser) throws Exception {
+    private static AtomElement parseLink(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
         AtomLink result = new AtomLink();
 
@@ -518,7 +519,7 @@ public class AtomPubParser {
     /**
      * Parses a link tag.
      */
-    private static AtomElement parseAtomContentSrc(XMLStreamReader parser) throws Exception {
+    private static AtomElement parseAtomContentSrc(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
         AtomLink result = new AtomLink();
         result.setRel(LINK_REL_CONTENT);
@@ -539,7 +540,7 @@ public class AtomPubParser {
     /**
      * Parses a text tag.
      */
-    private static AtomElement parseText(XMLStreamReader parser) throws Exception {
+    private static AtomElement parseText(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
         return new AtomElement(name, XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
     }
@@ -547,7 +548,7 @@ public class AtomPubParser {
     /**
      * Parses a text tag and convert it into an integer.
      */
-    private static AtomElement parseBigInteger(XMLStreamReader parser) throws Exception {
+    private static AtomElement parseBigInteger(XMLStreamReader parser) throws XMLStreamException {
         QName name = parser.getName();
         return new AtomElement(name, new BigInteger(XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH)));
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.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/AclServiceImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/AclServiceImpl.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.List;
@@ -74,7 +75,7 @@ public class AclServiceImpl extends Abst
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/DiscoveryServiceImpl.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/DiscoveryServiceImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/DiscoveryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/DiscoveryServiceImpl.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.math.BigInteger;
 import java.util.Map;
@@ -67,7 +68,7 @@ public class DiscoveryServiceImpl extend
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });

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=1498960&r1=1498959&r2=1498960&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 Tue Jul  2 14:39:20 2013
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.cl
 
 import java.io.BufferedInputStream;
 import java.io.ByteArrayInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URLEncoder;
@@ -214,7 +215,7 @@ public class FormDataWriter {
         return (contentStream == null ? CONTENT_TYPE_URLENCODED : CONTENT_TYPE_FORMDATA + boundary);
     }
 
-    public void write(OutputStream out) throws Exception {
+    public void write(OutputStream out) throws IOException {
         if (contentStream == null || contentStream.getStream() == null) {
             boolean first = true;
             byte[] amp = "&".getBytes("UTF-8");
@@ -280,11 +281,11 @@ public class FormDataWriter {
         }
     }
 
-    private void writeLine(OutputStream out) throws Exception {
+    private void writeLine(OutputStream out) throws IOException {
         writeLine(out, null);
     }
 
-    private void writeLine(OutputStream out, String s) throws Exception {
+    private void writeLine(OutputStream out, String s) throws IOException {
         s = (s == null ? CRLF : s + CRLF);
         out.write(s.getBytes("UTF-8"));
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/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/browser/MultiFilingServiceImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/MultiFilingServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/MultiFilingServiceImpl.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.IOException;
 import java.io.OutputStream;
 
 import org.apache.chemistry.opencmis.client.bindings.spi.BindingSession;
@@ -51,7 +52,7 @@ public class MultiFilingServiceImpl exte
 
         // send and parse
         postAndConsume(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -67,7 +68,7 @@ public class MultiFilingServiceImpl exte
 
         // send and parse
         postAndConsume(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.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/ObjectServiceImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/ObjectServiceImpl.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.math.BigInteger;
 import java.util.List;
@@ -80,7 +81,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -112,7 +113,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -141,7 +142,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -170,7 +171,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -199,7 +200,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -228,7 +229,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -384,7 +385,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -423,7 +424,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -451,7 +452,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -475,7 +476,7 @@ public class ObjectServiceImpl extends A
 
         // send
         postAndConsume(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -494,7 +495,7 @@ public class ObjectServiceImpl extends A
 
         // send
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -525,7 +526,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -562,7 +563,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -598,7 +599,7 @@ public class ObjectServiceImpl extends A
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/PolicyServiceImpl.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/PolicyServiceImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/PolicyServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/PolicyServiceImpl.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.util.Collections;
 import java.util.List;
@@ -55,7 +56,7 @@ public class PolicyServiceImpl extends A
 
         // send
         postAndConsume(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -71,7 +72,7 @@ public class PolicyServiceImpl extends A
 
         // send
         postAndConsume(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/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/spi/browser/RepositoryServiceImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/RepositoryServiceImpl.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.math.BigInteger;
 import java.util.List;
@@ -125,7 +126,7 @@ public class RepositoryServiceImpl exten
 
         // send
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -147,7 +148,7 @@ public class RepositoryServiceImpl exten
 
         // send
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -167,7 +168,7 @@ public class RepositoryServiceImpl exten
 
         // send
         postAndConsume(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.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/VersioningServiceImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/VersioningServiceImpl.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.client.bindings.spi.browser;
 
+import java.io.IOException;
 import java.io.OutputStream;
 import java.util.List;
 import java.util.Map;
@@ -68,7 +69,7 @@ public class VersioningServiceImpl exten
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -91,7 +92,7 @@ public class VersioningServiceImpl exten
 
         // send
         postAndConsume(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });
@@ -120,7 +121,7 @@ public class VersioningServiceImpl exten
 
         // send and parse
         Response resp = post(url, formData.getContentType(), new Output() {
-            public void write(OutputStream out) throws Exception {
+            public void write(OutputStream out) throws IOException {
                 formData.write(out);
             }
         });

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.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/AbstractPortProvider.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/AbstractPortProvider.java Tue Jul  2 14:39:20 2013
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.lang.ref.SoftReference;
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.math.BigInteger;
 import java.net.MalformedURLException;
 import java.net.URL;
@@ -177,13 +178,14 @@ public abstract class AbstractPortProvid
         private SoftReference<Service> serviceObject;
         private final URL endpointUrl;
 
-        public CmisServiceHolder(final CmisWebSerivcesService service, final URL endpointUrl) throws Exception {
+        public CmisServiceHolder(final CmisWebSerivcesService service, final URL endpointUrl) throws NoSuchMethodException, SecurityException, InstantiationException, InvocationTargetException, IllegalAccessException {
             this.service = service;
             this.endpointUrl = endpointUrl;
             this.serviceObject = new SoftReference<Service>(createServiceObject());
         }
 
-        private Service createServiceObject() throws Exception {
+        private Service createServiceObject() throws NoSuchMethodException, SecurityException, InstantiationException,
+                InvocationTargetException, IllegalAccessException {
             final Constructor<? extends Service> serviceConstructor = service.getServiceClass().getConstructor(
                     new Class<?>[] { URL.class, QName.class });
 

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=1498960&r1=1498959&r2=1498960&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 Tue Jul  2 14:39:20 2013
@@ -23,9 +23,7 @@ import static org.apache.chemistry.openc
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.util.ArrayList;
-import java.util.EnumSet;
 import java.util.GregorianCalendar;
-import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
@@ -1335,13 +1333,7 @@ public class XMLConverter {
                 throws XMLStreamException {
             if (isCmisNamespace(name)) {
                 if (isTag(name, TAG_CAP_CREATABLE_PROPERTY_TYPES_CANCREATE)) {
-                    Set<PropertyType> ptSet = target.canCreate();
-                    if (ptSet == null) {
-                        ptSet = EnumSet.noneOf(PropertyType.class);
-                        target.setCanCreate(ptSet);
-                    }
-
-                    ptSet.add(readEnum(parser, PropertyType.class));
+                    target.canCreate().add(readEnum(parser, PropertyType.class));
                     return true;
                 }
             }
@@ -1457,13 +1449,9 @@ public class XMLConverter {
                 }
 
                 if (isTag(name, TAG_ACLCAP_PERMISSION_MAPPING)) {
-                    Map<String, PermissionMapping> mapping = target.getPermissionMapping();
-                    if (mapping == null) {
-                        mapping = new HashMap<String, PermissionMapping>();
-                        target.setPermissionMappingData(mapping);
-                    }
-
                     PermissionMapping pm = PERMISSION_MAPPING_PARSER.walk(parser);
+
+                    Map<String, PermissionMapping> mapping = target.getPermissionMapping();
                     mapping.put(pm.getKey(), pm);
 
                     return true;
@@ -1561,13 +1549,9 @@ public class XMLConverter {
                 }
 
                 if (isTag(name, TAG_FEATURE_DATA)) {
-                    Map<String, String> featureData = target.getFeatureData();
-                    if (featureData == null) {
-                        featureData = new HashMap<String, String>();
-                        target.setFeatureData(featureData);
-                    }
-
                     String[] data = FEATURE_DATA_PARSER.walk(parser);
+
+                    Map<String, String> featureData = target.getFeatureData();
                     featureData.put(data[0], data[1]);
 
                     return true;
@@ -2308,10 +2292,6 @@ public class XMLConverter {
                     Action action = Action.fromValue(name.getLocalPart());
 
                     Set<Action> actions = target.getAllowableActions();
-                    if (actions == null) {
-                        actions = EnumSet.noneOf(Action.class);
-                        target.setAllowableActions(actions);
-                    }
 
                     if (Boolean.TRUE.equals(readBoolean(parser))) {
                         actions.add(action);
@@ -2576,7 +2556,7 @@ public class XMLConverter {
         }
     };
 
-    private static abstract class PropertyXMLWalker<T extends AbstractPropertyData<?>> extends XMLWalker<T> {
+    private abstract static class PropertyXMLWalker<T extends AbstractPropertyData<?>> extends XMLWalker<T> {
 
         protected abstract T createTarget(XMLStreamReader parser, QName name);
 
@@ -2618,7 +2598,7 @@ public class XMLConverter {
 
     };
 
-    private static abstract class PropertyStringXMLWalker<T extends AbstractPropertyData<String>> extends
+    private abstract static class PropertyStringXMLWalker<T extends AbstractPropertyData<String>> extends
             PropertyXMLWalker<T> {
         @Override
         protected void addValue(XMLStreamReader parser, T target) throws XMLStreamException {

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=1498960&r1=1498959&r2=1498960&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 Tue Jul  2 14:39:20 2013
@@ -175,9 +175,6 @@ public abstract class XMLWalker<T> {
 
     protected Boolean readBoolean(final XMLStreamReader parser) throws XMLStreamException {
         String value = readText(parser);
-        if (value == null) {
-            return null;
-        }
 
         if ("true".equals(value) || "1".equals(value)) {
             return Boolean.TRUE;
@@ -192,9 +189,6 @@ public abstract class XMLWalker<T> {
 
     protected BigInteger readInteger(final XMLStreamReader parser) throws XMLStreamException {
         String value = readText(parser);
-        if (value == null) {
-            return null;
-        }
 
         try {
             return new BigInteger(value);
@@ -205,9 +199,6 @@ public abstract class XMLWalker<T> {
 
     protected BigDecimal readDecimal(final XMLStreamReader parser) throws XMLStreamException {
         String value = readText(parser);
-        if (value == null) {
-            return null;
-        }
 
         try {
             return new BigDecimal(value);
@@ -218,9 +209,6 @@ public abstract class XMLWalker<T> {
 
     protected GregorianCalendar readDateTime(final XMLStreamReader parser) throws XMLStreamException {
         String value = readText(parser);
-        if (value == null) {
-            return null;
-        }
 
         GregorianCalendar result = DateTimeHelper.parseXmlDateTime(value);
         if (result == null) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/Yylex.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/json/parser/Yylex.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/Yylex.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/json/parser/Yylex.java Tue Jul  2 14:39:20 2013
@@ -67,8 +67,7 @@ class Yylex {
 
     private static int[] zzUnpackAction() {
         int[] result = new int[45];
-        int offset = 0;
-        offset = zzUnpackAction(ZZ_ACTION_PACKED_0, offset, result);
+        zzUnpackAction(ZZ_ACTION_PACKED_0, 0, result);
         return result;
     }
 
@@ -79,9 +78,9 @@ class Yylex {
         while (i < l) {
             int count = packed.charAt(i++);
             int value = packed.charAt(i++);
-            do
+            do {
                 result[j++] = value;
-            while (--count > 0);
+            } while (--count > 0);
         }
         return j;
     }
@@ -99,8 +98,7 @@ class Yylex {
 
     private static int[] zzUnpackRowMap() {
         int[] result = new int[45];
-        int offset = 0;
-        offset = zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, offset, result);
+        zzUnpackRowMap(ZZ_ROWMAP_PACKED_0, 0, result);
         return result;
     }
 
@@ -164,8 +162,7 @@ class Yylex {
 
     private static int[] zzUnpackAttribute() {
         int[] result = new int[45];
-        int offset = 0;
-        offset = zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, offset, result);
+        zzUnpackAttribute(ZZ_ATTRIBUTE_PACKED_0, 0, result);
         return result;
     }
 
@@ -572,8 +569,8 @@ class Yylex {
             case 33:
                 break;
             case 1: {
-                throw new JSONParseException(yychar, JSONParseException.ERROR_UNEXPECTED_CHAR, new Character(
-                        yycharat(0)));
+                throw new JSONParseException(yychar, JSONParseException.ERROR_UNEXPECTED_CHAR,
+                        Character.valueOf(yycharat(0)));
             }
             case 34:
                 break;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.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/tube/server/WssTube.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/tube/server/WssTube.java Tue Jul  2 14:39:20 2013
@@ -76,7 +76,7 @@ public class WssTube extends AbstractWss
             HeaderList headers = message.getHeaders();
             headers.add(Headers.create(wsseSecurityElement));
         } catch (Exception e) {
-            e.printStackTrace();
+            throw new RuntimeException("Creating SOAP header failed!", e);
         }
 
         return super.processResponse(packet);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.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/AtomEntryParser.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/AtomEntryParser.java Tue Jul  2 14:39:20 2013
@@ -20,6 +20,7 @@ package org.apache.chemistry.opencmis.se
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.math.BigInteger;
 import java.util.Iterator;
@@ -29,6 +30,7 @@ import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
@@ -98,7 +100,8 @@ public class AtomEntryParser {
     /**
      * Constructor that immediately parses the given stream.
      */
-    public AtomEntryParser(InputStream stream, ThresholdOutputStreamFactory streamFactory) throws Exception {
+    public AtomEntryParser(InputStream stream, ThresholdOutputStreamFactory streamFactory) throws XMLStreamException,
+            IOException {
         this(streamFactory);
         parse(stream);
     }
@@ -189,7 +192,7 @@ public class AtomEntryParser {
     /**
      * Parses the stream.
      */
-    public void parse(InputStream stream) throws Exception {
+    public void parse(InputStream stream) throws XMLStreamException, IOException {
         object = null;
         atomContentStream = null;
         cmisContentStream = null;
@@ -226,7 +229,7 @@ public class AtomEntryParser {
     /**
      * Parses an Atom entry.
      */
-    private void parseEntry(XMLStreamReader parser) throws Exception {
+    private void parseEntry(XMLStreamReader parser) throws XMLStreamException, IOException {
         String atomTitle = null;
 
         XMLUtils.next(parser);
@@ -279,28 +282,31 @@ public class AtomEntryParser {
     /**
      * Parses a CMIS object.
      */
-    private void parseObject(XMLStreamReader parser) throws Exception {
+    private void parseObject(XMLStreamReader parser) throws XMLStreamException {
         object = XMLConverter.convertObject(parser);
     }
 
     /**
      * Parses a CMIS type.
      */
-    private void parseTypeDefinition(XMLStreamReader parser) throws Exception {
+    private void parseTypeDefinition(XMLStreamReader parser) throws XMLStreamException {
         typeDef = XMLConverter.convertTypeDefinition(parser);
     }
 
     /**
      * Parses a bluk update.
      */
-    private void parseBulkUpdate(XMLStreamReader parser) throws Exception {
+    private void parseBulkUpdate(XMLStreamReader parser) throws XMLStreamException {
         bulkUpdate = XMLConverter.convertBulkUpdate(parser);
     }
 
     /**
      * Extract the content stream.
+     * 
+     * @throws XMLStreamException
+     * @throws IOException
      */
-    private void parseAtomContent(XMLStreamReader parser) throws Exception {
+    private void parseAtomContent(XMLStreamReader parser) throws XMLStreamException, IOException {
         atomContentStream = new ContentStreamImpl();
 
         // read attributes
@@ -351,7 +357,7 @@ public class AtomEntryParser {
     /**
      * Extract the content stream.
      */
-    private void parseCmisContent(XMLStreamReader parser) throws Exception {
+    private void parseCmisContent(XMLStreamReader parser) throws XMLStreamException, IOException {
         cmisContentStream = new ContentStreamImpl();
 
         XMLUtils.next(parser);
@@ -396,7 +402,7 @@ public class AtomEntryParser {
     /**
      * Parses a tag that contains content bytes.
      */
-    private ThresholdOutputStream readContentBytes(XMLStreamReader parser) throws Exception {
+    private ThresholdOutputStream readContentBytes(XMLStreamReader parser) throws XMLStreamException, IOException {
         ThresholdOutputStream bufferStream = streamFactory.newOutputStream();
 
         XMLUtils.next(parser);
@@ -421,9 +427,14 @@ public class AtomEntryParser {
                     break;
                 }
             }
-        } catch (Exception e) {
-            bufferStream.destroy(); // remove temp file
-            throw e;
+        } catch (XMLStreamException xse) {
+            // remove temp file
+            bufferStream.destroy();
+            throw xse;
+        } catch (IOException ioe) {
+            // remove temp file
+            bufferStream.destroy();
+            throw ioe;
         }
 
         XMLUtils.next(parser);
@@ -434,7 +445,7 @@ public class AtomEntryParser {
     /**
      * Parses a tag that contains base64 encoded content.
      */
-    private ThresholdOutputStream readBase64(XMLStreamReader parser) throws Exception {
+    private ThresholdOutputStream readBase64(XMLStreamReader parser) throws XMLStreamException, IOException {
         ThresholdOutputStream bufferStream = streamFactory.newOutputStream();
         @SuppressWarnings("resource")
         Base64.OutputStream b64stream = new Base64.OutputStream(bufferStream, Base64.DECODE);
@@ -467,9 +478,14 @@ public class AtomEntryParser {
             }
 
             b64stream.close();
-        } catch (Exception e) {
-            bufferStream.destroy(); // remove temp file
-            throw e;
+        } catch (XMLStreamException xse) {
+            // remove temp file
+            bufferStream.destroy();
+            throw xse;
+        } catch (IOException ioe) {
+            // remove temp file
+            bufferStream.destroy();
+            throw ioe;
         }
 
         XMLUtils.next(parser);
@@ -480,7 +496,7 @@ public class AtomEntryParser {
     /**
      * Copies a subtree into a stream.
      */
-    private static byte[] copy(XMLStreamReader parser) throws Exception {
+    private static byte[] copy(XMLStreamReader parser) throws XMLStreamException {
         // create a writer
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(out);
@@ -521,7 +537,7 @@ public class AtomEntryParser {
     /**
      * Copies a XML start element.
      */
-    private static void copyStartElement(XMLStreamReader parser, XMLStreamWriter writer) throws Exception {
+    private static void copyStartElement(XMLStreamReader parser, XMLStreamWriter writer) throws XMLStreamException {
         String namespaceUri = parser.getNamespaceURI();
         String prefix = parser.getPrefix();
         String localName = parser.getLocalName();
@@ -566,7 +582,7 @@ public class AtomEntryParser {
      */
     @SuppressWarnings("unchecked")
     private static void addNamespaceIfMissing(XMLStreamWriter writer, String prefix, String namespaceUri)
-            throws Exception {
+            throws XMLStreamException {
         if ((namespaceUri == null) || (namespaceUri.trim().length() == 0)) {
             return;
         }
@@ -593,7 +609,8 @@ public class AtomEntryParser {
     /**
      * Adds a namespace to a XML element.
      */
-    private static void addNamespace(XMLStreamWriter writer, String prefix, String namespaceUri) throws Exception {
+    private static void addNamespace(XMLStreamWriter writer, String prefix, String namespaceUri)
+            throws XMLStreamException {
         if ((prefix == null) || (prefix.trim().length() == 0)) {
             writer.setDefaultNamespace(namespaceUri);
             writer.writeDefaultNamespace(namespaceUri);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserCallContextImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserCallContextImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserCallContextImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/BrowserCallContextImpl.java Tue Jul  2 14:39:20 2013
@@ -61,6 +61,7 @@ public class BrowserCallContextImpl exte
      * Sets the necessary details to retrieve the object id, type id, and token
      * if requested.
      */
+    @SuppressWarnings("PMD.ArrayIsStoredDirectly")
     public void setCallDetails(CmisService service, String objectId, String[] pathFragments, String token) {
         this.service = service;
         this.objectId = objectId;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/POSTHttpServletRequestWrapper.java Tue Jul  2 14:39:20 2013
@@ -18,6 +18,7 @@
  */
 package org.apache.chemistry.opencmis.server.impl.browser;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.math.BigInteger;
@@ -37,7 +38,7 @@ public class POSTHttpServletRequestWrapp
     private InputStream stream;
 
     public POSTHttpServletRequestWrapper(HttpServletRequest request, ThresholdOutputStreamFactory streamFactory)
-            throws Exception {
+            throws IOException {
         super(request);
 
         // check multipart

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ProtectionRequestWrapper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ProtectionRequestWrapper.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ProtectionRequestWrapper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/webservices/ProtectionRequestWrapper.java Tue Jul  2 14:39:20 2013
@@ -37,8 +37,14 @@ import org.apache.chemistry.opencmis.com
 public class ProtectionRequestWrapper extends HttpServletRequestWrapper {
 
     private static final String MULTIPART = "multipart/";
-
-    private final ServletInputStream inputStream;
+    private static final byte CR = 0x0D;
+    private static final byte LF = 0x0A;
+    private static final byte DASH = 0x2D;
+
+    private final int messageMax;
+    private final InputStream orgStream;
+    private final ServletInputStream checkedStream;
+    private final byte[] boundary;
 
     public ProtectionRequestWrapper(HttpServletRequest request, int max) throws ServletException {
         super(request);
@@ -50,14 +56,16 @@ public class ProtectionRequestWrapper ex
         }
 
         // get boundary
-        byte[] boundary = MimeHelper.getBoundaryFromMultiPart(contentType);
+        boundary = MimeHelper.getBoundaryFromMultiPart(contentType);
         if (boundary == null) {
             throw new ServletException("Invalid multipart request!");
         }
 
         // set up checked stream
         try {
-            inputStream = new CheckServletInputStream(super.getInputStream(), boundary, max);
+            messageMax = max;
+            orgStream = super.getInputStream();
+            checkedStream = new CheckServletInputStream();
         } catch (IOException e) {
             throw new ServletException(e);
         }
@@ -65,27 +73,19 @@ public class ProtectionRequestWrapper ex
 
     @Override
     public ServletInputStream getInputStream() throws IOException {
-        return inputStream;
+        return checkedStream;
     }
 
-    public static class CheckServletInputStream extends ServletInputStream {
+    class CheckServletInputStream extends ServletInputStream {
 
-        private static final byte CR = 0x0D;
-        private static final byte LF = 0x0A;
-        private static final byte DASH = 0x2D;
-
-        private final InputStream stream;
-        private final byte[] boundary;
-        private final int max;
+        private final int streamMax;
         private byte[] linebuffer;
         private int pos;
         private int count;
         private int boundariesFound;
 
-        public CheckServletInputStream(InputStream stream, byte[] boundary, int max) {
-            this.stream = stream;
-            this.boundary = boundary;
-            this.max = max + 2 * (boundary.length + 6);
+        public CheckServletInputStream() {
+            streamMax = messageMax + 2 * (boundary.length + 6);
             linebuffer = new byte[64 * 1024];
             pos = 0;
             count = 0;
@@ -107,12 +107,12 @@ public class ProtectionRequestWrapper ex
 
         @Override
         public int available() throws IOException {
-            return stream.available();
+            return orgStream.available();
         }
 
         @Override
         public int read() throws IOException {
-            int b = stream.read();
+            int b = orgStream.read();
 
             if (boundariesFound == 2) {
                 return b;
@@ -134,7 +134,7 @@ public class ProtectionRequestWrapper ex
                 return 0;
             }
 
-            int r = stream.read(b, off, len);
+            int r = orgStream.read(b, off, len);
 
             if (boundariesFound == 2) {
                 return r;
@@ -156,7 +156,7 @@ public class ProtectionRequestWrapper ex
 
         @Override
         public void close() throws IOException {
-            stream.close();
+            orgStream.close();
         }
 
         private void checkBoundary(int startPos) {
@@ -231,7 +231,7 @@ public class ProtectionRequestWrapper ex
 
             if (boundariesFound < 2) {
                 count++;
-                if (count > max) {
+                if (count > streamMax) {
                     throw new IOException("SOAP message too big!");
                 }
             }
@@ -256,7 +256,7 @@ public class ProtectionRequestWrapper ex
 
             if (boundariesFound < 2) {
                 count += len;
-                if (count > max) {
+                if (count > streamMax) {
                     throw new IOException("SOAP message too big!");
                 }
             }
@@ -266,7 +266,7 @@ public class ProtectionRequestWrapper ex
          * Expand the line buffer.
          */
         private void expandBuffer(int len) throws IOException {
-            if (pos + len > max) {
+            if (pos + len > streamMax) {
                 throw new IOException("SOAP message too big!");
             }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.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/shared/ThresholdOutputStream.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/shared/ThresholdOutputStream.java Tue Jul  2 14:39:20 2013
@@ -371,14 +371,14 @@ public class ThresholdOutputStream exten
         }
 
         @Override
-        public synchronized void mark(int readlimit) {
+        public void mark(int readlimit) {
             if (buf != null) {
                 mark = pos;
             }
         }
 
         @Override
-        public synchronized void reset() throws IOException {
+        public void reset() throws IOException {
             if (mark < 0) {
                 throw new IOException("Reset not possible.");
             }
@@ -521,14 +521,14 @@ public class ThresholdOutputStream exten
         }
 
         @Override
-        public synchronized void mark(int readlimit) {
+        public void mark(int readlimit) {
             if (!isClosed) {
                 stream.mark(readlimit);
             }
         }
 
         @Override
-        public synchronized void reset() throws IOException {
+        public void reset() throws IOException {
             if (isClosed) {
                 throw new IOException("Stream is already closed!");
             }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/CheckServletInputStreamTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/CheckServletInputStreamTest.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/CheckServletInputStreamTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/CheckServletInputStreamTest.java Tue Jul  2 14:39:20 2013
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertEqu
 import static org.junit.Assert.fail;
 
 import java.io.ByteArrayInputStream;
+import java.io.InputStream;
 
 import org.apache.chemistry.opencmis.server.impl.webservices.ProtectionRequestWrapper;
 import org.junit.Test;
@@ -105,8 +106,9 @@ public class CheckServletInputStreamTest
         ByteArrayInputStream originStream = new ByteArrayInputStream(byteBuffer);
 
         try {
-            ProtectionRequestWrapper.CheckServletInputStream stream = new ProtectionRequestWrapper.CheckServletInputStream(
-                    originStream, BOUNDARY.getBytes(), max);
+            ProtectionRequestWrapper prw = new ProtectionRequestWrapper(HttpRequestMockHelper.createRequest(BOUNDARY,
+                    originStream), max);
+            InputStream stream = prw.getInputStream();
 
             int countS = 0;
             int countC = 0;
@@ -141,8 +143,9 @@ public class CheckServletInputStreamTest
         originStream = new ByteArrayInputStream(byteBuffer);
 
         try {
-            ProtectionRequestWrapper.CheckServletInputStream stream = new ProtectionRequestWrapper.CheckServletInputStream(
-                    originStream, BOUNDARY.getBytes(), max);
+            ProtectionRequestWrapper prw = new ProtectionRequestWrapper(HttpRequestMockHelper.createRequest(BOUNDARY,
+                    originStream), max);
+            InputStream stream = prw.getInputStream();
 
             int countS = 0;
             int countC = 0;

Added: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/HttpRequestMockHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/HttpRequestMockHelper.java?rev=1498960&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/HttpRequestMockHelper.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/HttpRequestMockHelper.java Tue Jul  2 14:39:20 2013
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.server.impl;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.HttpServletRequest;
+
+import org.mockito.Mockito;
+
+public class HttpRequestMockHelper {
+
+    public static HttpServletRequest createRequest(String boundary, byte[] content) throws IOException {
+        FakeServletInputStream stream = new FakeServletInputStream(content);
+
+        HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+        Mockito.when(request.getContentType()).thenReturn("multipart/form-data; boundary=\"" + boundary + "\"");
+        Mockito.when(request.getInputStream()).thenReturn(stream);
+
+        return request;
+    }
+
+    public static HttpServletRequest createRequest(String boundary, InputStream inputStream) throws IOException {
+        FakeServletInputStream stream = new FakeServletInputStream(inputStream);
+
+        HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
+        Mockito.when(request.getContentType()).thenReturn("multipart/form-data; boundary=\"" + boundary + "\"");
+        Mockito.when(request.getInputStream()).thenReturn(stream);
+
+        return request;
+    }
+
+    private static class FakeServletInputStream extends ServletInputStream {
+
+        private InputStream stream;
+
+        public FakeServletInputStream(byte[] content) {
+            this.stream = new ByteArrayInputStream(content);
+        }
+
+        public FakeServletInputStream(InputStream stream) {
+            this.stream = stream;
+        }
+
+        @Override
+        public int read() throws IOException {
+            return stream.read();
+        }
+
+        @Override
+        public int read(byte[] b, int off, int len) throws IOException {
+            return stream.read(b, off, len);
+        }
+
+        @Override
+        public int read(byte[] b) throws IOException {
+            return stream.read(b);
+        }
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/HttpRequestMockHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/MultipartParserTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/MultipartParserTest.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/MultipartParserTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/test/java/org/apache/chemistry/opencmis/server/impl/MultipartParserTest.java Tue Jul  2 14:39:20 2013
@@ -24,7 +24,6 @@ import static org.junit.Assert.assertFal
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -32,14 +31,12 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Random;
 
-import javax.servlet.ServletInputStream;
 import javax.servlet.http.HttpServletRequest;
 
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.server.impl.browser.MultipartParser;
 import org.apache.chemistry.opencmis.server.shared.ThresholdOutputStreamFactory;
 import org.junit.Test;
-import org.mockito.Mockito;
 
 /**
  * Tests the multipart parser.
@@ -371,11 +368,7 @@ public class MultipartParserTest {
     // ---- helpers ----
 
     private MultipartParser prepareParser(String boundary, byte[] content) throws Exception {
-        FakeServletInputStream stream = new FakeServletInputStream(content);
-
-        HttpServletRequest request = Mockito.mock(HttpServletRequest.class);
-        Mockito.when(request.getContentType()).thenReturn("multipart/form-data; boundary=\"" + boundary + "\"");
-        Mockito.when(request.getInputStream()).thenReturn(stream);
+        HttpServletRequest request = HttpRequestMockHelper.createRequest(boundary, content);
 
         ThresholdOutputStreamFactory streamFactory = ThresholdOutputStreamFactory.newInstance(null, THRESHOLD,
                 MAX_SIZE, false);
@@ -429,28 +422,4 @@ public class MultipartParserTest {
         assertEquals(count, counter);
         assertEquals(counter - (hasContent ? 1 : 0), fields.size());
     }
-
-    private static class FakeServletInputStream extends ServletInputStream {
-
-        private ByteArrayInputStream stream;
-
-        public FakeServletInputStream(byte[] content) {
-            stream = new ByteArrayInputStream(content);
-        }
-
-        @Override
-        public int read() throws IOException {
-            return stream.read();
-        }
-
-        @Override
-        public int read(byte[] b, int off, int len) throws IOException {
-            return stream.read(b, off, len);
-        }
-
-        @Override
-        public int read(byte[] b) throws IOException {
-            return stream.read(b);
-        }
-    }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-fileshare/src/main/java/org/apache/chemistry/opencmis/fileshare/FileShareRepository.java Tue Jul  2 14:39:20 2013
@@ -2120,7 +2120,7 @@ public class FileShareRepository {
      * Converts an id to a File object. A simple and insecure implementation,
      * but good enough for now.
      */
-    private File idToFile(String id) throws Exception {
+    private File idToFile(String id) throws IOException {
         if ((id == null) || (id.length() == 0)) {
             throw new CmisInvalidArgumentException("Id is not valid!");
         }
@@ -2148,7 +2148,7 @@ public class FileShareRepository {
      * Creates a File object from an id. A simple and insecure implementation,
      * but good enough for now.
      */
-    private String fileToId(File file) throws Exception {
+    private String fileToId(File file) throws IOException {
         if (file == null) {
             throw new IllegalArgumentException("File is not valid!");
         }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/AbstractSessionTest.java Tue Jul  2 14:39:20 2013
@@ -267,6 +267,16 @@ public abstract class AbstractSessionTes
      * Creates a folder.
      */
     protected Folder createFolder(Session session, Folder parent, String name, String objectTypeId) {
+        if (parent == null) {
+            throw new IllegalArgumentException("Parent is not set!");
+        }
+        if (name == null) {
+            throw new IllegalArgumentException("Name is not set!");
+        }
+        if (objectTypeId == null) {
+            throw new IllegalArgumentException("Object Type Id is not set!");
+        }
+
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(PropertyIds.NAME, name);
         properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
@@ -372,6 +382,16 @@ public abstract class AbstractSessionTes
      */
     protected Document createDocument(Session session, Folder parent, String name, String objectTypeId,
             String[] secondaryTypeIds, String content) {
+        if (parent == null) {
+            throw new IllegalArgumentException("Parent is not set!");
+        }
+        if (name == null) {
+            throw new IllegalArgumentException("Name is not set!");
+        }
+        if (objectTypeId == null) {
+            throw new IllegalArgumentException("Object Type Id is not set!");
+        }
+
         if (content == null) {
             content = "";
         }
@@ -447,20 +467,19 @@ public abstract class AbstractSessionTes
                     "Newly created document is invalid! Exception: " + e.getMessage(), e, true));
         }
 
-        if (parent != null) {
-            List<Folder> parents = result.getParents(SELECT_ALL_NO_CACHE_OC);
-            boolean found = false;
-            for (Folder folder : parents) {
-                if (parent.getId().equals(folder.getId())) {
-                    found = true;
-                    break;
-                }
+        // check parents
+        List<Folder> parents = result.getParents(SELECT_ALL_NO_CACHE_OC);
+        boolean found = false;
+        for (Folder folder : parents) {
+            if (parent.getId().equals(folder.getId())) {
+                found = true;
+                break;
             }
+        }
 
-            if (!found) {
-                addResult(createResult(FAILURE,
-                        "The folder the document has been created in is not in the list of the document parents!"));
-            }
+        if (!found) {
+            addResult(createResult(FAILURE,
+                    "The folder the document has been created in is not in the list of the document parents!"));
         }
 
         return result;
@@ -483,6 +502,13 @@ public abstract class AbstractSessionTes
      */
     protected Relationship createRelationship(Session session, String name, ObjectId source, ObjectId target,
             String objectTypeId) {
+        if (name == null) {
+            throw new IllegalArgumentException("Name is not set!");
+        }
+        if (objectTypeId == null) {
+            throw new IllegalArgumentException("Object Type Id is not set!");
+        }
+
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(PropertyIds.NAME, name);
         properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
@@ -524,6 +550,16 @@ public abstract class AbstractSessionTes
      * Creates a item.
      */
     protected Item createItem(Session session, Folder parent, String name, String objectTypeId) {
+        if (parent == null) {
+            throw new IllegalArgumentException("Parent is not set!");
+        }
+        if (name == null) {
+            throw new IllegalArgumentException("Name is not set!");
+        }
+        if (objectTypeId == null) {
+            throw new IllegalArgumentException("Object Type Id is not set!");
+        }
+
         Map<String, Object> properties = new HashMap<String, Object>();
         properties.put(PropertyIds.NAME, name);
         properties.put(PropertyIds.OBJECT_TYPE_ID, objectTypeId);
@@ -551,20 +587,19 @@ public abstract class AbstractSessionTes
                     e, true));
         }
 
-        if (parent != null) {
-            List<Folder> parents = result.getParents(SELECT_ALL_NO_CACHE_OC);
-            boolean found = false;
-            for (Folder folder : parents) {
-                if (parent.getId().equals(folder.getId())) {
-                    found = true;
-                    break;
-                }
+        // check parents
+        List<Folder> parents = result.getParents(SELECT_ALL_NO_CACHE_OC);
+        boolean found = false;
+        for (Folder folder : parents) {
+            if (parent.getId().equals(folder.getId())) {
+                found = true;
+                break;
             }
+        }
 
-            if (!found) {
-                addResult(createResult(FAILURE,
-                        "The folder the item has been created in is not in the list of the item parents!"));
-            }
+        if (!found) {
+            addResult(createResult(FAILURE,
+                    "The folder the item has been created in is not in the list of the item parents!"));
         }
 
         return result;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/CmisTestResultImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/CmisTestResultImpl.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/CmisTestResultImpl.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/impl/CmisTestResultImpl.java Tue Jul  2 14:39:20 2013
@@ -74,6 +74,7 @@ public class CmisTestResultImpl implemen
         return stackTrace;
     }
 
+    @SuppressWarnings("PMD.ArrayIsStoredDirectly")
     public void setStackTrace(StackTraceElement[] stackTrace) {
         this.stackTrace = stackTrace;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tck/src/main/java/org/apache/chemistry/opencmis/tck/runner/AbstractRunner.java Tue Jul  2 14:39:20 2013
@@ -21,6 +21,7 @@ package org.apache.chemistry.opencmis.tc
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.util.ArrayList;
@@ -69,7 +70,7 @@ public abstract class AbstractRunner {
         parameters.put(TCK_BUILD_TIMESTAMP_PARAMETER, loadTCKTimestamp());
     }
 
-    public void loadParameters(File file) throws Exception {
+    public void loadParameters(File file) throws IOException {
         if (file == null || !file.isFile()) {
             throw new IllegalArgumentException("File not found!");
         }
@@ -77,7 +78,7 @@ public abstract class AbstractRunner {
         loadParameters(new FileInputStream(file));
     }
 
-    public void loadParameters(InputStream stream) throws Exception {
+    public void loadParameters(InputStream stream) throws IOException {
         if (stream == null) {
             throw new IllegalArgumentException("Stream is null!");
         }
@@ -234,7 +235,9 @@ public abstract class AbstractRunner {
      * Runs all configured groups.
      */
     public void run(CmisTestProgressMonitor monitor) throws Exception {
-        isCanceled = false;
+        synchronized (this) {
+            isCanceled = false;
+        }
 
         for (CmisTestGroup group : groups) {
             synchronized (this) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-tools/src/main/java/org/apache/chemistry/opencmis/tools/filecopy/FileCopier.java Tue Jul  2 14:39:20 2013
@@ -218,8 +218,8 @@ public class FileCopier {
                 
                 parser.extractMetadata(f, td, session);
                 Map<String, Object> properties = parser.getCmisProperties();
-                for (String key : properties.keySet()) {
-                    LOG.info("Found metadata tag " + key + "mapped to " + properties.get(key));
+                for (Map.Entry<String, Object> entry : properties.entrySet()) {
+                    LOG.info("Found metadata tag " + entry.getKey() + "mapped to " + entry.getValue());
                 }
             }                        
         } catch (Exception e) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java?rev=1498960&r1=1498959&r2=1498960&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java Tue Jul  2 14:39:20 2013
@@ -306,10 +306,10 @@ public class ClientHelper {
         return tempFile;
     }
 
-    public static File createTempFileFromDocument(CmisObject object, String streamId) throws Exception {
+    public static File createTempFileFromDocument(CmisObject object, String streamId) throws IOException {
         ContentStream content = getContentStream(object, streamId);
         if (content == null) {
-            throw new Exception("No content!");
+            throw new IllegalArgumentException("No content!");
         }
 
         String filename = content.getFileName();



Mime
View raw message