From dev-return-39632-archive-asf-public=cust-asf.ponee.io@poi.apache.org Tue Feb 27 12:22:23 2018 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id 39218180651 for ; Tue, 27 Feb 2018 12:22:23 +0100 (CET) Received: (qmail 74873 invoked by uid 500); 27 Feb 2018 11:22:22 -0000 Mailing-List: contact dev-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Developers List" Delivered-To: mailing list dev@poi.apache.org Received: (qmail 74862 invoked by uid 99); 27 Feb 2018 11:22:21 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Feb 2018 11:22:21 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 6E410C1289 for ; Tue, 27 Feb 2018 11:22:21 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -10.311 X-Spam-Level: X-Spam-Status: No, score=-10.311 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01, USER_IN_DEF_SPF_WL=-7.5] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id cnViC_JJXKZs for ; Tue, 27 Feb 2018 11:22:20 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 91BD85F3BB for ; Tue, 27 Feb 2018 11:22:20 +0000 (UTC) Received: from asf-bz1-us-mid.priv.apache.org (nat1-us-mid.apache.org [23.253.172.122]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTPS id 13B23E00B5 for ; Tue, 27 Feb 2018 11:22:20 +0000 (UTC) Received: by asf-bz1-us-mid.priv.apache.org (ASF Mail Server at asf-bz1-us-mid.priv.apache.org, from userid 33) id 1AD116011F; Tue, 27 Feb 2018 11:22:19 +0000 (UTC) From: bugzilla@apache.org To: dev@poi.apache.org Subject: [Bug 62138] New: Undefined results for insertNewRun() method when XWPFParagraph contains SDT runs Date: Tue, 27 Feb 2018 11:22:18 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: POI X-Bugzilla-Component: XWPF X-Bugzilla-Version: 3.14-FINAL X-Bugzilla-Keywords: X-Bugzilla-Severity: major X-Bugzilla-Who: radu.c.stefanescu@gmail.com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: dev@poi.apache.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bz.apache.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 https://bz.apache.org/bugzilla/show_bug.cgi?id=3D62138 Bug ID: 62138 Summary: Undefined results for insertNewRun() method when XWPFParagraph contains SDT runs Product: POI Version: 3.14-FINAL Hardware: PC Status: NEW Severity: major Priority: P2 Component: XWPF Assignee: dev@poi.apache.org Reporter: radu.c.stefanescu@gmail.com Target Milestone: --- Problem: I have a paragraph that contains one SDT element (Checkbox) on position 0 a= nd some text on the next runs. I want to insert a text run BEFORE the SDT elem= ent in the paragraph, but calling the following method does not yield the expec= ted results: paragraph.insertNewRun(0); The insertNewRun method, when doing the synchronization between the Run list and the IRun list, will make no assumptions about the ordering of XWPFSDT a= nd XWPFRun types of elements in the IRun list, which in this case is not yield= ing the desired result, as a client of the API will not be able to order the sequence of IRunElements as desired. In the example before, the new text run (XWPFRun) is inserted on position 1, rather then before the XWPFSDT element. This is happening due to this logic: // To update the iruns, find where we're going // in the normal runs, and go in there int iPos =3D iruns.size(); if (pos < runs.size()) { XWPFRun oldAtPos =3D runs.get(pos); int oldAt =3D iruns.indexOf(oldAtPos); if (oldAt !=3D -1) { iPos =3D oldAt; } } Possible solution: enrich the API for XWPFParagraph with a method that inse= rts directly in the IRun list in order to be able to control the correct order = of runs. --=20 You are receiving this mail because: You are the assignee for the bug.= --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org For additional commands, e-mail: dev-help@poi.apache.org