objects.setElementAt(new String(content.getBuf(), 0, content.size()), objects.size() - 1);
else if (c.localName.equals("dateTime.iso8601")) {
- throw new Error("not implemented");
- /*
- String s = new String(content.getBuf(), 0, content.size());
-
- // strip whitespace
- int i=0;
- while(Character.isWhitespace(s.charAt(i))) i++;
- if (i > 0) s = s.substring(i);
-
- try {
- NativeDate nd = (NativeDate)JS.Thread.enter().newObject(org.xwt.util.JS.Obj.defaultObjects, "Date");
- double date = NativeDate.date_msecFromDate(Double.valueOf(s.substring(0, 4)).doubleValue(),
- Double.valueOf(s.substring(4, 6)).doubleValue() - 1,
- Double.valueOf(s.substring(6, 8)).doubleValue(),
- Double.valueOf(s.substring(9, 11)).doubleValue(),
- Double.valueOf(s.substring(12, 14)).doubleValue(),
- Double.valueOf(s.substring(15, 17)).doubleValue(),
- (double)0
- );
- nd.jsFunction_setTime(NativeDate.internalUTC(date));
- objects.setElementAt(nd, objects.size() - 1);
-
- } catch (Exception e) {
- if (Log.on) Log.log(this, "error parsing date : " + s);
- if (Log.on) Log.log(this, e);
- }
- */
+ String s = new String(content.getBuf(), 0, content.size());
+
+ // strip whitespace
+ int i=0;
+ while(Character.isWhitespace(s.charAt(i))) i++;
+ if (i > 0) s = s.substring(i);
+
+ try {
+ org.xwt.js.Date nd = new org.xwt.js.Date();
+ double date = org.xwt.js.Date.date_msecFromDate(Double.valueOf(s.substring(0, 4)).doubleValue(),
+ Double.valueOf(s.substring(4, 6)).doubleValue() - 1,
+ Double.valueOf(s.substring(6, 8)).doubleValue(),
+ Double.valueOf(s.substring(9, 11)).doubleValue(),
+ Double.valueOf(s.substring(12, 14)).doubleValue(),
+ Double.valueOf(s.substring(15, 17)).doubleValue(),
+ (double)0
+ );
+ nd.jsFunction_setTime(org.xwt.js.Date.internalUTC(date));
+ objects.setElementAt(nd, objects.size() - 1);
+
+ } catch (Exception e) {
+ if (Log.on) Log.log(this, "error parsing date : " + s);
+ if (Log.on) Log.log(this, e);
+ }
} else if (c.localName.equals("member")) {
Object memberValue = objects.elementAt(objects.size() - 1);
}
sb.append("</string></value>\n");
- /*
} else if (o instanceof org.xwt.js.Date) {
sb.append(" <value><dateTime.iso8601>");
- FIXME
- org.xwt.js.Date d = (org.xwt.js.Date)o;
- Date d = new Date(nd.getRawTime());
+ java.util.Date d = new java.util.Date(((org.xwt.js.Date)o).getRawTime());
sb.append(d.getYear() + 1900);
if (d.getMonth() + 1 < 10) sb.append('0');
sb.append(d.getMonth() + 1);
if (d.getSeconds() < 10) sb.append('0');
sb.append(d.getSeconds());
sb.append("</dateTime.iso8601></value>\n");
- */
} else if (o instanceof JS.Array) {
if (tracker.get(o) != null) throw new JS.Exn("attempted to send multi-ref data structure via XML-RPC");
while ((s = br2.readLine()) != null) Log.log(this, "send: " + s);
}
- HTTP.HTTPInputStream is = http.POST("text/xml", content);
+ InputStream is = http.POST("text/xml", content);
try {
BufferedReader br = !Log.verbose ?
- new BufferedReader(new InputStreamReader(new Filter(is))) :
- new BufferedReader(new FilterReader(new InputStreamReader(new Filter(is))) {
+ new BufferedReader(new InputStreamReader(is)) :
+ new BufferedReader(new FilterReader(new InputStreamReader(is)) {
public int read() throws IOException {
int i = super.read();
if (Log.on) Log.log(this, "recv: " + ((char)i));
}
public final Object call(JS.Array args) throws JS.Exn {
-
- if (!ThreadMessage.suspendThread()) return null;
-
try {
return call2(args);
} catch (IOException se) {
} catch (JS.Exn jse) {
if (Log.on) Log.log(this, jse.toString());
throw jse;
- } finally {
- ThreadMessage.resumeThread();
}
-
}
/** When you get a property from an XMLRPC, it just returns another XMLRPC with the property name tacked onto methodname. */
public AccessibleCharArrayWriter(int i) { super(i); }
}
- /** private filter class to make sure that network transfers don't interfere with UI responsiveness */
- private static class Filter extends FilterInputStream {
- public Filter(InputStream is) { super(is); }
- public int read() throws IOException {
- java.lang.Thread.yield();
- while(Message.Q.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
- return super.read();
- }
- public int read(byte[] b) throws IOException {
- java.lang.Thread.yield();
- while(Message.Q.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
- return super.read(b);
- }
- public int read(byte[] b, int i, int j) throws IOException {
- java.lang.Thread.yield();
- while(Message.Q.nonThreadEventsInQueue > 0) try { java.lang.Thread.sleep(100); } catch (Exception e) { };
- return super.read(b, i, j);
- }
- }
-
}