<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -12,19 +12,27 @@
  */
 package flapjack.cobol.util;
 
+import java.text.MessageFormat;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
 
 public class CobolDecimalPatternParser {
-    private static final Pattern NO_MULTIPLIER = Pattern.compile(&quot;(?i)9+v9+&quot;);
-    private static final Pattern MULTIPLIER = Pattern.compile(&quot;v9\\(([0-9]+)\\)&quot;, Pattern.CASE_INSENSITIVE);
+    private static final String NOT_A_DECIMAL_PATTERN = &quot;Unable to parse out the decimal points from cobol pattern ({0})&quot;;
+    private static final Pattern NO_MULTIPLIER = Pattern.compile(&quot;(?i)9+$&quot;);
+    private static final Pattern MULTIPLIER = Pattern.compile(&quot;9\\(([0-9]+)\\)$&quot;, Pattern.CASE_INSENSITIVE);
 
     public int parseDecimalPlaces(String pattern) {
-        if (Pattern.matches(NO_MULTIPLIER.pattern(), pattern))  {
-            return pattern.split(&quot;v|V&quot;)[1].length();
+        if (pattern.toLowerCase().indexOf(&quot;v&quot;) == -1) {
+            throw new IllegalArgumentException(MessageFormat.format(NOT_A_DECIMAL_PATTERN, new Object[]{pattern}));
         }
-        Matcher matcher = MULTIPLIER.matcher(pattern);
+
+        String decimal = pattern.split(&quot;v|V&quot;)[1];
+        if (Pattern.matches(NO_MULTIPLIER.pattern(), decimal))  {
+            return decimal.length();
+        }
+        
+        Matcher matcher = MULTIPLIER.matcher(decimal);
         matcher.find();
         return Integer.parseInt(matcher.group(1));
     }</diff>
      <filename>flapjack-cobol/src/main/java/flapjack/cobol/util/CobolDecimalPatternParser.java</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,11 @@
 /**
  * Copyright 2008-2009 the original author or authors.
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in
  * compliance with the License. You may obtain a copy of the License at:
- * 
+ *
  * http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software distributed under the License is
  * distributed on an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and limitations under the License. 
@@ -16,13 +16,30 @@ import junit.framework.TestCase;
 
 
 public class CobolDecimalPatternParserTest extends TestCase {
-    public void test() {
-        CobolDecimalPatternParser parser = new CobolDecimalPatternParser();
+    private CobolDecimalPatternParser parser;
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        parser = new CobolDecimalPatternParser();
+    }
 
+    public void test_problemWithCobolPattern() {
+        try {
+            parser.parseDecimalPlaces(&quot;999&quot;);
+            fail();
+        } catch (IllegalArgumentException err) {
+            assertEquals(&quot;Unable to parse out the decimal points from cobol pattern (999)&quot;, err.getMessage());
+        }
+    }
+
+    public void test() {
         assertEquals(1, parser.parseDecimalPlaces(&quot;9v9&quot;));
         assertEquals(2, parser.parseDecimalPlaces(&quot;9v99&quot;));
         assertEquals(2, parser.parseDecimalPlaces(&quot;9V99&quot;));
         assertEquals(2, parser.parseDecimalPlaces(&quot;9V9(2)&quot;));
         assertEquals(12, parser.parseDecimalPlaces(&quot;9V9(12)&quot;));
+        assertEquals(3, parser.parseDecimalPlaces(&quot;999V999&quot;));
+        assertEquals(3, parser.parseDecimalPlaces(&quot;9(2)v999&quot;));
     }
+
 }</diff>
      <filename>flapjack-cobol/src/test/java/flapjack/cobol/util/CobolDecimalPatternParserTest.java</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ac8c63396686e665e2c6f49429776829a091cf05</id>
    </parent>
  </parents>
  <author>
    <name>Dan Dudley</name>
    <email>born2snipe@gmail.com</email>
  </author>
  <url>http://github.com/born2snipe/flapjack/commit/326aa113506599242a9b9ef4944cb62afcdacee1</url>
  <id>326aa113506599242a9b9ef4944cb62afcdacee1</id>
  <committed-date>2009-11-04T21:29:38-08:00</committed-date>
  <authored-date>2009-11-04T21:29:38-08:00</authored-date>
  <message>updated to handle multiple decimal places properly</message>
  <tree>0996c2af04e8aee18d7e56f977a068d1c6fd3297</tree>
  <committer>
    <name>Dan Dudley</name>
    <email>born2snipe@gmail.com</email>
  </committer>
</commit>
