• Post Reply Bookmark Topic Watch Topic
  • New Topic

Loading properties problem  RSS feed

 
Vadim Vararu
Ranch Hand
Posts: 147
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to read these properties from a file:



into a Properties object. I don't know why, but some records are read ok, others get null in my Properties object. Did anybody meet something like this?
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove the spaces from the property names. Properties don't like those.
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:Remove the spaces from the property names. Properties don't like those.


where are the spaces ??
 
Carey Evans
Ranch Hand
Posts: 225
Debian Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't see any spaces either.

Properties files are encoded as ISO-8859-1, but of all the accented characters in your example, only î is available in that encoding. You may need to run native2ascii to convert your properties file to one that Java can load.
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Must be something in Opera; it removed the _ characters from several of the property names.

Vadim, what happens if you print out the properties object directly, and all of its entries:

Because I have tested your properties object, and no nulls. Perhaps you have mistyped a key? It must match exactly - no additional spaces, no different case.
 
Omar Al Kababji
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would suggest to double check the names you use to get the properties from the ResourceBundler, then try to modifiy the encoding used to save your .properties files. if you are using eclipse go to

window --> preferences --> General --> Workspace

and then change the "Text file encoding" and select UTF-8 or something adequate for your case ;)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!