I don't think GWT does anything useful when you pass a Java Date object into JSNI. You may want to pass the # of milliseconds since 1970 instead.
On Sat, May 30, 2009 at 2:03 AM, Bobby <bobbysoa...@gmail.com> wrote: > > I'm seeing some weird behavior whenever java.util.Date is used. The > following DateTime class in GData wraps around a date: > http://code.google.com/p/gwt-gdata/source/browse/trunk/gdata/src/com/google/gwt/gdata/client/DateTime.java > > The newInstance method receives a java.util.Date.: > > public static native DateTime newInstance(Date date, boolean > dateOnly) /*-{ > return new $wnd.google.gdata.DateTime( > date, > dateOnly > ); > }-*/; > > Whenever i call this method it fails. If i replace it with the > following, then it works: > > public static native DateTime newInstance(Date date, boolean > dateOnly) /*-{ > return new $wnd.google.gdata.DateTime( > new Date(), //pass static JS date instead > dateOnly > ); > }-*/; > > So the date object passed in from Java causes a failure whereas a > regular JS date doesn't. I looked at the Date parameter passed in from > Java and it looked like a regular JS date - when printed, a regular > date string is displayed. > In web mode jUnit hangs on newInstance(new Date(), true/false) because > a JS exception occurs. In hosted mode the following exception is > thrown: > > [WARN] Malformed JSNI reference 'getFullYear'; expect subsequent > failures > java.lang.NoSuchFieldError: getFullYear > at com.google.gwt.dev.shell.CompilingClassLoader > $DispatchClassInfoOracle.getDispId(CompilingClassLoader.java:119) > at com.google.gwt.dev.shell.CompilingClassLoader.getDispId > (CompilingClassLoader.java:531) > at com.google.gwt.dev.shell.ie.IDispatchProxy.getIDsOfNames > (IDispatchProxy.java:124) > at com.google.gwt.dev.shell.ie.IDispatchImpl.GetIDsOfNames > (IDispatchImpl.java:273) > at com.google.gwt.dev.shell.ie.IDispatchImpl.method5 > (IDispatchImpl.java:189) > at org.eclipse.swt.internal.ole.win32.COMObject.callback5 > (COMObject.java:108) > at org.eclipse.swt.internal.ole.win32.COM.VtblCall(Native Method) > at org.eclipse.swt.internal.ole.win32.IDispatch.Invoke(IDispatch.java: > 64) > at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java: > 493) > at org.eclipse.swt.ole.win32.OleAutomation.invoke(OleAutomation.java: > 417) > at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvokeOnWindow > (ModuleSpaceIE6.java:67) > at com.google.gwt.dev.shell.ie.ModuleSpaceIE6.doInvoke > (ModuleSpaceIE6.java:152) > at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java: > 447) > at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid > (ModuleSpace.java:248) > at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid > (JavaScriptHost.java:107) > at com.google.gwt.gdata.client.app.Edited$.setValue$(Edited.java) > at com.google.gwt.gdata.client.app.EditedTest.testProperties > (EditedTest.java:42) > at com.google.gwt.gdata.client.app.__EditedTest_unitTestImpl.doRunTest > (transient source for > com.google.gwt.gdata.client.app.__EditedTest_unitTestImpl:7) > at junit.framework.TestCase.runTest(TestCase.java:62) > at com.google.gwt.junit.client.GWTTestCase.runBare(GWTTestCase.java: > 178) > at com.google.gwt.junit.client.GWTTestCase.__doRunTest > (GWTTestCase.java:116) > at com.google.gwt.junit.client.impl.GWTRunner.runTest(GWTRunner.java: > 188) > at com.google.gwt.junit.client.impl.GWTRunner.doRunTest > (GWTRunner.java:163) > at com.google.gwt.junit.client.impl.GWTRunner.access$3(GWTRunner.java: > 157) > at com.google.gwt.junit.client.impl.GWTRunner > $JUnitHostListener.onSuccess(GWTRunner.java:61) > at com.google.gwt.junit.client.impl.GWTRunner > $JUnitHostListener.onSuccess(GWTRunner.java:1) > at > com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived > (RequestCallbackAdapter.java:215) > at com.google.gwt.http.client.Request.fireOnResponseReceivedImpl > (Request.java:254) > at com.google.gwt.http.client.Request.fireOnResponseReceivedAndCatch > (Request.java:226) > at com.google.gwt.http.client.Request.fireOnResponseReceived > (Request.java:217) > at sun.reflect.GeneratedMethodAccessor27.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java: > 103) > at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod > (IDispatchImpl.java:126) > at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke > (IDispatchProxy.java:155) > at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke > (IDispatchImpl.java:294) > at com.google.gwt.dev.shell.ie.IDispatchImpl.method6 > (IDispatchImpl.java:194) > at org.eclipse.swt.internal.ole.win32.COMObject.callback6 > (COMObject.java:117) > at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) > at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925) > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966) > at com.google.gwt.dev.GWTShell.pumpEventLoop(GWTShell.java:720) > at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:654) > at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:150) > at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java: > 219) > at junit.framework.TestCase.runBare(TestCase.java:130) > at junit.framework.TestResult$1.protect(TestResult.java:106) > at junit.framework.TestResult.runProtected(TestResult.java:124) > at junit.framework.TestResult.run(TestResult.java:109) > at junit.framework.TestCase.run(TestCase.java:120) > at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:132) > at junit.framework.TestSuite.runTest(TestSuite.java:230) > at junit.framework.TestSuite.run(TestSuite.java:225) > at junit.framework.TestSuite.runTest(TestSuite.java:230) > at junit.framework.TestSuite.run(TestSuite.java:225) > at > org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run > (JUnit3TestReference.java:130) > at org.eclipse.jdt.internal.junit.runner.TestExecution.run > (TestExecution.java:38) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > (RemoteTestRunner.java:460) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests > (RemoteTestRunner.java:673) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run > (RemoteTestRunner.java:386) > at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main > (RemoteTestRunner.java:196) > > Any idea why this might be happening? Is it IE6 related? > > Bobby > > On May 29, 2:03 am, Bobby <bobbysoa...@gmail.com> wrote: >> Thanks that was it. >> >> Bobby >> >> On May 26, 9:01 am, Thomas Broyer <t.bro...@gmail.com> wrote: >> >> >> >> > On 26 mai, 14:56, Eric Ayers <zun...@google.com> wrote: >> >> > > The read-only link starts with http, but there may be an error in the >> > > URL: >> >> > >http://gwt-google-apis.googlecode.com/svn/trunk/ajaxloader/ajaxloader... >> >> > > (2 instances of the string ajaxloader in the path) >> >> > ...and given where Bobby sets his svn:external, it should even >> > behttp://gwt-google-apis.googlecode.com/svn/trunk/ajaxloader/ajaxloader...- >> > Hide quoted text - >> >> - Show quoted text - > > > -- Eric Z. Ayers - GWT Team - Atlanta, GA USA http://code.google.com/webtoolkit/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to Google-Web-Toolkit@googlegroups.com To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/Google-Web-Toolkit?hl=en -~----------~----~----~----~------~----~------~--~---