directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cohei...@apache.org
Subject directory-kerby git commit: Adding ErrorProne maven plugin
Date Mon, 16 Oct 2017 11:28:51 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk aa3dfaf11 -> 8ae0b3542


Adding ErrorProne maven plugin


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/8ae0b354
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/8ae0b354
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/8ae0b354

Branch: refs/heads/trunk
Commit: 8ae0b35429396f87a8f8160acb056e778f9166a9
Parents: aa3dfaf
Author: Colm O hEigeartaigh <coheigea@apache.org>
Authored: Mon Oct 16 12:28:42 2017 +0100
Committer: Colm O hEigeartaigh <coheigea@apache.org>
Committed: Mon Oct 16 12:28:42 2017 +0100

----------------------------------------------------------------------
 .../apache/kerby/xdr/XdrStructTypeInstance.java |  1 +
 .../kerb/client/request/KdcRequest.java         | 10 +++----
 .../kerby/kerberos/kerb/Krb5ParserTest.java     |  2 +-
 .../kerby/kerberos/kerb/gss/GssMechFactory.java |  3 +-
 .../kerberos/kerb/gss/impl/GssEncryptor.java    |  2 +-
 .../kerberos/kerb/server/LoginTestBase.java     |  2 +-
 .../kerberos/provider/token/TokenTest.java      | 30 ++++++++++----------
 pom.xml                                         | 16 +++++++++++
 8 files changed, 42 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
----------------------------------------------------------------------
diff --git a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
index 37c5196..2262353 100644
--- a/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
+++ b/kerby-common/kerby-xdr/src/test/java/org/apache/kerby/xdr/XdrStructTypeInstance.java
@@ -85,6 +85,7 @@ public class XdrStructTypeInstance extends XdrStructType {
                     break;
                 case STRUCT:
                     fields[i] = new XdrStructTypeInstance((XdrFieldInfo[]) fieldInfos[i].getValue());
+                    break;
                 default:
                     fields[i] = null;
             }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
index fe2e1e1..d52a938 100644
--- a/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
+++ b/kerby-kerb/kerb-client/src/main/java/org/apache/kerby/kerberos/kerb/client/request/KdcRequest.java
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.kerby.kerberos.kerb.client.request;
 
