Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWPFParagraph: easier way to create a link. #153

Closed
wants to merge 4 commits into from
Closed

XWPFParagraph: easier way to create a link. #153

wants to merge 4 commits into from

Conversation

@asfgit
Copy link

asfgit commented Jun 4, 2019

Can one of the admins verify this patch?

@dourouc05
Copy link
Author

I've just added a test; is this OK to merge?

Copy link
Contributor

@pjfanning pjfanning left a 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)

@dourouc05
Copy link
Author

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 hyperlinks field).

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).

@asfgit asfgit closed this in e14c9f2 Jul 19, 2019
@pjfanning
Copy link
Contributor

pjfanning commented Jul 19, 2019

asfgit pushed a commit that referenced this pull request Oct 6, 2019
Alain-Bearez pushed a commit to cuali/poi that referenced this pull request Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants