changed error message for missing datafile to include filename

This commit is contained in:
Arndt 2015-02-08 10:05:50 +01:00
parent 5f34b5cf41
commit 0fe5d5144a
3 changed files with 18 additions and 2 deletions

View file

@ -298,9 +298,13 @@ public class RoutingEngine extends Thread
return mwp; return mwp;
} }
} }
if ( minRingWith == 1 && nodesCache.first_file_access_failed )
{
throw new IllegalArgumentException( "datafile " + nodesCache.first_file_access_name + " not found" );
}
if ( minRingWith++ == 5 ) if ( minRingWith++ == 5 )
{ {
throw new IllegalArgumentException( wp.name + "-position not mapped" ); throw new IllegalArgumentException( wp.name + "-position not mapped in existing datafile" );
} }
} }
} }

View file

@ -33,6 +33,8 @@ public final class NodesCache
public DistanceChecker distanceChecker; public DistanceChecker distanceChecker;
public boolean oom_carsubset_hint = false; public boolean oom_carsubset_hint = false;
public boolean first_file_access_failed = false;
public String first_file_access_name;
private long cacheSum = 0; private long cacheSum = 0;
private boolean garbageCollectionEnabled = false; private boolean garbageCollectionEnabled = false;
@ -48,6 +50,9 @@ public final class NodesCache
this.carMode = carMode; this.carMode = carMode;
this.forceSecondaryData = forceSecondaryData; this.forceSecondaryData = forceSecondaryData;
first_file_access_failed = false;
first_file_access_name = null;
if ( !this.segmentDir.isDirectory() ) throw new RuntimeException( "segment directory " + segmentDir + " does not exist" ); if ( !this.segmentDir.isDirectory() ) throw new RuntimeException( "segment directory " + segmentDir + " does not exist" );
if ( oldCache != null ) if ( oldCache != null )
@ -249,6 +254,13 @@ public final class NodesCache
OsmFile osmf = new OsmFile( ra, tileIndex, iobuffer ); OsmFile osmf = new OsmFile( ra, tileIndex, iobuffer );
osmf.lonDegree = lonDegree; osmf.lonDegree = lonDegree;
osmf.latDegree = latDegree; osmf.latDegree = latDegree;
if ( first_file_access_name == null )
{
first_file_access_name = currentFileName;
first_file_access_failed = osmf.filename == null;
}
return osmf; return osmf;
} }

View file

@ -39,7 +39,7 @@ public class RouterTest
msg = calcRoute( 8.720897, 50.002515, 16.723658, 49.997510, "notrack" ); msg = calcRoute( 8.720897, 50.002515, 16.723658, 49.997510, "notrack" );
Assert.assertTrue( msg, msg != null && msg.indexOf( "not mapped" ) >= 0 ); Assert.assertTrue( msg, msg != null && msg.indexOf( "not found" ) >= 0 );
} }
private String calcRoute( double flon, double flat, double tlon, double tlat, String trackname ) throws Exception private String calcRoute( double flon, double flat, double tlon, double tlat, String trackname ) throws Exception