Merge branch 'security-stable-2.107' into security-stable-2.121

This commit is contained in:
Jeff Thompson committed 2019-01-03 09:55:20 -07:00
commit 0916e5bd3c
25 files changed
+2105 -25

No files matched your search

+15 -1
View File
@@ -92,8 +92,9 @@ import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.FileUtils;
import org.kohsuke.stapler.Ancestor;
import org.kohsuke.stapler.StaplerRequest;
/**
* Various utility methods that don't have more proper home.
@@ -1663,6 +1664,19 @@ public class Util {
}
}
/**
* Find the specific ancestor, or throw an exception.
* Useful for an ancestor we know is inside the URL to ease readability
*/
@Restricted(NoExternalUse.class)
public static @Nonnull <T> T getNearestAncestorOfTypeOrThrow(@Nonnull StaplerRequest request, @Nonnull Class<T> clazz) {
T t = request.findAncestorObject(clazz);
if (t == null) {
throw new IllegalArgumentException("No ancestor of type " + clazz.getName() + " in the request");
}
return t;
}
public static final FastDateFormat XS_DATETIME_FORMATTER = FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss'Z'",new SimpleTimeZone(0,"GMT"));
// Note: RFC822 dates must not be localized!