getParameters() does not throw a DataValidationException. Also made methods
return interfaces. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2600 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -27,10 +27,12 @@ import java.util.Date;
|
|||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import com.samskivert.util.ArrayIntSet;
|
import com.samskivert.util.ArrayIntSet;
|
||||||
|
import com.samskivert.util.IntSet;
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -135,11 +137,11 @@ public class ParameterUtil
|
|||||||
* IntSet. If the parameter does not exist or is not a well-formed integer, a data validation
|
* IntSet. If the parameter does not exist or is not a well-formed integer, a data validation
|
||||||
* exception is thrown with the supplied message.
|
* exception is thrown with the supplied message.
|
||||||
*/
|
*/
|
||||||
public static ArrayIntSet getIntParameters (
|
public static IntSet getIntParameters (
|
||||||
HttpServletRequest req, String name, String invalidDataMessage)
|
HttpServletRequest req, String name, String invalidDataMessage)
|
||||||
throws DataValidationException
|
throws DataValidationException
|
||||||
{
|
{
|
||||||
ArrayIntSet ints = new ArrayIntSet();
|
IntSet ints = new ArrayIntSet();
|
||||||
String[] values = req.getParameterValues(name);
|
String[] values = req.getParameterValues(name);
|
||||||
if (values != null) {
|
if (values != null) {
|
||||||
for (int ii = 0; ii < values.length; ii++) {
|
for (int ii = 0; ii < values.length; ii++) {
|
||||||
@@ -152,13 +154,11 @@ public class ParameterUtil
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetches all the values from the request with the specified name and converts them to a
|
* Fetches all the values from the request with the specified name and converts them to a Set.
|
||||||
* HashSet.
|
|
||||||
*/
|
*/
|
||||||
public static HashSet<String> getParameters (HttpServletRequest req, String name)
|
public static Set<String> getParameters (HttpServletRequest req, String name)
|
||||||
throws DataValidationException
|
|
||||||
{
|
{
|
||||||
HashSet<String> set = new HashSet<String>();
|
Set<String> set = new HashSet<String>();
|
||||||
String[] values = req.getParameterValues(name);
|
String[] values = req.getParameterValues(name);
|
||||||
if (values != null) {
|
if (values != null) {
|
||||||
for (int ii = 0; ii < values.length; ii++) {
|
for (int ii = 0; ii < values.length; ii++) {
|
||||||
|
|||||||
Reference in New Issue
Block a user