// Path: components/script-engine/org.jaggeryjs.scriptengine/src/main/java/org/jaggeryjs/scriptengine/exceptions/ScriptException.java
// public class ScriptException extends Exception {
// 
//     public ScriptException(String message) {
//         super(message);
//     }
// 
//     public ScriptException(Exception exception) {
//         super(exception);
//     }
// 
//     public ScriptException(String message, Exception exception) {
//         super(message, exception);
//     }
// }


import org.jaggeryjs.scriptengine.exceptions.ScriptException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.CodeSource;
import java.security.cert.Certificate;
package org.jaggeryjs.scriptengine.security;



public class RhinoURISecurityDomain implements RhinoSecurityDomain {

    private String scriptURI;
    private CodeSource codeSource = null;

    public RhinoURISecurityDomain(String scriptURI) {
        this.scriptURI = scriptURI;
    }

    public CodeSource getCodeSource() throws ScriptException {
        if(codeSource != null) {
            return codeSource;
        }
        try {
            URL url = new URI(scriptURI).toURL();
            codeSource = new CodeSource(url, (Certificate[])null);
            return codeSource;
        } catch (MalformedURLException e) {
// Path: components/script-engine/org.jaggeryjs.scriptengine/src/main/java/org/jaggeryjs/scriptengine/exceptions/ScriptException.java
// public class ScriptException extends Exception {
// 
//     public ScriptException(String message) {
//         super(message);
//     }
// 
//     public ScriptException(Exception exception) {
//         super(exception);
//     }
// 
//     public ScriptException(String message, Exception exception) {
//         super(message, exception);
//     }
// }


// Path: components/script-engine/org.jaggeryjs.scriptengine/src/main/java/org/jaggeryjs/scriptengine/security/RhinoURISecurityDomain.java
import org.jaggeryjs.scriptengine.exceptions.ScriptException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.security.CodeSource;
import java.security.cert.Certificate;

package org.jaggeryjs.scriptengine.security;



public class RhinoURISecurityDomain implements RhinoSecurityDomain {

    private String scriptURI;
    private CodeSource codeSource = null;

    public RhinoURISecurityDomain(String scriptURI) {
        this.scriptURI = scriptURI;
    }

    public CodeSource getCodeSource() throws ScriptException {
        if(codeSource != null) {
            return codeSource;
        }
        try {
            URL url = new URI(scriptURI).toURL();
            codeSource = new CodeSource(url, (Certificate[])null);
            return codeSource;
        } catch (MalformedURLException e) {
            throw new ScriptException(e);