Author: chris.laprun(a)jboss.com
Date: 2009-01-20 19:29:06 -0500 (Tue, 20 Jan 2009)
New Revision: 12580
Removed:
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/ParameterSanitizer.java
Modified:
branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/servlet/DynaAjaxServlet.java
Log:
- JBPORTAL-2275: Replaced ParameterSanitizer by ParameterValidation.
- Use common SNAPSHOT to get latest ParameterValidation version.
Modified: branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml
===================================================================
--- branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2009-01-20 22:52:06 UTC
(rev 12579)
+++ branches/JBoss_Portal_Branch_2_7/build/build-thirdparty.xml 2009-01-21 00:29:06 UTC
(rev 12580)
@@ -1,4 +1,27 @@
<?xml version="1.0"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
<project name="main.build" default="synchronize"
basedir=".">
<!-- Property File definitions -->
@@ -41,7 +64,7 @@
are pushed to the
http://repository.jboss.com site.
-->
- <componentref name="jboss-portal/modules/common"
version="1.2.3"/>
+ <componentref name="jboss-portal/modules/common"
version="trunk-SNAPSHOT"/>
<componentref name="jboss-portal/modules/web"
version="1.2.3"/>
<componentref name="jboss-portal/modules/test"
version="1.0.4"/>
<componentref name="jboss-portal/modules/portlet"
version="2.0.5"/>
Modified: branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp 2009-01-20
22:52:06 UTC (rev 12579)
+++
branches/JBoss_Portal_Branch_2_7/core/src/resources/portal-server-war/login.jsp 2009-01-21
00:29:06 UTC (rev 12580)
@@ -1,36 +1,35 @@
<%--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ JBoss, a division of Red Hat ~
- ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
- ~ contributors as indicated by the @authors tag. See the ~
- ~ copyright.txt in the distribution for a full listing of ~
- ~ individual contributors. ~
- ~ ~
- ~ This is free software; you can redistribute it and/or modify it ~
- ~ under the terms of the GNU Lesser General Public License as ~
- ~ published by the Free Software Foundation; either version 2.1 of ~
- ~ the License, or (at your option) any later version. ~
- ~ ~
- ~ This software is distributed in the hope that it will be useful, ~
- ~ but WITHOUT ANY WARRANTY; without even the implied warranty of ~
- ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ~
- ~ Lesser General Public License for more details. ~
- ~ ~
- ~ You should have received a copy of the GNU Lesser General Public ~
- ~ License along with this software; if not, write to the Free ~
- ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ Copyright 2009, Red Hat Middleware, LLC, and individual
+ ~ contributors as indicated by the @authors tag. See the
+ ~ copyright.txt in the distribution for a full listing of
+ ~ individual contributors.
+ ~
+ ~ This is free software; you can redistribute it and/or modify it
+ ~ under the terms of the GNU Lesser General Public License as
+ ~ published by the Free Software Foundation; either version 2.1 of
+ ~ the License, or (at your option) any later version.
+ ~
+ ~ This software is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ ~ Lesser General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Lesser General Public
+ ~ License along with this software; if not, write to the Free
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--%>
<%@ page pageEncoding="utf-8" %>
+<%@page import="org.jboss.portal.common.util.ParameterValidation" %>
<%@page import="org.jboss.portal.identity.UserStatus" %>
-<%@page import="org.jboss.portal.server.ParameterSanitizer" %>
<%@page import="java.util.ResourceBundle" %>
<%
ResourceBundle rb = ResourceBundle.getBundle("Resource",
request.getLocale());
- // todo: use ParameterValidation.sanitize after 2.7.1
String loginheight = request.getParameter("loginheight");
boolean paramPresent = loginheight != null;
- loginheight = ParameterSanitizer.sanitizeFromPattern(loginheight,
ParameterSanitizer.CSS_DISTANCE, "300px");
+ loginheight = ParameterValidation.sanitizeFromPattern(loginheight,
ParameterValidation.CSS_DISTANCE, "300px");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Deleted:
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/ParameterSanitizer.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/ParameterSanitizer.java 2009-01-20
22:52:06 UTC (rev 12579)
+++
branches/JBoss_Portal_Branch_2_7/server/src/main/org/jboss/portal/server/ParameterSanitizer.java 2009-01-21
00:29:06 UTC (rev 12580)
@@ -1,71 +0,0 @@
-/*
-* JBoss, a division of Red Hat
-* Copyright 2008, Red Hat Middleware, LLC, and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
-*/
-
-package org.jboss.portal.server;
-
-import org.jboss.portal.common.util.ParameterValidation;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- * TODO
- *
- * @author <a href="mailto:chris.laprun@jboss.com">Chris
Laprun</a>
- * @version $Revision$
- * @deprecated Should use {@link
org.jboss.portal.common.util.ParameterValidation#sanitize*} instead starting with
- * 2.7.2
- */
-public class ParameterSanitizer
-{
- public final static Pattern CSS_DISTANCE =
Pattern.compile("\\d+\\W*(em|ex|px|in|cm|mm|pt|pc|%)?");
-
- public static String sanitizeFromPattern(String value, Pattern regex, String
defaultValue)
- {
- ParameterValidation.throwIllegalArgExceptionIfNull(regex, "expected value
format");
-
- if (value == null || !regex.matcher(value).matches())
- {
- return defaultValue;
- }
- else
- {
- return value;
- }
- }
-
- public static String sanitizeFromValues(String value, String[] possibleValues, String
defaultValue)
- {
- ParameterValidation.throwIllegalArgExceptionIfNullOrEmpty(possibleValues,
"possible values");
-
- List<String> values = Arrays.asList(possibleValues);
- if (!values.contains(value))
- {
- return defaultValue;
- }
- else
- {
- return value;
- }
- }
-}
Modified:
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/servlet/DynaAjaxServlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/servlet/DynaAjaxServlet.java 2009-01-20
22:52:06 UTC (rev 12579)
+++
branches/JBoss_Portal_Branch_2_7/theme/src/main/org/jboss/portal/theme/servlet/DynaAjaxServlet.java 2009-01-21
00:29:06 UTC (rev 12580)
@@ -1,6 +1,6 @@
/******************************************************************************
* JBoss, a division of Red Hat *
- * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * Copyright 2009, Red Hat Middleware, LLC, and individual *
* contributors as indicated by the @authors tag. See the *
* copyright.txt in the distribution for a full listing of *
* individual contributors. *
@@ -23,7 +23,7 @@
package org.jboss.portal.theme.servlet;
-import org.jboss.portal.server.ParameterSanitizer;
+import org.jboss.portal.common.util.ParameterValidation;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
@@ -52,7 +52,7 @@
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException
{
String actionValue = req.getParameter(ACTION);
- String response = ParameterSanitizer.sanitizeFromValues(actionValue,
POSSIBLE_ACTION_VALUES, DEFAULT_RESPONSE);
+ String response = ParameterValidation.sanitizeFromValues(actionValue,
POSSIBLE_ACTION_VALUES, DEFAULT_RESPONSE);
sendResp(resp, response);
}