Skip to content

Commit

Permalink
Reduce Sonar major issues - "Static Variable Name" and "Avoid comment…
Browse files Browse the repository at this point in the history
…ed-out lines of code"

Resolves: https://jira.duraspace.org/browse/FCREPO-1332
  • Loading branch information
yinlinchen authored and Andrew Woods committed Feb 19, 2015
1 parent 3fa9652 commit 9ab07de
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
Expand Up @@ -41,10 +41,10 @@
public final class ServletContainerAuthenticationProvider implements
AuthenticationProvider {

private static ServletContainerAuthenticationProvider _instance = null;
private static ServletContainerAuthenticationProvider instance = null;

private ServletContainerAuthenticationProvider() {
_instance = this;
instance = this;
}

public static final String EVERYONE_NAME = "EVERYONE";
Expand Down Expand Up @@ -90,12 +90,12 @@ public String toString() {
* @return a AuthenticationProvider
*/
public static synchronized AuthenticationProvider getInstance() {
if (_instance != null) {
return _instance;
if (instance != null) {
return instance;
}
_instance = new ServletContainerAuthenticationProvider();
instance = new ServletContainerAuthenticationProvider();
LOGGER.warn("Security is MINIMAL, no Policy Enforcement Point configured.");
return _instance;
return instance;
}

/**
Expand Down
Expand Up @@ -136,7 +136,7 @@ public abstract class ContentExposingResource extends FedoraBaseResource {

protected FedoraResource resource;

private static long MAX_BUFFER_SIZE = 10240000;
private static final long MAX_BUFFER_SIZE = 10240000;

protected abstract String externalPath();

Expand Down Expand Up @@ -342,13 +342,12 @@ protected Response getBinaryContent(final String rangeValue)
builder = status(REQUESTED_RANGE_NOT_SATISFIABLE)
.header("Content-Range", contentRangeValue);
} else {
final long maxBufferSize = MAX_BUFFER_SIZE; // 10MB max buffer size?
final long rangeStart = range.start();
final long rangeSize = range.size() == -1 ? contentSize - rangeStart : range.size();
final long remainingBytes = contentSize - rangeStart;
final long bufSize = rangeSize < remainingBytes ? rangeSize : remainingBytes;

if (bufSize < maxBufferSize) {
if (bufSize < MAX_BUFFER_SIZE) {
// Small size range content retrieval use javax.jcr.Binary to improve performance
final byte[] buf = new byte[(int) bufSize];

Expand Down
Expand Up @@ -28,7 +28,6 @@
import org.fcrepo.kernel.services.BinaryService;
import org.fcrepo.kernel.services.NodeService;
import org.fcrepo.kernel.services.ContainerService;
//import org.fcrepo.kernel.services.RepositoryService;
import org.fcrepo.kernel.services.VersionService;
import org.jvnet.hk2.annotations.Optional;
import org.slf4j.bridge.SLF4JBridgeHandler;
Expand Down
Expand Up @@ -66,7 +66,7 @@ public class PropertyDefinitionToTriples extends ItemDefinitionToTriples<Propert
/**
* A JCR type for which we know no RDF equivalent.
*/
private static Node UNMAPPED_TYPE = createURI(REPOSITORY_NAMESPACE
private static final Node UNMAPPED_TYPE = createURI(REPOSITORY_NAMESPACE
+ "UnmappedType");

/**
Expand Down Expand Up @@ -141,4 +141,4 @@ private static Node getRangeForJcrType(final int requiredType) {
? createURI(JCR_TYPE_TO_XSD_DATATYPE.get(requiredType).getURI())
: UNMAPPED_TYPE;
}
}
}

0 comments on commit 9ab07de

Please sign in to comment.