myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tandrasc...@apache.org
Subject [myfaces] branch master updated: cosmetics
Date Sun, 11 Aug 2019 08:50:37 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new dff4f77  cosmetics
dff4f77 is described below

commit dff4f77bdfbd1057da3e0bde3f895b46b74d1f5c
Author: Thomas Andraschko <tandraschko@apache.org>
AuthorDate: Sun Aug 11 10:50:35 2019 +0200

    cosmetics
---
 .../myfaces/renderkit/html/util/HTMLEncoder.java   | 16 ++---
 .../view/facelets/tag/jstl/fn/JstlFunction.java    | 74 ++++++----------------
 2 files changed, 26 insertions(+), 64 deletions(-)

diff --git a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HTMLEncoder.java b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HTMLEncoder.java
index d374cd8..fa9959c 100644
--- a/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HTMLEncoder.java
+++ b/impl/src/main/java/org/apache/myfaces/renderkit/html/util/HTMLEncoder.java
@@ -170,7 +170,7 @@ public abstract class HTMLEncoder
     /**
      * Variant of {@link #encode} where encodeNewline is false and encodeNbsp is true.
      */
-    public static void encode (Writer writer, String string) throws IOException
+    public static void encode(Writer writer, String string) throws IOException
     {
         encode(writer, string, false, true);
     }
@@ -178,7 +178,7 @@ public abstract class HTMLEncoder
     /**
      * Variant of {@link #encode} where encodeNbsp is true.
      */
-    public static void encode (Writer writer, String string, boolean encodeNewline) throws
IOException
+    public static void encode(Writer writer, String string, boolean encodeNewline) throws
IOException
     {
         encode(writer, string, encodeNewline, true);
     }
@@ -186,13 +186,13 @@ public abstract class HTMLEncoder
     /**
      * Variant of {@link #encode} where encodeNbsp and encodeNonLatin are true 
      */
-    public static void encode (Writer writer, String string, 
+    public static void encode(Writer writer, String string, 
             boolean encodeNewline, boolean encodeSubsequentBlanksToNbsp) throws IOException
     {
         encode(writer, string, encodeNewline, encodeSubsequentBlanksToNbsp, true);
     }
     
-    public static void encode (Writer writer, String string,
+    public static void encode(Writer writer, String string,
                                  boolean encodeNewline,
                                  boolean encodeSubsequentBlanksToNbsp,
                                  boolean encodeNonLatin) throws IOException
@@ -299,7 +299,7 @@ public abstract class HTMLEncoder
     /**
      * Variant of {@link #encode} where encodeNewline is false and encodeNbsp is true.
      */
-    public static void encode (char[] string, int offset, int length, Writer writer) throws
IOException
+    public static void encode(char[] string, int offset, int length, Writer writer) throws
IOException
     {
         encode(string, offset, length, false, true, writer);
     }
@@ -307,7 +307,7 @@ public abstract class HTMLEncoder
     /**
      * Variant of {@link #encode} where encodeNbsp is true.
      */
-    public static void encode (char[] string, int offset, int length, boolean encodeNewline,
Writer writer)
+    public static void encode(char[] string, int offset, int length, boolean encodeNewline,
Writer writer)
         throws IOException
     {
         encode(string, offset, length, encodeNewline, true, writer);
@@ -316,7 +316,7 @@ public abstract class HTMLEncoder
     /**
      * Variant of {@link #encode} where encodeNbsp and encodeNonLatin are true 
      */
-    public static void encode (char[] string, int offset, int length, boolean encodeNewline,

+    public static void encode(char[] string, int offset, int length, boolean encodeNewline,

             boolean encodeSubsequentBlanksToNbsp, Writer writer) throws IOException
     {
         encode(string, offset, length, encodeNewline, encodeSubsequentBlanksToNbsp, true,
writer);
@@ -330,7 +330,7 @@ public abstract class HTMLEncoder
      * @param encodeSubsequentBlanksToNbsp if true subsequent blanks are converted to &amp;nbsp;'s
      * @param encodeNonLatin if true encode non-latin characters as numeric character references
      */
-    public static void encode (char[] string, int offset, int length,
+    public static void encode(char[] string, int offset, int length,
                                  boolean encodeNewline,
                                  boolean encodeSubsequentBlanksToNbsp,
                                  boolean encodeNonLatin, Writer writer) throws IOException
diff --git a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
index 9884a27..fb043ae 100644
--- a/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
+++ b/impl/src/main/java/org/apache/myfaces/view/facelets/tag/jstl/fn/JstlFunction.java
@@ -24,6 +24,7 @@ import java.util.Map;
 import java.util.StringTokenizer;
 
 import org.apache.myfaces.buildtools.maven2.plugin.builder.annotation.JSFFaceletFunction;
+import org.apache.myfaces.util.lang.StringUtils;
 
 /**
  * Implementations of JSTL Functions
@@ -73,11 +74,7 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:escapeXml")
     public static String escapeXml(String value)
     {
-        if (value == null)
-        {
-            return "";
-        }
-        if (value.length() == 0)
+        if (StringUtils.isEmpty(value))
         {
             return "";
         }
@@ -220,22 +217,16 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:replace")
     public static String replace(String value, String a, String b)
     {
-        if (value == null)
-        {
-            return "";
-        }
-        if (value.length() == 0)
+        if (StringUtils.isEmpty(value))
         {
             return "";
         }
-        if (a == null)
-        {
-            return value;
-        }
-        if (a.length() == 0)
+
+        if (StringUtils.isEmpty(a))
         {
             return value;
         }
+
         if (b == null)
         {
             b = "";
@@ -247,23 +238,16 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:split")
     public static String[] split(String value, String d)
     {
-        if (value == null)
+        if (StringUtils.isEmpty(value))
         {
             return new String[]{""};
         }
-        if (value.length() == 0)
-        {
-            return new String[]{""};
-        }
-        if (d == null)
+
+        if (StringUtils.isEmpty(d))
         {
             return new String[]{value};
         }
-        if (d.length() == 0)
-        {
-            return new String[]{value};
-        }        
-        
+
         StringTokenizer st = new StringTokenizer(value, d);
         int numTokens = st.countTokens();
         if (numTokens == 0)
@@ -294,14 +278,11 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:substring")
     public static String substring(String v, int s, int e)
     {
-        if (v == null)
-        {
-            return "";
-        }
-        if (v.length() == 0)
+        if (StringUtils.isEmpty(v))
         {
             return "";
         }
+
         if (s >= v.length())
         {
             return "";
@@ -325,11 +306,7 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:substringAfter")
     public static String substringAfter(String v, String p)
     {
-        if (v == null)
-        {
-            return "";
-        }
-        if (v.length() == 0)
+        if (StringUtils.isEmpty(v))
         {
             return "";
         }
@@ -346,11 +323,7 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:substringBefore")
     public static String substringBefore(String v, String s)
     {
-        if (v == null)
-        {
-            return "";
-        }
-        if (v.length() == 0)
+        if (StringUtils.isEmpty(v))
         {
             return "";
         }
@@ -367,11 +340,7 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:toLowerCase")
     public static String toLowerCase(String v)
     {
-        if (v == null)
-        {
-            return "";
-        }
-        if (v.length() == 0)
+        if (StringUtils.isEmpty(v))
         {
             return "";
         }
@@ -382,11 +351,7 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:toUpperCase")
     public static String toUpperCase(String v)
     {
-        if (v == null)
-        {
-            return "";
-        }
-        if (v.length() == 0)
+        if (StringUtils.isEmpty(v))
         {
             return "";
         }
@@ -397,14 +362,11 @@ public final class JstlFunction
     @JSFFaceletFunction(name="fn:trim")
     public static String trim(String v)
     {
-        if (v == null)
-        {
-            return "";
-        }
-        if (v.length() == 0)
+        if (StringUtils.isEmpty(v))
         {
             return "";
         }
+
         return v.trim();
     }
 


Mime
View raw message