Shame on me.
Please excuse me. I'm stupid, i say "exactly the same method" , but
not really...
My own error is here :
...
fi = fc.features();
...
fi = fc.features();
...
Two call fc.feature() so two iterator opening !!
As always the problem, it is what there is between the chair and the
keyboard
Thanks for your help.
Linares a écrit :
> Thanks Jody,
> I try it without the isEmpty() test but i keep the warning. now i try
> to use a debugger (the eclipse one). I have never use it before so
> this not very helpful for me. I send you the execution stacks. this is
> the same code but here the static method retrive is now in the class
> DaoParcelle2.
>
> I have found a very strange things. I have exactly the same method for
> an other table ( haies_line) and this one doesn't send me this
> warning. Maybe this one come from my PosGis dataBase ??
>
> good weekend every-body.
>
> Unité d'exécution [main] (Suspendue (exception
> ConcurrentModificationException)) détient : DaoParcelle2
> (id=25) $Proxy0.close() ligne : non disponible [variables locales
> non disponibles] ----> I not found the code of this class in the
> Geotools source
> JDBCUtils.close(Connection, Transaction, SQLException) ligne :
> 149 QueryData.close(SQLException) ligne : 178
> JDBCFeatureReader.close(SQLException) ligne : 66
> JDBCFeatureReader.close() ligne : 62
> FeatureReaderIterator.close() ligne : 87
> JDBCFeatureCollection(DataFeatureCollection).closeIterator(Iterator)
> ligne : 263
> JDBCFeatureCollection(DataFeatureCollection).close(Iterator) ligne :
> 248 DelegateFeatureIterator.close() ligne : 58
> JDBCFeatureCollection(DataFeatureCollection).close(FeatureIterator)
> ligne : 272 DaoParcelle2.retrive(int) ligne : 1082
> -----> here is the call of FeatureClose(FeatureIterator); in my
> finnaly bloc. (I have remove the other call)
> Test.main(String[]) ligne : 54
>
> Jody Garnett a écrit :
>> Looks like a mistake on our side of the fence ... possibly in the
>> isEmpty() (it should do the same thing you do at the bottom with
>> checking the iterator.hasNext()... perhaps it did not clean up?
>>
>> The next step would be to run through it with a debugger.
>>
>> Jody
>> Linares wrote:
>>> Hi gt2 user. It's my first post !
>>>
>>> I've a strange warning from QueryData when i make two or much simple
>>> request.
>>> please look at simple code bellow:
>>>
>>> 12 avr. 2007 16:11:46 org.geotools.data.jdbc.QueryData finalize
>>> GRAVE: There's code leaving readers, writers or iterators unclosed
>>> (you got an unclosed QueryData object, which is usually held by a
>>> reader or a writer).
>>> Call reader/writer.close() or FeatureCollection.close(iterator)
>>> after using them to ensure they do not hold state such as JDCB
>>> connections.
>>> QueryData was open against feature type: parcelles_polygon
>>>
>>> It's important ? how to stop this ? I think i close my iterator so
>>> what is the problem ?
>>> Thanks.
>>> Please excuse my English I'm a French student.
>>>
>>>
>>> public class Test {
>>> public static Feature retrive(int id) {
>>>
>>> FeatureIterator fi = null;
>>> FeatureCollection fc = null;
>>> try {
>>> PostgisDataStoreFactory pdsf = new
>>> PostgisDataStoreFactory();
>>> PostgisDataStore dataStore = (PostgisDataStore) pdsf
>>> .createDataStore(conect.getParamAsMap());
>>>
>>> FeatureSource fs =
>>> dataStore.getFeatureSource("parcelles_polygon");
>>>
>>> // Create the id filter
>>> FilterFactory2 ff = (FilterFactory2) CommonFactoryFinder
>>> .getFilterFactory(null);
>>> Filter selectFid =
>>> ff.id(Collections.singleton(ff.featureId("parcelles_polygon"
>>> + "." + id)));
>>>
>>> // get the filtered collection
>>> fc = fs.getFeatures(selectFid);
>>> fi = fc.features();
>>>
>>> //test if the feature exist
>>> if ((fc == null)) {
>>> return null;
>>> } else {
>>> if (fc.isEmpty()) {
>>> return null;
>>> }
>>> }
>>> fi = fc.features(); return fi.next();
>>>
>>> } catch (IOException e) {
>>> LOGGER.warning("DataBase not found: " +
>>> e.getLocalizedMessage()
>>> + " exit");
>>> System.exit(1);
>>> } finally {
>>> if (fi != null)
>>> fi.close();
>>> if (fc != null) {
>>> fc.close(fi);
>>> }
>>> }
>>> return null;
>>> }
>>> public static void main(String[] args) {
>>> System.out.println(retrive(123));
>>> System.out.println(retrive(12));
>>> } //my connection manager classe
>>> ConnectionDB conect = new ConnectionDB("192.168.1.30", "camgis",
>>> "5432", "admin", "fluxo"); private static final
>>> Logger LOGGER = Logger
>>> .getLogger(Test.class.toString());
>>> }
>>>
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>>
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>> share your
>>> opinions on IT & business topics through brief surveys-and earn cash
>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
>>>
>>> _______________________________________________
>>> Geotools-gt2-users mailing list
>>> [EMAIL PROTECTED]
>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
>>>
>>
>>
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users