Enum should not have a non-final value
This commit is contained in:
parent
e21dc5925d
commit
3d364c7f75
@ -15,11 +15,11 @@
|
||||
*/
|
||||
package io.netty.handler.codec.http.multipart;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.util.CharsetUtil;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* Shared Static object between HttpMessageDecoder, HttpPostRequestDecoder and HttpPostRequestEncoder
|
||||
*/
|
||||
@ -97,7 +97,7 @@ final class HttpPostBodyUtil {
|
||||
*/
|
||||
BINARY("binary");
|
||||
|
||||
public String value;
|
||||
private final String value;
|
||||
|
||||
TransferEncodingMechanism(String value) {
|
||||
this.value = value;
|
||||
@ -107,6 +107,10 @@ final class HttpPostBodyUtil {
|
||||
value = name();
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return value;
|
||||
|
@ -1084,12 +1084,12 @@ public class HttpPostRequestDecoder {
|
||||
} catch (IOException e) {
|
||||
throw new ErrorDataDecoderException(e);
|
||||
}
|
||||
if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT7.value)) {
|
||||
if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT7.value())) {
|
||||
localCharset = HttpPostBodyUtil.US_ASCII;
|
||||
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT8.value)) {
|
||||
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BIT8.value())) {
|
||||
localCharset = HttpPostBodyUtil.ISO_8859_1;
|
||||
mechanism = TransferEncodingMechanism.BIT8;
|
||||
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value)) {
|
||||
} else if (code.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) {
|
||||
// no real charset, so let the default
|
||||
mechanism = TransferEncodingMechanism.BINARY;
|
||||
} else {
|
||||
@ -1122,7 +1122,7 @@ public class HttpPostRequestDecoder {
|
||||
}
|
||||
try {
|
||||
currentFileUpload = factory.createFileUpload(request, nameAttribute.getValue(),
|
||||
filenameAttribute.getValue(), contentTypeAttribute.getValue(), mechanism.value, localCharset,
|
||||
filenameAttribute.getValue(), contentTypeAttribute.getValue(), mechanism.value(), localCharset,
|
||||
size);
|
||||
} catch (NullPointerException e) {
|
||||
throw new ErrorDataDecoderException(e);
|
||||
|
@ -320,7 +320,7 @@ public class HttpPostRequestEncoder implements ChunkedMessageInput<HttpChunk> {
|
||||
}
|
||||
}
|
||||
if (!isText) {
|
||||
contentTransferEncoding = HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value;
|
||||
contentTransferEncoding = HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value();
|
||||
}
|
||||
FileUpload fileUpload = factory.createFileUpload(request, name, file.getName(), scontentType,
|
||||
contentTransferEncoding, null, file.length());
|
||||
@ -573,9 +573,9 @@ public class HttpPostRequestEncoder implements ChunkedMessageInput<HttpChunk> {
|
||||
internal.addValue(HttpHeaders.Names.CONTENT_TYPE + ": " + fileUpload.getContentType());
|
||||
String contentTransferEncoding = fileUpload.getContentTransferEncoding();
|
||||
if (contentTransferEncoding != null
|
||||
&& contentTransferEncoding.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value)) {
|
||||
&& contentTransferEncoding.equals(HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value())) {
|
||||
internal.addValue("\r\n" + HttpHeaders.Names.CONTENT_TRANSFER_ENCODING + ": "
|
||||
+ HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value + "\r\n\r\n");
|
||||
+ HttpPostBodyUtil.TransferEncodingMechanism.BINARY.value() + "\r\n\r\n");
|
||||
} else if (fileUpload.getCharset() != null) {
|
||||
internal.addValue("; " + HttpHeaders.Values.CHARSET + "=" + fileUpload.getCharset() + "\r\n\r\n");
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user