RE: Error : Code too large for try statement

Martin Gainty <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <[email protected]>
XSL does blind substitution ..the solution is to extend fromOM to output a Collection ( as seen here )
Original:   
   java.lang.Object object = fromOM(
                                             _returnEnv.getBody().getFirstElement() ,
                                             <xsl:value-of select="$outputtype"/>.class,
                                              getEnvelopeNamespaces(_returnEnv));

New:
   Collection collection_of_object=fromOM_Collection             _returnEnv.getBody().getFirstElement() ,
                                                        <xsl:value-of select="$outputtype"/>.class,
                                                       getEnvelopeNamespaces(_returnEnv));
<!-- Class.getMethod would need the new Class so we must change messageClass from java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});-->
while (collection_of_object.iterator().hasNext()){  Object object=collection_of_object.iterator().next().
  Class messageClass =object.getClass();
  java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                      new java.lang.Class[]{messageClass});

<!-- assume fromOM outputs <objects>                                                      <object>
                                                     </object>
                                                   </objects>-->
<xsl:for-each select="objects/object">   <!-- IF output/param[@location='body']/param) drives each record to be unique
          then we can retain outputparamcount as our counter
          otherwise we could need another counter to make sure each xsl:when test is unique for each              object      -->             <xsl:when test="$outputparamcount=1" return get                   <xsl:value-of select="$outputparamshorttype"/>                  <xsl:value-of select="$outputparampartname"/>((<xsl:value-of select="$outputtype"/>)object);
                                               </xsl:when>                    <xsl:when test="$outputparamcount=2" return get                                  <xsl:value-of select="$outputparamshorttype"/>                                 <xsl:value-of select="$outputparampartname"/>((<xsl:value-of select="$outputtype"/>)object);
                                                         </xsl:when>
</xsl:for-each> }  <!-- end when -->
Personally I would prefer to twiddle Class.getMethod but thats part of the JDK so the only solution
is to have fromOM create multiple classes (with identical method names) e.g.

class Object1Class { public void method1, public void method2... };
class Object2Class { public void method1, public void method2...};
Everyone uses toOM and fromOM to generate their XML and then to transform XML to code
so these methods need to be left as is
ToOM_Collection and fromOM_Collection is the only solution that would work

Let me know if this is of interest to you and I'll pitch it to the devs..

FYI: This feature would not be backported to previous versions of Axis
Martin Gainty 
______________________________________________ 
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas.  Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett.  Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs.  Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

 Date: Fri, 5 Apr 2013 14:56:30 -0700
From: [email protected]
Subject: Re: Error : Code too large for try statement
To: [email protected]

Thanks Martin for response. Refactoring helped in fixing code. 
I found there was link for Axis2 patch which fixed it without refactoring (https://issues.apache.org/jira/browse/AXIS2-3618) 
Is that issue fixed in any of Axis2 releases?
Thanks,Harish
        From: Martin Gainty <[email protected]>
 To: "[email protected]" <[email protected]> 
 Sent: Wednesday, April 3, 2013 4:36 PM
 Subject: RE: Error : Code too large for try statement
   




you exceeded the JVM max try/catch block size of 64k imposed by the JVM

break  up the try/catch block is the only solution I know of

Martin 
______________________________________________ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la
 copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.

 
Date: Tue, 2 Apr 2013 13:09:08 -0700
From: [email protected]
Subject: Error : Code too large for try statement
To: [email protected]

Hi Guys,
             When i try to generate client stub, i am getting following error. Can any onesuggest how to fix it ? 
This is due to large code size generated by Axis2 which is
 exceeding limit as per java. 

    [javac] C:\project\src\org\multispeak\www\version_4_1_release\MDM_ServerStub.java:126405: code too large for try statement
    [javac]        
 }catch(java.lang.Exception e){    [javac]          ^    [javac] C:\project\src\org\multispeak\www\version_4_1_release\MDM_ServerStub.java:107159: code too large    [javac]         public org.apache.xmlbeans.XmlObject fromOM(    [javac]          
                                    ^    [javac] Note: Some input files use or override a deprecated API.    [javac] Note: Recompile with -Xlint:deprecation for details.    [javac] Note: Some input files use unchecked or unsafe operations.    [javac] Note: Recompile with -Xlint:unchecked for details.    [javac] 2 errors    [javac] 2 warnings

   		 	   		  


    d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.