循环循环循环,求帮忙啊

当我进入这个循环的时候,为什么会导致这样的结果啊[ "liuhaifeng", "wanggang6", "nieyao", "liuhaifeng", "wanggang6", "nieyao", "liuhaifeng", "wanggang6", "nieyao",]

    String[] user_id = new String[] { "liuhaifeng", "wanggang6", "nieyao",
"lianwei" };
    ReturnValue<ReqSituation> ret = service.queryworkitem();

    List<ReqSituation> list = new ArrayList<ReqSituation>();
    if (ReturnCode.SUCCESS.equals(ret.getRetCode())) {
        list = ret.getContentByList();
    }
    Calendar c = Calendar.getInstance();
    if (list != null && list.size() > 0) {
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getSoftfx().equals("192")) {
                for (int j = 0; j < user_id.length - 1; j++) {

                    String itemid = UUID.randomUUID().toString();
                    String traceid = UUID.randomUUID().toString();
                    StringBuffer xml = new StringBuffer(
                            "<?xml version=\"1.0\" encoding=\"GBK\"?>");
                    xml.append("<apps id=\"24\" name=\"app24\">");
                    xml.append("<open>");
                    xml.append("<work doc_id='"
                            + list.get(i).getReqinstid() + "' work_id='"
                            + itemid + "' user_id='" + user_id[j]
                            + "' title='" + list.get(i).getReqName()
                            + "' start_time='"
                            + c.get(Calendar.HOUR_OF_DAY)
                            + "' ");
                    xml.append("url='http://"
                            + jlslmurl
                            + "/clientAction.do?method=clienLogin&amp;nextPage=/slm/unifymgr/unify-view.jsp&amp;instid="
                            + list.get(i).getReqinstid());
                    xml.append("&amp;processid="
                            + "3dc8887c-5631-42c8-bd4d-f0369b8fc988"
                            + "&amp;itemid=" + itemid + "&amp;traceid="
                            + traceid + "' from_man='admin' pri='1' type='"
                            + 3 + "'/>");
                    xml.append("</open>");
                    xml.append("</apps>");
                    HttpClient client = new HttpClient();
                    // client.getParams().setContentCharset("GBK");
                    PostMethod post = new PostMethod(url);
                    try {
                        post.setRequestEntity(new StringRequestEntity(xml
                                .toString(), "text/xml", "UTF-8"));
                        int num = client.executeMethod(post);
                        // 打印返回的信息
                        byte[] by = post.getResponseBody();
                        String log = new String(by);
                        // 释放连接
                        post.releaseConnection();

                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    service.insert25(list.get(i).getReqinstid(),
                            itemid, traceid, user_id[j]);

                }
            }
        }

3个回答

很明显的循环体结束不了,这个在自己循环体上加断点调试,看看为什么不结束,加上跳出循环就行了吧

只能建议你自己调试,因为你的代码中依赖很多外部的函数和变量,不调试很难说。

Python很优美简洁的语言,这么写不Pythonic,哈哈,就像你现在这样,几乎很难debug了,建议你看看《Learning Python》

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问