Claus Ibsen created CAMEL-27660:
-----------------------------------
Summary: camel-dns: lookup NPE with only CamelDnsClass, dead
DnsConfiguration, metadata and doc nits
Key: CAMEL-27660
URL: https://issues.apache.org/jira/browse/CAMEL-27660
Project: Camel
Issue Type: Bug
Components: camel-dns
Reporter: Claus Ibsen
Fix For: 4.24.0
Found while improving the option descriptions of camel-dns for CAMEL-23832 (PR
(commit
https://github.com/apache/camel/commit/b3e36ecda9db0696ed6545278689355abd4f44e6)).
These are separate problems of the component; the descriptions commit only
documents the current behavior.
h4. 1. lookup fails with a NullPointerException when only CamelDnsClass is set
{{DnsLookupProducer.process()}} keeps the type and class as {{Integer}}. When
the {{CamelDnsClass}} header is set and the {{CamelDnsType}} header is not, it
calls {{new Lookup(dnsName, dnsType, dnsClass)}}, the {{(String, int, int)}}
constructor, with a null {{dnsType}}. The unboxing throws a
{{NullPointerException}}, so the exchange fails instead of querying the A
record of that class.
{code:java}
Lookup lookup = (dnsClass == null)
? (dnsType == null ? new Lookup(dnsName) : new Lookup(dnsName, dnsType))
: new Lookup(dnsName, dnsType, dnsClass);
{code}
Proposed change: default the type to {{Type.A}} when the header is missing, as
{{DnsDigProducer.createQuery()}} does.
h4. 2. DnsConfiguration is dead code
{{DnsConfiguration}} is a {{@UriParams}} class with the options {{proto}} and
{{domain}}, but {{DnsEndpoint}} does not use it, so these options are not part
of the endpoint and are not in the catalog.
Proposed change: remove the class.
h4. 3. CamelDnsTerm header has no javaType
The {{@Metadata}} of {{DnsConstants.TERM}} has no {{javaType}}, so the header
has an empty {{javaType}} in {{dns.json}}, while the other headers are
{{String}}. The header is deprecated, together with the wikipedia type.
Proposed change: add {{javaType = "String"}}.
h4. 4. Outdated notes on the doc page
{{dns-component.adoc}} says "Requires SUN JVM" (the DNSJava library requires
running on the SUN JVM), which does not apply to dnsjava 3.x, and links to
{{http://www.xbill.org/dnsjava/}}, while dnsjava now lives at
https://github.com/dnsjava/dnsjava.
Proposed change: remove the note and update the link.
_Claude Code on behalf of davsclaus_
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)