Permalink
Browse files

whitespace, cleanup

  • Loading branch information...
burtbeckwith committed Jun 22, 2011
1 parent f6f1d39 commit f06bc674a31fafbddad66da76d11afb99107b314
Showing with 521 additions and 689 deletions.
  1. +3 −3 grails-bootstrap/src/main/groovy/grails/util/GrailsNameUtils.java
  2. +29 −13 grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/GrailsScriptRunner.java
  3. +7 −9 grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/cli/parsing/Option.java
  4. +4 −24 grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/resolve/IvyDependencyManager.groovy
  5. +24 −21 grails-bootstrap/src/main/groovy/org/codehaus/groovy/grails/resolve/PluginInstallEngine.groovy
  6. +2 −4 grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/GrailsClassUtils.java
  7. +1 −1 grails-core/src/main/groovy/org/codehaus/groovy/grails/commons/metaclass/LazyMetaPropertyMap.java
  8. +7 −10 ...core/src/main/groovy/org/codehaus/groovy/grails/commons/spring/WebRuntimeSpringConfiguration.java
  9. +2 −1 grails-core/src/main/groovy/org/codehaus/groovy/grails/exceptions/DefaultStackTraceFilterer.java
  10. +32 −32 grails-core/src/main/groovy/org/codehaus/groovy/grails/exceptions/StackTraceFilterer.java
  11. +2 −3 ...-core/src/main/groovy/org/codehaus/groovy/grails/orm/support/TransactionManagerPostProcessor.java
  12. +1 −1 grails-core/src/main/groovy/org/codehaus/groovy/grails/plugins/CoreGrailsPlugin.groovy
  13. +3 −3 grails-hibernate/src/main/groovy/org/codehaus/groovy/grails/orm/hibernate/HibernateDatastore.java
  14. +2 −2 ...plugin-controllers/src/main/groovy/org/codehaus/groovy/grails/plugins/web/api/ControllersApi.java
  15. +10 −11 ...lugin-controllers/src/main/groovy/org/codehaus/groovy/grails/web/metaclass/BindDynamicMethod.java
  16. +4 −6 ...ollers/src/test/groovy/org/codehaus/groovy/grails/compiler/web/MethodActionTransformerSpec.groovy
  17. +1 −1 ...-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/GroovyPagesGrailsPlugin.groovy
  18. +4 −4 grails-plugin-gsp/src/main/groovy/org/codehaus/groovy/grails/plugins/web/taglib/RenderTagLib.groovy
  19. +1 −3 grails-plugin-testing/src/main/groovy/grails/test/mixin/web/GroovyPageUnitTestMixin.groovy
  20. +4 −4 grails-plugin-testing/src/test/groovy/grails/test/mixin/GroovyPageUnitTestMixinTests.groovy
  21. +4 −6 ...l-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/DefaultUrlMappingEvaluator.java
  22. +3 −3 ...n-url-mappings/src/main/groovy/org/codehaus/groovy/grails/web/mapping/ResponseCodeUrlMapping.java
  23. +1 −2 grails-resources/src/grails/grails-app/conf/BuildConfig.groovy
  24. +10 −11 grails-resources/src/grails/grails-app/views/index.gsp
  25. +2 −2 grails-resources/src/grails/home/bash/startGrails
  26. +6 −15 grails-resources/src/grails/templates/scaffolding/Test.groovy
  27. +4 −4 grails-resources/src/war/css/errors.css
  28. +44 −46 grails-spring/src/main/groovy/grails/spring/BeanBuilder.java
  29. +7 −9 .../src/main/groovy/org/codehaus/groovy/grails/commons/spring/DefaultRuntimeSpringConfiguration.java
  30. +9 −9 ...e/src/main/groovy/org/codehaus/groovy/grails/web/servlet/mvc/AbstractGrailsControllerTests.groovy
  31. +2 −15 .../groovy/org/codehaus/groovy/grails/orm/hibernate/MappingDefinitionInheritedBySubclassTests.groovy
  32. +1 −3 ...ersistence/src/test/groovy/org/codehaus/groovy/grails/orm/hibernate/PersistenceMethodTests.groovy
  33. +6 −6 ...istence/src/test/groovy/org/codehaus/groovy/grails/orm/hibernate/SavePersistentMethodTests.groovy
  34. +2 −33 grails-test-suite-uber/src/test/groovy/grails/spring/BeanBuilderTests.groovy
  35. +17 −17 grails-test-suite-uber/src/test/groovy/grails/test/mixin/ControllerUnitTestMixinTests.groovy
  36. +4 −2 grails-test-suite-uber/src/test/groovy/grails/test/mixin/UrlMappingsTestMixinTests.groovy
  37. +1 −5 ...est-suite-uber/src/test/groovy/org/codehaus/groovy/grails/web/metaclass/ForwardMethodTests.groovy
  38. +2 −3 ...uite-uber/src/test/groovy/org/codehaus/groovy/grails/web/servlet/FlashScopeWithErrorsTests.groovy
  39. +5 −5 ...src/test/groovy/org/codehaus/groovy/grails/web/servlet/MultipleRenderCallsContentTypeTests.groovy
  40. +5 −6 ...s-test-suite-uber/src/test/groovy/org/codehaus/groovy/grails/web/servlet/RenderMethodTests.groovy
  41. +1 −3 ...e-uber/src/test/groovy/org/codehaus/groovy/grails/web/servlet/mvc/CommandObjectErrorsTests.groovy
  42. +7 −2 ...-suite-uber/src/test/groovy/org/codehaus/groovy/grails/web/servlet/mvc/CommandObjectsTests.groovy
  43. +2 −4 ...-suite-uber/src/test/groovy/org/codehaus/groovy/grails/web/servlet/mvc/RedirectMethodTests.groovy
  44. +1 −4 ...er/src/test/groovy/org/codehaus/groovy/grails/web/servlet/mvc/RedirectToDefaultActionTests.groovy
  45. +36 −42 ...e-uber/src/test/groovy/org/codehaus/groovy/grails/web/servlet/mvc/RenderDynamicMethodTests.groovy
  46. +15 −18 ...c/test/groovy/org/codehaus/groovy/grails/web/servlet/mvc/SimpleGrailsControllerHelperTests.groovy
  47. +2 −11 grails-test-suite-web/src/test/groovy/grails/gsp/PageRendererSpec.groovy
  48. +1 −4 ...te-web/src/test/groovy/org/codehaus/groovy/grails/plugins/web/filters/FilterExecutionTests.groovy
  49. +6 −8 ...b/src/test/groovy/org/codehaus/groovy/grails/web/binding/BindStringArrayToGenericListTests.groovy
  50. +1 −3 grails-test-suite-web/src/test/groovy/org/codehaus/groovy/grails/web/binding/EnumBindingTests.groovy
  51. +2 −4 grails-test-suite-web/src/test/groovy/org/codehaus/groovy/grails/web/binding/JSONBindingTests.groovy
  52. +14 −18 ...b/src/test/groovy/org/codehaus/groovy/grails/web/converters/AutoParamsJSONMarshallingTests.groovy
  53. +2 −4 ...eb/src/test/groovy/org/codehaus/groovy/grails/web/converters/AutoParamsXmlMarshallingTests.groovy
  54. +2 −4 ...est-suite-web/src/test/groovy/org/codehaus/groovy/grails/web/converters/JSONConverterTests.groovy
  55. +3 −4 ...test-suite-web/src/test/groovy/org/codehaus/groovy/grails/web/converters/XMLConverterTests.groovy
  56. +2 −5 ...suite-web/src/test/groovy/org/codehaus/groovy/grails/web/mime/ContentFormatControllerTests.groovy
  57. +3 −3 ...ls-test/src/main/groovy/org/codehaus/groovy/grails/test/junit4/runner/GrailsTestCaseRunner.groovy
  58. +4 −6 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/binding/ListOrderedSet.java
  59. +3 −6 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/binding/StructuredDateEditor.java
  60. +3 −3 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/pages/GroovyPageBinding.java
  61. +12 −17 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/pages/GroovyPagesServlet.java
  62. +7 −23 ...main/groovy/org/codehaus/groovy/grails/web/pages/discovery/GrailsConventionGroovyPageLocator.java
  63. +4 −5 ...rc/main/groovy/org/codehaus/groovy/grails/web/pages/discovery/GroovyPageCompiledScriptSource.java
  64. +5 −7 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/pages/discovery/GroovyPageLocator.java
  65. +4 −8 ...ls-web/src/main/groovy/org/codehaus/groovy/grails/web/pages/discovery/GroovyPageScriptSource.java
  66. +3 −2 ...eb/src/main/groovy/org/codehaus/groovy/grails/web/servlet/DefaultGrailsApplicationAttributes.java
  67. +2 −3 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/sitemesh/GrailsPageFilter.java
  68. +4 −9 grails-web/src/main/groovy/org/codehaus/groovy/grails/web/taglib/GroovySyntaxTag.java
  69. +4 −4 scripts/Upgrade.groovy
  70. +2 −4 scripts/_GrailsClasspath.groovy
  71. +12 −11 scripts/_PackagePlugins.groovy
  72. +74 −82 scripts/_PluginDependencies.groovy
