You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by th...@apache.org on 2020/09/05 14:56:09 UTC

[tapestry-5] branch master updated: Replacing code which used commons-lang

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

thiagohp pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tapestry-5.git


The following commit(s) were added to refs/heads/master by this push:
     new dbdd429  Replacing code which used commons-lang
dbdd429 is described below

commit dbdd429affd0a05f6a5ff9ef82642bc6caada804
Author: Thiago H. de Paula Figueiredo <th...@arsmachina.com.br>
AuthorDate: Sat Sep 5 11:54:42 2020 -0300

    Replacing code which used commons-lang
---
 .../internal/services/assets/ChecksumPath.java     | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ChecksumPath.java b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ChecksumPath.java
index 7e5f95e..03cdcae 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ChecksumPath.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/internal/services/assets/ChecksumPath.java
@@ -14,7 +14,6 @@
 
 package org.apache.tapestry5.internal.services.assets;
 
-import org.apache.commons.lang3.StringUtils;
 import org.apache.tapestry5.internal.services.ResourceStreamer;
 import org.apache.tapestry5.ioc.Resource;
 
@@ -41,11 +40,11 @@ public class ChecksumPath
         this.streamer = streamer;
         int slashx = extraPath.indexOf('/');
 
-        checksum = slashx >= 0 ? extraPath.substring(0, slashx) : null;
+        checksum = extraPath.substring(0, slashx);
 
         String morePath = extraPath.substring(slashx + 1);
 
-        if (StringUtils.isNotBlank(morePath)) {
+        if (!isBlank(morePath)) {
             resourcePath = baseFolder == null
                     ? morePath
                     : baseFolder + "/" + morePath;
@@ -76,4 +75,21 @@ public class ChecksumPath
 
         return streamer.streamResource(resource, checksum, ResourceStreamer.DEFAULT_OPTIONS);
     }
+    
+    /**
+     * Copied from StringUtils since it's the only method we want from it.
+     */
+    private static boolean isBlank(final CharSequence cs) {
+        int strLen;
+        if (cs == null || (strLen = cs.length()) == 0) {
+            return true;
+        }
+        for (int i = 0; i < strLen; i++) {
+            if (!Character.isWhitespace(cs.charAt(i))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
 }