[ 
https://issues.apache.org/jira/browse/DIRSERVER-1707?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Emmanuel Lecharny resolved DIRSERVER-1707.
------------------------------------------

    Resolution: Fixed

Sorry for being one year late on this issue...

LeafNode constructor now throws a NPE if the attribute is null. It should help 
to detect where the problem comes from. (see http://svn.apache.org/r1480268)
                
> LeafNode with null attribute exception thrown too late
> ------------------------------------------------------
>
>                 Key: DIRSERVER-1707
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1707
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>          Components: ldap
>    Affects Versions: 1.5.7
>            Reporter: David Portabella
>            Priority: Minor
>
> Hello,
> I get the following exception from my ApacheDS server log when the Weblogic 
> LDAP authenticator client makes a query.
> [14:05:13] DEBUG 
> [org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler] - 
> OTHER: failed for     SearchRequest
>         baseDn : 'DC=example,DC=com'
>         filter : 
> '(|(&(&(sAMAccountName=weblogic)(2.5.4.0=user))(!(userAccountControl-false-EXTENSIBLE-1.2.840.113556.1.4.803-'0x32
>  ')))(objectClass=referral))'
>         scope : whole subtree
>         typesOnly : false
>         Size Limit : 1000
>         Time Limit : no limit
>         Deref Aliases : never Deref Aliases
>         attributes : '1.1'
> : org.apache.directory.shared.ldap.exception.LdapException: ERR_04274 Cant 
> find an OID for the name {0}
> java.lang.RuntimeException: 
> org.apache.directory.shared.ldap.exception.LdapException: ERR_04274 Cant find 
> an OID for the name {0}
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visit(FilterNormalizingVisitor.java:476)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visitBranchNode(FilterNormalizingVisitor.java:339)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visit(FilterNormalizingVisitor.java:449)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visitBranchNode(FilterNormalizingVisitor.java:376)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visit(FilterNormalizingVisitor.java:449)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visitBranchNode(FilterNormalizingVisitor.java:376)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visit(FilterNormalizingVisitor.java:449)
>       at 
> org.apache.directory.shared.ldap.filter.BranchNode.accept(BranchNode.java:220)
>       at 
> org.apache.directory.server.core.normalization.NormalizationInterceptor.search(NormalizationInterceptor.java:195)
>       at 
> org.apache.directory.server.core.interceptor.InterceptorChain.search(InterceptorChain.java:868)
>       at 
> org.apache.directory.server.core.DefaultOperationManager.search(DefaultOperationManager.java:1072)
>       at 
> org.apache.directory.server.core.DefaultCoreSession.search(DefaultCoreSession.java:918)
>       at 
> org.apache.directory.server.ldap.handlers.SearchHandler.doSimpleSearch(SearchHandler.java:726)
>       at 
> org.apache.directory.server.ldap.handlers.SearchHandler.handleIgnoringReferrals(SearchHandler.java:978)
>       at 
> org.apache.directory.server.ldap.handlers.SearchHandler.handleWithReferrals(SearchHandler.java:1054)
>       at 
> org.apache.directory.server.ldap.handlers.SearchHandler.handleWithReferrals(SearchHandler.java:78)
>       at 
> org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handle(ReferralAwareRequestHandler.java:94)
>       at 
> org.apache.directory.server.ldap.handlers.ReferralAwareRequestHandler.handle(ReferralAwareRequestHandler.java:57)
>       at 
> org.apache.directory.server.ldap.handlers.LdapRequestHandler.handleMessage(LdapRequestHandler.java:208)
>       at 
> org.apache.directory.server.ldap.handlers.LdapRequestHandler.handleMessage(LdapRequestHandler.java:58)
>       at 
> org.apache.mina.handler.demux.DemuxingIoHandler.messageReceived(DemuxingIoHandler.java:232)
>       at 
> org.apache.directory.server.ldap.LdapProtocolHandler.messageReceived(LdapProtocolHandler.java:193)
>       at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:713)
>       at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:434)
>       at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:46)
>       at 
> org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:793)
>       at 
> org.apache.mina.core.filterchain.IoFilterEvent.fire(IoFilterEvent.java:71)
>       at org.apache.mina.core.session.IoEvent.run(IoEvent.java:63)
>       at 
> org.apache.mina.filter.executor.UnorderedThreadPoolExecutor$Worker.runTask(UnorderedThreadPoolExecutor.java:480)
>       at 
> org.apache.mina.filter.executor.UnorderedThreadPoolExecutor$Worker.run(UnorderedThreadPoolExecutor.java:434)
>       at java.lang.Thread.run(Thread.java:680)
> Caused by: org.apache.directory.shared.ldap.exception.LdapException: 
> ERR_04274 Cant find an OID for the name {0}
>       at 
> org.apache.directory.shared.ldap.schema.registries.DefaultSchemaObjectRegistry.getOidByName(DefaultSchemaObjectRegistry.java:343)
>       at 
> org.apache.directory.shared.ldap.schema.registries.ImmutableAttributeTypeRegistry.getOidByName(ImmutableAttributeTypeRegistry.java:209)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visitExtensibleNode(FilterNormalizingVisitor.java:313)
>       at 
> org.apache.directory.server.core.normalization.FilterNormalizingVisitor.visit(FilterNormalizingVisitor.java:463)
>       ... 30 more
> [14:05:13] DEBUG [org.apache.directory.shared.ldap.codec.LdapTransformer] - 
> Transforming message type SEARCH_RESULT_DONE
> [14:05:13] DEBUG [org.apache.directory.shared.ldap.codec.LdapTransformer] - 
> Transformed message :     Search Result Done
> ---
> I guess that the "{0}" text does not get substituted, because the value is 
> null. that is:
> System.out.println(java.text.MessageFormat.format("ERR_04274 Cant find an OID 
> for the name {0}", (String) null));    // ERR_04274 Cant find an OID for the 
> name null
> System.out.println(java.text.MessageFormat.format("ERR_04274 Cant find an OID 
> for the name {0}", (String[]) null));  // ERR_04274 Cant find an OID for the 
> name {0}
> ./org/apache/directory/shared/ldap/schema/registries/DefaultSchemaObjectRegistry.java
>     public String getOidByName( String name ) throws LdapException
>     {
>         T schemaObject = byName.get( name );
>             // ok this name is not for a schema object in the registry
>             if ( schemaObject == null )
>             {
> 343:                throw new LdapException( I18n.err( I18n.ERR_04274, name ) 
> );
> and the values is 
> ./i18n/src/main/java/org/apache/directory/server/i18n/I18n.java
>     public static String err( String err, Object... args ) {
> 789:            return err + " " + MessageFormat.format( errBundle.getString( 
> err ), args );
>       }
> the "name" comes from:
> ./core/src/main/java/org/apache/directory/server/core/normalization/FilterNormalizingVisitor.java
>     private ExprNode visitExtensibleNode( ExtensibleNode node ) throws 
> LdapException {
> 313:        node.setAttribute( 
> schemaManager.getAttributeTypeRegistry().getOidByName( node.getAttribute() ) 
> );
>         return node;
>     }
> which means that at some point a LeafNode with a null attribute is created.
> ./org/apache/directory/shared/ldap/filter/LeafNode.java
> public class LeafNode extends AbstractExprNode
> {
>     /** attribute on which this leaf is based */
>     private String attribute;
> ...
> }
> (unfortunately i cannot reproduce the problem with a simple unit case,
> i have a configuration problem, either at ApacheDS or at Weblogic, i am still 
> finding out)
> I guess that LeafNode with a null attribute should not be allowed. is that 
> correct?
> should a null test be added here? or even before?
> the problem with the current code is that the exception is thrown to late to 
> understand the source of the problem.
> I guess some more test or log should be added, instead of receiving the poor 
> message "ERR_04274 Cant find an OID for the name {0}".

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to