Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8998409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:01:21+00:00 2026-06-16T00:01:21+00:00

I’m using the PrimeFaces FileUpload component for transferring the .properties files into the server.

  • 0

I’m using the PrimeFaces FileUpload component for transferring the .properties files into the server. However, extension is not everything, so I wanted to test the behaviour when something else is posted. I’ve uploaded sample jar file (apache commons codec to be specific), but instead of possible exception in stack trace I’ve came across the strange behaviour of the browser: the dialog content collapsed completly and was not available (IE).

I’ve opened JavaScript console and I’ve found out the more fundamental errors.

On FireFox, there’s the jQuery error, but the dialog does not collapse:

NS_ERROR_NOT_IMPLEMENTED: Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMLSProgressEvent.input]

On IE 9, however, there’s an error from rendering engine:

XML5617: Ungültiges XML-Zeichen. 
form.xhtml, Zeile 3 Zeichen 3926

The XML answer contains binary content, such as the content of the uploaded file would be attached into it. Searching for possible PrimeFaces bugs I’ve found the following: primefaces fileupload filter with utf8 characters filter but I don’t know how could it apply to my case, since I’m not storing the content into String, I’m operating directly on UploadedFile object:

public void onPropertyFileUpload(FileUploadEvent event) {
    log.info("onPropertyFileUpload");
    if (event.getFile() == null) {
        log.warn("Empty file!!!");
        return;
    }
    Properties props = new Properties();
    try {
        props.load(event.getFile().getInputstream());
    } catch (IOException e) {
        log.error(e.getMessage(), e);
        return;
    }

So, is the bug in MultipartRequest found by BalusC the cause of this problem in my case, or this is something else? And, the most important, what can I do to avoid this bug?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:01:22+00:00Added an answer on June 16, 2026 at 12:01 am

    At first I’ve looked at primefaces fileupload filter with utf8 characters filter and I thought this may be the case, but after the analyse of the PrimeFaces code I’ve found out that this is something complete else.

    The bug is in fact in PrimeFaces, but deeply hidden. The bug is that they make no correct escaping of the texts they embed in XML response. My code was converting the file into String, which was available for editing and therefore sended to the user. Because uploaded file was binary, and PrimeFaces makes no correct escaping, the XML was broken.

    Because there’s actually not way to say in Java that the String is correct (no decoding error!), I’d have to use the code which I’ve seen a few times in other projects (shouldn’t it at least be put into Apache commons-lang?)

    /**
         * This method ensures that the output String has only
         * valid XML unicode characters as specified by the
         * XML 1.0 standard. For reference, please see
         * <a href="http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char">the
         * standard</a>. This method will return an empty
         * String if the input is null or empty.
         *
         * @param in The String whose non-valid characters we want to remove.
         * @return The in String, stripped of non-valid characters.
         */
        public String stripNonValidXMLCharacters(String in) {
            StringBuffer out = new StringBuffer(); // Used to hold the output.
            char current; // Used to reference the current character.
    
            if (in == null || ("".equals(in))) return ""; // vacancy test.
            for (int i = 0; i < in.length(); i++) {
                current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught here; it should not happen.
                if ((current == 0x9) ||
                    (current == 0xA) ||
                    (current == 0xD) ||
                    ((current >= 0x20) && (current <= 0xD7FF)) ||
                    ((current >= 0xE000) && (current <= 0xFFFD)) ||
                    ((current >= 0x10000) && (current <= 0x10FFFF)))
                    out.append(current);
            }
            return out.toString();
        }
    

    The source of the solution: https://kr.forums.oracle.com/forums/thread.jspa?threadID=1625928

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have thousands of HTML files to process using Groovy/Java and I need to
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
this is what i have right now Drawing an RSS feed into the php,
I am using the SimpleRSS gem to parse a WordPress RSS feed. The only
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.