Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return null instead of throwing exception when querystring parameter is missing #5326

Merged
merged 1 commit into from
Jun 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ private abstract static class AbstractStringReader<T> implements ParamConverter<
@Override
public T fromString(final String value) {
if (value == null) {
throw new IllegalArgumentException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value"));
return null;
}
try {
return _fromString(value);
Expand All @@ -85,7 +85,7 @@ public T fromString(final String value) {
@Override
public String toString(final T value) throws IllegalArgumentException {
if (value == null) {
throw new IllegalArgumentException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value"));
return null;
}
return value.toString();
}
Expand Down Expand Up @@ -193,7 +193,6 @@ public <T> ParamConverter<T> getConverter(final Class<T> rawType,
public T fromString(String value) {
if (value == null || value.isEmpty()) {
return null;
// throw new IllegalStateException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value"));
}

if (value.length() == 1) {
Expand All @@ -206,7 +205,7 @@ public T fromString(String value) {
@Override
public String toString(T value) {
if (value == null) {
throw new IllegalArgumentException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value"));
return null;
}
return value.toString();
}
Expand Down Expand Up @@ -246,7 +245,7 @@ public T fromString(final String value) {
@Override
public String toString(final T value) throws IllegalArgumentException {
if (value == null) {
throw new IllegalArgumentException(LocalizationMessages.METHOD_PARAMETER_CANNOT_BE_NULL("value"));
return null;
}
return value.toString();
}
Expand Down