File tree 1 file changed +9
-3
lines changed
src/org/opensolaris/opengrok/web
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ public DiffData getDiffData() {
189
189
if (data .genre == null || txtGenres .contains (data .genre )) {
190
190
InputStream [] in = new InputStream [2 ];
191
191
try {
192
+ // Get input stream for both older and newer file.
192
193
for (int i = 0 ; i < 2 ; i ++) {
193
194
File f = new File (srcRoot + filepath [i ]);
194
195
in [i ] = HistoryGuru .getInstance ().getRevision (f .getParent (), f .getName (), data .rev [i ]);
@@ -200,12 +201,17 @@ public DiffData getDiffData() {
200
201
}
201
202
}
202
203
203
- if (data .genre == null ) {
204
+ /*
205
+ * If the genre of the older revision cannot be determined,
206
+ * (this can happen if the file was empty), try with newer
207
+ * version.
208
+ */
209
+ for (int i = 0 ; i < 2 && data .genre == null ; i ++) {
204
210
try {
205
- data .genre = AnalyzerGuru .getGenre (in [0 ]);
211
+ data .genre = AnalyzerGuru .getGenre (in [i ]);
206
212
} catch (IOException e ) {
207
213
data .errorMsg = "Unable to determine the file type: "
208
- + Util .htmlize (e .getMessage ());
214
+ + Util .htmlize (e .getMessage ());
209
215
}
210
216
}
211
217
You can’t perform that action at this time.
0 commit comments