Skip to content

Commit

Permalink
GEODE-611: Change findbugs annotations to use ASL library
Browse files Browse the repository at this point in the history
Swtich the findbugs annotation dependency to use an ASL version
from https://github.com/stephenc/findbugs-annotations.  This
library only supports the SuppressWarning annotation, not
SuppressFBWarning so some source files were updated.
  • Loading branch information
metatype committed Dec 1, 2015
1 parent 5a9fdb8 commit 4d6df30
Show file tree
Hide file tree
Showing 20 changed files with 46 additions and 96 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ subprojects {
compile 'org.springframework:spring-expression:' + project.'springframework.version'
compile 'org.springframework:spring-web:' + project.'springframework.version'
compile 'org.springframework:spring-webmvc:' + project.'springframework.version'
compile 'com.github.stephenc.findbugs:findbugs-annotations:' + project.'stephenc-findbugs.version'

testCompile 'com.jayway.awaitility:awaitility:' + project.'awaitility.version'
testCompile 'com.github.stefanbirkner:system-rules:' + project.'system-rules.version'
Expand Down
1 change: 0 additions & 1 deletion gemfire-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dependencies {
compile 'com.fasterxml.jackson.core:jackson-annotations:' + project.'jackson.version'
compile 'com.fasterxml.jackson.core:jackson-core:' + project.'jackson.version'
compile 'com.fasterxml.jackson.core:jackson-databind:' + project.'jackson.version'
compile 'com.google.code.findbugs:annotations:' + project.'annotations.version'
provided 'com.google.guava:guava:' + project.'guava.version'
compile 'commons-io:commons-io:' + project.'commons-io.version'
compile 'commons-lang:commons-lang:' + project.'commons-lang.version'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Catches and responds to JVM failure
* <p>
Expand Down Expand Up @@ -190,7 +188,7 @@ public void uncaughtException(Thread t, Throwable e) {
* @author jpenney
* @since 5.1
*/
@SuppressFBWarnings(value="DM_GC", justification="This class performs System.gc as last ditch effort during out-of-memory condition.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="DM_GC", justification="This class performs System.gc as last ditch effort during out-of-memory condition.")
public final class SystemFailure {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
import javax.management.remote.rmi.RMIConnectorServer;
import javax.rmi.ssl.SslRMIClientSocketFactory;

import mx4j.tools.adaptor.http.HttpAdaptor;

import org.apache.logging.log4j.Logger;

import com.gemstone.gemfire.GemFireException;
Expand All @@ -56,6 +58,7 @@
import com.gemstone.gemfire.admin.jmx.AgentConfig;
import com.gemstone.gemfire.admin.jmx.AgentFactory;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.i18n.StringId;
import com.gemstone.gemfire.internal.Banner;
import com.gemstone.gemfire.internal.GemFireVersion;
import com.gemstone.gemfire.internal.admin.remote.TailLogResponse;
Expand All @@ -70,10 +73,6 @@
import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
import com.gemstone.gemfire.internal.logging.log4j.LogWriterAppender;
import com.gemstone.gemfire.internal.logging.log4j.LogWriterAppenders;
import com.gemstone.gemfire.i18n.StringId;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import mx4j.tools.adaptor.http.HttpAdaptor;

/**
* The GemFire JMX Agent provides the ability to administrate one GemFire
Expand Down Expand Up @@ -406,7 +405,7 @@ public ObjectName manageDistributedSystem()
*
* @return the object name of the system that the Agent is now connected to
*/
@SuppressFBWarnings(value="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification="This is only a style warning.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification="This is only a style warning.")
public ObjectName connectToSystem()
throws AdminException, MalformedObjectNameException {
synchronized(CONN_SYNC) {
Expand Down Expand Up @@ -454,7 +453,7 @@ public ObjectName connectToSystem()
/**
* Disconnects from the current DistributedSystem (if connected to one).
*/
@SuppressFBWarnings(value="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification="This is only a style warning.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification="This is only a style warning.")
public void disconnectFromSystem() {
synchronized(CONN_SYNC) {
try {
Expand Down Expand Up @@ -878,7 +877,7 @@ private void removeShutdownHook() {
/**
* Creates a LogWriterI18n for this Agent to use in logging.
*/
@SuppressFBWarnings(value="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification="Return value for file delete is not important here.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification="Return value for file delete is not important here.")
private void initLogWriter() throws com.gemstone.gemfire.admin.AdminException {
final LogConfig logConfig = this.agentConfig.createLogConfig();

Expand Down Expand Up @@ -1570,7 +1569,7 @@ class ConnectionNotificationAdapter implements NotificationListener {
* the listener. The MBean object should not use or modify the
* object. (NOTE: copied from javax.management.NotificationListener)
*/
@SuppressFBWarnings(value="BC_UNCONFIRMED_CAST", justification="Only JMXConnectionNotification instances are used.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="BC_UNCONFIRMED_CAST", justification="Only JMXConnectionNotification instances are used.")
public void handleNotification(Notification notification, Object handback) {
if (handback instanceof AgentImpl) {
AgentImpl agent = (AgentImpl) handback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
*/
package com.gemstone.gemfire.admin.jmx.internal;

import com.gemstone.gemfire.admin.*;
import com.gemstone.gemfire.admin.internal.*;
import javax.management.ObjectName;
import javax.management.modelmbean.ModelMBean;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import javax.management.*;
import javax.management.modelmbean.*;
import com.gemstone.gemfire.admin.AdminException;
import com.gemstone.gemfire.admin.GemFireHealth;
import com.gemstone.gemfire.admin.GemFireHealthConfig;
import com.gemstone.gemfire.admin.internal.GemFireHealthConfigImpl;

/**
* The JMX "managed resource" that represents the configuration for
Expand All @@ -46,7 +46,7 @@
*
* @since 3.5
*/
@SuppressFBWarnings(justification="This class is deprecated. Also, any further changes so close to the release is inadvisable.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(justification="This class is deprecated. Also, any further changes so close to the release is inadvisable.")
public class GemFireHealthConfigJmxImpl
implements GemFireHealthConfig, ManagedResource, java.io.Serializable {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@
import com.gemstone.gemfire.pdx.internal.PdxInstanceImpl;
import com.gemstone.gemfire.pdx.internal.PdxString;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Class Description
*
Expand Down Expand Up @@ -223,7 +221,7 @@ public Set computeDependencies(ExecutionContext context)
return context.addDependencies(this, rcvr.computeDependencies(context));
}

@SuppressFBWarnings(value="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED", justification="Does not matter if the methodDispatch that isn't stored in the map is used")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="RV_RETURN_VALUE_OF_PUTIFABSENT_IGNORED", justification="Does not matter if the methodDispatch that isn't stored in the map is used")
private Object eval0(Object receiver, Class resolutionType, ExecutionContext context)
throws TypeMismatchException, FunctionDomainException, NameResolutionException,
QueryInvocationTargetException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@
*/
package com.gemstone.gemfire.internal;

import com.gemstone.gemfire.GemFireIOException;
import com.gemstone.gemfire.InternalGemFireException;
import com.gemstone.gemfire.StatisticDescriptor;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
import com.gemstone.gemfire.internal.statistics.ResourceInstance;
import com.gemstone.gemfire.internal.statistics.ResourceType;
import com.gemstone.gemfire.internal.statistics.SampleHandler;
import com.gemstone.gemfire.internal.statistics.StatArchiveDescriptor;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

import java.io.BufferedOutputStream;
import java.io.DataInput;
import java.io.DataOutput;
Expand All @@ -49,6 +36,17 @@

import org.apache.logging.log4j.Logger;

import com.gemstone.gemfire.GemFireIOException;
import com.gemstone.gemfire.InternalGemFireException;
import com.gemstone.gemfire.StatisticDescriptor;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
import com.gemstone.gemfire.internal.statistics.ResourceInstance;
import com.gemstone.gemfire.internal.statistics.ResourceType;
import com.gemstone.gemfire.internal.statistics.SampleHandler;
import com.gemstone.gemfire.internal.statistics.StatArchiveDescriptor;

/**
* StatArchiveWriter provides APIs to write statistic snapshots to an archive
* file.
Expand Down Expand Up @@ -168,7 +166,7 @@ public final void close() {
}
}

@SuppressFBWarnings(value="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification="Best effort attempt to delete a GFS file without any samples.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="RV_RETURN_VALUE_IGNORED_BAD_PRACTICE", justification="Best effort attempt to delete a GFS file without any samples.")
private static void deleteFileIfPossible(File file) {
file.delete();
}
Expand Down Expand Up @@ -288,7 +286,7 @@ public void allocatedResourceType(ResourceType resourceType) {
}
}

@SuppressFBWarnings(value="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification="This is only for debugging and there is never more than one instance being traced because there is only one stat sampler.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification="This is only for debugging and there is never more than one instance being traced because there is only one stat sampler.")
public void allocatedResourceInstance(ResourceInstance statResource) {
if (logger.isTraceEnabled(LogMarker.STATISTICS)) {
logger.trace(LogMarker.STATISTICS, "StatArchiveWriter#allocatedResourceInstance statResource={}", statResource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@
import com.gemstone.gemfire.internal.logging.log4j.LogMarker;
import com.gemstone.gemfire.internal.util.DelayedAction;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Common code for both UpdateOperation and DistributedPutAllOperation.
*
Expand All @@ -57,7 +55,7 @@ public abstract class AbstractUpdateOperation extends DistributedCacheOperation

public static volatile boolean test_InvalidVersion;

@SuppressFBWarnings(value="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
justification="test hook that is unset normally")
public static volatile DelayedAction test_InvalidVersionAction;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* @author mthomas
*
Expand Down Expand Up @@ -570,7 +568,7 @@ public boolean containsKey(KeyInfo keyInfo, LocalRegion localRegion) {
/* (non-Javadoc)
* @see com.gemstone.gemfire.internal.cache.InternalDataView#entryCount(com.gemstone.gemfire.internal.cache.LocalRegion)
*/
@SuppressFBWarnings(value="UL_UNRELEASED_LOCK", justification="This method unlocks and then conditionally undoes the unlock in the finally-block. Review again at later time.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UL_UNRELEASED_LOCK", justification="This method unlocks and then conditionally undoes the unlock in the finally-block. Review again at later time.")
public int entryCount(LocalRegion localRegion) {
// if size is the first operation in the transaction, then reset the txState
boolean resetTXState = this.realDeal == null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,6 @@
import com.gemstone.gemfire.internal.tcp.ConnectionTable;
import com.gemstone.gemfire.internal.util.ArrayUtils;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* Implements the acceptor thread on the bridge server. Accepts connections from
* the edge and starts up threads to process requests from these.
Expand Down Expand Up @@ -1610,7 +1608,7 @@ public boolean isRunning()
}

@Override
@SuppressFBWarnings(value="REC_CATCH_EXCEPTION", justification="Allow this thread to die")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="REC_CATCH_EXCEPTION", justification="Allow this thread to die")
public void close() {
if (!isRunning()) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,12 @@
import com.gemstone.gemfire.cache.InterestResultPolicy;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionDestroyedException;
import com.gemstone.gemfire.cache.TransactionDataNodeHasDepartedException;
import com.gemstone.gemfire.cache.TransactionDataRebalancedException;
import com.gemstone.gemfire.cache.TransactionException;
import com.gemstone.gemfire.cache.operations.QueryOperationContext;
import com.gemstone.gemfire.cache.persistence.PartitionOfflineException;
import com.gemstone.gemfire.cache.query.Query;
import com.gemstone.gemfire.cache.query.QueryException;
import com.gemstone.gemfire.cache.query.QueryInvalidException;
import com.gemstone.gemfire.cache.query.SelectResults;
import com.gemstone.gemfire.cache.query.Struct;
import com.gemstone.gemfire.cache.query.internal.CqEntry;
import com.gemstone.gemfire.cache.query.internal.DefaultQuery;
import com.gemstone.gemfire.cache.query.internal.types.CollectionTypeImpl;
import com.gemstone.gemfire.cache.query.internal.types.StructTypeImpl;
import com.gemstone.gemfire.cache.query.types.CollectionType;
import com.gemstone.gemfire.distributed.DistributedSystemDisconnectedException;
import com.gemstone.gemfire.distributed.internal.DistributionStats;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.i18n.LogWriterI18n;
import com.gemstone.gemfire.internal.Assert;
import com.gemstone.gemfire.internal.Version;
import com.gemstone.gemfire.internal.cache.CachedDeserializable;
Expand All @@ -92,12 +79,9 @@
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
import com.gemstone.gemfire.internal.offheap.OffHeapHelper;
import com.gemstone.gemfire.internal.security.AuthorizeRequestPP;
import com.gemstone.gemfire.internal.sequencelog.EntryLogger;
import com.gemstone.gemfire.security.GemFireSecurityException;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* @author ashahid
*
Expand Down Expand Up @@ -1162,7 +1146,7 @@ private static void handleList(LocalRegion region, List keyList,
* Handles both RR and PR cases
*/
@SuppressWarnings("rawtypes")
@SuppressFBWarnings(value="NP_NULL_PARAM_DEREF", justification="Null value handled in sendNewRegisterInterestResponseChunk()")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="NP_NULL_PARAM_DEREF", justification="Null value handled in sendNewRegisterInterestResponseChunk()")
private static void handleKVSingleton(LocalRegion region, Object entryKey,
boolean serializeValues, ServerConnection servConn)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,12 @@
import com.gemstone.gemfire.internal.Assert;
import com.gemstone.gemfire.internal.DataSerializableFixedID;
import com.gemstone.gemfire.internal.HeapDataOutputStream;
import com.gemstone.gemfire.internal.InternalDataSerializer;
import com.gemstone.gemfire.internal.Version;
import com.gemstone.gemfire.internal.VersionedDataInputStream;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* This class represents a ConnectionProxy of the CacheClient
*
Expand Down Expand Up @@ -484,7 +481,7 @@ public void updateDurableTimeout(int newValue) {
/**
* call this when the distributed system ID has been modified
*/
@SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Only applicable in client DS and in that case too multiple instances do not modify it at the same time.")
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD", justification = "Only applicable in client DS and in that case too multiple instances do not modify it at the same time.")
public void updateID(DistributedMember idm) {
// this.transientPort = ((InternalDistributedMember)this.memberId).getPort();
// if (this.transientPort == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage;
import com.gemstone.gemfire.internal.logging.log4j.LogMarker;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* RegionVersionVector tracks the highest region-level version number of
* operations applied to a region for each member that has the region.<p>
Expand Down Expand Up @@ -296,7 +294,7 @@ private void lockVersionGeneration(final String regionPath, final DM dm, final I
// this could block for a while if a limit has been set on the waiting-thread-pool
dm.getWaitingThreadPool().execute(
new Runnable() {
@SuppressFBWarnings(value={"UL_UNRELEASED_LOCK","IMSE_DONT_CATCH_IMSE"})
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value={"UL_UNRELEASED_LOCK","IMSE_DONT_CATCH_IMSE"})
public void run() {
boolean haveLock = false;
synchronized(clearLockSync) {
Expand Down Expand Up @@ -667,7 +665,7 @@ public void recordVersion(T member, long version) {
* each oplog we recover.
* @param latestOplog
*/
@SuppressFBWarnings(value="ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD",
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="ML_SYNC_ON_FIELD_TO_GUARD_CHANGING_THAT_FIELD",
justification="sync on localExceptions guards concurrent modification but this is a replacement")
public void initRecoveredVersion(T member, RegionVersionHolder<T> v, boolean latestOplog) {
RegionVersionHolder<T> recovered = v.clone();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
import com.gemstone.gemfire.internal.logging.LogService;
import com.gemstone.gemfire.internal.logging.LoggingThreadGroup;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

/**
* AbstractPoolCache implements the ConnectionPoolCache interface. This is base
* class for the all connection pools. The class also implements the
Expand Down Expand Up @@ -88,7 +86,7 @@ public abstract class AbstractPoolCache implements ConnectionPoolCache,
* configuration for the pool.
* @throws PoolException
*/
@SuppressFBWarnings(value="SC_START_IN_CTOR",
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="SC_START_IN_CTOR",
justification="the thread started is a cleanup thread and is not active until there is a timeout tx")
public AbstractPoolCache(EventListener eventListner,
ConfiguredDataSourceProperties configs) throws PoolException {
Expand Down
Loading

0 comments on commit 4d6df30

Please sign in to comment.