[ 
https://issues.apache.org/jira/browse/METRON-1728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16573607#comment-16573607
 ] 

ASF GitHub Bot commented on METRON-1728:
----------------------------------------

Github user justinleet commented on a diff in the pull request:

    https://github.com/apache/metron/pull/1151#discussion_r208679310
  
    --- Diff: 
metron-platform/metron-pcap/src/main/java/org/apache/metron/pcap/mr/PcapJob.java
 ---
    @@ -216,20 +218,22 @@ public void setCompleteCheckInterval(long interval) {
         Configuration hadoopConf = PcapOptions.HADOOP_CONF.get(configuration, 
Configuration.class);
         FileSystem fileSystem = PcapOptions.FILESYSTEM.get(configuration, 
FileSystem.class);
         Path basePath = PcapOptions.BASE_PATH.getTransformed(configuration, 
Path.class);
    -    Path baseInterimResultPath = 
PcapOptions.BASE_INTERIM_RESULT_PATH.getTransformed(configuration, Path.class);
    +    Path baseInterimResultPath = PcapOptions.BASE_INTERIM_RESULT_PATH
    +        .getTransformedOrDefault(configuration, Path.class,
    +            new Path(PcapGlobalDefaults.BASE_INTERIM_RESULT_PATH_DEFAULT));
         long startTime;
         if (configuration.containsKey(PcapOptions.START_TIME_NS.getKey())) {
    -      startTime = PcapOptions.START_TIME_NS.get(configuration, Long.class);
    +      startTime = PcapOptions.START_TIME_NS.getOrDefault(configuration, 
Long.class, 0L);
         } else {
    -      startTime = PcapOptions.START_TIME_MS.get(configuration, Long.class) 
* 1000000;
    +      startTime = PcapOptions.START_TIME_MS.getOrDefault(configuration, 
Long.class, 0L) * 1000000;
         }
         long endTime;
         if (configuration.containsKey(PcapOptions.END_TIME_NS.getKey())) {
    -      endTime = PcapOptions.END_TIME_NS.get(configuration, Long.class);
    +      endTime = PcapOptions.END_TIME_NS.getOrDefault(configuration, 
Long.class, System.nanoTime());
    --- End diff --
    
    Nanotime isn't actually current time in nanos or anything objectively 
meaningful (and can vary by jvm or be negative or whatever).  Check out 
https://docs.oracle.com/javase/7/docs/api/java/lang/System.html#nanoTime()
    
    Particularly,
    > This method can only be used to measure elapsed time and is not related 
to any other notion of system or wall-clock time. The value returned represents 
nanoseconds since some fixed but arbitrary origin time (perhaps in the future, 
so values may be negative). 
    
    I'd just make it System.currentTimeMillis() and adjust, since I don't think 
there's a clean way to get a real nanos timestamp in Java (at least until 9, 
maybe)


> Handle null values in config in Pcap backend more gracefully
> ------------------------------------------------------------
>
>                 Key: METRON-1728
>                 URL: https://issues.apache.org/jira/browse/METRON-1728
>             Project: Metron
>          Issue Type: Sub-task
>            Reporter: Michael Miklavcic
>            Assignee: Michael Miklavcic
>            Priority: Major
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to