[GitHub] [commons-lang] garydgregory commented on a diff in pull request #903: Add toCharacterObject(String,String) with default value.

2023-01-11 Thread GitBox


garydgregory commented on code in PR #903:
URL: https://github.com/apache/commons-lang/pull/903#discussion_r1067475328


##
src/main/java/org/apache/commons/lang3/CharUtils.java:
##
@@ -114,6 +114,33 @@ public static Character toCharacterObject(final String 
str) {
 return StringUtils.isEmpty(str) ? null : 
Character.valueOf(str.charAt(0));
 }
 
+/**
+ * Converts the String to a Character using the first character, 
returning a
+ *  default value if {@code null} or empty is passed in.
+ *
+ * For ASCII 7 bit characters, this uses a cache that will return the
+ * same Character object each time.
+ *
+ * 
+ *   CharUtils.toCharacterObject(null, 'A') = 'A'
+ *   CharUtils.toCharacterObject("", 'A')   = 'A'
+ *   CharUtils.toCharacterObject("A", 'D')  = 'A'
+ *   CharUtils.toCharacterObject("BA", 'D') = 'B'
+ * 
+ *
+ * @param str  the character to convert
+ * @param defaultValue the value to use if the str is null or empty.
+ * @return the Character value of the first letter of the String or the 
default if null.
+ * @since 3.13.0
+ */
+public static Character toCharacterObject(final String str, final 
Character defaultValue) {
+  final Character character = toCharacterObject(str);
+  if (character == null){
+  return defaultValue;
+  }
+  return character;
+}

Review Comment:
   Better like this IMO: `return StringUtils.isEmpty(str) ? defaultValue : 
Character.valueOf(str.charAt(0));`



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [commons-lang] kinow commented on a diff in pull request #903: Add toCharacterObject(String,String) with default value.

2023-01-11 Thread GitBox


kinow commented on code in PR #903:
URL: https://github.com/apache/commons-lang/pull/903#discussion_r1067443008


##
src/main/java/org/apache/commons/lang3/CharUtils.java:
##
@@ -114,6 +114,33 @@ public static Character toCharacterObject(final String 
str) {
 return StringUtils.isEmpty(str) ? null : 
Character.valueOf(str.charAt(0));
 }
 
