You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Prachi Gauriar (JIRA)" <ji...@apache.org> on 2008/05/20 20:39:55 UTC

[jira] Issue Comment Edited: (AXIS2-3618) WSDL2Java produces code that causes javac to fail with "code to large"

    [ https://issues.apache.org/jira/browse/AXIS2-3618?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12598383#action_12598383 ] 

pgauriar edited comment on AXIS2-3618 at 5/20/08 11:38 AM:
-----------------------------------------------------------------

I ran into the same problem today. There appear to be two problems with the generated populateFault method.

1. For each fault, the same three Map put statements are called. These could be factored out into a method as follows:
    private void populateFault(String namespace, String localName, String name, String instantiatableType) {
        faultExceptionNameMap.put(new javax.xml.namespace.QName(namespace, localName), name);
        faultExceptionClassNameMap.put(new javax.xml.namespace.QName(namespace, localName), name);
        faultMessageMap.put(new javax.xml.namespace.QName(namespace, localName), instantiatableType);
    }

This significantly simplifies populateFaults(), since instead of having three constructor calls and three method calls for each fault, we have just one method call. This change can be made easily by modifying modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl. 

2. Even after modifying that method, there are a lot of redundant calls to the new populateFault method. For example, using the WSDL files attached to this bug with the fix from #1, there are 982 calls to populateFault() in the new populateFaults() method. The number of unique calls is only 58! Given that populateFault() only puts objects into several maps, multiple calls with the same parameters have no real effect. Unfortunately, I don't know XSL well enough to fix this problem.

I'm attaching my patch for InterfaceImplementationTemplate.xsl. This will at least allow the generated code for the provided WSDL files to compile.

      was (Author: pgauriar):
    I ran into the same problem today. There appear to be two problems with the generated populateFault method.

1. For each fault, the same three Map put statements are called. These could be factored out into a method as follows:
    private void populateFault(String namespace, String localName, String name, String instantiatableType) {
        faultExceptionNameMap.put(new javax.xml.namespace.QName(namespace, localName), name);
        faultExceptionClassNameMap.put(new javax.xml.namespace.QName(namespace, localName), name);
        faultMessageMap.put(new javax.xml.namespace.QName(namespace, localName), instantiatableType);
    }

This significantly simplifies populateFaults(), since instead of having three constructor calls and three method calls for each fault, we have just one method call. This change can be made easily by modifying modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl. 

2. Even after modifying that method, there are a lot of redundant calls to the new populateFault method. For example, using WSDL files provided with the fix from #1, there are 982 calls to populateFault() in the new populateFaults() method. The number of unique calls is only 58! Given that populateFault() only puts objects into several maps, multiple calls with the same parameters have no real effect. Unfortunately, I don't know XSL well enough to fix this problem.

I'm attaching my patch for InterfaceImplementationTemplate.xsl. This will at least allow the generated code for the provided WSDL files to compile.
  
> WSDL2Java produces code that causes javac to fail with "code to large"
> ----------------------------------------------------------------------
>
>                 Key: AXIS2-3618
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3618
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: codegen
>    Affects Versions: 1.3
>         Environment: We have encountered this problem both on linux using jdk 1.6 and on Windows using jdk 1.5.
>            Reporter: Peter Canning
>            Priority: Critical
>         Attachments: Axis2Patch, vim.wsdl, vimService.wsdl
>
>
> When generating stubs from a large WSDL document using either the ADB or XMLBeans databindings, the generated code causes javac to fail with the following error
>     [javac] /exit26/home/pcanning/visdk_clients/2.5/axis2-1.3/axis_stubs/src/com/vmware/vim/VimServiceStub.java:3090: code too large
>     [javac]     private void populateFaults() {
>     [javac]                  ^
> FYI: In order to successfully run the Axis2-1.3 stub generator, I had to modify axis2.sh to add -Xmx512M to increase the maximum heap size.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org