aboutsummaryrefslogtreecommitdiff
path: root/juick-server-jdbc/src/main/java/com
diff options
context:
space:
mode:
authorGravatar k0st1x2018-04-20 15:42:49 +0300
committerGravatar Vitaly Takmazov2018-04-20 16:16:49 +0300
commite4defa51ce6f124a76fc369c862c64553f7a0114 (patch)
tree0c4a2dba9596fb0448feca27cbb3e715a7c68750 /juick-server-jdbc/src/main/java/com
parente858e33bf615e354df8b234418162c8b6a9f2025 (diff)
fixes issue — do not collect tags from commented/quoted lines
Diffstat (limited to 'juick-server-jdbc/src/main/java/com')
-rw-r--r--juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java b/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java
index 403dac09..63e07bd2 100644
--- a/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java
+++ b/juick-server-jdbc/src/main/java/com/juick/service/TagServiceImpl.java
@@ -224,20 +224,21 @@ public class TagServiceImpl extends BaseJdbcService implements TagService {
@Override
public List<Tag> fromString(final String txt, final boolean tagsOnly) {
Pattern tagsPattern = tagsOnly ? TAGS_PATTERN1 : TAGS_PATTERN2;
-
- if (tagsPattern.matcher(txt).matches()) {
- Matcher tagMatcher = TAG_PATTERN.matcher(txt);
-
- List<Tag> tags = new ArrayList<>();
-
- // TODO: process readonly, private, friends, public
- while (tagMatcher.find()) {
- for (int i = 1; i <= tagMatcher.groupCount(); i++)
- tags.add(getTag(tagMatcher.group(i), true));
+ List<Tag> tags = new ArrayList<>();
+ for (String line : txt.split("\n")) {
+ if (line.startsWith(">"))
+ continue;
+ if (tagsPattern.matcher(line).matches()) {
+ Matcher tagMatcher = TAG_PATTERN.matcher(line);
+
+ // TODO: process readonly, private, friends, public
+ while (tagMatcher.find()) {
+ for (int i = 1; i <= tagMatcher.groupCount(); i++)
+ tags.add(getTag(tagMatcher.group(i), true));
+ }
}
- return tags;
}
- return Collections.emptyList();
+ return tags;
}
@Transactional(readOnly = true)