[
https://issues.apache.org/jira/browse/METRON-1003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16086620#comment-16086620
]
ASF GitHub Bot commented on METRON-1003:
----------------------------------------
Github user bjigmp commented on a diff in the pull request:
https://github.com/apache/metron/pull/623#discussion_r127359171
--- Diff:
metron-platform/metron-parsers/src/main/java/org/apache/metron/parsers/utils/ParserUtils.java
---
@@ -55,7 +55,7 @@ public static Long convertToEpoch(String m, String d,
String ts,
Date date = new SimpleDateFormat("MMM", Locale.ENGLISH).parse(m);
Calendar cal = Calendar.getInstance();
cal.setTime(date);
- String month = String.valueOf(cal.get(Calendar.MONTH));
+ String month = String.valueOf(cal.get(Calendar.MONTH) + 1);
--- End diff --
Done.
> ParserUtil parses dates incorrect
> ---------------------------------
>
> Key: METRON-1003
> URL: https://issues.apache.org/jira/browse/METRON-1003
> Project: Metron
> Issue Type: Bug
> Reporter: Vladimir
> Priority: Minor
>
> ParserUtils class has method convertToEpoch that takes month, day and time
> (as strings), parses it and returns milliseconds since epoch.
> Month expected in "MMM" format (i.e. "Jun")
> Month is parsed and then it is tried to get int value as:
> {code}
> String month = String.valueOf(cal.get(Calendar.MONTH));
> {code}
> But according to documentation (see
> https://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#MONTH)
> months start from 0.
> So this method returns incorrect value.
> This method should be refactored, but would be great to fix it and write some
> tests before.
> This is minor bug as this method is used in FireEye parser only.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)