Details
-
Bug
-
Status: Done
-
Major
-
Resolution: Done
-
0.4.1
-
None
-
openSUSE Tumbleweed 20171102, OpenJDK 1.8.0_144
Description
If I run "mvn package" in the root Metron directory then compilation fails because of a null reference in ./metron-platform/metron-common/src/test/java/org/apache/metron/common/error/MetronErrorTest.java. This happens in getJSONObjectShouldReturnBasicInformation on line 56 because errorJSON.get(Constants.ErrorFields.HOSTNAME.getName()) is assumed to return a string and the length() method is called on it. Because the assert doesn't use a message then no obvious reason why it fails is logged.
The underlying problem is that metron-platform/metron-common/src/main/java/org/apache/metron/common/error/MetronError.java falls through to a catch block in addHostname() when netAddress.getLocalHost().getHostName() exceptions with Name or service not known for the host name.
Setting a hostname that resolves is a build requirement that is out of Metron's control, but if the code specifically handles the fact that it won't always be retrieved then it seems problematic to have tests that assume it works and not make it clear what the failure is when it occurs.
Attachments
Issue Links
- links to