From ce2c59ec848a4744639b3272c1fd2e4e2bdd69ce Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 14 Jan 2009 09:27:51 +0000 Subject: [PATCH] Java 5 code style --- .../web/servlet/handler/SimpleServletPostProcessor.java | 8 ++++---- .../servlet/handler/UserRoleAuthorizationInterceptor.java | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java index 37b7dddeb9..a6dccad590 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/SimpleServletPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ package org.springframework.web.servlet.handler; import java.util.Collections; import java.util.Enumeration; - +import java.util.HashSet; import javax.servlet.Servlet; import javax.servlet.ServletConfig; import javax.servlet.ServletContext; @@ -149,8 +149,8 @@ public class SimpleServletPostProcessor implements return null; } - public Enumeration getInitParameterNames() { - return Collections.enumeration(Collections.EMPTY_SET); + public Enumeration getInitParameterNames() { + return Collections.enumeration(new HashSet()); } } diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java index c1309bf939..050d7d7927 100644 --- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java +++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/handler/UserRoleAuthorizationInterceptor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006 the original author or authors. + * Copyright 2002-2008 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.springframework.web.servlet.handler; import java.io.IOException; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -49,8 +48,8 @@ public class UserRoleAuthorizationInterceptor extends HandlerInterceptorAdapter throws ServletException, IOException { if (this.authorizedRoles != null) { - for (int i = 0; i < this.authorizedRoles.length; i++) { - if (request.isUserInRole(this.authorizedRoles[i])) { + for (String role : this.authorizedRoles) { + if (request.isUserInRole(role)) { return true; } }