Errors parsing struts-config.xml

Version: IntelliJ 7.0.1, Build 7364
Platform: Linux kubuntu 2.6.20-16-386 #2 Sun Sep 23 19:47:10 UTC 2007 i686 GNU/Linux

Problem: When IntelliJ parses my struts-config.xml file, it marks many lines with errors but I can't determine why. For instance, in my TilesPlugin section:

<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
<set-property property="definitions-debug" value="2"/>
<set-property property="definitions-parser-details" value="0"/>
<set-property property="definitions-parser-validate" value="true"/>
</plug-in>

The first and last set-property are interpreted fine, but the middle two it doesn't like. Mousing over them yields:

Cannot resolve null definitions-debug

See attached image. I'm also having similar problems with my own custom plugins being marked invalid. Can someone help me interpret how IntelliJ resolves these set-property statements and what it doesn't like about the ones I've given?

Thanks.



Attachment(s):
intellij-error.png
7 comments
Comment actions Permalink

Hello,

Struts Assistant resolves all fields with a public setter for determining the possible values in <set-property> "property". There's a special case for TilesPlugin though providing additionally the special properties definitions-config, definitions-parser-validate and definitions-factory-class.

What version of Struts do you use? Can you point me to the documentation for the properties you are using?

Greetings,

Yann

0
Comment actions Permalink

I'm using Struts 1.2.9. Looking at the source, these are legacy properties that are deprecated but I believe still in use in the 1.2.9 codebase. From the javadocs in the source of DefinitionsFactoryConfig:

/**

  • Alternate name for parser debug details properties in configuration file.

  • @deprecated This will be removed in a release after Struts 1.2.

*/
public static final String PARSER_DETAILS_PARAMETER_NAME =
"definitions-parser-details";

/**

  • Alternate name for definition debug details properties in configuration file.

  • @deprecated This will be removed in a release after Struts 1.2.

*/
public static final String TILES_DETAILS_PARAMETER_NAME = "definitions-debug";

It appears they are used in this method which handles legacy names:

/**

  • Link old property names to new property names.

  • This modifies the map.

  • @param properties Map keyed by property name, with the

  • corresponding (String or String[]) value(s) to be set.

*/
static public void linkOldPropertyNames(Map properties) {
Set entries = properties.entrySet();
Map toAdd = new HashMap();
Iterator i = entries.iterator();
while (i.hasNext()) {
Map.Entry entry = (Map.Entry) i.next();

if (DEFINITIONS_CONFIG_PARAMETER_NAME.equals(entry.getKey())) {
toAdd.put("definitionConfigFiles", entry.getValue());

} else if (FACTORY_CLASSNAME_PARAMETER_NAME.equals(entry.getKey())) {
toAdd.put("factoryClassname", entry.getValue());

} else if (PARSER_DETAILS_PARAMETER_NAME.equals(entry.getKey())) {
toAdd.put("parserDebugLevel", entry.getValue());

} else if (PARSER_VALIDATE_PARAMETER_NAME.equals(entry.getKey())) {
toAdd.put("parserValidate", entry.getValue());

} else if (TILES_DETAILS_PARAMETER_NAME.equals(entry.getKey())) {
toAdd.put("debugLevel", entry.getValue());
}
}

if (toAdd.size() > 0) {
properties.putAll(toAdd);
}
}

So it seems I should be using "debugLevel" and "parserDebugLevel" but those aren't parsed by IntelliJ either.

0
Comment actions Permalink

Thanks for your feedback, please watch http://www.jetbrains.net/jira/browse/STRUTS-215 for further progress.

You can workaround the error highlighting by disabling "Struts Model Inspection" for the tags in question.

Yann

0
Comment actions Permalink

Yann

You mention disabling "Struts Model Inspection" for the tags in question (that is definitions-parser-details and definitions-debug) - but I can't find how to do that in Idea 7. Can you please explain how this is done.

Thanks

0
Comment actions Permalink

Position cursor on the red highlighted element, press Alt+Enter, Cursor right, select "disable for Tag"

0
Comment actions Permalink

Hi Yann
yes that's what I tried before but I just get two options of "Expand Empty Tag" and "Split Tag" and pressing the right cursor brings up the option to disable either of those. I don't get the "disable for tag" option you are referring to. It seems that what I am getting is not related to the red (error) highlighting on these two tags but rather to do with the yellow light globe code "hints" that are available for normal tags that are not highlighted as errors. Any further ideas? How about fixing the bug itself - it seems to have been in Jira for a while!
regards
Dave

0
Comment actions Permalink

I'm sorry, indeed suppressing the highlighting is not possible for this case.
I'll try to tackle this issue for IDEA 7.0.4

0

Please sign in to leave a comment.