diff options
Diffstat (limited to 'moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java')
-rw-r--r-- | moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java | 104 |
1 files changed, 52 insertions, 52 deletions
diff --git a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java index d752a63..d1b776b 100644 --- a/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java +++ b/moaSig/moa-sig-lib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/config/CRLRetriever.java @@ -23,13 +23,6 @@ package at.gv.egovernment.moa.spss.server.iaik.config; -import iaik.logging.TransactionId; -import iaik.pki.revocation.RevocationSourceTypes; -import iaik.pki.store.revocation.RevocationInfoRetriever; -import iaik.pki.store.revocation.RevocationSource; -import iaik.pki.store.revocation.RevocationStoreException; -import iaik.pki.ldap.Handler; - import java.io.InputStream; import java.net.MalformedURLException; import java.net.URL; @@ -39,6 +32,12 @@ import java.util.Collection; import java.util.Date; import at.gv.egovernment.moaspss.logging.Logger; +import iaik.logging.TransactionId; +import iaik.pki.ldap.Handler; +import iaik.pki.revocation.RevocationSourceTypes; +import iaik.pki.store.revocation.RevocationInfoRetriever; +import iaik.pki.store.revocation.RevocationSource; +import iaik.pki.store.revocation.RevocationStoreException; /** * A customized implementation of @@ -47,55 +46,56 @@ import at.gv.egovernment.moaspss.logging.Logger; * {@link iaik.pki.store.revocation.CRLRetriever} to overcome a classloader * problem in connection with the {@link java.net.URL} class in a Tomcat * deployment environment. - * + * * @author Gregor Karlinger * @version $$ */ public class CRLRetriever implements RevocationInfoRetriever { - - private int connectTimeout = 5; - private int readTimeout = 5; - - - public void update(RevocationSource source, Collection supplementalRequestData, TransactionId tid) - throws RevocationStoreException { - if (source == null) { - throw new NullPointerException("RevocationSource parameter mustn't be null."); - } - Logger.info("Downloading crl from " + source.getUri()); - if (!source.getType().equals(RevocationSourceTypes.CRL)) { - throw new RevocationStoreException(source.getType() + " not supported", null, getClass().getName() + ":1"); - } - try { - URL crlUrl; - try { - crlUrl = new URL(source.getUri()); - } catch (MalformedURLException e) { - // Workaround for classloader problem with deployment in Tomcat - // 4.1 - URLStreamHandler handler = new Handler(); - crlUrl = new URL(null, source.getUri(), handler); - } - URLConnection con = crlUrl.openConnection(); - con.setConnectTimeout(connectTimeout); - con.setReadTimeout(readTimeout); - InputStream crlInputStream = con.getInputStream(); - source.readFrom(crlInputStream, tid); - source.setDownloadTime(new Date()); - crlInputStream.close(); - } catch (Exception iox) { - Logger.warn("Cannot retrieve crl", iox); - throw new RevocationStoreException("Cannot retrieve CRL", iox, getClass().getName() + ":1"); - } - } - @Override - public void setConnectTimeout(int arg0) { - this.connectTimeout = arg0; - } + private int connectTimeout = 5; + private int readTimeout = 5; + + @Override + public void update(RevocationSource source, Collection supplementalRequestData, TransactionId tid) + throws RevocationStoreException { + if (source == null) { + throw new NullPointerException("RevocationSource parameter mustn't be null."); + } + Logger.info("Downloading crl from " + source.getUri()); + if (!source.getType().equals(RevocationSourceTypes.CRL)) { + throw new RevocationStoreException(source.getType() + " not supported", null, getClass().getName() + + ":1"); + } + try { + URL crlUrl; + try { + crlUrl = new URL(source.getUri()); + } catch (final MalformedURLException e) { + // Workaround for classloader problem with deployment in Tomcat + // 4.1 + final URLStreamHandler handler = new Handler(); + crlUrl = new URL(null, source.getUri(), handler); + } + final URLConnection con = crlUrl.openConnection(); + con.setConnectTimeout(connectTimeout); + con.setReadTimeout(readTimeout); + final InputStream crlInputStream = con.getInputStream(); + source.readFrom(crlInputStream, tid); + source.setDownloadTime(new Date()); + crlInputStream.close(); + } catch (final Exception iox) { + Logger.warn("Cannot retrieve crl", iox); + throw new RevocationStoreException("Cannot retrieve CRL", iox, getClass().getName() + ":1"); + } + } + + @Override + public void setConnectTimeout(int arg0) { + this.connectTimeout = arg0; + } - @Override - public void setReadTimeout(int arg0) { - this.readTimeout = arg0; - } + @Override + public void setReadTimeout(int arg0) { + this.readTimeout = arg0; + } } |