directory-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <Carlo.Acco...@ibs-ag.com>
Subject Using ApacheDS api SearchCursor , getting Asn1Decoder warning to logs / console..
Date Fri, 07 Dec 2012 15:57:49 GMT
Hi,   We've starting moving some of our JNDI code to the ApacheDS API. The method below is
used to get an Array of entries.
When we close the cursor ( I think), we see the following log message.

[NioProcessor-4] WARN org.apache.directory.shared.asn1.ber.Asn1Decoder - ERR_00043_REMAINING_BYTES_FOR_DECODED_PDU
The PDU has been fully decoded but there are still bytes in the buffer.

We get the results we want but is there something else we need to do with the cursor to avoid
the message?  Thanks.


       protected Entry[] getEntries(SearchRequest req, long limit) throws LdapException{
              List<Entry> lstEntries = new ArrayList<Entry>();
                     req.setSizeLimit(limit);
                     SearchCursor cursor = connection.search(req);
                     try {
                           while(cursor.next()){
                                  Response response = cursor.get();
                                  Entry entry = ((SearchResultEntry)response).getEntry();
                                  lstEntries.add(entry);
                           }
                           SearchResultDone done = cursor.getSearchResultDone();
                           if(ResultCodeEnum.SUCCESS.equals(done.getLdapResult().getResultCode())){
                                  cursor.close();
                           }
                           else
                           {
                                  log.error(ERROR_LDAP_RESULT, done.getLdapResult().getResultCode().toString());
                           }
                     } catch (Exception e) {
                           e.printStackTrace();
                           try {
                                  cursor.close(e);
                           } catch (Exception e1) {
                                  e1.printStackTrace();
                           }
                     }
              return lstEntries.toArray(new Entry[lstEntries.size()]);
       }

We set the SearchRequest up like this.

SearchRequest req = new SearchRequestImpl();
              try {
                     req.setBase(new Dn(strDefaultDirRootSuffix));
                     req.setScope(SearchScope.SUBTREE);
                     req.setFilter(strSearch);

                     if (attrs != null && attrs.length > 0){
                           req.addAttributes(attrs);
                     } else {
                           req.addAttributes(DEFAULT_ATTRIBUTES);
                     }
              } catch (LdapInvalidDnException e1) {
                     e1.printStackTrace();
              } catch (LdapException e) {
                     e.printStackTrace();
              }


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message