Author: nbelaevski
Date: 2009-03-12 15:57:38 -0400 (Thu, 12 Mar 2009)
New Revision: 12946
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
Log:
https://jira.jboss.org/jira/browse/RF-5960 + empty catch blocks removed
Modified:
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java
===================================================================
---
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2009-03-12
19:38:26 UTC (rev 12945)
+++
trunk/ui/fileUpload/src/main/java/org/richfaces/renderkit/FileUploadRendererBase.java 2009-03-12
19:57:38 UTC (rev 12946)
@@ -125,9 +125,9 @@
if (fileUploadIndicator != null &&
Boolean.TRUE.toString().equals(fileUploadIndicator)) {
UIFileUpload fileUpload = (UIFileUpload) component;
String clientId = component.getClientId(context);
- String id = requestParameterMap.get("id");
+ String id = requestParameterMap.get(clientId);
- if (!clientId.equals(id)) {
+ if (id == null) {
return; // Avoid listener calling for another fileUpload
}
@@ -406,16 +406,12 @@
private void onUploadComplete(FacesContext context, List<UploadItem> fileList,
UIFileUpload fileUpload, boolean formUpload) {
storeData(context, fileUpload, fileList);
- try {
- AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
- if ((Boolean)fileUpload.getAttributes().get(AjaxRendererUtils.AJAX_SINGLE_ATTR)) {
- ajaxContext.setAjaxSingleClientId(fileUpload.getClientId(context));
- }
-
- ajaxContext.setAjaxRequest(!formUpload);
- } catch (Exception e) {
- e.getMessage();
+ AjaxContext ajaxContext = AjaxContext.getCurrentInstance(context);
+ if ((Boolean)fileUpload.getAttributes().get(AjaxRendererUtils.AJAX_SINGLE_ATTR)) {
+ ajaxContext.setAjaxSingleClientId(fileUpload.getClientId(context));
}
+
+ ajaxContext.setAjaxRequest(!formUpload);
}
/*
@@ -546,34 +542,30 @@
CountingOutputWriter customWriter = new CountingOutputWriter();
StringBuffer result = null;
UIComponent label = component.getFacet("label");
- try {
- if (label != null) {
+ if (label != null) {
- ResponseWriter writer = context.getResponseWriter();
+ ResponseWriter writer = context.getResponseWriter();
- String defaultRenderKitId = context.getApplication()
- .getDefaultRenderKitId();
- if (null == defaultRenderKitId) {
- defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
- }
- RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
- .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
- RenderKit renderKit = renderKitFactory.getRenderKit(context,
- defaultRenderKitId);
-
- ResponseWriter responseWriter = renderKit.createResponseWriter(
- customWriter, null, "UTF-8");
- context.setResponseWriter(responseWriter);
- writeScriptBody(context, label, false);
- if (writer != null) {
- context.setResponseWriter(writer);
- }
- result = customWriter.getContent();
+ String defaultRenderKitId = context.getApplication()
+ .getDefaultRenderKitId();
+ if (null == defaultRenderKitId) {
+ defaultRenderKitId = RenderKitFactory.HTML_BASIC_RENDER_KIT;
}
+ RenderKitFactory renderKitFactory = (RenderKitFactory) FactoryFinder
+ .getFactory(FactoryFinder.RENDER_KIT_FACTORY);
+ RenderKit renderKit = renderKitFactory.getRenderKit(context,
+ defaultRenderKitId);
- } catch (Exception e) {
- e.getMessage();
+ ResponseWriter responseWriter = renderKit.createResponseWriter(
+ customWriter, null, "UTF-8");
+ context.setResponseWriter(responseWriter);
+ writeScriptBody(context, label, false);
+ if (writer != null) {
+ context.setResponseWriter(writer);
+ }
+ result = customWriter.getContent();
}
+
return (result != null) ? new JSLiteral(result.toString())
: JSReference.NULL;
}
Modified:
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js
===================================================================
---
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2009-03-12
19:38:26 UTC (rev 12945)
+++
trunk/ui/fileUpload/src/main/resources/org/richfaces/renderkit/html/js/FileUpload.js 2009-03-12
19:57:38 UTC (rev 12946)
@@ -1035,7 +1035,7 @@
Richfaces.writeAttribute(parentForm, "enctype",
"multipart/form-data");
Richfaces.writeAttribute(parentForm, "action",
- this.actionUrl + (/\?/.test(this.actionUrl) ? '&_richfaces_upload_uid'
: '?_richfaces_upload_uid') + '=' + encodeURI(entry.uid) +
"&id=" + this.id +
"&_richfaces_upload_file_indicator=true"+"&AJAXREQUEST="+this.progressBar.containerId);
+ this.actionUrl + (/\?/.test(this.actionUrl) ? '&_richfaces_upload_uid'
: '?_richfaces_upload_uid') + '=' + encodeURI(entry.uid) +
"&" + this.id + "=" + this.id +
"&_richfaces_upload_file_indicator=true"+"&AJAXREQUEST="+this.progressBar.containerId);
Richfaces.writeAttribute(parentForm, "target", this.id +
"_iframe");
@@ -1117,7 +1117,7 @@
Richfaces.writeAttribute(f, "encoding", "multipart/form-data");
Richfaces.writeAttribute(f, "enctype", "multipart/form-data");
Richfaces.writeAttribute(f, "action",
- this.actionUrl + (/\?/.test(this.actionUrl) ? '&_richfaces_upload_uid' :
'?_richfaces_upload_uid') + '=_richfaces_form_upload' +
"&id=" + this.id + "&_richfaces_upload_file_indicator=true");
+ this.actionUrl + (/\?/.test(this.actionUrl) ? '&_richfaces_upload_uid' :
'?_richfaces_upload_uid') + '=_richfaces_form_upload' + "&"
+ this.id + "=" + this.id +
"&_richfaces_upload_file_indicator=true");
this.currentInput.disabled = true;
this._enableEntries(false);
@@ -1237,7 +1237,7 @@
},
_flashGetActionUrl: function (url, entry) {
- var getParams = "_richfaces_upload_uid="+ encodeURI(entry.uid) +
"&id=" + this.id +
"&_richfaces_upload_file_indicator=true&_richfaces_size="+entry.size+"&_richfaces_send_http_error=true";
+ var getParams = "_richfaces_upload_uid="+ encodeURI(entry.uid) +
"&" + this.id + "=" + this.id +
"&_richfaces_upload_file_indicator=true&_richfaces_size="+entry.size+"&_richfaces_send_http_error=true";
if (/\?/.test(url)) {
var i = url.indexOf("?");
url = url.substring(0, i) + ";jsessionid=" + this.sessionId +
url.substring(i) + "&" + getParams;