This repository was archived by the owner on Nov 12, 2019. It is now read-only.
File tree 2 files changed +13
-5
lines changed
2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -185,12 +185,16 @@ private DiffRowGenerator(Builder builder) {
185
185
columnWidth = builder .columnWidth ; //
186
186
defaultString = builder .defaultString ;
187
187
equalizer = new Equalizer <String >() {
188
- public boolean equals (String original , String revised ) {
188
+ public boolean equals (@ Nullable String original , @ Nullable String revised ) {
189
189
if (ignoreWhiteSpaces ) {
190
- original = original .trim ().replaceAll ("\\ s+" , " " );
191
- revised = revised .trim ().replaceAll ("\\ s+" , " " );
190
+ if (original != null ) {
191
+ original = original .trim ().replaceAll ("\\ s+" , " " );
192
+ }
193
+ if (revised != null ) {
194
+ revised = revised .trim ().replaceAll ("\\ s+" , " " );
195
+ }
192
196
}
193
- return original .equals (revised );
197
+ return Objects .equals (original , revised );
194
198
}
195
199
};
196
200
}
Original file line number Diff line number Diff line change 1
1
package difflib .myers ;
2
2
3
+ import javax .annotation .CheckReturnValue ;
4
+ import javax .annotation .Nullable ;
5
+
3
6
/**
4
7
* Specifies when two compared elements in the Myers algorithm are equal.
5
8
*
@@ -13,5 +16,6 @@ public interface Equalizer<T> {
13
16
* @param revised The revised element. Must not be {@code null}.
14
17
* @return Returns true if the elements are equal.
15
18
*/
16
- public boolean equals (T original , T revised );
19
+ @ CheckReturnValue
20
+ public boolean equals (@ Nullable T original , @ Nullable T revised );
17
21
}
You can’t perform that action at this time.
0 commit comments