[
https://issues.apache.org/jira/browse/GROOVY-10958?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17696006#comment-17696006
]
ASF GitHub Bot commented on GROOVY-10958:
-----------------------------------------
codecov-commenter commented on PR #1871:
URL: https://github.com/apache/groovy/pull/1871#issuecomment-1452994444
#
[Codecov](https://codecov.io/gh/apache/groovy/pull/1871?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
Report
> Merging
[#1871](https://codecov.io/gh/apache/groovy/pull/1871?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
(4ebd115) into
[master](https://codecov.io/gh/apache/groovy/commit/8db3702c0bd840ca60a27a913a97eacb6a06e083?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
(8db3702) will **not change** coverage.
> The diff coverage is `75.0000%`.
[](https://codecov.io/gh/apache/groovy/pull/1871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
```diff
@@ Coverage Diff @@
## master #1871 +/- ##
=============================================
Coverage 68.0940% 68.0940%
- Complexity 28612 28613 +1
=============================================
Files 1427 1427
Lines 113126 113126
Branches 19341 19341
=============================================
Hits 77032 77032
Misses 29602 29602
Partials 6492 6492
```
| [Impacted
Files](https://codecov.io/gh/apache/groovy/pull/1871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
| Coverage Δ | |
|---|---|---|
|
[src/main/java/groovy/util/GroovyScriptEngine.java](https://codecov.io/gh/apache/groovy/pull/1871?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL21haW4vamF2YS9ncm9vdnkvdXRpbC9Hcm9vdnlTY3JpcHRFbmdpbmUuamF2YQ==)
| `84.0989% <75.0000%> (ø)` | |
> Confusing error message from GroovyScriptEngine
> -----------------------------------------------
>
> Key: GROOVY-10958
> URL: https://issues.apache.org/jira/browse/GROOVY-10958
> Project: Groovy
> Issue Type: Improvement
> Components: GroovyScriptEngine
> Affects Versions: 2.5.19, 3.0.15, 4.0.9
> Reporter: Charlie Hubbard
> Priority: Minor
>
> When the GroovyScriptEngine can't find a file or receives a Malformed URL it
> writes out a message like this:
> {code:java}
> groovy.util.ResourceException: Cannot open URL:
> file:/var/lib/jenkins/workspace/TheProject/web/src/main/webapp/WEB-INF/scripts/,
> DocumentETL.groovy
> {code}
> The confusing part is the ", " inserted between the path and the filename.
> The way it reads looks like there is an errant ", " in the full path sent to
> the URL. No wonder it can't find it. But, it turns out the exception
> processing logic is inserting that. Here is the exert from the code:
> {code:java}
> } catch (MalformedURLException e) {
> String message = "Malformed URL: " + root + ", " + resourceName;
> if (se == null) {
> se = new ResourceException(message);
> } else {
> se = new ResourceException(message, se);
> }
> } catch (IOException e1) {
> String message = "Cannot open URL: " + root + ", " + resourceName;
> groovyScriptConn = null;
> if (se == null) {
> se = new ResourceException(message);
> } else {
> se = new ResourceException(message, se);
> }
> }{code}
> This will cause people to go searching for some errant command-space
> throughout their code while debugging issues like this because we are
> normally conditioned to see the full path that the system is attempting to
> load. The phrase before insinuates the full URL is next. As opposed to a
> segmented version of it. The will cause people to overlook what is really
> the error because it's such an aberrant message.
> Using the `scriptUrl` in the message would make more sense when IOException
> was thrown:
> {code:java}
> String message = "Cannot open URL: " + scriptUrl;
> {code}
> For the malformed exception it might be tricky to reconstruct the full URL,
> but it should be made more clear like:
> {code:java}
> String message = "Malformed URL: with context=" + root + " and spec=" +
> resourceName + " because " + e.getMessage();{code}
> Some way to delimit the parts of the URL if you can't create the full context.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)