[JIRA] (JENKINS-13896) Exception when multiple end markers present on page
[ https://issues.jenkins-ci.org/browse/JENKINS-13896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joe Hansche closed JENKINS-13896. - Assignee: Sampo Niskanen (was: Joe Hansche) Released as version 1.6 > Exception when multiple end markers present on page > --- > > Key: JENKINS-13896 > URL: https://issues.jenkins-ci.org/browse/JENKINS-13896 > Project: Jenkins > Issue Type: Bug > Components: confluence-publisher >Reporter: Sampo Niskanen >Assignee: Sampo Niskanen > > When using the "Replace content between start/end tokens" if the end marker > exists in multiple places on the page, the first marker is selected even if > it is before the start marker. This results in failure with the following > stack trace: > [confluence] Performing wiki edits: Replace content between start/end tokens > ERROR: Publisher com.myyearbook.hudson.plugins.confluence.ConfluencePublisher > aborted due to exception > java.lang.StringIndexOutOfBoundsException > at > java.lang.AbstractStringBuilder.delete(AbstractStringBuilder.java:702) > at java.lang.StringBuffer.delete(StringBuffer.java:373) > at > com.myyearbook.hudson.plugins.confluence.wiki.editors.BetweenTokensEditor.performEdits(BetweenTokensEditor.java:57) > at > com.myyearbook.hudson.plugins.confluence.wiki.editors.MarkupEditor.performReplacement(MarkupEditor.java:57) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performEdits(ConfluencePublisher.java:394) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performWikiReplacements(ConfluencePublisher.java:353) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.perform(ConfluencePublisher.java:327) > at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) > at > hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710) > at > hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685) > at hudson.model.Build$RunnerImpl.post2(Build.java:162) > at > hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632) > at hudson.model.Run.run(Run.java:1459) > at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) > at hudson.model.ResourceController.execute(ResourceController.java:88) > at hudson.model.Executor.run(Executor.java:239) > The fix for this is trivial, just search for the next end token *after* the > start token. I.e. change line 45 in BetweenTokensEditor.java from > final int end = content.indexOf(endMarkerToken); > to > final int end = content.indexOf(endMarkerToken, start); > Ideally both start and end token is unique on the page, but for example when > using the DIV macro to create a page portion to replace the end token is > always "". -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[JIRA] (JENKINS-13896) Exception when multiple end markers present on page
[ https://issues.jenkins-ci.org/browse/JENKINS-13896?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Joe Hansche resolved JENKINS-13896. --- Resolution: Fixed Thanks for the report and for tracking down the cause. I've committed a fix, and will be releasing an updated version shortly. You probably won't see it in your update center until tomorrow. > Exception when multiple end markers present on page > --- > > Key: JENKINS-13896 > URL: https://issues.jenkins-ci.org/browse/JENKINS-13896 > Project: Jenkins > Issue Type: Bug > Components: confluence-publisher >Reporter: Sampo Niskanen >Assignee: Joe Hansche > > When using the "Replace content between start/end tokens" if the end marker > exists in multiple places on the page, the first marker is selected even if > it is before the start marker. This results in failure with the following > stack trace: > [confluence] Performing wiki edits: Replace content between start/end tokens > ERROR: Publisher com.myyearbook.hudson.plugins.confluence.ConfluencePublisher > aborted due to exception > java.lang.StringIndexOutOfBoundsException > at > java.lang.AbstractStringBuilder.delete(AbstractStringBuilder.java:702) > at java.lang.StringBuffer.delete(StringBuffer.java:373) > at > com.myyearbook.hudson.plugins.confluence.wiki.editors.BetweenTokensEditor.performEdits(BetweenTokensEditor.java:57) > at > com.myyearbook.hudson.plugins.confluence.wiki.editors.MarkupEditor.performReplacement(MarkupEditor.java:57) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performEdits(ConfluencePublisher.java:394) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performWikiReplacements(ConfluencePublisher.java:353) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.perform(ConfluencePublisher.java:327) > at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) > at > hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710) > at > hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685) > at hudson.model.Build$RunnerImpl.post2(Build.java:162) > at > hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632) > at hudson.model.Run.run(Run.java:1459) > at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) > at hudson.model.ResourceController.execute(ResourceController.java:88) > at hudson.model.Executor.run(Executor.java:239) > The fix for this is trivial, just search for the next end token *after* the > start token. I.e. change line 45 in BetweenTokensEditor.java from > final int end = content.indexOf(endMarkerToken); > to > final int end = content.indexOf(endMarkerToken, start); > Ideally both start and end token is unique on the page, but for example when > using the DIV macro to create a page portion to replace the end token is > always "". -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[JIRA] (JENKINS-13896) Exception when multiple end markers present on page
[ https://issues.jenkins-ci.org/browse/JENKINS-13896?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=163265#comment-163265 ] SCM/JIRA link daemon commented on JENKINS-13896: Code changed in jenkins User: Joe Hansche Path: pom.xml src/main/java/com/myyearbook/hudson/plugins/confluence/wiki/editors/BetweenTokensEditor.java http://jenkins-ci.org/commit/confluence-publisher-plugin/c03fa8b25dde388ecc1e4e6bef142c90f23ec9db Log: [Fix JENKINS-13896] End marker must come after start marker. > Exception when multiple end markers present on page > --- > > Key: JENKINS-13896 > URL: https://issues.jenkins-ci.org/browse/JENKINS-13896 > Project: Jenkins > Issue Type: Bug > Components: confluence-publisher >Reporter: Sampo Niskanen >Assignee: Joe Hansche > > When using the "Replace content between start/end tokens" if the end marker > exists in multiple places on the page, the first marker is selected even if > it is before the start marker. This results in failure with the following > stack trace: > [confluence] Performing wiki edits: Replace content between start/end tokens > ERROR: Publisher com.myyearbook.hudson.plugins.confluence.ConfluencePublisher > aborted due to exception > java.lang.StringIndexOutOfBoundsException > at > java.lang.AbstractStringBuilder.delete(AbstractStringBuilder.java:702) > at java.lang.StringBuffer.delete(StringBuffer.java:373) > at > com.myyearbook.hudson.plugins.confluence.wiki.editors.BetweenTokensEditor.performEdits(BetweenTokensEditor.java:57) > at > com.myyearbook.hudson.plugins.confluence.wiki.editors.MarkupEditor.performReplacement(MarkupEditor.java:57) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performEdits(ConfluencePublisher.java:394) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performWikiReplacements(ConfluencePublisher.java:353) > at > com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.perform(ConfluencePublisher.java:327) > at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) > at > hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710) > at > hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685) > at hudson.model.Build$RunnerImpl.post2(Build.java:162) > at > hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632) > at hudson.model.Run.run(Run.java:1459) > at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) > at hudson.model.ResourceController.execute(ResourceController.java:88) > at hudson.model.Executor.run(Executor.java:239) > The fix for this is trivial, just search for the next end token *after* the > start token. I.e. change line 45 in BetweenTokensEditor.java from > final int end = content.indexOf(endMarkerToken); > to > final int end = content.indexOf(endMarkerToken, start); > Ideally both start and end token is unique on the page, but for example when > using the DIV macro to create a page portion to replace the end token is > always "". -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira
[JIRA] (JENKINS-13896) Exception when multiple end markers present on page
Sampo Niskanen created JENKINS-13896: Summary: Exception when multiple end markers present on page Key: JENKINS-13896 URL: https://issues.jenkins-ci.org/browse/JENKINS-13896 Project: Jenkins Issue Type: Bug Components: confluence-publisher Reporter: Sampo Niskanen Assignee: Joe Hansche When using the "Replace content between start/end tokens" if the end marker exists in multiple places on the page, the first marker is selected even if it is before the start marker. This results in failure with the following stack trace: [confluence] Performing wiki edits: Replace content between start/end tokens ERROR: Publisher com.myyearbook.hudson.plugins.confluence.ConfluencePublisher aborted due to exception java.lang.StringIndexOutOfBoundsException at java.lang.AbstractStringBuilder.delete(AbstractStringBuilder.java:702) at java.lang.StringBuffer.delete(StringBuffer.java:373) at com.myyearbook.hudson.plugins.confluence.wiki.editors.BetweenTokensEditor.performEdits(BetweenTokensEditor.java:57) at com.myyearbook.hudson.plugins.confluence.wiki.editors.MarkupEditor.performReplacement(MarkupEditor.java:57) at com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performEdits(ConfluencePublisher.java:394) at com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.performWikiReplacements(ConfluencePublisher.java:353) at com.myyearbook.hudson.plugins.confluence.ConfluencePublisher.perform(ConfluencePublisher.java:327) at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36) at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:710) at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:685) at hudson.model.Build$RunnerImpl.post2(Build.java:162) at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:632) at hudson.model.Run.run(Run.java:1459) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46) at hudson.model.ResourceController.execute(ResourceController.java:88) at hudson.model.Executor.run(Executor.java:239) The fix for this is trivial, just search for the next end token *after* the start token. I.e. change line 45 in BetweenTokensEditor.java from final int end = content.indexOf(endMarkerToken); to final int end = content.indexOf(endMarkerToken, start); Ideally both start and end token is unique on the page, but for example when using the DIV macro to create a page portion to replace the end token is always "". -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira