<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    VerifyError on auto generated code
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/taggat4023">George Taylor</a> in <i>Javassist</i> - <a href="http://community.jboss.org/message/618059#618059">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>I have a code generator that wraps a set of pojo's. I have been running it using the tools library successfully compiling the java previously.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In the latest version i have changed to javaassist 3.15.0.GA and now my unit tests are constantly failing to run with a VerifyError</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I can get around it by commenting out 1 line of code, but this line of code is important to the flow of the application.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>The following code will generate a VerifyError (this is extracted from what i add into the classpool and ctclass structures)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>import javax.servlet.http;</p><p>import uk.co.taylorconsulting.annoweb.web.exception;</p><p>import uk.co.taylorconsulting.annoweb.web.cache;</p><p>import uk.co.taylorconsulting.annoweb.web.interfaces;</p><p>import uk.co.taylorconsulting.annoweb.web.enums;</p><p>import org.apache.log4j;</p><p>import java.lang;</p><p>import uk.co.taylorconsulting.annoweb.annotation.action;</p><p>import uk.co.taylorconsulting.annoweb.annotation.cache;</p><p>import uk.co.taylorconsulting.annoweb.annotation.form;</p><p>import uk.co.taylorconsulting.annoweb.annotation.form.validation;</p><p>import uk.co.taylorconsulting.annoweb.annotation.injection;</p><p>import uk.co.taylorconsulting.annoweb.annotation.security;</p><p>import uk.co.taylorconsulting.annoweb.annotation.web;</p><p>import uk.co.taylorconsulting.annoweb.builder.exception;</p><p>import uk.co.taylorconsulting.annoweb.builder.structure;</p><p>import uk.co.taylorconsulting.annoweb.builder.structure.form;</p><p>import uk.co.taylorconsulting.annoweb.builder.structure.helper;</p><p>import uk.co.taylorconsulting.annoweb.builder.structure.security;</p><p>import uk.co.taylorconsulting.annoweb.builder.structure.view;</p><p>import uk.co.taylorconsulting.annoweb.builder.structure.view.method;</p><p>import uk.co.taylorconsulting.annoweb.builder.structure.view.parameter;</p><p>import uk.co.taylorconsulting.annoweb.builder.util;</p><p>import uk.co.taylorconsulting.annoweb.options;</p><p>import uk.co.taylorconsulting.annoweb.web.cache;</p><p>import uk.co.taylorconsulting.annoweb.web.controller;</p><p>import uk.co.taylorconsulting.annoweb.web.enums;</p><p>import uk.co.taylorconsulting.annoweb.web.exception;</p><p>import uk.co.taylorconsulting.annoweb.web.interfaces;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public uk.co.taylorconsulting.annoweb.site.siteName.root.base.View extends uk.co.taylorconsulting.annoweb.web.controller.WebHelper implements uk.co.taylorconsulting.annoweb.web.interfaces.ViewProcessor{</p><p>private static final Logger LOG = Logger.getLogger(uk.co.taylorconsulting.annoweb.site.siteName.root.base.View.class</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public View(){}</p><p>public process(HttpServletRequest request, HttpServletResponse response)</p><p>{if($1.getParameter("dispatch") != null) {LOG.debug("dispatch=dispatch value=" + $1.getParameter("dispatch"));dispatchDispatch($1,$2);}}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public dispatchDispatch(HttpServletRequest request, HttpServletResponse response)</p><p>{String val = $1.getParameter("dispatch");LOG.debug("Dispatching for dispatch value=\"" + val + "\"");if(val.equals("login")) {processDispatchLogin($1,$2);} else if(val.equals("actionWithTestObject")) {processDispatchActionWithTestObject($1,$2);} else if(val.equals("notAuthed")) {processDispatchNotAuthed($1,$2);}}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public processDispatchActionWithTestObject(HttpServletRequest request, HttpServletResponse response)</p><p>{LOG.debug("AS:processing processDispatchActionWithTestObject");try {ATestObject var0 = null;try{var0 = $1.getParameter("a");} catch (Exception e){}if (var0==null) {try{var0 = (uk.co.taylorconsulting.annoweb.builder.structure.samples.ATestObject)$1.getAttribute("a");} catch (Exception e){}}uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic action=(uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic)Cache.getClassCache("uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic");action.actionWithTestObject(var0);LOG.warn("No default forwards have been defined");} catch (Exception e) {LOG.warn("An error has occured in the action processDispatchActionWithTestObject Exception: " + e.getClass().getCanonicalName() +"(" + e.getMessage() +")");}}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public processDispatchNotAuthed(HttpServletRequest request, HttpServletResponse response)</p><p>{LOG.debug("AS:processing processDispatchNotAuthed");try {uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic action=(uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic)Cache.getClassCache("uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic");action.notAuthorised();LOG.warn("No default forwards have been defined");} catch (Exception e) {LOG.warn("An error has occured in the action processDispatchNotAuthed Exception: " + e.getClass().getCanonicalName() +"(" + e.getMessage() +")");}}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public processDispatchLogin(HttpServletRequest request, HttpServletResponse response)</p><p>{LOG.debug("AS:processing processDispatchLogin");try {uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic action=(uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic)Cache.getClassCache("uk.co.taylorconsulting.annoweb.builder.structure.samples.StructureTestBasic");action.login();LOG.warn("No default forwards have been defined");} catch (Exception e) {LOG.warn("An error has occured in the action processDispatchLogin Exception: " + e.getClass().getCanonicalName() +"(" + e.getMessage() +")");}}</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If i put this into a java file and compile it, it is fine and even the javaassist compiile does not complain about the code.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>If i remove the ATestObject from the processDispatchActionWithTestObject method's call to action.actionWithTestObject(var0); and replace it with action.actionWithTestObject(null); then this works successfully and doesn't complain, but then as you could imagine breaks the required data.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Can you tell me what i can do to get around this issue. this is the generated code from a unit test that i can get to fail every time (and get to pass by changing the data as mentioned above)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have attached 2 files of the full java code generated from the unit test one that works and one that doesn't (another way of getting it to work is to remove other code which i also need)</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/618059#618059">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Javassist at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2062">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>