-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Closed
Copy link
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Andreas Kuhtz opened SPR-9547 and commented
The following code should check if the connection is a JNLP connection.
/**
* 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'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.
I think this call should use ClassUtils.getShortName() instead of getClass().getName().
/**
* 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"));
}
Affects: 3.1.1
Reference URL: http://forum.springsource.org/showthread.php?127798-ResourceUtils-and-JNLP
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug