Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 90974 - Better support for .properties files
Better support for .properties files
Status: NEW
Product: utilities
Classification: Unclassified
Component: Properties
All All
: P2 (vote)
Assigned To: Jan Peska
Depends on:
  Show dependency treegraph
Reported: 2006-12-12 17:30 UTC by Jan Jancura
Modified: 2013-05-01 16:38 UTC (History)
1 user (show)

See Also:

Emacs el file (6.92 KB, text/plain)
2006-12-12 17:31 UTC, Jan Jancura

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Jancura 2006-12-12 17:30:14 UTC
I came across this blog entry:

There are some interesting things there. It's easy to end up with single quotes
in your strings, and if your strings are being formatted by MessageFormat (which
I suspect is the case for most people), it can have unintended consequences.

I looked up MessageFormat, and lo and behold, it's a whole "language"!  (Look at
the grammar listed right in its javadoc: )

I see that there is a Schliemann .nbs file for properties files, but it's only
doing key=value recognition at this point. (And needs to handle : as a separator
as well.)

Would it make sense to actually tokenize .properties files as if they are
MessageFormat language files??  I think that would help 95% of .properties file

-- Tor 


FWIW, I think this would be a great idea ... but with a potential caveat.  What
happens if the developer is specifying resources that are *not* MessageFormat
strings, and the coloring confuses things, or creates "false positive" error
reports for invalid syntax?  Ideally, we could implement this so you could turn
it on or off on a per-properties-file basis, perhaps defaulting with convention
over configuration (,, or some per-file setting that persists with the project.

That is why I have used the attached in Emacs for about ten years. I wrote it
from scratch in an afternoon, I guess, but it still provides better coloring
than NB ever did, mainly because duplicating it in old NB would have taken me
days. With the advent of Schliemann it should be easy to correct that. Note that
there is some special treatment in there for ATG Dynamo (an old app server) and
Ant, and the MessageFormat handling is minimal. The basic format features are
handling of

1. Continued lines such as




2. Extra spaces at the ends of lines, which are otherwise invisible parts of the

3. \uXXXX, \n, and other escapes.

To Craig's question - I have never been bothered by the possibility of the
attached major mode coloring something that wasn't actually special. It's rare
and mostly harmless. We can assume that most .properties files edited by NB
developers are

1. Resource bundle strings, sometimes using MessageFormat.

2. Ant property definitions, sometimes using ${property} substs.

3. Relatively short and straightforward config files for other systems - Maven,
Tomcat, whatever.
Comment 1 Jan Jancura 2006-12-12 17:31:18 UTC
Created attachment 36619 [details]
Emacs el file
Comment 2 Jiri Prox 2007-09-17 20:48:11 UTC
Obsolete milestone, please reevaluate
Comment 3 Jan Jancura 2007-09-18 17:20:37 UTC

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo