svn commit r16435 - trunk/wsf/javascript/rhino/message_receiver/src/org/wso2/javascript/rhino

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

svn commit r16435 - trunk/wsf/javascript/rhino/message_receiver/src/org/wso2/javascript/rhino

svn-9
Author: keith
Date: Thu May  1 03:33:18 2008
New Revision: 16435

Log:

Fixing even date, GYear and so on to work when the user returns a string

Modified:
   trunk/wsf/javascript/rhino/message_receiver/src/org/wso2/javascript/rhino/JSToOMConverter.java

Modified: trunk/wsf/javascript/rhino/message_receiver/src/org/wso2/javascript/rhino/JSToOMConverter.java
==============================================================================
--- trunk/wsf/javascript/rhino/message_receiver/src/org/wso2/javascript/rhino/JSToOMConverter.java (original)
+++ trunk/wsf/javascript/rhino/message_receiver/src/org/wso2/javascript/rhino/JSToOMConverter.java Thu May  1 03:33:18 2008
@@ -45,7 +45,6 @@
 import org.wso2.javascript.xmlimpl.QName;
 
 import java.math.BigDecimal;
-import java.math.BigInteger;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.TimeZone;
@@ -236,6 +235,12 @@
 
     public static String convertToDate(Object jsObject) throws AxisFault {
         try {
+            // If the user returned a date date a s a String we use the converterUtil to validate
+            // it and return it back.
+            if (jsObject instanceof String) {
+                Date date = ConverterUtil.convertToDate((String)jsObject);
+                return ConverterUtil.convertToString(date);
+            }
             Date date = (Date) Context.jsToJava(jsObject, Date.class);
             return ConverterUtil.convertToString(date);
         } catch (EvaluatorException e) {
@@ -245,6 +250,12 @@
 
     public static String convertToTime(Object jsObject) throws AxisFault {
         try {
+            // If the user returned a valid time a s a String we use the converterUtil to validate
+            // it and return it back.
+            if (jsObject instanceof String) {
+                Time time = ConverterUtil.convertToTime((String)jsObject);
+                return ConverterUtil.convertToString(time);
+            }
             Date date = (Date) Context.jsToJava(jsObject, Date.class);
             Calendar calendar = Calendar.getInstance();
             calendar.clear();
@@ -258,6 +269,12 @@
 
     public static String convertToGYearMonth(Object jsObject) throws AxisFault {
         try {
+            // If the user returned a valid GYearMonth a s a String we use the converterUtil to
+            // validate it and return it back.
+            if (jsObject instanceof String) {
+                YearMonth yearMonth = ConverterUtil.convertToGYearMonth((String)jsObject);
+                return ConverterUtil.convertToString(yearMonth);
+            }
             Date date = (Date) Context.jsToJava(jsObject, Date.class);
             Calendar calendar = Calendar.getInstance();
             calendar.clear();
@@ -274,6 +291,12 @@
 
     public static String convertToGMonthDay(Object jsObject) throws AxisFault {
         try {
+            // If the user returned a valid GMonthDay a s a String we use the converterUtil to
+            // validate it and return it back.
+            if (jsObject instanceof String) {
+                MonthDay monthDay = ConverterUtil.convertToGMonthDay((String)jsObject);
+                return ConverterUtil.convertToString(monthDay);
+            }
             Date date = (Date) Context.jsToJava(jsObject, Date.class);
             Calendar calendar = Calendar.getInstance();
             calendar.clear();
@@ -290,6 +313,12 @@
 
     public static String convertToGYear(Object jsObject) throws AxisFault {
         try {
+            // If the user returned a valid GYear a s a String we use the converterUtil to
+            // validate it and return it back.
+            if (jsObject instanceof String) {
+                Year year = ConverterUtil.convertToGYear((String)jsObject);
+                return ConverterUtil.convertToString(year);
+            }
             Date date = (Date) Context.jsToJava(jsObject, Date.class);
             Calendar calendar = Calendar.getInstance();
             calendar.clear();
@@ -305,6 +334,12 @@
 
     public static String convertToGDay(Object jsObject) throws AxisFault {
         try {
+            // If the user returned a valid GDay a s a String we use the converterUtil to
+            // validate it and return it back.
+            if (jsObject instanceof String) {
+                Day day = ConverterUtil.convertToGDay((String)jsObject);
+                return ConverterUtil.convertToString(day);
+            }
             Date date = (Date) Context.jsToJava(jsObject, Date.class);
             Calendar calendar = Calendar.getInstance();
             calendar.clear();
@@ -330,6 +365,12 @@
 
     public static String convertToGMonth(Object jsObject) throws AxisFault {
         try {
+            // If the user returned a valid GMonth a s a String we use the converterUtil to
+            // validate it and return it back.
+            if (jsObject instanceof String) {
+                Month month = ConverterUtil.convertToGMonth((String)jsObject);
+                return ConverterUtil.convertToString(month);
+            }
             Date date = (Date) Context.jsToJava(jsObject, Date.class);
             Calendar calendar = Calendar.getInstance();
             calendar.clear();

_______________________________________________
Wsf-javascript-dev mailing list
[hidden email]
http://wso2.org/cgi-bin/mailman/listinfo/wsf-javascript-dev
Loading...