Fix address creator bug

This commit is contained in:
Victor Shcherb 2012-01-02 23:44:11 +01:00
parent 0b0aca1321
commit be7d47a9d6
2 changed files with 15 additions and 11 deletions

View file

@ -37,13 +37,15 @@ public class Boundary {
if (getOuterWays().size() > 0) { if (getOuterWays().size() > 0) {
// now we try to merge the ways until we have only one // now we try to merge the ways until we have only one
int oldSize = 0; int oldSize = 0;
while (getOuterWays().size() != oldSize) { while (getOuterWays().size() != oldSize && !getOuterWays().isEmpty()) {
oldSize = getOuterWays().size(); oldSize = getOuterWays().size();
mergeOuterWays(); mergeOuterWays();
} }
// there is one way and last element is equal to the first... if (!getOuterWays().isEmpty()) {
List<Node> nodes = getOuterWays().get(0).getNodes(); // there is one way and last element is equal to the first...
closedWay = getOuterWays().size() == 1 && nodes.get(0).getId() == nodes.get(nodes.size() - 1).getId(); List<Node> nodes = getOuterWays().get(0).getNodes();
closedWay = getOuterWays().size() == 1 && nodes.get(0).getId() == nodes.get(nodes.size() - 1).getId();
}
} else { } else {
closedWay = false; closedWay = false;
} }

View file

@ -465,17 +465,19 @@ public class IndexBatchCreator {
if (fh != null) { if (fh != null) {
LogManager.getLogManager().getLogger("").addHandler(fh); LogManager.getLogManager().getLogger("").addHandler(fh);
} }
try {
indexCreator.generateIndexes(f, new ConsoleProgressImplementation(3), null, mapZooms, types, warningsAboutMapData); indexCreator.generateIndexes(f, new ConsoleProgressImplementation(3), null, mapZooms, types, warningsAboutMapData);
} finally {
if (fh != null) {
LogManager.getLogManager().getLogger("").removeHandler(fh);
fh.close();
}
}
File generated = new File(workDir, mapFileName); File generated = new File(workDir, mapFileName);
generated.renameTo(new File(indexDirFiles, generated.getName())); generated.renameTo(new File(indexDirFiles, generated.getName()));
logFileName.renameTo(new File(indexDirFiles, logFileName.getName())); logFileName.renameTo(new File(indexDirFiles, logFileName.getName()));
if (fh != null) {
LogManager.getLogManager().getLogger("").removeHandler(fh);
fh.close();
}
} catch (Exception e) { } catch (Exception e) {
log.error("Exception generating indexes for " + f.getName(), e); //$NON-NLS-1$ log.error("Exception generating indexes for " + f.getName(), e); //$NON-NLS-1$
} }