Skip to content

Conversation

@Avinash1423
Copy link

@Avinash1423 Avinash1423 commented Dec 28, 2025

Added Null check and throw of a ScriptException if resource is not available

fixes #66

Signed-off-by: Avinash Niyas <avinashNiyaz1423@gmail.com>
@slachiewicz slachiewicz added the bug Something isn't working label Dec 29, 2025
@slachiewicz slachiewicz requested a review from elharo December 29, 2025 10:07

/**
* @param engineName optional engine name, used to override the engine selection from the file extension
* @param engineName optional engine name, used to override the engine selection from the file extension
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space not needed


/**
* @param engine the script engine
* @param engine the script engine
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove extra space

return engine.eval(reader, context);
try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(resourceName)) {

if (is == null) throw new ScriptException("Resource not found : " + resourceName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error: src/main/java/org/apache/maven/plugins/scripting/ResourceScriptEvaluator.java:[71,13] (blocks) NeedBraces: 'if' construct must use '{}'s.

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you signed the Apache CLA?

Signed-off-by: Avinash Niyas <avinashNiyaz1423@gmail.com>
@Avinash1423
Copy link
Author

Avinash1423 commented Dec 30, 2025

Have you signed the Apache CLA?

yes signed and emailed it; pls take a look now

try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(resourceName)) {

if (is == null) {
throw new ScriptException("Resource not found : " + resourceName);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no space before the colon

Copy link
Contributor

@elharo elharo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run 'mvn spotless:apply' to fix these violations.

Signed-off-by: Avinash Niyas <avinashNiyaz1423@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResourceScriptEvaluator NullPointerException

3 participants