Minor com.sun.jndi.dns cleanup

Florian Weimer fweimer at redhat.com
Tue Feb 18 12:45:54 UTC 2014


On 02/17/2014 10:17 PM, Alan Bateman wrote:
> On 17/02/2014 20:01, Florian Weimer wrote:
>> In the DnsName case, the same exception is used for parsing
>> user-supplied strings and data from the wire, and strictly speaking,
>> InvalidNameException should be used only in the former case.
> Yes, I think the exceptions in DnsName should be re-examined too
> (doesn't have to be this patch of course). For RecordRecord then it
> would be good to see if there is a better NamingException, the closest
> seems to be CommunicationException with an appropriate cause but maybe
> there are more suitable choices.

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.

-- 
Florian Weimer / Red Hat Product Security Team



More information about the core-libs-dev mailing list