+/**
+ * Converts the String to a Character using the first character, 
returning a
+ *  default value if {@code null} or empty is passed in.
+ *
+ * For ASCII 7 bit characters, this uses a cache that will return the
+ * same Character object each time.
+ *
+ * 
+ *   CharUtils.toCharacterObject(null, 'A') = 'A'
+ *   CharUtils.toCharacterObject("", 'A')   = 'A'
+ *   CharUtils.toCharacterObject("A", 'D')  = 'A'
+ *   CharUtils.toCharacterObject("BA", 'D') = 'B'
+ * 
+ *
+ * @param str  the character to convert

Review Comment:
   Also worth checking if the docs are ending sentences with dot or without it. 
I think this `@param` doesn't use that, but the next ones does.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [commons-lang] kinow commented on a diff in pull request #903: Add toCharacterObject(String,String) with default value.

2023-01-11 Thread GitBox


kinow commented on code in PR #903:
URL: https://github.com/apache/commons-lang/pull/903#discussion_r1067442485


##
src/main/java/org/apache/commons/lang3/CharUtils.java:
##
@@ -114,6 +114,33 @@ public static Character toCharacterObject(final String 
str) {
 return StringUtils.isEmpty(str) ? null : 
Character.valueOf(str.charAt(0));
 }
 
+/**
+ * Converts the String to a Character using the first character, 
returning a
+ *  default value if {@code null} or empty is passed in.
+ *
+ * For ASCII 7 bit characters, this uses a cache that will return the
+ * same Character object each time.
+ *
+ * 
+ *   CharUtils.toCharacterObject(null, 'A') = 'A'
+ *   CharUtils.toCharacterObject("", 'A')   = 'A'
+ *   CharUtils.toCharacterObject("A", 'D')  = 'A'
+ *   CharUtils.toCharacterObject("BA", 'D') = 'B'
+ * 
+ *
+ * @param str  the character to convert

Review Comment:
   I think `str` is not a character too, sorry forgot to review the text in the 
javadocs.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [commons-lang] kinow commented on a diff in pull request #903: Add toCharacterObject(String,String) with default value.

2023-01-11 Thread GitBox


kinow commented on code in PR #903:
URL: https://github.com/apache/commons-lang/pull/903#discussion_r1067434485


##
src/main/java/org/apache/commons/lang3/CharUtils.java:
##
@@ -114,6 +114,33 @@ public static Character toCharacterObject(final String 
str) {
 return StringUtils.isEmpty(str) ? null : 
Character.valueOf(str.charAt(0));
 }
 
+/**
+ * Converts the String to a Character using the first character, 
returning a
+ *  default value if {@code null} or empty is passed in.
+ *
+ * For ASCII 7 bit characters, this uses a cache that will return the
+ * same Character object each time.
+ *
+ * 
+ *   CharUtils.toCharacterObject(null, 'A') = 'A'
+ *   CharUtils.toCharacterObject("", 'A')   = 'A'
+ *   CharUtils.toCharacterObject("A", 'D')  = 'A'
+ *   CharUtils.toCharacterObject("BA", 'D') = 'B'
+ * 
+ *
+ * @param str  the character to convert
+ * @param defaultValue the value to use if the str is null or empty.
+ * @return the Character value of the first letter of the String or the 
default if null.
+ * @since 3.13.0
+ */
+public static Character toCharacterObject(final String str, final 
Character defaultValue) {
+  final Character character = toCharacterObject(str);
+  if (character == null){
+  return defaultValue;
+  }
+  return character;
+}

Review Comment:
   I think the rest of the code is using 4 spaces (you used 4 spaces in the 
test).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [commons-lang] class101 commented on pull request #903: Add toCharacterObject(String,String) with default value.

2023-01-11 Thread GitBox


class101 commented on PR #903:
URL: https://github.com/apache/commons-lang/pull/903#issuecomment-1379344780

   > You can also look up the word "volunteer"... ;-)
   
   Volunteers to clear the pull request queue ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (COMPRESS-638) The GzipCompressorOutputStream#writeHeader method uses the ISO_8859_1 to write the file name. If the file name contains non-ISO_8859_1 characters, some unknown chara

2023-01-11 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17675574#comment-17675574
 ] 

Michael Osipov commented on COMPRESS-638:
-

I would at most do this approach via a flag: 
https://stackoverflow.com/a/30446122/696632

> The GzipCompressorOutputStream#writeHeader method uses the ISO_8859_1 to 
> write the file name.  If the file name contains non-ISO_8859_1 characters, 
> some unknown characters are displayed after decompression.
> --
>
> Key: COMPRESS-638
> URL: https://issues.apache.org/jira/browse/COMPRESS-638
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Radar wen
>Priority: Major
> Attachments: 0110.png
>
>
> The GzipCompressorOutputStream#writeHeader method uses the ISO_8859_1 to 
> write the file name. 
> If the file name contains non-ISO_8859_1 characters, some unknown characters 
> are displayed after decompression. !0110.png!
>  Can change the ISO_8859_1 to UTF-8? 
>         if (filename != null) {
>             out.write(filename.getBytes(ISO_8859_1));
>             out.write(0);
>         }
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (COMPRESS-638) The GzipCompressorOutputStream#writeHeader method uses the ISO_8859_1 to write the file name. If the file name contains non-ISO_8859_1 characters, some unknown chara

2023-01-11 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/COMPRESS-638?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17675572#comment-17675572
 ] 

Michael Osipov commented on COMPRESS-638:
-

