Directory Client API
  1. Directory Client API
  2. DIRAPI-82

Loading class file as stream under Windows bugged

    Details

      Description

      The method
      org.apache.directory.shared.ldap.sp.JavaStoredProcUtils.getClassFileAsStream(clazz: Class<?>): byte[]
      returns zero bytes under Windows if the path to the class contains at least one space character. This affects the possibility to load stored procedures. No exception is thrown.

      For example:
      Reading the file "C:\a a\foo.class" would return zero bytes, because
      clazz.getResource( classFileName ).getFile()
      returns the String "/C:/a%20a/foo.class". So in the following
      URL url = clazz.getResource( classFileName );
      File file = new File( url.getFile() );
      the file can not be found, because it searches for the "C:/a%20a" directory which doesn't exist.

      Solution:
      Instead of url.getFile() use url.toURI()

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        68d 9h 30m 1 Emmanuel Lecharny 01/May/12 00:54
        Resolved Resolved Closed Closed
        982d 17h 22m 1 Emmanuel Lecharny 08/Jan/15 17:17
        Emmanuel Lecharny made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Emmanuel Lecharny [ elecharny ]
        Hide
        Emmanuel Lecharny added a comment -

        Closing the resolved issues.

        Show
        Emmanuel Lecharny added a comment - Closing the resolved issues.
        Emmanuel Lecharny made changes -
        Fix Version/s 1.0.0-M12 [ 12320050 ]
        Emmanuel Lecharny made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Hide
        Emmanuel Lecharny added a comment -

        Thanks for the proposed fixes !

        Applied with http://svn.apache.org/viewvc?rev=1332475&view=rev

        Show
        Emmanuel Lecharny added a comment - Thanks for the proposed fixes ! Applied with http://svn.apache.org/viewvc?rev=1332475&view=rev
        Vitali Baumtrok created issue -

          People

          • Assignee:
            Emmanuel Lecharny
            Reporter:
            Vitali Baumtrok
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development