You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/12/31 19:11:39 UTC
svn commit: r491461 - in /directory/trunks:
apacheds/core/src/main/java/org/apache/directory/server/core/authz/
apacheds/core/src/main/java/org/apache/directory/server/core/event/
apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ apach...
Author: elecharny
Date: Sun Dec 31 10:11:38 2006
New Revision: 491461
URL: http://svn.apache.org/viewvc?view=rev&rev=491461
Log:
Cleaned the code following FindBugs suggestions
Modified:
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultOptimizer.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultSearchEngine.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java
directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
directory/trunks/shared/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectStatesEnum.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownStatesEnum.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCall.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallStatesEnum.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlStatesEnum.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlStatesEnum.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlStatesEnum.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authz/TupleCache.java Sun Dec 31 10:11:38 2006
@@ -172,22 +172,24 @@
}
List entryTuples = new ArrayList();
+
for ( int ii = 0; ii < aci.size(); ii++ )
{
ACIItem item = null;
+ String aciStr = ( String ) aci.get( ii );
try
{
- item = aciParser.parse( ( String ) aci.get( ii ) );
+ item = aciParser.parse( aciStr );
+ entryTuples.addAll( item.toTuples() );
}
catch ( ParseException e )
{
- String msg = "ACIItem parser failure on '" + item + "'. Cannnot add ACITuples to TupleCache.";
+ String msg = "ACIItem parser failure on " + aciStr + ". Cannnot add ACITuples to TupleCache.";
log.warn( msg, e );
}
-
- entryTuples.addAll( item.toTuples() );
}
+
tuples.put( normName.toNormName(), entryTuples );
}
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/event/ExpressionEvaluator.java Sun Dec 31 10:11:38 2006
@@ -29,7 +29,6 @@
import org.apache.directory.server.core.schema.OidRegistry;
import org.apache.directory.shared.ldap.filter.BranchNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.AssertionEnum;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/JavaLdapSupport.java Sun Dec 31 10:11:38 2006
@@ -102,7 +102,10 @@
{
try
{
- in.close();
+ if ( in != null )
+ {
+ in.close();
+ }
}
catch ( IOException e )
{
@@ -141,7 +144,10 @@
{
try
{
- out.close();
+ if ( out != null )
+ {
+ out.close();
+ }
}
catch ( IOException e )
{
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java Sun Dec 31 10:11:38 2006
@@ -240,7 +240,6 @@
// Check for Referenceable
if ( obj instanceof Referenceable )
{
- obj = ( ( Referenceable ) obj ).getReference();
throw new NamingException( "Do not know how to store Referenceables yet!" );
}
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/normalization/NormalizingVisitor.java Sun Dec 31 10:11:38 2006
@@ -34,7 +34,6 @@
import org.slf4j.LoggerFactory;
import javax.naming.NamingException;
-import java.util.ArrayList;
import java.util.List;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultOptimizer.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultOptimizer.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultOptimizer.java Sun Dec 31 10:11:38 2006
@@ -21,7 +21,6 @@
import java.math.BigInteger;
-import java.util.ArrayList;
import java.util.List;
import javax.naming.NamingException;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultSearchEngine.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultSearchEngine.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/DefaultSearchEngine.java Sun Dec 31 10:11:38 2006
@@ -28,7 +28,6 @@
import javax.naming.NamingException;
import javax.naming.directory.SearchControls;
-import org.apache.directory.shared.ldap.filter.AbstractExprNode;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
import org.apache.directory.shared.ldap.filter.BranchNode;
import org.apache.directory.shared.ldap.filter.ExprNode;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/partition/impl/btree/ExpressionEnumerator.java Sun Dec 31 10:11:38 2006
@@ -21,7 +21,6 @@
import java.math.BigInteger;
-import java.util.ArrayList;
import java.util.List;
import javax.naming.NamingEnumeration;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/referral/ReferralService.java Sun Dec 31 10:11:38 2006
@@ -64,7 +64,6 @@
import org.apache.directory.shared.ldap.exception.LdapReferralException;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.LeafNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import org.apache.directory.shared.ldap.message.ResultCodeEnum;
import org.apache.directory.shared.ldap.name.LdapDN;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/sp/LdapClassLoader.java Sun Dec 31 10:11:38 2006
@@ -31,7 +31,6 @@
import org.apache.directory.server.core.jndi.ServerLdapContext;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
import org.apache.directory.shared.ldap.filter.BranchNode;
-import org.apache.directory.shared.ldap.filter.LeafNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import org.apache.directory.shared.ldap.name.LdapDN;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluator.java Sun Dec 31 10:11:38 2006
@@ -22,7 +22,6 @@
import org.apache.directory.server.core.schema.OidRegistry;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
-import org.apache.directory.shared.ldap.filter.LeafNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import org.apache.directory.shared.ldap.util.StringTools;
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/subtree/SubentryService.java Sun Dec 31 10:11:38 2006
@@ -38,7 +38,6 @@
import org.apache.directory.shared.ldap.exception.LdapSchemaViolationException;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
import org.apache.directory.shared.ldap.filter.ExprNode;
-import org.apache.directory.shared.ldap.filter.LeafNode;
import org.apache.directory.shared.ldap.filter.PresenceNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import org.apache.directory.shared.ldap.message.LockableAttributeImpl;
Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementEvaluatorTest.java Sun Dec 31 10:11:38 2006
@@ -35,7 +35,6 @@
import org.apache.directory.shared.ldap.filter.ExprNode;
import org.apache.directory.shared.ldap.filter.FilterParser;
import org.apache.directory.shared.ldap.filter.FilterParserImpl;
-import org.apache.directory.shared.ldap.filter.LeafNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import java.util.Set;
Modified: directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java (original)
+++ directory/trunks/apacheds/core/src/test/java/org/apache/directory/server/core/subtree/RefinementLeafEvaluatorTest.java Sun Dec 31 10:11:38 2006
@@ -30,7 +30,6 @@
import org.apache.directory.server.core.schema.global.GlobalRegistries;
import org.apache.directory.server.core.subtree.RefinementLeafEvaluator;
import org.apache.directory.shared.ldap.filter.AssertionEnum;
-import org.apache.directory.shared.ldap.filter.LeafNode;
import org.apache.directory.shared.ldap.filter.SimpleNode;
import java.util.Set;
Modified: directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java (original)
+++ directory/trunks/apacheds/protocol-ldap/src/main/java/org/apache/directory/server/ldap/support/extended/GracefulShutdownHandler.java Sun Dec 31 10:11:38 2006
@@ -321,7 +321,7 @@
if ( delay > 0 )
{
// delay is in seconds
- long delayMillis = delay * 1000;
+ long delayMillis = delay * 1000L;
long startTime = System.currentTimeMillis();
while ( ( System.currentTimeMillis() - startTime ) < delayMillis )
Modified: directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java (original)
+++ directory/trunks/shared/asn1/src/main/java/org/apache/directory/shared/asn1/ber/Asn1Decoder.java Sun Dec 31 10:11:38 2006
@@ -361,6 +361,13 @@
private void treatLengthEndState( IAsn1Container container ) throws DecoderException
{
TLV tlv = container.getCurrentTLV();
+
+ if ( tlv == null )
+ {
+ log.error( "The current container TLV is null." );
+ throw new DecoderException( "Current TLV is null" );
+ }
+
int length = tlv.getLength();
// We will check the length here. What we must control is
Modified: directory/trunks/shared/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java (original)
+++ directory/trunks/shared/asn1/src/test/java/org/apache/directory/shared/asn1/codec/stateful/DecoderStackTest.java Sun Dec 31 10:11:38 2006
@@ -94,80 +94,80 @@
assertTrue( "expecting empty stack after creation", stack.isEmpty() );
PassThroDecoder decoder = new PassThroDecoder();
stack.push( decoder );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 0 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 0 ), history.getMostRecent() );
assertFalse( "expecting non-empty stack after push", stack.isEmpty() );
stack.push( new IncrementingDecoder() );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 1 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 1 ), history.getMostRecent() );
stack.push( new IncrementingDecoder() );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 2 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 2 ), history.getMostRecent() );
stack.push( new IncrementingDecoder() );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 3 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 3 ), history.getMostRecent() );
stack.push( new IncrementingDecoder() );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 4 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 4 ), history.getMostRecent() );
stack.push( new IncrementingDecoder() );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 5 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 5 ), history.getMostRecent() );
stack.push( new IncrementingDecoder() );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 6 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 6 ), history.getMostRecent() );
stack.push( new IncrementingDecoder() );
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 7 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 7 ), history.getMostRecent() );
// start popping and decrementing now
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 6 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 6 ), history.getMostRecent() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 5 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 5 ), history.getMostRecent() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 4 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 4 ), history.getMostRecent() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 3 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 3 ), history.getMostRecent() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 2 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 2 ), history.getMostRecent() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 1 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 1 ), history.getMostRecent() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 0 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 0 ), history.getMostRecent() );
assertFalse( "expecting stack with passthrodecoder", stack.isEmpty() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 0 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 0 ), history.getMostRecent() );
assertTrue( "expecting empty stack after last pop", stack.isEmpty() );
stack.pop();
- stack.decode( new Integer( 0 ) );
- assertEquals( new Integer( 0 ), history.getMostRecent() );
+ stack.decode( Integer.valueOf( 0 ) );
+ assertEquals( Integer.valueOf( 0 ), history.getMostRecent() );
assertTrue( "expecting empty stack after empty pop", stack.isEmpty() );
}
@@ -219,7 +219,7 @@
public void decode( Object encoded ) throws DecoderException
{
Integer value = ( Integer ) encoded;
- value = new Integer( value.intValue() + 1 );
+ value = Integer.valueOf( value.intValue() + 1 );
super.decodeOccurred( value );
}
}
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectStatesEnum.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulDisconnectStatesEnum.java Sun Dec 31 10:11:38 2006
@@ -42,22 +42,22 @@
public static final int START_STATE = 0;
/** Sequence */
- public static int GRACEFUL_DISCONNECT_SEQUENCE_STATE = 1;
+ public static final int GRACEFUL_DISCONNECT_SEQUENCE_STATE = 1;
/** Time offline */
- public static int TIME_OFFLINE_STATE = 2;
+ public static final int TIME_OFFLINE_STATE = 2;
/** Delay */
- public static int DELAY_STATE = 3;
+ public static final int DELAY_STATE = 3;
/** Replicated contexts */
- public static int REPLICATED_CONTEXTS_STATE = 4;
+ public static final int REPLICATED_CONTEXTS_STATE = 4;
/** Referral */
- public static int REFERRAL_STATE = 5;
+ public static final int REFERRAL_STATE = 5;
/** terminal state */
- public static int LAST_GRACEFUL_DISCONNECT_STATE = 6;
+ public static final int LAST_GRACEFUL_DISCONNECT_STATE = 6;
// =========================================================================
// States debug strings
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownStatesEnum.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/GracefulShutdownStatesEnum.java Sun Dec 31 10:11:38 2006
@@ -43,16 +43,16 @@
public static final int START_STATE = 0;
/** Sequence */
- public static int GRACEFUL_SHUTDOWN_SEQUENCE_STATE = 1;
+ public static final int GRACEFUL_SHUTDOWN_SEQUENCE_STATE = 1;
/** Time offline */
- public static int TIME_OFFLINE_STATE = 2;
+ public static final int TIME_OFFLINE_STATE = 2;
/** Delay */
- public static int DELAY_STATE = 3;
+ public static final int DELAY_STATE = 3;
/** terminal state */
- public static int LAST_GRACEFUL_SHUTDOWN_STATE = 4;
+ public static final int LAST_GRACEFUL_SHUTDOWN_STATE = 4;
// =========================================================================
// States debug strings
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCall.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCall.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCall.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCall.java Sun Dec 31 10:11:38 2006
@@ -144,11 +144,11 @@
public static class Scope
{
- public static Scope BASE_OBJECT = new Scope( "baseObject" );
+ public static final Scope BASE_OBJECT = new Scope( "baseObject" );
- public static Scope SINGLE_LEVEL = new Scope( "scopeLevel" );
+ public static final Scope SINGLE_LEVEL = new Scope( "scopeLevel" );
- public static Scope WHOLE_SUBTREE = new Scope( "wholeSubtree" );
+ public static final Scope WHOLE_SUBTREE = new Scope( "wholeSubtree" );
private String name;
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallStatesEnum.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureCallStatesEnum.java Sun Dec 31 10:11:38 2006
@@ -38,52 +38,52 @@
// Tags and values
//=========================================================================
/** starting state */
- public static int START_STATE = 0;
+ public static final int START_STATE = 0;
/** StoredProcedureCall */
- public static int STORED_PROCEDURE_CALL_STATE = 1;
+ public static final int STORED_PROCEDURE_CALL_STATE = 1;
// Name -------------------------------------------------------------------
/** Name */
- public static int NAME_STATE = 2;
+ public static final int NAME_STATE = 2;
// Options ----------------------------------------------------------------
/** Options */
- public static int OPTIONS_STATE = 3;
+ public static final int OPTIONS_STATE = 3;
// --- Language Scheme ----------------------------------------------------
/** Language Scheme */
- public static int LANGUAGE_SCHEME_STATE = 4;
+ public static final int LANGUAGE_SCHEME_STATE = 4;
// --- Search Context -----------------------------------------------------
/** Search Context */
- public static int SEARCH_CONTEXT_STATE = 5;
+ public static final int SEARCH_CONTEXT_STATE = 5;
// ------ Context ---------------------------------------------------------
/** Context */
- public static int CONTEXT_STATE = 6;
+ public static final int CONTEXT_STATE = 6;
// ------ Scope -----------------------------------------------------------
/** Scope */
- public static int SCOPE_STATE = 7;
+ public static final int SCOPE_STATE = 7;
// Parameters -------------------------------------------------------------
/** Parameters */
- public static int PARAMETERS_STATE = 8;
+ public static final int PARAMETERS_STATE = 8;
// --- Parameter ----------------------------------------------------------
/** Parameter */
- public static int PARAMETER_STATE = 9;
+ public static final int PARAMETER_STATE = 9;
// ------ Parameter type --------------------------------------------------
/** Parameter type */
- public static int PARAMETER_TYPE_STATE = 10;
+ public static final int PARAMETER_TYPE_STATE = 10;
// ------ Parameter value -------------------------------------------------
/** Parameter value */
- public static int PARAMETER_VALUE_STATE = 11;
+ public static final int PARAMETER_VALUE_STATE = 11;
- public static int LAST_STORED_PROCEDURE_CALL_STATE = 12;
+ public static final int LAST_STORED_PROCEDURE_CALL_STATE = 12;
//=========================================================================
// States debug strings
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/extended/operations/StoredProcedureStatesEnum.java Sun Dec 31 10:11:38 2006
@@ -38,36 +38,36 @@
// StoredProcedure
//=========================================================================
/** starting state */
- public static int START_STATE = 0;
+ public static final int START_STATE = 0;
/** StoredProcedure */
- public static int STORED_PROCEDURE_STATE = 1;
+ public static final int STORED_PROCEDURE_STATE = 1;
// Language ---------------------------------------------------------------
/** Language */
- public static int LANGUAGE_STATE = 2;
+ public static final int LANGUAGE_STATE = 2;
// Procedure --------------------------------------------------------------
/** Procedure */
- public static int PROCEDURE_STATE = 3;
+ public static final int PROCEDURE_STATE = 3;
// Parameters -------------------------------------------------------------
/** Parameters */
- public static int PARAMETERS_STATE = 4;
+ public static final int PARAMETERS_STATE = 4;
// Parameter --------------------------------------------------------------
/** Parameter */
- public static int PARAMETER_STATE = 5;
+ public static final int PARAMETER_STATE = 5;
// Parameter type ---------------------------------------------------------
/** Parameter type */
- public static int PARAMETER_TYPE_STATE = 6;
+ public static final int PARAMETER_TYPE_STATE = 6;
// Parameters value -------------------------------------------------------
/** Parameter value */
- public static int PARAMETER_VALUE_STATE = 7;
+ public static final int PARAMETER_VALUE_STATE = 7;
- public static int LAST_STORED_PROCEDURE_STATE = 8;
+ public static final int LAST_STORED_PROCEDURE_STATE = 8;
//=========================================================================
// States debug strings
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlStatesEnum.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/EntryChangeControlStatesEnum.java Sun Dec 31 10:11:38 2006
@@ -40,22 +40,22 @@
// =========================================================================
/** Sequence Tag */
- public static int START_STATE = 0;
+ public static final int START_STATE = 0;
/** Sequence */
- public static int EC_SEQUENCE_STATE = 1;
+ public static final int EC_SEQUENCE_STATE = 1;
/** changeType */
- public static int CHANGE_TYPE_STATE = 2;
+ public static final int CHANGE_TYPE_STATE = 2;
/** previousDN */
- public static int PREVIOUS_DN_STATE = 3;
+ public static final int PREVIOUS_DN_STATE = 3;
/** changeNumber */
- public static int CHANGE_NUMBER_STATE = 4;
+ public static final int CHANGE_NUMBER_STATE = 4;
/** terminal state */
- public static int LAST_EC_STATE = 5;
+ public static final int LAST_EC_STATE = 5;
// =========================================================================
// States debug strings
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlStatesEnum.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/PSearchControlStatesEnum.java Sun Dec 31 10:11:38 2006
@@ -42,19 +42,19 @@
public static final int START_STATE = 0;
/** Sequence Value */
- public static int PSEARCH_SEQUENCE_STATE = 1;
+ public static final int PSEARCH_SEQUENCE_STATE = 1;
/** changeTypes Value */
- public static int CHANGE_TYPES_STATE = 3;
+ public static final int CHANGE_TYPES_STATE = 3;
/** changesOnly Value */
- public static int CHANGES_ONLY_STATE = 5;
+ public static final int CHANGES_ONLY_STATE = 5;
/** returnECs Value */
- public static int RETURN_ECS_STATE = 7;
+ public static final int RETURN_ECS_STATE = 7;
/** terminal state */
- public static int LAST_PSEARCH_STATE = 8;
+ public static final int LAST_PSEARCH_STATE = 8;
// =========================================================================
// States debug strings
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlStatesEnum.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlStatesEnum.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlStatesEnum.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/codec/search/controls/SubEntryControlStatesEnum.java Sun Dec 31 10:11:38 2006
@@ -40,13 +40,13 @@
// =========================================================================
/** Starting state */
- public static int START_STATE = 0;
+ public static final int START_STATE = 0;
/** Visibility Value */
- public static int SUB_ENTRY_VISIBILITY_STATE = 1;
+ public static final int SUB_ENTRY_VISIBILITY_STATE = 1;
/** terminal state */
- public static int LAST_SUB_ENTRY_STATE = 2;
+ public static final int LAST_SUB_ENTRY_STATE = 2;
// =========================================================================
// States debug strings
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/filter/BranchNode.java Sun Dec 31 10:11:38 2006
@@ -26,9 +26,6 @@
import java.util.List;
import java.math.BigInteger;
-import org.apache.directory.shared.ldap.name.LdapDN;
-
-
/**
* Node representing branches within the expression tree corresponding to
* logical operators within the filter expression.
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/name/Rdn.java Sun Dec 31 10:11:38 2006
@@ -619,15 +619,17 @@
/**
- * Compares two RDNs. They are equals if : - their have the same number of
- * NC (AttributeTypeAndValue) - each ATAVs are equals - comparizon of type
- * are done case insensitive - each value is equel, case sensitive - Order
- * of ATAV is not important If the RDNs are not equals, a positive number is
+ * Compares two RDNs. They are equals if :
+ * - their have the same number of NC (AttributeTypeAndValue)
+ * - each ATAVs are equals
+ * - comparizon of type are done case insensitive
+ * - each value is equel, case sensitive
+ * - Order of ATAV is not important If the RDNs are not equals, a positive number is
* returned if the first RDN is greated, negative otherwise
*
* @param object
* @return 0 if both rdn are equals. -1 if the current RDN is inferior, 1 if
- * teh current Rdn is superioir, UNDIFIED otherwise.
+ * the current Rdn is superior, UNDEFINED otherwise.
*/
public int compareTo( Object object )
{
Modified: directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java (original)
+++ directory/trunks/shared/ldap/src/main/java/org/apache/directory/shared/ldap/util/StringTools.java Sun Dec 31 10:11:38 2006
@@ -1608,9 +1608,14 @@
*/
public static final boolean isCharASCII( String string, int index, char car )
{
+ if ( string == null )
+ {
+ return false;
+ }
+
int length = string.length();
- if ( ( string == null ) || ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+ if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
{
return false;
}
@@ -1718,7 +1723,7 @@
{
byte c = byteArray[index];
- if ( ( c > 127 ) || ( HEX[c] == false ) )
+ if ( ( ( c | 0x7F ) != 0x7F ) || ( HEX[c] == false ) )
{
return false;
}
@@ -1773,9 +1778,14 @@
*/
public static final boolean isHex( String string, int index )
{
+ if ( string == null )
+ {
+ return false;
+ }
+
int length = string.length();
- if ( ( string == null ) || ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
+ if ( ( length == 0 ) || ( index < 0 ) || ( index >= length ) )
{
return false;
}
@@ -1811,7 +1821,7 @@
}
else
{
- return ( ( ( byteArray[0] > 127 ) || !DIGIT[byteArray[0]] ) ? false : true );
+ return ( ( ( ( byteArray[0] | 0x7F ) != 0x7F ) || !DIGIT[byteArray[0]] ) ? false : true );
}
}
@@ -1878,7 +1888,7 @@
{
byte c = byteArray[index++];
- if ( ( c > 127 ) || ( ALPHA[c] == false ) )
+ if ( ( ( c | 0x7F ) != 0x7F ) || ( ALPHA[c] == false ) )
{
return false;
}
@@ -2058,7 +2068,7 @@
}
else
{
- return ( ( ( byteArray[index] > 127 ) || !DIGIT[byteArray[index]] ) ? false : true );
+ return ( ( ( ( byteArray[index] | 0x7F ) != 0x7F ) || !DIGIT[byteArray[index]] ) ? false : true );
}
}
@@ -2196,7 +2206,7 @@
{
byte c = byteArray[index++];
- if ( ( c > 127 ) || ( CHAR[c] == false ) )
+ if ( ( ( c | 0x7F ) != 0x7F ) || ( CHAR[c] == false ) )
{
return false;
}
Modified: directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java
URL: http://svn.apache.org/viewvc/directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java?view=diff&rev=491461&r1=491460&r2=491461
==============================================================================
--- directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java (original)
+++ directory/trunks/shared/ldap/src/test/java/org/apache/directory/shared/ldap/name/RdnTest.java Sun Dec 31 10:11:38 2006
@@ -303,6 +303,26 @@
/**
+ * Compares with a null RDN.
+ */
+ public void testRDNCompareToNullRdn() throws InvalidNameException
+ {
+ Rdn rdn1 = new Rdn( " a = b " );
+
+ Assert.assertEquals( 1, rdn1.compareTo( null ) );
+ }
+
+ /**
+ * Compares with a bad object
+ */
+ public void testRDNCompareToBadObject() throws InvalidNameException
+ {
+ Rdn rdn1 = new Rdn( " a = b " );
+
+ Assert.assertEquals( Rdn.UNDEFINED, rdn1.compareTo( "test" ) );
+ }
+
+ /**
* Compares a simple NC to a simple NC.
*/
public void testRDNCompareToNC2NC() throws InvalidNameException
@@ -404,7 +424,7 @@
Rdn rdn = new Rdn( "a=b + c=d + a=f" );
Assert.assertFalse( rdn.equals( null ) );
- Assert.assertFalse( rdn.equals( new String( "test" ) ) );
+ Assert.assertFalse( rdn.equals( "test" ) );
Assert.assertFalse( rdn.equals( new Rdn( "a=c + c=d + a=f" ) ) );
Assert.assertFalse( rdn.equals( new Rdn( "a=b" ) ) );
Assert.assertTrue( rdn.equals( new Rdn( "a=b + c=d + a=f" ) ) );