changed fixedsuspect expiry
This commit is contained in:
parent
373dc7ce36
commit
2a8ceff2d9
1 changed files with 109 additions and 98 deletions
|
@ -101,6 +101,15 @@ public class SuspectManager extends Thread
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
File suspectFile = new File( "suspects/suspects_" + country + ".txt" );
|
||||||
|
if ( suspectFile.exists() )
|
||||||
|
{
|
||||||
|
bw.write( "suspect file for country '" + country + "' not found\n" );
|
||||||
|
bw.write( "</body></html>\n" );
|
||||||
|
bw.flush();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
boolean showWatchList = false;
|
boolean showWatchList = false;
|
||||||
if ( tk.hasMoreTokens() )
|
if ( tk.hasMoreTokens() )
|
||||||
{
|
{
|
||||||
|
@ -117,12 +126,9 @@ public class SuspectManager extends Thread
|
||||||
|
|
||||||
if ( showWatchList )
|
if ( showWatchList )
|
||||||
{
|
{
|
||||||
File suspects = new File( "suspects/suspects_" + country + ".txt" );
|
|
||||||
bw.write( "watchlist for " + country + "\n" );
|
bw.write( "watchlist for " + country + "\n" );
|
||||||
bw.write( "<br><a href=\"/brouter/suspects\">back to country list</a><br><br>\n" );
|
bw.write( "<br><a href=\"/brouter/suspects\">back to country list</a><br><br>\n" );
|
||||||
if ( suspects.exists() )
|
BufferedReader r = new BufferedReader( new FileReader( suspectFile ) );
|
||||||
{
|
|
||||||
BufferedReader r = new BufferedReader( new FileReader( suspects ) );
|
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
String line = r.readLine();
|
String line = r.readLine();
|
||||||
|
@ -136,9 +142,8 @@ public class SuspectManager extends Thread
|
||||||
{
|
{
|
||||||
continue; // known false positive
|
continue; // known false positive
|
||||||
}
|
}
|
||||||
File fixedEntry = new File( "fixedsuspects/" + id );
|
|
||||||
File confirmedEntry = new File( "confirmednegatives/" + id );
|
File confirmedEntry = new File( "confirmednegatives/" + id );
|
||||||
if ( !( fixedEntry.exists() && confirmedEntry.exists() ) )
|
if ( !( isFixed( id, suspectFile ) && confirmedEntry.exists() ) )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -156,7 +161,6 @@ public class SuspectManager extends Thread
|
||||||
bw.write( "<a href=\"" + url2 + "\">" + dlon + "," + dlat + "</a>" + hint + "<br>\n" );
|
bw.write( "<a href=\"" + url2 + "\">" + dlon + "," + dlat + "</a>" + hint + "<br>\n" );
|
||||||
}
|
}
|
||||||
r.close();
|
r.close();
|
||||||
}
|
|
||||||
bw.write( "</body></html>\n" );
|
bw.write( "</body></html>\n" );
|
||||||
bw.flush();
|
bw.flush();
|
||||||
return;
|
return;
|
||||||
|
@ -194,15 +198,20 @@ public class SuspectManager extends Thread
|
||||||
if ( "fixed".equals( command ) )
|
if ( "fixed".equals( command ) )
|
||||||
{
|
{
|
||||||
File fixedMarker = new File( "fixedsuspects/" + id );
|
File fixedMarker = new File( "fixedsuspects/" + id );
|
||||||
|
if ( !fixedMarker.exists() )
|
||||||
|
{
|
||||||
fixedMarker.createNewFile();
|
fixedMarker.createNewFile();
|
||||||
|
}
|
||||||
id = 0L;
|
id = 0L;
|
||||||
|
|
||||||
|
int hideDays = 0;
|
||||||
if ( tk.hasMoreTokens() )
|
if ( tk.hasMoreTokens() )
|
||||||
{
|
{
|
||||||
String param = tk.nextToken();
|
String param = tk.nextToken();
|
||||||
int hideDays = Integer.parseInt( param );
|
hideDays = Integer.parseInt( param );
|
||||||
fixedMarker.setLastModified( System.currentTimeMillis() + hideDays*86400000L );
|
fixedMarker.setLastModified( System.currentTimeMillis() + hideDays*86400000L );
|
||||||
}
|
}
|
||||||
|
fixedMarker.setLastModified( System.currentTimeMillis() + hideDays*86400000L );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( id != 0L )
|
if ( id != 0L )
|
||||||
|
@ -252,8 +261,7 @@ public class SuspectManager extends Thread
|
||||||
bw.write( "<a href=\"" + url4 + "\">Open in Overpass / minus one week</a><br><br>\n" );
|
bw.write( "<a href=\"" + url4 + "\">Open in Overpass / minus one week</a><br><br>\n" );
|
||||||
bw.write( "<a href=\"" + url5 + "\">Open in Who-Did-It / last week</a><br><br>\n" );
|
bw.write( "<a href=\"" + url5 + "\">Open in Who-Did-It / last week</a><br><br>\n" );
|
||||||
bw.write( "<br>\n" );
|
bw.write( "<br>\n" );
|
||||||
File fixedEntry = new File( "fixedsuspects/" + id );
|
if ( isFixed( id, suspectFile ) )
|
||||||
if ( fixedEntry.exists() )
|
|
||||||
{
|
{
|
||||||
bw.write( "<br><br><a href=\"/brouter/suspects/" + country + "/" + filter + "/watchlist\">back to watchlist</a><br><br>\n" );
|
bw.write( "<br><br><a href=\"/brouter/suspects/" + country + "/" + filter + "/watchlist\">back to watchlist</a><br><br>\n" );
|
||||||
}
|
}
|
||||||
|
@ -281,12 +289,9 @@ public class SuspectManager extends Thread
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
File suspects = new File( "suspects/suspects_" + country + ".txt" );
|
|
||||||
bw.write( filter + " suspect list for " + country + "\n" );
|
bw.write( filter + " suspect list for " + country + "\n" );
|
||||||
bw.write( "<br><a href=\"/brouter/suspects/" + country + "/" + filter + "/watchlist\">see watchlist</a>\n" );
|
bw.write( "<br><a href=\"/brouter/suspects/" + country + "/" + filter + "/watchlist\">see watchlist</a>\n" );
|
||||||
bw.write( "<br><a href=\"/brouter/suspects\">back to country list</a><br><br>\n" );
|
bw.write( "<br><a href=\"/brouter/suspects\">back to country list</a><br><br>\n" );
|
||||||
if ( suspects.exists() )
|
|
||||||
{
|
|
||||||
int maxprio = 0;
|
int maxprio = 0;
|
||||||
for ( int pass = 1; pass <= 2; pass++ )
|
for ( int pass = 1; pass <= 2; pass++ )
|
||||||
{
|
{
|
||||||
|
@ -295,7 +300,7 @@ public class SuspectManager extends Thread
|
||||||
bw.write( "current level: " + getLevelDecsription( maxprio ) + "<br><br>\n" );
|
bw.write( "current level: " + getLevelDecsription( maxprio ) + "<br><br>\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
BufferedReader r = new BufferedReader( new FileReader( suspects ) );
|
BufferedReader r = new BufferedReader( new FileReader( suspectFile ) );
|
||||||
for ( ;; )
|
for ( ;; )
|
||||||
{
|
{
|
||||||
String line = r.readLine();
|
String line = r.readLine();
|
||||||
|
@ -314,7 +319,7 @@ public class SuspectManager extends Thread
|
||||||
{
|
{
|
||||||
continue; // known false positive
|
continue; // known false positive
|
||||||
}
|
}
|
||||||
if ( new File( "fixedsuspects/" + id ).exists() )
|
if ( isFixed( id, suspectFile ) )
|
||||||
{
|
{
|
||||||
continue; // known fixed
|
continue; // known fixed
|
||||||
}
|
}
|
||||||
|
@ -348,10 +353,16 @@ public class SuspectManager extends Thread
|
||||||
r.close();
|
r.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
bw.write( "</body></html>\n" );
|
bw.write( "</body></html>\n" );
|
||||||
bw.flush();
|
bw.flush();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isFixed( long id, File suspectFile )
|
||||||
|
{
|
||||||
|
File fixedEntry = new File( "fixedsuspects/" + id );
|
||||||
|
return fixedEntry.exists() && fixedEntry.lastModified() > suspectFile.lastModified();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue