首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

java.lang.IndexOutOfBoundsException: Index: 七, Size: 7

2012-07-23 
java.lang.IndexOutOfBoundsException: Index: 7, Size: 7/*** 处在开放注册期内的代理订单* @param keywo

java.lang.IndexOutOfBoundsException: Index: 7, Size: 7

 /**     * 处在开放注册期内的代理订单     * @param keyword 产品名称关键词     * @param intAllCount 返回的总条数     * @param pageindex 当前页索引(翻页时用,从0开始)     * @param pagesize 每页显示条数     * @return     */    public static List<String[]>getOpenProductList(String keyword, int pageindex, int pagesize, Holder<Integer> AllCount)    {    int stringSize =10;//返回数组长度        List<String[]> list = new ArrayList<String[]> ();    List<String> tempList = new ArrayList<String> ();        Agent_JBTMClient client = new Agent_JBTMClient();        Agent_JBTMSoap service = client.getAgent_JBTMSoap();        ArrayOfArrayOfString tempArrayList = (ArrayOfArrayOfString) service.Get_OpenList(keyword, pageindex, pagesize, AllCount);                        //计算总页        int totalPage;if(AllCount.value%pagesize == 0){totalPage = AllCount.value/pagesize;}else{totalPage = AllCount.value/pagesize+1;}//判断数据量int count;if(pageindex == totalPage-1){//最后一页count =AllCount.value%pagesize;}else{count =AllCount.value<pagesize?AllCount.value:pagesize;}        if(AllCount.value>0)        {        for(int i=0; i<count; i++)            {            String[] tempString = new String[stringSize];            tempList = tempArrayList.getArrayOfString().get(i).getString();                        for(int j=0; j<stringSize; j++)            {            tempString[j] = tempList.get(j);                        }            list.add(tempString);            }        }        return list;    }    

??此代码循环显示的,之所以抛java.lang.IndexOutOfBoundsException: Index: 7, Size: 7

异常是因为int stringSize =10;//返回数组长度(接受10个字段值显示,结果net只传给我7个字段值。)

总数据一共13条,再循环显示7条数据就会出现问题了。

热点排行