[Mondrian] RolapSchema #122

Matt Campbell mkambol at gmail.com
Mon Feb 16 15:01:01 EST 2009


Sherman,
It looks like a bug was introduced in the code which retrieves schemas from
the Pool.  In Pool.get() there is code which first loads the schema from a
given URL, then computes its checksum.  I've noticed that the new
Util.readVirtualFile() method will sometimes return the content of the
*previous* schema loaded.
In the current code there is actually an extra read of the catalog--see the
bolded section below.  It's leftover from the previous approach for loading
the schema.  This should probably be cleaned up, but it helped me find the
issue.  When I've traced through this code I've seen that the catalogStr
returned by the old code (Util.readURL) is sometimes different from the
schema returned by Util.readVirtualFile.

I'm going to try to come up with a clean reproducible test case tomorrow,
but I thought I'd pass on what I've seen in case you see something obviously
wrong.

                try {
                    if (catalogStr == null) {
                        catalogStr = Util.readURL(catalogUrl);
                        // Use VFS to get the content

                        FileObject file = Util.readVirtualFile(catalogUrl);

                        StringBuilder buf = new StringBuilder(1000);
                        FileContent fileContent = file.getContent();
                        InputStream in = fileContent.getInputStream();
                        int n;
                        while ((n = in.read()) != -1) {
                            buf.append((char) n);
                        }
                        catalogStr = buf.toString();
                    }
                    md5Bytes = encodeMD5(catalogStr);
                } catch (Exception ex) {
                    // Note, can not throw an Exception from this method
                    // but just to show that all is not well in Mudville
                    // we print stack trace (for now - better to change
                    // method signature and throw).
                    ex.printStackTrace();
                }

-Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pentaho.org/pipermail/mondrian/attachments/20090216/ec8f9e80/attachment.html 


More information about the Mondrian mailing list