chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1702921 - /chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
Date Mon, 14 Sep 2015 12:26:49 GMT
Author: fmui
Date: Mon Sep 14 12:26:48 2015
New Revision: 1702921

URL: http://svn.apache.org/r1702921
Log:
CMIS-948: use static DatatypeFactory in WSConverter

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java?rev=1702921&r1=1702920&r2=1702921&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-commons/chemistry-opencmis-commons-impl/src/main/java/org/apache/chemistry/opencmis/commons/impl/WSConverter.java
Mon Sep 14 12:26:48 2015
@@ -296,6 +296,15 @@ public final class WSConverter {
         }
     }
 
+    private static DatatypeFactory datatypeFactory;
+    static {
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException e) {
+            throw new RuntimeException("Cannot get a DatatypeFactory instance!", e);
+        }
+    }
+
     /**
      * Private constructor.
      */
@@ -2194,16 +2203,9 @@ public final class WSConverter {
             return null;
         }
 
-        DatatypeFactory df;
-        try {
-            df = DatatypeFactory.newInstance();
-        } catch (DatatypeConfigurationException e) {
-            throw new CmisRuntimeException("Convert exception: " + e.getMessage(), e);
-        }
-
         List<XMLGregorianCalendar> result = new ArrayList<XMLGregorianCalendar>();
         for (GregorianCalendar cal : calendar) {
-            result.add(df.newXMLGregorianCalendar(cal));
+            result.add(datatypeFactory.newXMLGregorianCalendar(cal));
         }
 
         return result;
@@ -2217,14 +2219,7 @@ public final class WSConverter {
             return null;
         }
 
-        DatatypeFactory df;
-        try {
-            df = DatatypeFactory.newInstance();
-        } catch (DatatypeConfigurationException e) {
-            throw new CmisRuntimeException("Convert exception: " + e.getMessage(), e);
-        }
-
-        return df.newXMLGregorianCalendar(calendar);
+        return datatypeFactory.newXMLGregorianCalendar(calendar);
     }
 
     /**
@@ -2838,7 +2833,7 @@ public final class WSConverter {
         }
         target.setExtensions(null);
 
-        if ((source == null) || (source.value == null)) {
+        if (source == null || source.value == null) {
             return;
         }
 



Mime
View raw message