不明的ArrayStoreException - 代码或配置问题 [英] Unexplained ArrayStoreException - Code or Configuration Issue

查看:243
本文介绍了不明的ArrayStoreException - 代码或配置问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试通过运行Java 1.5版的Websphere Platform 6.1在Windows XP计算机(5.1版本构建2600 Service Pack 3)上进行本地测试时调试正常工作的应用程序。

I am trying to debug an application that is working properly when tested locally on a Windows XP machine (version 5.1 build 2600 Service Pack 3) through Websphere Platform 6.1 running java version 1.5.

此应用程序在部署到运行java版本1.5.0_24的UNIX服务器(SunOS,版本5.10)时抛出一个ArrayStoreException。

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

我倾向于这是一个环境配置问题,但(除了它本地工作)我似乎不能确认它是一个配置问题。

I am leaning towards this being an environment configuration issue, but (other than it working locally) I can't seem to confirm that it's a configuration issue.

以下是日志消息 添加到代码中进行疑难解答。如日志中所述,代码正在尝试向类型为配置文件的数组添加配置文件对象。我不明白为什么这不会工作。

Below are the log messages that were added to the code to troubleshoot. As noted in the logs, the code is trying to add a Profile object to an Array of type Profile. I don't see why that wouldn't be working.

CollectionUtility.searchMapmsg = ZZZZZ抓取的ArrayStoreException ZZZZZ

CollectionUtility.searchMapmsg=ZZZZZ Caught ArrayStoreException ZZZZZ

CollectionUtility.searchMap | msg = ZZZZZ无法添加列表项到数组[Lcom.process.im.profile.impl.Profile; ZZZZZ

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

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

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

下面是 java代码 产生错误

Below is the java code that is producing 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 I may be missing something simple, but I'm not sure what to check next. If any of you have any ideas, please let me know. Any and all help is greatly appreciated. Thanks!

推荐答案

很好,你正在比较Object数组的类和Object。我很肯定这不是你打算做什么。

Well for one, you are comparing the class of an Object array to an Object. I'm pretty sure thats not what you are intending to do.

这篇关于不明的ArrayStoreException - 代码或配置问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