Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting a FieldValueExtractor on a DataSourceField generates IllegalArgumentException #44

Closed
GoogleCodeExporter opened this issue Apr 22, 2015 · 6 comments

Comments

@GoogleCodeExporter
Copy link

  Try to add a FieldValueExtractor to a DataSourceField, that basicaly does
nothing:

field.setFieldValueExtractor(new FieldValueExtractor() {

            public Object execute(Object record, Object value,
                return null;
            }

        });

and by starting the application, you will get the following exception;

com.google.gwt.dev.shell.ie.IDispatchImpl$HResultException:
java.lang.IllegalArgumentException: object is not an instance of declaring
class
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    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.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.smartgwt.client.data.DataSourceField.setFieldValueExtractor(DataSourceField.
java)
    at
com.abzreporting.reportfactory.gwt.client.TaxonomySource.<init>(TaxonomySource.j
ava:42)
    at
com.abzreporting.reportfactory.gwt.client.TaxonomyPanel.<init>(TaxonomyPanel.jav
a:22)
    at
com.abzreporting.reportfactory.gwt.client.TaxonomyExample.onModuleLoad(TaxonomyE
xample.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:320)
    at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:329)
    at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$300(BrowserWidgetIE6.java:37
)
    at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6
.java:76)
    at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.ja
va:139)
    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.dev.GWTShell.run(GWTShell.java:593)
    at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)
    at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke(IDispatchProxy.java:187)
    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.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.smartgwt.client.data.DataSourceField.setFieldValueExtractor(DataSourceField.
java)
    at
com.abzreporting.reportfactory.gwt.client.TaxonomySource.<init>(TaxonomySource.j
ava:42)
    at
com.abzreporting.reportfactory.gwt.client.TaxonomyPanel.<init>(TaxonomyPanel.jav
a:22)
    at
com.abzreporting.reportfactory.gwt.client.TaxonomyExample.onModuleLoad(TaxonomyE
xample.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.jav
a:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:320)
    at
com.google.gwt.dev.shell.BrowserWidget.attachModuleSpace(BrowserWidget.java:329)
    at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6.access$300(BrowserWidgetIE6.java:37
)
    at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.gwtOnLoad(BrowserWidgetIE6
.java:76)
    at
com.google.gwt.dev.shell.ie.BrowserWidgetIE6$External.invoke(BrowserWidgetIE6.ja
va:139)
    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.dev.GWTShell.run(GWTShell.java:593)
    at com.google.gwt.dev.GWTShell.main(GWTShell.java:357)

Original issue reported on code.google.com by pedjak@gmail.com on 14 Dec 2008 at 12:52

@GoogleCodeExporter
Copy link
Author

yeah, that api has not yet been implemented.

Original comment by sanjiv.j...@gmail.com on 14 Dec 2008 at 3:37

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

Fixed in SVN.

Sample usage :

DataSourceTextField customField = new DataSourceTextField("countryCode", "Code 
/ Continent");
customField.setFieldValueExtractor(new FieldValueExtractor() {
    public Object execute(Object record, Object value, DataSourceField field, String fieldName) {
        String countryCode = XMLTools.selectString(record, "countryCode");
        String continent = XMLTools.selectString(record, "continent");
        return countryCode + "/" + continent;
    }
});

Original comment by sanjiv.j...@gmail.com on 17 May 2009 at 3:01

  • Changed state: Fixed
  • Added labels: SmartGWT-1.0b3, Type-Enhancement
  • Removed labels: Type-Defect

@GoogleCodeExporter
Copy link
Author

I am having exactly the same problem here. Updated to GWT 1.1 already, but 
nothing
changed at all. There is also no note about FieldValueExtractor interface in the
release notes.

Original comment by Till.Kol...@googlemail.com on 29 May 2009 at 11:05

@GoogleCodeExporter
Copy link
Author

Please post a standalone test case. The code snippet I posted works fine when 
used with the Showcase samples 
Country Datasource.

Original comment by sanjiv.j...@gmail.com on 29 May 2009 at 11:12

@GoogleCodeExporter
Copy link
Author

Unfortunately I can not post a standalone test case, because my company policy 
does
not allow posting any of their code. But I can assure you, that my code looks 
very
similar to your example.

The only distinction is, that I am using a server response in XML format rather 
than
parsing a static XML-File.

My stacktrace looks exactly the same.

I am just wondering, because the API change history does not say anything about 
the
FindValueExtractor either.

Original comment by Till.Kol...@googlemail.com on 29 May 2009 at 12:26

@GoogleCodeExporter
Copy link
Author

The standalone test case doesn't have to be your company code. Just create a 
new simplified sample, or 
modify a showcase sample so that the error is reproduced.

Also make sure your xml response has the correct content-type header.

The API hasn't changed. Previously the implementation didn't quite exist (as 
noted in by the reporter of this 
issue) but it now does. 

Again, I have tested that it works using this API with the Country XML 
DataSource. Unless you create a sample 
that reproduces the issue, we cannot tell whats going on. 

Original comment by sanjiv.j...@gmail.com on 29 May 2009 at 12:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant