-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
XWPFParagraph: easier way to create a link. #153
XWPFParagraph: easier way to create a link. #153
Conversation
Can one of the admins verify this patch? |
I've just added a test; is this OK to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test fails for me.
Testcase: testAddHyperlink took 0.007 sec
Caused an ERROR
null
java.lang.NullPointerException
at org.apache.poi.xwpf.usermodel.TestXWPFDocument.testAddHyperlink(TestXWPFDocument.java:194)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
The DOCX always got generated as it should have, but retrieving a newly added link could not work. What I did is call initHyperlinks in XWPFDocument each time a link is requested by ID, in case a new link was added (first emptying the Is this approach correct? From my understanding, I think so… Performancewise, it seems problematic, as the list is rebuilt each time a request for a link is made, this is why I made a second commit to rebuild this list only when the link is not found (which is already better). |
Merged using https://svn.apache.org/repos/asf/poi/trunk@1863433 |
…ibaut Cuvelier. This closes #153 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1863433 13f79535-47bb-0310-9956-ffa450edef68
…ibaut Cuvelier. This closes apache#153 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1863433 13f79535-47bb-0310-9956-ffa450edef68
Inspiration from https://stackoverflow.com/questions/55275241/how-to-add-a-hyperlink-to-the-footer-of-a-xwpfdocument-using-apache-poi