ro.sync.ecss.extensions.api.node.AuthorNode#getTextContent() throws NullPointer
Oxygen general issues.
ro.sync.ecss.extensions.api.node.AuthorNode#getTextContent() throws NullPointer
Hello,
the ro.sync.ecss.extensions.api.node.AuthorNode#getTextContent() method throws a NullPointerException.
It occurs in a ro.sync.ecss.extensions.api.StylesFilter, when I try to get the text content of all existing PIs (ro.sync.ecss.extensions.api.node.AuthorNode#NODE_TYPE_PI)
Usually the getTextContent() method should only throw a javax.swing.text.BadLocationException, but not a NullPointerException.
The actual PI content where the NullPointer was thrown is : "tag TT0000014@A.4"
But the document itself contains more of those PIs, which look similar where the NullPointer is not thrown.
Maybe you could have a look at it.
Best regards,
Simon
the ro.sync.ecss.extensions.api.node.AuthorNode#getTextContent() method throws a NullPointerException.
Code: Select all
java.lang.NullPointerException
at ro.sync.ecss.dom.o.f(Unknown Source)
at ro.sync.ecss.dom.o.getTextContent(Unknown Source)
Usually the getTextContent() method should only throw a javax.swing.text.BadLocationException, but not a NullPointerException.
The actual PI content where the NullPointer was thrown is : "tag TT0000014@A.4"
But the document itself contains more of those PIs, which look similar where the NullPointer is not thrown.
Maybe you could have a look at it.
Best regards,
Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
Re: ro.sync.ecss.extensions.api.node.AuthorNode#getTextContent() throws NullPointer
Hi Simon,
This is a known issue and we work to fix it.
The problem is that a processing instruction node has no content information the first time when the styles are applied on it.
The only thing that you can do for now (until the fix is available) is to catch the NullPointerException and ignore it (this exception will appear only the first time when the filter method is invoked). The filter method will be then called for the same processing instruction node when this will have a content information so your filter code will be applied correctly.
We will let you know when the fix will be available.
Best regards,
Mihaela
This is a known issue and we work to fix it.
The problem is that a processing instruction node has no content information the first time when the styles are applied on it.
The only thing that you can do for now (until the fix is available) is to catch the NullPointerException and ignore it (this exception will appear only the first time when the filter method is invoked). The filter method will be then called for the same processing instruction node when this will have a content information so your filter code will be applied correctly.
We will let you know when the fix will be available.
Best regards,
Mihaela
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Re: ro.sync.ecss.extensions.api.node.AuthorNode#getTextContent() throws NullPointer
Hello mihaela,
I also realized that this Exception only occurs at startup and afterwards everything works great.
I just postet this Bug for you in case you have not recognized it yet.
Best regards,
Simon
I also realized that this Exception only occurs at startup and afterwards everything works great.
I just postet this Bug for you in case you have not recognized it yet.
Best regards,
Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
Re: ro.sync.ecss.extensions.api.node.AuthorNode#getTextConte
Hi Oxygen team,
We just stumbled on exactly the same problem. This is quite old - as this bug been fixed since. If not, is it on your roadmap ? Does the advice of catching the NPE still apply? - it seems to work, I'm just not that keen on catching NPE's in my code.
Thanks,
Martin
We just stumbled on exactly the same problem. This is quite old - as this bug been fixed since. If not, is it on your roadmap ? Does the advice of catching the NPE still apply? - it seems to work, I'm just not that keen on catching NPE's in my code.
Thanks,
Martin
Re: ro.sync.ecss.extensions.api.node.AuthorNode#getTextConte
Hi Martin,
Here is the javadoc of the authorNode parameter of the ro.sync.ecss.extensions.api.StylesFilter.filter(Styles, AuthorNode) method:
What you can do is to check if the node type is AuthorNode.NODE_TYPE_PI before calling the getTextContent() method (the artificial elements have the AuthorNode.NODE_TYPE_ELEMENT type).
Here is the javadoc of the authorNode parameter of the ro.sync.ecss.extensions.api.StylesFilter.filter(Styles, AuthorNode) method:
This artificial node that wraps the processing instruction node has no content information (it has the processing instruction information stored in attributes) and this is why you get the NPE when calling getTextContent() on it.@param authorNode The node to filter the CSS style for.
If this node points to a processing instruction, a CDATA or a comment then the real node can be
obtained by casting this object to {@link ArtificialNode} and using {@link ArtificialNode#getWrappedNode()}.
What you can do is to check if the node type is AuthorNode.NODE_TYPE_PI before calling the getTextContent() method (the artificial elements have the AuthorNode.NODE_TYPE_ELEMENT type).
Mihaela Calotescu
http://www.oxygenxml.com
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service