Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-5673

Certain test names or test fixture parameters causes the plugin to try to write to illegal file names

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • nunit-plugin
    • None
    • Master: Hudson ver. 1.346, NUnit plugin ver: 0.9
      Slave: Windows Vista SP2

      Given this test class definition:

      [TestFixture(typeof(UnicodeEncoding))]
      public class TestByteStringParser<T> where T : Encoding, new()
      {
         //...
      }
      

      you will get the following error:

      ERROR: Publisher hudson.plugins.nunit.NUnitPublisher aborted due to exception
      hudson.util.IOException2: remote file operation failed: c:\build\workspace\dotnet-vizrt-win32 at hudson.remoting.Channel@1cd1d94:bgohudsontest
      	at hudson.FilePath.act(FilePath.java:690)
      	at hudson.FilePath.act(FilePath.java:676)
      	at hudson.plugins.nunit.NUnitPublisher.perform(NUnitPublisher.java:102)
      	at hudson.tasks.BuildStepMonitor$3.perform(BuildStepMonitor.java:36)
      	at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:582)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:563)
      	at hudson.model.AbstractBuild$AbstractRunner.performAllBuildStep(AbstractBuild.java:550)
      	at hudson.model.Build$RunnerImpl.post2(Build.java:152)
      	at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
      	at hudson.model.Run.run(Run.java:1221)
      	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
      	at hudson.model.ResourceController.execute(ResourceController.java:88)
      	at hudson.model.Executor.run(Executor.java:122)
      Caused by: java.io.FileNotFoundException: c:\build\workspace\dotnet-vizrt-win32\temporary-junit-reports\TEST-Vizrt.Utilities.Tests.TestByteStringParser<UnicodeEncoding>.TestMultipleStringsInOneBlock.xml (The filename, directory name, or volume label syntax is incorrect)
      	at java.io.FileOutputStream.open(Native Method)
      	at java.io.FileOutputStream.<init>(Unknown Source)
      	at java.io.FileOutputStream.<init>(Unknown Source)
      	at hudson.plugins.nunit.NUnitReportTransformer.splitJUnitFile(NUnitReportTransformer.java:105)
      	at hudson.plugins.nunit.NUnitReportTransformer.transform(NUnitReportTransformer.java:69)
      	at hudson.plugins.nunit.NUnitArchiver.invoke(NUnitArchiver.java:55)
      	at hudson.plugins.nunit.NUnitArchiver.invoke(NUnitArchiver.java:26)
      	at hudson.FilePath$FileCallableWrapper.call(FilePath.java:1962)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:114)
      	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
      	at hudson.remoting.Request$2.run(Request.java:270)
      	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)
      
      

      The part to note here is that it tries to write to the filename "TEST-Vizrt.Utilities.Tests.TestByteStringParser<UnicodeEncoding>.TestMultipleStringsInOneBlock.xml" which contains illegal characters.

      I did a little bit of digging and it seems like the characters come from NUnitReportTransformer.java line 104 which uses element.getAttribute("name") as a part of the filename without sanitizing any illegal characters.

            redsolo redsolo
            dagvl dagvl
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: