You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2018/11/16 19:51:56 UTC

[GitHub] rfscholte closed pull request #23: [MRESOLVER-63] FileTransformer#transformData(File) should also throw TransformException

rfscholte closed pull request #23: [MRESOLVER-63] FileTransformer#transformData(File) should also throw TransformException
URL: https://github.com/apache/maven-resolver/pull/23
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/maven-resolver-api/src/main/java/org/eclipse/aether/transform/FileTransformer.java b/maven-resolver-api/src/main/java/org/eclipse/aether/transform/FileTransformer.java
index 4c520b3f..8de43422 100644
--- a/maven-resolver-api/src/main/java/org/eclipse/aether/transform/FileTransformer.java
+++ b/maven-resolver-api/src/main/java/org/eclipse/aether/transform/FileTransformer.java
@@ -46,6 +46,9 @@
      * 
      * @param file the file with the original data
      * @return the transformed data
+     * @throws IOException If an I/O error occurred
+     * @throws TransformException If the file could not be transformed
      */
-    InputStream transformData( File file ) throws IOException;
+    InputStream transformData( File file )
+        throws IOException, TransformException;
 }
diff --git a/maven-resolver-api/src/main/java/org/eclipse/aether/transform/TransformException.java b/maven-resolver-api/src/main/java/org/eclipse/aether/transform/TransformException.java
new file mode 100644
index 00000000..fe58f20f
--- /dev/null
+++ b/maven-resolver-api/src/main/java/org/eclipse/aether/transform/TransformException.java
@@ -0,0 +1,68 @@
+package org.eclipse.aether.transform;
+
+/*
+ * 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.
+ */
+
+/**
+ * Thrown when transformation failed.
+ */
+public class TransformException
+    extends Exception
+{
+
+    /**
+     * Creates a new exception with default detail message.
+     */
+    public TransformException()
+    {
+        super( "Transformation failed" );
+    }
+
+    /**
+     * Creates a new exception with the specified detail message.
+     *
+     * @param message The detail message, may be {@code null}.
+     */
+    public TransformException( String message )
+    {
+        super( message );
+    }
+
+    /**
+     * Creates a new exception with the specified cause.
+     *
+     * @param cause The exception that caused this one, may be {@code null}.
+     */
+    public TransformException( Throwable cause )
+    {
+        super( cause );
+    }
+
+    /**
+     * Creates a new exception with the specified detail message and cause.
+     *
+     * @param message The detail message, may be {@code null}.
+     * @param cause   The exception that caused this one, may be {@code null}.
+     */
+    public TransformException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+
+}
diff --git a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java
index 68a3547c..39f76e68 100644
--- a/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java
+++ b/maven-resolver-impl/src/test/java/org/eclipse/aether/internal/impl/DefaultInstallerTest.java
@@ -50,6 +50,7 @@
 import org.eclipse.aether.metadata.DefaultMetadata;
 import org.eclipse.aether.metadata.Metadata;
 import org.eclipse.aether.metadata.Metadata.Nature;
+import org.eclipse.aether.transform.TransformException;
 import org.eclipse.aether.transform.FileTransformer;
 import org.eclipse.aether.util.artifact.SubArtifact;
 import org.junit.After;
@@ -429,7 +430,7 @@ public void testFileTransformer() throws Exception
         {
             @Override
             public InputStream transformData( File file )
-                throws IOException
+                throws IOException, TransformException
             {
                 return new ByteArrayInputStream( "transformed data".getBytes( StandardCharsets.UTF_8 ) );
             }
diff --git a/pom.xml b/pom.xml
index bca779aa..36ae155f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,12 @@
   <url>https://maven.apache.org/resolver/</url>
   <inceptionYear>2010</inceptionYear>
 
+  <contributors>
+    <contributor>
+      <name>Matej Cimbora</name>
+    </contributor>
+  </contributors>
+
   <scm>
     <connection>scm:git:https://gitbox.apache.org/repos/asf/maven-resolver.git</connection>
     <developerConnection>scm:git:https://gitbox.apache.org/repos/asf/maven-resolver.git</developerConnection>


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services