Merge branch 'master' into JOSHUA-327
diff --git a/src/main/java/org/apache/joshua/decoder/Decoder.java b/src/main/java/org/apache/joshua/decoder/Decoder.java
index 7b202b9..e105fd2 100644
--- a/src/main/java/org/apache/joshua/decoder/Decoder.java
+++ b/src/main/java/org/apache/joshua/decoder/Decoder.java
@@ -459,6 +459,15 @@
 
       } else {
         if (new File(path).isDirectory()) {
+          /* Bug check. It is a problem if you load the glue grammar before a packed grammar, due to vocabulary
+           * issues. That should be fixed one day, but in the meantime, it is important to tell people about it.
+           */
+          if (glueGrammar != null) {
+            LOG.error("FATAL: the glue grammar must be listed AFTER any packed grammar.");
+            LOG.error("  Change the order in the config file so that your packed grammar is loaded first.");
+            throw new RuntimeException("Glue grammar loaded before a packed grammar.");
+          }
+
           try {
             PackedGrammar packed_grammar = new PackedGrammar(path, span_limit, owner, type, joshuaConfiguration);
             packed_grammars.add(packed_grammar);
@@ -468,6 +477,7 @@
                 + "Perhaps it doesn't exist, or it may be an old packed file format.";
             throw new RuntimeException(msg);
           }
+
         } else {
           // thrax, hiero, samt
           grammar = new MemoryBasedBatchGrammar(type, path, owner,