Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Import in CSS causes error on startup #6061

Closed
ggecy opened this issue Jul 12, 2019 · 1 comment · Fixed by #6078
Closed

@Import in CSS causes error on startup #6061

ggecy opened this issue Jul 12, 2019 · 1 comment · Fixed by #6078

Comments

@ggecy
Copy link

ggecy commented Jul 12, 2019

When starting application which imports JS Module containing CSS where there is the following line inside @import url('https://fonts.googleapis.com/css?family=Montserrat:700'); the following exception is thrown

java.lang.IllegalStateException: Failed to update the Flow imports file project_dir\target\frontend\generated-flow-imports.js'
at com.vaadin.flow.server.frontend.TaskUpdateImports.execute(TaskUpdateImports.java:100) ~[flow-server-2.0.2.jar:2.0.2]
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540) ~[na:na]
at com.vaadin.flow.server.frontend.NodeTasks.execute(NodeTasks.java:303) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.startup.DevModeInitializer.initDevModeHandler(DevModeInitializer.java:204) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:284) ~[vaadin-spring-12.0.2.jar:na]
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4680) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5150) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]
at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140) ~[na:na]
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:928) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.apache.catalina.startup.Tomcat.start(Tomcat.java:455) ~[tomcat-embed-core-9.0.17.jar:9.0.17]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:106) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.(TomcatWebServer.java:86) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:427) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:180) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.1.6.RELEASE.jar:5.1.6.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) ~[spring-boot-2.1.4.RELEASE.jar:2.1.4.RELEASE]
at ...
Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 10: url('https:

.nis-flex-centered-content {
display: flex
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182) ~[na:na]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153) ~[na:na]
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77) ~[na:na]
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92) ~[na:na]
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229) ~[na:na]
at java.base/java.nio.file.Path.resolve(Path.java:515) ~[na:na]
at com.vaadin.flow.server.frontend.TaskUpdateImports.resolve(TaskUpdateImports.java:251) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.frontend.TaskUpdateImports.visitImportsRecursively(TaskUpdateImports.java:217) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.frontend.TaskUpdateImports.handleImports(TaskUpdateImports.java:199) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.frontend.TaskUpdateImports.visitImportsRecursively(TaskUpdateImports.java:225) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.frontend.TaskUpdateImports.handleImports(TaskUpdateImports.java:199) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.frontend.TaskUpdateImports.modulesToImports(TaskUpdateImports.java:163) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.frontend.TaskUpdateImports.getMainJsContent(TaskUpdateImports.java:131) ~[flow-server-2.0.2.jar:2.0.2]
at com.vaadin.flow.server.frontend.TaskUpdateImports.execute(TaskUpdateImports.java:97) ~[flow-server-2.0.2.jar:2.0.2]
... 44 common frames omitted

The exception is thrown because com.vaadin.flow.server.frontend.ImportExtractor extracts the "@import" statement from CSS code inside the JS module:

const container = document.createElement('template');

container.innerHTML = `
    <dom-module id="gui-styles">
        <template>
            <style>
                @import url('https://fonts.googleapis.com/css?family=Montserrat:700');
...
            </style>
        </template>
    </dom-module>`;
document.head.appendChild(container.content);

- Vaadin / Flow version - vaadin version 14.0.0.rc4, flow-server-2.0.2.jar
@project-bot project-bot bot added this to Inbox - needs triage in OLD Vaadin Flow ongoing work (Vaadin 10+) Jul 12, 2019
@denis-anisimov
Copy link
Contributor

Right, my bad.
We should not go into the content for extracting import statements.

@denis-anisimov denis-anisimov self-assigned this Jul 15, 2019
@project-bot project-bot bot moved this from Inbox - needs triage to In progress in OLD Vaadin Flow ongoing work (Vaadin 10+) Jul 15, 2019
OLD Vaadin Flow ongoing work (Vaadin 10+) automation moved this from In progress to Done - pending release Jul 17, 2019
@mehdi-vaadin mehdi-vaadin added this to the 2.0.4 milestone Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
OLD Vaadin Flow ongoing work (Vaadin ...
  
Done - pending release
Development

Successfully merging a pull request may close this issue.

3 participants