Skip to content
This repository was archived by the owner on Dec 13, 2021. It is now read-only.

JOSHUA-264 System.exit() calls are replaced by throw new RuntimeException() #13

Merged
merged 3 commits into from
May 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
225 changes: 69 additions & 156 deletions src/main/java/org/apache/joshua/adagrad/AdaGradCore.java

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions src/main/java/org/apache/joshua/decoder/ArgsParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public ArgsParser(String[] args, JoshuaConfiguration joshuaConfiguration) throws
System.out.println(line);
}
} catch (IOException e) {
System.err.println("FATAL: missing license file!");
throw new RuntimeException("FATAL: missing license file!", e);
}
System.exit(0);
}
Expand All @@ -87,8 +87,7 @@ public ArgsParser(String[] args, JoshuaConfiguration joshuaConfiguration) throws
Decoder.LOG(1, "Parameters read from configuration file:");
joshuaConfiguration.readConfigFile(getConfigFile());
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
throw new RuntimeException(e);
}

break;
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/org/apache/joshua/decoder/BLEU.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,7 @@ public static float computeSentenceBleu(int refLen, HashMap<String, Integer> ref
// sentence-bleu: BLEU= bp * prec; where prec = exp (sum 1/4 * log(prec[order]))
public static float computeBleu(int hypLen, float refLen, int[] numNgramMatch, int bleuOrder) {
if (hypLen <= 0 || refLen <= 0) {
System.out.println("error: ref or hyp is zero len");
System.exit(1);
throw new RuntimeException("error: ref or hyp is zero len");
}
float res = 0;
float wt = 1.0f / bleuOrder;
Expand Down Expand Up @@ -383,10 +382,9 @@ public static Stats compute(HyperEdge edge, float spanPct, References references
try {
ngramState = (NgramDPState) edge.getTailNodes().get(tailIndex).getDPState(0);
} catch (ClassCastException e) {
System.err.println(String.format(
throw new RuntimeException(String.format(
"* FATAL: first state needs to be NgramDPState (found %s)", edge.getTailNodes()
.get(tailIndex).getDPState(0).getClass()));
System.exit(1);
}

// Compute ngrams overlapping with left context of tail node
Expand Down
Loading