[ 
https://issues.apache.org/jira/browse/PDFBOX-5674?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17761870#comment-17761870
 ] 

Michael Klink commented on PDFBOX-5674:
---------------------------------------

{quote}The equality check for empty strings was converted from an equals method 
call ("".equals(stringVar)) to use the isEmpty() method.{quote}

Beware, {{"".equals(stringVar)}} does work for {{null}} values, 
{{stringVar.isEmpty()}} throws NPEs in that case. Thus, please make sure that 
{{stringVar}} cannot be {{null}} there.

> refactor string operations
> --------------------------
>
>                 Key: PDFBOX-5674
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5674
>             Project: PDFBox
>          Issue Type: Bug
>            Reporter: Axel Howind
>            Priority: Minor
>         Attachments: refactor_String_operations.patch
>
>
> * Conversion of StringBuilder to String was simplified by using the objects 
> directly in the concatenation, instead of calling the toString() function.
> * The equality check for empty strings was converted from an equals method 
> call ("".equals(stringVar)) to use the isEmpty() method.
> * When obtaining a one-character substring from a string, charAt() was used 
> in preference over substring().
> * The new keyword was discarded when converting a single character into a 
> string, using String.valueOf() instead.
> * The creation of a string from a ByteArrayOutputStream was simplified to 
> call toString(encoding) directly.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to