Skip to content

Commit

Permalink
Merge pull request #1051 from DevFactory/release/Utility-classes-shou…
Browse files Browse the repository at this point in the history
…ld-not-have-public-constructors-fix-1

squid:S1118 - Utility classes should not have public constructors
  • Loading branch information
Turini committed Feb 19, 2016
2 parents f190df1 + ee025d1 commit 2470707
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package br.com.caelum.vraptor.observer.download;

import com.thoughtworks.xstream.InitializationException;

import static com.google.common.base.Objects.firstNonNull;
import static java.util.Objects.requireNonNull;

Expand All @@ -20,6 +22,10 @@
@Vetoed
public final class DownloadBuilder {

private DownloadBuilder () {
throw new InitializationException("Not allowed to initialize");
}

/**
* Creates an instance for build a {@link FileDownload}.<br>
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import javax.enterprise.inject.Vetoed;

import com.thoughtworks.xstream.InitializationException;
import org.jboss.weld.bean.proxy.ProxyObject;
import org.jboss.weld.interceptor.util.proxy.TargetInstanceProxy;

Expand All @@ -30,6 +31,9 @@
*/
@Vetoed
public final class CDIProxies {
private CDIProxies(){
throw new InitializationException("Not allowed to initialize");
}

public static boolean isCDIProxy(Class<?> type) {
return ProxyObject.class.isAssignableFrom(type);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package br.com.caelum.vraptor.util;

import com.thoughtworks.xstream.InitializationException;

import java.util.ArrayList;
import java.util.List;

Expand All @@ -28,8 +30,11 @@
* @author Lucas Cavalcanti
*/
@Vetoed
public class StringUtils {
public final class StringUtils {

private StringUtils(){
throw new InitializationException("Not allowed to initialize");
}
public static String decapitalize(String name) {
if (name.length() == 1) {
return name.toLowerCase();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,19 @@
import br.com.caelum.vraptor.serialization.JSONSerialization;
import br.com.caelum.vraptor.serialization.RepresentationResult;
import br.com.caelum.vraptor.serialization.XMLSerialization;
import com.thoughtworks.xstream.InitializationException;

/**
* Some common results for most web based logics.
*
* @author Guilherme Silveira
*/
@Vetoed
public class Results {
public final class Results {

private Results(){
throw new InitializationException("Not allowed to initialize");
}
/**
* Offers server side forward and include for web pages.<br>
* Should be used only with end results (not logics), otherwise you might
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Collections;
import java.util.ResourceBundle;

import com.thoughtworks.xstream.InitializationException;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
Expand All @@ -32,7 +33,11 @@
import br.com.caelum.vraptor.http.route.Route;
import br.com.caelum.vraptor.validator.Message;

public class VRaptorMatchers {
public final class VRaptorMatchers {
private VRaptorMatchers(){
throw new InitializationException("Not allowed to initialize");
}

public static Matcher<Collection<?>> hasOneCopyOf(final Object item) {
return new TypeSafeMatcher<Collection<?>>(){

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import java.lang.reflect.Method;

import com.thoughtworks.xstream.InitializationException;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
Expand All @@ -33,8 +34,10 @@
*
* @author Guilherme Silveira
*/
public class VRaptorMatchers {

public final class VRaptorMatchers {
private VRaptorMatchers(){
throw new InitializationException("Not allowed to initialize");
}
public static TypeSafeMatcher<ControllerMethod> controllerMethod(final Method method) {
return new TypeSafeMatcher<ControllerMethod>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@
package br.com.caelum.vraptor.ioc.fixture;

import br.com.caelum.vraptor.Result;
import com.thoughtworks.xstream.InitializationException;

public class HasConstructor {
public final class HasConstructor {
private HasConstructor(){
throw new InitializationException("Not allowed to initialize");
}

public HasConstructor(Result result) {
}
Expand Down

0 comments on commit 2470707

Please sign in to comment.