[~ggregory], I would not support a deviation from the RFC because that will 
creep into many other spheres. [~Radar], ugly but you could use percent-encoded 
UTF-8 values.

> The GzipCompressorOutputStream#writeHeader method uses the ISO_8859_1 to 
> write the file name.  If the file name contains non-ISO_8859_1 characters, 
> some unknown characters are displayed after decompression.
> --
>
> Key: COMPRESS-638
> URL: https://issues.apache.org/jira/browse/COMPRESS-638
> Project: Commons Compress
>  Issue Type: Bug
>Reporter: Radar wen
>Priority: Major
> Attachments: 0110.png
>
>
> The GzipCompressorOutputStream#writeHeader method uses the ISO_8859_1 to 
> write the file name. 
> If the file name contains non-ISO_8859_1 characters, some unknown characters 
> are displayed after decompression. !0110.png!
>  Can change the ISO_8859_1 to UTF-8? 
>         if (filename != null) {
>             out.write(filename.getBytes(ISO_8859_1));
>             out.write(0);
>         }
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (IO-373) FileUtils.byteCountToDisplaySize improvement/rounding issues

2023-01-11 Thread Eduardo (Jira)


[ 
https://issues.apache.org/jira/browse/IO-373?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17675567#comment-17675567
 ] 

Eduardo commented on IO-373:


Has this been integrated into Commons-text ? 

> FileUtils.byteCountToDisplaySize improvement/rounding issues
> 
>
> Key: IO-373
> URL: https://issues.apache.org/jira/browse/IO-373
> Project: Commons IO
>  Issue Type: Improvement
>  Components: Utilities
>Affects Versions: 2.4
>Reporter: Mark
>Priority: Minor
> Attachments: byteCountToDisplaySize.patch, 
> byteCountToHumanReadableGnu.patch
>
>
> Issue IO-226 is not fixed but closed.
> ?
> Here is my solution that also support a user-defined precision in terms of a 
> maximum length of the digits part.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [commons-lang] garydgregory commented on pull request #903: Add toCharacterObject(String,String) with default value.

2023-01-11 Thread GitBox


garydgregory commented on PR #903:
URL: https://github.com/apache/commons-lang/pull/903#issuecomment-1378687104

   You can also look up the word "volunteer"... ;-)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[GitHub] [commons-lang] class101 commented on pull request #903: Add toCharacterObject(String,String) with default value.

2023-01-11 Thread GitBox


class101 commented on PR #903:
URL: https://github.com/apache/commons-lang/pull/903#issuecomment-1378630195

   I was wondering why lang3 has a release per year. Really not motivating in 
participating this project, 110 pull request my god….


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



[jira] [Commented] (BEANUTILS-500) Upgrade from Apache Commons Collections 3 to 4

2023-01-11 Thread Federico Grilli (Jira)


[ 
https://issues.apache.org/jira/browse/BEANUTILS-500?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17673667#comment-17673667
 ] 

Federico Grilli commented on BEANUTILS-500:
---

Hello, any ETA for 2.0 release? 

> Upgrade from Apache Commons Collections 3 to 4
> --
>
> Key: BEANUTILS-500
> URL: https://issues.apache.org/jira/browse/BEANUTILS-500
> Project: Commons BeanUtils
>  Issue Type: Improvement
>  Components: Bean / Property Utils
>Affects Versions: 2.0.0
>Reporter: David Brosius
>Priority: Minor
> Fix For: 2.0.0
>
> Attachments: BEANUTILS-500.2.txt, BEANUTILS-500.3.txt, 
> BEANUTILS-500.txt
>
>
> uptake commons-collections4.
> The main difference is the removal of 'FastHashMap', and replacement with 
> ConcurrentHashMap.
> There are a few breaking changes for deprecated methods that return a 
> FastHashMap, that are exposed.
> I made them package private, and undeprecated them, thus 2.0



--
This message was sent by Atlassian Jira
(v8.20.10#820010)