You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by kw...@apache.org on 2022/11/20 15:50:23 UTC

[maven-plugin-tools] branch bugfix/javadoc-reference-with-labels-containing-spaces created (now 76eee712)

This is an automated email from the ASF dual-hosted git repository.

kwin pushed a change to branch bugfix/javadoc-reference-with-labels-containing-spaces
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git


      at 76eee712 [MPLUGIN-443] Detect javadoc link labels with spaces

This branch includes the following new commits:

     new 76eee712 [MPLUGIN-443] Detect javadoc link labels with spaces

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[maven-plugin-tools] 01/01: [MPLUGIN-443] Detect javadoc link labels with spaces

Posted by kw...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

kwin pushed a commit to branch bugfix/javadoc-reference-with-labels-containing-spaces
in repository https://gitbox.apache.org/repos/asf/maven-plugin-tools.git

commit 76eee712dece21d1633d7e06a16d69ccad6238d5
Author: Konrad Windszus <kw...@apache.org>
AuthorDate: Sun Nov 20 16:50:15 2022 +0100

    [MPLUGIN-443] Detect javadoc link labels with spaces
---
 .../java/org/apache/maven/tools/plugin/javadoc/JavadocReference.java  | 4 ++--
 .../org/apache/maven/tools/plugin/javadoc/JavadocReferenceTest.java   | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/javadoc/JavadocReference.java b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/javadoc/JavadocReference.java
index 1501c822..e33a523a 100644
--- a/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/javadoc/JavadocReference.java
+++ b/maven-plugin-tools-api/src/main/java/org/apache/maven/tools/plugin/javadoc/JavadocReference.java
@@ -46,11 +46,11 @@ public class JavadocReference
     private final Optional<String> label;
 
     /*
-     * Test at https://regex101.com/r/eDzWNx/1
+     * Test at https://regex101.com/r/eDzWNx
      * Captures several groups: module name (1), package name and/or class name (2), member (3), label (4)
      */
     private static final Pattern REFERENCE_VALUE_PATTERN =
-        Pattern.compile( "^\\s*(?:(.+)/)??([^#\\s/]+)?(?:#([^\\s\\(]+(?:\\([^\\)]*\\))?))?(?: +([^\\s/]+)\\s*)?$" );
+        Pattern.compile( "^\\s*(?:(.+)/)??([^#\\s/]+)?(?:#([^\\s\\(]+(?:\\([^\\)]*\\))?))?(?: +(.*))?$" );
 
     private static final int GROUP_INDEX_MODULE = 1;
 
diff --git a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/javadoc/JavadocReferenceTest.java b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/javadoc/JavadocReferenceTest.java
index 9f4d37f4..3f9b5635 100644
--- a/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/javadoc/JavadocReferenceTest.java
+++ b/maven-plugin-tools-api/src/test/java/org/apache/maven/tools/plugin/javadoc/JavadocReferenceTest.java
@@ -45,6 +45,8 @@ class JavadocReferenceTest
                       JavadocReference.parse( "package.Class#member(ArgType1,ArgType2) label" ) );
         assertEquals( new JavadocReference( Optional.of("my.module"), Optional.of( "package.Class" ), Optional.of( "member(ArgType1,ArgType2)" ), Optional.of("label") ),
                       JavadocReference.parse( "my.module/package.Class#member(ArgType1,ArgType2) label" ) );
+        assertEquals( new JavadocReference( Optional.empty(), Optional.empty(), Optional.of( "member" ), Optional.of("label with spaces") ),
+                JavadocReference.parse( "#member label with spaces" ) );
     }
 
 }