FidFilter sometimes causes NullPointerException in SQLEncoder
--------------------------------------------------------------
Key: GEOT-941
URL: http://jira.codehaus.org/browse/GEOT-941
Project: GeoTools
Issue Type: Bug
Components: core render
Affects Versions: 2.2.0
Reporter: Jesse Eichar
Assigned To: Jesse Eichar
Priority: Minor
Hi all!
I'm back since a long period. I'm proud to announce that our project based on
Udig is currently in a developpement cycle.
I am moving our code based on Udig 1.1M6 to 1.1RC4 and i have the following
problem :
I'm trying to use a FidFilter in order to retrieve a full Feature based on his
"Fid". Look simple isn't it?
But when I use the following code :
public static Feature getFeatureForLiteFeature(String sLayerName, Feature
fLiteFeature){
FeatureSource fs = getFeatureSourceForLayer(sLayerName);
try {
if (fs != null){
FeatureCollection fc = null;
FilterFactory ff = FilterFactoryFinder.createFilterFactory();
// System.out.println("Create Fidfilter");
FidFilter fidf = null;
fidf = ff.createFidFilter(fLiteFeature.getID());
// System.out.println("Add Fidfilter " + fid);
fc = fs.getFeatures(fidf);
if (fc.isEmpty()) return null; NULL POINTER
HERE!!
Feature f = null;
Iterator iFeature = fc.iterator();
while (iFeature.hasNext()){
f = (Feature) iFeature.next();
}
return f;
}
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
return null;
}
I have the following ouptput :
java.lang.NullPointerException
at org.geotools.filter.SQLEncoder.visit(SQLEncoder.java:473)
at org.geotools.filter.FidFilterImpl.accept(FidFilterImpl.java:199)
at org.geotools.filter.SQLEncoder.encode(SQLEncoder.java:205)
at org.geotools.filter.SQLEncoder.encode(SQLEncoder.java:229)
at
org.geotools.data.postgis.PostgisSQLBuilder.sqlWhere(PostgisSQLBuilder.java:156)
at
org.geotools.data.jdbc.DefaultSQLBuilder.buildSQLQuery(DefaultSQLBuilder.java:222)
at
org.geotools.data.jdbc.JDBC1DataStore.constructQuery(JDBC1DataStore.java:748)
at
org.geotools.data.jdbc.JDBC1DataStore.getFeatureReader(JDBC1DataStore.java:667)
at
org.geotools.data.jdbc.JDBCFeatureCollection.reader(JDBCFeatureCollection.java:78)
at
org.geotools.data.store.DataFeatureCollection.isEmpty(DataFeatureCollection.java:293)
at
net.ingencys.udig.utils.UtilsForMaps.getFeatureGIDForLayer(UtilsForMaps.java:905)
at
net.ingencys.udig.utils.actions.ZeInterceptorAction.run(ZeInterceptorAction.java:30)
at org.eclipse.ui.internal.PluginAction.runWithEvent(PluginAction.java:254)
at
org.eclipse.ui.internal.WWinPluginAction.runWithEvent(WWinPluginAction.java:229)
at
org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)
at
org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)
at
org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:441)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1914)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1878)
at
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:419)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at
net.refractions.udig.internal.ui.UDIGApplication.run(UDIGApplication.java:38)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336)
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Does anyone can help me please?
Thanks,
Sebastien
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel