You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/06/03 16:21:01 UTC

[commons-lang] branch master updated: [LANG-1461] Add null-safe StringUtils APIs to wrap String#getBytes([Charset|String]).

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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new 465e6be  [LANG-1461] Add null-safe StringUtils APIs to wrap String#getBytes([Charset|String]).</action>
465e6be is described below

commit 465e6becd8beda9569fbdc9ff44fac7dc3c5d1c6
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Mon Jun 3 12:20:56 2019 -0400

    [LANG-1461] Add null-safe StringUtils APIs to wrap
    String#getBytes([Charset|String]).</action>
    
    Also fix Javadoc on Java 13 EA 23.
---
 src/main/java/org/apache/commons/lang3/StringUtils.java        |  4 ++--
 .../java/org/apache/commons/lang3/concurrent/package-info.java |  6 ++----
 src/main/java/org/apache/commons/lang3/package-info.java       | 10 +++++-----
 .../org/apache/commons/lang3/reflect/ConstructorUtils.java     |  5 +++--
 .../java/org/apache/commons/lang3/reflect/MethodUtils.java     |  4 ++--
 5 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/StringUtils.java b/src/main/java/org/apache/commons/lang3/StringUtils.java
index f380d41..a5f90a1 100644
--- a/src/main/java/org/apache/commons/lang3/StringUtils.java
+++ b/src/main/java/org/apache/commons/lang3/StringUtils.java
@@ -1951,7 +1951,7 @@ public class StringUtils {
     /**
      * Calls {@link String#getBytes(Charset)} in a null-safe manner.
      *
-     * @param string
+     * @param string input string
      * @param charset The {@link Charset} to encode the {@code String}. If null, then use the default Charset.
      * @return The empty byte[] if {@code string} is null, the result of {@link String#getBytes(Charset)} otherwise.
      * @see String#getBytes(Charset)
@@ -1964,7 +1964,7 @@ public class StringUtils {
     /**
      * Calls {@link String#getBytes(String)} in a null-safe manner.
      *
-     * @param string
+     * @param string input string
      * @param charset The {@link Charset} name to encode the {@code String}. If null, then use the default Charset.
      * @return The empty byte[] if {@code string} is null, the result of {@link String#getBytes(String)} otherwise.
      * @throws UnsupportedEncodingException Thrown when the named charset is not supported.
diff --git a/src/main/java/org/apache/commons/lang3/concurrent/package-info.java b/src/main/java/org/apache/commons/lang3/concurrent/package-info.java
index 7f2a6b8..9cfcf96 100644
--- a/src/main/java/org/apache/commons/lang3/concurrent/package-info.java
+++ b/src/main/java/org/apache/commons/lang3/concurrent/package-info.java
@@ -19,8 +19,6 @@
  * This package is intended to be an extension to {@link java.util.concurrent}.
  * These classes are thread-safe.</p>
  *
- * <h3></h3>
- *
  * <p> A group of classes deals with the correct creation and initialization of objects that are accessed by multiple threads.
  * All these classes implement the {@link org.apache.commons.lang3.concurrent.ConcurrentInitializer} interface which provides just a
  * single method:
@@ -236,7 +234,7 @@
  * It is also possible to pass in an <code>ExecutorService</code> when the initializer is constructed.
  * That way client code can configure the <code>ExecutorService</code> according to its specific needs; for instance, the number of threads available could be limited.</p>
  *
- * <h3>Utility Classes</h3>
+ * <h2>Utility Classes</h2>
  *
  * <p>Another group of classes in the new <code>concurrent</code> package offers some generic functionality related to concurrency.
  * There is the {@link org.apache.commons.lang3.concurrent.ConcurrentUtils} class with a bunch of static utility methods.
@@ -334,7 +332,7 @@
  * This factory is then used for creating new threads; after that the specific attributes are applied to the new thread.
  * If no wrapped factory is set, the default factory provided by the JDK is used.</p>
  *
- * <h3>Synchronization objects</h3>
+ * <h2>Synchronization objects</h2>
  *
  * <p>The <code>concurrent</code> package also provides some support for specific synchronization problems with threads.</p>
  *
diff --git a/src/main/java/org/apache/commons/lang3/package-info.java b/src/main/java/org/apache/commons/lang3/package-info.java
index 9a476fe..d47d6f0 100644
--- a/src/main/java/org/apache/commons/lang3/package-info.java
+++ b/src/main/java/org/apache/commons/lang3/package-info.java
@@ -35,7 +35,7 @@
  * This may seem an odd thing to do, but it allows tools like Velocity to access the class as if it were a bean.
  * In other words, yes we know about private constructors and have chosen not to use them.</p>
  *
- * <h3>String manipulation - StringUtils, StringEscapeUtils, RandomStringUtils</h3>
+ * <h2>String manipulation - StringUtils, StringEscapeUtils, RandomStringUtils</h2>
  *
  * <p>Lang has a series of String utilities.
  * The first is {@link org.apache.commons.lang3.StringUtils}, oodles and oodles of functions which tweak, transform, squeeze and cuddle {@link java.lang.String java.lang.Strings}.
@@ -47,7 +47,7 @@
  * <p>These are ideal classes to start using if you're looking to get into Lang.
  * StringUtils' {@link org.apache.commons.lang3.StringUtils#capitalize(String)}, {@link org.apache.commons.lang3.StringUtils#substringBetween(String, String)}/{@link org.apache.commons.lang3.StringUtils#substringBefore(String, String) Before}/{@link org.apache.commons.lang3.StringUtils#substringAfter(String, String) After}, {@link org.apache.commons.lang3.StringUtils#split(String)} and {@link org.apache.commons.lang3.StringUtils#join(Object[])} are good methods to begin with.</p>
  *
- * <h3>Character handling - CharSetUtils, CharSet, CharRange, CharUtils</h3>
+ * <h2>Character handling - CharSetUtils, CharSet, CharRange, CharUtils</h2>
  *
  * <p>In addition to dealing with Strings, it's also important to deal with chars and Characters.
  * {@link org.apache.commons.lang3.CharUtils} exists for this purpose, while {@link org.apache.commons.lang3.CharSetUtils} exists for set-manipulation of Strings.
@@ -56,7 +56,7 @@
  *
  * <p>{@link org.apache.commons.lang3.CharRange} and {@link org.apache.commons.lang3.CharSet} are both used internally by CharSetUtils, and will probably rarely be used.</p>
  *
- * <h3>JVM interaction - SystemUtils, CharEncoding</h3>
+ * <h2>JVM interaction - SystemUtils, CharEncoding</h2>
  *
  * <p>SystemUtils is a simple little class which makes it easy to find out information about which platform you are on.
  * For some, this is a necessary evil. It was never something I expected to use myself until I was trying to ensure that Commons Lang itself compiled under JDK 1.2.
@@ -65,7 +65,7 @@
  *
  * <p>The {@link org.apache.commons.lang3.CharEncoding} class is also used to interact with the Java environment and may be used to see which character encodings are supported in a particular environment. </p>
  *
- * <h3>Serialization - SerializationUtils, SerializationException</h3>
+ * <h2>Serialization - SerializationUtils, SerializationException</h2>
  *
  * <p>Serialization doesn't have to be that hard!
  * A simple util class can take away the pain, plus it provides a method to clone an object by unserializing and reserializing, an old Java trick.</p>
@@ -114,7 +114,7 @@
  * <p>Our final util class is {@link org.apache.commons.lang3.BooleanUtils}.
  * It contains various Boolean acting methods, probably of most interest is the {@link org.apache.commons.lang3.BooleanUtils#toBoolean(String)} method which turns various positive/negative Strings into a Boolean object, and not just true/false as with Boolean.valueOf.</p>
  *
- * <h3>Flotsam - BitField, Validate</h3>
+ * <h2>Flotsam - BitField, Validate</h2>
  * <p>On reaching the end of our package, we are left with a couple of classes that haven't fit any of the topics so far. </p>
  * <p>The {@link org.apache.commons.lang3.BitField} class provides a wrapper class around the classic bitmask integer, whilst the {@link org.apache.commons.lang3.Validate} class may be used for assertions (remember, we support Java 1.2). </p>
  *
diff --git a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
index f95af54..651b77e 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/ConstructorUtils.java
@@ -28,8 +28,9 @@ import org.apache.commons.lang3.Validate;
  * <p> Utility reflection methods focused on constructors, modeled after
  * {@link MethodUtils}. </p>
  *
- * <h3>Known Limitations</h3> <h4>Accessing Public Constructors In A Default
- * Access Superclass</h4> <p>There is an issue when invoking {@code public} constructors
+ * <h2>Known Limitations</h2> 
+ * <h3>Accessing Public Constructors In A Default Access Superclass</h3> 
+ * <p>There is an issue when invoking {@code public} constructors
  * contained in a default access superclass. Reflection correctly locates these
  * constructors and assigns them as {@code public}. However, an
  * {@link IllegalAccessException} is thrown if the constructor is
diff --git a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
index a9a8031..bbd5019 100644
--- a/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
+++ b/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java
@@ -43,8 +43,8 @@ import org.apache.commons.lang3.Validate;
  * already existed within Lang.
  * </p>
  *
- * <h3>Known Limitations</h3>
- * <h4>Accessing Public Methods In A Default Access Superclass</h4>
+ * <h2>Known Limitations</h2>
+ * <h3>Accessing Public Methods In A Default Access Superclass</h3>
  * <p>There is an issue when invoking {@code public} methods contained in a default access superclass on JREs prior to 1.4.
  * Reflection locates these methods fine and correctly assigns them as {@code public}.
  * However, an {@link IllegalAccessException} is thrown if the method is invoked.</p>