I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 84ea533b authored by zab2's avatar zab2
Browse files

use DataHelper.split instead of String.split

parent fd2819c7
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,8 @@ import java.util.ArrayList; ...@@ -5,6 +5,8 @@ import java.util.ArrayList;
import java.io.File; import java.io.File;
import net.i2p.data.DataHelper;
class DefinitionParser { class DefinitionParser {
static FilterDefinition parse(String []definition) throws InvalidDefinitionException { static FilterDefinition parse(String []definition) throws InvalidDefinitionException {
...@@ -12,7 +14,7 @@ class DefinitionParser { ...@@ -12,7 +14,7 @@ class DefinitionParser {
DefinitionBuilder builder = new DefinitionBuilder(); DefinitionBuilder builder = new DefinitionBuilder();
for (String line : definition) { for (String line : definition) {
String [] split = line.split(" "); String [] split = DataHelper.split(line," ");
split[0] = split[0].toLowerCase(); split[0] = split[0].toLowerCase();
if ("default".equals(split[0])) if ("default".equals(split[0]))
builder.setDefaultThreshold(parseThreshold(line.substring(7).trim())); builder.setDefaultThreshold(parseThreshold(line.substring(7).trim()));
...@@ -31,7 +33,7 @@ class DefinitionParser { ...@@ -31,7 +33,7 @@ class DefinitionParser {
if ("deny".equalsIgnoreCase(s)) if ("deny".equalsIgnoreCase(s))
return Threshold.DENY; return Threshold.DENY;
String [] split = s.split("/"); String [] split = DataHelper.split(s,"/");
if (split.length != 2) if (split.length != 2)
throw new InvalidDefinitionException("Invalid threshold " + s); throw new InvalidDefinitionException("Invalid threshold " + s);
...@@ -77,7 +79,7 @@ class DefinitionParser { ...@@ -77,7 +79,7 @@ class DefinitionParser {
String thresholdString = extractThreshold(line); String thresholdString = extractThreshold(line);
Threshold threshold = parseThreshold(thresholdString); Threshold threshold = parseThreshold(thresholdString);
String line2 = line.substring(thresholdString.length()).trim(); String line2 = line.substring(thresholdString.length()).trim();
String[] split = line2.split(" "); String[] split = DataHelper.split(line2," ");
if (split.length < 2) if (split.length < 2)
throw new InvalidDefinitionException("invalid definition "+line); throw new InvalidDefinitionException("invalid definition "+line);
if ("explicit".equalsIgnoreCase(split[0])) if ("explicit".equalsIgnoreCase(split[0]))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment