Skip to content
Permalink
Browse files
981: Jira issue parser bails on space after URL
Reviewed-by: erikj
  • Loading branch information
rwestberg committed Apr 22, 2021
1 parent 7cdcc9d commit cbc8f3c1dca9fbca8664582f6383b4db18341e4a
Showing 1 changed file with 20 additions and 13 deletions.
@@ -27,11 +27,11 @@
import org.openjdk.skara.json.*;
import org.openjdk.skara.network.*;

import java.net.URI;
import java.net.*;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.logging.Logger;
import java.util.logging.*;
import java.util.regex.Pattern;
import java.util.stream.*;

@@ -388,19 +388,26 @@ private Optional<Link> parseWebLinkComment(Comment comment) {
if (!titleMatcher.matches() || !urlMatcher.matches()) {
return Optional.empty();
}
var linkBuilder = Link.create(URI.create(urlMatcher.group(1)), titleMatcher.group(1));
for (int i = 2; i < lines.size(); ++i) {
var line = lines.get(i);
var summaryMatcher = summaryPattern.matcher(line);
if (summaryMatcher.matches()) {
linkBuilder.summary(summaryMatcher.group(1));
}
var relationshipMatcher = relationshipPattern.matcher(line);
if (relationshipMatcher.matches()) {
linkBuilder.relationship(relationshipMatcher.group(1));
try {
var uri = URI.create(urlMatcher.group(1));
var linkBuilder = Link.create(uri, titleMatcher.group(1));
for (int i = 2; i < lines.size(); ++i) {
var line = lines.get(i);
var summaryMatcher = summaryPattern.matcher(line);
if (summaryMatcher.matches()) {
linkBuilder.summary(summaryMatcher.group(1));
}
var relationshipMatcher = relationshipPattern.matcher(line);
if (relationshipMatcher.matches()) {
linkBuilder.relationship(relationshipMatcher.group(1));
}
}
return Optional.of(linkBuilder.build());

} catch (IllegalArgumentException e) {
log.log(Level.WARNING, "Invalid link in web link comment: " + urlMatcher.group(1), e);
return Optional.empty();
}
return Optional.of(linkBuilder.build());
}

private void addWebLinkAsComment(Link link) {

1 comment on commit cbc8f3c

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on cbc8f3c Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.