Skip to content

Commit

Permalink
RESTEASY-2519 (#2320)
Browse files Browse the repository at this point in the history
* RESTEASY-2519

* update
  • Loading branch information
liweinan authored and asoldano committed Mar 24, 2020
1 parent 3168caa commit caef05a
Showing 1 changed file with 17 additions and 6 deletions.
@@ -1,5 +1,6 @@
package org.jboss.resteasy.core;

import java.io.UnsupportedEncodingException;
import java.lang.annotation.Annotation;
import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Array;
Expand All @@ -9,6 +10,8 @@
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -731,11 +734,11 @@ else if (constructor != null)
}
catch (InstantiationException e)
{
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), strVal, target), e);
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), _encode(strVal), target), e);
}
catch (IllegalAccessException e)
{
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), strVal, target), e);
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), _encode(strVal), target), e);
}
catch (InvocationTargetException e)
{
Expand All @@ -744,7 +747,7 @@ else if (constructor != null)
{
throw ((WebApplicationException)targetException);
}
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), strVal, target), targetException);
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), _encode(strVal), target), targetException);
}
}
else if (valueOf != null)
Expand All @@ -755,7 +758,7 @@ else if (valueOf != null)
}
catch (IllegalAccessException e)
{
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), strVal, target), e);
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), _encode(strVal), target), e);
}
catch (InvocationTargetException e)
{
Expand All @@ -764,7 +767,7 @@ else if (valueOf != null)
{
throw ((WebApplicationException)targetException);
}
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), strVal, target), targetException);
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), _encode(strVal), target), targetException);
}
}
try
Expand All @@ -773,11 +776,19 @@ else if (valueOf != null)
}
catch (Exception e)
{
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), strVal, target), e);
throwProcessingException(Messages.MESSAGES.unableToExtractParameter(getParamSignature(), _encode(strVal), target), e);
}
return null;
}

private String _encode(String strVal) {
try {
return URLEncoder.encode(strVal, StandardCharsets.UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}

protected void throwProcessingException(String message, Throwable cause)
{
throw new BadRequestException(message, cause);
Expand Down

0 comments on commit caef05a

Please sign in to comment.