[maven-resolver] branch MRESOLVER-60 created (now 9bfa46b)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[maven-resolver] branch MRESOLVER-60 created (now 9bfa46b)

Robert Scholte-8
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a change to branch MRESOLVER-60
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git.


      at 9bfa46b  [MRESOLVER-60] Possible NPE when calling RepositorySystemSession.getFileTransformerManager() Fix typo

This branch includes the following new commits:

     new 9bfa46b  [MRESOLVER-60] Possible NPE when calling RepositorySystemSession.getFileTransformerManager() Fix typo

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Reply | Threaded
Open this post in threaded view
|

[maven-resolver] 01/01: [MRESOLVER-60] Possible NPE when calling RepositorySystemSession.getFileTransformerManager() Fix typo

Robert Scholte-8
This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch MRESOLVER-60
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git

commit 9bfa46b5d702c9e8b9b101b798f69870208c2157
Author: rfscholte <[hidden email]>
AuthorDate: Wed Oct 10 21:05:03 2018 +0200

    [MRESOLVER-60] Possible NPE when calling RepositorySystemSession.getFileTransformerManager()
    Fix typo
---
 maven-resolver-api/pom.xml                         |  6 ++++++
 .../AbstractForwardingRepositorySystemSession.java |  4 ++--
 .../aether/DefaultRepositorySystemSession.java     |  3 ++-
 .../eclipse/aether/RepositorySystemSession.java    |  2 +-
 .../aether/DefaultRepositorySystemSessionTest.java | 25 ++++++++++++++++++++--
 .../aether/internal/impl/DefaultDeployer.java      |  2 +-
 .../aether/internal/impl/DefaultInstaller.java     |  2 +-
 pom.xml                                            |  6 ++++++
 8 files changed, 42 insertions(+), 8 deletions(-)

diff --git a/maven-resolver-api/pom.xml b/maven-resolver-api/pom.xml
index 7de33c3..a2da815 100644
--- a/maven-resolver-api/pom.xml
+++ b/maven-resolver-api/pom.xml
@@ -51,6 +51,12 @@
       <artifactId>hamcrest-core</artifactId>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <scope>test</scope>
+    </dependency>
+
   </dependencies>
 
   <build>
diff --git a/maven-resolver-api/src/main/java/org/eclipse/aether/AbstractForwardingRepositorySystemSession.java b/maven-resolver-api/src/main/java/org/eclipse/aether/AbstractForwardingRepositorySystemSession.java
index 35759cb..008a2df 100644
--- a/maven-resolver-api/src/main/java/org/eclipse/aether/AbstractForwardingRepositorySystemSession.java
+++ b/maven-resolver-api/src/main/java/org/eclipse/aether/AbstractForwardingRepositorySystemSession.java
@@ -213,9 +213,9 @@ public abstract class AbstractForwardingRepositorySystemSession
     }
     
     @Override
-    public FileTransformerManager geFileTransformerManager()
+    public FileTransformerManager getFileTransformerManager()
     {
-        return getSession().geFileTransformerManager();
+        return getSession().getFileTransformerManager();
     }
 
 }
diff --git a/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java b/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java
index 8ba4e15..0335118 100644
--- a/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java
+++ b/maven-resolver-api/src/main/java/org/eclipse/aether/DefaultRepositorySystemSession.java
@@ -175,6 +175,7 @@ public final class DefaultRepositorySystemSession
         setDependencySelector( session.getDependencySelector() );
         setVersionFilter( session.getVersionFilter() );
         setDependencyGraphTransformer( session.getDependencyGraphTransformer() );
+        setFileTransformerManager( session.getFileTransformerManager() );
         setData( session.getData() );
         setCache( session.getCache() );
     }
@@ -326,7 +327,7 @@ public final class DefaultRepositorySystemSession
     }
 
     @Override
-    public FileTransformerManager geFileTransformerManager()
+    public FileTransformerManager getFileTransformerManager()
     {
         return fileTransformerManager;
     }
