Skip to content

Commit

Permalink
Merged in SHIBUI-899 (pull request #201)
Browse files Browse the repository at this point in the history
SHIBUI-899

Approved-by: Bill Smith <wsmith@unicon.net>
  • Loading branch information
Bill Smith authored and Jonathan Johnson committed Sep 26, 2018
2 parents c10e492 + 60869cf commit 8dc34cb
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import org.apache.http.impl.client.HttpClients;
import org.apache.lucene.index.IndexWriter;
import org.joda.time.DateTime;
import org.joda.time.chrono.ISOChronology;
import org.opensaml.saml.metadata.resolver.filter.FilterException;
import org.opensaml.saml.metadata.resolver.filter.MetadataFilterChain;
import org.opensaml.saml.metadata.resolver.impl.FileBackedHTTPMetadataResolver;
Expand Down Expand Up @@ -92,4 +93,34 @@ public void refilter() {
logger.error("An error occurred while attempting to filter metadata!", e);
}
}

//TODO: This is a band-aid for the negative refresh issue. This override should go away once we figure out
// why the negative refresh is occurring.
@Override
public synchronized void refresh() throws ResolverException {
// In case a destroy() thread beat this thread into the monitor.
if (isDestroyed()) {
return;
}

try {

DateTime now = new DateTime(ISOChronology.getInstanceUTC());
String mdId = getMetadataIdentifier();

final byte[] mdBytes = fetchMetadata();
if (mdBytes == null) {
processCachedMetadata(mdId, now);
} else {
processNewMetadata(mdId, now, mdBytes);
}
} catch (final Throwable t) {
if (t instanceof Exception) {
throw new ResolverException((Exception) t);
} else {
throw new ResolverException(String.format("Saw an error of type '%s' with message '%s'",
t.getClass().getName(), t.getMessage()));
}
}
}
}

0 comments on commit 8dc34cb

Please sign in to comment.