Navigation Menu

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

fixes: NoSuchFileException in logs and improper caching in devmode after removing a html file #5182

Merged
merged 2 commits into from Nov 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions core/devmode/src/main/java/io/quarkus/dev/DevModeMain.java
Expand Up @@ -87,6 +87,7 @@ public void start() throws Exception {

runtimeUpdatesProcessor = setupRuntimeCompilation(context);
if (runtimeUpdatesProcessor != null) {
runtimeUpdatesProcessor.checkForFileChange();
runtimeUpdatesProcessor.checkForChangedClasses();
}
//TODO: we can't handle an exception on startup with hot replacement, as Undertow might not have started
Expand Down
Expand Up @@ -283,7 +283,7 @@ private String getFileExtension(File file) {
return name.substring(lastIndexOf);
}

private Set<String> checkForFileChange() {
Set<String> checkForFileChange() {
Set<String> ret = new HashSet<>();
for (DevModeContext.ModuleInfo module : context.getModules()) {
final Set<Path> moduleResources = correspondingResources.computeIfAbsent(module.getName(),
Expand Down Expand Up @@ -334,6 +334,7 @@ private Set<String> checkForFileChange() {
});
}
for (Path i : seen) {
moduleResources.remove(i);
if (!Files.isDirectory(i)) {
Files.delete(i);
}
Expand Down
@@ -0,0 +1,26 @@
package io.quarkus.resteasy.test.files;

import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.asset.StringAsset;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;

import io.quarkus.test.QuarkusDevModeTest;
import io.restassured.RestAssured;

public class StaticResourceDeletionBeforeFirstRequestTest {

public static final String META_INF_RESOURCES_STATIC_RESOURCE_TXT = "META-INF/resources/static-resource.txt";

@RegisterExtension
static final QuarkusDevModeTest test = new QuarkusDevModeTest()
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class)
.addAsResource(new StringAsset("static resource content"), META_INF_RESOURCES_STATIC_RESOURCE_TXT));

@Test
public void shouldReturn404HttpStatusCode() {
test.deleteResourceFile(META_INF_RESOURCES_STATIC_RESOURCE_TXT); // delete the resource
machi1990 marked this conversation as resolved.
Show resolved Hide resolved
RestAssured.when().get("/static-resource.txt").then().statusCode(404);
}
}