Uploaded image for project: 'SmartSprites'
  1. SmartSprites
  2. SMARTSPRITES-42

FileNotFoundException for sprite-generation with non default-default-output-dir and md5-uid generation

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.2.3
    • Fix Version/s: 0.2.4
    • Labels:
      None

      Description

      When using a non-default-output-dir and md5-uid generation the MD5-generation process throws the following FileNotFoundException.

      java.io.FileNotFoundException: C:\..\smartsprites\test\non-default-output-dir\img\relative.png (Das System kann die angegebene Datei nicht finden)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.<init>(FileInputStream.java:106)
      at org.carrot2.labs.smartsprites.SpriteBuilder.generateUidSuffix(SpriteBuilder.java:341)
      at org.carrot2.labs.smartsprites.SpriteBuilder.createProcessedCss(SpriteBuilder.java:231)
      at org.carrot2.labs.smartsprites.SpriteBuilder.rewriteCssFiles(SpriteBuilder.java:162)
      at org.carrot2.labs.smartsprites.SpriteBuilder.buildSprites(SpriteBuilder.java:115)
      at org.carrot2.labs.smartsprites.SpriteBuilderTest.buildSprites(SpriteBuilderTest.java:616)
      at org.carrot2.labs.smartsprites.SpriteBuilderTest.testNonDefaultOutputDir(SpriteBuilderTest.java:224)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
      at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
      at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
      at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
      at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
      at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:66)
      at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
      at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
      at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
      at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

      To reproduce this, just change the sprite-declarations in test/non-default-output-dir/css/styles.css to

      /** sprite: absolute; sprite-image: url('/img/absolute.png'); sprite-layout: horizontal; sprite-image-uid: md5*/
      /** sprite: relative; sprite-image: url('../img/relative.png'); sprite-layout: horizontal; sprite-image-uid: md5*/

      and run the testNonDefaultOutputDir test.

      The problem is, that during the md5-generation the SpriteBuilder is not using the non-default-output-dir to load the generated sprite (line 328-330).
      The uploaded patch should resolve this issue.

        Attachments

          Activity

            People

            • Assignee:
              stachoo Stanisław Osiński
              Reporter:
              cewers Christian Ewers
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: