You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2019/12/02 10:39:16 UTC
[groovy] 02/04: fix style items
This is an automated email from the ASF dual-hosted git repository.
sunlan pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 51ed9e1ce56ad093fd995441f1b780ab3f5bbb4b
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sun Dec 1 18:40:59 2019 -0600
fix style items
(cherry picked from commit 78525bb50924ec6a35db665bc4b9053a0c18a3c8)
---
.../codehaus/groovy/control/customizers/SecureASTCustomizer.java | 8 ++++----
.../groovy/control/customizers/SecureASTCustomizerTest.groovy | 6 +++---
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java b/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
index fe4622e..0a743ba 100644
--- a/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
+++ b/src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java
@@ -695,8 +695,8 @@ public class SecureASTCustomizer extends CompilationCustomizer {
if (staticStarImportsWhitelist != null) {
// we should now check if the import is in the star imports
String packageName = className.substring(0, className.lastIndexOf('.') + 1) + "*";
- if (!staticStarImportsWhitelist.contains(className + ".*") &&
- !staticStarImportsWhitelist.stream().filter(it -> it.endsWith(".")).anyMatch(packageName::startsWith)) {
+ if (!staticStarImportsWhitelist.contains(className + ".*")
+ && !staticStarImportsWhitelist.stream().filter(it -> it.endsWith(".")).anyMatch(packageName::startsWith)) {
throw new SecurityException("Importing [" + fqn + "] is not allowed");
}
} else {
@@ -709,8 +709,8 @@ public class SecureASTCustomizer extends CompilationCustomizer {
// check that there's no star import blacklist
if (staticStarImportsBlacklist != null) {
String packageName = className.substring(0, className.lastIndexOf('.') + 1) + "*";
- if (staticStarImportsBlacklist.contains(className + ".*") ||
- staticStarImportsBlacklist.stream().filter(it -> it.endsWith(".")).anyMatch(packageName::startsWith)) {
+ if (staticStarImportsBlacklist.contains(className + ".*")
+ || staticStarImportsBlacklist.stream().filter(it -> it.endsWith(".")).anyMatch(packageName::startsWith)) {
throw new SecurityException("Importing [" + fqn + "] is not allowed");
}
}
diff --git a/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy b/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy
index ad645ae..6feb2ba 100644
--- a/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy
+++ b/src/test/org/codehaus/groovy/control/customizers/SecureASTCustomizerTest.groovy
@@ -398,7 +398,7 @@ final class SecureASTCustomizerTest {
}
@Test
- void testStaticStarImportWhiteList() {
+ void testStaticStarImportWhiteList1() {
customizer.staticStarImportsWhitelist = ['java.lang.Math.*']
def shell = new GroovyShell(configuration)
shell.evaluate('''
@@ -415,7 +415,7 @@ final class SecureASTCustomizerTest {
}
@Test
- void testStaticDoubleStarImportWhiteList() {
+ void testStaticStarImportWhiteList2() {
customizer.staticStarImportsWhitelist = ['java.lang.**']
def shell = new GroovyShell(configuration)
shell.evaluate('''
@@ -432,7 +432,7 @@ final class SecureASTCustomizerTest {
}
@Test
- void testStaticDoubleStarImportBlackList() {
+ void testStaticStarImportBlackList1() {
customizer.staticStarImportsBlacklist = ['java.lang.**']
def shell = new GroovyShell(configuration)
assert hasSecurityException {