[jira] [Created] (WEAVER-17) Missing HelpMojo when trying to run mvn clean org.apache.commons:commons-weaver-maven-plugin:help
Bruno P. Kinoshita created WEAVER-17: Summary: Missing HelpMojo when trying to run mvn clean org.apache.commons:commons-weaver-maven-plugin:help Key: WEAVER-17 URL: https://issues.apache.org/jira/browse/WEAVER-17 Project: Commons Weaver Issue Type: Bug Components: maven-plugin Reporter: Bruno P. Kinoshita Priority: Minor This week while playing with weaver, trying to write a weaver for a Spring project, I tried to see the help with the following command: {noformat} mvn clean org.apache.commons:commons-weaver-maven-plugin:help {noformat} But it failed with the following message: {noformat} [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 0.579 s [INFO] Finished at: 2016-11-19T19:55:06+13:00 [INFO] Final Memory: 10M/238M [INFO] [ERROR] Failed to execute goal org.apache.commons:commons-weaver-maven-plugin:1.4-SNAPSHOT:help (default-cli) on project weaver-example: Execution default-cli of goal org.apache.commons:commons-weaver-maven-plugin:1.4-SNAPSHOT:help failed: Unable to load the mojo 'help' in the plugin 'org.apache.commons:commons-weaver-maven-plugin:1.4-SNAPSHOT'. A required class is missing: HelpMojo [ERROR] - [ERROR] realm = plugin>org.apache.commons:commons-weaver-maven-plugin:1.4-SNAPSHOT [ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy [ERROR] urls[0] = file:/home/kinow/.m2/repository/org/apache/commons/commons-weaver-maven-plugin/1.4-SNAPSHOT/commons-weaver-maven-plugin-1.4-SNAPSHOT.jar [ERROR] urls[1] = file:/home/kinow/.m2/repository/org/apache/commons/commons-weaver-privilizer-api/1.4-SNAPSHOT/commons-weaver-privilizer-api-1.4-SNAPSHOT.jar [ERROR] urls[2] = file:/home/kinow/.m2/repository/org/apache/commons/commons-weaver-privilizer/1.4-SNAPSHOT/commons-weaver-privilizer-1.4-SNAPSHOT.jar [ERROR] urls[3] = file:/home/kinow/.m2/repository/org/apache/commons/commons-weaver-processor/1.4-SNAPSHOT/commons-weaver-processor-1.4-SNAPSHOT.jar [ERROR] urls[4] = file:/home/kinow/.m2/repository/org/apache/xbean/xbean-finder-shaded/4.5/xbean-finder-shaded-4.5.jar [ERROR] urls[5] = file:/home/kinow/.m2/repository/org/apache/xbean/xbean-asm5-shaded/4.5/xbean-asm5-shaded-4.5.jar [ERROR] urls[6] = file:/home/kinow/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar [ERROR] urls[7] = file:/home/kinow/.m2/repository/org/apache/commons/commons-collections4/4.1/commons-collections4-4.1.jar [ERROR] urls[8] = file:/home/kinow/.m2/repository/commons-io/commons-io/2.5/commons-io-2.5.jar [ERROR] urls[9] = file:/home/kinow/.m2/repository/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.jar [ERROR] urls[10] = file:/home/kinow/.m2/repository/org/eclipse/aether/aether-util/1.1.0/aether-util-1.1.0.jar [ERROR] Number of foreign imports: 1 [ERROR] import: Entry[import from realm ClassRealm[maven.api, parent: null]] [ERROR] [ERROR] - [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException {noformat} If I try to run prepare with {noformat} mvn clean org.apache.commons:commons-weaver-maven-plugin:prepare {noformat} it works fine. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (WEAVER-16) NullPointerException when weaving class with no package
[ https://issues.apache.org/jira/browse/WEAVER-16?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15678693#comment-15678693 ] Bruno P. Kinoshita commented on WEAVER-16: -- Exception: {noformat} [INFO] [INFO] BUILD FAILURE [INFO] [INFO] Total time: 1.340 s [INFO] Finished at: 2016-11-19T18:56:43+13:00 [INFO] Final Memory: 16M/205M [INFO] [ERROR] Failed to execute goal org.apache.commons:commons-weaver-maven-plugin:1.4-SNAPSHOT:weave (default) on project weaver-example: weaving failed due to null: NullPointerException -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.commons:commons-weaver-maven-plugin:1.4-SNAPSHOT:weave (default) on project weaver-example: weaving failed due to null at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: org.apache.maven.plugin.MojoExecutionException: weaving failed due to null at org.apache.commons.weaver.maven.AbstractWeaveMojo.doExecute(AbstractWeaveMojo.java:40) at org.apache.commons.weaver.maven.AbstractCWMojo.execute(AbstractCWMojo.java:115) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) ... 20 more Caused by: java.lang.NullPointerException at org.apache.commons.weaver.model.ScanResult.getWeavable(ScanResult.java:184) at org.apache.commons.weaver.model.ScanResult.getWeavable(ScanResult.java:200) at org.apache.commons.weaver.model.ScanResult.getWeavable(ScanResult.java:218) at org.apache.commons.weaver.Finder.scan(Finder.java:706) at org.apache.commons.weaver.privilizer.PrivilizerWeaver.process(PrivilizerWeaver.java:55) at org.apache.commons.weaver.WeaveProcessor.weave(WeaveProcessor.java:70) at org.apache.commons.weaver.maven.AbstractWeaveMojo.doExecute(AbstractWeaveMojo.java:38) ... 23 more [ERROR] [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException {noformat} > NullPointerException when weaving class with no package > --- > > Key: WEAVER-16 > URL: https://issues.apache.org/jira/browse/WEAVER-16 > Project: Commons Weaver > Issue Type: Bug > Components: core >Reporter: Bruno P. Kinoshita >Priority: Minor > > This issue happened while quickly writing an example with weaver to test > another issue. > I created a sample project to call the maven-plugin with privilizer, as in > the project home page example. > {code} > import org.apache.commons.weaver.privilizer.Privileged; > public class SimpleClass { > public void
[jira] [Created] (WEAVER-16) NullPointerException when weaving class with no package
Bruno P. Kinoshita created WEAVER-16: Summary: NullPointerException when weaving class with no package Key: WEAVER-16 URL: https://issues.apache.org/jira/browse/WEAVER-16 Project: Commons Weaver Issue Type: Bug Components: core Reporter: Bruno P. Kinoshita Priority: Minor This issue happened while quickly writing an example with weaver to test another issue. I created a sample project to call the maven-plugin with privilizer, as in the project home page example. {code} import org.apache.commons.weaver.privilizer.Privileged; public class SimpleClass { public void sayA() { System.out.println("Aaa"); } @Privileged public void sayNothing() { System.out.println("Nothing"); } } {code} As I was in a hurry, I didn't bother creating a package, adding comments, etc. When I asked Eclipse to build the project, it threw a NPE. Then I tried via command line, same behavior. My pom.xml was using version 1.3, but since I have the project sources in my workspace, I re-synced the local repo, `mvn install`'d, and then updated the pom to use 1.4-SNAPSHOT. Same issue. I believe the issue is in the ScanResult#getWeavable method that returns a WeavablePackage. {code} // snip /** * Public for use by {@link WeaveProcessor}. * @param pkg to wrap * @return {@link WeavablePackage} */ public WeavablePackage getWeavable(final Package pkg) { final String key = pkg.getName(); if (packages.containsKey(key)) { return packages.get(key); } final WeavablePackage result = new WeavablePackage(pkg); final WeavablePackage faster = packages.putIfAbsent(key, result); return faster == null ? result : faster; } // snip {code} I believe when you create a class with no package, trying to get its package (i.e. obj.getClass().getPackage()) will return null. So I'm no sure how this issue could be fixed. Simply passing a null to WeavablePackage's contructor seems like will create other issues... For the time being, will update my example to use packages. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (TEXT-2) Add Jaccard Index and Jaccard Distance
[ https://issues.apache.org/jira/browse/TEXT-2?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15678622#comment-15678622 ] Bruno P. Kinoshita commented on TEXT-2: --- Hi Don, There has been some changes around edit distances, it has been re-modeled (for TEXT-21). So make sure to sync your local repo while working on your changes. Looking forward for the pull request. Cheers Bruno > Add Jaccard Index and Jaccard Distance > -- > > Key: TEXT-2 > URL: https://issues.apache.org/jira/browse/TEXT-2 > Project: Commons Text > Issue Type: New Feature >Reporter: Bruno P. Kinoshita >Priority: Minor > > Implement the Jaccard Index and Jaccard Distance as in > http://en.wikipedia.org/wiki/Jaccard_index -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (TEXT-2) Add Jaccard Index and Jaccard Distance
[ https://issues.apache.org/jira/browse/TEXT-2?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15678610#comment-15678610 ] Don Jeba commented on TEXT-2: - Hello Bruno, Planning to add a new class under org.apache.commons.text.similarity, that will implement EditDistance. Kindly comment if you have any. Once the development is done, will come with the pull request. Thank you, Regards, Don Jeba. > Add Jaccard Index and Jaccard Distance > -- > > Key: TEXT-2 > URL: https://issues.apache.org/jira/browse/TEXT-2 > Project: Commons Text > Issue Type: New Feature >Reporter: Bruno P. Kinoshita >Priority: Minor > > Implement the Jaccard Index and Jaccard Distance as in > http://en.wikipedia.org/wiki/Jaccard_index -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1288) Add a builder to StringEscapeUtils
[ https://issues.apache.org/jira/browse/LANG-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15678075#comment-15678075 ] ASF GitHub Bot commented on LANG-1288: -- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/213 [![Coverage Status](https://coveralls.io/builds/8904357/badge)](https://coveralls.io/builds/8904357) Coverage decreased (-0.003%) to 93.666% when pulling **b62c4d4a81e22b552616d346bc818cae4d73c580 on PascalSchumacher:add_EscapedStringBuilder** into **dfd69e038cc7035031d1807c4ade870d2a7e2ece on apache:master**. > Add a builder to StringEscapeUtils > -- > > Key: LANG-1288 > URL: https://issues.apache.org/jira/browse/LANG-1288 > Project: Commons Lang > Issue Type: New Feature >Reporter: Pascal Schumacher >Priority: Minor > > supplied in patch for LANG-1066 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] commons-lang issue #213: LANG-1288: Add a builder to StringEscapeUtils
Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/213 [![Coverage Status](https://coveralls.io/builds/8904357/badge)](https://coveralls.io/builds/8904357) Coverage decreased (-0.003%) to 93.666% when pulling **b62c4d4a81e22b552616d346bc818cae4d73c580 on PascalSchumacher:add_EscapedStringBuilder** into **dfd69e038cc7035031d1807c4ade870d2a7e2ece on apache:master**. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (LANG-1067) Add a reflection-based variant of DiffBuilder
[ https://issues.apache.org/jira/browse/LANG-1067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15678073#comment-15678073 ] ASF GitHub Bot commented on LANG-1067: -- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/210 [![Coverage Status](https://coveralls.io/builds/8904333/badge)](https://coveralls.io/builds/8904333) Coverage decreased (-0.02%) to 93.646% when pulling **21d4d19fae77703819377630c8cfcc54d01dcc75 on PascalSchumacher:add_reflection_diff_builder** into **dfd69e038cc7035031d1807c4ade870d2a7e2ece on apache:master**. > Add a reflection-based variant of DiffBuilder > - > > Key: LANG-1067 > URL: https://issues.apache.org/jira/browse/LANG-1067 > Project: Commons Lang > Issue Type: Improvement > Components: lang.builder.* >Affects Versions: 3.3.2 >Reporter: Duncan Jones >Priority: Minor > Fix For: Patch Needed > > > LANG-637 originally requested a reflection-based builder. This was forgotten > about and the issue was closed as fix in 3.3, with a new non-reflection > builder. > This issue is a reminder that the reflection-based builder is still sought > and should be added in a future release. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] commons-lang issue #210: LANG-1067: Add a reflection-based variant of DiffBu...
Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/210 [![Coverage Status](https://coveralls.io/builds/8904333/badge)](https://coveralls.io/builds/8904333) Coverage decreased (-0.02%) to 93.646% when pulling **21d4d19fae77703819377630c8cfcc54d01dcc75 on PascalSchumacher:add_reflection_diff_builder** into **dfd69e038cc7035031d1807c4ade870d2a7e2ece on apache:master**. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (LANG-1066) shell/XSI escape/unescape support
[ https://issues.apache.org/jira/browse/LANG-1066?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15678070#comment-15678070 ] ASF GitHub Bot commented on LANG-1066: -- Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/208 [![Coverage Status](https://coveralls.io/builds/8904313/badge)](https://coveralls.io/builds/8904313) Coverage decreased (-0.02%) to 93.652% when pulling **a1e4319d9f7a13a1d162c4e077dbd0f25ae24910 on PascalSchumacher:shell_xsi_escape_unescape_support** into **dfd69e038cc7035031d1807c4ade870d2a7e2ece on apache:master**. > shell/XSI escape/unescape support > - > > Key: LANG-1066 > URL: https://issues.apache.org/jira/browse/LANG-1066 > Project: Commons Lang > Issue Type: Improvement > Components: lang.* >Affects Versions: 3.3.2 >Reporter: Mark >Priority: Minor > Attachments: commons-lang3.trunk.rev1639624.patch > > > Please add the supplied patch. Thanks! -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] commons-lang issue #208: LANG-1066: Add shell/XSI escape/unescape support
Github user coveralls commented on the issue: https://github.com/apache/commons-lang/pull/208 [![Coverage Status](https://coveralls.io/builds/8904313/badge)](https://coveralls.io/builds/8904313) Coverage decreased (-0.02%) to 93.652% when pulling **a1e4319d9f7a13a1d162c4e077dbd0f25ae24910 on PascalSchumacher:shell_xsi_escape_unescape_support** into **dfd69e038cc7035031d1807c4ade870d2a7e2ece on apache:master**. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (LANG-1288) Add a builder to StringEscapeUtils
[ https://issues.apache.org/jira/browse/LANG-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15677854#comment-15677854 ] ASF GitHub Bot commented on LANG-1288: -- Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745694 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { + +private final StringBuilder sb; --- End diff -- Actually, I'm now thinking that it may be good to have a real decorator for `Appendables` with decorates any `Appendable` by piping input to the append methods through the translator first. WDYT? > Add a builder to StringEscapeUtils > -- > > Key: LANG-1288 > URL: https://issues.apache.org/jira/browse/LANG-1288 > Project: Commons Lang > Issue Type: New Feature >Reporter: Pascal Schumacher >Priority: Minor > > supplied in patch for LANG-1066 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1288) Add a builder to StringEscapeUtils
[ https://issues.apache.org/jira/browse/LANG-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15677857#comment-15677857 ] ASF GitHub Bot commented on LANG-1288: -- Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745531 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { --- End diff -- Is `Builder` really a good name? It's more of a wrapper currently. > Add a builder to StringEscapeUtils > -- > > Key: LANG-1288 > URL: https://issues.apache.org/jira/browse/LANG-1288 > Project: Commons Lang > Issue Type: New Feature >Reporter: Pascal Schumacher >Priority: Minor > > supplied in patch for LANG-1066 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1288) Add a builder to StringEscapeUtils
[ https://issues.apache.org/jira/browse/LANG-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15677855#comment-15677855 ] ASF GitHub Bot commented on LANG-1288: -- Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745033 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { + +private final StringBuilder sb; --- End diff -- How about making it possible to pass in any `java.lang.Appendable` and use a `StringBuilder` as default value? > Add a builder to StringEscapeUtils > -- > > Key: LANG-1288 > URL: https://issues.apache.org/jira/browse/LANG-1288 > Project: Commons Lang > Issue Type: New Feature >Reporter: Pascal Schumacher >Priority: Minor > > supplied in patch for LANG-1066 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1288) Add a builder to StringEscapeUtils
[ https://issues.apache.org/jira/browse/LANG-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15677856#comment-15677856 ] ASF GitHub Bot commented on LANG-1288: -- Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745205 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { + +private final StringBuilder sb; +private final CharSequenceTranslator translator; + +public Builder(final CharSequenceTranslator translator) { --- End diff -- I'd rather have a private constructor and then put a static factory method into `StringEscapeUtils` instead of having the inner class that one needs to construct like `new StringEscapeUtils.Builder(ESCAPE)` > Add a builder to StringEscapeUtils > -- > > Key: LANG-1288 > URL: https://issues.apache.org/jira/browse/LANG-1288 > Project: Commons Lang > Issue Type: New Feature >Reporter: Pascal Schumacher >Priority: Minor > > supplied in patch for LANG-1066 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] commons-lang pull request #213: LANG-1288: Add a builder to StringEscapeUtil...
Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745033 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { + +private final StringBuilder sb; --- End diff -- How about making it possible to pass in any `java.lang.Appendable` and use a `StringBuilder` as default value? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #213: LANG-1288: Add a builder to StringEscapeUtil...
Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745694 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { + +private final StringBuilder sb; --- End diff -- Actually, I'm now thinking that it may be good to have a real decorator for `Appendables` with decorates any `Appendable` by piping input to the append methods through the translator first. WDYT? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #213: LANG-1288: Add a builder to StringEscapeUtil...
Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745531 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { --- End diff -- Is `Builder` really a good name? It's more of a wrapper currently. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #213: LANG-1288: Add a builder to StringEscapeUtil...
Github user britter commented on a diff in the pull request: https://github.com/apache/commons-lang/pull/213#discussion_r88745205 --- Diff: src/main/java/org/apache/commons/lang3/StringEscapeUtils.java --- @@ -429,6 +429,65 @@ public StringEscapeUtils() { super(); } +/** + * Convenience wrapper for {@link java.lang.StringBuilder} providing escape methods. + * + * Example: + * + * new Builder(ESCAPE_HTML4) + * .append("p>") + * .escape("This is paragraph 1 and special chars like get escaped.") + * .append("/p>p>") + * .escape("This is paragraph 2 more...") + * .append("/p>") + * .toString() + * + * + * @since 3.6 + */ +public static class Builder { + +private final StringBuilder sb; +private final CharSequenceTranslator translator; + +public Builder(final CharSequenceTranslator translator) { --- End diff -- I'd rather have a private constructor and then put a static factory method into `StringEscapeUtils` instead of having the inner class that one needs to construct like `new StringEscapeUtils.Builder(ESCAPE)` --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Deleted] (LANG-1289) JavaVersion class depends on Apache Commons Math class NumberUtils
[ https://issues.apache.org/jira/browse/LANG-1289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary Gregory deleted LANG-1289: --- > JavaVersion class depends on Apache Commons Math class NumberUtils > -- > > Key: LANG-1289 > URL: https://issues.apache.org/jira/browse/LANG-1289 > Project: Commons Lang > Issue Type: Bug >Reporter: Gary Gregory >Assignee: Gary Gregory > > JavaVersion class depends on Apache Commons Math class NumberUtils. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1289) JavaVersion class depends on Apache Commons Math class NumberUtils
[ https://issues.apache.org/jira/browse/LANG-1289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15677838#comment-15677838 ] Gary Gregory commented on LANG-1289: I just did revert. I'll even delete this ticket. Sorry about the noise. > JavaVersion class depends on Apache Commons Math class NumberUtils > -- > > Key: LANG-1289 > URL: https://issues.apache.org/jira/browse/LANG-1289 > Project: Commons Lang > Issue Type: Bug >Reporter: Gary Gregory >Assignee: Gary Gregory > > JavaVersion class depends on Apache Commons Math class NumberUtils. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1289) JavaVersion class depends on Apache Commons Math class NumberUtils
[ https://issues.apache.org/jira/browse/LANG-1289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15677808#comment-15677808 ] Pascal Schumacher commented on LANG-1289: - The NumberUtils class used by JavaVersion is not from commons-math, but from commons-lang: https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/math/NumberUtils.java This is not a bug and should be reverted. > JavaVersion class depends on Apache Commons Math class NumberUtils > -- > > Key: LANG-1289 > URL: https://issues.apache.org/jira/browse/LANG-1289 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Affects Versions: 3.5 >Reporter: Gary Gregory >Assignee: Gary Gregory > Fix For: 3.6 > > > JavaVersion class depends on Apache Commons Math class NumberUtils. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Closed] (LANG-1289) JavaVersion class depends on Apache Commons Math class NumberUtils
[ https://issues.apache.org/jira/browse/LANG-1289?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Gary Gregory closed LANG-1289. -- Resolution: Fixed Fix Version/s: 3.6 In Git master. > JavaVersion class depends on Apache Commons Math class NumberUtils > -- > > Key: LANG-1289 > URL: https://issues.apache.org/jira/browse/LANG-1289 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Affects Versions: 3.5 >Reporter: Gary Gregory >Assignee: Gary Gregory > Fix For: 3.6 > > > JavaVersion class depends on Apache Commons Math class NumberUtils. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (LANG-1289) JavaVersion class depends on Apache Commons Math class NumberUtils
Gary Gregory created LANG-1289: -- Summary: JavaVersion class depends on Apache Commons Math class NumberUtils Key: LANG-1289 URL: https://issues.apache.org/jira/browse/LANG-1289 Project: Commons Lang Issue Type: Bug Components: lang.* Affects Versions: 3.5 Reporter: Gary Gregory Assignee: Gary Gregory JavaVersion class depends on Apache Commons Math class NumberUtils. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Closed] (LANG-642) Need varargs form of NumberUtils.max(), etc
[ https://issues.apache.org/jira/browse/LANG-642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pascal Schumacher closed LANG-642. -- Resolution: Duplicate Fix Version/s: (was: Patch Needed) > Need varargs form of NumberUtils.max(), etc > --- > > Key: LANG-642 > URL: https://issues.apache.org/jira/browse/LANG-642 > Project: Commons Lang > Issue Type: Improvement > Components: lang.math.* >Reporter: david cogen >Priority: Minor > > There should be a varargs form of the NumberUtils.max() and min() functions. > E.g. int max (int... numbers) > This might conflict with the existing int max (int[] numbers) but that > function would in fact not be needed if the varargs form existed because an > array could be supplied to it just as easily. > Or, if it is undesirable to remove max(int[] numbers), then a varargs > function could be defined as > int max (int number1, int... moreNumbers) > which would work for any number of arguments greater than 0. > Of course this function should be implemented for all number types (byte, > short, float, double, etc) and both max() and min() should be provided. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (LANG-1288) Add a builder to StringEscapeUtils
[ https://issues.apache.org/jira/browse/LANG-1288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15677273#comment-15677273 ] ASF GitHub Bot commented on LANG-1288: -- GitHub user PascalSchumacher opened a pull request: https://github.com/apache/commons-lang/pull/213 LANG-1288: Add a builder to StringEscapeUtils patch supplied by Mark (for LANG-1066) You can merge this pull request into a Git repository by running: $ git pull https://github.com/PascalSchumacher/commons-lang add_EscapedStringBuilder Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/213.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #213 commit 7a11c5fc982acc2223ae23a1934b19b6dd05b711 Author: pascalschumacherDate: 2016-11-18T17:36:58Z LANG-1288: Add a builder to StringEscapeUtils patch supplied by Mark (for LANG-1066) > Add a builder to StringEscapeUtils > -- > > Key: LANG-1288 > URL: https://issues.apache.org/jira/browse/LANG-1288 > Project: Commons Lang > Issue Type: New Feature >Reporter: Pascal Schumacher >Priority: Minor > > supplied in patch for LANG-1066 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] commons-lang pull request #213: LANG-1288: Add a builder to StringEscapeUtil...
GitHub user PascalSchumacher opened a pull request: https://github.com/apache/commons-lang/pull/213 LANG-1288: Add a builder to StringEscapeUtils patch supplied by Mark (for LANG-1066) You can merge this pull request into a Git repository by running: $ git pull https://github.com/PascalSchumacher/commons-lang add_EscapedStringBuilder Alternatively you can review and apply these changes as the patch at: https://github.com/apache/commons-lang/pull/213.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #213 commit 7a11c5fc982acc2223ae23a1934b19b6dd05b711 Author: pascalschumacherDate: 2016-11-18T17:36:58Z LANG-1288: Add a builder to StringEscapeUtils patch supplied by Mark (for LANG-1066) --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Created] (LANG-1288) Add a builder to StringEscapeUtils
Pascal Schumacher created LANG-1288: --- Summary: Add a builder to StringEscapeUtils Key: LANG-1288 URL: https://issues.apache.org/jira/browse/LANG-1288 Project: Commons Lang Issue Type: New Feature Reporter: Pascal Schumacher Priority: Minor supplied in patch for LANG-1066 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] commons-lang pull request #206: StringUtils: mention in javadoc that Charact...
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/206 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Resolved] (LANG-1287) RandomStringUtils#random can enter infinite loop if end parameter is to small
[ https://issues.apache.org/jira/browse/LANG-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pascal Schumacher resolved LANG-1287. - Resolution: Fixed Fix Version/s: 3.6 > RandomStringUtils#random can enter infinite loop if end parameter is to small > - > > Key: LANG-1287 > URL: https://issues.apache.org/jira/browse/LANG-1287 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Affects Versions: 3.5 >Reporter: Pascal Schumacher >Assignee: Pascal Schumacher > Fix For: 3.6 > > > {quote}I faced that the random method can cause an infinite loop. It can be > caused if the end parameter is too low for generating either numbers (< 48) > or letters (<65). I added some exception tests to make the cases clear. > Basically, if we call the random function with for example numbers = true && > end < 48 the validation for Character.isDigit(ch) will fail and we increment > count count++.{quote} > Ivan Morozov https://github.com/apache/commons-lang/pull/211 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[GitHub] commons-lang issue #211: Fixed possible infinite loop in random of RandomStr...
Github user PascalSchumacher commented on the issue: https://github.com/apache/commons-lang/pull/211 Thanks! :+1: --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] commons-lang pull request #211: Fixed possible infinite loop in random of Ra...
Github user asfgit closed the pull request at: https://github.com/apache/commons-lang/pull/211 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Updated] (LANG-1287) RandomStringUtils#random can enter infinite loop if end parameter is to small
[ https://issues.apache.org/jira/browse/LANG-1287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Pascal Schumacher updated LANG-1287: Description: {quote}I faced that the random method can cause an infinite loop. It can be caused if the end parameter is too low for generating either numbers (< 48) or letters (<65). I added some exception tests to make the cases clear. Basically, if we call the random function with for example numbers = true && end < 48 the validation for Character.isDigit(ch) will fail and we increment count count++.{quote} Ivan Morozov https://github.com/apache/commons-lang/pull/211 was: {quote}I faced that the random method can cause an infinite loop. It can be caused if the end parameter is too low for generating either numbers (< 48) or letters (<65). I added some exception tests to make the cases clear. Basically, if we call the random function with for example numbers = true && end < 48 the validation for Character.isDigit(ch) will fail and we increment count count++.{quote} Ivan Morozov https://github.com/apache/commons-lang/pull/211 > RandomStringUtils#random can enter infinite loop if end parameter is to small > - > > Key: LANG-1287 > URL: https://issues.apache.org/jira/browse/LANG-1287 > Project: Commons Lang > Issue Type: Bug > Components: lang.* >Affects Versions: 3.5 >Reporter: Pascal Schumacher >Assignee: Pascal Schumacher > > {quote}I faced that the random method can cause an infinite loop. It can be > caused if the end parameter is too low for generating either numbers (< 48) > or letters (<65). I added some exception tests to make the cases clear. > Basically, if we call the random function with for example numbers = true && > end < 48 the validation for Character.isDigit(ch) will fail and we increment > count count++.{quote} > Ivan Morozov https://github.com/apache/commons-lang/pull/211 -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Created] (LANG-1287) RandomStringUtils#random can enter infinite loop if end parameter is to small
Pascal Schumacher created LANG-1287: --- Summary: RandomStringUtils#random can enter infinite loop if end parameter is to small Key: LANG-1287 URL: https://issues.apache.org/jira/browse/LANG-1287 Project: Commons Lang Issue Type: Bug Components: lang.* Affects Versions: 3.5 Reporter: Pascal Schumacher Assignee: Pascal Schumacher {quote}I faced that the random method can cause an infinite loop. It can be caused if the end parameter is too low for generating either numbers (< 48) or letters (<65). I added some exception tests to make the cases clear. Basically, if we call the random function with for example numbers = true && end < 48 the validation for Character.isDigit(ch) will fail and we increment count count++.{quote} Ivan Morozov https://github.com/apache/commons-lang/pull/211 -- This message was sent by Atlassian JIRA (v6.3.4#6332)