[icedtea-web] RFC: fix whitespace in parsing text

Omair Majid omajid at redhat.com
Wed Dec 8 13:53:55 PST 2010

On 12/08/2010 03:45 PM, Deepak Bhole wrote:
> * Omair Majid<omajid at redhat.com>  [2010-12-08 15:35]:
>> Hi,
>> The attached patch makes netx's Parser convert sequences of
>> whitespace characters into a single space.
>> This means that all other places (GUI, command line) see consistent
>> titles, descriptions and vendors. As it is, some GUI elements like
>> JLabels will simply skip over new line characters while other places
>> may show them. This makes the strings sanitized for display and
>> consistent.
> Where on command line does the info show up?

Sorry, I should have worded it more carefully. Nothing shows up on the 
command line right now. However, some information may or may not be 
printed during debugging (and I would like to add some in the future).

However, there are places other than the GUI which make use of this 
information. And this information is treated inconsistently and even 
incorrectly. Take a few examples:

XDesktopEntryFile.getContentsAsReader() creates a file by writing the 
title and a description. Originally, it did not anticipate newlines in 
those strings (as I have never seen one) which could result in creating 
invalid files.

JLabels will simply discard newlines and tabs. This keeps everything on 
line line, but can mess up spacing. If two words in the description are 
separated by a newline, they are joined together (since JLabel will 
discard newline characters).

> Also, do you have an example jnlp where this is an issue?

No, I have never seen such a JNLP file anywhere (otherwise I might have 
brought this up sooner) but it is easy to modify an existing jnlp to 
demonstrate this issue. The attached file contains an example. When run 
(with a recent version of IcedTea-Web), it should show a dialog asking 
to confirm shortcut creation. The title should show the word FireFox 
which does not appear in the jnlp file (but two words Fire and Fox do).

I dont think this patch is a must-have right now, but it would be nice 
to have as it future-proofs a few things. Hopefully with it, we will 
avoid sanitization bugs like what happened with XDesktopEntryFile again.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hello-world.tar.gz
Type: application/x-gzip
Size: 2121 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20101208/c8e7663a/hello-world.tar.gz 

More information about the distro-pkg-dev mailing list