[ 
https://issues.jenkins-ci.org/browse/JENKINS-4836?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Karsten Brandt updated JENKINS-4836:
------------------------------------

    Attachment: SloccountReports.java.patch

This patch should solve this issue in a simple way.
                
> SLOCCount plugin fails with Windows/Cygwin SLOCCount execution
> --------------------------------------------------------------
>
>                 Key: JENKINS-4836
>                 URL: https://issues.jenkins-ci.org/browse/JENKINS-4836
>             Project: Jenkins
>          Issue Type: Bug
>          Components: sloccount
>    Affects Versions: current
>         Environment: Platform: All, OS: Windows XP
>            Reporter: kmmoens
>            Assignee: npiguet
>            Priority: Critical
>         Attachments: cygwin.patch, sloccount-output.txt, 
> SloccountReports.java.patch
>
>
> In our setup we have a master Hudson machine running on Linux with one slave
> macine running Windows XP. This last machine is responsible for any
> Windows-specific builds in our environment. To have some metrics, we make use 
> of
> SLOCCount both for the Linux and Windows projects, the SLOCCount plugin works
> perfect for our Linux projects but fails to work on the Windows ones.
> On Windows SLOCCount itself has to be executed from CygWin (Linux Emulation)
> which works without problems and gives the proper output format. An extract of
> this file is as follows:
>   Have a non-directory at the top, so creating directory top_dir
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/BetaUpdate.exe to
> top_dir
>   Creating filelist for Config
>   Creating filelist for FsInt
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/IvAp.sln to 
> top_dir
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/IvAp.svnprops to
> top_dir
>   Creating filelist for IvapMsgLib
>   Creating filelist for NetInt
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/ResourceMerge.exe
> to top_dir
>   Creating filelist for UsrHost
>   Creating filelist for UsrInt
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/cppcheck.txt to 
> top_dir
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/cppcheck.xml to 
> top_dir
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/errors.h to 
> top_dir
>   Creating filelist for installtester
>   Creating filelist for ivapconfig
>   Creating filelist for libraries
>   Creating filelist for mtlbuilder
>   Adding /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/version.h to 
> top_dir
>   Categorizing files.
>   Finding a working MD5 command....
>   Found a working MD5 command.
>   Computing results.
>   177 ansic   FsInt
> /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/FsInt/ModuleUser.c
>   120 ansic   FsInt
> /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/FsInt/AdvWeather.h
>   70  ansic   FsInt
> /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src/FsInt/FSUIPCNewWeather.h
> 57    ansic   FsInt   /cygdrive/h/###_Hudson/workspace/IvAp_v1.x/ivap/src
> As soon as Hudson starts collecting the results, we find this exception in our
> console log:
>   java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>       at java.lang.String.substring(Unknown Source)
>       at
> hudson.plugins.sloccount.model.SloccountReport.extractFolder(SloccountReport.java:64)
>       at 
> hudson.plugins.sloccount.model.SloccountReport.add(SloccountReport.java:42)
>       at
> hudson.plugins.sloccount.model.SloccountParser.parseLine(SloccountParser.java:91)
>       at 
> hudson.plugins.sloccount.model.SloccountParser.parse(SloccountParser.java:58)
>       at 
> hudson.plugins.sloccount.model.SloccountParser.parse(SloccountParser.java:49)
>       at 
> hudson.plugins.sloccount.model.SloccountParser.invoke(SloccountParser.java:39)
>       at 
> hudson.plugins.sloccount.model.SloccountParser.invoke(SloccountParser.java:17)
>       at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2068)
>       at hudson.remoting.UserRequest.perform(UserRequest.java:104)
>       at hudson.remoting.UserRequest.perform(UserRequest.java:48)
>       at hudson.remoting.Request$2.run(Request.java:250)
>       at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
>       at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
>       at java.util.concurrent.FutureTask.run(Unknown Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown 
> Source)
>       at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
>       at hudson.remoting.Engine$1$1.run(Engine.java:58)
>       at java.lang.Thread.run(Unknown Source)
> Based on a quick look at your source code I am assuming this is a problem
> related to the file separator. I.e. the data is collected on a Windows slave
> (separator = \), while the paths in the file are from CygWin (separator = /). 
> I
> suggest to use both for detecting the paths.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jenkins-ci.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to