private CodeSource createCodeSource ( ParsedPolicyEntry parsedEntry , KeyStore keystore ) throws Exception { String parsedCodebase = expandStringWithProperty ( parsedEntry . getCodebase ( ) ) ; String parsedCertificates = expandStringWithProperty ( parsedEntry . getSignedBy ( ) ) ; String [ ] splitCertificates = new String [ 0 ] ; if ( parsedCertificates != null ) { splitCertificates = parsedCertificates . split ( "," ) ; } if ( splitCertificates . length > 0 && keystore == null ) { throw new Exception ( "ER002: Keystore must be defined if signedBy is used" ) ; } List < Certificate > certList = new ArrayList < Certificate > ( ) ; for ( int i = 0 ; i < splitCertificates . length ; i ++ ) { Certificate certificate = keystore . getCertificate ( splitCertificates [ i ] ) ; if ( certificate != null ) { certList . add ( certificate ) ; } else { // return null to indicate that it never implies any permission return null ; } } Certificate [ ] certificates ; if ( certList . isEmpty ( ) ) { certificates = null ; } else { certificates = new Certificate [ certList . size ( ) ] ; certList . toArray ( certificates ) ; } URL url ; if ( parsedCodebase == null ) { url = null ; } else { url = new URL ( parsedCodebase ) ; } CodeSource cs = new CodeSource ( adaptURL ( url ) , certificates ) ; return cs ; }
Private method for creating new CodeSource object from ParsedEntry .