Skip to content

Commit

Permalink
bug(#247): fix all qulice suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
volodya-lombrozo committed May 6, 2024
1 parent 46a5182 commit 475c890
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions src/main/java/com/jcabi/xml/XMLDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ public final class XMLDocument implements XML {
*/
private final transient Node cache;

/**
* Transformer factory to use for {@link #toString()}.
*/
private final transient TransformerFactory tfactory;

static {
Expand Down Expand Up @@ -157,7 +160,6 @@ public XMLDocument(final String text) {
);
}


/**
* Public ctor, from XML as a text.
*
Expand All @@ -177,7 +179,7 @@ public XMLDocument(final String text) {
* @param text XML document body
* @param factory Transformer factory
*/
public XMLDocument(final String text, TransformerFactory factory) {
public XMLDocument(final String text, final TransformerFactory factory) {
this(
new DomParser(XMLDocument.DFACTORY, text).document(),
new XPathContext(),
Expand Down Expand Up @@ -346,6 +348,14 @@ private XMLDocument(
this(node, ctx, lfe, XMLDocument.TFACTORY);
}

/**
* Private ctor.
* @param cache The source
* @param context Namespace context
* @param leaf Is it a leaf node?
* @param tfactory Transformer factory
* @checkstyle ParameterNumberCheck (5 lines)
*/
public XMLDocument(
final Node cache,
final XPathContext context,
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/com/jcabi/xml/XMLDocumentTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,13 @@ void comparesDocumentsWithDifferentIndentations() {
// different indentations. Don't forget to remove the @Disabled annotation from this test.
final TransformerFactory factory = TransformerFactory.newInstance(
"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
this.getClass().getClassLoader()
Thread.currentThread().getContextClassLoader()
);
MatcherAssert.assertThat(
"Different indentations should be ignored",
new XMLDocument("<program>\n <indentation/>\n</program>", factory),
new XMLDocument("<program>\n <indentation/>\n</program>", factory),
Matchers.equalTo(
new XMLDocument("<program>\n <indentation/>\n</program>\n", factory)
new XMLDocument("<program>\n <indentation/>\n</program>\n", factory)
)
);
}
Expand Down

0 comments on commit 475c890

Please sign in to comment.