Skip to content

Commit

Permalink
[RESTEASY-2772] Backing out changes for RESTEASY-2772. (#2627)
Browse files Browse the repository at this point in the history
  • Loading branch information
ronsigal authored and asoldano committed Jan 11, 2021
1 parent 641fe88 commit aec7838
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
Expand Up @@ -15,7 +15,6 @@
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.BadRequestException;

/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
Expand All @@ -36,7 +35,7 @@ public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotati
public MultipartInput readFrom(Class<MultipartInput> type, Type genericType, Annotation[] annotations, MediaType mediaType, MultivaluedMap<String, String> httpHeaders, InputStream entityStream) throws IOException, WebApplicationException
{
String boundary = mediaType.getParameters().get("boundary");
if (boundary == null) throw new BadRequestException(Messages.MESSAGES.unableToGetBoundary());
if (boundary == null) throw new IOException(Messages.MESSAGES.unableToGetBoundary());
MultipartInputImpl input = new MultipartInputImpl(mediaType, workers);
/*
StringWriter writer = new StringWriter();
Expand Down
Expand Up @@ -11,7 +11,6 @@
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import javax.ws.rs.BadRequestException;

/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
Expand Down Expand Up @@ -94,7 +93,7 @@ private static MediaType internalParse(String type)
}
if (!MediaType.MEDIA_TYPE_WILDCARD.equals(major))
{
throw new BadRequestException(Messages.MESSAGES.failureParsingMediaType(type));
throw new IllegalArgumentException(Messages.MESSAGES.failureParsingMediaType(type));
}
subtype = MediaType.MEDIA_TYPE_WILDCARD;
}
Expand All @@ -112,11 +111,11 @@ private static MediaType internalParse(String type)
}
if (major.length() < 1 || subtype.length() < 1)
{
throw new BadRequestException(Messages.MESSAGES.failureParsingMediaType(type));
throw new IllegalArgumentException(Messages.MESSAGES.failureParsingMediaType(type));
}
if (!isValid(major) || !isValid(subtype))
{
throw new BadRequestException(Messages.MESSAGES.failureParsingMediaType(type));
throw new IllegalArgumentException(Messages.MESSAGES.failureParsingMediaType(type));
}
String params = null;
if (paramIndex > -1) params = type.substring(paramIndex + 1);
Expand Down
Expand Up @@ -16,7 +16,6 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.RuntimeDelegate;
import javax.ws.rs.BadRequestException;

import static org.jboss.resteasy.test.TestPortProvider.generateURL;

Expand All @@ -33,7 +32,7 @@ public class ClientBuilderTest {
* @tpPassCrit IllegalArgumentException is raised
* @tpSince RESTEasy 3.0.16
*/
@Test(expected = BadRequestException.class)
@Test(expected = IllegalArgumentException.class)
public void entityStringThrowsExceptionWhenUnparsableTest() throws Exception {
Entity.entity("entity", "\\//\\");
Assert.fail();
Expand Down
Expand Up @@ -2,11 +2,10 @@

import org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate;
import org.junit.Test;
import javax.ws.rs.BadRequestException;

public class MediaTypeHeaderTest {

@Test(expected = BadRequestException.class)
@Test(expected = IllegalArgumentException.class)
public void testNewLineInHeaderValueIsRejected() {
MediaTypeHeaderDelegate delegate = new MediaTypeHeaderDelegate();

Expand Down

0 comments on commit aec7838

Please sign in to comment.