This is an automated email from the ASF dual-hosted git repository.
bodewig pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant-ivy.git
The following commit(s) were added to refs/heads/master by this push:
new 503aafc5 IVY-1648 some tests are failing on Java8
503aafc5 is described below
commit 503aafc594b777ffb035a457ed341e31334c23a4
Author: Stefan Bodewig <[email protected]>
AuthorDate: Fri Sep 15 18:09:50 2023 +0200
IVY-1648 some tests are failing on Java8
---
asciidoc/release-notes.adoc | 1 +
test/java/org/apache/ivy/core/resolve/ResolveTest.java | 3 +--
.../ivy/plugins/parser/xml/XmlModuleUpdaterTest.java | 15 +++++++++++++++
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/asciidoc/release-notes.adoc b/asciidoc/release-notes.adoc
index 782e75df..d0fd7c31 100644
--- a/asciidoc/release-notes.adoc
+++ b/asciidoc/release-notes.adoc
@@ -43,6 +43,7 @@ For details about the following changes, check our JIRA
install at link:https://
*List of changes since Ivy 2.5.2:*
- FIX: trying to set safe XML features causes SAXExceptions when used with
certain XML parsers (jira:IVY-1647[])
+- FIX: some unit tests failed on Java 8 (jira:IVY-1648[]) (Thanks to Adrien
Piquerez)
////
Samples :
diff --git a/test/java/org/apache/ivy/core/resolve/ResolveTest.java
b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
index 5c611420..4dba1e59 100644
--- a/test/java/org/apache/ivy/core/resolve/ResolveTest.java
+++ b/test/java/org/apache/ivy/core/resolve/ResolveTest.java
@@ -323,9 +323,8 @@ public class ResolveTest {
int expectedNumberOfDependencies) {
Ivy ivy = new Ivy();
Throwable th = null;
- Properties p = System.getProperties();
+ Properties p = (Properties) System.getProperties().clone();
try {
- System.setProperties(new Properties());
System.setProperty(XMLHelper.ALLOW_DOCTYPE_PROCESSING, "true");
if (externalResourcesSystemProperty != null) {
System.setProperty(XMLHelper.EXTERNAL_RESOURCES,
externalResourcesSystemProperty);
diff --git
a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
index c38eca3d..df0ce6a1 100644
--- a/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
+++ b/test/java/org/apache/ivy/plugins/parser/xml/XmlModuleUpdaterTest.java
@@ -37,6 +37,7 @@ import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Properties;
import org.apache.ivy.Ivy;
import org.apache.ivy.core.module.descriptor.Artifact;
@@ -47,14 +48,28 @@ import org.apache.ivy.core.module.id.ModuleRevisionId;
import org.apache.ivy.core.settings.IvySettings;
import org.apache.ivy.plugins.repository.BasicResource;
import org.apache.ivy.util.FileUtil;
+import org.apache.ivy.util.XMLHelper;
import org.junit.After;
+import org.junit.Before;
import org.junit.Test;
public class XmlModuleUpdaterTest {
+ // Java8 tries to load ivy.xsd mentioned in
+ // xsd:noNamespaceLocation via https bypassing our UriResolver so
+ // we must allow using http(s) (and thus all) and external entities
+ private final Properties p = (Properties) System.getProperties().clone();
+
+ @Before
+ public void setUp() {
+ System.setProperty(XMLHelper.ALLOW_DOCTYPE_PROCESSING, "true");
+ System.setProperty(XMLHelper.EXTERNAL_RESOURCES, "all");
+ }
+
@After
public void tearDown() {
XmlModuleDescriptorUpdater.LINE_SEPARATOR = System.lineSeparator();
+ System.setProperties(p);
}
@Test