File new-antrun-plugin.patch of Package randomizedtesting

--- randomizedtesting-release-2.5.3/junit4-maven-plugin/src/main/java/com/carrotsearch/maven/plugins/junit4/JUnit4Mojo.java	2022-04-06 19:17:07.489471526 +0200
+++ randomizedtesting-release-2.5.3/junit4-maven-plugin/src/main/java/com/carrotsearch/maven/plugins/junit4/JUnit4Mojo.java	2022-04-07 07:19:06.822339019 +0200
@@ -29,7 +29,6 @@
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.antrun.AntrunXmlPlexusConfigurationWriter;
 import org.apache.maven.plugins.annotations.Component;
 import org.apache.maven.plugins.annotations.LifecyclePhase;
 import org.apache.maven.plugins.annotations.Mojo;
@@ -690,7 +689,7 @@
       }
 
       StringWriter writer = new StringWriter();
-      AntrunXmlPlexusConfigurationWriter xmlWriter = new AntrunXmlPlexusConfigurationWriter();
+      XmlConfigurationWriter xmlWriter = new XmlConfigurationWriter();
       xmlWriter.write(config, writer);
       Element root = new SAXReader().read(
           new StringReader(writer.toString())).getRootElement();
--- randomizedtesting-release-2.5.3/junit4-maven-plugin/src/main/java/com/carrotsearch/maven/plugins/junit4/XmlConfigurationWriter.java	1970-01-01 01:00:00.000000000 +0100
+++ randomizedtesting-release-2.5.3/junit4-maven-plugin/src/main/java/com/carrotsearch/maven/plugins/junit4/XmlConfigurationWriter.java	2022-04-07 07:14:10.520332767 +0200
@@ -0,0 +1,102 @@
+package com.carrotsearch.maven.plugins.junit4;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.codehaus.plexus.configuration.PlexusConfiguration;
+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+import org.codehaus.plexus.util.xml.XMLWriter;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Write a plexus configuration to a stream
+ */
+class XmlConfigurationWriter
+{
+
+    /**
+     * @param configuration {@link PlexusConfiguration}
+     * @param writer {@link Writer}
+     * @throws IOException In case of problems.
+     */
+    public void write( PlexusConfiguration configuration, Writer writer )
+        throws IOException
+    {
+        final int depth = 0;
+
+        PrettyPrintXMLWriter xmlWriter = new PrettyPrintXMLWriter( writer );
+        write( configuration, xmlWriter, depth );
+    }
+
+    private void write( PlexusConfiguration c, XMLWriter w, int depth )
+        throws IOException
+    {
+        int count = c.getChildCount();
+
+        if ( count == 0 )
+        {
+            writeTag( c, w, depth );
+        }
+        else
+        {
+            w.startElement( c.getName() );
+            writeAttributes( c, w );
+
+            for ( int i = 0; i < count; i++ )
+            {
+                PlexusConfiguration child = c.getChild( i );
+
+                write( child, w, depth + 1 );
+            }
+
+            w.endElement();
+        }
+    }
+
+    private void writeTag( PlexusConfiguration c, XMLWriter w, int depth )
+        throws IOException
+    {
+        w.startElement( c.getName() );
+
+        writeAttributes( c, w );
+
+        String value = c.getValue( null );
+        if ( value != null )
+        {
+            w.writeText( value );
+        }
+
+        w.endElement();
+    }
+
+    private void writeAttributes( PlexusConfiguration c, XMLWriter w )
+        throws IOException
+    {
+        String[] names = c.getAttributeNames();
+
+        for ( String name : names )
+        {
+            w.addAttribute( name, c.getAttribute( name, null ) );
+        }
+    }
+
+}
+
openSUSE Build Service is sponsored by