You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by ol...@apache.org on 2014/10/15 05:00:04 UTC

git commit: add a modernizer maven plugin build profile and fix one issue detected

Repository: archiva-redback-core
Updated Branches:
  refs/heads/master 694e1be55 -> 819fd5363


add a modernizer maven plugin build profile and fix one issue detected


Project: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/commit/819fd536
Tree: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/tree/819fd536
Diff: http://git-wip-us.apache.org/repos/asf/archiva-redback-core/diff/819fd536

Branch: refs/heads/master
Commit: 819fd5363db6180cb969a8bb94bf64e14cf62810
Parents: 694e1be
Author: Olivier Lamy <ol...@apache.org>
Authored: Wed Oct 15 13:59:56 2014 +1100
Committer: Olivier Lamy <ol...@apache.org>
Committed: Wed Oct 15 13:59:56 2014 +1100

----------------------------------------------------------------------
 pom.xml                                         | 24 ++++++++++++++++++++
 .../encoders/AbstractJAASPasswordEncoder.java   | 12 +++-------
 2 files changed, 27 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva-redback-core/blob/819fd536/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3a747a0..64efb8b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -924,6 +924,30 @@
         </plugins>
       </build>
     </profile>
+    <profile>
+      <id>modernizer</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.gaul</groupId>
+            <artifactId>modernizer-maven-plugin</artifactId>
+            <version>1.1.0</version>
+            <configuration>
+              <javaVersion>1.8</javaVersion>
+            </configuration>
+            <executions>
+              <execution>
+                <id>modernizer</id>
+                <goals>
+                  <goal>modernizer</goal>
+                </goals>
+                <phase>process-test-classes</phase>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 
 </project>

http://git-wip-us.apache.org/repos/asf/archiva-redback-core/blob/819fd536/redback-policy/src/main/java/org/apache/archiva/redback/policy/encoders/AbstractJAASPasswordEncoder.java
----------------------------------------------------------------------
diff --git a/redback-policy/src/main/java/org/apache/archiva/redback/policy/encoders/AbstractJAASPasswordEncoder.java b/redback-policy/src/main/java/org/apache/archiva/redback/policy/encoders/AbstractJAASPasswordEncoder.java
index c0a067d..bc1ded2 100644
--- a/redback-policy/src/main/java/org/apache/archiva/redback/policy/encoders/AbstractJAASPasswordEncoder.java
+++ b/redback-policy/src/main/java/org/apache/archiva/redback/policy/encoders/AbstractJAASPasswordEncoder.java
@@ -22,7 +22,7 @@ import org.apache.archiva.redback.users.Messages;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.commons.lang.StringUtils;
 
-import java.io.UnsupportedEncodingException;
+import java.nio.charset.Charset;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 
@@ -30,7 +30,6 @@ import java.security.NoSuchAlgorithmException;
  * Abstract Password Encoder that uses the {@link MessageDigest} from JAAS.
  *
  * @author <a href="mailto:joakim@erdfelt.com">Joakim Erdfelt</a>
- *
  */
 public class AbstractJAASPasswordEncoder
     implements PasswordEncoder
@@ -69,7 +68,7 @@ public class AbstractJAASPasswordEncoder
                 // Conforming to acegi password encoding standards for compatibility
                 precode += "{" + salt + "}";
             }
-            md.update( precode.getBytes( "UTF-8" ) ); //$NON-NLS-1$
+            md.update( precode.getBytes( Charset.forName( "UTF-8" ) ) );
 
             byte raw[] = md.digest();
             Base64 base64 = new Base64( 0, new byte[0] );
@@ -78,12 +77,7 @@ public class AbstractJAASPasswordEncoder
         catch ( NoSuchAlgorithmException e )
         {
             throw new PasswordEncodingException(
-                Messages.getString( "password.encoder.no.such.algoritm", this.algorithm ), e ); //$NON-NLS-1$
-        }
-        catch ( UnsupportedEncodingException e )
-        {
-            throw new PasswordEncodingException( Messages.getString( "password.encoder.unsupported.encoding" ),
-                                                 e ); //$NON-NLS-1$
+                Messages.getString( "password.encoder.no.such.algoritm", this.algorithm ), e );
         }
     }