Bugs item #592495, was opened at 2002-08-08 08:43 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=592495&group_id=22866
Category: JBossServer Group: v3.0 Rabbit Hole Status: Closed Resolution: Fixed Priority: 5 Submitted By: Michael Meadows (legerdemain) Assigned to: Christian Riege (lqd) Summary: Validate void return type for CMP setter Initial Comment: Recently wrote a CMP entity bean with the following code: ... public abstract int getOrgId(); public abstract int setOrgId(int orgId); public abstract int getSiteId(); public abstract int setSiteId(int siteId); public abstract int getId(); public abstract int setId(int id); ... i.e. with a return type of int in the setters. This causes the entity proxy to throw a NullPointerException. Now this was a really dumb thing to do but given that finding the problem was so difficult it might be good to have the validation check the return type of the setter methods. Original postings: http://www.jboss.org/forums/thread.jsp? forum=46&thread=18830 ---------------------------------------------------------------------- >Comment By: Michael Meadows (legerdemain) Date: 2002-08-09 09:37 Message: Logged In: YES user_id=185411 The stack trace was from the server so the NPE is only thrown on the server. Not sure what the client receives. It was most probably a standard remote exception wrapper. The speculation about the primary key fields was because I'd only made the mistake with the primary key fields! So it may or may not be only primary key fields that suffer from this problem. :) ---------------------------------------------------------------------- Comment By: Christian Riege (lqd) Date: 2002-08-09 08:04 Message: Logged In: YES user_id=176671 OK, thanks it's better than nothing. So the NPE is only thrown on the client or do you see something in the server log, too?! From reading the thread in the forum I also gather that this only happens if the set accessor method is invoked on a compound primary key field? ---------------------------------------------------------------------- Comment By: Michael Meadows (legerdemain) Date: 2002-08-08 17:34 Message: Logged In: YES user_id=185411 Wow... you fixed it already. Thanks ;) The stack trace you requested unfortunately it doesn't say much because the proxy is generated straight to bytecode: 18:30:30,670 ERROR [LogInterceptor] TransactionRolledbackException, causedBy: java.lang.NullPointerException at com.visualfiles.workflow.ActivityAutoCreateBean$Proxy.setOr gId(<gener ated>) at com.visualfiles.workflow.ActivityAutoCreateBean.ejbCreate (ActivityAut oCreateBean.java:18) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.plugins.CMPPersistenceManager.createEntity (CMPPersisten ceManager.java:221) at org.jboss.resource.connectionmanager.CachedConnectionInte rceptor.crea teEntity(CachedConnectionInterceptor.java:270) at org.jboss.ejb.EntityContainer.createLocalHome (EntityContainer.java:57 9) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHom e(EntityC ontainer.java:1116) at org.jboss.ejb.plugins.AbstractInterceptor.invokeHome (AbstractIntercep tor.java:73) at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeH ome(Ent itySynchronizationInterceptor.java:209) at org.jboss.resource.connectionmanager.CachedConnectionInte rceptor.invo keHome(CachedConnectionInterceptor.java:215) at org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome (EntityInst anceInterceptor.java:88) at org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome (EntityLockInte rceptor.java:79) at org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome (EntityCrea tionInterceptor.java:44) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext (AbstractTxInte rceptor.java:98) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions (TxIntercep torCMT.java:176) at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome (TxInterceptorCMT.ja va:52) at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome (SecurityIntercep tor.java:104) at org.jboss.ejb.plugins.LogInterceptor.invokeHome (LogInterceptor.java:1 18) at org.jboss.ejb.EntityContainer.invokeHome (EntityContainer.java:487) at org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeH ome(Base LocalContainerInvoker.java:227) at org.jboss.ejb.plugins.local.LocalHomeProxy.invoke (LocalHomeProxy.java :110) at $Proxy170.create(Unknown Source) at com.visualfiles.workflow.ProcessTypeControllerBean.createAc tivityAuto Create(ProcessTypeControllerBean.java:588) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl. java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor .invoke(S tatelessSessionContainer.java:664) at org.jboss.resource.connectionmanager.CachedConnectionInte rceptor.invo ke(CachedConnectionInterceptor.java:186) at org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.inv oke(Stat elessSessionInstanceInterceptor.java:77) at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext (AbstractTxInte rceptor.java:96) at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions (TxIntercep torCMT.java:176) at org.jboss.ejb.plugins.TxInterceptorCMT.invoke (TxInterceptorCMT.java:6 1) at org.jboss.ejb.plugins.SecurityInterceptor.invoke (SecurityInterceptor. java:129) at org.jboss.ejb.plugins.LogInterceptor.invoke (LogInterceptor.java:183) at org.jboss.ejb.StatelessSessionContainer.invoke (StatelessSessionContai ner.java:313) at org.jboss.ejb.Container.invoke(Container.java:705) at org.jboss.mx.server.MBeanServerImpl.invoke (MBeanServerImpl.java:491) at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke (JRMPInvoker.java: 362) at sun.reflect.GeneratedMethodAccessor41.invoke (Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAcces sorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at sun.rmi.server.UnicastServerRef.dispatch (UnicastServerRef.java:261) at sun.rmi.transport.Transport$1.run(Transport.java:148) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall (Transport.java:144) at sun.rmi.transport.tcp.TCPTransport.handleMessages (TCPTransport.java:4 60) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run (TCPTransport .java:701) at java.lang.Thread.run(Thread.java:536) ---------------------------------------------------------------------- Comment By: Christian Riege (lqd) Date: 2002-08-08 13:06 Message: Logged In: YES user_id=176671 fixed in CVS ( 3.0, 3.2 and HEAD ). additionally, a getter method is now checked for a void return type and a corresponding error message has been added. haven't looked at the Entity Proxy NPE yet. ---------------------------------------------------------------------- Comment By: Christian Riege (lqd) Date: 2002-08-08 11:55 Message: Logged In: YES user_id=176671 I will fix this in the verifier. However the Entity Proxy should be changed to report this rather than throwing a NPE. Michael, can you post the exact stack trace you are seeing so we can fix it in the Entity Proxy? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=376685&aid=592495&group_id=22866 ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development