@@ -19,6 +19,8 @@
import java.util.List;
import java.util.Locale;
+import org.springframework.util.Assert;
+
/**
* Utility methods for converting between different name types,
* for example from class names -> property names and vice-versa. The
@@ -62,9 +64,7 @@ public static String getGetterName(String propertyName) {
* @return The class name
*/
public static String getClassName(String logicalName, String trailingName) {
- if (isBlank(logicalName)) {
- throw new IllegalArgumentException("Argument [logicalName] cannot be null or blank");
- }
+ Assert.isTrue(!isBlank(logicalName), "Argument [logicalName] cannot be null or blank");
String className = logicalName.substring(0,1).toUpperCase(Locale.ENGLISH) + logicalName.substring(1);
if (trailingName != null) {
@@ -15,14 +15,38 @@
*/
package org.codehaus.groovy.grails.cli;
-
import gant.Gant;
import grails.build.logging.GrailsConsole;
-import grails.util.*;
+import grails.util.BuildSettings;
+import grails.util.BuildSettingsHolder;
+import grails.util.CosineSimilarity;
+import grails.util.Environment;
+import grails.util.GrailsNameUtils;
+import grails.util.PluginBuildSettings;
import groovy.lang.Closure;
import groovy.lang.GroovyObject;
import groovy.lang.GroovySystem;
import groovy.util.AntBuilder;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.regex.Pattern;
+
import org.apache.tools.ant.Project;
import org.codehaus.gant.GantBinding;
import org.codehaus.gant.GantMetaClass;
@@ -41,13 +65,6 @@
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.util.Log4jConfigurer;
-import java.io.*;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.net.URLClassLoader;
-import java.util.*;
-import java.util.regex.Pattern;
-
/**
* Handles Grails command line interface for running scripts.
*
@@ -142,8 +159,7 @@ public static void main(String[] args) {
return;
}
- String version = System.getProperty("grails.version");
-
+ String version = System.getProperty("grails.version");
ScriptAndArgs script = processArgumentsAndReturnScriptName(commandLine);
@@ -187,7 +203,7 @@ public static void main(String[] args) {
script.name = null;
}
if (script.name == null) {
- console.updateStatus("Loading Grails " + (version != null ? version : build.getGrailsVersion()));
+ console.updateStatus("Loading Grails " + (version != null ? version : build.getGrailsVersion()));
build.loadConfig();
scriptRunner.initializeState();
@@ -304,7 +320,7 @@ public int executeCommand(String scriptName, String args, String env) {
try {
System.setProperty("disable.grails.plugin.transform", "true");
- console.updateStatus("Loading Grails " + settings.getGrailsVersion());
+ console.updateStatus("Loading Grails " + settings.getGrailsVersion());
settings.loadConfig();
System.setProperty("springloaded.directoriesContainingReloadableCode",
@@ -15,9 +15,11 @@
*/
package org.codehaus.groovy.grails.cli.parsing;
+import org.springframework.util.Assert;
+import org.springframework.util.StringUtils;
+
/**
- * Represents a command line option
- *
+ * Represents a command line option.
*
* @author Graeme Rocher
* @since 1.4
@@ -28,13 +30,9 @@
private String description;
public Option(String name, String description) {
- if(name != null && name.length() > 0) {
- this.name = name;
- }
- else {
- throw new IllegalArgumentException("illegal option specified");
- }
- this.description = description != null ? description : "";
+ Assert.isTrue(StringUtils.hasLength(name), "Illegal option specified");
+ this.name = name;
+ this.description = description == null ? "" : description;
}
public String getName() {
@@ -18,43 +18,23 @@ import grails.util.BuildSettings
import grails.util.GrailsNameUtils
import grails.util.Metadata
+import java.util.concurrent.ConcurrentLinkedQueue
+
import org.apache.ivy.core.event.EventManager
+import org.apache.ivy.core.module.descriptor.*
import org.apache.ivy.core.module.id.ArtifactId
-import org.apache.ivy.core.module.id.ModuleId
import org.apache.ivy.core.module.id.ModuleRevisionId
+import org.apache.ivy.core.report.*
import org.apache.ivy.core.resolve.IvyNode
import org.apache.ivy.core.resolve.ResolveEngine
import org.apache.ivy.core.resolve.ResolveOptions
import org.apache.ivy.core.settings.IvySettings
import org.apache.ivy.core.sort.SortEngine
-import org.apache.ivy.plugins.latest.LatestTimeStrategy
-import org.apache.ivy.plugins.matcher.ExactPatternMatcher
-import org.apache.ivy.plugins.matcher.PatternMatcher
-import org.apache.ivy.plugins.parser.m2.PomModuleDescriptorParser
import org.apache.ivy.plugins.repository.TransferListener
import org.apache.ivy.plugins.resolver.ChainResolver
import org.apache.ivy.util.Message
-
-import org.apache.ivy.core.module.descriptor.ExcludeRule
-import grails.util.GrailsNameUtils
-
-import org.apache.ivy.core.report.ArtifactDownloadReport
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor
-import org.apache.ivy.core.module.descriptor.DefaultDependencyArtifactDescriptor
-
import org.apache.ivy.util.MessageLogger
-import org.apache.ivy.core.module.descriptor.Artifact
-import org.apache.ivy.core.report.ConfigurationResolveReport
-import org.apache.ivy.core.report.DownloadReport
-import org.apache.ivy.core.report.DownloadStatus
-import org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor
-import org.apache.ivy.plugins.repository.TransferListener
-import java.util.concurrent.ConcurrentLinkedQueue
-
-
import org.codehaus.groovy.grails.plugins.VersionComparator
-import org.apache.ivy.core.module.descriptor.*
-import org.apache.ivy.core.report.*
/**
* Implementation that uses Apache Ivy under the hood.
@@ -1,18 +1,18 @@
/*
-* Copyright 2004-2005 the original author or authors.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
+ * Copyright 2004-2005 the original author or authors.
+ *
+ * Licensed 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.
-*/
+ *
+ * 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.
+ */
package org.codehaus.groovy.grails.resolve
import grails.build.logging.GrailsConsole
@@ -21,15 +21,18 @@ import grails.util.GrailsNameUtils
import grails.util.Metadata
import grails.util.PluginBuildSettings
import groovy.util.slurpersupport.GPathResult
+
import java.util.regex.Pattern
import java.util.zip.ZipEntry
import java.util.zip.ZipFile
+
import org.apache.ivy.core.report.ArtifactDownloadReport
import org.apache.ivy.core.report.ResolveReport
import org.codehaus.groovy.grails.cli.ScriptExitException
import org.codehaus.groovy.grails.plugins.GrailsPluginInfo
import org.codehaus.groovy.grails.plugins.GrailsPluginUtils
import org.springframework.core.io.Resource
+import org.springframework.util.Assert
/**
* Manages the installation and uninstallation of plugins from a Grails project.
@@ -61,23 +64,23 @@ class PluginInstallEngine {
protected ant
protected PluginResolveEngine resolveEngine
- PluginInstallEngine(grails.util.BuildSettings settings) {
+ PluginInstallEngine(BuildSettings settings) {
this(settings, new PluginBuildSettings(settings), Metadata.current, new AntBuilder())
}
- PluginInstallEngine(grails.util.BuildSettings settings, grails.util.PluginBuildSettings pbs) {
+ PluginInstallEngine(BuildSettings settings, PluginBuildSettings pbs) {
this(settings, pbs, Metadata.current, new AntBuilder())
}
- PluginInstallEngine(grails.util.BuildSettings settings, grails.util.PluginBuildSettings pbs, Metadata md) {
+ PluginInstallEngine(BuildSettings settings, PluginBuildSettings pbs, Metadata md) {
this(settings, pbs, md, new AntBuilder())
}
- PluginInstallEngine(grails.util.BuildSettings settings, grails.util.PluginBuildSettings pbs, Metadata md, AntBuilder ant) {
- if (settings == null) throw new IllegalArgumentException("Argument [settings] cannot be null")
- if (pbs == null) throw new IllegalArgumentException("Argument [pbs] cannot be null")
- if (md == null) throw new IllegalArgumentException("Argument [md] cannot be null")
- if (ant== null) throw new IllegalArgumentException("Argument [ant] cannot be null")
+ PluginInstallEngine(BuildSettings settings, PluginBuildSettings pbs, Metadata md, AntBuilder ant) {
+ Assert.notNull settings, "Argument [settings] cannot be null"
+ Assert.notNull pbs, "Argument [pbs] cannot be null"
+ Assert.notNull md, "Argument [md] cannot be null"
+ Assert.notNull ant, "Argument [ant] cannot be null"
globalPluginsLocation = settings.globalPluginsDir
applicationPluginsLocation = settings.getProjectPluginsDir()
@@ -778,9 +778,7 @@ public static boolean isPublicField(Object obj, String name) {
@SuppressWarnings("rawtypes")
public static boolean isPropertyInherited(Class clz, String propertyName) {
if (clz == null) return false;
- if (StringUtils.isBlank(propertyName)) {
- throw new IllegalArgumentException("Argument [propertyName] cannot be null or blank");
- }
+ Assert.isTrue(!StringUtils.isBlank(propertyName), "Argument [propertyName] cannot be null or blank");
Class<?> superClass = clz.getSuperclass();
@@ -1025,7 +1023,7 @@ public static boolean getBooleanFromMap(String key, Map<?, ?> map) {
*/
@Deprecated
public static String getClassName(String logicalName, String trailingName) {
- if (StringUtils.isBlank(logicalName)) throw new IllegalArgumentException("Argument [logicalName] cannot be null or blank");
+ Assert.isTrue(!StringUtils.isBlank(logicalName), "Argument [logicalName] cannot be null or blank");
String className = logicalName.substring(0,1).toUpperCase() + logicalName.substring(1);
if (trailingName != null) className = className + trailingName;
@@ -78,7 +78,7 @@ public boolean isEmpty() {
*/
public boolean containsKey(Object propertyName) {
if (propertyName instanceof CharSequence) propertyName = propertyName.toString();
- if (!(propertyName instanceof String)) throw new IllegalArgumentException("This map implementation only supports String based keys!");
+ Assert.isInstanceOf(String.class, propertyName, "This map implementation only supports String based keys!");
if (EXCLUDES.contains(propertyName)) return false;
return metaClass.getMetaProperty((String)propertyName) != null;
@@ -19,6 +19,7 @@
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
+import org.springframework.util.Assert;
import org.springframework.web.context.ConfigurableWebApplicationContext;
import org.springframework.web.context.ServletContextAware;
@@ -41,21 +42,17 @@ public WebRuntimeSpringConfiguration(ApplicationContext parent, ClassLoader cl)
@Override
protected GenericApplicationContext createApplicationContext(ApplicationContext parentCtx) {
if (parentCtx != null && beanFactory != null) {
- if (beanFactory instanceof DefaultListableBeanFactory) {
- return new GrailsWebApplicationContext((DefaultListableBeanFactory) beanFactory,parentCtx);
- }
+ Assert.isInstanceOf(DefaultListableBeanFactory.class, beanFactory,
+ "ListableBeanFactory set must be a subclass of DefaultListableBeanFactory");
- throw new IllegalArgumentException(
- "ListableBeanFactory set must be a subclass of DefaultListableBeanFactory");
+ return new GrailsWebApplicationContext((DefaultListableBeanFactory) beanFactory,parentCtx);
}
if (beanFactory != null) {
- if (beanFactory instanceof DefaultListableBeanFactory) {
- return new GrailsWebApplicationContext((DefaultListableBeanFactory) beanFactory);
- }
+ Assert.isInstanceOf(DefaultListableBeanFactory.class, beanFactory,
+ "ListableBeanFactory set must be a subclass of DefaultListableBeanFactory");
- throw new IllegalArgumentException(
- "ListableBeanFactory set must be a subclass of DefaultListableBeanFactory");
+ return new GrailsWebApplicationContext((DefaultListableBeanFactory) beanFactory);
}
if (parentCtx != null) {
@@ -18,6 +18,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.Arrays;
@@ -69,7 +70,7 @@ public DefaultStackTraceFilterer(boolean shouldFilter) {
}
public void addInternalPackage(String name) {
- if (name == null) throw new IllegalArgumentException("Package name cannot be null");
+ Assert.notNull(name, "Package name cannot be null");
packagesToFilter.add(name);
}
Oops, something went wrong.

0 comments on commit f06bc67

Please sign in to comment.