[groovy] branch master updated: fix style items

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[groovy] branch master updated: fix style items

emilles
This is an automated email from the ASF dual-hosted git repository.

emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 78525bb  fix style items
78525bb is described below

commit 78525bb50924ec6a35db665bc4b9053a0c18a3c8
Author: Eric Milles <[hidden email]>
AuthorDate: Sun Dec 1 18:40:59 2019 -0600

    fix style items
---
 .../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 {