Unhandled ArrayStoreException - code or configuration problem

I am trying to debug an application that works correctly when testing locally on a computer running Windows XP (version 5.1 build 2600 Service Pack 3) through Websphere Platform 6.1 with version Java 1.5.

This application throws an ArrayStoreException when it is deployed to UNIX servers (SunOS, version 5.10) running on Java version 1.5.0_24.

I am inclined to think that this is a problem with the environment configuration, but (except for it works locally). I cannot confirm that this is a configuration problem.

The following are the log messages that have been added to the troubleshooting code. As noted in the logs, the code is trying to add a Profile object to an array of type Profile. I do not understand why this will not work.

CollectionUtility.searchMapmsg = ZZZZZ Caught ArrayStoreException ZZZZZ

CollectionUtility.searchMap | msg = ZZZZZ Cannot add list item to Array of type [Lcom.process.im.profile.impl.Profile; Zzzzz

CollectionUtility.searchMap | msg = ZZZZZ List [0] - class com.process.im.profile.impl.Profile, toString () = com.process.im.profile.impl.Profile mId = 4, mLongName = ccounting ZZZZZ

Below is the java code that creates the error

public static Object[] searchMap(Map m, Object[] keys, Object[] a) { if (keys != null && a != null) { List<Object> l = new ArrayList<Object>(keys.length); searchMap(m, keys, l, true, null); try { a = l.toArray(a); } catch (ArrayStoreException eArrayStore) { Log.warning("CollectionUtility.searchMap", "ZZZZZ Caught ArrayStoreException ZZZZZ", 0); if(l==null) { Log.warning("CollectionUtility.searchMap", "ZZZZZ Core CollectionUtility ZZZZZ null list.", 0); } else { for(int i=0; i<l.size(); i++) { Object bug = l.get(i); if(bug==null) { Log.warning("CollectionUtility.searchMap", "ZZZZZ List[" + i + "] is null ZZZZZ", 0); } else { if (a!=null && !a.getClass().getName().equals(bug.getClass().getName())) { Log.warning("CollectionUtility.searchMap", "ZZZZZ Unable to add list item to Array of type " + a.getClass().getName() + " ZZZZZ", 0); Log.warning("CollectionUtility.searchMap", "ZZZZZ List[" + i + "] is class " + bug.getClass().getName() + ", toString()=" + bug.toString() + " ZZZZZ", 0); } } } } throw eArrayStore; } } return a; } 

I know that I can skip something simple, but I'm not sure what to check next. If any of you have any ideas, please let me know. All help is welcome. Thanks!

0
java classpath environment classloader configuration
source share
1 answer

Good for one, you are comparing the class of an Object array with an object. I am sure that this is not what you intend to do.

0
source share

All Articles