@Override
public final void stop(BundleContext bundleContext) throws Exception {
- tracker.close();
+ if (tracker != null) {
+ tracker.close();
+ }
stopImpl(bundleContext);
}
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
}
@Override
+ @SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public NormalizedNode<?, ?> createDefault(final PathArgument currentArg) {
final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> builder = Builders
.mapEntryBuilder().withNodeIdentifier((NodeIdentifierWithPredicates) currentArg);
}
@Override
+ @SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public NormalizedNode<?, ?> createDefault(final PathArgument currentArg) {
return Builders.unkeyedListEntryBuilder().withNodeIdentifier((NodeIdentifier) currentArg).build();
}
}
@Override
+ @SuppressFBWarnings("BC_UNCONFIRMED_CAST")
public NormalizedNode<?, ?> createDefault(final PathArgument currentArg) {
return Builders.containerBuilder().withNodeIdentifier((NodeIdentifier) currentArg).build();
}
private static final Logger LOG = LoggerFactory.getLogger(AbstractMXBean.class);
- public static String BASE_JMX_PREFIX = "org.opendaylight.controller:";
+ public static final String BASE_JMX_PREFIX = "org.opendaylight.controller:";
private final MBeanServer server = ManagementFactory.getPlatformMBeanServer();
package org.opendaylight.controller.sal.common.util;
import com.google.common.collect.ImmutableList;
-import java.io.Serializable;
import java.util.Collection;
import org.opendaylight.yangtools.concepts.Immutable;
import org.opendaylight.yangtools.yang.common.RpcError;
return new RpcResultTO<>(successful, null, errors);
}
- private static class RpcResultTO<T> implements RpcResult<T>, Serializable, Immutable {
- private static final long serialVersionUID = 1L;
+ private static class RpcResultTO<T> implements RpcResult<T>, Immutable {
private final Collection<RpcError> errors;
private final T result;
private final boolean successful;
*/
package org.opendaylight.controller.md.sal.dom.api;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
+
/**
* Interface for a DOM commit cohort registry.
*
* @author Thomas Pantelis
*/
+@SuppressFBWarnings("NM_SAME_SIMPLE_NAME_AS_INTERFACE")
public interface DOMDataTreeCommitCohortRegistry extends DOMDataBrokerExtension,
org.opendaylight.mdsal.dom.api.DOMDataTreeCommitCohortRegistry {
}
final int prime = 31;
int result = 1;
result = prime * result + type.hashCode();
- result = prime * result + (getContextReference() == null ? 0 : getContextReference().hashCode());
+ result = prime * result + getContextReference().hashCode();
return result;
}
tracker.open();
}
-
-
@Override
public final void stop(final BundleContext bundleContext) throws Exception {
stopImpl(bundleContext);
broker = null;
- tracker.close();
+
+ if (tracker != null) {
+ tracker.close();
+ }
}
protected void startImpl(final BundleContext bundleContext) {
@Override
public Broker addingService(final ServiceReference<Broker> reference) {
- if (broker == null) {
+ if (broker == null && context != null) {
broker = context.getService(reference);
broker.registerConsumer(this, context);
return broker;
@Override
public final void stop(final BundleContext bundleContext) throws Exception {
broker = null;
- tracker.close();
+
+ if (tracker != null) {
+ tracker.close();
+ }
+
tracker = null;
stopImpl(bundleContext);
}
@Override
public Broker addingService(final ServiceReference<Broker> reference) {
- if (broker == null) {
+ if (broker == null && context != null) {
broker = context.getService(reference);
broker.registerProvider(this, context);
return broker;
import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collection;
@Beta
public final class DefaultDOMRpcResult implements DOMRpcResult, Immutable, Serializable {
private static final long serialVersionUID = 1L;
+
+ // Flagged as "Non-transient non-serializable instance field" - the Collection is Serializable but the RpcError
+ // interface isn't. In lieu of changing the interface, we assume the implementation is Serializable which is
+ // reasonable since the only implementation that is actually used is from the RpcResultBuilder.
+ @SuppressFBWarnings("SE_BAD_FIELD")
private final Collection<RpcError> errors;
+
+ // Unfortunately the NormalizedNode interface isn't Serializable but we assume the implementations are.
+ @SuppressFBWarnings("SE_BAD_FIELD")
private final NormalizedNode<?, ?> result;
private static Collection<RpcError> asCollection(final RpcError... errors) {
private final Set<YangInstanceIdentifier> removed = new HashSet<>();
private Builder(final DataChangeScope scope) {
- Preconditions.checkNotNull(scope, "Data change scope should not be null.");
- this.scope = scope;
+ this.scope = Preconditions.checkNotNull(scope, "Data change scope should not be null.");
}
public Builder setAfter(final NormalizedNode<?, ?> node) {
(listener, notification) -> {
final AsyncDataChangeListener<YangInstanceIdentifier, NormalizedNode<?, ?>> inst =
listener.getInstance();
- if (inst != null) {
- inst.onDataChanged(notification);
- }
+ inst.onDataChanged(notification);
};
private final DataTree dataTree;
private static final Invoker<AbstractDOMDataTreeChangeListenerRegistration<?>, DataTreeCandidate> MANAGER_INVOKER =
(listener, notification) -> {
// FIXME: this is inefficient, as we could grab the entire queue for the listener and post it
- final DOMDataTreeChangeListener inst = listener.getInstance();
- if (inst != null) {
- inst.onDataTreeChanged(Collections.singletonList(notification));
- }
+ listener.getInstance().onDataTreeChanged(Collections.singletonList(notification));
};
private static final Logger LOG = LoggerFactory.getLogger(InMemoryDOMStoreTreeChangePublisher.class);
@Override
public boolean equals(final Object obj) {
- return delegate.equals(obj);
+ if (obj == null || getClass() != obj.getClass()) {
+ return false;
+ }
+
+ return delegate.equals(((ListenerNode)obj).delegate);
}
@Override