Announcement Announcement Module
Collapse
No announcement yet.
ResourceUtils and JNLP ... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ResourceUtils and JNLP ...

    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.
    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'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().

    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"));
    }
    I'm not sure if this is the correct forum for this question ... or is it better to create a JIRA issue?

    Cheers
    Andi

  • #2
    If you think it is a bug or if it is wrong create a JIRA.

    Comment


    • #3
      Issue created

      Done: https://jira.springsource.org/browse/SPR-9547

      Comment

      Working...
      X