#330 Can't parse non-ascii characters in string token

release_3.5
closed
5
2012-10-10
2005-06-08
Ken Koster
No

Checkstyle has difficulties parsing files that have
non-ascii characters in string constants. I've
attached a copy of a file that produces the behavior.

Discussion

  • Ken Koster
    Ken Koster
    2005-06-08

    zip file containing java file that exhibits bug

     
    Attachments
  • Logged In: YES
    user_id=1022106

    Actually, more acurately, Checkstyle had problems parsing ascii
    characters in string tokens!

    The problem here was that your string had an embedded null (\0 or \u0000
    before escpaing) and our grammar wasn't expecting characters in the range
    \0000 to \0002 although they are perfectly legal in Java. This is now fixed
    for version 4.0 (I don't believe there will be any more 3.5 releases so you'll
    have to upgrade).

     
  • Logged In: YES
    user_id=1022106

    Just to clarify, this has been fixed against CVS HEAD so
    will be in the next beta or full release as the case may be.

     
  • Ken Koster
    Ken Koster
    2005-06-09

    Logged In: YES
    user_id=1127974

    Will do. Thanks!

     
  • David Vydra
    David Vydra
    2005-06-29

    Logged In: YES
    user_id=125874

    I still see the bug in 4.0 beta 4. I have a \0 embedded in a
    string. Can someone please look at it again?

    Thanks
    David

    === my snapshot ===

    jC:\data\dev\bug6028>java -cp
    C:\data\dev\checkstyle-4.0-beta4\checkstyle-all-4.0
    -beta4.jar com.puppycrawl.tools.checkstyle.Main -c
    sun_checks.xml WithNull.java

    Starting audit...
    C:\data\dev\bug6028\package.html:0: Missing package
    documentation file.
    WithNull.java:13:24: Got an exception - expecting '"', found ' '
    Audit done.

     
  • Logged In: YES
    user_id=1022106

    My comment indicating it was resolved were made one day after beta 4
    was released hence the fix for this will be in beta 5. If you really want this
    fix now then CVS HEAD is the best we can offer.