diff --git a/maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java b/maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java
index 025ec80..5a3f14c 100644
--- a/maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java
+++ b/maven-resolver-api/src/main/java/org/eclipse/aether/RepositorySystemSession.java
@@ -266,6 +266,6 @@ public interface RepositorySystemSession
      *
      * @return the manager, never {@code null}
      */
-    FileTransformerManager geFileTransformerManager();
+    FileTransformerManager getFileTransformerManager();
 
 }
diff --git a/maven-resolver-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java b/maven-resolver-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java
index 91afeb5..5d5bb63 100644
--- a/maven-resolver-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java
+++ b/maven-resolver-api/src/test/java/org/eclipse/aether/DefaultRepositorySystemSessionTest.java
@@ -18,10 +18,13 @@ package org.eclipse.aether;
  * specific language governing permissions and limitations
  * under the License.
  */
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
 
-import static org.junit.Assert.*;
-
+import java.lang.reflect.Method;
 import java.util.Map;
+import java.util.Objects;
 
 import org.eclipse.aether.repository.Authentication;
 import org.eclipse.aether.repository.AuthenticationContext;
@@ -29,6 +32,7 @@ import org.eclipse.aether.repository.AuthenticationDigest;
 import org.eclipse.aether.repository.Proxy;
 import org.eclipse.aether.repository.RemoteRepository;
 import org.junit.Test;
+import org.mockito.Mockito;
 
 /**
  */
@@ -124,4 +128,21 @@ public class DefaultRepositorySystemSessionTest
         }
     }
 
+
+    @Test
+    public void testCopyRepositorySystemSession() throws Exception
+    {
+        RepositorySystemSession session = Mockito.mock( RepositorySystemSession.class, Mockito.RETURNS_MOCKS );
+
+        RepositorySystemSession newSession = new DefaultRepositorySystemSession( session );
+
+        Method[] methods = RepositorySystemSession.class.getMethods();
+
+        for ( Method method : methods )
+        {
+            assertEquals( method.getName(), Objects.isNull( method.invoke( session ) ),
+                          Objects.isNull( method.invoke( newSession ) ) );
+        }
+    }
+
 }
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDeployer.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDeployer.java
index 4d6f5be..31edb44 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDeployer.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultDeployer.java
@@ -239,7 +239,7 @@ public class DefaultDeployer
         {
             List<? extends MetadataGenerator> generators = getMetadataGenerators( session, request );
 
-            FileTransformerManager fileTransformerManager = session.geFileTransformerManager();
+            FileTransformerManager fileTransformerManager = session.getFileTransformerManager();
 
             List<ArtifactUpload> artifactUploads = new ArrayList<ArtifactUpload>();
             List<MetadataUpload> metadataUploads = new ArrayList<MetadataUpload>();
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java
index e4c998a..a517d74 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/DefaultInstaller.java
@@ -239,7 +239,7 @@ public class DefaultInstaller
 
         File srcFile = artifact.getFile();
 
-        Collection<FileTransformer> fileTransformers = session.geFileTransformerManager().getTransformersForArtifact( artifact );
+        Collection<FileTransformer> fileTransformers = session.getFileTransformerManager().getTransformersForArtifact( artifact );
         if ( fileTransformers.isEmpty() )
         {
             install( session, trace, artifact, lrm, srcFile, null );
diff --git a/pom.xml b/pom.xml
index 3a1c05b..d0df362 100644
--- a/pom.xml
+++ b/pom.xml
@@ -151,6 +151,12 @@
         <version>1.3</version>
         <scope>test</scope>
       </dependency>
+      <dependency>
+        <groupId>org.mockito</groupId>
+        <artifactId>mockito-core</artifactId>
+        <version>2.23.0</version>
+        <scope>test</scope>
+      </dependency>
 
       <dependency>
         <groupId>javax.inject</groupId>