Skip to content

Commit

Permalink
Corrections for Sonar violations
Browse files Browse the repository at this point in the history
  • Loading branch information
ajs6f committed Apr 20, 2013
1 parent baf6959 commit 96b8ee5
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 48 deletions.
4 changes: 2 additions & 2 deletions fcrepo-kernel/src/main/java/org/fcrepo/FedoraObject.java
Expand Up @@ -33,14 +33,14 @@
*/
public class FedoraObject extends JcrTools implements FedoraJcrTypes {

private Node node;

/**
* Timer for the time to create/initialize a FedoraObject
*/
final static Timer timer = metrics.timer(name(FedoraObject.class,
"FedoraObject"));

private Node node;

/**
* Construct a FedoraObject from an existing JCR Node
* @param n an existing JCR node to treat as an fcrepo object
Expand Down
Expand Up @@ -13,8 +13,8 @@
*/
public interface PidMinter {

public String mintPid();
String mintPid();

public Function<Object, String> makePid();
Function<Object, String> makePid();

}
Expand Up @@ -7,7 +7,6 @@
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.jcr.LoginException;
import javax.jcr.Node;
import javax.jcr.PathNotFoundException;
import javax.jcr.RepositoryException;
Expand Down Expand Up @@ -48,16 +47,15 @@ public boolean apply(final Event event) {
isFedoraDatastream.apply(resource);

} catch (final PathNotFoundException e) {
return false; // not a node in the fedora workspace
} catch (final LoginException e) {
throw new SystemFailureException(e);
// not a node in the fedora workspace
return false;
} catch (final RepositoryException e) {
throw new SystemFailureException(e);
}
}

