cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r661409 - in /cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common: DataTypeAdapter.java Messages.properties
Date Thu, 29 May 2008 17:23:35 GMT
Author: dkulp
Date: Thu May 29 10:23:34 2008
New Revision: 661409

URL: http://svn.apache.org/viewvc?rev=661409&view=rev
Log:
[CXF-1602] Add better fault message 

Modified:
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java
    cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java?rev=661409&r1=661408&r2=661409&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java
(original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/DataTypeAdapter.java
Thu May 29 10:23:34 2008
@@ -20,9 +20,17 @@
 
 import java.util.Calendar;
 import java.util.Date;
+import java.util.logging.Logger;
+
 import javax.xml.bind.DatatypeConverter;
 
+import org.apache.cxf.common.i18n.Message;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.interceptor.Fault;
+
 public final class DataTypeAdapter {
+    private static final Logger LOG = LogUtils.getL7dLogger(DataTypeAdapter.class);
+
     private DataTypeAdapter() {
     }
 
@@ -30,6 +38,9 @@
         return DatatypeConverter.parseDate(s).getTime();
     }
     public static String printDate(Date dt) {
+        if (dt == null) {
+            throw new Fault(new Message("NULL_PASSED_FOR_DATE", LOG));
+        }
         Calendar c = Calendar.getInstance();
         c.setTime(dt);
         return DatatypeConverter.printDate(c);
@@ -39,6 +50,9 @@
         return DatatypeConverter.parseTime(s).getTime();
     }
     public static String printTime(Date dt) {
+        if (dt == null) {
+            throw new Fault(new Message("NULL_PASSED_FOR_DATE", LOG));
+        }
         Calendar c = Calendar.getInstance();
         c.setTime(dt);
         return DatatypeConverter.printTime(c);
@@ -48,6 +62,9 @@
         return DatatypeConverter.parseDateTime(s).getTime();
     }
     public static String printDateTime(Date dt) {
+        if (dt == null) {
+            throw new Fault(new Message("NULL_PASSED_FOR_DATE", LOG));
+        }
         Calendar c = Calendar.getInstance();
         c.setTime(dt);
         return DatatypeConverter.printDateTime(c);

Modified: cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties
URL: http://svn.apache.org/viewvc/cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties?rev=661409&r1=661408&r2=661409&view=diff
==============================================================================
--- cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties (original)
+++ cxf/trunk/tools/common/src/main/java/org/apache/cxf/tools/common/Messages.properties Thu
May 29 10:23:34 2008
@@ -30,3 +30,5 @@
 VELOCITY_ENGINE_WRITE_ERRORS = Velocity engine write errors
 FAIL_TO_WRITE_FILE = Failed to write file: {0}
 FAIL_TO_COMPILE_GENERATE_CODES = Failed to compile generated code
+
+NULL_PASSED_FOR_DATE = Null Date passed to DataTypeAdapter
\ No newline at end of file



Mime
View raw message