chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1517496 - in /chemistry/opencmis/trunk: chemistry-opencmis-android/chemistry-opencmis-android-client/src/main/java/org/apache/chemistry/opencmis/commons/impl/ chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/a...
Date Mon, 26 Aug 2013 11:28:21 GMT
Author: fmui
Date: Mon Aug 26 11:28:21 2013
New Revision: 1517496

URL: http://svn.apache.org/r1517496
Log:
minor fixes

Modified:
    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/browser/FormDataWriter.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-archetype/src/main/resources/archetype-resources/pom.xml
    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/atompub/CmisAtomPubServlet.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.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-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
    chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/filter/LoggingFilter.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/ClientHelper.java

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=1517496&r1=1517495&r2=1517496&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
Mon Aug 26 11:28:21 2013
@@ -239,7 +239,7 @@ public class XMLUtils {
                     sb.append(parser.getText());
                 }
             } else if (event == XmlPullParser.START_TAG) {
-                throw new RuntimeException("Unexpected tag: " + parser.getName());
+                throw new XmlPullParserException("Unexpected tag: " + parser.getName());
             }
 
             if (!next(parser)) {

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=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/browser/FormDataWriter.java
Mon Aug 26 11:28:21 2013
@@ -228,7 +228,7 @@ public class FormDataWriter {
                     out.write(amp);
                 }
 
-                out.write(IOUtils.getUTF8Bytes(param.getKey() + "=" + URLEncoder.encode(param.getValue(),
"UTF-8")));
+                out.write(IOUtils.getUTF8Bytes(param.getKey() + "=" + URLEncoder.encode(param.getValue(),
IOUtils.UTF8)));
             }
         } else {
             writeLine(out);

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.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/Response.java?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/http/Response.java
Mon Aug 26 11:28:21 2013
@@ -63,7 +63,7 @@ public class Response {
         }
 
         // determine charset
-        charset = "UTF-8";
+        charset = IOUtils.UTF8;
         String contentType = getContentTypeHeader();
         if (contentType != null) {
             String[] parts = contentType.split(";");

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-impl/src/main/java/org/apache/chemistry/opencmis/client/runtime/QueryStatementImpl.java
Mon Aug 26 11:28:21 2013
@@ -373,7 +373,7 @@ public class QueryStatementImpl implemen
     }
 
     @Override
-    protected Object clone() throws CloneNotSupportedException {
+    protected QueryStatementImpl clone() throws CloneNotSupportedException {
         QueryStatementImpl qs = new QueryStatementImpl(session, statement);
         qs.parametersMap.putAll(parametersMap);
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/dataobjects/AbstractTypeDefinition.java
Mon Aug 26 11:28:21 2013
@@ -30,7 +30,7 @@ import org.apache.chemistry.opencmis.com
 /**
  * Abstract type definition data implementation.
  */
-public abstract class AbstractTypeDefinition extends AbstractExtensionData implements MutableTypeDefinition,
Cloneable {
+public abstract class AbstractTypeDefinition extends AbstractExtensionData implements MutableTypeDefinition
{
 
     private static final long serialVersionUID = 2L;
 
@@ -240,15 +240,6 @@ public abstract class AbstractTypeDefini
         this.typeMutability = typeMutability;
     }
 
-    public AbstractTypeDefinition clone() {
-        try {
-            return (AbstractTypeDefinition) super.clone();
-        } catch (CloneNotSupportedException e) {
-            e.printStackTrace();
-            throw new RuntimeException("Clone not supported", e);
-        }
-    }
-
     @Override
     public String toString() {
         return "Type Definition [base id=" + baseId + ", id=" + id + ", display Name=" +
displayName + ", description="

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-archetype/src/main/resources/archetype-resources/pom.xml
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-archetype/src/main/resources/archetype-resources/pom.xml?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-archetype/src/main/resources/archetype-resources/pom.xml
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-archetype/src/main/resources/archetype-resources/pom.xml
Mon Aug 26 11:28:21 2013
@@ -12,7 +12,7 @@
         <opencmis.version>${opencmisVersion}</opencmis.version>
     </properties>
 
-   <name>Your OpenCMIS Server</name>
+    <name>Your OpenCMIS Server</name>
 
     <build>
         <plugins>

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=1517496&r1=1517495&r2=1517496&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
Mon Aug 26 11:28:21 2013
@@ -46,6 +46,7 @@ import org.apache.chemistry.opencmis.com
 import org.apache.chemistry.opencmis.commons.exceptions.CmisInvalidArgumentException;
 import org.apache.chemistry.opencmis.commons.exceptions.CmisNotSupportedException;
 import org.apache.chemistry.opencmis.commons.impl.Base64;
+import org.apache.chemistry.opencmis.commons.impl.IOUtils;
 import org.apache.chemistry.opencmis.commons.impl.XMLConstants;
 import org.apache.chemistry.opencmis.commons.impl.XMLConstraints;
 import org.apache.chemistry.opencmis.commons.impl.XMLConverter;
@@ -415,7 +416,7 @@ public class AtomEntryParser {
                 } else if (event == XMLStreamReader.CHARACTERS) {
                     String s = parser.getText();
                     if (s != null) {
-                        byte[] bytes = s.getBytes("UTF-8");
+                        byte[] bytes = IOUtils.getUTF8Bytes(s);
                         bufferStream.write(bytes);
                         cappedStream.deductBytes(bytes.length);
                     }

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.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/CmisAtomPubServlet.java?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/atompub/CmisAtomPubServlet.java
Mon Aug 26 11:28:21 2013
@@ -292,6 +292,7 @@ public class CmisAtomPubServlet extends 
         }
 
         try {
+            response.reset();
             PrintWriter pw = response.getWriter();
             response.setStatus(statusCode);
             response.setContentType("text/html");

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.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/CmisBrowserBindingServlet.java?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-bindings/src/main/java/org/apache/chemistry/opencmis/server/impl/browser/CmisBrowserBindingServlet.java
Mon Aug 26 11:28:21 2013
@@ -445,6 +445,7 @@ public class CmisBrowserBindingServlet e
                     : null);
 
             if (token == null) {
+                response.reset();
                 setStatus(request, response, statusCode);
                 response.setContentType(JSON_MIME_TYPE);
 

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=1517496&r1=1517495&r2=1517496&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
Mon Aug 26 11:28:21 2013
@@ -500,6 +500,8 @@ public class FileShareRepository {
      */
     public String createDocumentFromSource(CallContext context, String sourceId, Properties
properties,
             String folderId, VersioningState versioningState) {
+        debug("createDocumentFromSource");
+        checkUser(context, true);
 
         // check versioning state
         if (VersioningState.NONE != versioningState) {
@@ -570,7 +572,7 @@ public class FileShareRepository {
                 }
 
                 // can it be set?
-                if ((propType.getUpdatability() != Updatability.READWRITE)) {
+                if (propType.getUpdatability() != Updatability.READWRITE) {
                     throw new CmisConstraintException("Property '" + prop.getId() + "' cannot
be updated!");
                 }
 
@@ -814,7 +816,7 @@ public class FileShareRepository {
         debug("deleteTree");
         checkUser(context, true);
 
-        boolean cof = (continueOnFailure == null ? false : continueOnFailure.booleanValue());
+        boolean cof = FileShareUtils.getBooleanParameter(continueOnFailure, false);
 
         // get the file or folder
         File file = getFile(folderId);
@@ -826,10 +828,7 @@ public class FileShareRepository {
         if (file.isDirectory()) {
             deleteFolder(file, cof, result);
         } else {
-            getPropertiesFile(file).delete();
-            if (!file.delete()) {
-                result.getIds().add(getId(file));
-            }
+            throw new CmisConstraintException("Object is not a folder!");
         }
 
         return result;
@@ -876,7 +875,7 @@ public class FileShareRepository {
         debug("updateProperties");
         boolean userReadOnly = checkUser(context, true);
 
-        if (objectId == null) {
+        if (objectId == null || objectId.getValue() == null) {
             throw new CmisInvalidArgumentException("Id is not valid!");
         }
 
@@ -1634,7 +1633,7 @@ public class FileShareRepository {
             IOUtils.closeQuietly(stream);
         }
 
-        if ((obj == null) || (obj.getProperties() == null)) {
+        if (obj == null || obj.getProperties() == null) {
             return;
         }
 
@@ -1780,7 +1779,7 @@ public class FileShareRepository {
     }
 
     private boolean isEmptyProperty(PropertyData<?> prop) {
-        if ((prop == null) || (prop.getValues() == null)) {
+        if (prop == null || prop.getValues() == null) {
             return true;
         }
 
@@ -1843,7 +1842,7 @@ public class FileShareRepository {
     }
 
     private boolean checkAddProperty(Properties properties, String typeId, Set<String>
filter, String id) {
-        if ((properties == null) || (properties.getProperties() == null)) {
+        if (properties == null || properties.getProperties() == null) {
             throw new IllegalArgumentException("Properties must not be null!");
         }
 
@@ -1861,7 +1860,7 @@ public class FileShareRepository {
 
         String queryName = type.getPropertyDefinitions().get(id).getQueryName();
 
-        if ((queryName != null) && (filter != null)) {
+        if (queryName != null && filter != null) {
             if (!filter.contains(queryName)) {
                 return false;
             } else {
@@ -1877,7 +1876,7 @@ public class FileShareRepository {
      */
     @SuppressWarnings("unchecked")
     private boolean addPropertyDefault(PropertiesImpl props, PropertyDefinition<?>
propDef) {
-        if ((props == null) || (props.getProperties() == null)) {
+        if (props == null || props.getProperties() == null) {
             throw new IllegalArgumentException("Props must not be null!");
         }
 
@@ -1886,7 +1885,7 @@ public class FileShareRepository {
         }
 
         List<?> defaultValue = propDef.getDefaultValue();
-        if ((defaultValue != null) && (!defaultValue.isEmpty())) {
+        if (defaultValue != null && !defaultValue.isEmpty()) {
             switch (propDef.getPropertyType()) {
             case BOOLEAN:
                 props.addProperty(new PropertyBooleanImpl(propDef.getId(), (List<Boolean>)
defaultValue));
@@ -1913,7 +1912,7 @@ public class FileShareRepository {
                 props.addProperty(new PropertyUriImpl(propDef.getId(), (List<String>)
defaultValue));
                 break;
             default:
-                throw new RuntimeException("Unknown datatype! Spec change?");
+                assert false;
             }
 
             return true;
@@ -2040,7 +2039,7 @@ public class FileShareRepository {
 
         String[] fileNames = folder.list();
 
-        if ((fileNames == null) || (fileNames.length == 0)) {
+        if (fileNames == null || fileNames.length == 0) {
             return true;
         }
 

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.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/TypeDefinitionFactory.java?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/TypeDefinitionFactory.java
Mon Aug 26 11:28:21 2013
@@ -1002,7 +1002,7 @@ public final class TypeDefinitionFactory
         assert source != null;
         assert target != null;
 
-        if (source != null && source.getPropertyDefinitions() != null) {
+        if (source.getPropertyDefinitions() != null) {
             for (PropertyDefinition<?> propDef : source.getPropertyDefinitions().values())
{
                 if (cmisVersion == CmisVersion.CMIS_1_0) {
                     if (NEW_CMIS11_PROPERTIES.contains(propDef.getId())) {

Modified: chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/filter/LoggingFilter.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/filter/LoggingFilter.java?rev=1517496&r1=1517495&r2=1517496&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/filter/LoggingFilter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-server/chemistry-opencmis-server-support/src/main/java/org/apache/chemistry/opencmis/server/support/filter/LoggingFilter.java
Mon Aug 26 11:28:21 2013
@@ -27,6 +27,7 @@ import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.StringReader;
 import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Enumeration;
@@ -55,6 +56,7 @@ import javax.xml.transform.TransformerFa
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
 
+import org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException;
 import org.apache.chemistry.opencmis.commons.impl.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -177,7 +179,7 @@ public class LoggingFilter implements Fi
         PrintWriter pw = null;
         OutputStreamWriter fw = null;
         try {
-            fw = new OutputStreamWriter(new FileOutputStream(filename), "UTF-8");
+            fw = new OutputStreamWriter(new FileOutputStream(filename), IOUtils.UTF8);
             pw = new PrintWriter(fw);
 
             Scanner scanner = new Scanner(content);
@@ -240,7 +242,8 @@ public class LoggingFilter implements Fi
                 if (line.startsWith("<?xml") || line.startsWith("{")) {
                     inXmlOrJsonBody = true;
                     isXml = line.startsWith("<?xml");
-                    xmlBodyBuffer.write(line.getBytes(), 0, line.length());
+                    byte[] lienBytes = IOUtils.getUTF8Bytes(line);
+                    xmlBodyBuffer.write(lienBytes, 0, lienBytes.length);
                     while (inXmlOrJsonBody) {
                         line = in.readLine();
                         if (line == null) {
@@ -252,13 +255,13 @@ public class LoggingFilter implements Fi
                             inXmlOrJsonBody = false;
                             inXmlOrJsonPart = false;
                             if (isXml) {
-                                out.append(prettyPrintXml(xmlBodyBuffer.toString(), indent));
+                                out.append(prettyPrintXml(xmlBodyBuffer.toString(IOUtils.UTF8),
indent));
                             } else {
-                                out.append(prettyPrintJson(xmlBodyBuffer.toString(), indent));
+                                out.append(prettyPrintJson(xmlBodyBuffer.toString(IOUtils.UTF8),
indent));
                             }
                             out.append(line).append('\n');
                         } else {
-                            xmlBodyBuffer.write(line.getBytes(), 0, line.length());
+                            xmlBodyBuffer.write(lienBytes, 0, lienBytes.length);
                         }
                     }
                 } else {
@@ -402,7 +405,11 @@ public class LoggingFilter implements Fi
         }
 
         public String getPayload() {
-            return baous.toString();
+            try {
+                return baous.toString(IOUtils.UTF8);
+            } catch (UnsupportedEncodingException e) {
+                throw new CmisRuntimeException("Unsupported encoding 'UTF-8'!", e);
+            }
         }
     }
 
@@ -423,7 +430,7 @@ public class LoggingFilter implements Fi
         public PrintWriter getWriter() {
             try {
                 if (null == writer) {
-                    writer = new PrintWriter(this.getOutputStream());
+                    writer = new PrintWriter(new OutputStreamWriter(this.getOutputStream(),
IOUtils.UTF8));
                 }
                 return writer;
             } catch (IOException 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=1517496&r1=1517495&r2=1517496&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
Mon Aug 26 11:28:21 2013
@@ -38,9 +38,9 @@ import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
-import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.Writer;
@@ -700,7 +700,7 @@ public final class ClientHelper {
             engine.put("session", model.getClientSession().getSession());
             engine.put("binding", model.getClientSession().getSession().getBinding());
             engine.put("out", new PrintWriter(out));
-            engine.eval(new FileReader(file));
+            engine.eval(new InputStreamReader(new FileInputStream(file), "UTF-8"));
         } catch (Exception ex) {
             ClientHelper.showError(null, ex);
         } finally {



Mime
View raw message