Author: jochen
Date: Thu May 18 12:31:03 2006
New Revision: 407619
URL: http://svn.apache.org/viewvc?rev=407619&view=rev
Log:
Removed the XmlRpcDateTimeFormat again. It is actually too different from
XsDateTimeFormat.
Removed:
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XmlRpcDateTimeFormat.java
Modified:
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateFormat.java
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateTimeFormat.java
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsTimeFormat.java
webservices/commons/trunk/modules/util/src/test/org/apache/ws/commons/util/test/XsDateTimeFormatTest.java
Modified:
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateFormat.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateFormat.java?rev=407619&r1=407618&r2=407619&view=diff
==============================================================================
---
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateFormat.java
(original)
+++
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateFormat.java
Thu May 18 12:31:03 2006
@@ -26,6 +26,6 @@
/** Creates a new instance.
*/
public XsDateFormat() {
- super(true, false, true);
+ super(true, false);
}
}
Modified:
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateTimeFormat.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateTimeFormat.java?rev=407619&r1=407618&r2=407619&view=diff
==============================================================================
---
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateTimeFormat.java
(original)
+++
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsDateTimeFormat.java
Thu May 18 12:31:03 2006
@@ -30,29 +30,16 @@
private static final long serialVersionUID = 3258131340871479609L;
final boolean parseDate;
final boolean parseTime;
- final boolean parseTz;
- /** Creates a new instance with the given settings.
- * @param pParseDate Returns, whether the parsed/printed object will
- * contain a date. In the case of [EMAIL PROTECTED] XsTimeFormat}, this
value
- * will be false. Otherwise, it will be true.
- * @param pParseTime Returns, whether the parsed/printed object will
- * contain a time value. In the case of [EMAIL PROTECTED] XsDateFormat},
this
- * value will be false. Otherwise, it will be true.
- * @param pParseTz Returns, whether the parsed/printed object will
- * contain a time zone. This is typically the case, unless for printing
- * XML-RPC values.
- */
- protected XsDateTimeFormat(boolean pParseDate, boolean pParseTime, boolean
pParseTz) {
+ XsDateTimeFormat(boolean pParseDate, boolean pParseTime) {
parseDate = pParseDate;
parseTime = pParseTime;
- parseTz = pParseTz;
}
/** Creates a new instance.
*/
public XsDateTimeFormat() {
- this(true, true, true);
+ this(true, true);
}
private int parseInt(String pString, int pOffset, StringBuffer pDigits) {
@@ -201,41 +188,35 @@
hour = minute = second = millis = 0;
}
- final TimeZone tz;
- if (parseTz) {
- digits.setLength(0);
- digits.append("GMT");
- if (offset < length) {
- char c = pString.charAt(offset);
- if (c == 'Z') {
- // Ignore UTC, it is the default
- ++offset;
- } else if (c == '+' || c == '-') {
- digits.append(c);
- ++offset;
- for (int i = 0; i < 5; i++) {
- if (offset >= length) {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- c = pString.charAt(offset);
- if ((i != 2 && Character.isDigit(c)) ||
- (i == 2 && c == ':')) {
- digits.append(c);
- } else {
- pParsePosition.setErrorIndex(offset);
- return null;
- }
- ++offset;
+ digits.setLength(0);
+ digits.append("GMT");
+ if (offset < length) {
+ char c = pString.charAt(offset);
+ if (c == 'Z') {
+ // Ignore UTC, it is the default
+ ++offset;
+ } else if (c == '+' || c == '-') {
+ digits.append(c);
+ ++offset;
+ for (int i = 0; i < 5; i++) {
+ if (offset >= length) {
+ pParsePosition.setErrorIndex(offset);
+ return null;
+ }
+ c = pString.charAt(offset);
+ if ((i != 2 && Character.isDigit(c)) ||
+ (i == 2 && c == ':')) {
+ digits.append(c);
+ } else {
+ pParsePosition.setErrorIndex(offset);
+ return null;
}
+ ++offset;
}
}
- tz = TimeZone.getTimeZone(digits.toString());
- } else {
- tz = TimeZone.getDefault();
}
- Calendar cal = Calendar.getInstance(tz);
+ Calendar cal =
Calendar.getInstance(TimeZone.getTimeZone(digits.toString()));
cal.set(isMinus ? -year : year, parseDate ? month-1 : month, mday,
hour, minute, second);
cal.set(Calendar.MILLISECOND, millis);
pParsePosition.setIndex(offset);
@@ -289,29 +270,27 @@
append(pBuffer, millis, 3);
}
}
- if (parseTz) {
- TimeZone tz = cal.getTimeZone();
- // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
- int offset = cal.get(Calendar.ZONE_OFFSET);
- if (tz.inDaylightTime(cal.getTime())) {
- offset += cal.get(Calendar.DST_OFFSET);
- }
- if (offset == 0) {
- pBuffer.append('Z');
+ TimeZone tz = cal.getTimeZone();
+ // JDK 1.4: int offset = tz.getOffset(cal.getTimeInMillis());
+ int offset = cal.get(Calendar.ZONE_OFFSET);
+ if (tz.inDaylightTime(cal.getTime())) {
+ offset += cal.get(Calendar.DST_OFFSET);
+ }
+ if (offset == 0) {
+ pBuffer.append('Z');
+ } else {
+ if (offset < 0) {
+ pBuffer.append('-');
+ offset = -offset;
} else {
- if (offset < 0) {
- pBuffer.append('-');
- offset = -offset;
- } else {
- pBuffer.append('+');
- }
- int minutes = offset / (60*1000);
- int hours = minutes / 60;
- minutes -= hours * 60;
- append(pBuffer, hours, 2);
- pBuffer.append(':');
- append(pBuffer, minutes, 2);
+ pBuffer.append('+');
}
+ int minutes = offset / (60*1000);
+ int hours = minutes / 60;
+ minutes -= hours * 60;
+ append(pBuffer, hours, 2);
+ pBuffer.append(':');
+ append(pBuffer, minutes, 2);
}
return pBuffer;
}
Modified:
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsTimeFormat.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsTimeFormat.java?rev=407619&r1=407618&r2=407619&view=diff
==============================================================================
---
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsTimeFormat.java
(original)
+++
webservices/commons/trunk/modules/util/src/java/org/apache/ws/commons/util/XsTimeFormat.java
Thu May 18 12:31:03 2006
@@ -26,6 +26,6 @@
/** Creates a new instance.
*/
public XsTimeFormat() {
- super(false, true, true);
+ super(false, true);
}
}
Modified:
webservices/commons/trunk/modules/util/src/test/org/apache/ws/commons/util/test/XsDateTimeFormatTest.java
URL:
http://svn.apache.org/viewvc/webservices/commons/trunk/modules/util/src/test/org/apache/ws/commons/util/test/XsDateTimeFormatTest.java?rev=407619&r1=407618&r2=407619&view=diff
==============================================================================
---
webservices/commons/trunk/modules/util/src/test/org/apache/ws/commons/util/test/XsDateTimeFormatTest.java
(original)
+++
webservices/commons/trunk/modules/util/src/test/org/apache/ws/commons/util/test/XsDateTimeFormatTest.java
Thu May 18 12:31:03 2006
@@ -21,7 +21,6 @@
import java.util.Calendar;
import java.util.TimeZone;
-import org.apache.ws.commons.util.XmlRpcDateTimeFormat;
import org.apache.ws.commons.util.XsDateFormat;
import org.apache.ws.commons.util.XsDateTimeFormat;
import org.apache.ws.commons.util.XsTimeFormat;
@@ -198,22 +197,5 @@
c1 = (Calendar) format.parseObject("15:29:17.15Z");
c2 = (Calendar) format.parseObject("15:29:17.150Z");
assertEquals(c1, c2);
- }
-
- /** Tests the XML-RPC compatible format variant.
- */
- public void testXmlRpcFormat() throws Exception {
- Calendar cal = getCalendar(TimeZone.getTimeZone("GMT"));
- assertEquals(0, cal.get(Calendar.MILLISECOND));
- XmlRpcDateTimeFormat format = new XmlRpcDateTimeFormat();
- String got = format.format(cal);
- String expect = "2004-01-14T03:12:07";
- assertEquals(expect, got);
-
- cal = getCalendar(TimeZone.getTimeZone("GMT-03:00"));
- assertEquals(0, cal.get(Calendar.MILLISECOND));
- got = format.format(cal);
- expect = "2004-01-14T03:12:07";
- assertEquals(expect, got);
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]