Skip to content

Commit

Permalink
[#188] Upgrade xalan to 2.7.3 due to CVE-2022-34169
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaseder committed May 9, 2023
2 parents bdb9d0a + d77fec5 commit 1e487ec
Show file tree
Hide file tree
Showing 18 changed files with 354 additions and 234 deletions.
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@
<dependency>
<groupId>org.jooq</groupId>
<artifactId>joox</artifactId>
<version>1.6.2</version>
<version>2.0.0</version>
</dependency>
```

**For use with Java 8+**

```xml
<dependency>
<groupId>org.jooq</groupId>
<artifactId>joox-java-8</artifactId>
<version>2.0.0</version>
</dependency>
```

Expand All @@ -32,7 +42,7 @@
<dependency>
<groupId>org.jooq</groupId>
<artifactId>joox-java-6</artifactId>
<version>1.6.2</version>
<version>2.0.0</version>
</dependency>
```

Expand Down Expand Up @@ -138,7 +148,7 @@ Match x4 = $(document).find("book").filter(odd());
List<String> ids = $(document).find("book").ids();

// This will get all books with ID = 1 or ID = 2
Match x5 = $(document).find("book").filter(ids(1, 2));
Match x5 = $(document).find("book").filter(ids("1", "2"));

// Or, use css-selector syntax:
Match x6 = $(document).find("book#1, book#2");
Expand Down
6 changes: 4 additions & 2 deletions jOOX-java-8/.classpath
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
Expand All @@ -23,9 +25,9 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
Expand Down
9 changes: 6 additions & 3 deletions jOOX-java-8/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=9
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=9
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
Expand All @@ -22,6 +22,7 @@ org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
Expand Down Expand Up @@ -64,6 +65,7 @@ org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=igno
org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=warning
org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
Expand Down Expand Up @@ -93,7 +95,8 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disa
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=9
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11
org.eclipse.jdt.core.formatter.align_type_members_on_columns=true
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
Expand Down
69 changes: 36 additions & 33 deletions jOOX-java-8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@

<groupId>org.jooq</groupId>
<artifactId>joox-java-8</artifactId>
<version>1.6.3</version>
<version>2.0.0</version>
<packaging>bundle</packaging>

<properties>
<jaxb.version>3.0.0</jaxb.version>
</properties>

<name>jOOX</name>
<description>jOOX is a recursive acronym that stands for jOOX Object Oriented XML. It is a simple wrapper for the org.w3c.dom package, to allow for fluent XML document creation and manipulation where DOM is required but too verbose.</description>
<url>https://github.com/jOOQ/jOOX</url>
Expand Down Expand Up @@ -83,7 +87,7 @@

<profiles>
<profile>
<id>release</id>
<id>release-oss</id>
<build>
<plugins>
<plugin>
Expand Down Expand Up @@ -179,19 +183,18 @@
</includes>
<replacements>
<replacement>
<token><![CDATA[<body>]]></token>
<value><![CDATA[<body>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-30716479-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
<token><![CDATA[</body>]]></token>
<value><![CDATA[
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-PB08BGF2SR"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-PB08BGF2SR');
</script>
</body>
]]></value>
</replacement>
</replacements>
Expand All @@ -201,14 +204,20 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.1</version>
<version>3.0.1</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
Expand All @@ -231,26 +240,20 @@

<dependencies>

<!-- Runtime dependencies -->

















<!-- Prior to Java 9, the JAXB dependency was shipped with the JDK -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>${jaxb.version}</version>
</dependency>

<!-- Test dependencies -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>${jaxb.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
Expand Down
21 changes: 20 additions & 1 deletion jOOX-java-8/src/main/java/org/joox/Impl.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import java.util.function.Function;
import java.util.regex.Pattern;

import javax.xml.bind.JAXB;
import jakarta.xml.bind.JAXB;
import javax.xml.namespace.NamespaceContext;
import javax.xml.namespace.QName;
import javax.xml.transform.Source;
Expand All @@ -69,9 +69,11 @@
import javax.xml.xpath.XPathFactory;
import javax.xml.xpath.XPathVariableResolver;

import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

Expand Down Expand Up @@ -1197,6 +1199,23 @@ public final Impl prepend(Element... content) {
return this;
}

@Override
public final Set<String> attrNames() {
Set<String> result = new LinkedHashSet<>();

for (Element e : this) {
NamedNodeMap m = e.getAttributes();
int length = m.getLength();

for (int i = 0; i < length; i++) {
Attr a = (Attr) m.item(i);
result.add(a.getName());
}
}

return result;
}

@Override
public final String attr(String name) {
if (size() > 0)
Expand Down
21 changes: 15 additions & 6 deletions jOOX-java-8/src/main/java/org/joox/JOOX.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,17 @@
import java.net.URI;
import java.net.URL;
import java.nio.file.Path;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.regex.Pattern;

import javax.xml.bind.DataBindingException;
import javax.xml.bind.JAXB;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
Expand All @@ -46,6 +49,12 @@
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import jakarta.xml.bind.DataBindingException;
import jakarta.xml.bind.JAXB;
import jakarta.xml.bind.JAXBContext;
import jakarta.xml.bind.JAXBException;
import jakarta.xml.bind.Marshaller;

/**
* @author Lukas Eder
*/
Expand Down
6 changes: 6 additions & 0 deletions jOOX-java-8/src/main/java/org/joox/Match.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.xml.transform.Result;
import javax.xml.transform.Source;
Expand Down Expand Up @@ -1752,6 +1753,11 @@ public interface Match extends Iterable<Element> {
// Manipulation of attributes
// ---------------------------------------------------------------------

/**
* Get the set of available attribute names in the set of matched elements.
*/
Set<String> attrNames();

/**
* Get an attribute from the first element in the set of matched elements,
* or <code>null</code> if the first element does not have that attribute.
Expand Down
6 changes: 3 additions & 3 deletions jOOX-java-8/src/test/java/org/joox/Customer.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
*/
package org.joox;

import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import jakarta.xml.bind.annotation.XmlAttribute;
import jakarta.xml.bind.annotation.XmlElement;
import jakarta.xml.bind.annotation.XmlRootElement;

/**
* @author Lukas Eder
Expand Down
Loading

1 comment on commit 1e487ec

@lukaseder
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea what git silliness happened here 🫠

Please sign in to comment.