struts-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lukaszlen...@apache.org
Subject [1/2] struts git commit: Uses default error key if specified key doesn't exist
Date Mon, 06 Mar 2017 11:03:12 GMT
Repository: struts
Updated Branches:
  refs/heads/support-2-3 54dff362f -> 1ed29d508


Uses default error key if specified key doesn't exist


Project: http://git-wip-us.apache.org/repos/asf/struts/repo
Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/35230649
Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/35230649
Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/35230649

Branch: refs/heads/support-2-3
Commit: 352306493971e7d5a756d61780d57a76eb1f519a
Parents: 54dff36
Author: Lukasz Lenart <lukaszlenart@apache.org>
Authored: Mon Mar 6 11:56:39 2017 +0100
Committer: Lukasz Lenart <lukaszlenart@apache.org>
Committed: Mon Mar 6 11:56:39 2017 +0100

----------------------------------------------------------------------
 .../struts2/dispatcher/multipart/JakartaMultiPartRequest.java  | 6 +++++-
 .../dispatcher/multipart/JakartaStreamMultiPartRequest.java    | 6 +++++-
 .../struts2/dispatcher/multipart/MultiPartRequestWrapper.java  | 6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/struts/blob/35230649/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
index eecec0e..8f3592b 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java
@@ -120,7 +120,11 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Preparing error message for key: [#0]", errorKey);
         }
-        return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(),
args);
+        if (LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null, new
Object[0]) == null) {
+            return LocalizedTextUtil.findText(this.getClass(), "struts.messages.error.uploading",
defaultLocale, null, new Object[] { e.getMessage() });
+        } else {
+            return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null,
args);
+        }
     }
 
     protected void processUpload(HttpServletRequest request, String saveDir) throws FileUploadException,
UnsupportedEncodingException {

http://git-wip-us.apache.org/repos/asf/struts/blob/35230649/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
index e22cee3..b230556 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java
@@ -539,7 +539,11 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest
{
         String errorKey = "struts.message.upload.error." + e.getClass().getSimpleName();
         if (LOG.isDebugEnabled())
             LOG.debug("Preparing error message for key: [#0]", errorKey);
-        return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(),
args);
+        if (LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null, new
Object[0]) == null) {
+            return LocalizedTextUtil.findText(this.getClass(), "struts.messages.error.uploading",
defaultLocale, null, new Object[] { e.getMessage() });
+        } else {
+            return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null,
args);
+        }
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/struts/blob/35230649/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
index ddc4275..997c224 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java
@@ -108,7 +108,11 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
         if (LOG.isDebugEnabled()) {
             LOG.debug("Preparing error message for key: [#0]", errorKey);
         }
-        return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(),
args);
+        if (LocalizedTextUtil.findText(this.getClass(), errorKey, getLocale(), null, new
Object[0]) == null) {
+            return LocalizedTextUtil.findText(this.getClass(), "struts.messages.error.uploading",
defaultLocale, null, new Object[] { e.getMessage() });
+        } else {
+            return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, null,
args);
+        }
     }
 
     /**


Mime
View raw message