Don't startup an ARP Cache if the TTL is 0.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 28 Jan 2003 23:09:15 +0000 (23:09 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Tue, 28 Jan 2003 23:09:15 +0000 (23:09 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@433 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/arp/provider/BaseArpRepository.java

index d954efe..390c30c 100755 (executable)
@@ -79,18 +79,31 @@ public abstract class BaseArpRepository implements ArpRepository {
        private static Logger log = Logger.getLogger(BaseArpRepository.class.getName());
        private ArpCache arpCache;
 
-       BaseArpRepository(Properties properties) {
-               if (properties
-                       .getProperty(
-                               "edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL",
-                               null)
-                       != null) {
-                       arpCache = ArpCache.instance();
-                       arpCache.setCacheLength(
-                               Long.parseLong(
-                                       properties.getProperty(
-                                               "edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL",
-                                               null)));
+       BaseArpRepository(Properties properties) throws ArpRepositoryException {
+               try {
+                       if (properties
+                               .getProperty(
+                                       "edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL",
+                                       null)
+                               != null) {
+                               if (Long
+                                       .parseLong(
+                                               properties.getProperty(
+                                                       "edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL",
+                                                       null))
+                                       != 0) {
+                                       arpCache = ArpCache.instance();
+                                       arpCache.setCacheLength(
+                                               Long.parseLong(
+                                                       properties.getProperty(
+                                                               "edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL",
+                                                               null)));
+                               }
+                       }
+               } catch (NumberFormatException nfe) {
+                       log.error(
+                               "Value for (edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL) must be a long integer.");
+                       throw new ArpRepositoryException("Value for (edu.internet2.middleware.shibboleth.aa.arp.BaseArpRepository.ArpTTL) must be a long integer.");
                }
        }