You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2013/08/07 17:23:49 UTC

svn commit: r1511360 [1/2] - in /chemistry/opencmis/trunk: chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/ chemistry-opencmis-android/chemistry-opencmis-android-clien...

Author: fmui
Date: Wed Aug  7 15:23:48 2013
New Revision: 1511360

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

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/AtomPubParser.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-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LTPAWSSecurityAuthenticationProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.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/AbstractPortProvider.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/osgi/Activator.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/Base64.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/MimeTypes.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-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryObject.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilBase.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilStrict.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/StringUtil.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-tools/src/main/java/org/apache/chemistry/opencmis/tools/mapper/PropertyMapperExif.java
    chemistry/opencmis/trunk/chemistry-opencmis-test/chemistry-opencmis-test-util/src/main/java/org/apache/chemistry/opencmis/util/content/fractal/FractalGenerator.java

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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -29,6 +29,7 @@ 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;
@@ -42,11 +43,11 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
 import org.apache.chemistry.opencmis.commons.enums.CmisVersion;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
-import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
-import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.Base64;
 import org.apache.chemistry.opencmis.commons.impl.DateTimeHelper;
 import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.dataobjects.BulkUpdateImpl;
 import org.xmlpull.v1.XmlSerializer;
 
@@ -140,8 +141,12 @@ public class AtomEntryWriter {
 
     /**
      * Writes the entry to an output stream.
+     * 
+     * @throws IOException
+     * @throws IllegalStateException
+     * @throws IllegalArgumentException
      */
-    public void write(OutputStream out) throws Exception {
+    public void write(OutputStream out) throws IOException {
         XmlSerializer writer = Xml.newSerializer();
         writer.setOutput(out, ENCODING);
 
@@ -150,13 +155,15 @@ public class AtomEntryWriter {
 
         // start entry
         writer.startTag(XMLConstants.NAMESPACE_ATOM, TAG_ENTRY);
-        
+
         writer.attribute("", XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
         writer.attribute("", XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
         writer.attribute("", XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
-        /*if (contentStream != null && contentStream.getFileName() != null) {
-            writer.attribute("", XMLConstants.PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY);
-        }*/
+        /*
+         * if (contentStream != null && contentStream.getFileName() != null) {
+         * writer.attribute("", XMLConstants.PREFIX_APACHE_CHEMISTY,
+         * XMLConstants.NAMESPACE_APACHE_CHEMISTRY); }
+         */
 
         // atom:id
         writeTag(writer, XMLConstants.NAMESPACE_ATOM, TAG_ATOM_ID, "urn:uuid:00000000-0000-0000-0000-00000000000");
@@ -177,7 +184,7 @@ public class AtomEntryWriter {
                 XMLUtils.write(writer, XMLConstants.PREFIX_APACHE_CHEMISTY, XMLConstants.NAMESPACE_APACHE_CHEMISTRY,
                         TAG_CONTENT_FILENAME, contentStream.getFileName());
             }
-            
+
             writer.startTag(XMLConstants.NAMESPACE_RESTATOM, TAG_CONTENT_BASE64);
             writeContent(writer);
             writer.endTag(XMLConstants.NAMESPACE_RESTATOM, TAG_CONTENT_BASE64);
@@ -189,7 +196,7 @@ public class AtomEntryWriter {
         if (object != null) {
             XMLConverter.writeObject(writer, cmisVersion, XMLConstants.NAMESPACE_RESTATOM, object);
         }
-        
+
         // type
         if (typeDef != null) {
             XMLConverter.writeTypeDefinition(writer, cmisVersion, XMLConstants.NAMESPACE_RESTATOM, typeDef);
@@ -204,7 +211,7 @@ public class AtomEntryWriter {
         writer.endTag(XMLConstants.NAMESPACE_ATOM, TAG_ENTRY);
 
         // end document
-         XMLUtils.endXmlDocument(writer);
+        XMLUtils.endXmlDocument(writer);
     }
 
     // ---- internal ----
@@ -232,7 +239,7 @@ public class AtomEntryWriter {
         return result;
     }
 
-    private void writeContent(XmlSerializer writer) throws Exception {
+    private void writeContent(XmlSerializer writer) throws IOException {
         @SuppressWarnings("resource")
         Base64.InputStream b64stream = new Base64.InputStream(stream, Base64.ENCODE);
 
@@ -257,7 +264,7 @@ public class AtomEntryWriter {
     }
 
     private static void writeTag(XmlSerializer writer, String tagNameSpace, String tagName, String text)
-            throws Exception {
+            throws IOException {
         writer.startTag(tagNameSpace, tagName);
         writer.text(text);
         writer.endTag(tagNameSpace, tagName);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.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/AtomPubParser.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/atompub/AtomPubParser.java Wed Aug  7 15:23:48 2013
@@ -30,7 +30,6 @@ import static org.apache.chemistry.openc
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_CONTENT;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_ENTRY;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_FEED;
-import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_HTML;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_LINK;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_NUM_ITEMS;
 import static org.apache.chemistry.opencmis.client.bindings.spi.atompub.CmisAtomPubConstants.TAG_OBJECT;
@@ -60,17 +59,17 @@ import org.apache.chemistry.opencmis.cli
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomEntry;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomFeed;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.AtomLink;
-import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.HtmlDoc;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.RepositoryWorkspace;
 import org.apache.chemistry.opencmis.client.bindings.spi.atompub.objects.ServiceDoc;
 import org.apache.chemistry.opencmis.commons.data.ObjectData;
 import org.apache.chemistry.opencmis.commons.data.RepositoryInfo;
 import org.apache.chemistry.opencmis.commons.definitions.TypeDefinition;
-import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
-import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
 import org.apache.chemistry.opencmis.commons.impl.XMLConstraints;
+import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
+import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
 import org.xmlpull.v1.XmlPullParser;
+import org.xmlpull.v1.XmlPullParserException;
 
 /**
  * AtomPub Parser.
@@ -94,7 +93,7 @@ public class AtomPubParser {
     /**
      * Parses the stream.
      */
-    public void parse() throws Exception {
+    public void parse() throws XmlPullParserException {
         XmlPullParser parser = XMLUtils.createParser(stream);
 
         try {
@@ -157,7 +156,7 @@ public class AtomPubParser {
     /**
      * Parses a service document.
      */
-    private static ServiceDoc parseServiceDoc(XmlPullParser parser) throws Exception {
+    private static ServiceDoc parseServiceDoc(XmlPullParser parser) throws XmlPullParserException {
         ServiceDoc result = new ServiceDoc();
 
         next(parser);
@@ -191,7 +190,7 @@ public class AtomPubParser {
     /**
      * Parses a workspace element in a service document.
      */
-    private static RepositoryWorkspace parseWorkspace(XmlPullParser parser) throws Exception {
+    private static RepositoryWorkspace parseWorkspace(XmlPullParser parser) throws XmlPullParserException {
         RepositoryWorkspace workspace = new RepositoryWorkspace();
 
         next(parser);
@@ -225,7 +224,7 @@ public class AtomPubParser {
     /**
      * Parses an Atom feed.
      */
-    private AtomFeed parseFeed(XmlPullParser parser) throws Exception {
+    private AtomFeed parseFeed(XmlPullParser parser) throws XmlPullParserException {
         AtomFeed result = new AtomFeed();
 
         next(parser);
@@ -268,8 +267,10 @@ public class AtomPubParser {
 
     /**
      * Parses an Atom entry.
+     * 
+     * @throws XmlPullParserException
      */
-    private AtomEntry parseEntry(XmlPullParser parser) throws Exception {
+    private AtomEntry parseEntry(XmlPullParser parser) throws XmlPullParserException {
         AtomEntry result = new AtomEntry();
 
         next(parser);
@@ -307,21 +308,23 @@ public class AtomPubParser {
     /**
      * Parses an Allowable Actions document.
      */
-    private static AtomAllowableActions parseAllowableActions(XmlPullParser parser) throws Exception {
+    private static AtomAllowableActions parseAllowableActions(XmlPullParser parser) throws XmlPullParserException {
         return new AtomAllowableActions(XMLConverter.convertAllowableActions(parser));
     }
 
     /**
      * Parses an ACL document.
      */
-    private static AtomAcl parseACL(XmlPullParser parser) throws Exception {
+    private static AtomAcl parseACL(XmlPullParser parser) throws XmlPullParserException {
         return new AtomAcl(XMLConverter.convertAcl(parser));
     }
 
     /**
      * Parses an element.
+     * 
+     * @throws XmlPullParserException
      */
-    private AtomElement parseElement(XmlPullParser parser) throws Exception {
+    private AtomElement parseElement(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
 
         if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
@@ -352,7 +355,7 @@ public class AtomPubParser {
     /**
      * Parses a children element.
      */
-    private AtomElement parseChildren(XmlPullParser parser) throws Exception {
+    private AtomElement parseChildren(XmlPullParser parser) throws XmlPullParserException {
         AtomElement result = null;
         QName childName = new QName(parser.getNamespace(), parser.getName());
 
@@ -390,7 +393,7 @@ public class AtomPubParser {
     /**
      * Parses a workspace element.
      */
-    private static AtomElement parseWorkspaceElement(XmlPullParser parser) throws Exception {
+    private static AtomElement parseWorkspaceElement(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
 
         if (XMLConstants.NAMESPACE_RESTATOM.equals(name.getNamespaceURI())) {
@@ -418,7 +421,7 @@ public class AtomPubParser {
     /**
      * Parses a collection tag.
      */
-    private static AtomElement parseCollection(XmlPullParser parser) throws Exception {
+    private static AtomElement parseCollection(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
         Map<String, String> result = new HashMap<String, String>();
 
@@ -453,7 +456,7 @@ public class AtomPubParser {
     /**
      * Parses a template tag.
      */
-    private static AtomElement parseTemplate(XmlPullParser parser) throws Exception {
+    private static AtomElement parseTemplate(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
         Map<String, String> result = new HashMap<String, String>();
 
@@ -491,7 +494,7 @@ public class AtomPubParser {
     /**
      * Parses a link tag.
      */
-    private static AtomElement parseLink(XmlPullParser parser) throws Exception {
+    private static AtomElement parseLink(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
         AtomLink result = new AtomLink();
 
@@ -515,7 +518,7 @@ public class AtomPubParser {
     /**
      * Parses a link tag.
      */
-    private static AtomElement parseAtomContentSrc(XmlPullParser parser) throws Exception {
+    private static AtomElement parseAtomContentSrc(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
         AtomLink result = new AtomLink();
         result.setRel(LINK_REL_CONTENT);
@@ -535,8 +538,10 @@ public class AtomPubParser {
 
     /**
      * Parses a text tag.
+     * 
+     * @throws XmlPullParserException
      */
-    private static AtomElement parseText(XmlPullParser parser) throws Exception {
+    private static AtomElement parseText(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
         return new AtomElement(name, XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH));
     }
@@ -544,7 +549,7 @@ public class AtomPubParser {
     /**
      * Parses a text tag and convert it into an integer.
      */
-    private static AtomElement parseBigInteger(XmlPullParser parser) throws Exception {
+    private static AtomElement parseBigInteger(XmlPullParser parser) throws XmlPullParserException {
         QName name = new QName(parser.getNamespace(), parser.getName());
         return new AtomElement(name, new BigInteger(XMLUtils.readText(parser, XMLConstraints.MAX_STRING_LENGTH)));
     }

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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -150,7 +150,7 @@ import org.xmlpull.v1.XmlPullParser;
 import org.xmlpull.v1.XmlPullParserException;
 import org.xmlpull.v1.XmlSerializer;
 
-public class XMLConverter {
+public final class XMLConverter {
 
     private static final Logger LOG = LoggerFactory.getLogger(XMLConverter.class);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.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/XMLUtils.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/XMLUtils.java Wed Aug  7 15:23:48 2013
@@ -37,13 +37,8 @@ public class XMLUtils {
 
     /**
      * Starts a XML document.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
-    public static void startXmlDocument(XmlSerializer writer) throws IllegalArgumentException, IllegalStateException,
-            IOException {
+    public static void startXmlDocument(XmlSerializer writer) throws IOException {
         writer.setPrefix(XMLConstants.PREFIX_ATOM, XMLConstants.NAMESPACE_ATOM);
         writer.setPrefix(XMLConstants.PREFIX_CMIS, XMLConstants.NAMESPACE_CMIS);
         writer.setPrefix(XMLConstants.PREFIX_RESTATOM, XMLConstants.NAMESPACE_RESTATOM);
@@ -54,13 +49,8 @@ public class XMLUtils {
 
     /**
      * Ends a XML document.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
-    public static void endXmlDocument(XmlSerializer writer) throws IllegalArgumentException, IllegalStateException,
-            IOException {
+    public static void endXmlDocument(XmlSerializer writer) throws IOException {
         // end document
         writer.endDocument();
         writer.flush();
@@ -69,13 +59,9 @@ public class XMLUtils {
 
     /**
      * Writes a String tag.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, String value)
-            throws IllegalArgumentException, IllegalStateException, IOException {
+            throws IOException {
         if (value == null) {
             return;
         }
@@ -91,13 +77,9 @@ public class XMLUtils {
 
     /**
      * Writes an Integer tag.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, BigInteger value)
-            throws IllegalArgumentException, IllegalStateException, IOException {
+            throws IOException {
         if (value == null) {
             return;
         }
@@ -106,13 +88,9 @@ public class XMLUtils {
 
     /**
      * Writes a Decimal tag.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, BigDecimal value)
-            throws IllegalArgumentException, IllegalStateException, IOException {
+            throws IOException {
         if (value == null) {
             return;
         }
@@ -122,13 +100,9 @@ public class XMLUtils {
 
     /**
      * Writes a DateTime tag.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, GregorianCalendar value)
-            throws IllegalArgumentException, IllegalStateException, IOException {
+            throws IOException {
         if (value == null) {
             return;
         }
@@ -138,13 +112,9 @@ public class XMLUtils {
 
     /**
      * Writes a Boolean tag.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, Boolean value)
-            throws IllegalArgumentException, IllegalStateException, IOException {
+            throws IOException {
         if (value == null) {
             return;
         }
@@ -154,13 +124,9 @@ public class XMLUtils {
 
     /**
      * Writes an Enum tag.
-     * 
-     * @throws IOException
-     * @throws IllegalStateException
-     * @throws IllegalArgumentException
      */
     public static void write(XmlSerializer writer, String prefix, String namespace, String tag, Enum<?> value)
-            throws IllegalArgumentException, IllegalStateException, IOException {
+            throws IOException {
         if (value == null) {
             return;
         }
@@ -181,8 +147,6 @@ public class XMLUtils {
 
     /**
      * Creates a new XML parser with OpenCMIS default settings.
-     * 
-     * @throws XmlPullParserException
      */
     public static XmlPullParser createParser(InputStream stream) throws XmlPullParserException {
         XmlPullParser parser = Xml.newPullParser();
@@ -211,8 +175,6 @@ public class XMLUtils {
 
     /**
      * Skips a tag or subtree.
-     * 
-     * @throws XmlPullParserException
      */
     public static void skip(XmlPullParser parser) throws XmlPullParserException {
         int level = 1;
@@ -236,8 +198,6 @@ public class XMLUtils {
      * 
      * @return <code>true</code> if another start element has been found,
      *         <code>false</code> otherwise
-     * @throws IOException
-     * @throws XmlPullParserException
      */
     public static boolean findNextStartElemenet(XmlPullParser parser) throws XmlPullParserException, IOException {
         while (true) {
@@ -257,8 +217,6 @@ public class XMLUtils {
 
     /**
      * Parses a tag that contains text.
-     * 
-     * @throws XmlPullParserException
      */
     public static String readText(XmlPullParser parser, int maxLength) throws XmlPullParserException {
         StringBuilder sb = new StringBuilder();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LTPAWSSecurityAuthenticationProvider.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/LTPAWSSecurityAuthenticationProvider.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LTPAWSSecurityAuthenticationProvider.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/LTPAWSSecurityAuthenticationProvider.java Wed Aug  7 15:23:48 2013
@@ -137,7 +137,7 @@ public class LTPAWSSecurityAuthenticatio
 
     @SuppressWarnings("unchecked")
     private <T> T invokeSecurityCredentialMethod(Class<?> credentialClass, Object securityCredential, String methodName)
-            throws NoSuchMethodException, SecurityException, IllegalAccessException, InvocationTargetException {
+            throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
         Method m = credentialClass.getMethod(methodName, new Class[0]);
         return (T) m.invoke(securityCredential, new Object[0]);
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.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/ApacheClientHttpInvoker.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/ApacheClientHttpInvoker.java Wed Aug  7 15:23:48 2013
@@ -115,7 +115,7 @@ public class ApacheClientHttpInvoker ext
         // build new socket factory
         return new SchemeLayeredSocketFactory() {
 
-            public boolean isSecure(Socket sock) throws IllegalArgumentException {
+            public boolean isSecure(Socket sock) {
                 return true;
             }
 
@@ -124,8 +124,7 @@ public class ApacheClientHttpInvoker ext
             }
 
             public Socket connectSocket(final Socket socket, final InetSocketAddress remoteAddress,
-                    final InetSocketAddress localAddress, final HttpParams params) throws IOException,
-                    UnknownHostException, ConnectTimeoutException {
+                    final InetSocketAddress localAddress, final HttpParams params) throws IOException {
 
                 Socket sock = (socket != null ? socket : createSocket(params));
                 if (localAddress != null) {
@@ -164,7 +163,7 @@ public class ApacheClientHttpInvoker ext
             }
 
             public Socket createLayeredSocket(final Socket socket, final String host, final int port,
-                    final HttpParams params) throws IOException, UnknownHostException {
+                    final HttpParams params) throws IOException {
                 SSLSocket sslSocket = (SSLSocket) sf.createSocket(socket, host, port, true);
                 verify(hv, host, sslSocket);
 

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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -24,5 +24,5 @@ import java.io.OutputStream;
  * Output interface.
  */
 public interface Output {
-    void write(OutputStream out) throws Exception;
+    void write(OutputStream out) throws Exception; // NOPMD
 }
\ 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/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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -180,15 +180,13 @@ public abstract class AbstractPortProvid
         private final URL endpointUrl;
 
         public CmisServiceHolder(final CmisWebSerivcesService service, final URL endpointUrl)
-                throws NoSuchMethodException, SecurityException, InstantiationException, InvocationTargetException,
-                IllegalAccessException {
+                throws ReflectiveOperationException {
             this.service = service;
             this.endpointUrl = endpointUrl;
             this.serviceObject = new SoftReference<Service>(createServiceObject());
         }
 
-        private Service createServiceObject() throws NoSuchMethodException, SecurityException, InstantiationException,
-                InvocationTargetException, IllegalAccessException {
+        private Service createServiceObject() throws ReflectiveOperationException {
             final Constructor<? extends Service> serviceConstructor = service.getServiceClass().getConstructor(
                     new Class<?>[] { URL.class, QName.class });
 
@@ -214,7 +212,7 @@ public abstract class AbstractPortProvid
             return service;
         }
 
-        public Service getServiceObject() throws Exception {
+        public Service getServiceObject() throws ReflectiveOperationException {
             Service result = serviceObject.get();
             if (result == null) {
                 result = createServiceObject();

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/osgi/Activator.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/osgi/Activator.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/osgi/Activator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/osgi/Activator.java Wed Aug  7 15:23:48 2013
@@ -33,7 +33,7 @@ import org.osgi.framework.Constants;
  */
 public class Activator implements BundleActivator {
 
-    public void start(BundleContext context) throws Exception {
+    public void start(BundleContext context) {
         // register the MetaTypeService now, that we are ready
         Dictionary<String, String> props = new Hashtable<String, String>();
         props.put(Constants.SERVICE_DESCRIPTION, "Apache Chemistry OpenCMIS Client Session Factory");
@@ -43,7 +43,7 @@ public class Activator implements Bundle
         context.registerService(SessionFactory.class.getName(), sessionFactory, props);
     }
 
-    public void stop(BundleContext context) throws Exception {
+    public void stop(BundleContext context) {
         // The SessionFactory service will be unregistered automatically
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/util/TypeUtils.java Wed Aug  7 15:23:48 2013
@@ -19,6 +19,7 @@
 package org.apache.chemistry.opencmis.client.util;
 
 import java.io.BufferedWriter;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.OutputStream;
@@ -28,6 +29,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 
+import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
@@ -56,6 +58,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
 import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
 import org.apache.chemistry.opencmis.commons.impl.XMLUtils;
+import org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParseException;
 import org.apache.chemistry.opencmis.commons.impl.json.parser.JSONParser;
 
 public class TypeUtils {
@@ -69,7 +72,7 @@ public class TypeUtils {
      * 
      * The XML is UTF-8 encoded and the stream is not closed.
      */
-    public static void writeToXML(TypeDefinition type, OutputStream stream) throws Exception {
+    public static void writeToXML(TypeDefinition type, OutputStream stream) throws XMLStreamException {
         if (type == null) {
             throw new IllegalArgumentException("Type must be set!");
         }
@@ -90,7 +93,7 @@ public class TypeUtils {
      * 
      * The JSON is UTF-8 encoded and the stream is not closed.
      */
-    public static void writeToJSON(TypeDefinition type, OutputStream stream) throws Exception {
+    public static void writeToJSON(TypeDefinition type, OutputStream stream) throws IOException {
         if (type == null) {
             throw new IllegalArgumentException("Type must be set!");
         }
@@ -108,7 +111,7 @@ public class TypeUtils {
      * 
      * The stream must be UTF-8 encoded.
      */
-    public static TypeDefinition readFromXML(InputStream stream) throws Exception {
+    public static TypeDefinition readFromXML(InputStream stream) throws XMLStreamException {
         if (stream == null) {
             throw new IllegalArgumentException("Input stream must be set!");
         }
@@ -131,7 +134,7 @@ public class TypeUtils {
      * The stream must be UTF-8 encoded.
      */
     @SuppressWarnings("unchecked")
-    public static TypeDefinition readFromJSON(InputStream stream) throws Exception {
+    public static TypeDefinition readFromJSON(InputStream stream) throws IOException, JSONParseException {
         if (stream == null) {
             throw new IllegalArgumentException("Input stream must be set!");
         }

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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -30,7 +30,7 @@ package org.apache.chemistry.opencmis.co
  * @author rob@iharder.net
  * @version 2.3.7
  */
-public class Base64 {
+public final class Base64 {
 
     /* ******** P U B L I C F I E L D S ******** */
 

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=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/JSONConverter.java Wed Aug  7 15:23:48 2013
@@ -2040,6 +2040,8 @@ public final class JSONConverter {
                     property = new PropertyUriImpl();
                     ((PropertyUriImpl) property).setValues(copyStringValues(values));
                     break;
+                default:
+                    throw new CmisRuntimeException("Unknown property type!");
                 }
 
                 property.setId(id);
@@ -2157,6 +2159,8 @@ public final class JSONConverter {
                     property = new PropertyUriImpl();
                     ((PropertyUriImpl) property).setValues(copyStringValues(values));
                     break;
+                default:
+                    throw new CmisRuntimeException("Unknown property type!");
                 }
 
                 property.setId(id);

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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -31,7 +31,7 @@ import java.util.Map;
 /**
  * MIME helper class.
  */
-public class MimeHelper {
+public final class MimeHelper {
 
     public static final String CONTENT_DISPOSITION = "Content-Disposition";
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/MimeTypes.java Wed Aug  7 15:23:48 2013
@@ -24,7 +24,7 @@ import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 
-public class MimeTypes {
+public final class MimeTypes {
 
     private static final Map<String, String> EXT2MIME = new HashMap<String, String>();
     private static final Map<String, String> MIME2EXT = new HashMap<String, String>();

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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -18,7 +18,7 @@
  */
 package org.apache.chemistry.opencmis.commons.impl;
 
-public class XMLConstants {
+public final class XMLConstants {
 
     private XMLConstants() {
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeValidator.java Wed Aug  7 15:23:48 2013
@@ -513,9 +513,9 @@ public class TypeValidator {
                 return true;
             } else if (propertyId.equals(PropertyIds.CONTENT_STREAM_ID)) {
                 return true;
-            } else {
-                return false;
             }
+
+            return false;
         } else if (baseTypeId.equals(BaseTypeId.CMIS_FOLDER)) {
             if (propertyId.equals(PropertyIds.PARENT_ID)) {
                 return true;
@@ -523,23 +523,22 @@ public class TypeValidator {
                 return true;
             } else if (propertyId.equals(PropertyIds.PATH)) {
                 return true;
-            } else {
-                return false;
             }
+            
+            return false;
         } else if (baseTypeId.equals(BaseTypeId.CMIS_POLICY)) {
             if (propertyId.equals(PropertyIds.SOURCE_ID)) {
                 return true;
             } else if (propertyId.equals(PropertyIds.TARGET_ID)) {
                 return true;
-            } else {
-                return false;
             }
+            return false;
         } else { // relationship
             if (propertyId.equals(PropertyIds.POLICY_TEXT)) {
                 return true;
-            } else {
-                return false;
             }
+            
+            return false;
         }
     }
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryObject.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryObject.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryObject.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryObject.java Wed Aug  7 15:23:48 2013
@@ -36,7 +36,6 @@ import org.apache.chemistry.opencmis.ser
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
 /**
  * QueryObject is a class used to encapsulate a CMIS query. It is created from
  * an ANTLR parser on an incoming query string. During parsing various
@@ -73,11 +72,13 @@ public class QueryObject {
 
     // order by part
     protected final List<SortSpec> sortSpecs = new ArrayList<SortSpec>();
-    
+
     @SuppressWarnings("serial")
-    protected List<String> predefinedQueryNames = new ArrayList<String> () {{
-        add("SEARCH_SCORE");
-        }};
+    protected List<String> predefinedQueryNames = new ArrayList<String>() {
+        {
+            add("SEARCH_SCORE");
+        }
+    };
 
     private String errorMessage;
 
@@ -105,15 +106,16 @@ public class QueryObject {
 
         @Override
         public String toString() {
-            return "JoinReference(" + kind + "," + alias + "," + onLeft + ","
-                    + onRight + ")";
+            return "JoinReference(" + kind + "," + alias + "," + onLeft + "," + onRight + ")";
         }
     }
 
     public class SortSpec {
         public final boolean ascending;
-        public final Integer colRefKey; // key in columnReferencesMap point to column
-                                    // descriptions
+        public final Integer colRefKey; // key in columnReferencesMap point to
+                                        // column
+
+        // descriptions
 
         public SortSpec(Integer key, boolean ascending) {
             this.colRefKey = key;
@@ -168,8 +170,7 @@ public class QueryObject {
     public void addAlias(String aliasName, CmisSelector aliasRef) {
         LOG.debug("add alias: " + aliasName + " for: " + aliasRef);
         if (colOrFuncAlias.containsKey(aliasName)) {
-            throw new CmisQueryException("You cannot use name " + aliasName
-                    + " more than once as alias in a select.");
+            throw new CmisQueryException("You cannot use name " + aliasName + " more than once as alias in a select.");
         } else {
             aliasRef.setAliasName(aliasName);
             colOrFuncAlias.put(aliasName, aliasRef);
@@ -200,7 +201,8 @@ public class QueryObject {
             return aliasName;
         } catch (CmisQueryException cqe) {
             errorMessage = cqe.getMessage(); // preserve message
-            return null; // indicate an error to ANTLR so that it generates FailedPredicateException
+            return null; // indicate an error to ANTLR so that it generates
+                         // FailedPredicateException
         }
     }
 
@@ -241,30 +243,30 @@ public class QueryObject {
     /**
      * return a map of all columns that have been requested in the SELECT part
      * of the statement.
-     *
-     * @return a map with a String as a key and value. key is the alias if 
-     * an alias was given or the query name otherwise. value is the query 
-     * name of the property.
+     * 
+     * @return a map with a String as a key and value. key is the alias if an
+     *         alias was given or the query name otherwise. value is the query
+     *         name of the property.
      */
     public Map<String, String> getRequestedPropertiesByAlias() {
         return getRequestedProperties(true);
     }
-    
+
     /**
      * return a map of all columns that have been requested in the SELECT part
      * of the statement.
-     *
+     * 
      * @return a map with a String as a key and value. key is the query name of
      *         the property, value is the alias if an alias was given or the
      *         query name otherwise.
-     *         
-     * @deprecated  Use getRequestedPropertiesByAlias instead.
+     * 
+     * @deprecated Use getRequestedPropertiesByAlias instead.
      */
     @Deprecated
     public Map<String, String> getRequestedProperties() {
         return getRequestedProperties(false);
     }
-    
+
     private Map<String, String> getRequestedProperties(boolean byAlias) {
 
         Map<String, String> res = new HashMap<String, String>();
@@ -272,16 +274,16 @@ public class QueryObject {
             if (sel instanceof ColumnReference) {
                 ColumnReference colRef = (ColumnReference) sel;
                 String key = colRef.getPropertyId();
-                if (null == key)
-                 {
+                if (null == key) {
                     key = colRef.getPropertyQueryName(); // happens for *
                 }
                 String propDescr = colRef.getAliasName() == null ? colRef.getPropertyQueryName() : colRef
                         .getAliasName();
-                if (byAlias)
+                if (byAlias) {
                     res.put(propDescr, key);
-                else
+                } else {
                     res.put(key, propDescr);
+                }
             }
         }
         return res;
@@ -290,25 +292,25 @@ public class QueryObject {
     /**
      * return a map of all functions that have been requested in the SELECT part
      * of the statement.
-     *
+     * 
      * @return a map with a String as a key and value. key is the function name
      *         of the property, value is the alias if an alias was given or the
      *         function name otherwise.
-     *         
-     * @deprecated  Use getRequestedPropertiesByAlias instead.
+     * 
+     * @deprecated Use getRequestedPropertiesByAlias instead.
      */
     @Deprecated
     public Map<String, String> getRequestedFuncs() {
         return getRequestedFuncs(false);
     }
-    
+
     /**
      * return a map of all functions that have been requested in the SELECT part
      * of the statement.
-     *
-     * @return a map with a String as a key and value. key is the alias if an 
-     * alias was given or the function name otherwise, value is the a name
-     * of the property. 
+     * 
+     * @return a map with a String as a key and value. key is the alias if an
+     *         alias was given or the function name otherwise, value is the a
+     *         name of the property.
      */
     public Map<String, String> getRequestedFuncsByAlias() {
         return getRequestedFuncs(true);
@@ -321,10 +323,11 @@ public class QueryObject {
             if (sel instanceof FunctionReference) {
                 FunctionReference funcRef = (FunctionReference) sel;
                 String propDescr = funcRef.getAliasName() == null ? funcRef.getName() : funcRef.getAliasName();
-                if (byAlias)
+                if (byAlias) {
                     res.put(propDescr, funcRef.getName());
-                else
+                } else {
                     res.put(funcRef.getName(), propDescr);
+                }
             }
         }
         return res;
@@ -361,7 +364,6 @@ public class QueryObject {
     // ///////////////////////////////////////////////////////
     // WHERE part
 
-
     public void addWhereReference(Tree node, CmisSelector reference) {
         LOG.debug("add node to where: " + System.identityHashCode(node));
         columnReferences.put(node.getTokenStartIndex(), reference);
@@ -392,22 +394,24 @@ public class QueryObject {
     }
 
     /**
-     * Tests if the query has a JOIN from one primary type to only secondary types
-     * (This JOIN does not require a JOIN capability in CMIS).
+     * Tests if the query has a JOIN from one primary type to only secondary
+     * types (This JOIN does not require a JOIN capability in CMIS).
      * 
-     * @return list of secondary type ids that are joined or null if the
-     * query has no JOINs or has joins to primary types
+     * @return list of secondary type ids that are joined or null if the query
+     *         has no JOINs or has joins to primary types
      */
     public List<TypeDefinition> getJoinedSecondaryTypes() {
         List<TypeDefinition> secondaryTypeIds = new ArrayList<TypeDefinition>();
         Map<String, String> froms = getTypes();
-        if (froms.size() == 1)
+        if (froms.size() == 1) {
             return null; // no JOIN in query
+        }
         String mainTypeQueryName = froms.get(getMainTypeAlias());
-        for (String queryName: froms.values()) {
+        for (String queryName : froms.values()) {
             TypeDefinition td = getTypeDefinitionFromQueryName(queryName);
-            if (queryName.equals(mainTypeQueryName))
+            if (queryName.equals(mainTypeQueryName)) {
                 continue;
+            }
             if (td.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY) {
                 secondaryTypeIds.add(td);
             } else {
@@ -415,11 +419,12 @@ public class QueryObject {
             }
         }
         for (JoinSpec join : getJoins()) {
-            if (!(null != join.onLeft && null != join.onRight && ((join.onRight.getPropertyId() == null && join.onRight.getTypeDefinition().getBaseTypeId() == BaseTypeId.CMIS_SECONDARY &&
-                    join.onLeft.getPropertyId().equals(PropertyIds.OBJECT_ID)) ||
-                    (join.onLeft.getPropertyId() == null && join.onLeft.getTypeDefinition().getBaseTypeId() == BaseTypeId.CMIS_SECONDARY && 
-                    join.onRight.getPropertyId().equals(PropertyIds.OBJECT_ID)  ))))
-                return null;             
+            if (!(null != join.onLeft && null != join.onRight && ((join.onRight.getPropertyId() == null
+                    && join.onRight.getTypeDefinition().getBaseTypeId() == BaseTypeId.CMIS_SECONDARY && join.onLeft
+                    .getPropertyId().equals(PropertyIds.OBJECT_ID)) || (join.onLeft.getPropertyId() == null
+                    && join.onLeft.getTypeDefinition().getBaseTypeId() == BaseTypeId.CMIS_SECONDARY && join.onRight
+                    .getPropertyId().equals(PropertyIds.OBJECT_ID)))))
+                return null;
         }
         return secondaryTypeIds;
     }
@@ -450,7 +455,8 @@ public class QueryObject {
                 if (colOrFuncAlias.containsKey(key)) { // it is an alias
                     CmisSelector resolvedReference = colOrFuncAlias.get(key);
                     columnReferences.put(obj, resolvedReference);
-                    // Note: ^ This may replace the value in the map with the same
+                    // Note: ^ This may replace the value in the map with the
+                    // same
                     // value, but this does not harm.
                     // Otherwise we need to check if it is resolved or not which
                     // causes two more ifs:
@@ -458,7 +464,8 @@ public class QueryObject {
                     // ColumnReference colRef = ((ColumnReference) selector);
                     // if (colRef.getTypeDefinition() == null) // it is not yet
                     // resolved
-                    // // replace unresolved column reference by resolved on from
+                    // // replace unresolved column reference by resolved on
+                    // from
                     // alias map
                     // columnReferences.put(obj,
                     // colOrFuncAlias.get(selector.getAliasName()));
@@ -481,7 +488,8 @@ public class QueryObject {
                 // ignore functions here
                 if (select instanceof ColumnReference) {
                     ColumnReference colRef = ((ColumnReference) select);
-                    if (colRef.getTypeDefinition() == null) { // not yet resolved
+                    if (colRef.getTypeDefinition() == null) { // not yet
+                                                              // resolved
                         if (colRef.getQualifier() == null) {
                             // unqualified select: SELECT p FROM
                             resolveTypeForColumnReference(colRef);
@@ -495,13 +503,12 @@ public class QueryObject {
 
             // Replace types used as qualifiers (IN_TREE, IN_FOLDER,
             // CONTAINS) by their corresponding alias (correlation name)
-            for (Entry<Integer, String> en: typeReferences.entrySet()) {
+            for (Entry<Integer, String> en : typeReferences.entrySet()) {
                 Integer obj = en.getKey();
                 String qualifier = en.getValue();
                 String typeQueryName = getReferencedTypeQueryName(qualifier);
                 if (typeQueryName == null) {
-                    throw new CmisQueryException(qualifier
-                            + " is neither a type query name nor an alias.");
+                    throw new CmisQueryException(qualifier + " is neither a type query name nor an alias.");
                 }
                 if (typeQueryName.equals(qualifier)) {
                     // try to find an alias for it
@@ -523,7 +530,8 @@ public class QueryObject {
             return true;
         } catch (CmisQueryException cqe) {
             errorMessage = cqe.getMessage(); // preserve message
-            return false; // indicate an error to ANTLR so that it generates FailedPredicateException
+            return false; // indicate an error to ANTLR so that it generates
+                          // FailedPredicateException
         }
     }
 
@@ -554,10 +562,11 @@ public class QueryObject {
         // it is property query name without a type, so find type
         int noFound = 0;
         TypeDefinition tdFound = null;
-        
-        if (isPredfinedQueryName(propName))
+
+        if (isPredfinedQueryName(propName)) {
             return;
-        
+        }
+
         for (String typeQueryName : froms.values()) {
             TypeDefinition td = typeMgr.getTypeByQueryName(typeQueryName);
             if (null == td) {
@@ -571,11 +580,9 @@ public class QueryObject {
             }
         }
         if (noFound == 0) {
-            throw new CmisQueryException(propName
-                    + " is not a property query name in any of the types in from ...");
+            throw new CmisQueryException(propName + " is not a property query name in any of the types in from ...");
         } else if (noFound > 1 && !isStar) {
-            throw new CmisQueryException(propName
-                    + " is not a unique property query name within the types in from ...");
+            throw new CmisQueryException(propName + " is not a unique property query name within the types in from ...");
         } else {
             if (null != tdFound) {
                 validateColumnReferenceAndResolveType(tdFound, colRef);
@@ -594,8 +601,7 @@ public class QueryObject {
         String typeQueryName = getReferencedTypeQueryName(colRef.getQualifier());
         TypeDefinition td = typeMgr.getTypeByQueryName(typeQueryName);
         if (null == td) {
-            throw new CmisQueryException(colRef.getQualifier()
-                    + " is neither a type query name nor an alias.");
+            throw new CmisQueryException(colRef.getQualifier() + " is neither a type query name nor an alias.");
         }
 
         validateColumnReferenceAndResolveType(td, colRef);
@@ -609,12 +615,14 @@ public class QueryObject {
             hasProp = true;
         } else {
             hasProp = TypeValidator.typeContainsPropertyWithQueryName(td, colRef.getPropertyQueryName());
-            if (!hasProp && td.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY && colRef.getPropertyQueryName().equals(PropertyIds.OBJECT_ID))
-                hasProp = true; // special handling for object id on secondary types which are required for JOINS
+            if (!hasProp && td.getBaseTypeId() == BaseTypeId.CMIS_SECONDARY
+                    && colRef.getPropertyQueryName().equals(PropertyIds.OBJECT_ID))
+                hasProp = true; // special handling for object id on secondary
+                                // types which are required for JOINS
         }
         if (!hasProp) {
-            throw new CmisQueryException(colRef.getPropertyQueryName()
-                    + " is not a valid property query name in type " + td.getId() + ".");
+            throw new CmisQueryException(colRef.getPropertyQueryName() + " is not a valid property query name in type "
+                    + td.getId() + ".");
         }
 
         colRef.setTypeDefinition(typeMgr.getPropertyIdForQueryName(td, colRef.getPropertyQueryName()), td);
@@ -631,8 +639,7 @@ public class QueryObject {
             for (String tqn : froms.values()) {
                 if (qualifier.equals(tqn)) {
                     if (q != null) {
-                        throw new CmisQueryException(qualifier
-                                + " is an ambiguous type query name.");
+                        throw new CmisQueryException(qualifier + " is an ambiguous type query name.");
                     }
                     q = tqn;
                 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilBase.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilBase.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilBase.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilBase.java Wed Aug  7 15:23:48 2013
@@ -28,14 +28,15 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.server.support.TypeManager;
 
 /**
- * Utility class to help parsing and processing a query statement using the AntLR parser
- * Subclasses have to implement methods that setup parser and query walker and 
- * parse and process a query. This class provides common methods for error handling
- * and for storing the necessary opencmis objects for query support
- *
+ * Utility class to help parsing and processing a query statement using the
+ * AntLR parser Subclasses have to implement methods that setup parser and query
+ * walker and parse and process a query. This class provides common methods for
+ * error handling and for storing the necessary opencmis objects for query
+ * support
+ * 
  * @param <T>
- *      AntLR tree grammar, will usually be a CmisQueryWalker but can be custom class for
- *       customized (extended) parsers
+ *            AntLR tree grammar, will usually be a CmisQueryWalker but can be
+ *            custom class for customized (extended) parsers
  */
 public abstract class QueryUtilBase<T extends TreeParser> {
 
@@ -43,29 +44,28 @@ public abstract class QueryUtilBase<T ex
     protected QueryObject queryObj;
     protected PredicateWalkerBase predicateWalker;
     protected String statement;
- 
+
     protected CommonTree parserTree; // the ANTLR tree after parsing phase
-    protected TokenStream tokens;    // the ANTLR token stream
+    protected TokenStream tokens; // the ANTLR token stream
 
     /**
-     * Perform the first phase of query processing. Setup lexer and parser, 
+     * Perform the first phase of query processing. Setup lexer and parser,
      * parse the statement, check for syntax errors and create an AST
      * 
-     * @return
-     *      the abstract syntax tree of the parsed statement
-     *      
+     * @return the abstract syntax tree of the parsed statement
+     * 
      * @throws RecognitionException
      */
     public abstract CommonTree parseStatement() throws RecognitionException;
-    
+
     /**
-     * Perform the second phase of  query processing, analyzes the select 
-     * part, check for semantic errors, fill the query object. Usually a 
-     * walker will be CmisQueryWalker (or subclass) if the supporting 
-     * OpenCMIS query classes are used. 
+     * Perform the second phase of query processing, analyzes the select part,
+     * check for semantic errors, fill the query object. Usually a walker will
+     * be CmisQueryWalker (or subclass) if the supporting OpenCMIS query classes
+     * are used.
      * 
      * @throws RecognitionException
-     */    
+     */
     public abstract void walkStatement() throws RecognitionException;;
 
     /**
@@ -77,44 +77,45 @@ public abstract class QueryUtilBase<T ex
     public void processStatement() throws RecognitionException {
         parseStatement();
         walkStatement();
-     }
+    }
 
     protected QueryUtilBase(String statement, TypeManager tm, PredicateWalkerBase pw) {
         walker = null;
         queryObj = new QueryObject(tm);
-        predicateWalker = pw; 
+        predicateWalker = pw;
         this.statement = statement;
     }
-    
+
     public T getWalker() {
         return walker;
     }
-    
+
     public PredicateWalkerBase getPredicateWalker() {
         return predicateWalker;
     }
-    
+
     public QueryObject getQueryObject() {
         return queryObj;
     }
-    
+
     public String getStatement() {
         return statement;
     }
-        
+
     /**
      * Same as traverseStatement but throws only CMIS Exceptions
      * 
      * @param statement
-     *      CMISQL statement to parse
+     *            CMISQL statement to parse
      * @return
      */
-    public void  processStatementUsingCmisExceptions() {
+    public void processStatementUsingCmisExceptions() {
         try {
             processStatement();
         } catch (RecognitionException e) {
             String errorMsg = queryObj.getErrorMessage();
-            throw new CmisInvalidArgumentException("Walking of statement failed with RecognitionException error: \n   " + errorMsg, e);
+            throw new CmisInvalidArgumentException("Walking of statement failed with RecognitionException error: \n   "
+                    + errorMsg, e);
         } catch (CmisBaseException e) {
             throw e;
         } catch (Exception e) {
@@ -123,15 +124,16 @@ public abstract class QueryUtilBase<T ex
     }
 
     public String getErrorMessage(RecognitionException e) {
-        if (null == walker)
+        if (null == walker) {
             return e.toString();
-        else
+        } else {
             return getErrorMessage(walker, e);
+        }
     }
-    
+
     private static String getErrorMessage(BaseRecognizer recognizer, RecognitionException e) {
         String[] tokenNames = recognizer.getTokenNames();
-        String hdr = "Line "+e.line+":"+e.charPositionInLine;
+        String hdr = "Line " + e.line + ":" + e.charPositionInLine;
         String msg = recognizer.getErrorMessage(e, tokenNames);
         return hdr + " " + msg;
     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilStrict.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilStrict.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilStrict.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/QueryUtilStrict.java Wed Aug  7 15:23:48 2013
@@ -32,10 +32,12 @@ import org.apache.chemistry.opencmis.ser
 
 public class QueryUtilStrict extends QueryUtilBase<CmisQueryWalker> {
 
-    private CommonTree parserTree; // the ANTLR tree after parsing phase
-    private TokenStream tokens;    // the ANTLR token stream
-    private boolean parseFulltext = true; 
-    
+    /* the ANTLR tree after parsing phase */
+    private CommonTree parserTree;
+    /* the ANTLR token stream */
+    private TokenStream tokens;
+    private boolean parseFulltext = true;
+
     public QueryUtilStrict(String statement, TypeManager tm, PredicateWalkerBase pw) {
         super(statement, tm, pw);
     }
@@ -56,25 +58,27 @@ public class QueryUtilStrict extends Que
         if (parser.hasErrors()) {
             throw new CmisInvalidArgumentException(parser.getErrorMessages());
         } else if (tokens.index() != tokens.size()) {
-            throw new CmisInvalidArgumentException("Query String has illegal tokens after end of statement: " + tokens.get(tokens.index()));
+            throw new CmisInvalidArgumentException("Query String has illegal tokens after end of statement: "
+                    + tokens.get(tokens.index()));
         }
-        
+
         parserTree = (CommonTree) parsedStatement.getTree();
         return parserTree;
     }
-    
+
     @Override
     public void walkStatement() throws RecognitionException {
-        
-        if (null == parserTree)
+
+        if (null == parserTree) {
             throw new CmisQueryException("You must parse the query before you can walk it.");
-        
+        }
+
         CommonTreeNodeStream nodes = new CommonTreeNodeStream(parserTree);
         nodes.setTokenStream(tokens);
         walker = new CmisQueryWalker(nodes);
         walker.setDoFullTextParse(parseFulltext);
         walker.query(queryObj, predicateWalker);
-        walker.getWherePredicateTree();    
+        walker.getWherePredicateTree();
     }
 
 }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/StringUtil.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/StringUtil.java?rev=1511360&r1=1511359&r2=1511360&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/StringUtil.java (original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/query/StringUtil.java Wed Aug  7 15:23:48 2013
@@ -18,46 +18,50 @@
  */
 package org.apache.chemistry.opencmis.server.support.query;
 
-
 public class StringUtil {
-    
+
     /**
      * remove all escape sequences in a string and return unescaped string
-     * escape character is backslash \, so \\ --> \, \' --> ' additional
-     * escaped characters can be allowed in escapedChars
+     * escape character is backslash \, so \\ --> \, \' --> ' additional escaped
+     * characters can be allowed in escapedChars
+     * 
      * @param literal
-     *      String to unescape
+     *            String to unescape
      * @param escapedChars
-     *      set of allowed characters to be escaped with a backslash, if set to
-     *      null then ' (quote) and \ (backslash) are allowed to be escaped
-     * @return
-     *      unescaped literal or null if the literal is illegal
+     *            set of allowed characters to be escaped with a backslash, if
+     *            set to null then ' (quote) and \ (backslash) are allowed to be
+     *            escaped
+     * @return unescaped literal or null if the literal is illegal
      */
     public static String unescape(String literal, String escapedChars) {
-        char c ='?';
-        int i=0;
+        char c = '?';
+        int i = 0;
         StringBuffer sb = new StringBuffer();
-        
-        if (null == escapedChars) 
+
+        if (null == escapedChars) {
             escapedChars = "\\'";
-        
-        if (null == literal)
+        }
+
+        if (null == literal) {
             return null;
-        
+        }
+
         int len = literal.length();
-        
-        if (len == 1 && literal.charAt(0) == '\\')
+
+        if (len == 1 && literal.charAt(0) == '\\') {
             return null;
+        }
 
-        if (len > 1 && literal.charAt(len-2) != '\\' && literal.charAt(len-1) == '\\') 
+        if (len > 1 && literal.charAt(len - 2) != '\\' && literal.charAt(len - 1) == '\\') {
             return null;
+        }
 
-        for (i=0; i<len; i++) {
+        for (i = 0; i < len; i++) {
             c = literal.charAt(i);
-            if ( c == '\\') {
-                char escChar = literal.charAt(i+1);
+            if (c == '\\') {
+                char escChar = literal.charAt(i + 1);
                 boolean matched = false;
-                for (int j = 0; j< escapedChars.length(); j++) {
+                for (int j = 0; j < escapedChars.length(); j++) {
                     if (escChar == escapedChars.charAt(j)) {
                         sb.append(escChar);
                         ++i;
@@ -65,15 +69,16 @@ public class StringUtil {
                         break;
                     }
                 }
-                
-                if (!matched)
+
+                if (!matched) {
                     return null;
-                
+                }
+
             } else {
                 sb.append(literal.charAt(i));
             }
         }
-        
+
         return sb.toString();
     }
 

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=1511360&r1=1511359&r2=1511360&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 Wed Aug  7 15:23:48 2013
@@ -3242,12 +3242,12 @@ public abstract class AbstractSessionTes
         }
 
         try {
-            actual.getStream().close();
+            as.close();
         } catch (Exception e) {
         }
 
         try {
-            expected.getStream().close();
+            es.close();
         } catch (Exception e) {
         }