I looked at them, basically Sonar is complaining that we're storing
member variables and not using them anywhere, in that class or in known
subclasses. (I'm surprised it's found only two such cases.) For
WikiRenderer's m_enablePlugins, it's a redundant value because the
m_context variable it comes from is already a protected field, i.e., any
subclass that wants m_enablePlugins can query m_context for it anyway.
For DefaultURLConstructor's m_useRelativeURLStyle, likewise, that value
can be freely obtained by any subclass that wants it by overriding the
initialize(engine, properties) method, as that value comes from the
properties object. I might argue it would be better in the future for
DefaultURLConstructor to store the whole properties object for its
subclasses than to try to store instance variables like
m_useRelativeURLStyle for every property value subclasses might be
possibly interested in. For 2.10, my inclination is to remove both
variables.
Glen
On 07/17/2013 06:39 PM, Juan Pablo Santos RodrÃguez wrote:
Hi Glen,
didn't had the time to take a deep look into this yet, but seems to me
remains of old code. If you give a couple of days I'll try to confirm
br,
juan pablo
On Mon, Jul 15, 2013 at 10:49 PM, Glen Mazza <[email protected]> wrote:
Folks, Sonar is complaining[1] about two variables that are assigned but
never being read within JSPWiki:
gmazza@gmazza-E527:/media/**work1/opensource/jspwiki$ grep
"m_useRelativeURLStyle" .
./jspwiki-war/src/main/java/**org/apache/wiki/url/**DefaultURLConstructor.java:
protected boolean m_useRelativeURLStyle = true;
./jspwiki-war/src/main/java/**org/apache/wiki/url/**DefaultURLConstructor.java:
m_useRelativeURLStyle = "relative".equals( properties.getProperty(
WikiEngine.PROP_REFSTYLE,
gmazza@gmazza-E527:/media/**work1/opensource/jspwiki$ grep
"m_enablePlugins" .
./jspwiki-war/src/main/java/**org/apache/wiki/render/**WikiRenderer.java:
protected boolean m_enablePlugins = true;
./jspwiki-war/src/main/java/**org/apache/wiki/render/**WikiRenderer.java:
m_enablePlugins = toggle;
Anybody know if these have an external purpose? One file,
./jspwiki-war/src/main/config/**doc/APIChangesFrom2.4.html, mentions that
m_enablePlugins was deleted from JSPWiki 2.4 (in class com.ecyrd.jspwiki.*
*TranslatorReader). I have no problem deleting these two variables and
putting them back in later if we determine a use for them.
Regards,
Glen
[1] https://analysis.apache.org/**drilldown/issues/org.apache.**
jspwiki:jspwiki-builder?**severity=INFO<https://analysis.apache.org/drilldown/issues/org.apache.jspwiki:jspwiki-builder?severity=INFO>