click-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadr...@apache.org
Subject svn commit: r1540524 - in /click/trunk/click: extras/src/org/apache/click/extras/filter/ extras/src/org/apache/click/extras/hibernate/ extras/src/org/apache/click/extras/service/ framework/src/org/apache/click/ framework/src/org/apache/click/util/ mock...
Date Sun, 10 Nov 2013 19:22:36 GMT
Author: aadrian
Date: Sun Nov 10 19:22:35 2013
New Revision: 1540524

URL: http://svn.apache.org/r1540524
Log:
improve readability a little.

Modified:
    click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java
    click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionServletResponseWrapper.java
    click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java
    click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java
    click/trunk/click/extras/src/org/apache/click/extras/service/FreemarkerTemplateService.java
    click/trunk/click/extras/src/org/apache/click/extras/service/JdkLogService.java
    click/trunk/click/framework/src/org/apache/click/ClickServlet.java
    click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
    click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java
    click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java
    click/trunk/click/mock/src/org/apache/click/servlet/MockRequest.java
    click/trunk/click/mock/test/org/apache/click/MockContainerTest.java

Modified: click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionFilter.java Sun
Nov 10 19:22:35 2013
@@ -230,7 +230,7 @@ public class CompressionFilter implement
 
             while (e.hasMoreElements()) {
                 String name = (String) e.nextElement();
-                if (name.indexOf("gzip") != -1) {
+                if (name.contains("gzip")) {
                     return true;
                 }
             }

Modified: click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionServletResponseWrapper.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionServletResponseWrapper.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionServletResponseWrapper.java
(original)
+++ click/trunk/click/extras/src/org/apache/click/extras/filter/CompressionServletResponseWrapper.java
Sun Nov 10 19:22:35 2013
@@ -133,6 +133,7 @@ public class CompressionServletResponseW
                 }
             }
         } catch (IOException e) {
+            /* ignore */
         }
     }
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/filter/PerformanceFilter.java Sun
Nov 10 19:22:35 2013
@@ -595,7 +595,7 @@ public class PerformanceFilter implement
     protected boolean isExcludePath(String path) {
         if (!excludeFiles.isEmpty()) {
             for (int i = 0; i < excludeFiles.size(); i++) {
-                String file = excludeFiles.get(i).toString();
+                String file = excludeFiles.get(i);
                 if (path.endsWith(file)) {
                     return true;
                 }
@@ -604,7 +604,7 @@ public class PerformanceFilter implement
 
         if (!excludeDirs.isEmpty()) {
             for (int i = 0; i < excludeDirs.size(); i++) {
-                String dir = excludeDirs.get(i).toString();
+                String dir = excludeDirs.get(i);
                 if (path.startsWith(dir)) {
                     return true;
                 }
@@ -693,14 +693,14 @@ public class PerformanceFilter implement
      */
     protected boolean useForeverCacheHeader(String path) {
         String versionIndicator = getResourceVersionIndicator(path);
-        if (path.startsWith("/click/") && path.indexOf(versionIndicator) != -1) {
+        if (path.startsWith("/click/") && path.contains(versionIndicator)) {
             return true;
         }
         versionIndicator = getApplicationResourceVersionIndicator(path);
 
         // Only apply application version if one is defined
         if (StringUtils.isNotBlank(versionIndicator)) {
-            if (path.indexOf(versionIndicator) != -1) {
+            if (path.contains(versionIndicator)) {
                 return true;
             }
         }
@@ -717,7 +717,7 @@ public class PerformanceFilter implement
     protected boolean useConfiguredCacheHeader(String path) {
         if (!includeFiles.isEmpty()) {
             for (int i = 0; i < includeFiles.size(); i++) {
-                String file = includeFiles.get(i).toString();
+                String file = includeFiles.get(i);
                 if (path.endsWith(file)) {
                     return true;
                 }
@@ -726,7 +726,7 @@ public class PerformanceFilter implement
 
         if (!includeDirs.isEmpty()) {
             for (int i = 0; i < includeDirs.size(); i++) {
-                String dir = includeDirs.get(i).toString();
+                String dir = includeDirs.get(i);
                 if (path.startsWith(dir)) {
                     return true;
                 }
@@ -767,7 +767,7 @@ public class PerformanceFilter implement
 
             while (e.hasMoreElements()) {
                 String name = (String) e.nextElement();
-                if (name.indexOf("gzip") != -1) {
+                if (name.contains("gzip")) {
                     return true;
                 }
             }

Modified: click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/hibernate/HibernateForm.java Sun
Nov 10 19:22:35 2013
@@ -428,7 +428,7 @@ public class HibernateForm extends Form 
     protected String getClassname(Class<?> aClass) {
 
         String classname = aClass.getName();
-        if (classname.indexOf("$$") != -1) {
+        if (classname.contains("$$")) {
             classname = classname.substring(0, classname.indexOf("$"));
         }
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/service/FreemarkerTemplateService.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/service/FreemarkerTemplateService.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/service/FreemarkerTemplateService.java
(original)
+++ click/trunk/click/extras/src/org/apache/click/extras/service/FreemarkerTemplateService.java
Sun Nov 10 19:22:35 2013
@@ -218,12 +218,14 @@ public class FreemarkerTemplateService i
             configuration.getTemplate(ERROR_PAGE_PATH);
             deployedErrorTemplate = true;
         } catch (IOException ioe) {
+            /* ignore */
         }
 
         try {
             configuration.getTemplate(NOT_FOUND_PAGE_PATH);
             deployedNotFoundTemplate = true;
         } catch (IOException ioe) {
+            /* ignore */
         }
     }
 

Modified: click/trunk/click/extras/src/org/apache/click/extras/service/JdkLogService.java
URL: http://svn.apache.org/viewvc/click/trunk/click/extras/src/org/apache/click/extras/service/JdkLogService.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/extras/src/org/apache/click/extras/service/JdkLogService.java (original)
+++ click/trunk/click/extras/src/org/apache/click/extras/service/JdkLogService.java Sun Nov
10 19:22:35 2013
@@ -27,7 +27,7 @@ import org.apache.click.service.LogServi
 
 /**
  * Provides a JDK Util
- * <a target="_blank" href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/logging/package-summary.html">Logging</a>
+ * <a target="_blank" href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/package-summary.html">Logging</a>
  * LogService adapter class with a logger name of "<tt>Click</tt>".
  *
  * <h3>Configuration</h3>

Modified: click/trunk/click/framework/src/org/apache/click/ClickServlet.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/ClickServlet.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/ClickServlet.java (original)
+++ click/trunk/click/framework/src/org/apache/click/ClickServlet.java Sun Nov 10 19:22:35
2013
@@ -1811,7 +1811,7 @@ public class ClickServlet extends HttpSe
                 }
 
                 // If Ajax request does not target a valid page, return a 404
-                // repsonse status, allowing JavaScript to display a proper message
+                // response status, allowing JavaScript to display a proper message
                 if (ConfigService.NOT_FOUND_PATH.equals(page.getPath())) {
                     HttpServletResponse response = context.getResponse();
                     response.setStatus(HttpServletResponse.SC_NOT_FOUND);
@@ -1985,13 +1985,10 @@ public class ClickServlet extends HttpSe
                 // Initialize the ConfigService instance
                 configService.onInit(servletContext);
 
+            } catch (RuntimeException e) {
+                throw e;
             } catch (Exception e) {
-
-                if (e instanceof RuntimeException) {
-                    throw (RuntimeException) e;
-                } else {
-                    throw new RuntimeException(e);
-                }
+                throw new RuntimeException(e);
             }
         }
     }
@@ -2011,13 +2008,10 @@ public class ClickServlet extends HttpSe
             try {
                 configService.onDestroy();
 
+            } catch (RuntimeException e) {
+                throw e;
             } catch (Exception e) {
-
-                if (e instanceof RuntimeException) {
-                    throw (RuntimeException) e;
-                } else {
-                    throw new RuntimeException(e);
-                }
+                throw new RuntimeException(e);
             } finally {
                 servletContext.setAttribute(ConfigService.CONTEXT_NAME, null);
             }

Modified: click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ClickUtils.java Sun Nov 10 19:22:35
2013
@@ -505,7 +505,7 @@ public class ClickUtils {
 
             while (e.hasMoreElements()) {
                 String name = (String) e.nextElement();
-                if (name.indexOf("gzip") != -1) {
+                if (name.contains("gzip")) {
                     compress = true;
                     break;
                 }

Modified: click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ContainerUtils.java Sun Nov 10 19:22:35
2013
@@ -808,7 +808,7 @@ public class ContainerUtils {
      */
     private static boolean hasMatchingProperty(Field field, Set<String> properties)
{
         String fieldName = field.getName();
-        if (fieldName.indexOf(".") != -1) {
+        if (fieldName.contains(".")) {
             fieldName = fieldName.substring(0, fieldName.indexOf("."));
         }
         return properties.contains(fieldName);
@@ -905,6 +905,7 @@ public class ContainerUtils {
         try {
             method = sourceClass.getMethod(getterName, (Class[]) null);
         } catch (Exception e) {
+            /* ignore */
         }
 
         if (method == null) {

Modified: click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java
URL: http://svn.apache.org/viewvc/click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java (original)
+++ click/trunk/click/framework/src/org/apache/click/util/ErrorReport.java Sun Nov 10 19:22:35
2013
@@ -147,7 +147,7 @@ public class ErrorReport {
                 if (getCause() instanceof IllegalArgumentException) {
                     line = tokenizer.nextToken();
 
-                    if (line.indexOf("org.apache.commons.lang.Validate") != -1) {
+                    if (line.contains("org.apache.commons.lang.Validate")) {
                         line = tokenizer.nextToken();
                     }
                 }
@@ -155,7 +155,7 @@ public class ErrorReport {
                 int nameStart = line.indexOf("at ");
                 int nameEnd = line.indexOf("(");
                 nameEnd = line.lastIndexOf(".", nameEnd);
-                if (line.indexOf("$") != -1) {
+                if (line.contains("$")) {
                     nameEnd = line.indexOf("$");
                 }
 

Modified: click/trunk/click/mock/src/org/apache/click/servlet/MockRequest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/mock/src/org/apache/click/servlet/MockRequest.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/mock/src/org/apache/click/servlet/MockRequest.java (original)
+++ click/trunk/click/mock/src/org/apache/click/servlet/MockRequest.java Sun Nov 10 19:22:35
2013
@@ -314,9 +314,7 @@ public class MockRequest implements Http
     public void setHeader(String name, String... values) {
         List<String> list = new ArrayList<String>(values.length);
         headers.put(name, list);
-        for (String value : values) {
-            list.add(value);
-        }
+        Collections.addAll(list, values);
     }
 
     /**

Modified: click/trunk/click/mock/test/org/apache/click/MockContainerTest.java
URL: http://svn.apache.org/viewvc/click/trunk/click/mock/test/org/apache/click/MockContainerTest.java?rev=1540524&r1=1540523&r2=1540524&view=diff
==============================================================================
--- click/trunk/click/mock/test/org/apache/click/MockContainerTest.java (original)
+++ click/trunk/click/mock/test/org/apache/click/MockContainerTest.java Sun Nov 10 19:22:35
2013
@@ -91,7 +91,7 @@ public class MockContainerTest extends T
             container.stop();
             container.start();
 
-            // Third test exectes the test against the test.htm template
+            // Third test executes the test against the test.htm template
             testPage = container.testPage("/test.htm");
 
             // Check that the page set a ID value as a request attribute



Mime
View raw message