glassfish
  1. glassfish
  2. GLASSFISH-2520

Loading of persistence.xml fails on assert on windows when path contains spaces

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      2,520
    • Status Whiteboard:
      Hide

      v2.1.1_exclude

      Show
      v2.1.1_exclude

      Description

      When toplink is loading the persistence.xml file, the assert fails in case the
      file is located in classpath directly (not in jar) and the filename path
      contains spaces.

      The problematic code is this PersistenceUnitProcessor method:

      private static URL computePURootURL(URL pxmlURL) throws IOException {
      String protocol = pxmlURL.getProtocol();
      if("file".equals(protocol)) { // NOI18N
      // e.g. file:/tmp/META-INF/persistence.xml
      assert(new File(pxmlURL.getFile()).isFile());

      The "new File(pxmlURL.getFile()).isFile()" fails in case of spaces in the path.

      This line suffers from the know "won't-fix" Java issue -
      http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4466485

      Solution:
      instead of
      new File(pxmlURL.getFile())
      one should use
      new File(pxmlURL.toURI())

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        Are you using TopLink Essential in Java SE mode?
        You must be explicitly enabling assertions to get that message, right? There are
        a couple of work arounds to this issue:
        1. don't enable assertions for that class by using "-da" option.
        2. don't use a directory which has a white space in its name.

        Although I agree this is a bug, I don't think it's a P1, so I am downgrading the
        priority to p4.

        – Sahoo

        Show
        Sanjeeb Sahoo added a comment - Are you using TopLink Essential in Java SE mode? You must be explicitly enabling assertions to get that message, right? There are a couple of work arounds to this issue: 1. don't enable assertions for that class by using "-da" option. 2. don't use a directory which has a white space in its name. Although I agree this is a bug, I don't think it's a P1, so I am downgrading the priority to p4. – Sahoo
        Hide
        gfbugbridge added a comment -

        <BT6540742>

        Show
        gfbugbridge added a comment - <BT6540742>
        Hide
        chandrakumarm added a comment -
            • Issue 2520 has been confirmed by votes. ***
        Show
        chandrakumarm added a comment - Issue 2520 has been confirmed by votes. ***
        Hide
        chandrakumarm added a comment -

        No testing this Issue, we found that it also occur on Linux OS (Fedora 11) also.
        So i rise the issue priority p2.

        Show
        chandrakumarm added a comment - No testing this Issue, we found that it also occur on Linux OS (Fedora 11) also. So i rise the issue priority p2.
        Hide
        Ed Bratt added a comment -

        Will not fix in v2.1.1

        Show
        Ed Bratt added a comment - Will not fix in v2.1.1
        Hide
        Tom Mueller added a comment -

        Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

        Show
        Tom Mueller added a comment - Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

          People

          • Assignee:
            tware
            Reporter:
            letenay
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: