diff options
author | John Ahlroos <john@vaadin.com> | 2013-03-01 10:41:24 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-03-01 09:35:43 +0000 |
commit | b056c43954fde77c5bdf4116aa1f0a948b954037 (patch) | |
tree | 70b5db070f0a0f7dbf660833d6ded879a9d33692 /theme-compiler/src/com/vaadin/sass | |
parent | a2636a774d599ba0154a89c9c11744805cc06afa (diff) | |
download | vaadin-framework-b056c43954fde77c5bdf4116aa1f0a948b954037.tar.gz vaadin-framework-b056c43954fde77c5bdf4116aa1f0a948b954037.zip |
Prevent NPE when a SCSS file is not found #11099
Change-Id: Id0e0fd6a31f4089228b02bf8b66086d3f3a1727b
Diffstat (limited to 'theme-compiler/src/com/vaadin/sass')
-rw-r--r-- | theme-compiler/src/com/vaadin/sass/SassCompiler.java | 7 | ||||
-rw-r--r-- | theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java | 12 |
2 files changed, 17 insertions, 2 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/SassCompiler.java b/theme-compiler/src/com/vaadin/sass/SassCompiler.java index 840badfc25..48b2d24c46 100644 --- a/theme-compiler/src/com/vaadin/sass/SassCompiler.java +++ b/theme-compiler/src/com/vaadin/sass/SassCompiler.java @@ -17,6 +17,7 @@ package com.vaadin.sass; import java.io.File; +import java.io.FileNotFoundException; import java.io.FileWriter; import java.io.IOException; @@ -48,6 +49,12 @@ public class SassCompiler { // ScssStylesheet.setStylesheetResolvers(new VaadinResolver()); ScssStylesheet scss = ScssStylesheet.get(input); + if(scss == null){ + System.err.println("The scss file " + input + + " could not be found."); + return; + } + scss.compile(); if (output == null) { System.out.println(scss.toString()); diff --git a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java index 688d569dff..dbb3e571dc 100644 --- a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java +++ b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java @@ -78,7 +78,8 @@ public class ScssStylesheet extends Node { * ScssStylesheet tree out of it. Calling compile() on it will transform * SASS into CSS. Calling toString() will print out the SCSS/CSS. * - * @param file + * @param identifier + * The file path. If null then null is returned. * @return * @throws CSSException * @throws IOException @@ -93,7 +94,8 @@ public class ScssStylesheet extends Node { * builds up a ScssStylesheet tree out of it. Calling compile() on it will * transform SASS into CSS. Calling toString() will print out the SCSS/CSS. * - * @param file + * @param identifier + * The file path. If null then null is returned. * @param encoding * @return * @throws CSSException @@ -109,6 +111,12 @@ public class ScssStylesheet extends Node { * * @charset declaration, the default one is ASCII. */ + + if (identifier == null) { + return null; + } + + // FIXME Is this actually intended? /John 1.3.2013 File file = new File(identifier); file = file.getCanonicalFile(); |