Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » NLS unused message(getting irrelevant warning while launching application)
icon7.gif  NLS unused message [message #757124] Wed, 16 November 2011 15:44 Go to next message
Jai  is currently offline Jai Friend
Messages: 4
Registered: November 2011
Junior Member
Hello,

Hope this is correct forum for this question.

I saw related questions have been asked in past in few of eclipse forum....but those are very old and didn't help me, that's why opened as new topic.

I am working on eclipse.....developing a plugin based application that supports externalization.

And for externalization it uses two different methods :
one is NLS method (provided by eclipse)
and other is ResourceBundle method (provided by sun/oracle)

When ever I launch my application......it produces lots of warning messages which can be seen in current workspaces's \runtime_workspace\.metadata\.log file and also in "Error Log" view of eclipse.

sample warning messages :

!ENTRY org.eclipse.osgi 2 1 2011-11-16 12:59:55.358
!MESSAGE NLS unused message: EngineInspectEntry_Container_Type in: com.apama.runtime.Messages

!ENTRY org.eclipse.osgi 2 1 2011-11-16 13:00:17.543
!MESSAGE NLS unused message: BlockTypeSelectionPage.page_description_select_a_method in: com.apama.text.wizards.WizardMessages

I tried googling.....but didn't find any solution.

Here is more detail

-these messages are warnings....not the errors and are not creating any problem at runtime......but it's flooding my logs and Error Log view which is irritating
-all strings which are externalized via NLS method are fine.....warning is not being produced for those.
-getting warning for only those strings which are externalized via ResourceBundle method
-if you notice above warning message.....BlockTypeSelectionPage.page_description_select_a_method is the Key which is in some messages.properties file......this is key is being used in various java classes


Issue (as per me) :

as per me the issue is due to eclipse itself.

As in case of NLS method of externalizing......there should be one static string variable in Messages.java for every corresponding key in messages.properties also name of string variable in Messages.java should be same as key name in corresponding messages.properties. So eclipse framework reads messages.properties file (reads all its key-values) and populates those values in static string variables in corresponding Messages.java class.
And in case if any key is present in messages.properties and but string variable is not present with same name in corresponding Messages.java then eclipse (NLS.java class) produces a warning saying that this key is not in used as NLS unused message: Key name in:.........

So here....while using ResourceBundle mechanism of externalizing string.....eclipse framework is repeating same process.....it's picking up messages.properties and reading all it's key-values.....then it's trying to populate values in string variables declared in corresponding Messages.java class
But as we know......while using ResourceBundle mechanism......that we don't declare string variables in Messages.java file.......so eclipse is generating warning saying NLS unused.....

I may be wrong.....please correct me if needed.

platform-xp
jdk-1.5
eclipse-3.6
no babel pack installed
Please help in fixing this.

Thanks in advance Smile
Re: NLS unused message [message #757219 is a reply to message #757124] Thu, 17 November 2011 07:58 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
I believe NLS#load() reports these errors. So, if this function is not called there should not be errors.
Re: NLS unused message [message #757618 is a reply to message #757219] Sun, 20 November 2011 13:29 Go to previous message
Jai  is currently offline Jai Friend
Messages: 4
Registered: November 2011
Junior Member
thanks a lot Satyam Kandula for suggestion, actually problem has been fixed by one of my senior.
issue was - few messages.properties were shared between between NLS and ResourceBundle methods.
and as per NLS rules if any messages.properties is linked to Messages.java (subclass of NLS) then Messages.java should contain all keys defined in messages.properties as static string variables in it which was not there so those warning were getting generated to mention that Messages.java and messages.properties are not in sync.

hope I am clear.

Thanks,
Jai
Re: NLS unused message [message #757854 is a reply to message #757124] Fri, 18 November 2011 17:48 Go to previous message
Deepak Azad is currently offline Deepak AzadFriend
Messages: 543
Registered: July 2009
Senior Member
> As in case of NLS method of externalizing......there should be one
> static string variable in Messages.java for every corresponding key in
> messages.properties also name of string variable in Messages.java should
> be same as key name in corresponding messages.properties. So eclipse
> framework reads messages.properties file (reads all its key-values) and
> populates those values in static string variables in corresponding
> Messages.java class.
> And in case if any key is present in messages.properties and but string
> variable is not present with same name in corresponding Messages.java
> then eclipse (NLS.java class) produces a warning saying that this key is
> not in used as NLS unused message: Key name in:.........
>
> So here....while using ResourceBundle mechanism of externalizing
> string.....eclipse framework is repeating same process.....it's picking
> up messages.properties and reading all it's key-values.....then it's
> trying to populate values in string variables declared in corresponding
> Messages.java class
> But as we know......while using ResourceBundle mechanism......that we
> don't declare string variables in Messages.java file.......so eclipse is
> generating warning saying NLS unused.....

Do all your Messages.java classes extend org.eclipse.osgi.util.NLS ?
Even the ones where you do not use Eclipse style NLS?

My guess is that the answers to above questions is 'yes', and that's the
problem :-)

--
Deepak Azad
http://wiki.eclipse.org/JDT/FAQ
Previous Topic:No auto-refresh of display?
Next Topic:Editing Large Files
Goto Forum:
  


Current Time: Fri Apr 26 07:07:59 GMT 2024

Powered by FUDForum. Page generated in 0.03265 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top