Skip to content

Commit

Permalink
Remove property-based override for dynamic ECI charsets
Browse files Browse the repository at this point in the history
  • Loading branch information
gredler committed May 22, 2023
1 parent eaf438a commit 253d947
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
10 changes: 0 additions & 10 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,6 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<!-- some JVMs do not support these charsets; run tests in a restricted, reproducible configuration -->
<zxing.remove.eci.charsets>ISO8859_6,ISO8859_8,ISO8859_10,ISO8859_11,ISO8859_14</zxing.remove.eci.charsets>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
import com.google.zxing.FormatException;

import java.nio.charset.Charset;
import java.util.Arrays;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
Expand Down Expand Up @@ -62,15 +61,11 @@ public enum CharacterSetECI {
EUC_KR(30, "EUC-KR");

// only character sets supported by the current JVM are registered here
// some JVMs, for example, do not support character sets ISO-8859-6/8/10/11/14
// restricted JVMs can be simulated with the "zxing.remove.eci.charsets" property
private static final Map<Integer,CharacterSetECI> VALUE_TO_ECI = new HashMap<>();
private static final Map<String,CharacterSetECI> NAME_TO_ECI = new HashMap<>();
static {
String removeProp = System.getProperty("zxing.remove.eci.charsets", "");
List<String> remove = Arrays.asList(removeProp.split(","));
for (CharacterSetECI eci : values()) {
if (Charset.isSupported(eci.name()) && !remove.contains(eci.name())) {
if (Charset.isSupported(eci.name())) {
for (int value : eci.values) {
VALUE_TO_ECI.put(value, eci);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ public void testECIs() {
"\u062C\u064E\u0651\u0627\u0635 (\u02BE\u0101\u1E63) \"pear\", suggested to have originated from Hebrew " +
"\u05D0\u05B7\u05D2\u05B8\u05BC\u05E1 (ag\u00E1s)"));
assertEquals("239 209 151 206 214 92 122 140 35 158 144 162 52 205 55 171 137 23 67 206 218 175 147 113 15 254" +
" 116 33 241 25 231 186 14 212 64 253 151 252 159 33 41 241 27 231 83 171 53 209 35 25 134 6 42 33 35 239 184" +
" 116 33 241 9 231 186 14 206 64 248 144 252 159 33 41 241 27 231 83 171 53 209 35 25 134 6 42 33 35 239 184" +
" 31 193 234 7 252 205 101 127 241 209 34 24 5 22 23 221 148 179 239 128 140 92 187 106 204 198 59 19 25 114" +
" 248 118 36 254 231 106 196 19 239 101 27 107 69 189 112 236 156 252 16 174 125 24 10 125 116 42 129",
visualized);
Expand Down

0 comments on commit 253d947

Please sign in to comment.