summaryrefslogtreecommitdiff
path: root/java/security
diff options
context:
space:
mode:
authorAndrew John Hughes <gnu_andrew@member.fsf.org>2015-03-11 21:16:43 +0000
committerAndrew John Hughes <gnu_andrew@member.fsf.org>2015-03-11 21:18:20 +0000
commit229a0915fbb027f0bbb4ce9b0981bc4cd2d5472e (patch)
treee6812d61e42be65c353c298931999cfc99e9561f /java/security
parenta09acb2a1f9dc481c980ab38e19f510581e43ea8 (diff)
downloadclasspath-229a0915fbb027f0bbb4ce9b0981bc4cd2d5472e.tar.gz
Cleanup the majority of the warnings in the gnu.java.security, java.security, javax.security and gnu.javax.security classes.
2015-03-11 Andrew John Hughes <gnu_andrew@member.fsf.org> * configure.ac: (ECJ_WARNINGS): Turn off parameter assignment, autoboxing and overridding without a super method call warnings for now. * gnu/java/security/OID.java: (OID(int[],boolean)): Remove unnecessary cast on clone() call. (getIDs()): Likewise. (getDER()): Likewise. (clone()): Add @Override. (toString()): Add @Override. Remove unncessary else clause. (hashCode()): Add @Override. (equals(Object)): Likewise. (compareTo(OID)): Likewise. * gnu/java/security/PolicyFile.java: (getPermissions(CodeSource)): Add @Override. (refresh()): Likewise and on anonymous inner class run() method. (toString()): Add @Override. (parse(URL)): Throw exception if p is null, and suppress associated warning, as exception is thrown via error method. Add default empty case to switch method. Call error method with the exception, not the result of its toString() method. Remove unneeded else block. (expand(String)): Avoid shadowing the prop variable. (error(URL,StreamTokenizer,Throwable)): Add new variant that allows the cause to be included. * gnu/java/security/Properties.java: (init()): Avoid unnecessary casts. (handleBooleanProperty(String)): Make static. * gnu/java/security/action/GetPropertyAction.java: (run()): Add @Override. * gnu/java/security/action/GetSecurityPropertyAction.java: (run()): Add @Override. * gnu/java/security/ber/BERReader.java: (read()): Add @Override. Remove unnecessary else clause. * gnu/java/security/ber/BERValue.java: (getLength()): Add @Override. * gnu/java/security/der/BitString.java: (toByteArray()): Remove unnecessary cast on clone() call. (getShiftedByteArray()): Likewise. (toBooleanArray()): Likewise. (clone(): Add @Override. (hashCode()): Likewise. (equals(Object)): Likewise. (toString()): Likewise. * gnu/java/security/der/DERReader.java: (makeTime(int,byte[])): Make static. Mark fall-through cases in switch statement. Add default case which throws an exception. * gnu/java/security/der/DERValue.java: (DERValue(int,int,Object,byte[])): Remove unnecessary cast on clone() call. (getValueAs(int)): Avoid shadowing of encoded variable. (getEncoded()): Remove unnecessary cast on clone() call. (toString()): Add @Override. * gnu/java/security/hash/BaseHash.java: (name()): Add @Override. (hashSize()): Likewise. (blockSize()): Likewise. (update(byte)): Likewise. (update(byte[])): Likewise. (update(byte[],int,int)): Likewise. (digest()): Likewise. (reset()): Likewise. (clone()): Likewise. (selfTest()): Likewise. * gnu/java/security/hash/Haval.java: (Haval(Haval)): Remove unnecessary cast on clone() call. (clone()): Add @Override. (transform(byte[],int)): Likewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest()): Likewise. (tailorDigestBits()): Add empty default case to switch statement. (FF5(int,int,int,int,int,int,int,int,int,int)): Make static. (f1(int,int,int,int,int,int,int)): Likewise. (f2(int,int,int,int,int,int,int)): Likewise. (f3(int,int,int,int,int,int,int)): Likewise. (f4(int,int,int,int,int,int,int)): Likewise. (f5(int,int,int,int,int,int,int)): Likewise. * gnu/java/security/hash/MD2.java: (MD2(MD2)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. (padBuffer()): Likewise. (transform(byte[],int)): LIkewise. * gnu/java/security/hash/MD4.java: (MD4(MD4)): Remove unncessary casts on clone() call. (clone()): Add @Override. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. Avoid shadowing d variable. (padBuffer()): Likewise. (transform(byte[],int)): LIkewise. * gnu/java/security/hash/MD5.java: (MD5(MD5)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/hash/RipeMD128.java: (RipeMD128(RipeMD128)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/hash/RipeMD160.java: (RipeMD160(RipeMD160)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/hash/Sha160.java: (Sha160(Sha160)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/hash/Sha256.java: (Sha256(Sha256)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/hash/Sha384.java: (Sha384(Sha384)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/hash/Sha512.java: (Sha512(Sha512)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/hash/Tiger.java: (Tiger(Tiger)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (selfTest())): Likewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (transform(byte[],int)): LIkewise. * gnu/java/security/hash/Whirlpool.java, (Whirlpool(Whirlpool)): Remove unnecessary casts on clone() call. (clone()): Add @Override. (transform(byte[],int)): LIkewise. (padBuffer()): Likewise. (getResult()): Likewise. (resetContext()): Likewise. (selfTest())): Likewise. * gnu/java/security/jce/hash/MessageDigestAdapter.java: (clone()): Add @Override. (engineGetDigestLength()): Likewise. (engineUpdate(byte)): Likewise. (engineUpdate(byte[],int,int)): Likewise. (engineDigest()): Likewise. (engineDigest(byte[],int,int)): Likewise. (engineReset()): Likewise. * gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java: (initialize(int,SecureRandom)): Add @Override. (initialize(AlgorithmParameterSpec,SecureRandom)): Likewise. * gnu/java/security/jce/sig/DSSParametersGenerator.java: (engineInit(int,SecureRandom)): Add @Override. (engineInit(AlgorithmParameterSpec,SecureRandom)): Likewise. (engineGenerateParameters()): Likewise. * gnu/java/security/jce/sig/EncodedKeyFactory.java: (decodeDSSPublicKey(DSAPublicKeySpec)): Make static. (decodeRSAPublicKey(RSAPublicKeySpec)): Likewise. (decodeDHPublicKey(DHPublicKeySpec)): Likewise. (decodeDHPublicKey(byte[]]): Likewise. (decodeDSSPrivateKey(DSAPrivateKeySpec)): Likewise. (decodeRSAPrivateKey(RSAPrivateCrtKeySpec)): Likewise. (decodeDHPrivateKey(DHPrivateKeySpec)): Likewise. (decodeDHPrivateKey(byte[])): Likewise. * gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java: (initialize(int,SecureRandom)): Add Override. (initialize(AlgorithmParameterSpec,SecureRandom)): Likewise. (generateKeyPair()): Likewise. (localiseName(String)): Uncomment conversion. * gnu/java/security/jce/sig/RSAKeyPairGeneratorSpi.java: (initialize(int,SecureRandom)): Add Override. (initialize(AlgorithmParameterSpec,SecureRandom)): Likewise. * gnu/java/security/jce/sig/SignatureAdapter.java: Drop unneeded import of BaseSignature. (clone()): Add @Override. (engineInitVerify(PublicKey)): Reference VERIFIER_KEY via interface ISignature where it is defined. (engineInitSign(PrivateKey)): Likewise for SIGNER_KEY. (engineInitSign(PrivateKey,SecureRandom)): Likewise for SIGNER_KEY and SOURCE_OF_RANDOMNESS. * gnu/java/security/key/KeyPairCodecFactory.java: (getInstance(String,int)): Add default case which returns null. (getInstance(Key)): Likewise and fix typo in documentation. * gnu/java/security/key/dss/DSSKey.java: (getParams()): Add @Override. (getAlgorithm()): Likewise. (getEncoded()): Likewise. (getFormat()): LIkewise. (equals(Object)): Likewise. (hashCode()): Add implementation using java.util.Objects.hash (toString()): Remove unneeded cast. * gnu/java/security/key/dss/DSSKeyPairGenerator.java: (setup(MAp)): Remove unnecessary else clause. (generate()): Remove left-over debug statement. * gnu/java/security/key/dss/DSSKeyPairRawCodec.java: (getFormatID()): Add @Override. (encodePublicKey(PublicKey)): Likewise. (decodePublicKey(byte[])): Likewise. (encodePrivateKey(PrivateKey)): Likewise. (decodePrivateKey(byte[])): Likewise. * gnu/java/security/key/dss/DSSKeyPairX509Codec.java: (getFormatID()): Add @Override. (encodePublicKey(PublicKey)): Likewise. (encodePrivateKey(PrivateKey)): Likewise. (decodePublicKey(byte[])): Likewise. (decodePrivateKey(byte[])): Likewise. * gnu/java/security/key/dss/DSSPrivateKey.java: Drop unneeded reference to PrivateKey. (getX()): Add @Override. (getEncoded(int)): Likewise. (equals(Object)): Likewise. (hashCode()): Implemented. (toString()): Add @Override and remove unneeded cast. * gnu/java/security/key/dss/DSSPublicKey.java: Drop unneeded reference to PublicKey. (getY()): Add @Override. (getEncoded(int)): Likewise. (equals(Object)): Likewise. (hashCode()): Implemented. (toString()): Add @Override and remove unneeded cast. * gnu/java/security/key/rsa/GnuRSAKey.java: (getModulus()): Add @Override. (getAlgorithm()): Likewise. (getEncoded()): Likewise. (getFormat()): Likewise. (equals(Object)): Likewise. (hashCode()): Implemented using java.util.Objects.hash (toString()): Add @Override and remove unneeded cast. * gnu/java/security/key/rsa/GnuRSAPrivateKey.java: Drop unneeded reference to PrivateKey. (getPrimeP()): Add @Override. (getPrimeQ()): Likewise. (getPrimeExponentP()): Likewise. (getPrimeExponentQ()): Likewise. (getCrtCoefficient()): Likewise. (getPrivateExponent()): Likewise. (getEncoded(int)): Likewise. (equals(Object)): Likewise. (hashCode()): Implemented using java.util.Objects.hash. (toString()): Add @Override and remove unneeded cast. * gnu/java/security/key/rsa/GnuRSAPublicKey.java: Drop unneeded reference to PublicKey. (getEncoded()): Add @Override. (equals(Object)): Likewise. (hashCode()): Implemented. (toString()): Add @Override and remove unneeded cast. * gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java: (getFormatID()): Add @Override. (encodePublicKey(PublicKey)): Likewise. (encodePrivateKey(PrivateKey)): Likewise. (decodePublicKey(byte[])): Likewise. (decodePrivateKey(byte[])): Likewise. * gnu/java/security/key/rsa/RSAKeyPairRawCodec.java: (getFormatID()): Add @Override. (encodePublicKey(PublicKey)): Likewise. (decodePublicKey(byte[])): Likewise. (encodePrivateKey(PrivateKey)): Likewise. (decodePrivateKey(byte[])): Likewise. * gnu/java/security/pkcs/PKCS7SignedData.java: (PKCS7SignedData(BERReader)): Refer to constants by the interface where they are defined. Rename crls to avoid shadowing the class variable. * gnu/java/security/pkcs/SignerInfo.java: (SignerInfo(BERReader)): Refer to constants by the interface where they are defined. * gnu/java/security/prng/BasePRNG.java: (addRandomBytes(byte[])): Add @Override. (addRandomBytes(byte[],int,int)): Likewise. Rename buffer to buf to avoid shadowing. (clone()): Remove unnecessary cast and this references. * gnu/java/security/prng/MDGenerator.java: Remove unneeded reference to Cloneable. * gnu/java/security/prng/RandomEvent.java: (RandomEvent(Object,byte,byte,byte[])): Remove unnecessary cast. * gnu/java/security/provider/DefaultPolicy.java: (getPermissions(CodeSource)): Add @Override. (refresh()): Likewise. * gnu/java/security/provider/Gnu.java: (Gnu()): Add @Override to run implementation in anonymous inner class. * gnu/java/security/provider/PKIXCertPathValidatorImpl.java: (engineValidate(CertPath,CertPathParameters)): Add @Override. Remove unneeded cast and else clause. (checkExplicitPolicy(int,List)): Make static. * gnu/java/security/provider/X509CertificateFactory.java: (generateCert(InputStream)): Make static. Remove unnecessary else clause. (generateCRL(InputStream)): Likewise. * gnu/java/security/sig/SignatureCodecFactory.java: (getInstance(String,int)): Add default case to switch statement. * gnu/java/security/sig/dss/DSSSignature.java: (encodeSignature(BigInteger,BigInteger)): Make static. (decodeSignature(Object)): Likewise. * gnu/java/security/sig/dss/DSSSignatureRawCodec.java: (getFormatID()): Add @Override. (encodeSignature(Object)): Likewise. (decodeSignature(byte[])): Likewise. * gnu/java/security/sig/dss/DSSSignatureX509Codec.java: (getFormatID()): Add @Override. (encodeSignature(Object)): Likewise. (decodeSignature(byte[])): Likewise. * gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java: (clone()): Add @Override. * gnu/java/security/sig/rsa/EMSA_PSS.java: (clone()): Add @Override. * gnu/java/security/sig/rsa/RSA.java: (RSADP(RSAPrivateKey, BigInteger)): Suppress null warning as r is always non-null if rsaBlinding is true. * gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java: (clone()): Add @Override. (setupForVerification(PublicKey)): Likewise. (setupForSigning(PrivateKey)): Likewise. (generateSignature()): Likewise. (verifySignature(Object)): Likewise. * gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java: (getFormatID()): Add @Override. (encodeSignature(Object)): Likewise. (decodeSignature(byte[])): Likewise. * gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java: (getFormatID()): Add @Override. (encodeSignature(Object)): Likewise. (decodeSignature(byte[])): Likewise. * gnu/java/security/sig/rsa/RSAPSSSignature.java: (clone()): Add @Override. (setupForVerification(PublicKey)): Likewise. Remove unnecessary cast. (setupForSigning(PrivateKey)): Likewise. (generateSignature()): Add @Override. (verifySignature(Object)): Likewise. * gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java: (getFormatID()): Add @Override. (encodeSignature(Object)): Likewise. (decodeSignature(byte[])): Likewise. * gnu/java/security/util/ByteArray.java: (toString()): Add @Override. * gnu/java/security/util/ByteBufferOutputStream.java: (toString()): Add @Override. * gnu/java/security/util/ExpirableObject.java: (destroy()): Add @Override. (Destroyer.run()): Likewise. * gnu/java/security/util/FormatUtil.java: (getEncodingName(int)): Add default case for switch statement. (getEncodingShortName(int)): Likewise. * gnu/java/security/util/Sequence.java: (size()): Add @Override. (toArray()): Likewise. Remove unnecessary cast. * gnu/java/security/util/SimpleList.java: (size()): Add @Override. (get(int)): Likewise. (toString()): Likewise. * gnu/java/security/util/Util.java: (toBase64(byte[])): Add default case to switch statement which does nothing. Remove unnecessary else clause. * gnu/java/security/x509/PolicyNodeImpl.java: (addExpectedPolicy(String)): Rename variable to expectedPolicy to avoid shadowing policy variable. (addAllPolicyQualifiers(Collection)): Rename variable to policyQualifiers to avoid shadowing qualifiers variable. Rewrite collection check to catch ClassCastException as, if it.next() returns normally, it will always be an instance of PolicyQualifierInfo. (toString()): Add @Override. * gnu/java/security/x509/X500DistinguishedName.java: (X500DistinguishedName(String)): Throw IOException rather than catching it as calling methods in X509CRLSelector implementations, addIssuerName(String), expect an IOException to be thrown if there is a parsing error. (getName()): Add @Override. (hashCode()): Likewise. (equals(Object)): Likewise. (toString()): Likewise. (getDer()): Remove unnecessary casts. (readAttributeType(Reader)): Make static. * gnu/java/security/x509/X509CRL.java: (equals(Object)): Add @Override. (hashCode()): Likewise. (getEncoded()): Remove unnecessary cast. (getIssuerX500Principal()): Add @Override. (getTBSCertList()): Remove unnecessary cast. (getSignature()): Likewise. (getSigAlgParams()): Likewise. (hasUnsupportedCriticalExtension()): Add @Override. (getCriticialExtensionOIDs()): Likewise. (getNonCriticalExtensionOIDs()): Likewise. (getExtensionValue(String)): Likewise. (isRevoked(Certificate)): Likewise. Remove unnecessary cast. (parse(InputStream)): Remove unnecessary cast. * gnu/java/security/x509/X509CRLEntry.java: (getEncoded()): Remove unncessary cast. (hasUnsupportedCriticalExtension()): Add @Override. (getCriticialExtensionOIDs()): Likewise. (getNonCriticalExtensionOIDs()): Likewise. (getExtensionValue(String)): Likewise. * gnu/java/security/x509/X509CRLSelectorImpl.java: (addIssuerName(String)): Throw IOException as specified. * gnu/java/security/x509/X509CertPath.java: (getCertificates()): Add @Override. (getEncoded()): Likewise. Remove unnecessary casts. (getEncodings()): Add @Override. (parse(InputStream, String)): Rename path to parsedPath to avoid shadowing. * gnu/java/security/x509/X509CertSelectorImpl.java: (addIssuerName(String)): Throw IOException as specified. * gnu/java/security/x509/X509Certificate.java: Remove unneeded Serializable reference. (checkValidity()): Add @Override. (checkValidity(Date)): Likewise. (getVersion()): Likewise. (getSerialNumber()): Likewise. (getIssuerDN()): Likewise. (getIssuerX500Principal()): Likewise. (getSubjectDN()): Likewise. (getSubjectX500Principal()): Likewise. (getNotBefore()): Likewise. (getNotAfter()): Likewise. (getTBSCertificate()): Likewise. Remove unnecessary cast. (getSignature()): Likewise. (getSigAlgName()): Add @Override. (getSigAlgOID()): Likewise. (getSigAlgParams()): Likewise. Remove unnecessary cast. (getIssuerUniqueID()): Add @Override. (getSubjectUniqueID()): Likewise. (getKeyUsage()): Likewise. (getExtendedKeyUsage()): Likewise. (getBasicConstraints()): Likewise. (getSubjectAlternativeNames()): Likewise. Make conversion from int to Integer explicit. (getIssuerAlternativeNames()): Likewise. (hasUnsupportedCriticalExtension()): Add @Override. (getCriticialExtensionOIDs()): Likewise. (getNonCriticalExtensionOIDs()): Likewise. (getExtensionValue(String)): Likewise. (getEncoded()): Likewise. Remove unnecessary cast. (verify(PublicKey)): Add @Override. (verify(PublicKey, String)): Likewise. (toString()): Likewise. (getPublicKey()): Likewise. (parse(InputStream)): Rename encoded to enc to avoid shadowing. Avoid unnecessary cast. * gnu/java/security/x509/ext/AuthorityKeyIdentifier.java: (toString()): Add @Override. * gnu/java/security/x509/ext/BasicConstraints.java: (getEncoded()): Add @Override. Remove unncessary casts. (toString()): Add @Override. * gnu/java/security/x509/ext/CRLNumber.java: (getEncoded()): Add @Override. Remove unncessary casts. (toString()): Add @Override. * gnu/java/security/x509/ext/CertificatePolicies.java: (CertificatePolicies(List,Map)): Swap empty for-loop for a while loop. (getEncoded()): Add @Override. Remove unnecessary cast. (toString()): Add @Override. * gnu/java/security/x509/ext/ExtendedKeyUsage.java: (toString()): Add @Override. * gnu/java/security/x509/ext/Extension.java: (Extension(byte[])): Remove unnecessary cast. (getEncoded()): Likewise. (toString()): Add @Override. (Value.Value(byte[])): Remove unnecessary cast. (Value.getEncoded()): Likewise. (hashCode()): Add @Override. (equals(Object)): Likewise. (toString()): Likewise. * gnu/java/security/x509/ext/GeneralName.java: (Kind.forTag(int)): Add default case. (Kind): Remove unnecessary ; on closing brace. (GeneralName(Kind,byte[])): Remove unnecessary cast. (name()): Likewise. (encoded()): Check for null rather than catching exception. Remove unnecessary cast. (equals(Object)): Add @Override. Avoid unnecessary method call. (hashCode()): Implemented using java.util.Objects.hash. (toString()): Add @Override. * gnu/java/security/x509/ext/GeneralNames.java: (toString()): Add @Override. * gnu/java/security/x509/ext/GeneralSubtree.java: (toString()): Add @Override. * gnu/java/security/x509/ext/IssuerAlternativeNames.java: (toString()): Add @Override. * gnu/java/security/x509/ext/KeyUsage.java: (toString()): Add @Override. * gnu/java/security/x509/ext/NameConstraints.java: (toString()): Add @Override. * gnu/java/security/x509/ext/PolicyConstraint.java: (toString()): Add @Override. * gnu/java/security/x509/ext/PolicyMappings.java: (toString()): Add @Override. * gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java: (toString()): Add @Override. * gnu/java/security/x509/ext/ReasonCode.java: (toString()): Add @Override. * gnu/java/security/x509/ext/SubjectAlternativeNames.java: (toString()): Add @Override. * gnu/java/security/x509/ext/SubjectKeyIdentifier.java: (getKeyIdentifier()): Remove unnecessary cast. (toString()): Add @Override. * gnu/javax/security/auth/Password.java: (doDestroy): Add @Override. Remove unneeded else block. (isDestroyed): Add @Override. * gnu/javax/security/auth/callback/AWTCallbackHandler.java: (handleChoice(ChoiceCallback)): Add @Override. (handleConfirmation(ConfirmationCallback)): Likewise. (handleLanguage(LanguageCallback)): Likewise. (handleName(NameCallback)): Likewise. (handlePassword(PasswordCallback)): Likewise. (handleTextInput(TextInputCallback)): Likewise. (handleTextOutput(TextOutputCallback)): Likewise. (actionPerformed(ActionEvent)): Likewise. (windowClosing(WindowEvent)): Likewise. (windowOpened(WindowEvent)): Likewise. (windowClosed(WindowEvent)): Likewise. (windowIconified(WindowEvent)): Likewise. (windowDeiconified(WindowEvent)): Likewise. (windowActivated(WindowEvent)): Likewise. (windowDeactivated(WindowEvent)): Likewise. * gnu/javax/security/auth/callback/AbstractCallbackHandler.java: (AbstractCallbackHandler(String)): Reference getBundle by class where it is implemented (ResourceBundle). (handle(Callback[])): Add @Override. (handleChoice(ChoiceCallback)): Allow and document an UnsupportedCallbackException being thrown. (handleConfirmation(ConfirmationCallback)): Likewise. (handleLanguage(LanguageCallback)): Likewise. (handleName(NameCallback)): Likewise. (handlePassword(PasswordCallback)): Likewise. (handleTextInput(TextInputCallback)): Likewise. (handleTextOutput(TextOutputCallback)): Likewise. (handleOther(Callback)): Suppress warnings resulting from unused variables, unthrown exceptions and lack of IOException being thrown. They are necessary for subclasses. * gnu/javax/security/auth/callback/ConsoleCallbackHandler.java: (handleChoice(ChoiceCallback)): Add @Override. Drop unnecessary cast. (handleConfirmation(ConfirmationCallback)): Add @Override. (handleLanguage(LanguageCallback)): Likewise. (handleName(NameCallback)): Likewise. (handlePassword(PasswordCallback)): Likewise. (handleTextInput(TextInputCallback)): Likewise. (handleTextOutput(TextOutputCallback)): Likewise. * gnu/javax/security/auth/callback/DefaultCallbackHandler.java: (handleChoice(ChoiceCallback)): Add @Override. (handleConfirmation(ConfirmationCallback)): Likewise. (handleLanguage(LanguageCallback)): Likewise. (handleName(NameCallback)): Likewise. (handlePassword(PasswordCallback)): Likewise. (handleTextInput(TextInputCallback)): Likewise. (handleTextOutput(TextOutputCallback)): Likewise. * gnu/javax/security/auth/callback/GnuCallbacks.java: (GnuCallbacks()): Add @Override to run() implementation in anonymous inner class. * gnu/javax/security/auth/callback/SwingCallbackHandler.java: (handleChoice(ChoiceCallback)): Add @Override to method and methods of anonymous inner classes. Refer to constants using interface where they appear. (handleConfirmation(ConfirmationCallback)): Add @Override to method and methods of anonymous inner class. Declare UnsupportedCallbackException as thrown and add default cases and fall-through markers to switch statements. (handleLanguage(LanguageCallback)): Add @Override. Remove unused variable defaultIndex. (handleName(NameCallback)): Add @Override to method and method of anonymous inner class. (handlePassword(PasswordCallback)): Likewise. (handleTextInput(TextInputCallback)): Likewise. Refer to constants using interface where they appear. (handleTextOutput(TextOutputCallback)): Likewise. Declare UnsupportedCallbackException as thrown and add default case to switch statement. (waitForInput(JDialog, Callback)): Make static. * gnu/javax/security/auth/login/ConfigFileParser.java: (initParser(Reader)): Don't declare IOException as thrown as one is never thrown. (expandParamValue(String)): Make static. * gnu/javax/security/auth/login/GnuConfiguration.java: (getAppConfigurationEntry(String)): Add @Override. (refresh()): Likewise. (getInputStreamFromURL(String)): Make static. (parseConfig(InputStream)): Remove unneeded variable. (getUserName()): Make static. (getConfigFromUserName(File,String)): Likewise. * java/security/AccessControlContext.java: (equals(Object)): Add @Override. (hashCode()): Likewise. * java/security/AlgorithmParameters.java: (toString()): Add @Override. * java/security/AllPermission.java: (AllPermission(String,String)): Suppress warning about actions variable being unused. (implies(Permission)): Add @Override. (equals(Object)): Likewise. (hashCode()): Likewise. (getActions()): Likewise. (newPermissionCollection()): Likewise. (AllPermissionCollection()): Add public constructor to avoid generating a synthetic accessor method. * java/security/BasicPermission.java: Remove unneeded Serializable reference. (BasicPermission(String,String)): Suppress warnings about actions variable being unused. (getActions()): Add @Override. (newPermissionCollection()): Likewise. * java/security/Certificate.java: Mark with @Deprecated. Fix typo in documentation. * java/security/DigestInputStream.java: (read()): Add @Override. (read(byte[],int,int)): Likewise. (toString()): Likewise. * java/security/DigestOutputStream.java: (write(int)): Add @Override. (write(byte[],int,int)): Likewise. (toString()): Likewise. * java/security/DummyKeyPairGenerator.java: (clone()): Add @Override. (initialize(int,SecureRandom)): Likewise. (initialize(AlgorithmParameterSpec,SecureRandom)): Likewise. (generateKeyPair()): Likewise. * java/security/DummyMessageDigest.java: (clone()): Add @Override. (engineDigest()): Likewise. (engineDigest(byte[],int,int)): Likewise. (engineGetDigestLength()): Likewise. (engineReset()): Likewise. (engineUpdate(byte)): Likewise. (engineUpdate(byte[],int,int)): Likewise. * java/security/Identity.java: Mark as @Deprecated. Fix typo in documentation. (getName()): Add @Override. (equals(Object)): Likewise. (toString()): Likewise. (toString(boolean)): Remove unnecessary else clause. (hashCode()): Add @Override. * java/security/IdentityScope.java: Mark as @Deprecated. (toString()): Add @Override. * java/security/IntersectingDomainCombiner.java: (combine(ProtectionDomain[],ProtectionDomain[])): Add @Override. * java/security/KeyPairGenerator.java: (generateKeyPair()): Add @Override. * java/security/KeyPairGeneratorSpi.java: (initialize(AlgorithmParameterSpec,SecureRandom)): Suppress warning about making this method static. Intended to be overridden by subclasses. (clone()): Add @Override. * java/security/KeyStore.java: (getInstance(String,Provider)): Fix typo in documentation. (getDefaultType()): Add @Override to run() in anonymous inner class. * java/security/MessageDigest.java: (toString()): Add @Override. (clone()): Likewise. * java/security/MessageDigestSpi.java: (engineGetDigestLength()): Suppress warning about making this method static. Intended to be overridden by subclasses. (clone()): Add @Override. * java/security/Permission.java: (checkGuard(Object)): Add @Override. (equals(Object)): Likewise. (hashCode()): Likewise. (newPermissionCollection()): Likewise. (toString()): Likewise. * java/security/PermissionCollection.java: (toString()): Add @Override. * java/security/Permissions.java: Remove unneeded Serializable reference. (elements()): Add @Override to hasMoreElements and nextElement methods in anonymous inner class. (PermissionsHash.PermissionsHash()): Add explicit constructor to avoid a synthetic accessor method. (add(Permission)): Mark synchronized. (implies(Permission)): Likewise. * java/security/Policy.java: (implies(ProtectionDomain,Permission)): Remove unnecessary cast. * java/security/Principal.java: (equals(Object)): Add @Override. (toString()): Likewise. (hashCode()): Likewise. * java/security/PrivilegedActionException.java: (getCause()): Add @Override. (toString()): Removed; pointless as it just calls superclass version. * java/security/ProtectionDomain.java: (ProtectionDomain(CodeSource,PermissionCollection, ClassLoader,Principal[],boolean)): Remove unnecessary cast. (getPrincipals()): Add @Override. (toString()): Likewise. * java/security/Provider.java: Remove unneeded Serializable reference. (put(Object,Object)): Add @Override. Suppress warnings about overridding a synchronized method as all collection modifications are made in synchronized superclass method. (get(Object)): Likewise. (remove(Object)): Likewise. (clear()): Likewise. (toString()): Add @Override. Suppress warning about overridding a synchronized method as the collection isn't used. (toCanonicalKey(Object)): Make static. * java/security/SecureClassLoader.java: (getPermissions(CodeSource)): Suppress warning about making this method static; may potentially be overridden by subclasses. Avoid unnecessary variable policy. * java/security/SecureRandom.java: (setSeed(byte[])): Make synchronized to prevent concurrent access to secureRandomSpi. (setSeed(long)): Add @Override and make synchronized. (nextBytes(byte[])): Likewise. (next(int)): Likewise. (generateSeed(byte[])): Make synchronized. * java/security/Security.java: (getAlgorithmProperty(String,String)): Add @Deprecated. (getProvider(String)): Remove unnecessary else clause. (getAlgorithm(String)): Use provs instead of providers to avoid shadowing class variable. (provides(Provider,String,String,String,String)): Set serviceDotAlgorithm to the empty string to avoid null pointer issues. * java/security/SecurityPermission.java: (SecurityPermission(String,String)): Suppress warning due to nothing being done with actions. * java/security/Signature.java: (sign()): Remove unnecessary else clause. (sign(byte[],int,int)): Likewise. (verify(byte[])): Likewise. (toString()): Mark @Override. (setParameter(String,Object)): Add @Deprecated. (getParameter(String)): Likewise. (clone()): Add @Override. * java/security/SignatureSpi.java: (engineSetParameter(String,Object)): Add @Deprecated. (engineSetParameter(AlgorithmParameterSpec)): Suppress warnings about unused variables, unthrown exceptions and ability to be a static method. Subclasses override this. (engineGetParameters()): Suppress warnings about making this method static. (engineGetParameter(String)): Add @Deprecated. * java/security/SignedObject.java: (getSignature()): Remove unnecessary cast. (readObject(ObjectInputStream)): Likewise x 2. * java/security/Signer.java: Mark as @Deprecated. (toString()): Add @Override. * java/security/UnresolvedPermission.java: (getUnresolvedCerts()): Remove unnecessaary cast. (UnresolvedPermissionCollection.elements()): Add @Override to hasMoreElements and nextElement. * java/security/acl/Acl.java: (toString()): Add @Override. * java/security/acl/AclEntry.java: (setPrincipal(Principal)): Fix formatting of documentation. (addPermission(Permission)): Likewise. (removePermission(Permission)): Likewise. (checkPermission(Permission)): Likewise. (toString()): Add @Override. * java/security/acl/Permission.java: (equals(Object)): Add @Override. (toString()): Likewise. * java/security/cert/CRL.java: (toString()): Add @Override. * java/security/cert/CertPath.java: (equals(Object)): Add @Override. (hashCode()): Likewise. (toString()): Likewise. * java/security/cert/CertPathBuilderException.java: (CertPathBuilderException(Throwable)): Just call superclass constructor. (CertPathBuilderException(String,Throwable)): Likewise. (getMessage()): Removed; provided by superclass. (getCause()): Likewise. (toString()): Likewise. (printStackTrace()): Likewise. (printStackTrace(PrintStream)): Likewise. (printStackTrace(PrintWriter)): Likewise. * java/security/cert/CertPathValidatorException.java: (CertPathValidatorException(String,Throwable)): Just call superclass with both arguments, rather than initCause. (getMessage()): Removed; provided by superclass. (getCause()): Likewise. (toString()): Likewise. (printStackTrace()): Likewise. (printStackTrace(PrintStream)): Likewise. (printStackTrace(PrintWriter)): Likewise. * java/security/cert/CertStoreException.java: (CertStoreException(Throwable)): Just call superclass constructor. (CertStoreException(String,Throwable)): Likewise. (getMessage()): Removed; provided by superclass. (getCause()): Likewise. (toString()): Likewise. (printStackTrace()): Likewise. (printStackTrace(PrintStream)): Likewise. (printStackTrace(PrintWriter)): Likewise. * java/security/cert/CertStoreSpi.java: (CertStoreSpi(CertStoreParameters)): Suppress warnings about exception not being thrown. Present for subclasses. * java/security/cert/Certificate.java: (equals(Object)): Add @Override. (hashCode()): Likewise. (toString()): Likewise. * java/security/cert/CertificateFactorySpi.java: (engineGenerateCertPath(InputStream)): Suppress warnings about unused arguments, exceptions not being thrown and method can be static. Provided for subclass implementations. (engineGenerateCertPath(InputStream,String)): Likewise. (engineGenerateCertPath(List)): Likewise. (engineGetCertPathEncodings()): Likewise. * java/security/cert/CollectionCertStoreParameters.java: (toString()): Add @Override. * java/security/cert/LDAPCertStoreParameters.java: (clone()): Add @Override. (toString()): Likewise. * java/security/cert/PKIXBuilderParameters.java: (toString()): Likewise. * java/security/cert/PKIXCertPathBuilderResult.java: (getCertPath()): Add @Override. (toString()): Likewise. * java/security/cert/PKIXCertPathChecker.java: (clone()): Add @Override. * java/security/cert/PKIXCertPathValidatorResult.java: (clone()): Add @Override. (toString()): Likewise. * java/security/cert/PKIXParameters.java: (clone()): Add @Overrride. (toString()): Likewise. * java/security/cert/PolicyQualifierInfo.java: (PolicyQualifierInfo(byte[])): Remove unnecessary cast. (getEncoded()): Likewise. (toString()): Add @Override. * java/security/cert/TrustAnchor.java: (TrustAnchor(X509Certificate,byte[])): Remove unnecessary cast. (TrustAnchor(String,PublicKey,byte[])): Document exceptions. Catch IOException and throw as IllegalArgumentException. Remove unnecessary casts. (toString()): Add @Override. * java/security/cert/X509CRL.java: (equals(Object)): Add @Override. (hashCode()): Likewise. (getIssuerX500Principal()): Suppress warning about making this static. Should be overridden by subclasses. * java/security/cert/X509CRLEntry.java: (equals(Object):: Add @Override. (hashCode()): Likewise. (toString()): Likewise. * java/security/cert/X509CRLSelector.java: Remove unneeded Cloneable reference. (getIssuerNames()): Remove unneeded else block. (toString()): Add @Override. (match(CRL)): Likewise. (clone()): LIkewise. * java/security/cert/X509CertSelector.java: Remove unneeded Cloneable reference. (makeName(int,String)): Re-use earlier result of Kind.forTag(id). Add default case. (clone()): Add @Override. (getAuthorityKeyIdentifier()): Remove unneeded else block and cast. (getCertificateValid()): Remove unneeded else block. (getExtendedKeyUsage()): Likewise. (getIssuerAsBytes()): Likewise. (getIssuerAsString()): Likewise. (getKeyUsage()): Likewise and remove unneeded cast. (getNameConstraints()): Likewise. (getPathToNames()): Explicitly convert int to Integer. (getPrivateKeyValid()): Suppress static method warning. Method is deliberately useless. (getSubjectAlternativeNames()): Explicitly convert int to Integer. (getSubjectAsBytes()): Remove unneeded else block. (getSubjectAsString()): Likewise. (getSubjectKeyIdentifier()): Likewise and remove unneeded cast. (match(Certificate)): Add @Override. Rename cert to other to avoid shadowing. (setNameConstraints(byte[])): Remove unnecessary cast. Suppress warnings about NameConstraints instance being unused. (setPrivateKeyValid()): Suppress unused variable warning. Method is deliberately useless. (setSubjectPublicKey(PublicKey)): Remove unneeded cast. (toString()): Add @Override. * java/security/cert/X509Certificate.java: (getExtendedKeyUsage()): Suppress unthrown exception warning and static method suggestion. Overridden by subclasses. (getSubjectAlternativeNames()): Likewise. (getIssuerAlternativeNames()): Likewise. (getSubjectX500Principal()): Suppress static method suggestion. Overridden by subclasses. (getIssuerX500Principal()): Likewise. * java/security/spec/DSAParameterSpec.java: (getP()): Add @Override. (getQ()): Likewise. (getG()): Likewise. * java/security/spec/PKCS8EncodedKeySpec.java: (getEncoded()): Add @Override. (getFormat()): Likewise. * java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java: (RSAMultiPrimePrivateCrtKeySpec(BigInteger,BigInteger,BigInteger, BigInteger,BigInteger,BigInteger,BigInteger,BigInteger, RSAOtherPrimeInfo[])): Remove unneeded else block. * java/security/spec/X509EncodedKeySpec.java: (getEncoded()): Add @Override. (getFormat()): Likewise. * javax/security/auth/Policy.java: Add @Deprecated. * javax/security/auth/PrivateCredentialPermission.java: Remove unneeded Serializable reference. (equals(Object)): Add @Override. Rename principals to thisPrincipals to avoid shadowing. (getActions()): Add @Override. (hashCode()): Likewise. (implies(Permission)): Likewise. Rename principals to thisPrincipals to avoid shadowing. (newPermissionCollection()): Add @Override to method and anonymous inner class implementations of equals(Object) & hashCode(). * javax/security/auth/SubjectDomainCombiner.java: (combine(ProtectionDomain[],ProtectionDomain[])): Add @Override. * javax/security/auth/callback/ConfirmationCallback.java: (setOptions(String[],int)): Move reference to options.length to after options null check. * javax/security/auth/kerberos/KerberosKey.java: Remove unneeded Serializable reference. (getAlgorithm()): Add @Override. (getFormat()): Likewise. (getEncoded()): Likewise and remove unnecessary cast. (destroy()): Add @Override. (isDestroyed()): Likewise. (toString()): Likewise. * javax/security/auth/kerberos/KerberosPrincipal.java: (getName()): Add @Override. (hashCode()): Likewise. (equals(Object)): Likewise. (toString()): Likewise. * javax/security/auth/kerberos/KerberosTicket.java: (asn1Encoding): Remove @SuppressWarnings. (KerberosTicket(byte[],KerberosPrincipal,KerberosPrincipal, byte[],int,boolean[],Date,Date,Date,Date,InetAddress[])): Remove unnecessary cast. Remove duplicate assignment to flags. (destroy()): Add @Override. (isDestroyed()): Likewise. (isCurrent()): Likewise. (refresh()): Likewise. (getFlags()): Remove unnecessary cast. (getEncoded()): Likewise. (toString()): Add @Override. * javax/security/auth/kerberos/KeyImpl.java: Remove unneeded Serializable reference. (KeyImpl(byte[],int)): Remove unnecessary cast. (getAlgorithm()): Add @Override. (getEncoded()): Likewise. (getFormat()): Likewise. (toString()): Likewise. * javax/security/auth/login/AppConfigurationEntry.java: (toString()): Add @Override. (LoginModuleControlFlag.toString()): Likewise. * javax/security/auth/login/Configuration.java: (getConfig()): Use GetSecurityPropertyAction rather than a bespoke PrivilegedAction implementation. * javax/security/auth/login/LoginContext.java: (LoginContext(String,Subject,CallbackHandler,Configuration)): Rename entries to appEntries to avoid shadowing. (lookupModule(AppConfigurationEntry,Subject,Map)): Rename subject to subj to avoid shadowing. Check module is null rather than cause is non-null. * javax/security/auth/login/NullConfiguration.java: (getAppConfigurationEntry(String)): Add @Override. (refresh()): Likewise. * javax/security/auth/x500/X500Principal.java: (hashCode()): Add @Override. (equals(Object)): Likewise. (getEncoded()): Remove unnecessary cast. (getName()): Add @Override. (toString()): Likewise. (readAttributeType(Reader)): Make static. (parseDer(InputStream)): Rename encoded to encodedStream to avoid shadowing. * javax/security/auth/x500/X500PrivateCredential.java: (destroy()): Add @Override. (isDestroyed()): Likewise. * javax/security/cert/Certificate.java: (equals(Object)): Add @Override. (hashCode()): Likewise. (toString()): Likewise. * javax/security/cert/X509CertBridge.java: (getEncoded()): Add @Override. (verify(PublicKey)): Likewise. (verify(PublicKey,String)): Likewise. (toString()): Likewise. (getPublicKey()): Likewise. (checkValidity()): Likewise. (checkValidity(Date)): Likewise. (getVersion()): Likewise. (getSerialNumber()): Likewise. (getIssuerDN()): Likewise. (getSubjectDN()): Likewise. (getNotBefore()): Likewise. (getNotAfter()): Likewise. (getSigAlgName()): Likewise. (getSigAlgOID()): Likewise. (getSigAlgParams()): Likewise. * javax/security/sasl/Sasl.java: (createSaslClient(String[],String,String,String,Map,CallbackHandler)): Remove unnecessary else clause and pointless result assignment. (createSaslServer(String,String,String,Map,CallbackHandler)): Likewise. * javax/security/sasl/SaslException.java: Remove unneeded Serializable reference. (SaslException(String,Throwable)): Add cause to superclass call. (getCause()): Add @Override. (printStackTrace()): Removed; provided by superclass. (printStackTrace(PrintStream)): Likewise. (printStackTrace(PrintWriter)): Likewise. (initCause(Throwable)): Call superclass version, then sync the local copy. (toString()): Add @Override.
Diffstat (limited to 'java/security')
-rw-r--r--java/security/AccessControlContext.java4
-rw-r--r--java/security/AlgorithmParameters.java3
-rw-r--r--java/security/AllPermission.java18
-rw-r--r--java/security/BasicPermission.java7
-rw-r--r--java/security/Certificate.java5
-rw-r--r--java/security/DigestInputStream.java5
-rw-r--r--java/security/DigestOutputStream.java5
-rw-r--r--java/security/DummyKeyPairGenerator.java6
-rw-r--r--java/security/DummyMessageDigest.java9
-rw-r--r--java/security/Identity.java16
-rw-r--r--java/security/IdentityScope.java4
-rw-r--r--java/security/IntersectingDomainCombiner.java3
-rw-r--r--java/security/KeyPairGenerator.java1
-rw-r--r--java/security/KeyPairGeneratorSpi.java4
-rw-r--r--java/security/KeyStore.java5
-rw-r--r--java/security/MessageDigest.java4
-rw-r--r--java/security/MessageDigestSpi.java4
-rw-r--r--java/security/Permission.java8
-rw-r--r--java/security/PermissionCollection.java3
-rw-r--r--java/security/Permissions.java21
-rw-r--r--java/security/Policy.java2
-rw-r--r--java/security/Principal.java5
-rw-r--r--java/security/PrivilegedActionException.java12
-rw-r--r--java/security/ProtectionDomain.java7
-rw-r--r--java/security/Provider.java17
-rw-r--r--java/security/SecureClassLoader.java6
-rw-r--r--java/security/SecureRandom.java14
-rw-r--r--java/security/Security.java19
-rw-r--r--java/security/SecurityPermission.java3
-rw-r--r--java/security/Signature.java15
-rw-r--r--java/security/SignatureSpi.java4
-rw-r--r--java/security/SignedObject.java8
-rw-r--r--java/security/Signer.java4
-rw-r--r--java/security/UnresolvedPermission.java4
-rw-r--r--java/security/acl/Acl.java3
-rw-r--r--java/security/acl/AclEntry.java16
-rw-r--r--java/security/acl/Permission.java4
-rw-r--r--java/security/cert/CRL.java3
-rw-r--r--java/security/cert/CertPath.java5
-rw-r--r--java/security/cert/CertPathBuilderException.java66
-rw-r--r--java/security/cert/CertPathValidatorException.java64
-rw-r--r--java/security/cert/CertStoreException.java66
-rw-r--r--java/security/cert/CertStoreSpi.java3
-rw-r--r--java/security/cert/Certificate.java5
-rw-r--r--java/security/cert/CertificateFactorySpi.java6
-rw-r--r--java/security/cert/CollectionCertStoreParameters.java1
-rw-r--r--java/security/cert/LDAPCertStoreParameters.java4
-rw-r--r--java/security/cert/PKIXBuilderParameters.java3
-rw-r--r--java/security/cert/PKIXCertPathBuilderResult.java4
-rw-r--r--java/security/cert/PKIXCertPathChecker.java3
-rw-r--r--java/security/cert/PKIXCertPathValidatorResult.java4
-rw-r--r--java/security/cert/PKIXParameters.java2
-rw-r--r--java/security/cert/PolicyQualifierInfo.java7
-rw-r--r--java/security/cert/TrustAnchor.java23
-rw-r--r--java/security/cert/X509CRL.java5
-rw-r--r--java/security/cert/X509CRLEntry.java5
-rw-r--r--java/security/cert/X509CRLSelector.java10
-rw-r--r--java/security/cert/X509CertSelector.java105
-rw-r--r--java/security/cert/X509Certificate.java7
-rw-r--r--java/security/spec/DSAParameterSpec.java5
-rw-r--r--java/security/spec/PKCS8EncodedKeySpec.java4
-rw-r--r--java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java13
-rw-r--r--java/security/spec/X509EncodedKeySpec.java4
63 files changed, 334 insertions, 371 deletions
diff --git a/java/security/AccessControlContext.java b/java/security/AccessControlContext.java
index 726a6f6e6..5e491cb01 100644
--- a/java/security/AccessControlContext.java
+++ b/java/security/AccessControlContext.java
@@ -1,5 +1,5 @@
/* AccessControlContext.java --- Access Control Context Class
- Copyright (C) 1999, 2004, 2014 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -172,6 +172,7 @@ public final class AccessControlContext
*
* @return true if equal, false otherwise
*/
+ @Override
public boolean equals(Object obj)
{
if (obj instanceof AccessControlContext)
@@ -202,6 +203,7 @@ public final class AccessControlContext
*
* @return a hash code representing this class
*/
+ @Override
public int hashCode()
{
int h = 0;
diff --git a/java/security/AlgorithmParameters.java b/java/security/AlgorithmParameters.java
index ba805143e..7cc98f385 100644
--- a/java/security/AlgorithmParameters.java
+++ b/java/security/AlgorithmParameters.java
@@ -1,5 +1,5 @@
/* AlgorithmParameters.java --- Algorithm Parameters Implementation Class
- Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2004, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -310,6 +310,7 @@ public class AlgorithmParameters
*
* @return a string representation of the encoded form.
*/
+ @Override
public final String toString()
{
return paramSpi.engineToString();
diff --git a/java/security/AllPermission.java b/java/security/AllPermission.java
index 0a0a5f2ce..12e7d986a 100644
--- a/java/security/AllPermission.java
+++ b/java/security/AllPermission.java
@@ -1,5 +1,6 @@
/* AllPermission.java -- Permission to do anything
- Copyright (C) 1998, 2001, 2002, 2004, 2005, 2014 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2004, 2005, 2014, 2015
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,6 +79,7 @@ public final class AllPermission extends Permission
* @param name ignored
* @param actions ignored
*/
+ @SuppressWarnings("unused")
public AllPermission(String name, String actions)
{
super("*");
@@ -90,6 +92,7 @@ public final class AllPermission extends Permission
* @param perm ignored
* @return true, the permission is implied
*/
+ @Override
public boolean implies(Permission perm)
{
return true;
@@ -100,6 +103,7 @@ public final class AllPermission extends Permission
*
* @param obj the <code>Object</code> to test for equality
*/
+ @Override
public boolean equals(Object obj)
{
return obj instanceof AllPermission;
@@ -110,6 +114,7 @@ public final class AllPermission extends Permission
*
* @return a hash value for this object
*/
+ @Override
public int hashCode()
{
return 1;
@@ -121,6 +126,7 @@ public final class AllPermission extends Permission
*
* @return the action list
*/
+ @Override
public String getActions()
{
return "";
@@ -131,6 +137,7 @@ public final class AllPermission extends Permission
*
* @return a permission collection
*/
+ @Override
public PermissionCollection newPermissionCollection()
{
return new AllPermissionCollection();
@@ -157,6 +164,15 @@ public final class AllPermission extends Permission
private boolean all_allowed;
/**
+ * Public constructor to avoid generation of a
+ * synthetic accessor method.
+ */
+ public AllPermissionCollection()
+ {
+ super();
+ }
+
+ /**
* Add an AllPermission.
*
* @param perm the permission to add
diff --git a/java/security/BasicPermission.java b/java/security/BasicPermission.java
index 3bd0bd8f3..86c58f0e0 100644
--- a/java/security/BasicPermission.java
+++ b/java/security/BasicPermission.java
@@ -1,5 +1,5 @@
/* BasicPermission.java -- implements a simple named permission
- Copyright (C) 1998, 1999, 2002, 2003, 2004, 2005, 2006, 2014
+ Copyright (C) 1998, 1999, 2002, 2003, 2004, 2005, 2006, 2014, 2015
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,7 +39,6 @@ exception statement from your version. */
package java.security;
-import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -74,7 +73,6 @@ import java.util.Hashtable;
* @status updated to 1.4
*/
public abstract class BasicPermission extends Permission
- implements Serializable
{
/**
* Compatible with JDK 1.1+.
@@ -111,6 +109,7 @@ public abstract class BasicPermission extends Permission
* @throws NullPointerException if name is null
* @throws IllegalArgumentException if name is invalid
*/
+ @SuppressWarnings("unused")
public BasicPermission(String name, String actions)
{
this(name);
@@ -183,6 +182,7 @@ public abstract class BasicPermission extends Permission
*
* @return the action list
*/
+ @Override
public String getActions()
{
return "";
@@ -197,6 +197,7 @@ public abstract class BasicPermission extends Permission
*
* @return a new empty <code>PermissionCollection</code> object
*/
+ @Override
public PermissionCollection newPermissionCollection()
{
return new BasicPermissionCollection(getClass());
diff --git a/java/security/Certificate.java b/java/security/Certificate.java
index 5cdba6e10..cb863b578 100644
--- a/java/security/Certificate.java
+++ b/java/security/Certificate.java
@@ -1,5 +1,5 @@
/* Certificate.java -- deprecated interface for modeling digital certificates
- Copyright (C) 1998, 2002, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2004, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,7 +45,7 @@ import java.io.OutputStream;
/**
* This interface models a digital certificate which verifies the
* authenticity of a party. This class simply allows certificate
- * information to be queried, it does not guarantee that the certificate
+ * information to be queried; it does not guarantee that the certificate
* is valid.
*
* <p>This class is deprecated in favor of the new java.security.cert package.
@@ -56,6 +56,7 @@ import java.io.OutputStream;
* @deprecated use {@link java.security.cert} instead
* @status updated to 1.4
*/
+@Deprecated
public interface Certificate
{
/**
diff --git a/java/security/DigestInputStream.java b/java/security/DigestInputStream.java
index c0a74f3ab..7bd440e26 100644
--- a/java/security/DigestInputStream.java
+++ b/java/security/DigestInputStream.java
@@ -1,5 +1,5 @@
/* DigestInputStream.java --- An Input stream tied to a message digest
- Copyright (C) 1999, 2003, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2004, 2005, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -110,6 +110,7 @@ public class DigestInputStream extends FilterInputStream
* @throws IOException if an IO error occurs in the underlying input stream,
* this error is thrown
*/
+ @Override
public int read() throws IOException
{
int temp = in.read();
@@ -134,6 +135,7 @@ public class DigestInputStream extends FilterInputStream
* @throws IOException if an IO error occurs in the underlying input stream,
* this error is thrown
*/
+ @Override
public int read(byte[]b, int off, int len) throws IOException
{
int temp = in.read(b, off, len);
@@ -160,6 +162,7 @@ public class DigestInputStream extends FilterInputStream
*
* @return A string representing the input stream and message digest.
*/
+ @Override
public String toString()
{
return "[Digest Input Stream] " + digest.toString();
diff --git a/java/security/DigestOutputStream.java b/java/security/DigestOutputStream.java
index 748f83d79..2b745adc5 100644
--- a/java/security/DigestOutputStream.java
+++ b/java/security/DigestOutputStream.java
@@ -1,5 +1,5 @@
/* DigestOutputStream.java --- An output stream tied to a message digest
- Copyright (C) 1999, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004, 2005, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -108,6 +108,7 @@ public class DigestOutputStream extends FilterOutputStream
* @exception IOException if the underlying output stream
* cannot write the byte, this is thrown.
*/
+ @Override
public void write(int b) throws IOException
{
if (state)
@@ -127,6 +128,7 @@ public class DigestOutputStream extends FilterOutputStream
* @exception IOException if the underlying output stream
* cannot write the bytes, this is thrown.
*/
+ @Override
public void write(byte[]b, int off, int len) throws IOException
{
if (state)
@@ -151,6 +153,7 @@ public class DigestOutputStream extends FilterOutputStream
*
* @return A string representing the output stream and message digest.
*/
+ @Override
public String toString()
{
return "[Digest Output Stream] " + digest.toString();
diff --git a/java/security/DummyKeyPairGenerator.java b/java/security/DummyKeyPairGenerator.java
index da8c362eb..63c89ebd9 100644
--- a/java/security/DummyKeyPairGenerator.java
+++ b/java/security/DummyKeyPairGenerator.java
@@ -1,5 +1,5 @@
/* DummyKeyPairGenerator.java - Wrapper for KeyPairGeneratorSpi
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,6 +49,7 @@ final class DummyKeyPairGenerator extends KeyPairGenerator
this.kpgSpi = kpgSpi;
}
+ @Override
public Object clone() throws CloneNotSupportedException
{
KeyPairGenerator result = new DummyKeyPairGenerator
@@ -57,17 +58,20 @@ final class DummyKeyPairGenerator extends KeyPairGenerator
return result;
}
+ @Override
public void initialize(int keysize, SecureRandom random)
{
kpgSpi.initialize(keysize, random);
}
+ @Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException
{
kpgSpi.initialize(params, random);
}
+ @Override
public KeyPair generateKeyPair()
{
return kpgSpi.generateKeyPair();
diff --git a/java/security/DummyMessageDigest.java b/java/security/DummyMessageDigest.java
index 6cecdcf68..7b78f828a 100644
--- a/java/security/DummyMessageDigest.java
+++ b/java/security/DummyMessageDigest.java
@@ -1,5 +1,5 @@
/* DummyMessageDigest.java - Wrapper for MessageDigestSpi
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,6 +47,7 @@ final class DummyMessageDigest extends MessageDigest
this.mdSpi = mdSpi;
}
+ @Override
public Object clone() throws CloneNotSupportedException
{
MessageDigest result = new DummyMessageDigest
@@ -57,32 +58,38 @@ final class DummyMessageDigest extends MessageDigest
// java.security.MessageDigestSpi abstract methods implementation ---------
+ @Override
public byte[] engineDigest()
{
return mdSpi.engineDigest();
}
+ @Override
public int engineDigest(byte[] buf, int offset, int len)
throws DigestException
{
return mdSpi.engineDigest(buf, offset, len);
}
+ @Override
public int engineGetDigestLength()
{
return mdSpi.engineGetDigestLength();
}
+ @Override
public void engineReset()
{
mdSpi.engineReset();
}
+ @Override
public void engineUpdate(byte input)
{
mdSpi.engineUpdate(input);
}
+ @Override
public void engineUpdate(byte[] input, int offset, int len)
{
mdSpi.engineUpdate(input, offset, len);
diff --git a/java/security/Identity.java b/java/security/Identity.java
index d3f48e887..9086bb7ab 100644
--- a/java/security/Identity.java
+++ b/java/security/Identity.java
@@ -1,5 +1,5 @@
/* Identity.java --- Identity Class
- Copyright (C) 1999, 2003, 2014, Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2014, 2015, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -49,7 +49,7 @@ import java.util.Vector;
* identity. The names cannot be changed and the identities can be scoped. Each
* identity (name and public key) within a scope are unique to that scope.</p>
*
- * <p>Each identity has a set of ceritificates which all specify the same
+ * <p>Each identity has a set of certificates which all specify the same
* public key, but not necessarily the same name.</p>
*
* <p>The <code>Identity</code> class can be subclassed to allow additional
@@ -63,6 +63,7 @@ import java.util.Vector;
* <code>java.security.cert</code> package, and
* <code>java.security.Principal</code>.
*/
+@Deprecated
public abstract class Identity implements Principal, Serializable
{
private static final long serialVersionUID = 3609922007826600659L;
@@ -110,6 +111,7 @@ public abstract class Identity implements Principal, Serializable
}
/** @return the name of this identity. */
+ @Override
public final String getName()
{
return name;
@@ -252,6 +254,7 @@ public abstract class Identity implements Principal, Serializable
* @return <code>true</code> if they are equal, <code>false</code>
* otherwise.
*/
+ @Override
public final boolean equals(Object identity)
{
if (identity instanceof Identity)
@@ -290,6 +293,7 @@ public abstract class Identity implements Principal, Serializable
* if a {@link SecurityManager} is installed which disallows this
* operation.
*/
+ @Override
public String toString()
{
SecurityManager sm = System.getSecurityManager();
@@ -321,14 +325,12 @@ public abstract class Identity implements Principal, Serializable
/* TODO: Insert proper detailed format here */
return (name + ":@" + scope + " Public Key: " + publicKey);
}
- else
- {
- /* TODO: Insert proper format here */
- return (name + ":@" + scope + " Public Key: " + publicKey);
- }
+ /* TODO: Insert proper format here */
+ return (name + ":@" + scope + " Public Key: " + publicKey);
}
/** @return a hashcode of this identity. */
+ @Override
public int hashCode()
{
int ret = name.hashCode();
diff --git a/java/security/IdentityScope.java b/java/security/IdentityScope.java
index 4391fbd49..4cdccdd55 100644
--- a/java/security/IdentityScope.java
+++ b/java/security/IdentityScope.java
@@ -1,5 +1,5 @@
/* IdentityScope.java --- IdentityScope Class
- Copyright (C) 1999, 2003, Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2015, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -59,6 +59,7 @@ import java.util.Enumeration;
* @deprecated Use java.security.KeyStore, the java.security.cert package, and
* java.security.Principal.
*/
+@Deprecated
public abstract class IdentityScope extends Identity
{
private static final long serialVersionUID = -2337346281189773310L;
@@ -209,6 +210,7 @@ public abstract class IdentityScope extends Identity
*
* @return a string representation of this instance.
*/
+ @Override
public String toString()
{
return (super.getName() + " " + super.getScope().getName() + " " + size());
diff --git a/java/security/IntersectingDomainCombiner.java b/java/security/IntersectingDomainCombiner.java
index 9a40ce75e..f93812533 100644
--- a/java/security/IntersectingDomainCombiner.java
+++ b/java/security/IntersectingDomainCombiner.java
@@ -1,5 +1,5 @@
/* IntersectingDomainCombiner.java --
- Copyright (C) 2004, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -62,6 +62,7 @@ final class IntersectingDomainCombiner implements DomainCombiner
// Methods.
// -------------------------------------------------------------------------
+ @Override
public ProtectionDomain[] combine (ProtectionDomain[] currentDomains,
ProtectionDomain[] assignedDomains)
{
diff --git a/java/security/KeyPairGenerator.java b/java/security/KeyPairGenerator.java
index 457c5a531..190a0a517 100644
--- a/java/security/KeyPairGenerator.java
+++ b/java/security/KeyPairGenerator.java
@@ -315,6 +315,7 @@ public abstract class KeyPairGenerator extends KeyPairGeneratorSpi
* @return a new unique {@link KeyPair}.
* @see #genKeyPair()
*/
+ @Override
public KeyPair generateKeyPair()
{
try
diff --git a/java/security/KeyPairGeneratorSpi.java b/java/security/KeyPairGeneratorSpi.java
index 1eaad9832..659f9d760 100644
--- a/java/security/KeyPairGeneratorSpi.java
+++ b/java/security/KeyPairGeneratorSpi.java
@@ -1,5 +1,5 @@
/* KeyPairGeneratorSpi.java --- Key Pair Generator SPI Class
- Copyright (C) 1999, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,6 +76,7 @@ public abstract class KeyPairGeneratorSpi
@throws InvalidAlgorithmParameterException
*/
+ @SuppressWarnings({"unused","static-method"})
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
throws InvalidAlgorithmParameterException
{
@@ -95,6 +96,7 @@ public abstract class KeyPairGeneratorSpi
* We override clone here to make it accessible for use by
* DummyKeyPairGenerator.
*/
+ @Override
protected Object clone() throws CloneNotSupportedException
{
return super.clone();
diff --git a/java/security/KeyStore.java b/java/security/KeyStore.java
index 25173e543..baf9a3c94 100644
--- a/java/security/KeyStore.java
+++ b/java/security/KeyStore.java
@@ -1,5 +1,5 @@
/* KeyStore.java --- Key Store Class
- Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2004, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -171,7 +171,7 @@ public class KeyStore
*
* @param type the type of keystore to create.
* @param provider the provider to use.
- * @return a <code>KeyStore</code> repesenting the desired type.
+ * @return a <code>KeyStore</code> representing the desired type.
* @throws KeyStoreException if the designated type is not implemented by the
* given provider.
* @throws IllegalArgumentException if either <code>type</code> or
@@ -215,6 +215,7 @@ public class KeyStore
// Security reads every property in java.security so it
// will return this property if it exists.
String tmp = AccessController.doPrivileged(new PrivilegedAction<String> () {
+ @Override
public String run()
{
return Security.getProperty("keystore.type");
diff --git a/java/security/MessageDigest.java b/java/security/MessageDigest.java
index a4eeab447..d4e844993 100644
--- a/java/security/MessageDigest.java
+++ b/java/security/MessageDigest.java
@@ -1,5 +1,5 @@
/* MessageDigest.java --- The message digest interface.
- Copyright (C) 1999, 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2006, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -288,6 +288,7 @@ public abstract class MessageDigest extends MessageDigestSpi
*
* @return a string representation of this instance.
*/
+ @Override
public String toString()
{
return (getClass()).getName() + " Message Digest <" + digestToString() + ">";
@@ -353,6 +354,7 @@ public abstract class MessageDigest extends MessageDigestSpi
* @throws CloneNotSupportedException
* the implementation does not support cloning.
*/
+ @Override
public Object clone() throws CloneNotSupportedException
{
return super.clone();
diff --git a/java/security/MessageDigestSpi.java b/java/security/MessageDigestSpi.java
index 63cc96047..5c16b66fd 100644
--- a/java/security/MessageDigestSpi.java
+++ b/java/security/MessageDigestSpi.java
@@ -1,5 +1,5 @@
/* MessageDigestSpi.java --- The message digest service provider interface.
- Copyright (C) 1999, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2005, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,6 +76,7 @@ public abstract class MessageDigestSpi
@since 1.2
*/
+ @SuppressWarnings("static-method")
protected int engineGetDigestLength()
{
return 0;
@@ -167,6 +168,7 @@ public abstract class MessageDigestSpi
implementation has to overload this class in order to be
cloneable.
*/
+ @Override
public Object clone() throws CloneNotSupportedException
{
return super.clone();
diff --git a/java/security/Permission.java b/java/security/Permission.java
index cf6399b16..f39466f17 100644
--- a/java/security/Permission.java
+++ b/java/security/Permission.java
@@ -1,5 +1,6 @@
/* Permission.java -- The superclass for all permission objects
- Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005, 2014, 2015
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -105,6 +106,7 @@ public abstract class Permission implements Guard, Serializable
* @see GuardedObject
* @see SecurityManager#checkPermission(Permission)
*/
+ @Override
public void checkGuard(Object obj)
{
SecurityManager sm = System.getSecurityManager();
@@ -127,6 +129,7 @@ public abstract class Permission implements Guard, Serializable
*
* @param obj the object to compare to
*/
+ @Override
public abstract boolean equals(Object obj);
/**
@@ -136,6 +139,7 @@ public abstract class Permission implements Guard, Serializable
*
* @return a hash value
*/
+ @Override
public abstract int hashCode();
/**
@@ -168,6 +172,7 @@ public abstract class Permission implements Guard, Serializable
*
* @return a new <code>PermissionCollection</code>
*/
+ @SuppressWarnings("static-method")
public PermissionCollection newPermissionCollection()
{
return null;
@@ -181,6 +186,7 @@ public abstract class Permission implements Guard, Serializable
*
* @return this object as a <code>String</code>
*/
+ @Override
public String toString()
{
CPStringBuilder string = new CPStringBuilder();
diff --git a/java/security/PermissionCollection.java b/java/security/PermissionCollection.java
index ef87cc7e1..64a5bd038 100644
--- a/java/security/PermissionCollection.java
+++ b/java/security/PermissionCollection.java
@@ -1,5 +1,5 @@
/* PermissionCollection.java -- A collection of permission objects
- Copyright (C) 1998, 2001, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2005, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -156,6 +156,7 @@ public abstract class PermissionCollection implements Serializable
*
* @return a <code>String</code> representing this object
*/
+ @Override
public String toString()
{
CPStringBuilder sb = new CPStringBuilder(super.toString());
diff --git a/java/security/Permissions.java b/java/security/Permissions.java
index 40087ba02..669d9140f 100644
--- a/java/security/Permissions.java
+++ b/java/security/Permissions.java
@@ -1,5 +1,6 @@
/* Permissions.java -- a collection of permission collections
- Copyright (C) 1998, 2001, 2002, 2004, 2005, 2014 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2001, 2002, 2004, 2005, 2014, 2015
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,7 +39,6 @@ exception statement from your version. */
package java.security;
-import java.io.Serializable;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.NoSuchElementException;
@@ -58,7 +58,6 @@ import java.util.NoSuchElementException;
* @since 1.1
*/
public final class Permissions extends PermissionCollection
- implements Serializable
{
/**
* Compatible with JDK 1.1+.
@@ -159,6 +158,7 @@ public final class Permissions extends PermissionCollection
Enumeration<PermissionCollection> mainEnum = perms.elements();
Enumeration<Permission> subEnum;
+ @Override
public boolean hasMoreElements()
{
if (subEnum == null)
@@ -181,6 +181,7 @@ public final class Permissions extends PermissionCollection
return true;
}
+ @Override
public Permission nextElement()
{
if (! hasMoreElements())
@@ -208,8 +209,12 @@ public final class Permissions extends PermissionCollection
*
* @serial the stored permissions, both as key and value
*/
- private final Hashtable<Permission,Permission> perms =
- new Hashtable<Permission,Permission>();
+ private final Hashtable<Permission,Permission> perms;
+
+ public PermissionsHash()
+ {
+ perms = new Hashtable<Permission,Permission>();
+ }
/**
* Add a permission. We don't need to check for read-only, as this
@@ -219,7 +224,7 @@ public final class Permissions extends PermissionCollection
* @param perm the permission to add
*/
@Override
- public void add(Permission perm)
+ public synchronized void add(Permission perm)
{
perms.put(perm, perm);
}
@@ -230,9 +235,9 @@ public final class Permissions extends PermissionCollection
* @param perm the permission to check
* @return true if it is implied
*/
- // FIXME: Should this method be synchronized?
+ // Synchronized to avoid elements being added mid-iteration
@Override
- public boolean implies(Permission perm)
+ public synchronized boolean implies(Permission perm)
{
Enumeration<Permission> elements = elements();
diff --git a/java/security/Policy.java b/java/security/Policy.java
index 930315bfd..9f3459c9a 100644
--- a/java/security/Policy.java
+++ b/java/security/Policy.java
@@ -274,7 +274,7 @@ public abstract class Policy
if (pd2pc == null)
setup(this);
- PermissionCollection pc = (PermissionCollection) pd2pc.get(domain);
+ PermissionCollection pc = pd2pc.get(domain);
if (pc != null)
return pc.implies(permission);
diff --git a/java/security/Principal.java b/java/security/Principal.java
index 6d9de6ccd..a3cd851cc 100644
--- a/java/security/Principal.java
+++ b/java/security/Principal.java
@@ -1,5 +1,5 @@
/* Principal.java -- A security entity
- Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,7 @@ public interface Principal
* @param obj the Object to test for equality
* @return true if the specified <code>Principal</code> is equal
*/
+ @Override
boolean equals(Object obj);
/**
@@ -64,6 +65,7 @@ public interface Principal
*
* @return this <code>Principal</code> represented as a <code>String</code>
*/
+ @Override
String toString();
/**
@@ -73,6 +75,7 @@ public interface Principal
*
* @return a hash value
*/
+ @Override
int hashCode();
/**
diff --git a/java/security/PrivilegedActionException.java b/java/security/PrivilegedActionException.java
index 3f08c8130..bedd773dd 100644
--- a/java/security/PrivilegedActionException.java
+++ b/java/security/PrivilegedActionException.java
@@ -1,5 +1,5 @@
/* PrivilegedActionException.java -- wrap an exception in a privileged action
- Copyright (C) 1998, 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2005, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -92,18 +92,10 @@ public class PrivilegedActionException extends Exception
* @return the cause
* @since 1.4
*/
+ @Override
public Throwable getCause()
{
return exception;
}
- /**
- * Convert this to a String.
- *
- * @return the string representation
- */
- public String toString()
- {
- return super.toString();
- }
}
diff --git a/java/security/ProtectionDomain.java b/java/security/ProtectionDomain.java
index 7be5875dc..cbf66f356 100644
--- a/java/security/ProtectionDomain.java
+++ b/java/security/ProtectionDomain.java
@@ -1,5 +1,5 @@
/* ProtectionDomain.java -- A security domain
- Copyright (C) 1998, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2003, 2004, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -144,7 +144,7 @@ public class ProtectionDomain
this.classloader = classloader;
this.principals =
- (principals != null ? (Principal[]) principals.clone() : new Principal[0]);
+ (principals != null ? principals.clone() : new Principal[0]);
this.staticBinding = staticBinding;
}
@@ -178,7 +178,7 @@ public class ProtectionDomain
*/
public final Principal[] getPrincipals()
{
- return (Principal[]) principals.clone();
+ return principals.clone();
}
/**
@@ -217,6 +217,7 @@ public class ProtectionDomain
*
* @return A string representation of this object.
*/
+ @Override
public String toString()
{
String linesep = SystemProperties.getProperty("line.separator");
diff --git a/java/security/Provider.java b/java/security/Provider.java
index b1d6d9ce2..c6e0deace 100644
--- a/java/security/Provider.java
+++ b/java/security/Provider.java
@@ -1,5 +1,6 @@
/* Provider.java -- Security provider information
- Copyright (C) 1998, 1999, 2000, 2002, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000, 2002, 2006, 2014, 2015
+ Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -37,7 +38,6 @@ exception statement from your version. */
package java.security;
-import java.io.Serializable;
import java.util.Properties;
/**
@@ -53,7 +53,6 @@ import java.util.Properties;
*/
public abstract class Provider
extends Properties
- implements Serializable
{
private static final long serialVersionUID = -4298000515446427739L;
@@ -138,6 +137,8 @@ public abstract class Provider
* @see java.lang.Object#equals(Object)
* @see java.util.Hashtable#get(Object)
*/
+ @Override
+ @SuppressWarnings("sync-override") // Calls super-class
public Object put(Object key, Object value)
{
SecurityManager sm = System.getSecurityManager();
@@ -147,6 +148,8 @@ public abstract class Provider
}
// overrides same in java.util.Hashtable
+ @Override
+ @SuppressWarnings("sync-override") // Calls super-class
public Object get(Object key)
{
return super.get(toCanonicalKey(key));
@@ -167,6 +170,8 @@ public abstract class Provider
* @return The previous value for this key, or <code>null</code> if no
* previous value.
*/
+ @Override
+ @SuppressWarnings("sync-override") // Calls super-class
public Object remove(Object key)
{
SecurityManager sm = System.getSecurityManager();
@@ -188,6 +193,8 @@ public abstract class Provider
* {@link SecurityManager#checkPermission(Permission)} for a
* <code>SecurityPermission("clearProviderProperties." + name)</code>.
*/
+ @Override
+ @SuppressWarnings("sync-override") // Calls super-class
public void clear()
{
SecurityManager sm = System.getSecurityManager();
@@ -203,13 +210,15 @@ public abstract class Provider
*
* @return A <code>String</code> representation of this object.
*/
+ @Override
+ @SuppressWarnings("sync-override") // Doesn't access collection
public String toString()
{
return (getClass().getName() + ": name=" + getName() + " version=" +
version);
}
- private Object toCanonicalKey(Object key)
+ private static Object toCanonicalKey(Object key)
{
if (key.getClass().isAssignableFrom(String.class)) // is it ours?
return ((String) key).toUpperCase(); // use default locale
diff --git a/java/security/SecureClassLoader.java b/java/security/SecureClassLoader.java
index 1480b7116..c52f99472 100644
--- a/java/security/SecureClassLoader.java
+++ b/java/security/SecureClassLoader.java
@@ -1,5 +1,5 @@
/* SecureClassLoader.java --- A Secure Class Loader
- Copyright (C) 1999, 2004, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004, 2006, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -140,9 +140,9 @@ public class SecureClassLoader extends ClassLoader
* argument to build a proper ProtectionDomain for the class
* being defined.
*/
+ @SuppressWarnings("static-method")
protected PermissionCollection getPermissions(CodeSource cs)
{
- Policy policy = Policy.getCurrentPolicy();
- return policy.getPermissions(cs);
+ return Policy.getCurrentPolicy().getPermissions(cs);
}
}
diff --git a/java/security/SecureRandom.java b/java/security/SecureRandom.java
index 649966fee..d17a886d2 100644
--- a/java/security/SecureRandom.java
+++ b/java/security/SecureRandom.java
@@ -1,5 +1,5 @@
/* SecureRandom.java --- Secure Random class implementation
- Copyright (C) 1999, 2001, 2002, 2003, 2005, 2006, 2014
+ Copyright (C) 1999, 2001, 2002, 2003, 2005, 2006, 2014, 2015
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -310,7 +310,7 @@ public class SecureRandom extends Random
@param seed seed bytes to seed with
*/
- public void setSeed(byte[] seed)
+ public synchronized void setSeed(byte[] seed)
{
secureRandomSpi.engineSetSeed(seed);
isSeeded = true;
@@ -322,7 +322,8 @@ public class SecureRandom extends Random
@param seed 8 seed bytes to seed with
*/
- public void setSeed(long seed)
+ @Override
+ public synchronized void setSeed(long seed)
{
// This particular setSeed will be called by Random.Random(), via
// our own constructor, before secureRandomSpi is initialized. In
@@ -351,7 +352,8 @@ public class SecureRandom extends Random
@param bytes array to store generated bytes in
*/
- public void nextBytes(byte[] bytes)
+ @Override
+ public synchronized void nextBytes(byte[] bytes)
{
if (!isSeeded)
setSeed(getSeed(32));
@@ -369,6 +371,8 @@ public class SecureRandom extends Random
@return the random bits
*/
+ @Override
+ @SuppressWarnings("sync-override") // nextBytes(byte[]) is synchronized
protected final int next(int numBits)
{
if (numBits == 0)
@@ -404,7 +408,7 @@ public class SecureRandom extends Random
@return an array containing the seed bytes
*/
- public byte[] generateSeed(int numBytes)
+ public synchronized byte[] generateSeed(int numBytes)
{
return secureRandomSpi.engineGenerateSeed(numBytes);
}
diff --git a/java/security/Security.java b/java/security/Security.java
index 6b20a7cb6..66f3ab255 100644
--- a/java/security/Security.java
+++ b/java/security/Security.java
@@ -183,6 +183,7 @@ public final class Security
* {@link AlgorithmParameters} and {@link KeyFactory} engine
* classes instead.
*/
+ @Deprecated
public static String getAlgorithmProperty(String algName, String propName)
{
if (algName == null || propName == null)
@@ -322,12 +323,10 @@ public final class Security
{
if (name == null)
return null;
- else
- {
- name = name.trim();
- if (name.length() == 0)
- return null;
- }
+ name = name.trim();
+ if (name.length() == 0)
+ return null;
+
Provider p;
int max = providers.size ();
for (int i = 0; i < max; i++)
@@ -414,10 +413,10 @@ public final class Security
return result;
serviceName = serviceName.toUpperCase()+".";
- Provider[] providers = getProviders();
+ Provider[] provs = getProviders();
int ndx;
- for (int i = 0; i < providers.length; i++)
- for (String s : providers[i].stringPropertyNames())
+ for (int i = 0; i < provs.length; i++)
+ for (String s : provs[i].stringPropertyNames())
{
String service = s.trim();
if (service.toUpperCase().startsWith(serviceName))
@@ -634,7 +633,7 @@ public final class Security
private static boolean provides(Provider p, String svc, String algo,
String attr, String val)
{
- String serviceDotAlgorithm = null;
+ String serviceDotAlgorithm = "";
String realVal;
boolean found = false;
// if <svc>.<algo> <attr> is in the set then so is <svc>.<algo>
diff --git a/java/security/SecurityPermission.java b/java/security/SecurityPermission.java
index 6aba18f34..cdfd0be66 100644
--- a/java/security/SecurityPermission.java
+++ b/java/security/SecurityPermission.java
@@ -1,5 +1,5 @@
/* SecurityPermission.java -- Class for named security permissions
- Copyright (C) 1998, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2002, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -171,6 +171,7 @@ public final class SecurityPermission extends BasicPermission
* @param name the name to assign to this permission
* @param actions ignored
*/
+ @SuppressWarnings("unused")
public SecurityPermission(String name, String actions)
{
super(name);
diff --git a/java/security/Signature.java b/java/security/Signature.java
index d7186395f..29ce53512 100644
--- a/java/security/Signature.java
+++ b/java/security/Signature.java
@@ -1,5 +1,5 @@
/* Signature.java --- Signature Class
- Copyright (C) 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002, 2003, 2004, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -332,8 +332,7 @@ public abstract class Signature extends SignatureSpi
{
if (state == SIGN)
return engineSign();
- else
- throw new SignatureException();
+ throw new SignatureException();
}
/**
@@ -365,8 +364,7 @@ public abstract class Signature extends SignatureSpi
{
if (state == SIGN)
return engineSign(outbuf, offset, len);
- else
- throw new SignatureException();
+ throw new SignatureException();
}
/**
@@ -383,8 +381,7 @@ public abstract class Signature extends SignatureSpi
{
if (state == VERIFY)
return engineVerify(signature);
- else
- throw new SignatureException();
+ throw new SignatureException();
}
/**
@@ -510,6 +507,7 @@ public abstract class Signature extends SignatureSpi
*
* @return a rstring representation of this instance.
*/
+ @Override
public String toString()
{
return (algorithm + " Signature");
@@ -527,6 +525,7 @@ public abstract class Signature extends SignatureSpi
* can not be changed, a security exception occured, etc.
* @deprecated use the other setParameter
*/
+ @Deprecated
public final void setParameter(String param, Object value)
throws InvalidParameterException
{
@@ -573,6 +572,7 @@ public abstract class Signature extends SignatureSpi
* if the parameter is invalid.
* @deprecated use the other getParameter
*/
+ @Deprecated
public final Object getParameter(String param)
throws InvalidParameterException
{
@@ -586,6 +586,7 @@ public abstract class Signature extends SignatureSpi
* @throws CloneNotSupportedException
* if the implementation does not support cloning.
*/
+ @Override
public Object clone() throws CloneNotSupportedException
{
return super.clone();
diff --git a/java/security/SignatureSpi.java b/java/security/SignatureSpi.java
index 11ce551a0..491a183ed 100644
--- a/java/security/SignatureSpi.java
+++ b/java/security/SignatureSpi.java
@@ -250,6 +250,7 @@ public abstract class SignatureSpi
* cannot be changed, a security exception occured, etc.
* @deprecated use the other setParameter.
*/
+ @Deprecated
protected abstract void engineSetParameter(String param, Object value)
throws InvalidParameterException;
@@ -266,6 +267,7 @@ public abstract class SignatureSpi
* if the parameter is invalid, the parameter is already set and
* cannot be changed, a security exception occured, etc.
*/
+ @SuppressWarnings({"unused","static-method"})
protected void engineSetParameter(AlgorithmParameterSpec params)
throws InvalidAlgorithmParameterException
{
@@ -284,6 +286,7 @@ public abstract class SignatureSpi
* @throws UnsupportedOperationException
* always.
*/
+ @SuppressWarnings("static-method")
protected AlgorithmParameters engineGetParameters()
{
throw new UnsupportedOperationException();
@@ -299,6 +302,7 @@ public abstract class SignatureSpi
* if the parameter is invalid.
* @deprecated use the other getParameter
*/
+ @Deprecated
protected abstract Object engineGetParameter(String param)
throws InvalidParameterException;
diff --git a/java/security/SignedObject.java b/java/security/SignedObject.java
index 79f551cce..2f09cb05b 100644
--- a/java/security/SignedObject.java
+++ b/java/security/SignedObject.java
@@ -1,5 +1,5 @@
/* SignedObject.java --- Signed Object Class
- Copyright (C) 1999, 2003, Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -155,7 +155,7 @@ public final class SignedObject implements Serializable
*/
public byte[] getSignature()
{
- return (byte[]) signature.clone();
+ return signature.clone();
}
@@ -197,7 +197,7 @@ public final class SignedObject implements Serializable
throws IOException, ClassNotFoundException
{
s.defaultReadObject();
- content = (byte[]) content.clone();
- signature = (byte[]) signature.clone();
+ content = content.clone();
+ signature = signature.clone();
}
}
diff --git a/java/security/Signer.java b/java/security/Signer.java
index 18259c863..faf73f771 100644
--- a/java/security/Signer.java
+++ b/java/security/Signer.java
@@ -1,5 +1,5 @@
/* Signer.java --- Signer Class
- Copyright (C) 1999, 2003, Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -45,6 +45,7 @@ package java.security;
* @deprecated Replaced by <code>java.security.KeyStore</code>, the
* <code>java.security.cert</code> package, and <code>java.security.Principal</code>.
*/
+@Deprecated
public abstract class Signer extends Identity
{
private static final long serialVersionUID = -1763464102261361480L;
@@ -141,6 +142,7 @@ public abstract class Signer extends Identity
}
/** @returns a string representing this <code>Signer</code>. */
+ @Override
public String toString()
{
return (getName() + ": " + privateKey);
diff --git a/java/security/UnresolvedPermission.java b/java/security/UnresolvedPermission.java
index d7af92211..73ffc0b58 100644
--- a/java/security/UnresolvedPermission.java
+++ b/java/security/UnresolvedPermission.java
@@ -246,7 +246,7 @@ public final class UnresolvedPermission extends Permission
{
if (certs == null)
return null;
- return (Certificate[]) certs.clone();
+ return certs.clone();
}
} // class UnresolvedPermission
@@ -322,6 +322,7 @@ class UnresolvedPermissionCollection extends PermissionCollection
Enumeration<Vector<Permission>> mainEnum = permissions.elements();
Enumeration<Permission> subEnum;
+ @Override
public boolean hasMoreElements()
{
if (subEnum == null)
@@ -344,6 +345,7 @@ class UnresolvedPermissionCollection extends PermissionCollection
return true;
}
+ @Override
public Permission nextElement()
{
if (! hasMoreElements())
diff --git a/java/security/acl/Acl.java b/java/security/acl/Acl.java
index 10a59fdf5..dd1b60193 100644
--- a/java/security/acl/Acl.java
+++ b/java/security/acl/Acl.java
@@ -1,5 +1,5 @@
/* Acl.java -- An access control list
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -149,5 +149,6 @@ public interface Acl extends Owner
*
* @return A <code>String</code> representation of this ACL
*/
+ @Override
String toString();
}
diff --git a/java/security/acl/AclEntry.java b/java/security/acl/AclEntry.java
index 47154b285..a0982da92 100644
--- a/java/security/acl/AclEntry.java
+++ b/java/security/acl/AclEntry.java
@@ -1,5 +1,5 @@
/* AclEntry.java -- An entry in an ACL list.
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,7 +72,8 @@ public interface AclEntry extends Cloneable
*
* @param user The <code>Principal</code> for this ACL entry
*
- * @return <code>true</code> if the <code>Principal</code> was successfully set or <code>false</code> if this entry already has a <code>Principal</code>.
+ * @return <code>true</code> if the <code>Principal</code> was successfully
+ * set or <code>false</code> if this entry already has a <code>Principal</code>.
*/
boolean setPrincipal(Principal user);
@@ -96,7 +97,8 @@ public interface AclEntry extends Cloneable
*
* @param permission The <code>Permission</code> to add
*
- * @return <code>true</code> if the permission was added or <code>false</code> if it was already set for this entry
+ * @return <code>true</code> if the permission was added or
+ * <code>false</code> if it was already set for this entry
*/
boolean addPermission(Permission permission);
@@ -105,7 +107,9 @@ public interface AclEntry extends Cloneable
*
* @param perm The <code>Permission</code> to delete from this ACL entry.
*
- * @return <code>true</code> if the permission was successfully deleted or <code>false</code> if the permission was not part of this ACL to begin with
+ * @return <code>true</code> if the permission was successfully deleted
+ * or <code>false</code> if the permission was not part of this
+ * ACL to begin with
*/
boolean removePermission(Permission perm);
@@ -115,7 +119,8 @@ public interface AclEntry extends Cloneable
*
* @param permission The <code>Permission</code> to test
*
- * @return <code>true</code> if this permission is associated with this entry or <code>false</code> otherwise
+ * @return <code>true</code> if this permission is associated
+ * with this entry or <code>false</code> otherwise
*/
boolean checkPermission(Permission permission);
@@ -132,6 +137,7 @@ public interface AclEntry extends Cloneable
*
* @return A <code>String</code> representation of this object
*/
+ @Override
String toString();
/**
diff --git a/java/security/acl/Permission.java b/java/security/acl/Permission.java
index e5ba29138..663be09bd 100644
--- a/java/security/acl/Permission.java
+++ b/java/security/acl/Permission.java
@@ -1,5 +1,5 @@
/* Permission.java -- Information about an ACL permission
- Copyright (C) 1998 Free Software Foundation, Inc.
+ Copyright (C) 1998, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -56,6 +56,7 @@ public interface Permission
*
* @return <code>true</code> if the specified permission is the same as this one, <code>false</code> otherwise
*/
+ @Override
boolean equals (Object perm);
/**
@@ -63,5 +64,6 @@ public interface Permission
*
* @return A <code>String</code> representing this permission.
*/
+ @Override
String toString();
}
diff --git a/java/security/cert/CRL.java b/java/security/cert/CRL.java
index 1eaa70fa9..618aa4566 100644
--- a/java/security/cert/CRL.java
+++ b/java/security/cert/CRL.java
@@ -1,5 +1,5 @@
/* CRL.java --- Certificate Revocation List
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -81,6 +81,7 @@ public abstract class CRL
@return a string representing the CRL.
*/
+ @Override
public abstract String toString();
/**
diff --git a/java/security/cert/CertPath.java b/java/security/cert/CertPath.java
index 5c9a12ab9..221c267d6 100644
--- a/java/security/cert/CertPath.java
+++ b/java/security/cert/CertPath.java
@@ -1,5 +1,5 @@
/* CertPath.java -- a sequence of certificates
- Copyright (C) 2002, 2005, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -173,6 +173,7 @@ public abstract class CertPath implements Serializable
* @param o the object to compare to
* @return true if the two are equal
*/
+ @Override
public boolean equals(Object o)
{
if (! (o instanceof CertPath))
@@ -188,11 +189,13 @@ public abstract class CertPath implements Serializable
*
* @return the hashcode
*/
+ @Override
public int hashCode()
{
return 31 * type.hashCode() + getCertificates().hashCode();
}
+ @Override
public String toString()
{
List<? extends Certificate> l = getCertificates();
diff --git a/java/security/cert/CertPathBuilderException.java b/java/security/cert/CertPathBuilderException.java
index 985151010..5906dae93 100644
--- a/java/security/cert/CertPathBuilderException.java
+++ b/java/security/cert/CertPathBuilderException.java
@@ -1,6 +1,6 @@
/* CertPathBuilderException.java -- wraps an exception during certificate
path building
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,6 @@ exception statement from your version. */
package java.security.cert;
-import java.io.PrintStream;
-import java.io.PrintWriter;
import java.security.GeneralSecurityException;
/**
@@ -84,7 +82,7 @@ public class CertPathBuilderException extends GeneralSecurityException
*/
public CertPathBuilderException(Throwable cause)
{
- this(cause == null ? null : cause.toString(), cause);
+ super(cause);
}
/**
@@ -95,65 +93,7 @@ public class CertPathBuilderException extends GeneralSecurityException
*/
public CertPathBuilderException(String msg, Throwable cause)
{
- super(msg);
- initCause(cause);
- }
-
- /**
- * Get the detail message.
- *
- * @return the detail message
- */
- public String getMessage()
- {
- return super.getMessage();
- }
-
- /**
- * Get the cause, null if unknown.
- *
- * @return the cause
- */
- public Throwable getCause()
- {
- return super.getCause();
+ super(msg, cause);
}
- /**
- * Convert this to a string, including its cause.
- *
- * @return the string conversion
- */
- public String toString()
- {
- return super.toString();
- }
-
- /**
- * Print the stack trace to <code>System.err</code>.
- */
- public void printStackTrace()
- {
- super.printStackTrace();
- }
-
- /**
- * Print the stack trace to a stream.
- *
- * @param stream the stream
- */
- public void printStackTrace(PrintStream stream)
- {
- super.printStackTrace(stream);
- }
-
- /**
- * Print the stack trace to a stream.
- *
- * @param stream the stream
- */
- public void printStackTrace(PrintWriter stream)
- {
- super.printStackTrace(stream);
- }
}
diff --git a/java/security/cert/CertPathValidatorException.java b/java/security/cert/CertPathValidatorException.java
index f3195be29..23f19b081 100644
--- a/java/security/cert/CertPathValidatorException.java
+++ b/java/security/cert/CertPathValidatorException.java
@@ -1,6 +1,6 @@
/* CertPathValidatorException.java -- wraps an exception during validation
of a CertPath
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -39,8 +39,6 @@ exception statement from your version. */
package java.security.cert;
-import java.io.PrintStream;
-import java.io.PrintWriter;
import java.security.GeneralSecurityException;
/**
@@ -135,8 +133,7 @@ public class CertPathValidatorException extends GeneralSecurityException
public CertPathValidatorException(String msg, Throwable cause,
CertPath certPath, int index)
{
- super(msg);
- initCause(cause);
+ super(msg, cause);
if (index < -1 || (certPath != null
&& index >= certPath.getCertificates().size()))
throw new IndexOutOfBoundsException();
@@ -147,16 +144,6 @@ public class CertPathValidatorException extends GeneralSecurityException
}
/**
- * Get the detail message.
- *
- * @return the detail message
- */
- public String getMessage()
- {
- return super.getMessage();
- }
-
- /**
* Get the certificate path that had the failure, or null.
*
* @return the culprit path
@@ -176,51 +163,4 @@ public class CertPathValidatorException extends GeneralSecurityException
return index;
}
- /**
- * Get the cause, null if unknown.
- *
- * @return the cause
- */
- public Throwable getCause()
- {
- return super.getCause();
- }
-
- /**
- * Convert this to a string, including its cause.
- *
- * @return the string conversion
- */
- public String toString()
- {
- return super.toString();
- }
-
- /**
- * Print the stack trace to <code>System.err</code>.
- */
- public void printStackTrace()
- {
- super.printStackTrace();
- }
-
- /**
- * Print the stack trace to a stream.
- *
- * @param stream the stream
- */
- public void printStackTrace(PrintStream stream)
- {
- super.printStackTrace(stream);
- }
-
- /**
- * Print the stack trace to a stream.
- *
- * @param stream the stream
- */
- public void printStackTrace(PrintWriter stream)
- {
- super.printStackTrace(stream);
- }
}
diff --git a/java/security/cert/CertStoreException.java b/java/security/cert/CertStoreException.java
index a4d8b7a46..c243bb42c 100644
--- a/java/security/cert/CertStoreException.java
+++ b/java/security/cert/CertStoreException.java
@@ -1,5 +1,5 @@
/* CertStoreException.java -- wraps an exception during certificate storage
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2005, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -38,8 +38,6 @@ exception statement from your version. */
package java.security.cert;
-import java.io.PrintStream;
-import java.io.PrintWriter;
import java.security.GeneralSecurityException;
/**
@@ -84,7 +82,7 @@ public class CertStoreException extends GeneralSecurityException
*/
public CertStoreException(Throwable cause)
{
- this(cause == null ? null : cause.toString(), cause);
+ super(cause);
}
/**
@@ -95,65 +93,7 @@ public class CertStoreException extends GeneralSecurityException
*/
public CertStoreException(String msg, Throwable cause)
{
- super(msg);
- initCause(cause);
- }
-
- /**
- * Get the detail message.
- *
- * @return the detail message
- */
- public String getMessage()
- {
- return super.getMessage();
- }
-
- /**
- * Get the cause, null if unknown.
- *
- * @return the cause
- */
- public Throwable getCause()
- {
- return super.getCause();
+ super(msg, cause);
}
- /**
- * Convert this to a string, including its cause.
- *
- * @return the string conversion
- */
- public String toString()
- {
- return super.toString();
- }
-
- /**
- * Print the stack trace to <code>System.err</code>.
- */
- public void printStackTrace()
- {
- super.printStackTrace();
- }
-
- /**
- * Print the stack trace to a stream.
- *
- * @param stream the stream
- */
- public void printStackTrace(PrintStream stream)
- {
- super.printStackTrace(stream);
- }
-
- /**
- * Print the stack trace to a stream.
- *
- * @param stream the stream
- */
- public void printStackTrace(PrintWriter stream)
- {
- super.printStackTrace(stream);
- }
}
diff --git a/java/security/cert/CertStoreSpi.java b/java/security/cert/CertStoreSpi.java
index a47978a22..85de3ae5b 100644
--- a/java/security/cert/CertStoreSpi.java
+++ b/java/security/cert/CertStoreSpi.java
@@ -1,5 +1,5 @@
/* CertStoreSpi -- certificate store service provider interface.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -69,6 +69,7 @@ public abstract class CertStoreSpi
* @throws InvalidAlgorithmParameterException If the specified
* parameters are inappropriate for this class.
*/
+ @SuppressWarnings("unused")
public CertStoreSpi(CertStoreParameters params)
throws InvalidAlgorithmParameterException
{
diff --git a/java/security/cert/Certificate.java b/java/security/cert/Certificate.java
index be1713cbf..b9abe8e65 100644
--- a/java/security/cert/Certificate.java
+++ b/java/security/cert/Certificate.java
@@ -1,5 +1,5 @@
/* Certificate.java --- Certificate class
- Copyright (C) 1999, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2004, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -107,6 +107,7 @@ public abstract class Certificate implements Serializable
@return true if equal, false otherwise
*/
+ @Override
public boolean equals(Object other)
{
if( other instanceof Certificate ) {
@@ -136,6 +137,7 @@ public abstract class Certificate implements Serializable
@return A hash code of this class
*/
+ @Override
public int hashCode()
{
return super.hashCode();
@@ -198,6 +200,7 @@ public abstract class Certificate implements Serializable
@return a string representing the Certificate.
*/
+ @Override
public abstract String toString();
diff --git a/java/security/cert/CertificateFactorySpi.java b/java/security/cert/CertificateFactorySpi.java
index 2c9ca5d38..2b5bb529c 100644
--- a/java/security/cert/CertificateFactorySpi.java
+++ b/java/security/cert/CertificateFactorySpi.java
@@ -1,5 +1,5 @@
/* CertificateFactorySpi.java --- Certificate Factory Class
- Copyright (C) 1999,2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -172,6 +172,7 @@ public abstract class CertificateFactorySpi
* @throws CertificateException If an error occurs decoding the
* CertPath.
*/
+ @SuppressWarnings({"unused","static-method"})
public CertPath engineGenerateCertPath(InputStream inStream)
throws CertificateException
{
@@ -188,6 +189,7 @@ public abstract class CertificateFactorySpi
* @throws CertificateException If an error occurs decoding the
* CertPath.
*/
+ @SuppressWarnings({"unused","static-method"})
public CertPath engineGenerateCertPath(InputStream inStream, String encoding)
throws CertificateException
{
@@ -204,6 +206,7 @@ public abstract class CertificateFactorySpi
* @throws CertificateException If an error occurs generating the
* CertPath.
*/
+ @SuppressWarnings({"unused","static-method"})
public CertPath engineGenerateCertPath(List<? extends Certificate> certificates)
throws CertificateException
{
@@ -217,6 +220,7 @@ public abstract class CertificateFactorySpi
*
* @return The Iterator of supported encodings.
*/
+ @SuppressWarnings("static-method")
public Iterator<String> engineGetCertPathEncodings()
{
throw new UnsupportedOperationException("not implemented");
diff --git a/java/security/cert/CollectionCertStoreParameters.java b/java/security/cert/CollectionCertStoreParameters.java
index 6edaf7677..ace8eccbc 100644
--- a/java/security/cert/CollectionCertStoreParameters.java
+++ b/java/security/cert/CollectionCertStoreParameters.java
@@ -115,6 +115,7 @@ public class CollectionCertStoreParameters implements CertStoreParameters
*
* @return The string representation of these parameters.
*/
+ @Override
public String toString()
{
return "CollectionCertStoreParameters: [ collection: "
diff --git a/java/security/cert/LDAPCertStoreParameters.java b/java/security/cert/LDAPCertStoreParameters.java
index f2dff764a..615b80853 100644
--- a/java/security/cert/LDAPCertStoreParameters.java
+++ b/java/security/cert/LDAPCertStoreParameters.java
@@ -1,5 +1,5 @@
/* LDAPCertStoreParameters.java -- LDAP CertStore parameters.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,6 +102,7 @@ public class LDAPCertStoreParameters implements CertStoreParameters
// Instance methods.
// ------------------------------------------------------------------------
+ @Override
public Object clone()
{
return new LDAPCertStoreParameters(serverName, port);
@@ -132,6 +133,7 @@ public class LDAPCertStoreParameters implements CertStoreParameters
*
* @return The string representation of these parameters.
*/
+ @Override
public String toString()
{
return "LDAPCertStoreParameters: [ serverName: " + serverName
diff --git a/java/security/cert/PKIXBuilderParameters.java b/java/security/cert/PKIXBuilderParameters.java
index 3a29b5218..47f8484df 100644
--- a/java/security/cert/PKIXBuilderParameters.java
+++ b/java/security/cert/PKIXBuilderParameters.java
@@ -1,5 +1,5 @@
/* PKIXBuilderParameters.java -- parameters for PKIX cert path builders
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -140,6 +140,7 @@ public class PKIXBuilderParameters extends PKIXParameters
this.maxPathLength = maxPathLength;
}
+ @Override
public String toString()
{
CPStringBuilder buf = new CPStringBuilder(super.toString());
diff --git a/java/security/cert/PKIXCertPathBuilderResult.java b/java/security/cert/PKIXCertPathBuilderResult.java
index 52984b543..779983339 100644
--- a/java/security/cert/PKIXCertPathBuilderResult.java
+++ b/java/security/cert/PKIXCertPathBuilderResult.java
@@ -1,5 +1,5 @@
/* PKIXCertPathBuilderResult.java -- PKIX cert path bulider result
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -90,11 +90,13 @@ public class PKIXCertPathBuilderResult extends PKIXCertPathValidatorResult
*
* @return The certificate path that was built.
*/
+ @Override
public CertPath getCertPath()
{
return certPath;
}
+ @Override
public String toString()
{
CPStringBuilder buf = new CPStringBuilder(super.toString());
diff --git a/java/security/cert/PKIXCertPathChecker.java b/java/security/cert/PKIXCertPathChecker.java
index 0bedf401a..b33117f84 100644
--- a/java/security/cert/PKIXCertPathChecker.java
+++ b/java/security/cert/PKIXCertPathChecker.java
@@ -1,5 +1,5 @@
/* PKIXCertPathChecker.java -- checks X.509 certificate paths.
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -76,6 +76,7 @@ public abstract class PKIXCertPathChecker implements Cloneable
// Cloneable interface.
// ------------------------------------------------------------------------
+ @Override
public Object clone()
{
try
diff --git a/java/security/cert/PKIXCertPathValidatorResult.java b/java/security/cert/PKIXCertPathValidatorResult.java
index 17b5c86f8..2b1f05edb 100644
--- a/java/security/cert/PKIXCertPathValidatorResult.java
+++ b/java/security/cert/PKIXCertPathValidatorResult.java
@@ -1,5 +1,5 @@
/* PKIXCertPathValidatorResult.java -- PKIX cert path builder result
- Copyright (C) 2003 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -123,6 +123,7 @@ public class PKIXCertPathValidatorResult implements CertPathValidatorResult
*
* @return The copy.
*/
+ @Override
public Object clone()
{
return new PKIXCertPathValidatorResult(trustAnchor, policyTree,
@@ -134,6 +135,7 @@ public class PKIXCertPathValidatorResult implements CertPathValidatorResult
*
* @return A printable string representation of this result.
*/
+ @Override
public String toString()
{
return "[ Trust Anchor=" + trustAnchor + "; Policy Tree="
diff --git a/java/security/cert/PKIXParameters.java b/java/security/cert/PKIXParameters.java
index 1778d6127..33ba297b6 100644
--- a/java/security/cert/PKIXParameters.java
+++ b/java/security/cert/PKIXParameters.java
@@ -521,6 +521,7 @@ public class PKIXParameters implements CertPathParameters
*
* @return The copy.
*/
+ @Override
public Object clone()
{
return new PKIXParameters(this);
@@ -531,6 +532,7 @@ public class PKIXParameters implements CertPathParameters
*
* @return A printable representation of these parameters.
*/
+ @Override
public String toString() {
return "[ Trust Anchors: " + trustAnchors + "; Initial Policy OIDs="
+ (initPolicies != null ? initPolicies.toString() : "any")
diff --git a/java/security/cert/PolicyQualifierInfo.java b/java/security/cert/PolicyQualifierInfo.java
index b53faa935..07530d3b3 100644
--- a/java/security/cert/PolicyQualifierInfo.java
+++ b/java/security/cert/PolicyQualifierInfo.java
@@ -1,5 +1,5 @@
/* PolicyQualifierInfo.java -- policy qualifier info object.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2014 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -102,7 +102,7 @@ PolicyQualifierId ::= OBJECT IDENTIFIER
{
if (encoded == null)
throw new IOException("null bytes");
- this.encoded = (byte[]) encoded.clone();
+ this.encoded = encoded.clone();
DERReader in = new DERReader(new ByteArrayInputStream(this.encoded));
DERValue qualInfo = in.read();
if (!qualInfo.isConstructed())
@@ -139,7 +139,7 @@ PolicyQualifierId ::= OBJECT IDENTIFIER
*/
public final byte[] getEncoded()
{
- return (byte[]) encoded.clone();
+ return encoded.clone();
}
/**
@@ -161,6 +161,7 @@ PolicyQualifierId ::= OBJECT IDENTIFIER
*
* @return The string representation.
*/
+ @Override
public String toString()
{
return "PolicyQualifierInfo { policyQualifierId ::= " + oid
diff --git a/java/security/cert/TrustAnchor.java b/java/security/cert/TrustAnchor.java
index 2110ed518..f0537d2ef 100644
--- a/java/security/cert/TrustAnchor.java
+++ b/java/security/cert/TrustAnchor.java
@@ -1,5 +1,5 @@
/* TrustAnchor.java -- an ultimately-trusted certificate.
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2004, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -40,6 +40,7 @@ package java.security.cert;
import gnu.java.security.x509.X500DistinguishedName;
+import java.io.IOException;
import java.security.PublicKey;
/**
@@ -87,7 +88,7 @@ public class TrustAnchor
caName = null;
caKey = null;
if (nameConstraints != null)
- this.nameConstraints = (byte[]) nameConstraints.clone();
+ this.nameConstraints = nameConstraints.clone();
else
this.nameConstraints = null;
}
@@ -102,6 +103,10 @@ public class TrustAnchor
* @params caName The CA's distinguished name.
* @params caKey The CA's public key.
* @params nameConstraints The encoded nameConstraints.
+ * @throws NullPointerException if the specified CA name or key is
+ * {@code null}.
+ * @throws IllegalArgumentException if the CA name is of zero length or
+ * incorrectly formatted, or the name constraints can't be decoded.
*/
public TrustAnchor(String caName, PublicKey caKey, byte[] nameConstraints)
{
@@ -110,10 +115,17 @@ public class TrustAnchor
if (caName.length() == 0)
throw new IllegalArgumentException();
trustedCert = null;
- this.caName = new X500DistinguishedName(caName);
+ try
+ {
+ this.caName = new X500DistinguishedName(caName);
+ }
+ catch (IOException ex)
+ {
+ throw new IllegalArgumentException("Couldn't parse name", ex);
+ }
this.caKey = caKey;
if (nameConstraints != null)
- this.nameConstraints = (byte[]) nameConstraints.clone();
+ this.nameConstraints = nameConstraints.clone();
else
this.nameConstraints = null;
}
@@ -167,7 +179,7 @@ public class TrustAnchor
{
if (nameConstraints == null)
return null;
- return (byte[]) nameConstraints.clone();
+ return nameConstraints.clone();
}
/**
@@ -175,6 +187,7 @@ public class TrustAnchor
*
* @return The printable representation.
*/
+ @Override
public String toString()
{
if (trustedCert == null)
diff --git a/java/security/cert/X509CRL.java b/java/security/cert/X509CRL.java
index 895ba33e7..3e4a4e96b 100644
--- a/java/security/cert/X509CRL.java
+++ b/java/security/cert/X509CRL.java
@@ -1,5 +1,5 @@
/* X509CRL.java --- X.509 Certificate Revocation List
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -119,6 +119,7 @@ public abstract class X509CRL extends CRL implements X509Extension
@return true if equal, false otherwise
*/
+ @Override
public boolean equals(Object other)
{
if( other instanceof X509CRL ) {
@@ -148,6 +149,7 @@ public abstract class X509CRL extends CRL implements X509Extension
@return A hash code of this class
*/
+ @Override
public int hashCode()
{
return super.hashCode();
@@ -390,6 +392,7 @@ public abstract class X509CRL extends CRL implements X509Extension
* @return The issuer's X.500 distinguished name.
* @since JDK 1.4
*/
+ @SuppressWarnings("static-method")
public X500Principal getIssuerX500Principal()
{
throw new UnsupportedOperationException();
diff --git a/java/security/cert/X509CRLEntry.java b/java/security/cert/X509CRLEntry.java
index ac5ef4714..d8f00187f 100644
--- a/java/security/cert/X509CRLEntry.java
+++ b/java/security/cert/X509CRLEntry.java
@@ -1,5 +1,5 @@
/* X509CRLEntry.java --- X.509 Certificate Revocation List Entry
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -89,6 +89,7 @@ public abstract class X509CRLEntry implements X509Extension
@return true if equal, false otherwise
*/
+ @Override
public boolean equals(Object other)
{
if( other instanceof X509CRLEntry ) {
@@ -118,6 +119,7 @@ public abstract class X509CRLEntry implements X509Extension
@return A hash code of this class
*/
+ @Override
public int hashCode()
{
return super.hashCode();
@@ -164,6 +166,7 @@ public abstract class X509CRLEntry implements X509Extension
@return a string representing this X509CRLEntry.
*/
+ @Override
public abstract String toString();
}
diff --git a/java/security/cert/X509CRLSelector.java b/java/security/cert/X509CRLSelector.java
index 1ac5c640b..81817da1d 100644
--- a/java/security/cert/X509CRLSelector.java
+++ b/java/security/cert/X509CRLSelector.java
@@ -1,5 +1,5 @@
/* X509CRLSelector.java -- selects X.509 CRLs by criteria.
- Copyright (C) 2004, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -72,7 +72,7 @@ import javax.security.auth.x500.X500Principal;
* @author Casey Marshall (csm@gnu.org)
* @since 1.4
*/
-public class X509CRLSelector implements CRLSelector, Cloneable
+public class X509CRLSelector implements CRLSelector
{
// Fields.
@@ -235,8 +235,7 @@ public class X509CRLSelector implements CRLSelector, Cloneable
iNames.add(principal.getName());
return Collections.unmodifiableList(iNames);
}
- else
- return null;
+ return null;
}
/**
@@ -339,6 +338,7 @@ public class X509CRLSelector implements CRLSelector, Cloneable
*
* @return The string.
*/
+ @Override
public String toString()
{
CPStringBuilder str = new CPStringBuilder(X509CRLSelector.class.getName());
@@ -367,6 +367,7 @@ public class X509CRLSelector implements CRLSelector, Cloneable
* @param _crl The CRL being checked.
* @return True if the CRL matches, false otherwise.
*/
+ @Override
public boolean match(CRL _crl)
{
if (!(_crl instanceof X509CRL))
@@ -433,6 +434,7 @@ public class X509CRLSelector implements CRLSelector, Cloneable
*
* @return The copy.
*/
+ @Override
public Object clone()
{
try
diff --git a/java/security/cert/X509CertSelector.java b/java/security/cert/X509CertSelector.java
index ef8123bf7..ccdb3344d 100644
--- a/java/security/cert/X509CertSelector.java
+++ b/java/security/cert/X509CertSelector.java
@@ -1,5 +1,5 @@
/* X509CertSelector.java -- selects X.509 certificates by criteria.
- Copyright (C) 2004, 2005, 2006, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2004, 2005, 2006, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -47,7 +47,6 @@ import gnu.java.security.x509.ext.Extension;
import gnu.java.security.x509.ext.GeneralName;
import gnu.java.security.x509.ext.GeneralSubtree;
import gnu.java.security.x509.ext.NameConstraints;
-import gnu.java.security.x509.ext.GeneralName.Kind;
import java.io.IOException;
import java.math.BigInteger;
@@ -87,7 +86,7 @@ import javax.security.auth.x500.X500Principal;
* @author Casey Marshall (csm@gnu.org)
* @since 1.4
*/
-public class X509CertSelector implements CertSelector, Cloneable
+public class X509CertSelector implements CertSelector
{
// Constants and fields.
@@ -107,7 +106,7 @@ public class X509CertSelector implements CertSelector, Cloneable
{
byte[] nameBytes = null;
GeneralName.Kind kind = GeneralName.Kind.forTag(id);
- switch (Kind.forTag(id))
+ switch (kind)
{
case dNSName:
case rfc822Name:
@@ -133,6 +132,7 @@ public class X509CertSelector implements CertSelector, Cloneable
case ediPartyName:
case x400Address:
case otherName:
+ default:
throw new IOException("cannot decode string representation of "
+ kind);
}
@@ -259,6 +259,7 @@ public class X509CertSelector implements CertSelector, Cloneable
altNames.add(generalName);
}
+ @Override
public Object clone()
{
try
@@ -281,9 +282,8 @@ public class X509CertSelector implements CertSelector, Cloneable
public byte[] getAuthorityKeyIdentifier()
{
if (authKeyId != null)
- return (byte[]) authKeyId.clone();
- else
- return null;
+ return authKeyId.clone();
+ return null;
}
/**
@@ -317,8 +317,7 @@ public class X509CertSelector implements CertSelector, Cloneable
{
if (certValid != null)
return (Date) certValid.clone();
- else
- return null;
+ return null;
}
/**
@@ -332,8 +331,7 @@ public class X509CertSelector implements CertSelector, Cloneable
{
if (keyPurposeSet != null)
return Collections.unmodifiableSet(keyPurposeSet);
- else
- return null;
+ return null;
}
/**
@@ -346,8 +344,7 @@ public class X509CertSelector implements CertSelector, Cloneable
{
if (issuer != null)
return issuer.getEncoded();
- else
- return null;
+ return null;
}
/**
@@ -360,8 +357,7 @@ public class X509CertSelector implements CertSelector, Cloneable
{
if (issuer != null)
return issuer.getName();
- else
- return null;
+ return null;
}
/**
@@ -373,9 +369,8 @@ public class X509CertSelector implements CertSelector, Cloneable
public boolean[] getKeyUsage()
{
if (keyUsage != null)
- return (boolean[]) keyUsage.clone();
- else
- return null;
+ return keyUsage.clone();
+ return null;
}
/**
@@ -400,9 +395,8 @@ public class X509CertSelector implements CertSelector, Cloneable
public byte[] getNameConstraints()
{
if (nameConstraints != null)
- return (byte[]) nameConstraints.clone();
- else
- return null;
+ return nameConstraints.clone();
+ return null;
}
public Collection<List<?>> getPathToNames()
@@ -413,7 +407,7 @@ public class X509CertSelector implements CertSelector, Cloneable
for (GeneralName name : pathToNames)
{
List<Object> n = new ArrayList<Object>(2);
- n.add(name.kind().tag());
+ n.add(Integer.valueOf(name.kind().tag()));
n.add(name.name());
names.add(n);
}
@@ -456,6 +450,7 @@ public class X509CertSelector implements CertSelector, Cloneable
*
* @return Null.
*/
+ @SuppressWarnings("static-method")
public Date getPrivateKeyValid()
{
return null;
@@ -489,7 +484,7 @@ public class X509CertSelector implements CertSelector, Cloneable
for (GeneralName name : altNames)
{
List<Object> n = new ArrayList<Object>(2);
- n.add(name.kind().tag());
+ n.add(Integer.valueOf(name.kind().tag()));
n.add(name.name());
names.add(n);
}
@@ -508,8 +503,7 @@ public class X509CertSelector implements CertSelector, Cloneable
{
if (subject != null)
return subject.getEncoded();
- else
- return null;
+ return null;
}
/**
@@ -522,8 +516,7 @@ public class X509CertSelector implements CertSelector, Cloneable
{
if (subject != null)
return subject.getName();
- else
- return null;
+ return null;
}
/**
@@ -536,9 +529,8 @@ public class X509CertSelector implements CertSelector, Cloneable
public byte[] getSubjectKeyIdentifier()
{
if (subjectKeyId != null)
- return (byte[]) subjectKeyId.clone();
- else
- return null;
+ return subjectKeyId.clone();
+ return null;
}
/**
@@ -571,17 +563,18 @@ public class X509CertSelector implements CertSelector, Cloneable
* @param certificate The certificate to check.
* @return true if the certificate matches all criteria.
*/
+ @Override
public boolean match(Certificate certificate)
{
if (!(certificate instanceof X509Certificate))
return false;
- X509Certificate cert = (X509Certificate) certificate;
- if (this.cert != null)
+ X509Certificate other = (X509Certificate) certificate;
+ if (cert != null)
{
try
{
- byte[] e1 = this.cert.getEncoded();
- byte[] e2 = cert.getEncoded();
+ byte[] e1 = cert.getEncoded();
+ byte[] e2 = other.getEncoded();
if (!Arrays.equals(e1, e2))
return false;
}
@@ -592,14 +585,14 @@ public class X509CertSelector implements CertSelector, Cloneable
}
if (serialNo != null)
{
- if (!serialNo.equals(cert.getSerialNumber()))
+ if (!serialNo.equals(other.getSerialNumber()))
return false;
}
if (certValid != null)
{
try
{
- cert.checkValidity(certValid);
+ other.checkValidity(certValid);
}
catch (CertificateException ce)
{
@@ -608,40 +601,40 @@ public class X509CertSelector implements CertSelector, Cloneable
}
if (issuer != null)
{
- if (!issuer.equals(cert.getIssuerX500Principal()))
+ if (!issuer.equals(other.getIssuerX500Principal()))
return false;
}
if (subject != null)
{
- if (!subject.equals(cert.getSubjectX500Principal()))
+ if (!subject.equals(other.getSubjectX500Principal()))
return false;
}
if (sigId != null)
{
- if (!sigId.toString().equals(cert.getSigAlgOID()))
+ if (!sigId.toString().equals(other.getSigAlgOID()))
return false;
}
if (subjectKeyId != null)
{
- byte[] b = cert.getExtensionValue(SUBJECT_KEY_ID);
+ byte[] b = other.getExtensionValue(SUBJECT_KEY_ID);
if (!Arrays.equals(b, subjectKeyId))
return false;
}
if (authKeyId != null)
{
- byte[] b = cert.getExtensionValue(AUTH_KEY_ID);
+ byte[] b = other.getExtensionValue(AUTH_KEY_ID);
if (!Arrays.equals(b, authKeyId))
return false;
}
if (keyUsage != null)
{
- boolean[] b = cert.getKeyUsage();
+ boolean[] b = other.getKeyUsage();
if (!Arrays.equals(b, keyUsage))
return false;
}
if (basicConstraints >= 0)
{
- if (cert.getBasicConstraints() != basicConstraints)
+ if (other.getBasicConstraints() != basicConstraints)
return false;
}
if (keyPurposeSet != null)
@@ -649,7 +642,7 @@ public class X509CertSelector implements CertSelector, Cloneable
List<String> kp = null;
try
{
- kp = cert.getExtendedKeyUsage();
+ kp = other.getExtendedKeyUsage();
}
catch (CertificateParsingException cpe)
{
@@ -668,7 +661,7 @@ public class X509CertSelector implements CertSelector, Cloneable
Collection<List<?>> an = null;
try
{
- an = cert.getSubjectAlternativeNames();
+ an = other.getSubjectAlternativeNames();
}
catch (CertificateParsingException cpe)
{
@@ -709,7 +702,7 @@ public class X509CertSelector implements CertSelector, Cloneable
}
if (nameConstraints != null)
{
- byte[] nc = cert.getExtensionValue(NAME_CONSTRAINTS_ID);
+ byte[] nc = other.getExtensionValue(NAME_CONSTRAINTS_ID);
if (!Arrays.equals(nameConstraints, nc))
return false;
}
@@ -717,15 +710,15 @@ public class X509CertSelector implements CertSelector, Cloneable
if (policy != null)
{
CertificatePolicies policies = null;
- if (cert instanceof GnuPKIExtension)
+ if (other instanceof GnuPKIExtension)
{
policies = (CertificatePolicies)
- ((GnuPKIExtension) cert).getExtension(CertificatePolicies.ID).getValue();
+ ((GnuPKIExtension) other).getExtension(CertificatePolicies.ID).getValue();
}
else
{
byte[] policiesDer =
- cert.getExtensionValue(CertificatePolicies.ID.toString());
+ other.getExtensionValue(CertificatePolicies.ID.toString());
try
{
policies = new CertificatePolicies(policiesDer);
@@ -745,16 +738,16 @@ public class X509CertSelector implements CertSelector, Cloneable
if (pathToNames != null)
{
NameConstraints nc = null;
- if (cert instanceof GnuPKIExtension)
+ if (other instanceof GnuPKIExtension)
{
Extension e =
- ((GnuPKIExtension) cert).getExtension(NameConstraints.ID);
+ ((GnuPKIExtension) other).getExtension(NameConstraints.ID);
if (e != null)
nc = (NameConstraints) e.getValue();
}
else
{
- byte[] b = cert.getExtensionValue(NameConstraints.ID.toString());
+ byte[] b = other.getExtensionValue(NameConstraints.ID.toString());
if (b != null)
{
try
@@ -957,6 +950,7 @@ public class X509CertSelector implements CertSelector, Cloneable
* @throws IOException If the argument is not a valid DER-encoded
* name constraints.
*/
+ @SuppressWarnings("unused")
public void setNameConstraints(byte[] nameConstraints)
throws IOException
{
@@ -965,7 +959,7 @@ public class X509CertSelector implements CertSelector, Cloneable
// But we just compare raw byte arrays.
this.nameConstraints = nameConstraints != null
- ? (byte[]) nameConstraints.clone() : null;
+ ? nameConstraints.clone() : null;
}
/**
@@ -1056,6 +1050,7 @@ public class X509CertSelector implements CertSelector, Cloneable
*
* @param UNUSED Is silently ignored.
*/
+ @SuppressWarnings("unused")
public void setPrivateKeyValid(Date UNUSED)
{
}
@@ -1216,8 +1211,7 @@ public class X509CertSelector implements CertSelector, Cloneable
try
{
KeyFactory enc = KeyFactory.getInstance("X.509");
- subjectKeySpec = (X509EncodedKeySpec)
- enc.getKeySpec(key, X509EncodedKeySpec.class);
+ subjectKeySpec = enc.getKeySpec(key, X509EncodedKeySpec.class);
}
catch (Exception x)
{
@@ -1256,6 +1250,7 @@ public class X509CertSelector implements CertSelector, Cloneable
this.sigId = null;
}
+ @Override
public String toString()
{
CPStringBuilder str = new CPStringBuilder(X509CertSelector.class.getName());
diff --git a/java/security/cert/X509Certificate.java b/java/security/cert/X509Certificate.java
index ab9e1be37..62a1e01eb 100644
--- a/java/security/cert/X509Certificate.java
+++ b/java/security/cert/X509Certificate.java
@@ -1,5 +1,5 @@
/* X509Certificate.java --- X.509 Certificate class
- Copyright (C) 1999,2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2003, 2006, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -488,6 +488,7 @@ public abstract class X509Certificate
* @throws CertificateParsingException If this extension cannot be
* parsed from its encoded form.
*/
+ @SuppressWarnings({"unused","static-method"})
public java.util.List<String> getExtendedKeyUsage()
throws CertificateParsingException
{
@@ -532,6 +533,7 @@ public abstract class X509Certificate
* be parsed.
* @since JDK 1.4
*/
+ @SuppressWarnings({"unused","static-method"})
public java.util.Collection<List<?>> getSubjectAlternativeNames()
throws CertificateParsingException
{
@@ -559,6 +561,7 @@ public abstract class X509Certificate
* be parsed.
* @since JDK 1.4
*/
+ @SuppressWarnings({"unused","static-method"})
public java.util.Collection<List<?>> getIssuerAlternativeNames()
throws CertificateParsingException
{
@@ -571,6 +574,7 @@ public abstract class X509Certificate
* @return The subject's X.500 distinguished name.
* @since JDK 1.4
*/
+ @SuppressWarnings("static-method")
public javax.security.auth.x500.X500Principal getSubjectX500Principal()
{
throw new UnsupportedOperationException();
@@ -582,6 +586,7 @@ public abstract class X509Certificate
* @return The issuer's X.500 distinguished name.
* @since JDK 1.4
*/
+ @SuppressWarnings("static-method")
public javax.security.auth.x500.X500Principal getIssuerX500Principal()
{
throw new UnsupportedOperationException();
diff --git a/java/security/spec/DSAParameterSpec.java b/java/security/spec/DSAParameterSpec.java
index f7f673110..a374910c1 100644
--- a/java/security/spec/DSAParameterSpec.java
+++ b/java/security/spec/DSAParameterSpec.java
@@ -1,5 +1,5 @@
/* DSAParameterSpec.java --- DSA Parameter Specificaton class
- Copyright (C) 1999, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2004, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -74,6 +74,7 @@ public class DSAParameterSpec implements AlgorithmParameterSpec, DSAParams
*
* @return Returns the requested BigInteger
*/
+ @Override
public BigInteger getP()
{
return this.p;
@@ -84,6 +85,7 @@ public class DSAParameterSpec implements AlgorithmParameterSpec, DSAParams
*
* @return Returns the requested BigInteger
*/
+ @Override
public BigInteger getQ()
{
return this.q;
@@ -94,6 +96,7 @@ public class DSAParameterSpec implements AlgorithmParameterSpec, DSAParams
*
* @return Returns the requested BigInteger
*/
+ @Override
public BigInteger getG()
{
return this.g;
diff --git a/java/security/spec/PKCS8EncodedKeySpec.java b/java/security/spec/PKCS8EncodedKeySpec.java
index 53b68de47..c064621f6 100644
--- a/java/security/spec/PKCS8EncodedKeySpec.java
+++ b/java/security/spec/PKCS8EncodedKeySpec.java
@@ -1,5 +1,5 @@
/* PKCS8EncodedKeySpec.java --- PKCS8 Encoded Key Specificaton class
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -63,6 +63,7 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec
@returns the encoded key
*/
+ @Override
public byte[] getEncoded()
{
return super.getEncoded();
@@ -73,6 +74,7 @@ public class PKCS8EncodedKeySpec extends EncodedKeySpec
@return a string representing the name
*/
+ @Override
public final String getFormat()
{
return "PKCS#8";
diff --git a/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java b/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
index 09b8438df..199c4036b 100644
--- a/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
+++ b/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java
@@ -1,5 +1,5 @@
-/* PSSParameterSpec.java --
- Copyright (C) 2003, Free Software Foundation, Inc.
+/* RSAMultiPrimePrivateCrtKeySpec.java --
+ Copyright (C) 2003, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -129,10 +129,11 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec
if (crtCoefficient == null)
throw new NullPointerException("crtCoefficient");
if (otherPrimeInfo != null)
- if (otherPrimeInfo.length == 0)
- throw new IllegalArgumentException();
- else
- this.otherPrimeInfo = (RSAOtherPrimeInfo[]) otherPrimeInfo.clone();
+ {
+ if (otherPrimeInfo.length == 0)
+ throw new IllegalArgumentException();
+ this.otherPrimeInfo = otherPrimeInfo.clone();
+ }
this.publicExponent = publicExponent;
this.primeP = primeP;
diff --git a/java/security/spec/X509EncodedKeySpec.java b/java/security/spec/X509EncodedKeySpec.java
index 8b50aaae1..3bc33d089 100644
--- a/java/security/spec/X509EncodedKeySpec.java
+++ b/java/security/spec/X509EncodedKeySpec.java
@@ -1,5 +1,5 @@
/* X509EncodedKeySpec.java --- X.509 Encoded Key Specificaton class
- Copyright (C) 1999, 2001 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -64,6 +64,7 @@ public class X509EncodedKeySpec extends EncodedKeySpec
@returns the encoded key
*/
+ @Override
public byte[] getEncoded()
{
return super.getEncoded();
@@ -74,6 +75,7 @@ public class X509EncodedKeySpec extends EncodedKeySpec
@return a string representing the name
*/
+ @Override
public final String getFormat()
{
return "X.509";