Skip to content

Commit

Permalink
#103 deps polished
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 11, 2022
1 parent 8f89ccd commit 98fcf6a
Show file tree
Hide file tree
Showing 15 changed files with 22 additions and 51 deletions.
5 changes: 5 additions & 0 deletions pom.xml
Expand Up @@ -93,6 +93,11 @@ OF THE POSSIBILITY OF SUCH DAMAGE.
<artifactId>lombok</artifactId>
<version>1.18.24</version>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.9.2</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/xembly/Directives.java
Expand Up @@ -234,8 +234,8 @@ public Directives append(final Iterable<Directive> dirs) {
* Appends the {@link Node node}.
* @param node The node to append
* @return This object
* @see #append(java.lang.Iterable)
* @see Directives#copyOf(org.w3c.dom.Node)
* @see #append(Iterable)
* @see Directives#copyOf(Node)
* @since 0.23
*/
public Directives append(final Node node) {
Expand Down
8 changes: 0 additions & 8 deletions src/main/java/org/xembly/ParsingException.java
Expand Up @@ -41,14 +41,6 @@ final class ParsingException extends RuntimeException {
*/
private static final long serialVersionUID = 0x6547f999eaf6efb9L;

/**
* Public ctor.
* @param cause Cause of it
*/
ParsingException(final String cause) {
super(cause);
}

/**
* Public ctor.
* @param cause Cause of it
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/xembly/RemoveDirective.java
Expand Up @@ -69,7 +69,7 @@ public Directive.Cursor exec(final Node dom,
@SuppressWarnings("aibolit.P13")
private static Node parent(final Node node) {
final Node parent;
if (node.getNodeType() == Node.ATTRIBUTE_NODE) {
if ((int) node.getNodeType() == (int) Node.ATTRIBUTE_NODE) {
final Attr attr = Attr.class.cast(node);
parent = attr.getOwnerElement();
Element.class.cast(parent).removeAttributeNode(attr);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/xembly/Xembler.java
Expand Up @@ -76,7 +76,7 @@
* a necessity to catch checked exceptions.
* Use {@code *Quietly()} methods for that:
* {@link #xmlQuietly()}, {@link #domQuietly()},
* and {@link #applyQuietly(org.w3c.dom.Node)}.
* and {@link #applyQuietly(Node)}.
*
* @since 0.1
* @checkstyle ClassDataAbstractionCouplingCheck (500 lines)
Expand Down
9 changes: 0 additions & 9 deletions src/main/java/org/xembly/XmlContentException.java
Expand Up @@ -49,13 +49,4 @@ final class XmlContentException extends Exception {
super(cause);
}

/**
* Public ctor.
* @param cause Cause of it
* @param thr Original throwable
*/
XmlContentException(final String cause, final Throwable thr) {
super(cause, thr);
}

}
7 changes: 1 addition & 6 deletions src/main/java/org/xembly/XpathDirective.java
Expand Up @@ -58,12 +58,7 @@ final class XpathDirective implements Directive {
* XPath factory.
*/
private static final ThreadLocal<XPathFactory> FACTORY =
new ThreadLocal<XPathFactory>() {
@Override
protected XPathFactory initialValue() {
return XPathFactory.newInstance();
}
};
ThreadLocal.withInitial(XPathFactory::newInstance);

/**
* Pattern to match root-only XPath queries.
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/xembly/AddIfDirectiveTest.java
Expand Up @@ -36,7 +36,6 @@
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
* Test case for {@link AddIfDirective}.
Expand Down Expand Up @@ -83,7 +82,7 @@ public void addsDomNodesDirectly() throws Exception {
root.appendChild(dom.createProcessingInstruction("a12", "22"));
dom.appendChild(root);
new AddIfDirective("b").exec(
dom, new DomCursor(Collections.<Node>singleton(root)),
dom, new DomCursor(Collections.singleton(root)),
new DomStack()
);
MatcherAssert.assertThat(
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/org/xembly/AttrDirectiveTest.java
Expand Up @@ -37,7 +37,6 @@
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
* Test case for {@link AddDirective}.
Expand Down Expand Up @@ -88,7 +87,7 @@ public void addsDomAttributesDirectly() throws Exception {
root.appendChild(second);
dom.appendChild(root);
new AttrDirective("x", "y").exec(
dom, new DomCursor(Collections.<Node>singletonList(second)),
dom, new DomCursor(Collections.singletonList(second)),
new DomStack()
);
MatcherAssert.assertThat(
Expand All @@ -109,7 +108,7 @@ public void addsCaseSensitiveAttributesDirectly() throws Exception {
final Element root = dom.createElement("f");
dom.appendChild(root);
new AttrDirective("Price", "\u20ac50").exec(
dom, new DomCursor(Collections.<Node>singletonList(root)),
dom, new DomCursor(Collections.singletonList(root)),
new DomStack()
);
MatcherAssert.assertThat(
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/xembly/PiDirectiveTest.java
Expand Up @@ -38,7 +38,6 @@
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
* Test case for {@link PiDirective}.
Expand Down Expand Up @@ -84,7 +83,7 @@ public void addsProcessingInstructionsDirectlyToDom() throws Exception {
final Element root = dom.createElement("xxx");
dom.appendChild(root);
new PiDirective("x", "y").exec(
dom, new DomCursor(Collections.<Node>emptyList()),
dom, new DomCursor(Collections.emptyList()),
new DomStack()
);
MatcherAssert.assertThat(
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/xembly/RemoveDirectiveTest.java
Expand Up @@ -37,7 +37,6 @@
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
* Test case for {@link RemoveDirective}.
Expand Down Expand Up @@ -88,7 +87,7 @@ public void removesDomNodesDirectly() throws Exception {
root.appendChild(second);
dom.appendChild(root);
new RemoveDirective().exec(
dom, new DomCursor(Collections.<Node>singletonList(first)),
dom, new DomCursor(Collections.singletonList(first)),
new DomStack()
);
MatcherAssert.assertThat(
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/xembly/SetDirectiveTest.java
Expand Up @@ -38,7 +38,6 @@
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
* Test case for {@link SetDirective}.
Expand Down Expand Up @@ -99,7 +98,7 @@ public void setsTextDirectlyIntoDomNodes() throws Exception {
root.appendChild(second);
dom.appendChild(root);
new SetDirective("alpha").exec(
dom, new DomCursor(Arrays.<Node>asList(first, second)),
dom, new DomCursor(Arrays.asList(first, second)),
new DomStack()
);
MatcherAssert.assertThat(
Expand Down
12 changes: 3 additions & 9 deletions src/test/java/org/xembly/XemblerTest.java
Expand Up @@ -274,14 +274,8 @@ public void concurrentInvocationWithNoExceptions() throws Exception {
* @param document DOM object
* @return Callable object
*/
private static Callable<Node> callable(
final Xembler xembler, final Node document
) {
return new Callable<Node>() {
@Override
public Node call() throws Exception {
return xembler.apply(document);
}
};
private static Callable<Node> callable(final Xembler xembler,
final Node document) {
return () -> xembler.apply(document);
}
}
4 changes: 2 additions & 2 deletions src/test/java/org/xembly/XpathDirectiveTest.java
Expand Up @@ -110,7 +110,7 @@ public void findsNodesByXpathDirectly() throws Exception {
MatcherAssert.assertThat(
new XpathDirective("/*").exec(
dom,
new DomCursor(Collections.<Node>singletonList(first)),
new DomCursor(Collections.singletonList(first)),
new DomStack()
),
Matchers.hasItem(root)
Expand All @@ -128,7 +128,7 @@ public void findsNodesInEmptyDom() throws Exception {
MatcherAssert.assertThat(
new XpathDirective("/some-root").exec(
dom,
new DomCursor(Collections.<Node>emptyList()),
new DomCursor(Collections.emptyList()),
new DomStack()
),
Matchers.emptyIterable()
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/org/xembly/XsetDirectiveTest.java
Expand Up @@ -37,7 +37,6 @@
import org.junit.jupiter.api.Test;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;

/**
* Test case for {@link XsetDirective}.
Expand Down Expand Up @@ -92,7 +91,7 @@ public void setsTextDirectlyIntoDomNodes() throws Exception {
root.appendChild(second);
dom.appendChild(root);
new XsetDirective("sum(/xxx/*/text()) + 5").exec(
dom, new DomCursor(Collections.<Node>singletonList(first)),
dom, new DomCursor(Collections.singletonList(first)),
new DomStack()
);
MatcherAssert.assertThat(
Expand Down

0 comments on commit 98fcf6a

Please sign in to comment.