Hi,
here's a small and humble patch to ensure the query is closed in ArcSDEMetadataAdapter.
I'd be also cool if the println calls can be avoided in favor of logging?
### Eclipse Workspace Patch 1.0
#P geonetwork-main
Index: src/main/java/org/fao/geonet/arcgis/ArcSDEMetadataAdapter.java
--- src/main/java/org/fao/geonet/arcgis/ArcSDEMetadataAdapter.java (revision 6252)
+++ src/main/java/org/fao/geonet/arcgis/ArcSDEMetadataAdapter.java (working copy)
@@ -63,12 +63,9 @@
query.prepareQuery(propertyNames, sqlConstruct);
query.execute();
- // it is not documented in the ArcSDE API how you know there are no more rows to fetch!
- // I'm assuming: query.fetch returns null (empiric tests indicate this assumption is correct).
- boolean allRowsFetched = false;
- while(! allRowsFetched) {
- SeRow row = query.fetch();
- if(row != null) {
+ try{
+ SeRow row;
+ while((row = query.fetch()) != null) {
ByteArrayInputStream bytes = row.getBlob(0);
byte buff = new byte[bytes.available()];
bytes.read(buff);
@@ -77,12 +74,10 @@
System.out.println("ISO metadata found");
results.add(document);
}
- }
- else {
- allRowsFetched = true;
- }
- }
- query.close();
+ }
+ }finally{
+ query.close();
+ }
System.out.println("cool");
return results;
}
--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.