Skip to content

Commit

Permalink
Polishes how error messages are displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszlenart committed Nov 12, 2014
1 parent eeab265 commit 266f83f
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -430,14 +430,14 @@ protected boolean isAccepted(String paramName) {
if (result.isAccepted()) {
return true;
}
notifyDeveloper("Parameter [#0] didn't match accepted pattern [#1]!", paramName, String.valueOf(result.getAcceptedPattern()));
notifyDeveloper("Parameter [#0] didn't match accepted pattern [#1]!", paramName, result.getAcceptedPattern());
return false;
}

protected boolean isExcluded(String paramName) {
ExcludedPatternsChecker.IsExcluded result = excludedPatterns.isExcluded(paramName);
if (result.isExcluded()) {
notifyDeveloper("Parameter [#0] matches excluded pattern [#1]!", paramName, String.valueOf(result.getExcludedPattern()));
notifyDeveloper("Parameter [#0] matches excluded pattern [#1]!", paramName, result.getExcludedPattern());
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ public interface AcceptedPatternsChecker {
public final static class IsAccepted {

private final boolean accepted;
private final Pattern acceptedPattern;
private final String acceptedPattern;

public static IsAccepted yes(Pattern acceptedPattern) {
public static IsAccepted yes(String acceptedPattern) {
return new IsAccepted(true, acceptedPattern);
}

public static IsAccepted no() {
return new IsAccepted(false, null);
public static IsAccepted no(String acceptedPatterns) {
return new IsAccepted(false, acceptedPatterns);
}

private IsAccepted(boolean accepted, Pattern acceptedPattern) {
private IsAccepted(boolean accepted, String acceptedPattern) {
this.accepted = accepted;
this.acceptedPattern = acceptedPattern;
}
Expand All @@ -66,7 +66,7 @@ public boolean isAccepted() {
return accepted;
}

public Pattern getAcceptedPattern() {
public String getAcceptedPattern() {
return acceptedPattern;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ public IsAccepted isAccepted(String value) {
if (LOG.isTraceEnabled()) {
LOG.trace("[#0] matches accepted pattern [#1]", value, acceptedPattern);
}
return IsAccepted.yes(acceptedPattern);
return IsAccepted.yes(acceptedPattern.toString());
}
}
return IsAccepted.no();
return IsAccepted.no(acceptedPatterns.toString());
}

public Set<Pattern> getAcceptedPatterns() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public IsExcluded isExcluded(String value) {
return IsExcluded.yes(excludedPattern);
}
}
return IsExcluded.no();
return IsExcluded.no(excludedPatterns);
}

public Set<Pattern> getExcludedPatterns() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,17 @@ public interface ExcludedPatternsChecker {
public final static class IsExcluded {

private final boolean excluded;
private final Pattern excludedPattern;
private final String excludedPattern;

public static IsExcluded yes(Pattern excludedPattern) {
return new IsExcluded(true, excludedPattern);
return new IsExcluded(true, excludedPattern.pattern());
}

public static IsExcluded no() {
return new IsExcluded(false, null);
public static IsExcluded no(Set<Pattern> excludedPatterns) {
return new IsExcluded(false, excludedPatterns.toString());
}

private IsExcluded(boolean excluded, Pattern excludedPattern) {
private IsExcluded(boolean excluded, String excludedPattern) {
this.excluded = excluded;
this.excludedPattern = excludedPattern;
}
Expand All @@ -66,7 +66,7 @@ public boolean isExcluded() {
return excluded;
}

public Pattern getExcludedPattern() {
public String getExcludedPattern() {
return excludedPattern;
}

Expand Down

0 comments on commit 266f83f

Please sign in to comment.