[Bug 61236] New: Dynamically addAbstractNum in XWPFNumbering

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[Bug 61236] New: Dynamically addAbstractNum in XWPFNumbering

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61236

            Bug ID: 61236
           Summary: Dynamically addAbstractNum in XWPFNumbering
           Product: POI
           Version: 3.16-FINAL
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XWPF
          Assignee: [hidden email]
          Reporter: [hidden email]
  Target Milestone: ---

I want addAbstractNum in XWPFNumbering Dynamically, but in method
org.apache.poi.xwpf.usermodel.XWPFNumbering.addAbstractNum(), if
abstractNum.getAbstractNum() is null, will throw NullPointerException


TRACE:

java.lang.NullPointerException
        at
org.apache.poi.xwpf.usermodel.XWPFNumbering.addAbstractNum(XWPFNumbering.java:242)

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61236] Dynamically addAbstractNum in XWPFNumbering

Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61236

--- Comment #1 from PJ Fanning <[hidden email]> ---
Isn't abstractNum the param you pass in?

public BigInteger addAbstractNum(XWPFAbstractNum abstractNum)

Can't you ensure that your abstractNum has a non-null value for
abstractNum.getAbstractNum()?

Eg by using
public XWPFAbstractNum(CTAbstractNum abstractNum)

Could you provide a full sample of what you are trying to do?

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61236] Dynamically addAbstractNum in XWPFNumbering

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61236

--- Comment #2 from [hidden email] ---
(In reply to PJ Fanning from comment #1)

> Isn't abstractNum the param you pass in?
>
> public BigInteger addAbstractNum(XWPFAbstractNum abstractNum)
>
> Can't you ensure that your abstractNum has a non-null value for
> abstractNum.getAbstractNum()?
>
> Eg by using
> public XWPFAbstractNum(CTAbstractNum abstractNum)
>
> Could you provide a full sample of what you are trying to do?

abstractNum.getAbstractNum() is really null,i just want to addAbstractNum。
Java Code allow abstractNum.getAbstractNum() has a null value,but in else
block, throw exception,So the else block is dead.

Thank you.
finally, i found this method to addAbstractNum, it's OK,
https://stackoverflow.com/questions/44433347/apache-poi-numbered-list

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[Bug 61236] Dynamically addAbstractNum in XWPFNumbering

Bugzilla from bugzilla@apache.org
In reply to this post by Bugzilla from bugzilla@apache.org
https://bz.apache.org/bugzilla/show_bug.cgi?id=61236

Dominik Stadler <[hidden email]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |WORKSFORME

--- Comment #3 from Dominik Stadler <[hidden email]> ---
Seems to be ok for now based on last comment.

--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]