Menu

#46 ResolverConfig and System.getProperty

None
closed-rejected
nobody
None
3
2014-04-15
2014-04-12
mlsff
No

Hello,

First of all, thanks for this tool which have been supported for so many years now.

I came across a singularity in the ResolverConfig constructor.

Lines 53 & 54 aren't using the default argument of the getProperty method and we are using a very custom Linux/JVM which seems to have trouble with the os.name property. The resulting error is exposed below:

java.lang.NullPointerException: at org.xbill.DNS.ResolverConfig.<init>(ResolverConfig.java:55)
at org.xbill.DNS.ResolverConfig.refresh(ResolverConfig.java:330)
at org.xbill.DNS.ResolverConfig.<clinit>(ResolverConfig.java:27)
at org.xbill.DNS.ExtendedResolver.<init>(ExtendedResolver.java:258)
at dig.main(dig.java:179)

This is happening because the OS String is null when calling indexOf on line 55.

We circumvent the error by replacing the lines 53 & 54 on ResolverConfig by:

String OS = System.getProperty("os.name", "Linux");
String vendor = System.getProperty("java.vendor", "Oracle");

M.

Discussion

  • Brian Wellington

    It looks to me like os.name and os.vendor are required to be set. I can certainly understand having a broken JVM, but this default only works if the broken JVM is actually running on Linux, so I can't commit this change.

    Can't the JVM be fixed by adding configuration? If not, the system properties can be overridden.

     
  • Brian Wellington

    • status: open --> closed-rejected
    • Group: -->