@@ -182,11 +182,11 @@ public static Patch parseUnifiedDiff(List<String> diff) {
182182 */
183183 public static List <String > generateUnifiedDiff (String original , String revised ,
184184 List <String > originalLines , Patch patch , int contextSize ) {
185- List <String > ret = new ArrayList <String >();
186- ret .add ("--- " + original );
187- ret .add ("+++ " + revised );
188-
189185 if (!patch .getDeltas ().isEmpty ()) {
186+ List <String > ret = new ArrayList <String >();
187+ ret .add ("--- " + original );
188+ ret .add ("+++ " + revised );
189+
190190 List <Delta > patchDeltas = new ArrayList <Delta >(patch .getDeltas ());
191191
192192 // code outside the if block also works for single-delta issues.
@@ -220,8 +220,9 @@ public static List<String> generateUnifiedDiff(String original, String revised,
220220 // don't forget to process the last set of Deltas
221221 List <String > curBlock = processDeltas (originalLines , deltas , contextSize );
222222 ret .addAll (curBlock );
223+ return ret ;
223224 }
224- return ret ;
225+ return new ArrayList < String >() ;
225226 }
226227
227228 /**
@@ -260,7 +261,7 @@ private static List<String> processDeltas(List<String> origLines, List<Delta> de
260261 }
261262
262263 // output the context before the first Delta
263- for (line = contextStart ; line < curDelta .getOriginal ().getPosition (); line ++) { //
264+ for (line = contextStart ; line < curDelta .getOriginal ().getPosition (); line ++) { //
264265 buffer .add (" " + origLines .get (line ));
265266 origTotal ++;
266267 revTotal ++;
0 commit comments