Improved: Fix some bugs Spotbugs reports (OFBIZ-12386)
In GitHubEvents::gitHubRedirect and LinkedInEvents::linkedInRedirect random object created and used only once. Fixes a typo for MESSAGE_LABLES Adds a FIXME in OFBizCasAuthenticationHandler::OFBizCasAuthenticationHandler. It's only an "empty" constructor supposed to "initializes some required member variables". I see nothing happening here and it's never called, remove it?
This commit is contained in:
@@ -55,8 +55,7 @@ public final class OFBizCasAuthenticationHandler extends AbstractOFBizAuthentica
|
||||
/**
|
||||
* Public constructor, initializes some required member variables.<p>
|
||||
*/
|
||||
public OFBizCasAuthenticationHandler() {
|
||||
|
||||
public OFBizCasAuthenticationHandler() { // FIXME: I see nothing happening here and it's never called, remove it?
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -76,6 +76,8 @@ public class GitHubEvents {
|
||||
private static final String TOKEN_END_POINT = "https://github.com";
|
||||
private static final String SESSION_GITHUB_STATE = "_GITHUB_STATE_";
|
||||
|
||||
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
|
||||
|
||||
public static final String ENV_PREFIX = UtilProperties.getPropertyValue(GitHubAuthenticator.PROPS, "github.env.prefix", "test");
|
||||
|
||||
public static String getApiEndPoint() {
|
||||
@@ -97,11 +99,10 @@ public class GitHubEvents {
|
||||
}
|
||||
String clientId = oauth2GitHub.getString(PassportUtil.COMMON_CLIENT_ID);
|
||||
String returnURI = oauth2GitHub.getString(PassportUtil.COMMON_RETURN_RUL);
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
|
||||
// Get user authorization code
|
||||
try {
|
||||
String state = System.currentTimeMillis() + String.valueOf((secureRandom.nextLong()));
|
||||
String state = System.currentTimeMillis() + String.valueOf((SECURE_RANDOM.nextLong()));
|
||||
request.getSession().setAttribute(SESSION_GITHUB_STATE, state);
|
||||
String redirectUrl = TOKEN_END_POINT + AUTHORIZE_URI
|
||||
+ "?client_id=" + clientId
|
||||
|
||||
@@ -79,6 +79,8 @@ public class LinkedInEvents {
|
||||
public static final String SESSION_LINKEDIN_STATE = "_LINKEDIN_STATE_";
|
||||
public static final String ENV_PREFIX = UtilProperties.getPropertyValue(LinkedInAuthenticator.getPROPS(), "linkedin.env.prefix", "test");
|
||||
|
||||
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
|
||||
|
||||
/**
|
||||
* Redirect to LinkedIn login page.
|
||||
* @return string "success" or "error"
|
||||
@@ -93,9 +95,8 @@ public class LinkedInEvents {
|
||||
String returnURI = oauth2LinkedIn.getString(ENV_PREFIX + PassportUtil.RETURN_URL_LABEL);
|
||||
|
||||
// Get user authorization code
|
||||
SecureRandom secureRandom = new SecureRandom();
|
||||
try {
|
||||
String state = System.currentTimeMillis() + String.valueOf((secureRandom.nextLong()));
|
||||
String state = System.currentTimeMillis() + String.valueOf((SECURE_RANDOM.nextLong()));
|
||||
request.getSession().setAttribute(SESSION_LINKEDIN_STATE, state);
|
||||
String redirectUrl = TOKEN_END_POINT + AUTHORIZE_URI
|
||||
+ "?client_id=" + clientId
|
||||
|
||||
@@ -39,9 +39,9 @@ public class SampleHtmlThread extends AbstractReportThread {
|
||||
public static final String COUNT_DOWN = "countdown";
|
||||
public static final String COUNT_UP = "countup";
|
||||
public static final String CONFIRM = "confirm_action";
|
||||
public static final String[] MESSAGE_LABLES = new String[] {"FORMAT_DEFAULT", "FORMAT_WARNING", "FORMAT_HEADLINE", "FORMAT_NOTE",
|
||||
public static final String[] MESSAGE_LABELS = new String[] { "FORMAT_DEFAULT", "FORMAT_WARNING", "FORMAT_HEADLINE", "FORMAT_NOTE",
|
||||
"FORMAT_OK", "FORMAT_ERROR", "FORMAT_THROWABLE"};
|
||||
public static final List<String> MESSAGES = Collections.unmodifiableList(Arrays.asList(MESSAGE_LABLES));
|
||||
public static final List<String> MESSAGES = Collections.unmodifiableList(Arrays.asList(MESSAGE_LABELS));
|
||||
private static final String RESOURCE = "PricatUiLabels";
|
||||
|
||||
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
|
||||
|
||||
Reference in New Issue
Block a user