Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid crash when processing logs of files not under the source dir #563

Conversation

abelsromero
Copy link
Member

@abelsromero abelsromero commented Dec 23, 2021

Thank you for opening a pull request and contributing to asciidoctor-maven-plugin!

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Documentation
  • Refactor
  • Build improvement
  • Other (please describe)

What is the goal of this pull request?
Validates if the cursor file path is contained in the configured source directory of the plugin to avoid crashing.
It also checks if the cursor is a remote url to prevent similar crash.

Are there any alternative ways to implement this?
The subpath and http validations could be done with java.io.Path but required methods are not available in Java8. This can be refactored with we drop compat for Java8 in v3.0.0.

Are there any implications of this pull request? Anything a user must know?
No.

Is it related to an existing issue?

Finally, please add a corresponding entry to CHANGELOG.adoc

Closes #554

@abelsromero abelsromero force-pushed the issue-554-fix-StringIndexOutOfBoundsException-when-failed-include-not-in-sub-path branch 3 times, most recently from 48e0cac to 2f705b1 Compare December 24, 2021 10:32
* Rename LogRecordHelper into LogRecordFormatter
@abelsromero abelsromero force-pushed the issue-554-fix-StringIndexOutOfBoundsException-when-failed-include-not-in-sub-path branch from 2f705b1 to b8a2452 Compare December 24, 2021 10:34
@abelsromero abelsromero merged commit fb79430 into asciidoctor:main Dec 24, 2021
@abelsromero abelsromero deleted the issue-554-fix-StringIndexOutOfBoundsException-when-failed-include-not-in-sub-path branch August 25, 2022 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

StringIndexOutOfBoundsException with version 2.2.1
1 participant