Java Code Examples for sun.security.util.PropertyExpander#ExpandException

The following examples show how to use sun.security.util.PropertyExpander#ExpandException . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PolicyParser.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private Map<String, String> parseProperties(String terminator)
    throws ParsingException, IOException {

    Map<String, String> properties = new HashMap<>();
    String key;
    String value;
    while (!peek(terminator)) {
        key = match("property name");
        match("=");

        try {
            value = expand(match("quoted string"));
        } catch (PropertyExpander.ExpandException peee) {
            throw new IOException(peee.getLocalizedMessage());
        }
        properties.put(key.toLowerCase(Locale.ENGLISH), value);
    }

    return properties;
}
 
Example 2
Source File: ConfigFile.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private String expand(String value)
    throws PropertyExpander.ExpandException, IOException {

    if (value.isEmpty()) {
        return value;
    }

    if (!expandProp) {
        return value;
    }
    String s = PropertyExpander.expand(value);
    if (s == null || s.length() == 0) {
        throw ioException(
            "Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
            new Integer(linenum), value);
    }
    return s;
}
 
Example 3
Source File: PolicyParser.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private Map<String, String> parseProperties(String terminator)
    throws ParsingException, IOException {

    Map<String, String> properties = new HashMap<>();
    String key;
    String value;
    while (!peek(terminator)) {
        key = match("property name");
        match("=");

        try {
            value = expand(match("quoted string"));
        } catch (PropertyExpander.ExpandException peee) {
            throw new IOException(peee.getLocalizedMessage());
        }
        properties.put(key.toLowerCase(), value);
    }

    return properties;
}
 
Example 4
Source File: ConfigFile.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private String expand(String value)
    throws PropertyExpander.ExpandException, IOException {

    if (value.isEmpty()) {
        return value;
    }

    if (!expandProp) {
        return value;
    }
    String s = PropertyExpander.expand(value);
    if (s == null || s.length() == 0) {
        throw ioException(
            "Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
            linenum, value);
    }
    return s;
}
 
Example 5
Source File: ConfigFile.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private String expand(String value)
    throws PropertyExpander.ExpandException, IOException {

    if (value.isEmpty()) {
        return value;
    }

    if (!expandProp) {
        return value;
    }
    String s = PropertyExpander.expand(value);
    if (s == null || s.length() == 0) {
        throw ioException(
            "Configuration.Error.Line.line.system.property.value.expanded.to.empty.value",
            new Integer(linenum), value);
    }
    return s;
}
 
Example 6
Source File: PolicyParser.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * parse a Permission entry
 */
private PermissionEntry parsePermissionEntry()
    throws ParsingException, IOException, PropertyExpander.ExpandException
{
    PermissionEntry e = new PermissionEntry();

    // Permission
    match("Permission");
    e.permission = match("permission type");

    if (peek("\"")) {
        // Permission name
        e.name = expand(match("quoted string"));
    }

    if (!peek(",")) {
        return e;
    }
    match(",");

    if (peek("\"")) {
            e.action = expand(match("quoted string"));
            if (!peek(",")) {
                return e;
            }
            match(",");
    }

    if (peekAndMatch("SignedBy")) {
        e.signedBy = expand(match("quoted string"));
    }
    return e;
}
 
Example 7
Source File: PolicyParser.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * parse a Permission entry
 */
private PermissionEntry parsePermissionEntry()
    throws ParsingException, IOException, PropertyExpander.ExpandException
{
    PermissionEntry e = new PermissionEntry();

    // Permission
    match("Permission");
    e.permission = match("permission type");

    if (peek("\"")) {
        // Permission name
        e.name = expand(match("quoted string"));
    }

    if (!peek(",")) {
        return e;
    }
    match(",");

    if (peek("\"")) {
            e.action = expand(match("quoted string"));
            if (!peek(",")) {
                return e;
            }
            match(",");
    }

    if (peekAndMatch("SignedBy")) {
        e.signedBy = expand(match("quoted string"));
    }
    return e;
}
 
Example 8
Source File: PolicyParser.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public String getStorePassURL() {
    try {
        if (storePassURL!=null && storePassURL.length()!=0) {
            return expand(storePassURL, true).replace
                                            (File.separatorChar, '/');
        }
    } catch (PropertyExpander.ExpandException peee) {
        if (debug != null) {
            debug.println(peee.toString());
        }
        return null;
    }
    return null;
}
 
Example 9
Source File: PolicyParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * parse a Permission entry
 */
private PermissionEntry parsePermissionEntry()
    throws ParsingException, IOException, PropertyExpander.ExpandException
{
    PermissionEntry e = new PermissionEntry();

    // Permission
    match("Permission");
    e.permission = match("permission type");

    if (peek("\"")) {
        // Permission name
        e.name = expand(match("quoted string"));
    }

    if (!peek(",")) {
        return e;
    }
    match(",");

    if (peek("\"")) {
            e.action = expand(match("quoted string"));
            if (!peek(",")) {
                return e;
            }
            match(",");
    }

    if (peekAndMatch("SignedBy")) {
        e.signedBy = expand(match("quoted string"));
    }
    return e;
}
 
Example 10
Source File: PolicyParser.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * parse a Permission entry
 */
