Announcement Announcement Module
Collapse
No announcement yet.
Beandoc crashing (on its samples!) Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    I've committed a fix (still untested until I get access to a 'doze box). The following patch should have the same effect but be a little more efficient (taken against 0.6.2)
    Code:
    Index: BeanDocUtils.java
    ===================================================================
    RCS file: /cvsroot/springframework/spring-beandoc/src/org/springframework/beandoc/util/BeanDocUtils.java,v
    retrieving revision 1.7
    diff -u -r1.7 BeanDocUtils.java
    --- BeanDocUtils.java	14 Jun 2005 00:20:49 -0000	1.7
    +++ BeanDocUtils.java	6 Oct 2005 17:31:57 -0000
    @@ -16,10 +16,9 @@
     
     package org.springframework.beandoc.util;
     
    -import java.io.IOException;
     import java.io.File;
     import java.io.FileFilter;
    -import java.util.ArrayList;
    +import java.io.IOException;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Collections;
    @@ -51,6 +50,11 @@
         
         private static final Log logger = LogFactory.getLog(BeanDocUtils.class);
         
    +    private static final boolean isWindows = 
    +        System.getProperty("os.name").toLowerCase().indexOf("windows") > -1;
    +        
    +    private static final String FILE_SEP_REGEX = (isWindows ? "\\\\" : File.separator);
    +    
         private static FileFilter dirFilter = new FileFilter() {
             public boolean accept(File pathname) {
                 return pathname.isDirectory();
    @@ -130,8 +134,7 @@
                 Resource[] resources = resolver.getResources(inputFileNames[i]);
                 allResources.addAll(Arrays.asList(resources));
             }
    -    
    -        File outputDir = new File(inputFileNames[inputFileNames.length - 1]);
    +        
             Resource[] inputFiles = (Resource[]) 
                 allResources.toArray(new Resource[allResources.size()]);
                 
    @@ -171,7 +174,7 @@
             List tokenList = new ArrayList(numFiles);        
             for &#40;int i = 0; i < numFiles; i++&#41;
                 try &#123;
    -                tokenList.add&#40;inputFiles&#91;i&#93;.getFile&#40;&#41;.getAbsolutePath&#40;&#41;.split&#40;File.separator&#41;&#41;;
    +                tokenList.add&#40;inputFiles&#91;i&#93;.getFile&#40;&#41;.getAbsolutePath&#40;&#41;.split&#40;FILE_SEP_REGEX&#41;&#41;;
                 &#125; catch &#40;IOException e&#41; &#123;
                     throw new BeanDocException&#40;"Failed to tokenize file resource paths.  Are your resources files?"&#41;;
                 &#125;
    Regards,

    Comment


    • #17
      davison; removing the space out of the target directory works a treat. To be clear I *do* have spaces on the input directory, but not the target.

      Thanks

      Col

      P.S. WinXP.

      Comment


      • #18
        thanks Colin - I'll add that to the TODO list so I don't forget about it again.

        Are you able to verify that the patch I posted to fix the RegEx file separator issue works? If it does, I'll get another release out with it in. Alternatively it's in CVS if you prefer to pull from there..

        Many thanks

        Comment

        Working...
        X