Skip to content

Commit 9f16326

Browse files
committed
Merge pull request #13378 from dreis2211:remove-commons-codec-imports
* pr/13378: Polish "Replace commons-codec Base64 usage" Replace commons-codec Base64 usage
2 parents e3bf518 + 68380b6 commit 9f16326

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/reactive/ReactiveTokenValidatorTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@
2929
import java.util.Map;
3030
import java.util.concurrent.ConcurrentHashMap;
3131

32-
import org.apache.commons.codec.binary.Base64;
3332
import org.junit.Before;
3433
import org.junit.Test;
3534
import org.mockito.Mock;
@@ -337,7 +336,8 @@ private PrivateKey getPrivateKey()
337336
+ "J/OOn5zOs8yf26os0q3+JUM=\n-----END PRIVATE KEY-----";
338337
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
339338
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
340-
byte[] pkcs8EncodedBytes = Base64.decodeBase64(privateKey);
339+
privateKey = privateKey.replace("\n", "");
340+
byte[] pkcs8EncodedBytes = Base64Utils.decodeFromString(privateKey);
341341
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
342342
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
343343
return keyFactory.generatePrivate(keySpec);

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/cloudfoundry/servlet/TokenValidatorTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -28,7 +28,6 @@
2828
import java.util.Collections;
2929
import java.util.Map;
3030

31-
import org.apache.commons.codec.binary.Base64;
3231
import org.junit.Before;
3332
import org.junit.Rule;
3433
import org.junit.Test;
@@ -248,7 +247,8 @@ private PrivateKey getPrivateKey()
248247
+ "J/OOn5zOs8yf26os0q3+JUM=\n-----END PRIVATE KEY-----";
249248
String privateKey = signingKey.replace("-----BEGIN PRIVATE KEY-----\n", "");
250249
privateKey = privateKey.replace("-----END PRIVATE KEY-----", "");
251-
byte[] pkcs8EncodedBytes = Base64.decodeBase64(privateKey);
250+
privateKey = privateKey.replace("\n", "");
251+
byte[] pkcs8EncodedBytes = Base64Utils.decodeFromString(privateKey);
252252
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(pkcs8EncodedBytes);
253253
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
254254
return keyFactory.generatePrivate(keySpec);

src/checkstyle/checkstyle.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<module name="io.spring.javaformat.checkstyle.SpringChecks" />
55
<module name="com.puppycrawl.tools.checkstyle.TreeWalker">
66
<module name="com.puppycrawl.tools.checkstyle.checks.imports.IllegalImportCheck">
7-
<property name="illegalPkgs" value="sun, org.apache.commons.(?!codec|compress|dbcp2|lang|lang3|logging|pool2).*, com.google.common, org.flywaydb.core.internal, reactor.core.support.Assert"/>
7+
<property name="illegalPkgs" value="sun, org.apache.commons.(?!compress|dbcp2|lang|lang3|logging|pool2).*, com.google.common, org.flywaydb.core.internal, reactor.core.support.Assert"/>
88
<property name="regexp" value="true"/>
99
</module>
1010
</module>

0 commit comments

Comments
 (0)