ICU-6867 Merged c25972(#6896) from trunk to maint-4-2.  This change reenables the RBNF spellout parsing for ar, he and mt.  We found a better condition to exclude unparseable rules which triggered stack overflow.

X-SVN-Rev: 25975
diff --git a/src/com/ibm/icu/text/NFRuleSet.java b/src/com/ibm/icu/text/NFRuleSet.java
index 068552a..7ffff55 100644
--- a/src/com/ibm/icu/text/NFRuleSet.java
+++ b/src/com/ibm/icu/text/NFRuleSet.java
@@ -1,6 +1,6 @@
 /*
  *******************************************************************************
- * Copyright (C) 1996-2007, International Business Machines Corporation and    *
+ * Copyright (C) 1996-2009, International Business Machines Corporation and    *
  * others. All Rights Reserved.                                                *
  *******************************************************************************
  */
@@ -371,7 +371,22 @@
      * @return true if the rule set is public
      */
     public boolean isPublic() {
-    return !name.startsWith("%%");
+        return !name.startsWith("%%");
+    }
+
+    /**
+     * Return true if the rule set can be used for parsing.
+     * @return true if the rule set can be used for parsing.
+     */
+    public boolean isParseable() {
+        //TODO:
+        //  In CLDR 1.7, we have no distinction between
+        //  parseable/unparseable.  Rules which have one of
+        //  3 suffixes below are know as unparseable for now.
+        //  We should add the information in CLDR data.
+        return !(name.endsWith("-prefixpart")
+                || name.endsWith("-postfixpart")
+                || name.endsWith("-postfx"));
     }
 
     //-----------------------------------------------------------------------
diff --git a/src/com/ibm/icu/text/RuleBasedNumberFormat.java b/src/com/ibm/icu/text/RuleBasedNumberFormat.java
index e4fb2f1..e054c5d 100644
--- a/src/com/ibm/icu/text/RuleBasedNumberFormat.java
+++ b/src/com/ibm/icu/text/RuleBasedNumberFormat.java
@@ -599,12 +599,7 @@
     // Temporary workaround - when noParse is true, do noting in parse.
     // TODO: We need a real fix - see #6895/#6896
     private boolean noParse;
-    private static final String[] NO_SPELLOUT_PARSE_LANGUAGES = {
-        "ga", "mt", "ar", "he",
-    };
-    // Note: "ar" and "he" do not cause any errors with ICU4J test case,
-    // but the test coverage is suspicious.  These locales trigger stack
-    // overflow in C.  For now, we also include these in the list above.
+    private static final String[] NO_SPELLOUT_PARSE_LANGUAGES = { "ga" };
 
     //-----------------------------------------------------------------------
     // constructors
@@ -1207,7 +1202,7 @@
         // the result we return
         for (int i = ruleSets.length - 1; i >= 0; i--) {
             // skip private rule sets
-            if (ruleSets[i].getName().startsWith("%%")) {
+            if (!ruleSets[i].isPublic() || !ruleSets[i].isParseable()) {
                 continue;
             }