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

[RESTEASY-2772] Backing out changes for RESTEASY-2772. #2627

Merged
merged 1 commit into from Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -7,7 +7,6 @@
import javax.ws.rs.ext.RuntimeDelegate;

import java.util.HashMap;
import javax.ws.rs.BadRequestException;

/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
Expand Down Expand Up @@ -114,7 +113,7 @@ public static MediaType parse(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 @@ -132,11 +131,11 @@ public static MediaType parse(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