Skip to content

Commit

Permalink
Add back field fCause, initialize and use in the constructor (via ini…
Browse files Browse the repository at this point in the history
…tCause()) to avoid npe and unused field warnings, respectively

Issue junit-team#1178, junit-team#976
  • Loading branch information
aishahalim committed May 31, 2016
1 parent 7f2569f commit dffb662
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/junit/internal/ArrayComparisonFailure.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ public class ArrayComparisonFailure extends AssertionError {

/*
* We have to use the f prefix until the next major release to ensure
* serialization compatibility.
* serialization compatibility.
* See https://github.com/junit-team/junit4/issues/976
*/
private final List<Integer> fIndices = new ArrayList<Integer>();
private final String fMessage;
private final AssertionError fCause;

/**
* Construct a new <code>ArrayComparisonFailure</code> with an error text and the array's
Expand All @@ -32,7 +33,8 @@ public class ArrayComparisonFailure extends AssertionError {
*/
public ArrayComparisonFailure(String message, AssertionError cause, int index) {
this.fMessage = message;
initCause(cause);
this.fCause = cause;
initCause(fCause);
addDimension(index);
}

Expand Down

0 comments on commit dffb662

Please sign in to comment.