jijo-paulose / gwtupload

Automatically exported from code.google.com/p/gwtupload
Other
0 stars 0 forks source link

Bug with formating localization of error message #137

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I did size limit in 10 MB. When I choose file for upload with size more than 
this limit I get next error message in web-browser:
"The request was rejected because its size: 16 234 KB, exceeds the maximum: 10 
240 KB".

This is good!

I use Chromium 17.0.963.56 on Ubuntu 11.10 with Russian locale ("RU").

I added a file UploadServlet_ru.properties and I began to get this message on 
Russian language. It worked correctly. I got the messages on Russian language.

But some time ago I have updated to GWT 2.4.0. And I found next problem:

If I use browser with English locale I get correct error message when size of 
file for upload more then limit. But if I use Chromuim with Russian locale I do 
not get this message and boot process not moving.

After code debug I found the following:

package gwtupload.client;

...

public class Uploader extends Composite implements IsUpdateable, IUploader, 
HasJsData {

...

private void parseAjaxResponse(String responseTxt) {
   if (responseTxt == null) {
     return;
   }

   String error = null;
   Document doc = null;
   try {
     doc = XMLParser.parse(responseTxt);
     error = Utils.getXmlNodeValue(doc, "error");
   } catch (Exception e) {
     if (responseTxt.toLowerCase().matches("error")) {
       error = i18nStrs.uploaderServerError() + "\nAction: " + getServletPath() + "\nException: " + e.getMessage() + responseTxt;
     }
   }

   if (error != null) {
     successful = false;
     cancelUpload(error);
     return;
   } else if (Utils.getXmlNodeValue(doc, TAG_WAIT) != null) {
     if (serverResponse != null) {
       log("server response received, cancelling the upload " + getFileName() + " " + serverResponse, null);
       successful = true;
       uploadFinished();
     }
   } else if (Utils.getXmlNodeValue(doc, TAG_CANCELED) != null) {
     log("server response is: canceled " + getFileName(), null);
     successful = false;
     canceled = true;
     uploadFinished();
     return;
   } else if (Utils.getXmlNodeValue(doc, TAG_FINISHED) != null) {
     log("server response is: finished " + getFileName(), null);
     successful = true;
     if (onSubmitComplete) {
       log("response from server has been received", null);
       uploadFinished();
     }
     return;
   } else if (Utils.getXmlNodeValue(doc, TAG_PERCENT) != null) {
     lastData = now();
     int transferredKB = Integer.valueOf(Utils.getXmlNodeValue(doc, TAG_CURRENT_BYTES)) / 1024;
     int totalKB = Integer.valueOf(Utils.getXmlNodeValue(doc, TAG_TOTAL_BYTES)) / 1024;
     statusWidget.setProgress(transferredKB, totalKB);
     log("server response transferred  " + transferredKB + "/" + totalKB + " " + getFileName(), null);
     return;
   } else {
     log("incorrect response: " + getFileName() + " " + responseTxt, null);
   }

   if (uploadTimeout > 0 && now() - lastData >  uploadTimeout) {
     successful = false;
     cancelUpload(i18nStrs.uploaderTimeout());
     try {
       sendAjaxRequestToCancelCurrentUpload();
     } catch (Exception e) {
     }
   }
 }

...

}

When I try to upload the file with size more the limit in browser with Russian 
locale I get following value of responseText:

<response><error>Файл отклонён, потому что его 
размер: 16&nbsp;936 KB, превышает максимальный: 
10&nbsp;240 KB</error></response>

XMLParser can not parse text with &nbsp;

When I try to run this scenario in browser with English locale responseText 
does not contain &nbsp; in size value.

In attach simple UploadServlet_ru.properties

Original issue reported on code.google.com by Demetriu...@gmail.com on 29 Feb 2012 at 11:36

Attachments:

GoogleCodeExporter commented 9 years ago
I dont follow, where is the   I dont see it in your file.

Original comment by manuel.carrasco.m on 23 May 2012 at 3:31

GoogleCodeExporter commented 9 years ago
I've added your file to the project, then I've deployed an instance in [1] and 
using RU I don't see the issue, see screenshot.

Please check that the issue does not happen any more visiting [1].

Could you attach to this file the translated file for the client part:  
IUploader$UploaderConstants_ru.properties? 
You can see default wordings in English in IUploader.java.

Thanks
- Manolo

[1] http://gwtupload.alcala.org

Original comment by manuel.carrasco.m on 24 May 2012 at 12:07

GoogleCodeExporter commented 9 years ago
This problem is not resolved!!!!

Original comment by Demetriu...@gmail.com on 10 Jul 2012 at 10:03

GoogleCodeExporter commented 9 years ago
If i use tomcat i have not problem, but if i use getty i have bug

Original comment by Demetriu...@gmail.com on 10 Jul 2012 at 10:05

GoogleCodeExporter commented 9 years ago
file download hangs and no error message appears

Original comment by Demetriu...@gmail.com on 10 Jul 2012 at 10:06

GoogleCodeExporter commented 9 years ago
Have you tried  http://gwtupload.alcala.org using RU as language?

Original comment by manuel.carrasco.m on 11 Jul 2012 at 10:29

GoogleCodeExporter commented 9 years ago
could you attach a project which demonstrates the issue?
I'm unable to reproduce it in my PC.

Original comment by manuel.carrasco.m on 3 Dec 2012 at 12:22

GoogleCodeExporter commented 9 years ago
I have double checked that Files with UTF-8 characters works without problem in 
example deployed in jetty. I'have successfully uploaded files with names in 
Japanese, Spanish and Arabic. Definitivelly is not an issue in gwtupload but in 
the locale/char-set of the browser/server. 

Original comment by manuel.carrasco.m on 30 Oct 2013 at 9:50