summaryrefslogtreecommitdiffstats
path: root/theme-compiler
diff options
context:
space:
mode:
authorArtur Signell <artur@vaadin.com>2013-09-02 22:28:19 +0300
committerArtur Signell <artur@vaadin.com>2013-09-02 23:29:30 +0300
commit261a3ba76a523d7e8d6b717f6f9d67eaef8c901f (patch)
tree4eb3448dfc6e0488711985869b843d66c85779cd /theme-compiler
parentbe3953c0686a4bd59fe9df2c401d882104a7afac (diff)
downloadvaadin-framework-261a3ba76a523d7e8d6b717f6f9d67eaef8c901f.tar.gz
vaadin-framework-261a3ba76a523d7e8d6b717f6f9d67eaef8c901f.zip
Improve error message for missing imports (#12494)
Change-Id: Ic320ac6f54e928939773495a5168ac674d6a1a33
Diffstat (limited to 'theme-compiler')
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java26
-rw-r--r--theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java9
2 files changed, 26 insertions, 9 deletions
diff --git a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
index dbb3e571dc..704425e300 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/ScssStylesheet.java
@@ -59,7 +59,7 @@ public class ScssStylesheet extends Node {
private static HashMap<Node, Node> lastNodeAdded = new HashMap<Node, Node>();
- private String fileName;
+ private File file;
private String charset;
@@ -162,7 +162,7 @@ public class ScssStylesheet extends Node {
InputSource source = resolver.resolve(identifier);
if (source != null) {
File f = new File(source.getURI());
- setFileName(f.getParent());
+ setFile(f);
return source;
}
}
@@ -355,12 +355,28 @@ public class ScssStylesheet extends Node {
return mixinDefs.get(name);
}
- public void setFileName(String fileName) {
- this.fileName = fileName;
+ public void setFile(File file) {
+ this.file = file;
}
+ /**
+ * Returns the directory containing this style sheet
+ *
+ * @since 7.2
+ * @return The directory containing this style sheet
+ */
+ public String getDirectory() {
+ return file.getParent();
+ }
+
+ /**
+ * Returns the full file name for this style sheet
+ *
+ * @since 7.2
+ * @return The full file name for this style sheet
+ */
public String getFileName() {
- return fileName;
+ return file.getPath();
}
public static HashMap<Node, Node> getLastNodeAdded() {
diff --git a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java
index cb9896967a..87c7cadcf8 100644
--- a/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java
+++ b/theme-compiler/src/com/vaadin/sass/internal/visitor/ImportNodeHandler.java
@@ -58,7 +58,7 @@ public class ImportNodeHandler {
if (!importNode.isPureCssImport()) {
try {
StringBuilder filePathBuilder = new StringBuilder(
- styleSheet.getFileName());
+ styleSheet.getDirectory());
filePathBuilder.append(File.separatorChar).append(
importNode.getUri());
if (!filePathBuilder.toString().endsWith(".scss")) {
@@ -73,9 +73,10 @@ public class ImportNodeHandler {
imported = ScssStylesheet.get(importNode.getUri());
}
if (imported == null) {
- throw new FileNotFoundException(importNode.getUri()
- + " (parent: "
- + ScssStylesheet.get().getFileName() + ")");
+ throw new FileNotFoundException("Import '"
+ + importNode.getUri() + "' in '"
+ + styleSheet.getFileName()
+ + "' could not be found");
}
traverse(imported);