MCPcopy Index your code
hub / github.com/apache/groovy / getScriptSource

Method getScriptSource

src/main/java/groovy/ui/GroovyMain.java:502–513  ·  view source on GitHub ↗

Get a new GroovyCodeSource for a script which may be given as a location (isScript is true) or as text (isScript is false). @param isScriptFile indicates whether the script parameter is a location or content @param script the location or context of the script @return a new GroovyCodeSource fo

(boolean isScriptFile, String script)

Source from the content-addressed store, hash-verified

500 * @since 2.3.0
501 */
502 protected GroovyCodeSource getScriptSource(boolean isScriptFile, String script) throws IOException, URISyntaxException {
503 //check the script is currently valid before starting a server against the script
504 if (isScriptFile) {
505 // search for the file and if it exists don't try to use URIs ...
506 File scriptFile = huntForTheScriptFile(script);
507 if (!scriptFile.exists() && URI_PATTERN.matcher(script).matches()) {
508 return new GroovyCodeSource(new URI(script));
509 }
510 return new GroovyCodeSource(scriptFile);
511 }
512 return new GroovyCodeSource(script, "script_from_command_line", GroovyShell.DEFAULT_CODE_BASE);
513 }
514
515 // RFC2396
516 // scheme = alpha *( alpha | digit | "+" | "-" | "." )

Callers 3

processSocketsMethod · 0.95
processFilesMethod · 0.95
processOnceMethod · 0.95

Calls 3

huntForTheScriptFileMethod · 0.95
existsMethod · 0.65
matchesMethod · 0.65

Tested by

no test coverage detected