From b523c015e32be84362493f939233ddeda0cb6f9f Mon Sep 17 00:00:00 2001 From: aserkes Date: Fri, 8 Jan 2021 14:30:20 +0100 Subject: [PATCH] Refactoring Signed-off-by: aserkes --- .../jersey/media/multipart/ContentDisposition.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/ContentDisposition.java b/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/ContentDisposition.java index ec3a19d024..cb2ee378df 100644 --- a/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/ContentDisposition.java +++ b/media/multipart/src/main/java/org/glassfish/jersey/media/multipart/ContentDisposition.java @@ -225,15 +225,17 @@ private String defineFileName() throws ParseException { return fileNameExt; } + final String charset = matcher.group(CHARSET_GROUP_NAME); if (matcher.group(CHARSET_GROUP_NAME).equalsIgnoreCase("UTF-8")) { - return new StringBuilder(matcher.group(CHARSET_GROUP_NAME)) + final String language = matcher.group(LANG_GROUP_NAME); + return new StringBuilder(charset) .append("'") - .append(matcher.group(LANG_GROUP_NAME) == null ? "" : matcher.group(LANG_GROUP_NAME)) + .append(language == null ? "" : language) .append("'") .append(encodeToUriFormat(fileNameValueChars)) .toString(); } else { - throw new ParseException(matcher.group(CHARSET_GROUP_NAME) + " charset is not supported", 0); + throw new ParseException(charset + " charset is not supported", 0); } }