diff options
| author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2015-03-11 21:16:43 +0000 |
|---|---|---|
| committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2015-03-11 21:18:20 +0000 |
| commit | 229a0915fbb027f0bbb4ce9b0981bc4cd2d5472e (patch) | |
| tree | e6812d61e42be65c353c298931999cfc99e9561f /java/security/cert | |
| parent | a09acb2a1f9dc481c980ab38e19f510581e43ea8 (diff) | |
| download | classpath-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/cert')
22 files changed, 133 insertions, 268 deletions
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(); |
