You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by fe...@apache.org on 2010/05/15 10:06:08 UTC
svn commit: r944590 - in /directory/apacheds/trunk:
core-api/src/main/java/org/apache/directory/server/core/interceptor/
core/src/main/java/org/apache/directory/server/core/
core/src/main/java/org/apache/directory/server/core/changelog/
core/src/main/j...
Author: felixk
Date: Sat May 15 08:06:07 2010
New Revision: 944590
URL: http://svn.apache.org/viewvc?rev=944590&view=rev
Log:
>From PMD report "Avoid empty catch blocks"
SuppressWarnings where intended to avoid false positives
Modified:
directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKey.java
directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java
directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java
directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
directory/apacheds/trunk/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/AddressRecordEncoder.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java
directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java (original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/InterceptorChain.java Sat May 15 08:06:07 2010
@@ -702,6 +702,8 @@ public class InterceptorChain
*
* @param opContext the operation context to populate with cached fields
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void eagerlyPopulateFields( OperationContext opContext )
{
// If the entry field is not set for ops other than add for example
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sat May 15 08:06:07 2010
@@ -1494,6 +1494,8 @@ public class DefaultDirectoryService imp
* @param text The ldif format file
* @return An entry.
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private Entry readEntry( String text )
{
StringReader strIn = new StringReader( text );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/ReferralManagerImpl.java Sat May 15 08:06:07 2010
@@ -122,6 +122,8 @@ public class ReferralManagerImpl impleme
/**
* {@inheritDoc}
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public void addReferral( Entry entry )
{
try
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java Sat May 15 08:06:07 2010
@@ -127,6 +127,8 @@ public class MemoryChangeLogStore implem
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void loadRevision() throws Exception
{
File revFile = new File( workingDirectory, REV_FILE );
@@ -194,6 +196,8 @@ public class MemoryChangeLogStore implem
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void saveTags() throws Exception
{
File tagFile = new File( workingDirectory, TAG_FILE );
@@ -249,6 +253,8 @@ public class MemoryChangeLogStore implem
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void loadTags() throws Exception
{
File revFile = new File( workingDirectory, REV_FILE );
@@ -316,6 +322,8 @@ public class MemoryChangeLogStore implem
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void loadChangeLog() throws Exception
{
File file = new File( workingDirectory, CHANGELOG_FILE );
@@ -363,6 +371,8 @@ public class MemoryChangeLogStore implem
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void saveChangeLog() throws Exception
{
File file = new File( workingDirectory, CHANGELOG_FILE );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/prefs/ServerSystemPreferences.java Sat May 15 08:06:07 2010
@@ -77,6 +77,8 @@ public class ServerSystemPreferences ext
* Creates a preferences object for the system preferences root.
* @param directoryService the directory service core
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public ServerSystemPreferences( DirectoryService directoryService )
{
super( null, "" );
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/referral/ReferralInterceptor.java Sat May 15 08:06:07 2010
@@ -141,6 +141,8 @@ public class ReferralInterceptor extends
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
static private boolean isReferral( Entry entry ) throws NamingException
{
// Check that the entry is not null, otherwise return FALSE.
Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java (original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaInterceptor.java Sat May 15 08:06:07 2010
@@ -416,6 +416,8 @@ public class SchemaInterceptor extends B
*
* @param searchCtls The SearchControls we will filter
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void filterAttributesToReturn( SearchControls searchCtls )
{
String[] attributes = searchCtls.getReturningAttributes();
@@ -1415,6 +1417,8 @@ public class SchemaInterceptor extends B
/**
* Filter the attributes by removing the ones which are not allowed
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void filterAttributeTypes( SearchingOperationContext operation, ClonedServerEntry result )
{
if ( operation.getReturningAttributes() == null )
Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKey.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKey.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/DesStringToKey.java Sat May 15 08:06:07 2010
@@ -317,6 +317,8 @@ public class DesStringToKey
* @param string The String to encode.
* @return The encoded String.
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
protected byte[] characterEncodeString( String string )
{
byte encodedByteArray[] = new byte[string.length()];
Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/KerberosKeyFactory.java Sat May 15 08:06:07 2010
@@ -83,6 +83,8 @@ public class KerberosKeyFactory
* @param ciphers The set of ciphers to derive keys for.
* @return The list of KerberosKey's.
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public static Map<EncryptionType, EncryptionKey> getKerberosKeys( String principalName, String passPhrase,
Set<EncryptionType> ciphers )
{
Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java (original)
+++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddress.java Sat May 15 08:06:07 2010
@@ -315,6 +315,8 @@ public class HostAddress extends Abstrac
/**
* @see Object#toString()
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public String toString()
{
String result = "";
Modified: directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java (original)
+++ directory/apacheds/trunk/protocol-dhcp/src/main/java/org/apache/directory/server/dhcp/store/Subnet.java Sat May 15 08:06:07 2010
@@ -46,6 +46,8 @@ public class Subnet extends DhcpConfigEl
private InetAddress rangeMax;
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public Subnet(InetAddress address, InetAddress netmask, InetAddress rangeMin, InetAddress rangeMax)
{
// mask address to match subnet
Modified: directory/apacheds/trunk/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/AddressRecordEncoder.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/AddressRecordEncoder.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/AddressRecordEncoder.java (original)
+++ directory/apacheds/trunk/protocol-dns/src/main/java/org/apache/directory/server/dns/io/encoder/AddressRecordEncoder.java Sat May 15 08:06:07 2010
@@ -53,6 +53,8 @@ import org.apache.mina.core.buffer.IoBuf
*/
public class AddressRecordEncoder extends ResourceRecordEncoder
{
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
protected void putResourceRecordData( IoBuffer byteBuffer, ResourceRecord record )
{
String ipAddress = record.get( DnsAttribute.IP_ADDRESS );
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/LdapServer.java Sat May 15 08:06:07 2010
@@ -335,6 +335,8 @@ public class LdapServer extends Director
/**
* loads the digital certificate either from a keystore file or from the admin entry in DIT
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void loadKeyStore() throws Exception
{
if ( StringTools.isEmpty( keystoreFile ) )
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java Sat May 15 08:06:07 2010
@@ -86,6 +86,8 @@ public class BindHandler extends LdapReq
* @param message The BindRequest received
* @throws Exception If the authentication cannot be done
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public void handleSimpleAuth( LdapSession ldapSession, InternalBindRequest bindRequest ) throws Exception
{
// if the user is already bound, we have to unbind him
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/SearchHandler.java Sat May 15 08:06:07 2010
@@ -1582,6 +1582,8 @@ public class SearchHandler extends LdapR
* @return the farthest referral ancestor or null
* @throws Exception if there are problems during this search
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public static final Entry getFarthestReferralAncestor( LdapSession session, DN target )
throws Exception
{
Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java (original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/extended/LaunchDiagnosticUiHandler.java Sat May 15 08:06:07 2010
@@ -75,6 +75,8 @@ public class LaunchDiagnosticUiHandler i
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
public void handleExtendedOperation( LdapSession requestor, InternalExtendedRequest req )
throws Exception
{
Modified: directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java (original)
+++ directory/apacheds/trunk/server-jndi/src/main/java/org/apache/directory/server/configuration/ApacheDS.java Sat May 15 08:06:07 2010
@@ -339,6 +339,8 @@ public class ApacheDS
* @param ldifFile The ldif file to read
* @throws NamingException If something went wrong while loading the entries
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void loadLdif( File ldifFile ) throws Exception
{
Entry fileEntry = null;
Modified: directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java (original)
+++ directory/apacheds/trunk/test-framework/src/main/java/org/apache/directory/server/core/integ/FrameworkSuite.java Sat May 15 08:06:07 2010
@@ -88,6 +88,8 @@ public class FrameworkSuite extends Suit
/**
* Stop and clean the DS
*/
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private void stopDS()
{
if ( directoryService != null )
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java Sat May 15 08:06:07 2010
@@ -68,6 +68,8 @@ public class DefaultOptimizer<E, ID exte
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private ID getContextEntryId() throws Exception
{
if ( contextEntryId == null )
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeCursor.java Sat May 15 08:06:07 2010
@@ -94,6 +94,8 @@ public class SubtreeScopeCursor<ID exten
}
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private ID getContextEntryId() throws Exception
{
if ( contextEntryId == null )
Modified: directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=944590&r1=944589&r2=944590&view=diff
==============================================================================
--- directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java (original)
+++ directory/apacheds/trunk/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java Sat May 15 08:06:07 2010
@@ -87,6 +87,8 @@ public class SubtreeScopeEvaluator<E, ID
private ID contextEntryId;
+ // This will suppress PMD.EmptyCatchBlock warnings in this method
+ @SuppressWarnings("PMD.EmptyCatchBlock")
private ID getContextEntryId() throws Exception
{
if ( contextEntryId == null )
Re: svn commit: r944590 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/
core/src/main/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/changelog/
core/src/main/j...
Posted by Felix Knecht <fe...@apache.org>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
> I would not add a @SuppressWarning for such a warning. It's not good to
> have an empty catch block, and we should at least add a comment (//
> expected) if it's really expected, or add some real log if not.
>
> I don't think that an empty catch block is a good thing (except in tests)
IMO it's never good swallowing an exception without leaving a trace
(either propagate exception or log exception).
Apart from that we may run into another problem, when catching any
thrown exception using the general "catch (Exception e)":
"This method uses a try-catch block that catches Exception objects, but
Exception is not thrown within the try block, and RuntimeException is
not explicitly caught. It is a common bug pattern to say try { ... }
catch (Exception e) { something } as a shorthand for catching a number
of types of exception each of whose catch blocks is identical, but this
construct also accidentally catches RuntimeException as well, masking
potential bugs. "
So what shall we do - propagate or log?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkvuYicACgkQ2lZVCB08qHFJigCfe4ha2ToHocVsUxpFjLWAf1tI
QWcAnjKZxsdqrtT8iMn7NKdtsYe3q7wO
=DmL1
-----END PGP SIGNATURE-----
Re: svn commit: r944590 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/interceptor/
core/src/main/java/org/apache/directory/server/core/ core/src/main/java/org/apache/directory/server/core/changelog/
core/src/main/j...
Posted by Emmanuel Lecharny <el...@gmail.com>.
On 5/15/10 10:06 AM, felixk@apache.org wrote:
> Author: felixk
> Date: Sat May 15 08:06:07 2010
> New Revision: 944590
>
> URL: http://svn.apache.org/viewvc?rev=944590&view=rev
> Log:
> > From PMD report "Avoid empty catch blocks"
>
I would not add a @SuppressWarning for such a warning. It's not good to
have an empty catch block, and we should at least add a comment (//
expected) if it's really expected, or add some real log if not.
I don't think that an empty catch block is a good thing (except in tests)
--
Regards,
Cordialement,
Emmanuel Lécharny
www.nextury.com