[java-support] 01/04: Add missing init/destroy guards t0 methods.
Ian Young
ian at iay.org.uk
Mon Oct 2 10:42:13 EDT 2017
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch master
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=3ebfadc5be4b546972555d95043460f54774b897
commit 3ebfadc5be4b546972555d95043460f54774b897
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Sep 27 21:02:42 2017 -0400
Add missing init/destroy guards t0 methods.
---
.../utilities/java/support/net/CookieManager.java | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/net/CookieManager.java b/src/main/java/net/shibboleth/utilities/java/support/net/CookieManager.java
index 9f7e84e..657c38a 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/net/CookieManager.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/net/CookieManager.java
@@ -77,6 +77,7 @@ public final class CookieManager extends AbstractInitializableComponent {
*/
public void setCookiePath(@Nullable final String path) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
cookiePath = StringSupport.trimOrNull(path);
}
@@ -88,6 +89,7 @@ public final class CookieManager extends AbstractInitializableComponent {
*/
public void setCookieDomain(@Nullable final String domain) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
cookieDomain = StringSupport.trimOrNull(domain);
}
@@ -99,6 +101,7 @@ public final class CookieManager extends AbstractInitializableComponent {
*/
public void setHttpServletRequest(@Nonnull final HttpServletRequest request) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
httpRequest = Constraint.isNotNull(request, "HttpServletRequest cannot be null");
}
@@ -110,6 +113,7 @@ public final class CookieManager extends AbstractInitializableComponent {
*/
public void setHttpServletResponse(@Nonnull final HttpServletResponse response) {
ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
httpResponse = Constraint.isNotNull(response, "HttpServletResponse cannot be null");
}
@@ -120,6 +124,9 @@ public final class CookieManager extends AbstractInitializableComponent {
* @param flag flag to set
*/
public void setSecure(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
secure = flag;
}
@@ -130,6 +137,9 @@ public final class CookieManager extends AbstractInitializableComponent {
* @param flag flag to set
*/
public void setHttpOnly(final boolean flag) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
httpOnly = flag;
}
@@ -139,6 +149,9 @@ public final class CookieManager extends AbstractInitializableComponent {
* @param age max age to set
*/
public void setMaxAge(final int age) {
+ ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
maxAge = age;
}
@@ -158,6 +171,9 @@ public final class CookieManager extends AbstractInitializableComponent {
* @param value value of cookie
*/
@Nullable public void addCookie(@Nonnull @NotEmpty final String name, @Nonnull @NotEmpty final String value) {
+ ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
final Cookie cookie = new Cookie(name, value);
cookie.setPath(cookiePath != null ? cookiePath : contextPathToCookiePath());
if (cookieDomain != null) {
@@ -176,6 +192,9 @@ public final class CookieManager extends AbstractInitializableComponent {
* @param name name of cookie
*/
@Nullable public void unsetCookie(@Nonnull @NotEmpty final String name) {
+ ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
+
final Cookie cookie = new Cookie(name, null);
cookie.setPath(cookiePath != null ? cookiePath : contextPathToCookiePath());
if (cookieDomain != null) {
@@ -215,6 +234,8 @@ public final class CookieManager extends AbstractInitializableComponent {
* @return cookie value
*/
@Nullable public String getCookieValue(@Nonnull @NotEmpty final String name, @Nullable final String defValue) {
+ ComponentSupport.ifNotInitializedThrowUninitializedComponentException(this);
+ ComponentSupport.ifDestroyedThrowDestroyedComponentException(this);
final Cookie[] cookies = httpRequest.getCookies();
if (cookies != null) {
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list