Retrieve AuthorAccess in StylesFilter
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 174
- Joined: Fri Jan 20, 2017 1:11 pm
Retrieve AuthorAccess in StylesFilter
Hello,
We use oxygen sdk 27.1.0.1.
We have implemented our own StylesFilter and in the override method
For this, we have coded this :
But when we open a large document, we face a StackOverflowError error :
Can you explain to me how to retrieve AuthorAccess properly ?
Thanks,
Regards,
Isabelle
We use oxygen sdk 27.1.0.1.
We have implemented our own StylesFilter and in the override method
we need AuthorAccess.public Styles filter(Styles styles, AuthorNode authorNode)
For this, we have coded this :
Code: Select all
URL currentUrl = authorNode.getXMLBaseURL();
WSEditor currentPluginEditorAccess = PluginWorkspaceProvider.getPluginWorkspace().getEditorAccess(currentUrl, PluginWorkspace.MAIN_EDITING_AREA);
WSEditorPage currentPage = currentPluginEditorAccess.getCurrentPage();
if(currentPage instanceof WSAuthorEditorPage) {
WSAuthorEditorPage wsAuthorEditorPage = (WSAuthorEditorPage) currentPage;
return wsAuthorEditorPage.getAuthorAccess();
} else {
return null;
}
For information : ADAMStylesFilter.java:254 refers to URL currentUrl = authorNode.getXMLBaseURL();java.lang.StackOverflowError: null
at java.base/java.net.URLStreamHandler.parseURL(URLStreamHandler.java:326)
at java.base/sun.net.www.protocol.file.Handler.parseURL(Handler.java:67)
at java.base/java.net.URL.<init>(URL.java:703)
at java.base/java.net.URL.<init>(URL.java:569)
at java.base/java.net.URL.<init>(URL.java:516)
at ro.sync.ecss.dom.ib.getXMLBaseURL(Unknown Source)
at ro.sync.ecss.dom.ib.getXMLBaseURL(Unknown Source)
at ro.sync.ecss.dom.ib.getXMLBaseURL(Unknown Source)
at ro.sync.ecss.dom.ib.getXMLBaseURL(Unknown Source)
at ro.sync.ecss.dom.ib.getXMLBaseURL(Unknown Source)
at ro.sync.ecss.dom.ib.getXMLBaseURL(Unknown Source)
at ro.sync.ecss.dom.ib.getXMLBaseURL(Unknown Source)
at com._4dconcept.adam.author.framework.S1000D.style.ADAMStylesFilter.getAuthorAccess(ADAMStylesFilter.java:254)
at com._4dconcept.adam.author.framework.S1000D.style.ADAMStylesFilter.filter(ADAMStylesFilter.java:54)
at ro.sync.ecss.css.db.pe(Unknown Source)
at ro.sync.ecss.css.db.xg(Unknown Source)
at ro.sync.ecss.css.db.q(Unknown Source)
...
Can you explain to me how to retrieve AuthorAccess properly ?
Thanks,
Regards,
Isabelle
-
- Posts: 9491
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Retrieve AuthorAccess in StylesFilter
Hi Isabelle,
The StylesFilter does not have access to the current editor for a reason. It may start getting called very early, before the current editor is opened.
In the Javadoc for the StylesFilter class it says:
so this is the proper way to gain access to the AuthorAccess corresponding to it.
But even with using the proper way of retrieving the AuthorAccess, if inside the styles filter you use the authoraccess to try and retrieve the styles for another node, then the same styles filter gets called to compute styles also for that node so you might again end up with a stack overflow.
Regards,
Radu
The StylesFilter does not have access to the current editor for a reason. It may start getting called very early, before the current editor is opened.
In the Javadoc for the StylesFilter class it says:
Code: Select all
* <p>If your StylesFilter implementation also implements the {@link AuthorExtensionStateListener} API, its "activated" callback will be automatically
* called with the corresponding {@link AuthorAccess}.</p>
But even with using the proper way of retrieving the AuthorAccess, if inside the styles filter you use the authoraccess to try and retrieve the styles for another node, then the same styles filter gets called to compute styles also for that node so you might again end up with a stack overflow.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 174
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Retrieve AuthorAccess in StylesFilter
Thank you Radu for your quick feedback.
I made an other test.
I have this custom StylesFilter :
And I style have a StackOverflowError :
Do you have any idea ?
Thanks,
Regards,
Isabelle
I made an other test.
I have this custom StylesFilter :
Code: Select all
public abstract class CustomStylesFilter implements StylesFilter {
public CustomStylesFilter () {
}
@Override
public Styles filter(Styles styles, AuthorNode authorNode) {
if (AuthorNode.NODE_TYPE_ELEMENT == authorNode.getType() && ("nodeName".equals(authorNode.getName()))) {
AuthorElement[] code = ((AuthorElement) authorNode).getElementsByLocalName("code");
if (code != null && code.length > 0) {
String infoCode = code[0].getAttribute("infoCode").getValue();
}
}
return styles;
}
@Override
public String getDescription() {
return null;
}
}
I delete all references to AuthorAcces and I still have this issue.java.lang.StackOverflowError: null
at java.base/java.util.WeakHashMap.hash(WeakHashMap.java:303)
at java.base/java.util.WeakHashMap.get(WeakHashMap.java:402)
at ro.sync.ecss.css.db.qc(Unknown Source)
at ro.sync.ecss.css.db.q(Unknown Source)
at ro.sync.ecss.component.f.g.m(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
Do you have any idea ?
Thanks,
Regards,
Isabelle
Last edited by Isabelle on Tue Jul 01, 2025 3:56 pm, edited 1 time in total.
-
- Posts: 9491
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Retrieve AuthorAccess in StylesFilter
Hi Isabelle,
That looks like a different stack overflow, could you most more content from the stack trace exception? More lines?
Regards,
Radu
That looks like a different stack overflow, could you most more content from the stack trace exception? More lines?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 174
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Retrieve AuthorAccess in StylesFilter
Here is the full stack trace :
But sometimes I have other errors :java.lang.StackOverflowError: null
at java.base/java.util.WeakHashMap.hash(WeakHashMap.java:303)
at java.base/java.util.WeakHashMap.get(WeakHashMap.java:402)
at ro.sync.ecss.css.db.qc(Unknown Source)
at ro.sync.ecss.css.db.q(Unknown Source)
at ro.sync.ecss.component.f.g.m(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
...........
java.lang.StackOverflowError: null
at ro.sync.exml.options.Options.nb(Unknown Source)
at ro.sync.exml.options.Options.ob(Unknown Source)
at ro.sync.exml.options.Options.wb(Unknown Source)
at ro.sync.exml.options.Options.getObject(Unknown Source)
at ro.sync.options.k.getBooleanProperty(Unknown Source)
at ro.sync.ecss.conditions.c.c.k(Unknown Source)
at ro.sync.ecss.conditions.y.ead(Unknown Source)
at ro.sync.ecss.conditions.y.rzc(Unknown Source)
at ro.sync.ecss.css.db.qb(Unknown Source)
at ro.sync.ecss.css.db.xg(Unknown Source)
at ro.sync.ecss.css.db.q(Unknown Source)
at ro.sync.ecss.component.f.g.m(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
...........
-
- Posts: 9491
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Retrieve AuthorAccess in StylesFilter
Hi Isabella,
Strange, both these stack overflow stack traces seem to stem from the automatic spell checker, it gets in some kind of a loop, I need to think more about this.
But if you uncomment your styles filter API implementation the problem cannot be reproduced correct? Can you come up with the most basic styles filter implementation that I could use on my side to reproduce the problem?
Regards,
Radu
Strange, both these stack overflow stack traces seem to stem from the automatic spell checker, it gets in some kind of a loop, I need to think more about this.
But if you uncomment your styles filter API implementation the problem cannot be reproduced correct? Can you come up with the most basic styles filter implementation that I could use on my side to reproduce the problem?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 174
- Joined: Fri Jan 20, 2017 1:11 pm
Re: Retrieve AuthorAccess in StylesFilter
Hi Radu,
When I comment the method createAuthorStylesFilter in our CustomExtensionsBundle I still have the issue
Regards,
Isabelle
When I comment the method createAuthorStylesFilter in our CustomExtensionsBundle I still have the issue
I can send you the XML file for your test if needed.java.lang.StackOverflowError: null
at java.base/java.util.WeakHashMap.hash(WeakHashMap.java:303)
at java.base/java.util.WeakHashMap.get(WeakHashMap.java:402)
at ro.sync.ecss.css.db.qc(Unknown Source)
at ro.sync.ecss.css.db.q(Unknown Source)
at ro.sync.ecss.component.f.g.m(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
at ro.sync.ecss.component.f.g.h(Unknown Source)
Regards,
Isabelle
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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