container/components/components/src/main/java/org/mobicents/slee/container/component/security/PolicyFileImpl.java
private boolean loadPolicy(String policyURLString, GlobalPolicyHolder newGlobalPolicyHolder) {

		// System.err.println("Load policy: " + policyURLString);
		try {
			URI policyURI = null;
			if (policyURLString.startsWith(_PROTOCOL_FILE)) {
				File policyFile = new File(policyURLString.replaceFirst(_PROTOCOL_FILE_PREFIX, ""));
				if (!policyFile.exists() || !policyFile.isFile() || !policyFile.canRead()) {
					if (logger.isDebugEnabled()) {
						logger.debug("Could not load file: " + policyURLString + ", exists[" + policyFile.exists() + "] isFile[" + policyFile.isFile() + "] canRead[" + policyFile.canRead() + "] ");

					}
					// Hmm...
					return false;

				} else {
					policyURI = policyFile.toURI().normalize();
				}
			} else {
				policyURI = new URI(policyURLString);
			}

			PolicyParser pp = new PolicyParser(true);
			InputStream is = getStream(policyURI);
			InputStreamReader reader = new InputStreamReader(is);
			pp.read(reader);
			reader.close();

			// KeyStore ks = ..... FIXME:
			KeyStore ks = null;

			Enumeration<PolicyParser.GrantEntry> grantEntries = pp.grantElements();
			while (grantEntries.hasMoreElements()) {

				parseGrantEntry(grantEntries.nextElement(), ks, newGlobalPolicyHolder);
			}

		} catch (Exception e) {

			if (logger.isDebugEnabled()) {
				logger.debug("Failed to read policy file due to some error.");
				e.printStackTrace();
			}
			return false;
		}

		return true;
	}
private boolean loadPolicy(String policyURLString, GlobalPolicyHolder newGlobalPolicyHolder) {

		// System.err.println("Load policy: " + policyURLString);
		try {
			URI policyURI = null;
			if (policyURLString.startsWith(_PROTOCOL_FILE)) {
				File policyFile = new File(policyURLString.replaceFirst(_PROTOCOL_FILE_PREFIX, ""));
				if (!policyFile.exists() || !policyFile.isFile() || !policyFile.canRead()) {
					if (logger.isDebugEnabled()) {
						logger.debug("Could not load file: " + policyURLString + ", exists[" + policyFile.exists() + "] isFile[" + policyFile.isFile() + "] canRead[" + policyFile.canRead() + "] ");

					}
					// Hmm...
					return false;

				} else {
					policyURI = policyFile.toURI().normalize();
				}
			} else {
				policyURI = new URI(policyURLString);
			}

			PolicyParser pp = new PolicyParser(true);
			InputStream is = getStream(policyURI);
			InputStreamReader reader = new InputStreamReader(is);
			pp.read(reader);
			reader.close();

			// KeyStore ks = ..... FIXME:
			KeyStore ks = null;

			Enumeration<PolicyParser.GrantEntry> grantEntries = pp.grantElements();
			while (grantEntries.hasMoreElements()) {

				parseGrantEntry(grantEntries.nextElement(), ks, newGlobalPolicyHolder);
			}

		} catch (Exception e) {

			if (logger.isDebugEnabled()) {
				logger.debug("Failed to read policy file due to some error.");
				e.printStackTrace();
			}
			return false;
		}

		return true;
	}
private boolean loadPolicy ( String policyURLString , GlobalPolicyHolder newGlobalPolicyHolder ) { // System.err.println("Load policy: " + policyURLString); try { URI policyURI = null ; if ( policyURLString . startsWith ( _PROTOCOL_FILE ) ) { File policyFile = new File ( policyURLString . replaceFirst ( _PROTOCOL_FILE_PREFIX , "" ) ) ; if ( ! policyFile . exists ( ) || ! policyFile . isFile ( ) || ! policyFile . canRead ( ) ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Could not load file: " + policyURLString + ", exists[" + policyFile . exists ( ) + "] isFile[" + policyFile . isFile ( ) + "] canRead[" + policyFile . canRead ( ) + "] " ) ; } // Hmm... return false ; } else { policyURI = policyFile . toURI ( ) . normalize ( ) ; } } else { policyURI = new URI ( policyURLString ) ; } PolicyParser pp = new PolicyParser ( true ) ; InputStream is = getStream ( policyURI ) ; InputStreamReader reader = new InputStreamReader ( is ) ; pp . read ( reader ) ; reader . close ( ) ; // KeyStore ks = ..... FIXME: KeyStore ks = null ; Enumeration < PolicyParser . GrantEntry > grantEntries = pp . grantElements ( ) ; while ( grantEntries . hasMoreElements ( ) ) { parseGrantEntry ( grantEntries . nextElement ( ) , ks , newGlobalPolicyHolder ) ; } } catch ( Exception e ) { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Failed to read policy file due to some error." ) ; e . printStackTrace ( ) ; } return false ; } return true ; }
newGlobalPolicyHolder) {
newGlobalPolicyHolder ) {