You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@joshua.apache.org by mj...@apache.org on 2016/06/10 02:07:54 UTC

incubator-joshua git commit: bug fix: GrammarPacker.java

Repository: incubator-joshua
Updated Branches:
  refs/heads/master 5a6de1f05 -> d2287bfaa


bug fix: GrammarPacker.java

In line 360, the result of splitting an empty string is an array of length 1, so the conditional on line 362 will always be true, resulting in an exception if alignment_line is an empty string. Having the conditional check the length of alignment_line instead solves this.

Project: http://git-wip-us.apache.org/repos/asf/incubator-joshua/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-joshua/commit/d2287bfa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-joshua/tree/d2287bfa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-joshua/diff/d2287bfa

Branch: refs/heads/master
Commit: d2287bfaa53bff4e0a455827ae957fbc365a813c
Parents: 5a6de1f
Author: Courtney Napoles <cd...@gmail.com>
Authored: Thu Jun 9 22:04:15 2016 -0400
Committer: GitHub <no...@github.com>
Committed: Thu Jun 9 22:04:15 2016 -0400

----------------------------------------------------------------------
 src/main/java/org/apache/joshua/tools/GrammarPacker.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-joshua/blob/d2287bfa/src/main/java/org/apache/joshua/tools/GrammarPacker.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/joshua/tools/GrammarPacker.java b/src/main/java/org/apache/joshua/tools/GrammarPacker.java
index 93aec2f..b9208d2 100644
--- a/src/main/java/org/apache/joshua/tools/GrammarPacker.java
+++ b/src/main/java/org/apache/joshua/tools/GrammarPacker.java
@@ -359,7 +359,7 @@ public class GrammarPacker {
         }
         String[] alignment_entries = alignment_line.split("\\s");
         byte[] alignments = new byte[alignment_entries.length * 2];
-        if (alignment_entries.length != 0) {
+        if (alignment_line.length() > 0) {
           for (int i = 0; i < alignment_entries.length; i++) {
             String[] parts = alignment_entries[i].split("-");
             alignments[2 * i] = Byte.parseByte(parts[0]);