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

revert test modification from last commit in AccessTracker.main
pull/110/head
reger 8 years ago
parent cc770512d5
commit 334c70c37a

@ -75,9 +75,9 @@ public final class timeline_p {
// 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 @@ public class AccessTracker {
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();
}
}
}

Loading…
Cancel
Save