[java-opensaml2 COMMIT] in /branches/REL_2: doc/RELEASE-NOTES.txt src/main/java/org/opensaml/saml2/metadata/provider/...
noreply at shibboleth.net
noreply at shibboleth.net
Sat Jan 9 20:22:22 EST 2016
Author: putmanb
Date: Sat Jan 9 20:22:21 2016
New Revision: 1689
URL: http://svn.shibboleth.net/view/java-opensaml2?rev=1689&view=rev
Log:
JOST-244: durations in log messages should be given in ISO format, not milliseconds
Modified:
branches/REL_2/doc/RELEASE-NOTES.txt
branches/REL_2/src/main/java/org/opensaml/saml2/metadata/provider/RequiredValidUntilFilter.java
Modified: branches/REL_2/doc/RELEASE-NOTES.txt
URL: http://svn.shibboleth.net/view/java-opensaml2/branches/REL_2/doc/RELEASE-NOTES.txt?rev=1689&r1=1688&r2=1689&view=diff
==============================================================================
--- branches/REL_2/doc/RELEASE-NOTES.txt (original)
+++ branches/REL_2/doc/RELEASE-NOTES.txt Sat Jan 9 20:22:21 2016
@@ -1,6 +1,7 @@
Changes in Release 2.6.6
=============================================
[JOST-243] - Metadata reload errors logged on DEBUG only
+[JOST-244] - durations in log messages should be given in ISO format, not milliseconds
[JOST-245] - BaseSAML2MessageDecoder tries to get SAML1 role descriptor
Changes in Release 2.6.5
Modified: branches/REL_2/src/main/java/org/opensaml/saml2/metadata/provider/RequiredValidUntilFilter.java
URL: http://svn.shibboleth.net/view/java-opensaml2/branches/REL_2/src/main/java/org/opensaml/saml2/metadata/provider/RequiredValidUntilFilter.java?rev=1689&r1=1688&r2=1689&view=diff
==============================================================================
--- branches/REL_2/src/main/java/org/opensaml/saml2/metadata/provider/RequiredValidUntilFilter.java (original)
+++ branches/REL_2/src/main/java/org/opensaml/saml2/metadata/provider/RequiredValidUntilFilter.java Sat Jan 9 20:22:21 2016
@@ -16,6 +16,9 @@
*/
package org.opensaml.saml2.metadata.provider;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
import org.joda.time.DateTime;
import org.joda.time.chrono.ISOChronology;
@@ -40,10 +43,13 @@
/** The maximum interval, in milliseconds, between now and the <code>validUntil</code> date. */
private long maxValidityInterval;
+
+ /** DatatypeFactory used to convert duration to string representation. */
+ private DatatypeFactory dataTypeFactory;
/** Constructor. */
public RequiredValidUntilFilter() {
- maxValidityInterval = 0;
+ this(0);
}
/**
@@ -53,11 +59,16 @@
*/
public RequiredValidUntilFilter(long maxValidity) {
this.maxValidityInterval = maxValidity * 1000;
+ try {
+ dataTypeFactory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException e) {
+ throw new RuntimeException("JVM is required to support XML DatatypeFactory but it does not", e);
+ }
}
/**
- * Gets the maximum internal, in milliseconds, between now and the <code>validUntil</code> date. A value of less than 1
- * indicates that there is no restriction.
+ * Gets the maximum internal, in milliseconds, between now and the <code>validUntil</code> date.
+ * A value of less than 1 indicates that there is no restriction.
*
* @return maximum internal, in milliseconds, between now and the <code>validUntil</code> date
*/
@@ -77,8 +88,9 @@
if (maxValidityInterval > 0 && validUntil.isAfter(now)) {
long validityInterval = validUntil.getMillis() - now.getMillis();
if (validityInterval > maxValidityInterval) {
- throw new FilterException("Metadata's validity interval, " + validityInterval
- + "ms, is larger than is allowed, " + maxValidityInterval + "ms.");
+ throw new FilterException(String.format("Metadata's validity interval %s is larger than is allowed %s",
+ dataTypeFactory.newDuration(validityInterval).toString(),
+ dataTypeFactory.newDuration(maxValidityInterval).toString()));
}
}
}
More information about the commits
mailing list