Skip to content

Commit

Permalink
influxdata#684: forgot that posix-styled stuff doesn't work here
Browse files Browse the repository at this point in the history
  • Loading branch information
BrentonPoke committed Aug 1, 2020
1 parent 1d4016b commit ef277d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions src/main/java/org/influxdb/dto/Point.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ public Builder tag(final String tagName, final String value) {
&& CheckTags.isTagValueLegal(value)) {
tags.put(tagName, value);
}
else {
throw InfluxDBException.buildExceptionForErrorState("tag name or value failed regex check");
}
return this;
}

Expand All @@ -139,7 +136,11 @@ public Builder tag(final String tagName, final String value) {
*/
public Builder tag(final Map<String, String> tagsToAdd) {
for (Entry<String, String> tag : tagsToAdd.entrySet()) {
if(CheckTags.isTagNameLegal(tag.getKey())
&& CheckTags.isTagValueLegal(tag.getValue()))
tag(tag.getKey(), tag.getValue());
else
continue;
}
return this;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/influxdb/dto/utils/CheckTags.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
*/
public final class CheckTags {
static final String nameRegex = "([a-zA-Z0-9-_]+)";
static final String valueRegex = "[[:ascii:]]+";
static final String valueRegex = "[\\x00-\\x7F]+";
static final Pattern namePattern = Pattern.compile(nameRegex, Pattern.MULTILINE);
static final Pattern valuePattern = Pattern.compile(valueRegex, Pattern.MULTILINE);

Expand All @@ -28,7 +28,7 @@ public final class CheckTags {

public static Boolean isTagNameLegal(String name){
final Matcher matcher = namePattern.matcher(name);
return matcher.groupCount() == 1 && matcher.matches();
return matcher.matches();
}

/**
Expand Down

0 comments on commit ef277d0

Please sign in to comment.