Skip to content

Commit

Permalink
Merge pull request #1299 from lat-lon/fixShpTableAlreadyExists-8187-1297
Browse files Browse the repository at this point in the history
Fixed Error "Table "DBF_INDEX" already exists"
  • Loading branch information
stephanr authored Mar 30, 2022
2 parents ed1ce3a + c5c4ddb commit 5f327e0
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ Occam Labs UG (haftungsbeschränkt)

/**
* Copies the dbf contents into the h2 db.
*
*
* @author <a href="mailto:schmitz@occamlabs.de">Andreas Schmitz</a>
* @author last edited by: $Author: stranger $
*
*
* @version $Revision: $, $Date: $
*/
class DbfIndexImporter {
Expand All @@ -86,7 +86,7 @@ class DbfIndexImporter {

private Pair<ArrayList<Pair<float[], Long>>, Boolean> envelopes;

private ArrayList<String> fields = new ArrayList<String>();
private ArrayList<String> fields = new ArrayList<>();

private List<Mapping> mappings;

Expand All @@ -111,7 +111,7 @@ private void createTable( StringBuilder sb ) {
private Map<String, Mapping> createMappingMap( List<Mapping> mappings ) {
Map<String, Mapping> fieldMap = null;
if ( mappings != null ) {
fieldMap = new HashMap<String, Mapping>();
fieldMap = new HashMap<>();
for ( Mapping m : mappings ) {
if ( m.propname != null ) {
fieldMap.put( m.propname, m );
Expand Down Expand Up @@ -159,8 +159,7 @@ private void appendFields( StringBuilder create ) {
create.append( ")" );
}

private String createInsertStatement( Map<SimplePropertyType, Property> entry )
throws IOException {
private String createInsertStatement( Map<SimplePropertyType, Property> entry ) {
StringBuilder sb = new StringBuilder();
StringBuilder qms = new StringBuilder();
sb.setLength( 0 );
Expand Down Expand Up @@ -304,7 +303,7 @@ ConnectionProvider createIndex()

connProvider = new LegacyConnectionProvider( "jdbc:h2:" + dbfile, "SA", "", false, null );

if ( new File( dbfile.toString() + ".h2.db" ).exists() ) {
if ( new File( dbfile.toString() + ".mv.db" ).exists() ) {
// TODO proper check for database consistency
return connProvider;
}
Expand Down

0 comments on commit 5f327e0

Please sign in to comment.