Skip to content

Commit

Permalink
[#noissue] fix findbug issue
Browse files Browse the repository at this point in the history
  • Loading branch information
emeroad committed Sep 21, 2017
1 parent ce3c64c commit 499e012
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ public class DefaultMultiClassBasedMatcher implements MultiClassBasedMatcher {
}
this.baseClassNames = baseClassNames;

this.matcherOperand = getMatcherOperand(additional);
this.matcherOperand = getMatcherOperand(baseClassNames, additional);
}

private MatcherOperand getMatcherOperand(MatcherOperand additional) {
MatcherOperand operand = joinOr();
private MatcherOperand getMatcherOperand(List<String> baseClassNames, MatcherOperand additional) {
MatcherOperand operand = joinOr(baseClassNames);
if (operand == null) {
throw new IllegalStateException("operand is null");
}
if (additional == null) {
return operand;
}
Expand All @@ -53,9 +56,9 @@ private MatcherOperand getMatcherOperand(MatcherOperand additional) {
return operand;
}

private MatcherOperand joinOr() {
private MatcherOperand joinOr(List<String> baseClassNames) {
MatcherOperand operand = null;
for (String baseClassName : this.baseClassNames) {
for (String baseClassName : baseClassNames) {
if (operand == null) {
operand = new ClassInternalNameMatcherOperand(baseClassName);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public class DefaultMultiPackageBasedMatcher implements MultiPackageBasedMatcher

final List<String> buildBasePackageName = buildBasePackageNameList(basePackageNames);
final MatcherOperand operand = joinOr(buildBasePackageName);
if (operand == null) {
throw new IllegalStateException("operand is null");
}
this.matcherOperand = addOr(operand, additional);

this.basePackageNames = Collections.unmodifiableList(buildBasePackageName);
Expand All @@ -60,7 +63,7 @@ private MatcherOperand addOr(MatcherOperand operand, MatcherOperand additional)

private MatcherOperand joinOr(List<String> basePackageNames) {
if (basePackageNames.isEmpty()) {
throw new IllegalArgumentException("basePackageNames must not be empty " + basePackageNames);
throw new IllegalArgumentException("basePackageNames must not be empty ");
}

MatcherOperand operandGroup = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;

import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Properties;

/**
Expand Down Expand Up @@ -176,8 +176,8 @@ public void readConfigFile() {

@Override
public void afterPropertiesSet() throws Exception {
Assert.notNull(properties);
readPropertyValues(this.properties);
final Properties properties = Objects.requireNonNull(this.properties, "properties must not be null");
readPropertyValues(properties);
}

protected void readPropertyValues(Properties properties) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ protected boolean check(InetSocketAddress address, byte[] requestData, byte[] ex
}

private Socket createSocket(InetSocketAddress socketAddress) throws IOException {
final Socket socket = new Socket();

Socket socket = null;
boolean success = false;
try {
socket = new Socket();
socket.setSoTimeout(3000);
socket.connect(socketAddress);
success = true;
Expand Down

0 comments on commit 499e012

Please sign in to comment.