XWiki - Open Source Wiki and Content-Oriented Application Platform » FAQ » WhyDoIHaveDeprecatedUsageOfMethodXXXInTheConsoleLog

WhyDoIHaveDeprecatedUsageOfMethodXXXInTheConsoleLog

Last modified by Sergiu Dumitriu on 2008/10/15
Question Why do I have messages like "Deprecated usage of method com.xpn.xwiki.api.XWiki.parseInt" in XWiki's console log ?
Answer XWiki's deprecation strategy for public APIs is described here.

When an public API method is deprecated, we continue to support it for 2 full versions (For example, if we deprecate an API starting in XWiki 1.7, it will be supported in all versions of XWiki 1.7 and 1.8). For our users to move their code that uses deprecated APIs, we log every call to an API that is going to be not supported in futures versions in the console log. This is why you can sometimes read such messages :

[WARNING] Deprecated usage of method [com.xpn.xwiki.api.XWiki.parseInt] in Main.
WebHome@14,25

In this example, when displaying the Main.WebHome page, the method parseInt from com.xpn.xwiki.api.XWiki is called, and this is a deprecated API that is going to disappear in future versions. Instead com.xpn.xwiki.api.Util.parseInt should be used.

It is recommended to either:

  • replace the problematic pages and templates with their newer versions included in the official release (by selectively importing the .xar and templates), if those documents were not changed locally; thus, you benefit from other improvements and new features, too.
  • manually fix each deprecated call in the pages; the log identifies the file/document that must be changed, and also indicates the line+column where the call occurred. Finding the right method to use sometimes requires looking at the java code and searching for the deprecated method; above each such method, a comment identifies the right object/method that must be called. But usually, most of the deprecated methods need simply replacing $xwiki with $util.
Tags:
Created by Jerome Velociter on 2008/10/15

Get Connected