if ( ref == null && ref.size() > 0 )
if ( ref == null || ref.size() > 0 )
        public SearchResponseIterator( SearchRequest req, NamingEnumeration underlying )        {            this.req = req;            this.underlying = underlying;            try            {                if ( underlying.hasMore() )                {                    SearchResult result = ( SearchResult ) underlying.next();                    /*                     * Now we have to build the prefetched object from the 'result'                     * local variable for the following call to next()                     */                    Attribute ref = result.getAttributes().get( "ref" );                    if ( ref == null && ref.size() > 0 )                    {                        SearchResponseEntry respEntry;                        respEntry = new SearchResponseEntryImpl( req.getMessageId() );                        respEntry.setAttributes( result.getAttributes() );                        respEntry.setObjectName( result.getName() );                        prefetched = respEntry;                    }                    else                    {                        SearchResponseReference respRef;                        respRef = new SearchResponseReferenceImpl( req.getMessageId() );                        respRef.setReferral( new ReferralImpl( respRef ) );                        for ( int ii = 0; ii < ref.size(); ii++ )                        {                            String url;                            try                            {                                url = ( String ) ref.get( ii );                                respRef.getReferral().addLdapUrl( url );                            }                            catch ( NamingException e )                            {                                try { underlying.close(); } catch( Throwable t ) {}                                prefetched = null;                                respDone = getResponse( req, e );                            }                        }                        prefetched = respRef;                    }                }            }            catch ( NamingException e )            {                try { this.underlying.close(); } catch( Exception e2 ) {}                respDone = getResponse( req, e );            }        }