Hello all,

our company had developed static error analyser for Java called Wasp.
We just released version 3.0, and this was overlapped with another our 
project which has Fop involved.

I decided to try Wasp on Fop. I tried it on 0.18.1.  And I think that there 
are some results. You can download complete messages at 
http://www.waspsoft.com/fop/

Main application is Fop. There are 2 files concerning this app: Fop.grf (call 
function graph), and Fop.msg (error/warnings found).

I'll try explain some situations in the Fop.msg file. If there will be any 
interest, we can continue with this.

================================================================

The reason of the following two messages is that the method getBooleanValue
always returns null value:

[C] (org/apache/fop/apps/InputHandler.java 58,79) null pointer exception for
   variable $method_result
    ...debugMode =
    Configuration.getBooleanValue("debugMode").#booleanValue();

[C] (org/apache/fop/apps/Options.java 47,59) null pointer exception for
   variable $method_result
                    if
    (Configuration.getBooleanValue("quiet").#booleanValue...

Analysing the body of the getBooleanValue
one can see that call the "Configuration.getValue (key, role);"
produces neither String nor Boolean because the following messages holds:

[W] (org/apache/fop/configuration/Configuration.java 111,24) false condition
   - unreachable then-branch
                    if (obj #instanceof String) {
[W] (org/apache/fop/configuration/Configuration.java 113,31) false condition
   - unreachable then-branch
                    } else if (obj #instanceof Boolean) {


Analysing the getValue method one can find that the result is calculated by
        standardConfiguration.get(key)

The standardConfiguration variable is encounted in the setup and put
methods of the Configuration class. All these methods are absent in
the call graph of Fop program (Fop.grf).
To enshure this, try search string "setup<" in the Fop.grf file.

So the calculated value is null.

What is the reason of such situation.
Possibly the createParser() method should never reached
from the Fop.main method in the actual execution of the Fop program.

======================================================================

Another interesting message:

[W] (org/apache/fop/tools/DocumentReader.java 404,4) method parse not
   completed normally
        #public void parse (InputSource input)
  #CONTEXT parse(404,4) <-

ConfigurationReader.start(org/apache/fop/configuration/ConfigurationReader.ja
va,

       124,19?)

The reason is easily explained by the next message in the Fop.mes:

[W] (org/apache/fop/tools/DocumentReader.java 407,18) false condition -
   unreachable then-branch
            if (input #instanceof DocumentInputSource) {
  #CONTEXT parse(407,18) <-

ConfigurationReader.start(org/apache/fop/configuration/ConfigurationReader.ja
va,

       124,19?)

One can see that if the condition "input instanceof DocumentInputSource"
is false, the SAXException exception will be thrown.
According the context of the message, the parse method is called
from ConfigurationReader.start method.

The field "filename" in the "parser.parse(filename);"
may be assigned only in the ConfigurationReader constructer.

If one search for the string "start<" in the Fop.grf,
one can find

 #  org.apache.fop.configuration.ConfigurationReader.start<--
                   apps.Options.loadStandardConfiguration(125,19);

It is obvious from the fragment below
that the reader.start() will always finished abnormal
with the FOPException exception.

        ConfigurationReader reader =
          new ConfigurationReader (new InputSource(configfile));
        if (errorDump) {
            reader.setDumpError(true);
        }
        try {
            reader.start();
        } catch (org.apache.fop.apps.FOPException error) {
            MessageHandler.errorln("Fatal Error: Can't process default
configuration file. \nProbably it is not well-formed.");
            if (errorDump) {
                reader.dumpError(error);
            }
            System.exit(1);
        }

================================================
It is more hard to explain the message:

[W] (org/apache/fop/fo/FOTreeBuilder.java 297,4) method format not completed
   normally
        #public void format(AreaTree areaTree) throws FOPException {

The reason of abnormal exit in the method below
is the ClassCastException when cast to Root.

    public void format(AreaTree areaTree) throws FOPException {
        MessageHandler.logln("formatting FOs into areas");
        ((Root) this.rootFObj).format(areaTree);
    }

To understand why so, one can find that the field rootFObj may be assigned 
only in the fragment:

        if (rootFObj == null) {
            rootFObj = fobj;
            if (!fobj.getName().equals("fo:root")) {
                throw new SAXException(

It is hard to understand what type variable fobj should be without good 
knowledge of Fop.

===============================================================

Also we would like to place some of these messages on our website like 
http://www.waspsoft/jess.html or http://www.waspsoft/jun.html, and possibly 
in some other ad information.

-- 
Sincerely Yours,
Denis Perchine

----------------------------------
E-Mail: [EMAIL PROTECTED]
HomePage: http://www.perchine.com/dyp/
FidoNet: 2:5000/120.5
----------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to