[Mondrian] MONDRIAN-620: Incomplete format string

Julian Hyde jhyde at pentaho.com
Mon Sep 28 22:08:55 EDT 2009


Thanks. I fixed the bug today. See my comments on MONDRIAN-620 and duplicate
bug  <http://jira.pentaho.com/browse/MONDRIAN-434>
http://jira.pentaho.com/browse/MONDRIAN-434.


  _____  

From: Matt Campbell [mailto:mkambol at gmail.com] 
Sent: Monday, September 28, 2009 5:00 AM
To: jhyde at pentaho.com; Mondrian developer mailing list
Subject: Re: [Mondrian] MONDRIAN-620: Incomplete format string


I've updated the bug with info about the default Analysis Services 2000/2005
behavior.


On Tue, Sep 15, 2009 at 10:52 PM, Julian Hyde <jhyde at pentaho.com> wrote:


Matt,
 
See my comments on the bug.
 
http://jira.pentaho.com/browse/MONDRIAN-620
 
Julian


  _____  

From: mondrian-bounces at pentaho.org [mailto:mondrian-bounces at pentaho.org] On
Behalf Of Matt Campbell
Sent: Tuesday, September 15, 2009 11:32 AM
To: Mondrian developer mailing list
Subject: [Mondrian] MONDRIAN-620: Incomplete format string


I just entered MONDRIAN-620 for the following issue.  Mondrian supports a
format string that follows a layout like this:  

     #,##0;(#,##0);0

Where the item to the left is the format for positive numbers, the format in
the middle is negative, and the format to the right is Nil.

I discovered recently that if you omit the Nil format string you can get an
ArrayIndexOutOfBoundsException.  The following unit test shows this (it uses
checkFormat() from FormatTest):


 public void testMissingNilFormat() 
    { 
        checkFormat(null, -0.02, "#,##0;(#,##0)"); 
    } 


java.lang.ArrayIndexOutOfBoundsException: 2
    at mondrian.util.Format$AlternateFormat.format(Format.java:348)
    at mondrian.util.Format.format(Format.java:2432)
    at mondrian.util.Format.format(Format.java:2420)
    at mondrian.util.FormatTest.checkFormat(FormatTest.java:404)
    at mondrian.util.FormatTest.testSmallNumber(FormatTest.java:249)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
    at
com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
.java:25)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)

A possible solution would be to use a default format string if none is
specified.  Does that sound like a reasonable fix?



_______________________________________________
Mondrian mailing list
Mondrian at pentaho.org
http://lists.pentaho.org/mailman/listinfo/mondrian




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20090928/77cf7cff/attachment.html 


More information about the Mondrian mailing list