Skip to content

Commit

Permalink
Fixed issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lishid committed Apr 25, 2014
1 parent eb8a805 commit 399db00
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 5 additions & 1 deletion app/com/linkedin/drelephant/ElephantFetcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ private TaskReport[] getReduceTaskReports(JobID job_id) throws IOException {
}

public JobStatus[] getJobList() throws IOException {
return jobClient.getAllJobs();
JobStatus[] result = jobClient.getAllJobs();
if(result == null) {
throw new IOException("Unable to connect to Jobtracker");
}
return result;
}

public Properties getJobConf(RunningJob job) throws IOException, AuthenticationException {
Expand Down
5 changes: 1 addition & 4 deletions app/com/linkedin/drelephant/ElephantRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ public Void run() {
logger.info("Fetching job list.");
hadoopSecurity.checkLogin();
JobStatus[] jobs = fetcher.getJobList();
if (jobs == null) {
throw new IllegalArgumentException("Jobtracker returned 'null' for job list");
}

Set<JobID> successJobs = filterSuccessfulJobs(jobs);
successJobs = filterPreviousJobs(successJobs, previousJobs);
Expand All @@ -83,7 +80,7 @@ public Void run() {
try {
Thread.sleep(waitTime);
} catch (InterruptedException e) {
e.printStackTrace();
logger.error("Thread interrupted", e);
}
waitTime = nextRun - System.currentTimeMillis();
}
Expand Down
7 changes: 4 additions & 3 deletions app/com/linkedin/drelephant/util/Utils.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.linkedin.drelephant.util;

import java.util.ArrayList;
import java.util.List;

public class Utils {

Expand Down Expand Up @@ -38,8 +39,8 @@ public static String[][] parseCsvLines(String data) {
}

public static String[] parseCsvLine(String line) {
ArrayList<String> store = new ArrayList<String>();
StringBuffer curVal = new StringBuffer();
List<String> store = new ArrayList<String>();
StringBuilder curVal = new StringBuilder();
boolean inquotes = false;
for (int i = 0; i < line.length(); i++) {
char ch = line.charAt(i);
Expand All @@ -59,7 +60,7 @@ public static String[] parseCsvLine(String line) {
}
} else if (ch == ',') {
store.add(curVal.toString());
curVal = new StringBuffer();
curVal = new StringBuilder();
} else {
curVal.append(ch);
}
Expand Down

0 comments on commit 399db00

Please sign in to comment.