@PostConstruct
public void acquireSession() throws LoginException, RepositoryException {
public void acquireSession() throws RepositoryException {
session = repository.login();
}

Expand Down
Expand Up @@ -16,7 +16,7 @@
*/
public class FedoraEvent implements Event {

Event e;
private Event e;

public FedoraEvent(final Event e) {
this.e = e;
Expand Down
Expand Up @@ -36,7 +36,15 @@
*/
public class SimpleObserver implements EventListener {

final private Integer eventTypes = NODE_ADDED + NODE_REMOVED + NODE_MOVED +
static final private Logger logger = getLogger(SimpleObserver.class);

/**
* A simple counter of events that pass through this observer
*/
static final Counter eventCounter = metrics.counter(name(
SimpleObserver.class, "onEvent"));

static final Integer eventTypes = NODE_ADDED + NODE_REMOVED + NODE_MOVED +
PROPERTY_ADDED + PROPERTY_CHANGED + PROPERTY_REMOVED;

@Inject
Expand All @@ -48,14 +56,6 @@ public class SimpleObserver implements EventListener {
@Inject
private EventFilter eventFilter;

static final private Logger logger = getLogger(SimpleObserver.class);

/**
* A simple counter of events that pass through this observer
*/
static final Counter eventCounter = metrics.counter(name(
SimpleObserver.class, "onEvent"));

@PostConstruct
public void buildListener() throws RepositoryException {
final Session session = repository.login();
Expand Down
Expand Up @@ -9,12 +9,10 @@

import javax.jcr.Node;
import javax.jcr.NodeIterator;
import javax.jcr.PathNotFoundException;
import javax.jcr.Property;
import javax.jcr.PropertyIterator;
import javax.jcr.RepositoryException;
import javax.jcr.Value;
import javax.jcr.ValueFormatException;

import org.fcrepo.services.functions.CheckCacheEntryFixity;
import org.fcrepo.utils.FixityResult;
Expand Down Expand Up @@ -64,14 +62,11 @@ private static Long getObjectDSSize(final Node obj)
}

public static Long getDatastreamSize(final Node ds)
throws ValueFormatException, PathNotFoundException,
RepositoryException {
throws RepositoryException {
return getNodePropertySize(ds) + getContentSize(ds);
}

public static Long getContentSize(final Node ds)
throws ValueFormatException, PathNotFoundException,
RepositoryException {
public static Long getContentSize(final Node ds) throws RepositoryException {
return ds.getNode(JCR_CONTENT).getProperty(JCR_DATA).getBinary()
.getSize();
}
Expand Down
Expand Up @@ -15,7 +15,7 @@
public class GetGoodFixityResults implements
Function<Collection<FixityResult>, Set<FixityResult>> {

IsGoodFixity predicate = new IsGoodFixity();
private IsGoodFixity predicate = new IsGoodFixity();

public boolean isGood(final FixityResult input) {
return predicate.apply(input);
Expand Down
Expand Up @@ -7,7 +7,7 @@

public class EventIterator implements Iterator<Event>, Iterable<Event> {

javax.jcr.observation.EventIterator i;
private javax.jcr.observation.EventIterator i;

public EventIterator(final javax.jcr.observation.EventIterator i) {
this.i = i;
Expand Down
8 changes: 4 additions & 4 deletions fcrepo-kernel/src/main/java/org/fcrepo/utils/EventType.java
Expand Up @@ -27,8 +27,8 @@ public static EventType getEventType(final Integer i) {
return NODE_MOVED;
case 0x40:
return PERSIST;

default: // no default
// no default
default:
throw new IllegalArgumentException("Invalid JCR event type: " +
i);
}
Expand All @@ -55,8 +55,8 @@ public static String getEventName(final Integer jcrEvent) {
return "node moved";
case PERSIST:
return "persist";

default: // no default
// no default
default:
throw new IllegalArgumentException("Invalid JCR event type: " +
jcrEvent);
}
Expand Down
28 changes: 14 additions & 14 deletions fcrepo-kernel/src/main/java/org/fcrepo/utils/FedoraJcrTypes.java
Expand Up @@ -9,32 +9,32 @@
*/
public interface FedoraJcrTypes {

public static final String FEDORA_DATASTREAM = "fedora:datastream";
static final String FEDORA_DATASTREAM = "fedora:datastream";

public static final String FEDORA_OBJECT = "fedora:object";
static final String FEDORA_OBJECT = "fedora:object";

public static final String FEDORA_SIZE = "fedora:size";
static final String FEDORA_SIZE = "fedora:size";

public static final String FEDORA_OWNED = "fedora:owned";
static final String FEDORA_OWNED = "fedora:owned";

public static final String FEDORA_OWNERID = "fedora:ownerId";
static final String FEDORA_OWNERID = "fedora:ownerId";

public static final String DC_TITLE = "dc:title";
static final String DC_TITLE = "dc:title";

public static final String DC_IDENTIFIER = "dc:identifier";
static final String DC_IDENTIFIER = "dc:identifier";

public static final String JCR_LASTMODIFIED = "jcr:lastModified";
static final String JCR_LASTMODIFIED = "jcr:lastModified";

public static final String JCR_CREATED = "jcr:created";
static final String JCR_CREATED = "jcr:created";

public static final String FEDORA_CHECKSUM = "fedora:checksum";
static final String FEDORA_CHECKSUM = "fedora:checksum";

public static final String CONTENT_SIZE = "fedora:size";
static final String CONTENT_SIZE = "fedora:size";

public static final String DIGEST_VALUE = "fedora:digest";
static final String DIGEST_VALUE = "fedora:digest";

public static final String DIGEST_ALGORITHM = "fedora:digestAlgorithm";
static final String DIGEST_ALGORITHM = "fedora:digestAlgorithm";

public static final String FEDORA_CONTENTTYPE = "fedora:contentType";
static final String FEDORA_CONTENTTYPE = "fedora:contentType";

}
Expand Up @@ -8,7 +8,7 @@

public class FedoraPropertyIterator implements Iterator<Property> {

PropertyIterator i;
private PropertyIterator i;

public FedoraPropertyIterator(final PropertyIterator i) {
this.i = i;
Expand Down
Expand Up @@ -7,7 +7,7 @@

public class NodeIterator implements Iterator<Node> {

javax.jcr.NodeIterator i;
private javax.jcr.NodeIterator i;

public NodeIterator(final javax.jcr.NodeIterator i) {
this.i = i;
Expand Down

0 comments on commit 96b8ee5

Please sign in to comment.