From 475c890121caf645a5111eec653d0c955e436c41 Mon Sep 17 00:00:00 2001 From: volodya-lombrozo Date: Mon, 6 May 2024 17:14:56 +0300 Subject: [PATCH] bug(#247): fix all qulice suggestions --- src/main/java/com/jcabi/xml/XMLDocument.java | 14 ++++++++++++-- src/test/java/com/jcabi/xml/XMLDocumentTest.java | 6 +++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/jcabi/xml/XMLDocument.java b/src/main/java/com/jcabi/xml/XMLDocument.java index 17a543a..fa16c27 100644 --- a/src/main/java/com/jcabi/xml/XMLDocument.java +++ b/src/main/java/com/jcabi/xml/XMLDocument.java @@ -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 { @@ -157,7 +160,6 @@ public XMLDocument(final String text) { ); } - /** * Public ctor, from XML as a text. * @@ -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(), @@ -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, diff --git a/src/test/java/com/jcabi/xml/XMLDocumentTest.java b/src/test/java/com/jcabi/xml/XMLDocumentTest.java index b3ffa0b..c40e1c5 100644 --- a/src/test/java/com/jcabi/xml/XMLDocumentTest.java +++ b/src/test/java/com/jcabi/xml/XMLDocumentTest.java @@ -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("\n \n", factory), + new XMLDocument("\n \n", factory), Matchers.equalTo( - new XMLDocument("\n \n\n", factory) + new XMLDocument("\n \n\n", factory) ) ); }