Hi,
I'm using Spring-3.1.1 and I have a question if the ResourceUtils correctly checks for JNLP connection ...
The following code should check if the connection is a JNLP connection.
I've debugged the code and the getName() of the connection returns the name with packages prefixed in case of using the Oracle JDK (as expected) what prevents the flag set to true.Code:/** * Set the {@link URLConnection#setUseCaches "useCaches"} flag on the * given connection, preferring <code>false</code> but leaving the * flag at <code>true</code> for JNLP based resources. * @param con the URLConnection to set the flag on */ public static void useCachesIfNecessary(URLConnection con) { con.setUseCaches(con.getClass().getName().startsWith("JNLP")); }
I think this call should use ClassUtils.getShortName() instead of getClass().getName().
I'm not sure if this is the correct forum for this question ... or is it better to create a JIRA issue?Code:/** * Set the {@link URLConnection#setUseCaches "useCaches"} flag on the * given connection, preferring <code>false</code> but leaving the * flag at <code>true</code> for JNLP based resources. * @param con the URLConnection to set the flag on */ public static void useCachesIfNecessary(URLConnection con) { con.setUseCaches(ClassUtils.getShortName(con.getClass()).startsWith("JNLP")); }
Cheers
Andi


Reply With Quote
