Bug 28652 - JBoss fails to start due class cast exception in the management classes
Summary: JBoss fails to start due class cast exception in the management classes
Status: RESOLVED FIXED
Alias: None
Product: classpath
Classification: Unclassified
Component: classpath (show other bugs)
Version: 0.92
: P3 normal
Target Milestone: ---
Assignee: Andrew John Hughes
URL:
Keywords:
: 28653 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-08-08 11:46 UTC by Audrius Meškauskas
Modified: 2007-02-15 23:48 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2007-02-15 12:29:31


Attachments
Stack trace and JBoss messages (972 bytes, text/plain)
2006-08-08 11:47 UTC, Audrius Meškauskas
Details
patch fixing the ClassCastException by cloning instead of arraycopy (699 bytes, patch)
2006-10-14 11:21 UTC, Edwin Steiner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Audrius Meškauskas 2006-08-08 11:46:01 UTC
JBoss does not starts with jamvm today with the class cast exception in the sentence:

     this.modelAttributes = (ModelMBeanAttributeInfo[]) super.getAttributes();

This was confirmed by the two independent observers on both JamVM and CACAO.
Comment 1 Audrius Meškauskas 2006-08-08 11:47:04 UTC
Created attachment 12041 [details]
Stack trace and JBoss messages
Comment 2 Audrius Meškauskas 2006-08-08 11:49:28 UTC
Confirmed (by TWISTI)
Comment 3 Tom Tromey 2006-08-09 17:49:07 UTC
*** Bug 28653 has been marked as a duplicate of this bug. ***
Comment 4 Edwin Steiner 2006-10-14 11:20:19 UTC
I found the reason for this:
    javax.management.modelmbean.ModelMBeanInfoSupport assumes that
    all kinds of arrays retrieved from its superclass can be cast to
    a specific derived type. I saw that many places in GNU Classpath use
    the "new array - arraycopy" idiom to copy arrays, which probably is
    the right thing, as you end up with the most general array type that
    makes sense. JBoss code in this case assumes that array _cloning_ is
    used in the superclass constructor, so the more derived type of the
    arrays is preserved.

I'll attach a patch fixing this particular case.
Comment 5 Edwin Steiner 2006-10-14 11:21:42 UTC
Created attachment 12427 [details]
patch fixing the ClassCastException by cloning instead of arraycopy
Comment 6 Andrew John Hughes 2007-02-15 09:24:46 UTC
Does anyone know if the attached patch can be committed? Is the necessary paperwork in place?
Comment 7 cvs-commit@developer.classpath.org 2007-02-15 23:46:52 UTC
Subject: Bug 28652

CVSROOT:	/cvsroot/classpath
Module name:	classpath
Changes by:	Andrew John Hughes <gnu_andrew>	07/02/15 23:46:31

Modified files:
	.              : ChangeLog 
	javax/management: MBeanInfo.java 

Log message:
	2006-10-14  Edwin Steiner  <edwin.steiner@gmx.net>
	
		PR classpath/28652:
		* javax/management/MBeanInfo.java (MBeanInfo): 
		Use clone to duplicate the arrays in order to
		preserve the array type.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.9111&r2=1.9112
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/management/MBeanInfo.java?cvsroot=classpath&r1=1.5&r2=1.6



Comment 8 Andrew John Hughes 2007-02-15 23:48:45 UTC
Patch committed.  Closing.
Comment 9 Tom Tromey 2007-02-16 19:19:22 UTC
Subject: Bug 28652

Author: tromey
Date: Fri Feb 16 19:19:11 2007
New Revision: 122050

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122050
Log:
2006-10-14  Edwin Steiner  <edwin.steiner@gmx.net>

	PR classpath/28652:
	* javax/management/MBeanInfo.java (MBeanInfo): 
	Use clone to duplicate the arrays in order to
	preserve the array type.

Modified:
    trunk/libjava/classpath/ChangeLog
    trunk/libjava/classpath/javax/management/MBeanInfo.java
    trunk/libjava/classpath/lib/javax/management/MBeanInfo.class

Comment 10 Tom Tromey 2007-02-16 19:22:06 UTC
Subject: Bug 28652

Author: tromey
Date: Fri Feb 16 19:21:55 2007
New Revision: 122051

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122051
Log:
2006-10-14  Edwin Steiner  <edwin.steiner@gmx.net>

	PR classpath/28652:
	* javax/management/MBeanInfo.java (MBeanInfo): 
	Use clone to duplicate the arrays in order to
	preserve the array type.

Modified:
    branches/redhat/gcc-4_1-branch-java-merge-20070117/libjava/classpath/ChangeLog
    branches/redhat/gcc-4_1-branch-java-merge-20070117/libjava/classpath/javax/management/MBeanInfo.java