sun.management.FileSystem Java Examples

The following examples show how to use sun.management.FileSystem. 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: AdaptorBootstrap.java    From jdk8u-dev-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #2
Source File: AdaptorBootstrap.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #3
Source File: AdaptorBootstrap.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #4
Source File: AdaptorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #5
Source File: AdaptorBootstrap.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #6
Source File: AdaptorBootstrap.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #7
Source File: AdaptorBootstrap.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #8
Source File: AdaptorBootstrap.java    From jdk8u_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #9
Source File: AdaptorBootstrap.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #10
Source File: AdaptorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #11
Source File: AdaptorBootstrap.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #12
Source File: AdaptorBootstrap.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
private static void checkAclFile(String aclFileName) {
    if (aclFileName == null || aclFileName.length()==0) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_SET);
    }
    final File file = new File(aclFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_FOUND, aclFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_NOT_READABLE, aclFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                throw new AgentConfigurationError(SNMP_ACL_FILE_ACCESS_NOT_RESTRICTED,
                    aclFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(SNMP_ACL_FILE_READ_FAILED, aclFileName);

    }
}
 
Example #13
Source File: ConnectorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #14
Source File: ConnectorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #15
Source File: ConnectorBootstrap.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #16
Source File: ConnectorBootstrap.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #17
Source File: ConnectorBootstrap.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #18
Source File: ConnectorBootstrap.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #19
Source File: ConnectorBootstrap.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #20
Source File: ConnectorBootstrap.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #21
Source File: ConnectorBootstrap.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #22
Source File: ConnectorBootstrap.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #23
Source File: ConnectorBootstrap.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #24
Source File: ConnectorBootstrap.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #25
Source File: ConnectorBootstrap.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #26
Source File: ConnectorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #27
Source File: ConnectorBootstrap.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #28
Source File: ConnectorBootstrap.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}
 
Example #29
Source File: ConnectorBootstrap.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private static void checkPasswordFile(String passwordFileName) {
    if (passwordFileName == null || passwordFileName.length() == 0) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_SET);
    }
    File file = new File(passwordFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_FOUND, passwordFileName);
    }

    if (!file.canRead()) {
        throw new AgentConfigurationError(PASSWORD_FILE_NOT_READABLE, passwordFileName);
    }

    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText("jmxremote.ConnectorBootstrap.password.readonly",
                        passwordFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(PASSWORD_FILE_ACCESS_NOT_RESTRICTED,
                        passwordFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(PASSWORD_FILE_READ_FAILED,
                e, passwordFileName);
    }
}
 
Example #30
Source File: ConnectorBootstrap.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private static void checkRestrictedFile(String restrictedFileName) {
    if (restrictedFileName == null || restrictedFileName.length() == 0) {
        throw new AgentConfigurationError(FILE_NOT_SET);
    }
    File file = new File(restrictedFileName);
    if (!file.exists()) {
        throw new AgentConfigurationError(FILE_NOT_FOUND, restrictedFileName);
    }
    if (!file.canRead()) {
        throw new AgentConfigurationError(FILE_NOT_READABLE, restrictedFileName);
    }
    FileSystem fs = FileSystem.open();
    try {
        if (fs.supportsFileSecurity(file)) {
            if (!fs.isAccessUserOnly(file)) {
                final String msg = Agent.getText(
                        "jmxremote.ConnectorBootstrap.file.readonly",
                        restrictedFileName);
                log.config("startRemoteConnectorServer", msg);
                throw new AgentConfigurationError(
                        FILE_ACCESS_NOT_RESTRICTED, restrictedFileName);
            }
        }
    } catch (IOException e) {
        throw new AgentConfigurationError(
                FILE_READ_FAILED, e, restrictedFileName);
    }
}