History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: IDEADEV-22670
Type: Bug Bug
Status: Open Open
Priority: Normal Normal
Assignee: Dmitry Avdeev
Reporter: Chris Marshall
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
IDEA: Development

SpringModel inspection reports various problems which are not problems

Created: 17 Oct 07 15:00   Updated: 18 Oct 07 14:25
Component/s: Code Analysis. Inspection
Fix Version/s: None

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown
Environment: JDK 1.6.0_02, Spring 2.0.6, IDEA v7 on Windows XP.

Build: 7,361
Severity: Medium

Sub-Tasks  All   Open   
 Sub-Task Progress: 

 Description  « Hide
I have a working Spring XML config file and IDEA is reporting a number of problems with it:

1. <import resource="file:s:/statarb/gsatrader/live/config/spring/mail/internal-mail.xml"/>

IDEA is telling me that file:s:/statarb/gsatrader/live/config/spring/mail/internal-mail.xml is an invalid value but this works. The file exists.

2. <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="gsa.chasm.common.service.ModelServiceFactory.setModelService"/>
<property name="arguments" ref="modelService" />
</bean>

IDEA is telling me that the type of the "value" of arguments must be Object[]. Spring handles it (supplying a single value) perfectly though, so this should not be an error either.

3.
<bean id="dateService" class="gsa.chasm.server.service.impl.PositionDateServiceImpl">
<property name="rollTime" value="01:00" />
</bean>

IDEA is telling me that it cannot resolve symbol 01:00 The type of the property is one of my own classes for which I have supplied a custom editor (in the same Spring config file) at the top as follows:

<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="gsa.shared.datetime.XTimeOfDay">
<bean class="gsa.shared.datetime.XTimeOfDayEditor"/>
</entry>
</map>
</property>
</bean>

4. <bean id="rmiRegistry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
<property name="alwaysCreate" value="false" />
<property name="port" value="${rmi.registry.port}" />
</bean>

IDEA is telling me that it cannot convert the string ${rmi.registry.port} to an integer. However, IDEA should recognize that this is a property and will probably be replaced by a valid value at runtime.

5. <aop:config>
<aop:pointcut id="txOperation"
expression="execution(* gsa.rascal.server.service.impl.DelegatingPersistenceService.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txOperation"/>
</aop:config>

<aop:config>
<aop:pointcut id="txOperation2"
expression="execution(* gsa.rascal.server.service.impl.WaveAmendmentServiceImpl.amendMarketOrderFillPrices(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txOperation2"/>
</aop:config>

<aop:config>
<aop:pointcut id="txOperation3"
expression="execution(* gsa.rascal.server.service.impl.WaveAnalyticsServiceImpl.assignWaveFill(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="txOperation3"/>
</aop:config>

This is an odd one. In the third pointcut expression, the first instance of the word "rascal" is in red and IDEA tells me it cannot resolve the symbol "rascal". This is odd because it has no problems with the first two instances. Even odder is what happens when I attempt CTRL-SPACE after the "gsa." in each instance. Only the middle one offers me the "rascal" option!

As the advanced Spring (incl AOP) support would be a reason to upgrade, the fact that it seems as though some pretty basic bugs exist is a reason to not upgrade to v7 at this time.



 All   Comments   Work Log   Change History      Sort Order:
Dmitry Avdeev - 18 Oct 07 12:57
Hi Chris. Thanks for feedback. Regarding number 4: how do you have your PropertyPlaceholderConfigurer configured? Is it located in the same file/fileset as the property usage?

Dmitry Avdeev - 18 Oct 07 13:01
Regarding number 1: is the file located under your source roots? Why do you use absolute file path (which is not too reliable), instead of classpath or relative file path?

Chris Marshall - 18 Oct 07 13:11
Regarding #4; the first line in the file is:

<bean class="gsa.shared.spring.PropertyReplacer"/>

and this class extends PropertyPlaceholderConfigurer (does some extra stuff like understand dates)

Regarding #1; the file is not located under the source root. The file contains a centrally-defined Spring bean which enables emailing and can be imported from any Spring App in the company as this drive is mapped from everyone's PC. I wonder how you justify the fact that the absolute path is "not too reliable"? What can you mean?

There may be an alternative I suppose? How would you suggest I modify the classpath in order that this file be discoverable? My only argument against this is that it would NOT be clear from the Spring XML file exactly where the shared resource was located. I see no reason that it shouldn't be.


Taras Tielkes - 18 Oct 07 13:31
Regarding #4: at the moment IDEA only supports PropertyPlaceholderConfigurer, not any subclasses.
There is already a JIRA request to treat PropertyPlaceholderConfigurer subclasses the say way as regular PPC beans: IDEADEV-22431
Chris, could you take a look at the comments for IDEADEV-22431 and see if it would solve your issue?

Chris Marshall - 18 Oct 07 13:43
It may well do; I don't know how clever IDEA is being about this. All I need IDEA to do is decide that a PPC has been defined (whether it be a subclass or o/w) and then interpret ${x.y.z} values as being convertable to any model type (assuming there exists an appropriate Editor or the model type is convertable using a default Sprng Editor).

There isa further concern however. Spring allows you to alter the property pattern in the PPC and indeed we also use $[x.y.z] (i.e. square brackets). I would want these to be treated in the same manner. trouble is, IDEA could not possibly have any knowledge of this at design-time, so perhaps it's inevitable that this would raise a warning. Would be nice to have IDEA possibly treat both curly, square and normal brackets as possible property patterns.


Dmitry Avdeev - 18 Oct 07 13:55
Regarding #1: You could have a jar including the file and address it as something like "classpath:config/spring/mail/internal-mail.xml". Anyway, IDEA cannot resolve any references to files outside of project.

Chris Marshall - 18 Oct 07 14:06
But I can "attach source" to a JAR where the source is outside the project. Is this a "feature", or something that will be fixed? I don't expect to see errors when I'm doing something perfectly valid... if IDEA sees a "file:" in a Spring file, why can it not follow the path specified?

Taras Tielkes - 18 Oct 07 14:12
Chris, some more comments regarding #4:
  • IDEA does support custom prefix/suffix like $[x.y.z], however, only if these are configured on the PropertyPlacholderConfigurer using the "placeholderPrefix"/"placeholderSuffix" properties.
  • When using your custom gsa.shared.spring.PropertyReplacer bean, how do you specify the property file? Through the "location"/"locations" properties inherited from the PPC superclasss?

Dmitry Avdeev - 18 Oct 07 14:13
Yes, it is a "feature" (or a "limitation", if you want). I can suppress error highlighting on such usages, but references to the beans in this file won't be resolved. You can copy the file into your project and include it in the same fileset as a workaround.

Chris Marshall - 18 Oct 07 14:25
Well, when we start our application, we provide a list of .xml and .properties files. We have a "SpringMain" class which organises these using Spring's PPC class programmatically on startup.

Our PPC subclass which is defined in the XML file internally defines the placeholderPrefix and placeholderSuffix properties so it's impossible for IDEA to be aware of what they are at design-time.