javaserverfaces / mojarra

Legacy home of the Mojarra Project. You can click the site link below to go to the active Mojarra project under Eclipse Foundation
https://github.com/eclipse-ee4j/mojarra
5 stars 0 forks source link

JSF Javascript Library - HTTP 413 - Undefined getAttribute #1

Open Jorelia opened 2 years ago

Jorelia commented 2 years ago

Environment:

We implemented an Upload features to allow students to upload their documents very simply. During the test, we got an HTTP error 413 from our nginx serveur.

However, even if it might be normal to receive a such error, the JSF Ajax tools failed due to an error in javascript and the web page cannot display the error.

We got an NPE equivalent error in javaScript:

undefined is not an object (evaluating 'partialResponse.getAttribute')

JSF Ajax is not able to retrieve the partial response because the partial response does not exist as the NGINX takes the hand. JSF Ajax should/must tests the partialResponse object before accessing it and have a fallback answer.

Actually, the page returns to itself without displaying any error when the file exceed the allowed limit size which is for us less than 5Mb.

ERROR DETAILS

[Error] TypeError: undefined is not an object (evaluating 'partialResponse.getAttribute') response (jsf.js.xhtml:1:38985) onComplete (jsf.js.xhtml:1:29364) (anonymous function) (jsf.js.xhtml:1:29138) callback (jsf.js.xhtml:1:5423) (anonymous function) (jsf.js.xhtml:1:5827)

      var partialResponse = xml.getElementsByTagName("partial-response")[0];

1582 >>>>>> var partialResponseId = partialResponse.getAttribute("id"); var responseType = partialResponse.firstChild;

At the beginning of the file, we catch that:

OpenAjax.hub.registerLibrary("jsf", "www.sun.com", "2.2", null)

We've also prepared an upgraded version of our product and the behaviour is slightly different. May be worst. We have the error "Failed to load resource: the server responded with a status of 500 (Internal Server Error)" but the UI is not able to render the error page. Waiter cursor is not removed and the page is not refreshed. The error is exactly the same as above and it is related to the partialResponse object. Env. is Docker avec WildFly 26.1.1.Final, WildFly Core 18.1.1.Final, et Mojarra 2.3.17.SP01, PrimeFaces 6.0.

Jorelia commented 2 years ago

WildFly 26 - Docker log.

WildFly26-Docker-20220804.log

Jorelia commented 2 years ago

Rendered HTML page from XHTML - Source file from WebTools

WildFly26-XHTM-Renderer-20220805.txt

Jorelia commented 2 years ago

Bug Image #1 JSF-Bug-1-20220805

Jorelia commented 2 years ago

Bug Image #2

JSF-Bug-2-20220805

Jorelia commented 2 years ago

Bug Image #3

JSF-Bug-3-20220804

Jorelia commented 2 years ago

Our UI to understand the page layout

JSF-Bug-4-20220805

Jorelia commented 2 years ago

The jsf.js.xhtml source extracted by WebTools.

jsf.js.xhtml-by-copy-paste-from-web-tools.txt

Jorelia commented 2 years ago

Source files - Java file and XHTML files for info.

JSF-HTTP-413-Source-files.zip