mirror of https://github.com/apache/poi.git
[bug-66475] SignatureConfig: remove ThreadLocals and deprecated code associated with them
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1907579 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
dc91cdbaaa
commit
28a26d9cb2
|
@ -125,12 +125,6 @@ public class SignatureConfig {
|
|||
Office2010SignatureFacet::new
|
||||
);
|
||||
|
||||
|
||||
private final ThreadLocal<OPCPackage> opcPackage = new ThreadLocal<>();
|
||||
private final ThreadLocal<XMLSignatureFactory> signatureFactory = new ThreadLocal<>();
|
||||
private final ThreadLocal<KeyInfoFactory> keyInfoFactory = new ThreadLocal<>();
|
||||
private final ThreadLocal<Provider> provider = new ThreadLocal<>();
|
||||
|
||||
private List<SignatureFacet> signatureFacets = new ArrayList<>();
|
||||
private HashAlgorithm digestAlgo = HashAlgorithm.sha256;
|
||||
private Date executionTime = new Date();
|
||||
|
@ -324,28 +318,6 @@ public class SignatureConfig {
|
|||
this.digestAlgo = digestAlgo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the opc package to be used by this thread, stored as thread-local
|
||||
*
|
||||
* @deprecated in POI 5.0.0 - use {@link SignatureInfo#setOpcPackage(OPCPackage)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public OPCPackage getOpcPackage() {
|
||||
return opcPackage.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param opcPackage the opc package to be handled by this thread, stored as thread-local
|
||||
*
|
||||
* @deprecated in POI 5.0.0 - use {@link SignatureInfo#setOpcPackage(OPCPackage)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public void setOpcPackage(OPCPackage opcPackage) {
|
||||
this.opcPackage.set(opcPackage);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the private key
|
||||
*/
|
||||
|
@ -1011,74 +983,6 @@ public class SignatureConfig {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param signatureFactory the xml signature factory, saved as thread-local
|
||||
*
|
||||
* @deprecated in POI 5.0.0 - use {@link SignatureInfo#setSignatureFactory(XMLSignatureFactory)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public void setSignatureFactory(XMLSignatureFactory signatureFactory) {
|
||||
this.signatureFactory.set(signatureFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the xml signature factory (thread-local)
|
||||
*
|
||||
* @deprecated in POI 5.0.0 - will be handled by SignatureInfo internally
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public XMLSignatureFactory getSignatureFactory() {
|
||||
return signatureFactory.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keyInfoFactory the key factory, saved as thread-local
|
||||
*
|
||||
* @deprecated in POI 5.0.0 - use {@link SignatureInfo#setKeyInfoFactory(KeyInfoFactory)}
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public void setKeyInfoFactory(KeyInfoFactory keyInfoFactory) {
|
||||
this.keyInfoFactory.set(keyInfoFactory);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the key factory (thread-local)
|
||||
*
|
||||
* @deprecated in POI 5.0.0 - will be handled by SignatureInfo internally
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public KeyInfoFactory getKeyInfoFactory() {
|
||||
return keyInfoFactory.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to set provider
|
||||
* @param provider the provider
|
||||
* @deprecated in POI 5.0.0 - use {@link SignatureInfo#setProvider(Provider)}
|
||||
*/
|
||||
@Internal
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public void setProvider(Provider provider) {
|
||||
this.provider.set(provider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cached provider or null if not set before
|
||||
*
|
||||
* @deprecated in POI 5.0.0 - will be handled by SignatureInfo internally
|
||||
*/
|
||||
@Deprecated
|
||||
@Removal(version = "5.0.0")
|
||||
public Provider getProvider() {
|
||||
return provider.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the possible classes for XMLSEC.
|
||||
* The order is
|
||||
|
|
|
@ -626,33 +626,18 @@ public class SignatureInfo {
|
|||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
protected void initXmlProvider() {
|
||||
if (opcPackage == null) {
|
||||
opcPackage = signatureConfig.getOpcPackage();
|
||||
}
|
||||
if (provider == null) {
|
||||
provider = signatureConfig.getProvider();
|
||||
if (provider == null) {
|
||||
provider = XmlProviderInitSingleton.getInstance().findProvider();
|
||||
}
|
||||
}
|
||||
if (signatureFactory == null) {
|
||||
signatureFactory = signatureConfig.getSignatureFactory();
|
||||
if (signatureFactory == null) {
|
||||
signatureFactory = XMLSignatureFactory.getInstance("DOM", provider);
|
||||
}
|
||||
}
|
||||
if (keyInfoFactory == null) {
|
||||
keyInfoFactory = signatureConfig.getKeyInfoFactory();
|
||||
if (keyInfoFactory == null) {
|
||||
keyInfoFactory = KeyInfoFactory.getInstance("DOM", provider);
|
||||
}
|
||||
}
|
||||
if (uriDereferencer == null) {
|
||||
uriDereferencer = signatureConfig.getUriDereferencer();
|
||||
if (uriDereferencer == null) {
|
||||
uriDereferencer = new OOXMLURIDereferencer();
|
||||
}
|
||||
}
|
||||
if (uriDereferencer instanceof OOXMLURIDereferencer) {
|
||||
((OOXMLURIDereferencer)uriDereferencer).setSignatureInfo(this);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue