Grails
  1. Grails
  2. GRAILS-7986

No TOC entry found for... messages on Windows

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-M1
    • Fix Version/s: 2.0-RC1
    • Component/s: Documentation
    • Labels:
      None
    • Environment:
      Windows 7 x64

      Description

      On Windows using the documentation stated in chapter 3 of the online docs for 2.0.0.M1, I am getting "No TOC entry found for..." messages in the console when running the grails doc command.

      Looks like the files in gdocFilesInToc in DocPublisher were using '\' as the path separator (windows), and the actual section references from the generated toc in DocPublisher are using '/' as the path separator. Found the root cause in grails-docs/src/main/groovy/grails/doc/internal/YamlTocStrategy.groovy using '/' constant instead of File.separator for the file system dependent separator. Made the fix and submitting pull request to grails-core/grails-doc on github.

        Activity

        Show
        Brian Saville added a comment - https://github.com/grails/grails-core/pull/102
        Hide
        Brian Saville added a comment -

        Saw the pull request come through on this one - but the ticket was never resolved? Waiting on a test case? Just curious if this actually made it into 2.0.0.M2 or not.

        Show
        Brian Saville added a comment - Saw the pull request come through on this one - but the ticket was never resolved? Waiting on a test case? Just curious if this actually made it into 2.0.0.M2 or not.
        Hide
        Peter Ledbrook added a comment - - edited

        I'm going to leave this open because I think the fix is wrong. filePath is a logical path, not necessarily a path on the file system. That's why the existence check is delegated to the resource checker. What if the resource checker is querying the classpath? Then the File.separator is completely inappropriate.

        In fact, I can't see where the bug is at all. Remember that File will accept '/' as a separator even on Windows. Do you have a reproducible example?

        Show
        Peter Ledbrook added a comment - - edited I'm going to leave this open because I think the fix is wrong. filePath is a logical path, not necessarily a path on the file system. That's why the existence check is delegated to the resource checker. What if the resource checker is querying the classpath? Then the File.separator is completely inappropriate. In fact, I can't see where the bug is at all. Remember that File will accept '/' as a separator even on Windows. Do you have a reproducible example?
        Hide
        Peter Ledbrook added a comment -

        OK, found it.

        Show
        Peter Ledbrook added a comment - OK, found it.
        Hide
        Brian Saville added a comment -

        I believe (not sure on this one) that if it used the .absolutePath on the file, it would work, but since it doesn't do this before returning in YamlTocStrategy it fails when comparing in DocPublisher to files that use .absolutePath. Does that make sense? Using Path.separator seemed to be the quickest and easiest fix without passing in the base dir and cutting it off the relative path constructed in YamlTocStrategy.determineFilePath.

        Show
        Brian Saville added a comment - I believe (not sure on this one) that if it used the .absolutePath on the file, it would work, but since it doesn't do this before returning in YamlTocStrategy it fails when comparing in DocPublisher to files that use .absolutePath . Does that make sense? Using Path.separator seemed to be the quickest and easiest fix without passing in the base dir and cutting it off the relative path constructed in YamlTocStrategy.determineFilePath .
        Hide
        Brian Saville added a comment -

        Didn't realize it would take a classpath as well, well then this may require a different fix.

        Show
        Brian Saville added a comment - Didn't realize it would take a classpath as well, well then this may require a different fix.
        Hide
        Peter Ledbrook added a comment -

        Don't worry, it wasn't documented. Actually, the resourceChecker abstraction was introduced to allow simpler unit testing. But it means that YamlTocStrategy has no dependency on the file system. Anyway, I've fixed the problem and I'll resolve the issue once I push to GitHub.

        Show
        Peter Ledbrook added a comment - Don't worry, it wasn't documented. Actually, the resourceChecker abstraction was introduced to allow simpler unit testing. But it means that YamlTocStrategy has no dependency on the file system. Anyway, I've fixed the problem and I'll resolve the issue once I push to GitHub.

          People

          • Assignee:
            Peter Ledbrook
            Reporter:
            Brian Saville
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Last Reviewed:

              Development