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条数据就会出现问题了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值