This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 233401 - 2500 identical lines in messages.log
Summary: 2500 identical lines in messages.log
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: DD Editor (show other bugs)
Version: 7.4
Hardware: All All
: P2 normal (vote)
Assignee: David Konecny
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-25 10:05 UTC by Tomas Hurka
Modified: 2013-08-01 02:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
messages.log (559.92 KB, text/plain)
2013-07-25 10:06 UTC, Tomas Hurka
Details
proposed solution (5.31 KB, patch)
2013-07-26 01:33 UTC, David Konecny
Details | Diff
proposed solution V2 (44.65 KB, patch)
2013-07-30 03:27 UTC, David Konecny
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Hurka 2013-07-25 10:05:04 UTC
Take a look at attached messages.log file.It has ~2500 identical lines:

WARNING [org.netbeans.modules.j2ee.dd.impl.web.model_2_5.ServletMapping]: ServletMapping25.getUrlPattern() is only fallback, use ServletMapping25.getUrlPatterns() instead!

Repeating such warning is useless and it causes:
1) the messages.log file is missing initial part, with important information about  NetBeans build, etc.
2) unnecessary load to NetBeans logging infrastructure.

Please fix the violators or disable the warning.
Comment 1 Tomas Hurka 2013-07-25 10:06:24 UTC
Created attachment 137770 [details]
messages.log
Comment 2 David Konecny 2013-07-26 01:33:57 UTC
Created attachment 137827 [details]
proposed solution

Martin could you have a look at the patch please? Thx.

Tomas, how do you reproduce this problem? I could not figured out from the code under what circumstances this method should be called repeatedly that many times. I'm fixing also repeating warning about Mozilla not being available - no need to keep telling to user that they do not have Mozilla installed.
Comment 3 Martin Fousek 2013-07-26 05:52:04 UTC
(In reply to comment #2)
> Created attachment 137827 [details]
> proposed solution
> 
> Martin could you have a look at the patch please? Thx.

Sure. :)

> Tomas, how do you reproduce this problem? I could not figured out from the code
> under what circumstances this method should be called repeatedly that many
> times. I'm fixing also repeating warning about Mozilla not being available - no
> need to keep telling to user that they do not have Mozilla installed.

I'm afraid that you focused on wrong SET method but the real problem from the messages.log lies in the GET method - getUrlPattern().

BTW, our WARNING logging is pretty strange way how to prevent the method from calling it and obviously no body takes care. ;)

Ideal solution looks to me:
1, into ServletMapping 2.4 (and its API) include getUrlPatterns(), setUrlPatterns() methods which will delegate to the older getUrlPattern(), setUrlPattern()
2, remove the warning from all 2.5+ ServletMappings implementations and made the methods @Deprecated, as well as add @Deprecated field to the ServletMapping25 interface
3, change occurrences to use the getUrlPatterns(), setUrlPatterns()

It will be probably pretty much work, so the second solution is only step Nr.2. All clients of the API will get message in the compile time about the deprecation and they should rewrite their sources. BTW, at least step Nr.1 would deserve also its own API review if you would go thru all 3 points. ;)
Comment 4 Tomas Hurka 2013-07-26 11:52:02 UTC
(In reply to comment #2)
> 
> Tomas, how do you reproduce this problem? 
I don't know. The messages.log file is from issue #233262.

> I'm fixing also repeating warning about Mozilla not being available - no
> need to keep telling to user that they do not have Mozilla installed.
Great!
Comment 5 David Konecny 2013-07-30 03:26:27 UTC
Thanks for your comments Martin. I deprecated two old methods in ServletMapping and changed implementation generated for 2.4 schema to always implement ServletMapping25 methods as well. Thanks to that all clients can work just with ServletMapping25 API without necessity to do "if ServletMapping or ServletMapping25?" etc. I updated whole NB code base to not use deprecated APIs. I also removed warnings.

One problem which remains is that APIs like WebApp still returns ServletMapping class. But changing that looks to me like too much work.

The only possible issue which my change may cause is in scenario when multiple URL mappings are being added into a web.xml which uses 2.4 schema. In such case only first (or last) URL mapping will be stored/retrieved. I do not think that's a realistic problem - most of our code base operates with single URL mapping anyway and whoever is still using 2.4 web.xml should consider upgrading it or staying with older versions of NB. 

What do you think about it? I'm attaching new patch.
Comment 6 David Konecny 2013-07-30 03:27:03 UTC
Created attachment 137977 [details]
proposed solution V2
Comment 7 Martin Fousek 2013-07-30 14:02:27 UTC
(In reply to comment #5)
> The only possible issue which my change may cause is in scenario when multiple
> URL mappings are being added into a web.xml which uses 2.4 schema. In such case
> only first (or last) URL mapping will be stored/retrieved. I do not think
> that's a realistic problem - most of our code base operates with single URL
> mapping anyway and whoever is still using 2.4 web.xml should consider upgrading
> it or staying with older versions of NB. 

I agree that such scenario will be very rare. BTW. most of current implementation omit such scenario anyway so this is no change there. ;)

> What do you think about it? I'm attaching new patch.

The second patch looks great. Sorry I didn't take a look on all rewrites of the getUrlPattern(), setUrlPattern() deeply but generally it looks well.
Comment 8 David Konecny 2013-07-30 21:22:18 UTC
> Sorry I didn't take a look on all rewrites

That's all I wanted anyway - a sanity check. Thanks!

web-main#ee04a2892807
Comment 9 Quality Engineering 2013-08-01 02:34:02 UTC
Integrated into 'main-silver', will be available in build *201307312300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/d6ff05354280
User: David Konecny <dkonecny@netbeans.org>
Log: #233401 - 2500 identical lines in messages.log