You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2021/04/19 22:24:02 UTC

[commons-text] branch master updated (839fc24 -> 25b847a)

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

kinow pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-text.git.


    from 839fc24  Merge branch 'pr-223'
     new 77de407  [TEXT-200] Simplify statements
     new 2cd1c6c  [TEXT-200] Changelog
     new 25b847a  Merge branch 'pr-222'

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                           | 3 ++-
 src/main/java/org/apache/commons/text/CaseUtils.java              | 5 +----
 .../commons/text/translate/UnicodeUnpairedSurrogateRemover.java   | 8 ++------
 3 files changed, 5 insertions(+), 11 deletions(-)

[commons-text] 03/03: Merge branch 'pr-222'

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 25b847a1f861d7a98a3c509588ee83cec8277bd4
Merge: 839fc24 2cd1c6c
Author: Bruno P. Kinoshita <ki...@users.noreply.github.com>
AuthorDate: Tue Apr 20 10:23:36 2021 +1200

    Merge branch 'pr-222'
    
    This closes #222

 src/changes/changes.xml                                           | 3 ++-
 src/main/java/org/apache/commons/text/CaseUtils.java              | 5 +----
 .../commons/text/translate/UnicodeUnpairedSurrogateRemover.java   | 8 ++------
 3 files changed, 5 insertions(+), 11 deletions(-)

[commons-text] 02/03: [TEXT-200] Changelog

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 2cd1c6ccfff05f17cabc2eed07d680f69dbf44a9
Author: Bruno P. Kinoshita <ki...@users.noreply.github.com>
AuthorDate: Tue Apr 20 10:23:27 2021 +1200

    [TEXT-200] Changelog
---
 src/changes/changes.xml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e1a0047..c3c89f7 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -78,7 +78,8 @@ The <action> type attribute can be add,update,fix,remove.
     <action                  type="update" dev="ggregory" due-to="Gary Gregory">Update commons-lang3 3.11 -> 3.12.0.</action>
     <action issue="TEXT-194" type="update" dev="kinow" due-to="Arturo Bernal">Use StringUtils.INDEX_NOT_FOUND constant.</action>
     <action issue="TEXT-199" type="update" dev="kinow" due-to="Arturo Bernal">Remove redundant local variable.</action>
-    <action issue="TEXT-198" type="update" dev="kinow" due-to="Arturo Bernal"> Replace lambda with method reference.</action>
+    <action issue="TEXT-198" type="update" dev="kinow" due-to="Arturo Bernal">Replace lambda with method reference.</action>
+    <action issue="TEXT-200" type="update" dev="kinow" due-to="Arturo Bernal">Simplify statements.</action>
   </release>
   <release version="1.9" date="2020-07-21" description="Release 1.9. Requires Java 8.">
     <action issue="TEXT-166" type="fix" dev="kinow" due-to="Mikko Maunu">Removed non-existing parameter from Javadocs and spelled out parameters in throws.</action>

[commons-text] 01/03: [TEXT-200] Simplify statements

Posted by ki...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 77de407d9622b4da9ca7bb348a0ba96095413fa2
Author: Arturo Bernal <ar...@gmail.com>
AuthorDate: Sun Apr 18 12:55:20 2021 +0200

    [TEXT-200] Simplify statements
---
 src/main/java/org/apache/commons/text/CaseUtils.java              | 5 +----
 .../commons/text/translate/UnicodeUnpairedSurrogateRemover.java   | 8 ++------
 2 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/apache/commons/text/CaseUtils.java b/src/main/java/org/apache/commons/text/CaseUtils.java
index ccf902a..74cebf3 100644
--- a/src/main/java/org/apache/commons/text/CaseUtils.java
+++ b/src/main/java/org/apache/commons/text/CaseUtils.java
@@ -86,10 +86,7 @@ public class CaseUtils {
         final int[] newCodePoints = new int[strLen];
         int outOffset = 0;
         final Set<Integer> delimiterSet = generateDelimiterSet(delimiters);
-        boolean capitalizeNext = false;
-        if (capitalizeFirstLetter) {
-            capitalizeNext = true;
-        }
+        boolean capitalizeNext = capitalizeFirstLetter;
         for (int index = 0; index < strLen;) {
             final int codePoint = str.codePointAt(index);
 
diff --git a/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java b/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java
index eea9ece..9d7c6c2 100644
--- a/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java
+++ b/src/main/java/org/apache/commons/text/translate/UnicodeUnpairedSurrogateRemover.java
@@ -31,12 +31,8 @@ public class UnicodeUnpairedSurrogateRemover extends CodePointTranslator {
      */
     @Override
     public boolean translate(final int codepoint, final Writer writer) throws IOException {
-        if (codepoint >= Character.MIN_SURROGATE && codepoint <= Character.MAX_SURROGATE) {
-            // It's a surrogate. Write nothing and say we've translated.
-            return true;
-        }
-        // It's not a surrogate. Don't translate it.
-        return false;
+        // If true, it is a surrogate. Write nothing and say we've translated. Otherwise return false, and don't translate it.
+        return codepoint >= Character.MIN_SURROGATE && codepoint <= Character.MAX_SURROGATE;
     }
 }