Skip to content

Commit

Permalink
Make method isPureAscii thread safe
Browse files Browse the repository at this point in the history
Fixes #28
  • Loading branch information
albfernandez committed Apr 17, 2017
1 parent 26137e8 commit bcd31c7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.albfernandez</groupId>
<artifactId>javadbf</artifactId>
<version>0.9.1</version>
<version>0.9.2</version>
<url>https://github.com/albfernandez/javadbf</url>
<packaging>jar</packaging>
<name>javadbf</name>
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/com/linuxense/javadbf/DBFUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,12 @@ public static boolean contains(byte[] array, byte value) {
* @return true if is ascci
*/
public static boolean isPureAscii(String stringToCheck) {
if (stringToCheck == null) {
if (stringToCheck == null || stringToCheck.length() == 0) {
return true;
}
return ASCII_ENCODER.canEncode(stringToCheck);
synchronized (ASCII_ENCODER) {
return ASCII_ENCODER.canEncode(stringToCheck);
}
}

/**
Expand Down

0 comments on commit bcd31c7

Please sign in to comment.