Permalink
Browse files

correct fromDate init value on missing param in api/timeline_p servlet

revert test modification from last commit in AccessTracker.main
  • Loading branch information...
reger24 committed Feb 19, 2017
1 parent cc77051 commit 334c70c37af7965d230d8f3c52b50b3060a9774f
Showing with 10 additions and 10 deletions.
  1. +3 −3 htroot/api/timeline_p.java
  2. +7 −7 source/net/yacy/search/query/AccessTracker.java
@@ -75,9 +75,9 @@ public static serverObjects respond(@SuppressWarnings("unused") final RequestHea
// get a time period
Date fromDate = new Date(0);
Date toDate = new Date();
try {fromDate = GenericFormatter.SHORT_SECOND_FORMATTER.parse(post.get("from", "20031215182700"), 0).getTime();} catch (ParseException e) {}
try {toDate = GenericFormatter.SHORT_SECOND_FORMATTER.parse(post.get("to", GenericFormatter.SHORT_SECOND_FORMATTER.format(new Date())), 0).getTime();} catch (ParseException e) {}
try {fromDate = GenericFormatter.SHORT_SECOND_FORMATTER.parse(post.get("from", GenericFormatter.SHORT_SECOND_FORMATTER.format(fromDate)), 0).getTime();} catch (ParseException e) {}
try {toDate = GenericFormatter.SHORT_SECOND_FORMATTER.parse(post.get("to", GenericFormatter.SHORT_SECOND_FORMATTER.format(toDate)), 0).getTime();} catch (ParseException e) {}
// get latest dump;
AccessTracker.dumpLog();
@@ -342,15 +342,15 @@ private static Date readDate(RandomAccessFile raf, long x) throws IOException {
public static void main(String[] args) {
// i.e. /Users/admin/git/rc1/DATA/LOG/queries.log 20140522135156 20140614223118
String file = "C:\\src\\github\\yacy_search_server\\DATA\\LOG\\queries.log";
String file = args[0];
Date from;
// try {
from = new Date(0);//GenericFormatter.SHORT_SECOND_FORMATTER.parse(args[1], 0).getTime();
Date to = new Date();//GenericFormatter.SHORT_SECOND_FORMATTER.parse(args[2], 0).getTime();
try {
from = GenericFormatter.SHORT_SECOND_FORMATTER.parse(args[1], 0).getTime();
Date to = GenericFormatter.SHORT_SECOND_FORMATTER.parse(args[2], 0).getTime();
List<EventTracker.Event> dump = readLog(new File(file), from, to);
for (EventTracker.Event s: dump) System.out.println(s.toString());
// } catch (ParseException e) {
// e.printStackTrace();
// }
} catch (ParseException e) {
e.printStackTrace();
}
}
}

0 comments on commit 334c70c

Please sign in to comment.