[MRESOLVER-63] FileTransformer#transformData(File) should also throw TransformException
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 4c520b3..8de4342 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 0000000..fe58f20
--- /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 68a3547..39f76e6 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 @@
{
@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 bca779a..36ae155 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>