Quantcast

[JIRA] (JENKINS-14205) BetweenTokensEditor corrupts page if start marker not found

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-14205) BetweenTokensEditor corrupts page if start marker not found

JIRA noreply@jenkins-ci.org
Issue Type: Bug Bug
Assignee: Joe Hansche
Components: confluence-publisher
Created: 25/Jun/12 6:08 AM
Description:

I found a second problem in the token matching logic of BetweenTokensEditor.java. The logic for finding the start token is:

final int start = content.indexOf(startMarkerToken) + startMarkerToken.length();
if (start < 0) { // exception }

However, as long as the startMarkerToken is defined, the sum of indexOf + length() will be non-negative whether the marker is found or not. If the marker length is 10, then the plugin will replace the page content starting from char 9 if the marker is not found, corrupting the page.

Obviously, the code should check whether indexOf(startMarkerToken) < 0, instead of checking the sum.

Project: Jenkins
Priority: Critical Critical
Reporter: Sampo Niskanen
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-14205) BetweenTokensEditor corrupts page if start marker not found

JIRA noreply@jenkins-ci.org
Joe Hansche started work on Bug JENKINS-14205
Change By: Joe Hansche (25/Jun/12 3:34 PM)
Status: Open In Progress
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-14205) BetweenTokensEditor corrupts page if start marker not found

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Joe Hansche stopped work on Bug JENKINS-14205
Change By: Joe Hansche (25/Jun/12 4:44 PM)
Status: In Progress Open
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-14205) BetweenTokensEditor corrupts page if start marker not found

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

Code changed in jenkins
User: Joe Hansche
Path:
.classpath
pom.xml
src/main/java/com/myyearbook/hudson/plugins/confluence/wiki/editors/BetweenTokensEditor.java
src/test/java/com/myyearbook/hudson/plugins/confluence/wiki/editors/BetweenTokensEditorTest.java
http://jenkins-ci.org/commit/confluence-publisher-plugin/2aa0a59ff18c82a0fb914e5498651f23aa557502
Log:
[Fix JENKINS-14205] Fix logic error checking for start token.

If the start token is configured, but does not exist in the content,
the check for the start token's existence would fail, causing the content
to become corrupt.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-14205) BetweenTokensEditor corrupts page if start marker not found

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Joe Hansche resolved Bug JENKINS-14205 as Fixed

Thanks for the report and for taking the time to look into it! I've pushed a fix, released as version 1.7. I've also added unit tests so things like this don't regress later.

Change By: Joe Hansche (25/Jun/12 4:47 PM)
Status: Open Resolved
Resolution: Fixed
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-14205) BetweenTokensEditor corrupts page if start marker not found

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org

Scratch that: 1.7 was a botched release and should not show up in the Update Center (release plugin failed to push, and left everything in a weird state). Please confirm that 1.7.1 fixes the bug, once it drops in the Update Center.

Thanks!

Change By: Joe Hansche (25/Jun/12 5:06 PM)
Assignee: Joe Hansche Sampo Niskanen
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
Loading...