Minor com.sun.jndi.dns cleanup

Alan Bateman Alan.Bateman at oracle.com
Wed Feb 19 12:05:01 UTC 2014

On 18/02/2014 12:45, Florian Weimer wrote:
> Thanks for the bug number and these suggestions.  The new version is 
> here: <http://fweimer.fedorapeople.org/openjdk/8035105/>
> I had to adjust the checked exceptions, so I wrapped the 
> InvalidNameException from DnsName in a CommunicationException as well.
> I eliminated the recursion and from the name parser and added yet 
> another check for invalid label types. (Other implementations treat 
> extended label types as errors as well, so there is no need to 
> implement them here.)
> Is this code actually used?  (I discovered it because I looked at 
> DatagramSocket users in the JDK.)  If it is, there are some other 
> fixes besides the ArrayIndexOutOfBoundsException handling that would 
> make sense.
Thanks for the update.

It's good to replace the recursion. Do you have the regular label case 
right? It looks like the type is being used by the length. Also is it 
necessary to catch InvalidNameException at line 363 as I don't think 
this is throw anymore.

One thing about communication exceptions is that the DNS client will 
retry. I think this is okay here but potentially it means that we fail 
with too many compression references a number of times.

As to whether the DNS provider is widely used then I don't have data on 
that. I think most of the JNDI usages are LDAP but probably a small 
market beyond that.


More information about the core-libs-dev mailing list