@@ -313,7 +313,7 @@ public abstract class KdcRequest {
 
     public KerberosTime getTicketTillTime() {
         long now = System.currentTimeMillis();
-        return new KerberosTime(now + KerberosTime.MINUTE * 60 * 1000);
+        return new KerberosTime(now + (long) KerberosTime.MINUTE * 60 * 1000);
     }
 
     public void addHost(String hostNameOrIpAddress) throws UnknownHostException {

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
b/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
index 89e5fab..364bb50 100644
--- a/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
+++ b/kerby-kerb/kerb-common/src/test/java/org/apache/kerby/kerberos/kerb/Krb5ParserTest.java
@@ -50,6 +50,6 @@ public class Krb5ParserTest {
         assertThat(k.getSection("libdefaults", "dns_lookup_kdc")).isEqualTo("false");
         assertThat(k.getSection("realms", "ATHENA.MIT.EDU") instanceof Map).isTrue();
         assertThat(k.getSection("realms", "ATHENA.MIT.EDU", "v4_instance_convert") instanceof
 Map).isTrue();
-        assertThat(k.getSection("realms", "ATHENA.MIT.EDU", "v4_instance_convert", "mit").equals("mit.edu"));
+        assertThat(k.getSection("realms", "ATHENA.MIT.EDU", "v4_instance_convert", "mit")).isEqualTo("mit.edu");
     }
 }

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/GssMechFactory.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/GssMechFactory.java
b/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/GssMechFactory.java
index 735368b..3e7d4ae 100644
--- a/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/GssMechFactory.java
+++ b/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/GssMechFactory.java
@@ -35,6 +35,7 @@ import sun.security.jgss.spi.GSSNameSpi;
 import sun.security.jgss.spi.MechanismFactory;
 
 import java.security.Provider;
+import java.util.Arrays;
 
 /**
  * Kerby Kerberos V5 plugin for JGSS
@@ -78,7 +79,7 @@ public class GssMechFactory implements MechanismFactory {
 
     public GSSNameSpi getNameElement(byte[] name, Oid nameType)
             throws GSSException {
-        return GssNameElement.getInstance(name.toString(), nameType);
+        return GssNameElement.getInstance(Arrays.toString(name), nameType);
     }
 
     // Used by initiator

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/impl/GssEncryptor.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/impl/GssEncryptor.java
b/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/impl/GssEncryptor.java
index 4eb96e3..e9efbc2 100644
--- a/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/impl/GssEncryptor.java
+++ b/kerby-kerb/kerb-gssapi/src/main/java/org/apache/kerby/kerberos/kerb/gss/impl/GssEncryptor.java
@@ -230,7 +230,7 @@ public class GssEncryptor {
                     Md5Provider md5Provider = new Md5Provider();
                     md5Provider.hash(toProc);
                     toProc = md5Provider.output();
-
+                    // fall through
                 case GssTokenV1.SGN_ALG_DES_MAC:
                     DesProvider desProvider = new DesProvider();
                     return desProvider.cbcMac(encKeyBytes, IV_ZEROR_8B, toProc);

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
index 401d5bb..1f83d57 100644
--- a/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
+++ b/kerby-kerb/kerb-kdc-test/src/test/java/org/apache/kerby/kerberos/kerb/server/LoginTestBase.java
@@ -69,7 +69,7 @@ public class LoginTestBase extends KdcTestBase {
 
     protected void checkSubject(Subject subject) {
         Set<Principal> clientPrincipals = subject.getPrincipals();
-        assertThat(clientPrincipals);
+        assertThat(clientPrincipals).isNotEmpty();
     }
 
     @After

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
----------------------------------------------------------------------
diff --git a/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
b/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
index ba544f7..e0335fb 100644
--- a/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
+++ b/kerby-provider/token-provider/src/test/java/org/apache/kerby/kerberos/provider/token/TokenTest.java
@@ -6,16 +6,16 @@
  *  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. 
- *  
+ *  under the License.
+ *
  */
 package org.apache.kerby.kerberos.provider.token;
 
@@ -121,7 +121,7 @@ public class TokenTest {
         Assertions.assertThat(token2.getSubject()).isEqualTo(SUBJECT);
         Assertions.assertThat(token2.getIssuer()).isEqualTo(ISSUER);
     }
-    
+
     @Test
     public void testTokenWithDirectEncryptedJWT() throws Exception {
         TokenEncoder tokenEncoder = KrbRuntime.getTokenProvider("JWT").createTokenEncoder();
@@ -130,7 +130,7 @@ public class TokenTest {
         KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
         keyGenerator.init(128);
         byte[] secretKey = keyGenerator.generateKey().getEncoded();
-        
+
         ((JwtTokenEncoder) tokenEncoder).setEncryptionKey(secretKey);
         ((JwtTokenEncoder) tokenEncoder).setJweAlgorithm(JWEAlgorithm.DIR);
         ((JwtTokenDecoder) tokenDecoder).setDecryptionKey(secretKey);
@@ -142,17 +142,17 @@ public class TokenTest {
         AuthToken token2 = tokenDecoder.decodeFromString(tokenStr);
         Assertions.assertThat(token2.getSubject()).isEqualTo(SUBJECT);
         Assertions.assertThat(token2.getIssuer()).isEqualTo(ISSUER);
-        
+
         // Now try with a different secret key
         secretKey = keyGenerator.generateKey().getEncoded();
         ((JwtTokenDecoder) tokenDecoder).setDecryptionKey(secretKey);
-        
+
         try {
             tokenDecoder.decodeFromString(tokenStr);
             Assertions.fail("Failure expected on a bad secret key");
         } catch (IOException ex) {
             String expectedError = "Failed to decrypt the encrypted JWT";
-            Assertions.assertThat(ex.getMessage().contains(expectedError));
+            Assertions.assertThat(ex.getMessage()).contains(expectedError);
             // expected
         }
     }
@@ -172,7 +172,7 @@ public class TokenTest {
         Assertions.assertThat(token2.getSubject()).isEqualTo(SUBJECT);
         Assertions.assertThat(token2.getIssuer()).isEqualTo(ISSUER);
     }
-    
+
     @Test
     public void testTokenWithHMACSignedJWT() throws Exception {
         TokenEncoder tokenEncoder = KrbRuntime.getTokenProvider("JWT").createTokenEncoder();
@@ -181,7 +181,7 @@ public class TokenTest {
         KeyGenerator keyGenerator = KeyGenerator.getInstance("AES");
         keyGenerator.init(256);
         byte[] secretKey = keyGenerator.generateKey().getEncoded();
-        
+
         ((JwtTokenEncoder) tokenEncoder).setSignKey(secretKey);
         ((JwtTokenEncoder) tokenEncoder).setJwsAlgorithm(JWSAlgorithm.HS256);
         ((JwtTokenDecoder) tokenDecoder).setVerifyKey(secretKey);
@@ -193,11 +193,11 @@ public class TokenTest {
         AuthToken token2 = tokenDecoder.decodeFromString(tokenStr);
         Assertions.assertThat(token2.getSubject()).isEqualTo(SUBJECT);
         Assertions.assertThat(token2.getIssuer()).isEqualTo(ISSUER);
-        
+
         // Now try with a different secret key
         secretKey = keyGenerator.generateKey().getEncoded();
         ((JwtTokenDecoder) tokenDecoder).setVerifyKey(secretKey);
-        
+
        token2 = tokenDecoder.decodeFromString(tokenStr);
        Assertions.assertThat(token2).isNull();
     }
@@ -211,7 +211,7 @@ public class TokenTest {
 
         KeyPairGenerator kpg = KeyPairGenerator.getInstance("EC");
         KeyPair keyPair = kpg.generateKeyPair();
-        
+
         ((JwtTokenEncoder) tokenEncoder).setSignKey(keyPair.getPrivate());
         ((JwtTokenEncoder) tokenEncoder).setJwsAlgorithm(JWSAlgorithm.ES256);
         ((JwtTokenDecoder) tokenDecoder).setVerifyKey(keyPair.getPublic());
@@ -224,7 +224,7 @@ public class TokenTest {
         Assertions.assertThat(token2.getSubject()).isEqualTo(SUBJECT);
         Assertions.assertThat(token2.getIssuer()).isEqualTo(ISSUER);
     }
-    
+
     @Test
     public void testTokenWithSignedAndEncryptedJWT() throws Exception {
         TokenEncoder tokenEncoder = KrbRuntime.getTokenProvider("JWT").createTokenEncoder();

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/8ae0b354/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 5b2be05..af50c99 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,7 +118,23 @@
             <source>1.7</source>
             <target>1.7</target>
             <encoding>UTF-8</encoding>
+            <compilerId>javac-with-errorprone</compilerId>
+            <forceJavacCompilerUse>true</forceJavacCompilerUse>
           </configuration>
+          <dependencies>
+            <dependency>
+              <groupId>org.codehaus.plexus</groupId>
+              <artifactId>plexus-compiler-javac-errorprone</artifactId>
+              <version>2.8</version>
+            </dependency>
+            <!-- override plexus-compiler-javac-errorprone's dependency on
+                 Error Prone with the latest version -->
+            <dependency>
+              <groupId>com.google.errorprone</groupId>
+              <artifactId>error_prone_core</artifactId>
+              <version>2.1.1</version>
+            </dependency>
+          </dependencies>
         </plugin>
 
         <plugin>


Mime
View raw message