Skip to content

Commit

Permalink
#26 - manage the case where the file is not specified
Browse files Browse the repository at this point in the history
Signed-off-by: Clement Escoffier <[email protected]>
  • Loading branch information
cescoffier committed Jun 3, 2014
1 parent ca5ab24 commit 469101b
Showing 1 changed file with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,10 @@ private Result renderPipelineError(File error) throws IOException {
ObjectNode node = (ObjectNode) json.parse(content);

String message = node.get("message").asText();
String file = node.get("file").asText();
String file = null;
if (node.get("file") != null) {
file = node.get("file").asText();
}
String watcher = node.get("watcher").asText();
int line = -1;
int character = -1;
Expand All @@ -268,11 +271,15 @@ private Result renderPipelineError(File error) throws IOException {

String fileContent = "";
InterestingLines lines = null;
File source = new File(file);
if (source.isFile()) {
fileContent = FileUtils.readFileToString(source);
if (line != -1 && line != 0) {
lines = extractInterestedLines(fileContent, line, 4);

File source = null;
if (file != null) {
source = new File(file);
if (source.isFile()) {
fileContent = FileUtils.readFileToString(source);
if (line != -1 && line != 0) {
lines = extractInterestedLines(fileContent, line, 4);
}
}
}

Expand Down

0 comments on commit 469101b

Please sign in to comment.