private PermissionEntry parsePermissionEntry()
    throws ParsingException, IOException, PropertyExpander.ExpandException
{
    PermissionEntry e = new PermissionEntry();

    // Permission
    match("Permission");
    e.permission = match("permission type");

    if (peek("\"")) {
        // Permission name
        e.name = expand(match("quoted string"));
    }

    if (!peek(",")) {
        return e;
    }
    match(",");

    if (peek("\"")) {
            e.action = expand(match("quoted string"));
            if (!peek(",")) {
                return e;
            }
            match(",");
    }

    if (peekAndMatch("SignedBy")) {
        e.signedBy = expand(match("quoted string"));
    }
    return e;
}
 
Example 11
Source File: PolicyParser.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the (possibly expanded) keystore location, or null if the
 * expansion fails.
 */
public String getKeyStoreUrl() {
    try {
        if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) {
            return expand(keyStoreUrlString, true).replace
                                            (File.separatorChar, '/');
        }
    } catch (PropertyExpander.ExpandException peee) {
        if (debug != null) {
            debug.println(peee.toString());
        }
        return null;
    }
    return null;
}
 
Example 12
Source File: PolicyParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * parse a Permission entry
 */
private PermissionEntry parsePermissionEntry()
    throws ParsingException, IOException, PropertyExpander.ExpandException
{
    PermissionEntry e = new PermissionEntry();

    // Permission
    match("Permission");
    e.permission = match("permission type");

    if (peek("\"")) {
        // Permission name
        e.name = expand(match("quoted string"));
    }

    if (!peek(",")) {
        return e;
    }
    match(",");

    if (peek("\"")) {
            e.action = expand(match("quoted string"));
            if (!peek(",")) {
                return e;
            }
            match(",");
    }

    if (peekAndMatch("SignedBy")) {
        e.signedBy = expand(match("quoted string"));
    }
    return e;
}
 
Example 13
Source File: PolicyParser.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the (possibly expanded) keystore location, or null if the
 * expansion fails.
 */
public String getKeyStoreUrl() {
    try {
        if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) {
            return expand(keyStoreUrlString, true).replace
                                            (File.separatorChar, '/');
        }
    } catch (PropertyExpander.ExpandException peee) {
        if (debug != null) {
            debug.println(peee.toString());
        }
        return null;
    }
    return null;
}
 
Example 14
Source File: PolicyParser.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the (possibly expanded) keystore location, or null if the
 * expansion fails.
 */
public String getKeyStoreUrl() {
    try {
        if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) {
            return expand(keyStoreUrlString, true).replace
                                            (File.separatorChar, '/');
        }
    } catch (PropertyExpander.ExpandException peee) {
        if (debug != null) {
            debug.println(peee.toString());
        }
        return null;
    }
    return null;
}
 
Example 15
Source File: PolicyParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * parse a Permission entry
 */
private PermissionEntry parsePermissionEntry()
    throws ParsingException, IOException, PropertyExpander.ExpandException
{
    PermissionEntry e = new PermissionEntry();

    // Permission
    match("Permission");
    e.permission = match("permission type");

    if (peek("\"")) {
        // Permission name
        e.name = expand(match("quoted string"));
    }

    if (!peek(",")) {
        return e;
    }
    match(",");

    if (peek("\"")) {
            e.action = expand(match("quoted string"));
            if (!peek(",")) {
                return e;
            }
            match(",");
    }

    if (peekAndMatch("SignedBy")) {
        e.signedBy = expand(match("quoted string"));
    }
    return e;
}
 
Example 16
Source File: PolicyParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the (possibly expanded) keystore location, or null if the
 * expansion fails.
 */
public String getKeyStoreUrl() {
    try {
        if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) {
            return expand(keyStoreUrlString, true).replace
                                            (File.separatorChar, '/');
        }
    } catch (PropertyExpander.ExpandException peee) {
        if (debug != null) {
            debug.println(peee.toString());
        }
        return null;
    }
    return null;
}
 
Example 17
Source File: PolicyParser.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns the (possibly expanded) keystore location, or null if the
 * expansion fails.
 */
public String getKeyStoreUrl() {
    try {
        if (keyStoreUrlString!=null && keyStoreUrlString.length()!=0) {
            return expand(keyStoreUrlString, true).replace
                                            (File.separatorChar, '/');
        }
    } catch (PropertyExpander.ExpandException peee) {
        if (debug != null) {
            debug.println(peee.toString());
        }
        return null;
    }
    return null;
}
 
Example 18
Source File: PolicyParser.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public String getStorePassURL() {
    try {
        if (storePassURL!=null && storePassURL.length()!=0) {
            return expand(storePassURL, true).replace
                                            (File.separatorChar, '/');
        }
    } catch (PropertyExpander.ExpandException peee) {
        if (debug != null) {
            debug.println(peee.toString());
        }
        return null;
    }
    return null;
}
 
Example 19
Source File: PolicyParser.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
private String expand(String value)
    throws PropertyExpander.ExpandException
{
    return expand(value, false);
}
 
Example 20
Source File: PolicyParser.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
private String expand(String value)
    throws PropertyExpander.ExpandException
{
    return expand(value, false);
}