Regression since 2.3.0.M3. Create a Spring Boot 2.3.0.M4 project from start.spring.io and activate layered jar:

bootJar {
    layered()
}

Add a file src/main/resources/Test File.txt

I used Gradle wrapper using Gradle 6.3 and Java -- but I suspect same would happen in Maven:

Run * gradlew clean bootJar * java -Djarmode=layertools -jar build\libs\sbm4-gradle-layered-bug-0.0.1-SNAPSHOT.jar list

Result is exception including the following:

Caused by: java.lang.IllegalStateException: Layer index file is malformed
        at org.springframework.util.Assert.state(Assert.java:73)
        at org.springframework.boot.jarmode.layertools.IndexedLayers.lambda$new$1(IndexedLayers.java:49)

Note that layers.idx has an entry with spaces in it: * application BOOT-INF/classes/Test File.txt

The code around IndexedLayers.java:49

            String[] content = line.split(" ");
            Assert.state(content.length == 2, "Layer index file is malformed");
            this.layers.add(content[0], content[1]);

This code performs a split on spaces and asserts that the result is 2 strings. This doesn't work on the layers.idx file where the path has spaces in it.

Suggested fix, set limit parameter on split method to 2:

line.split(" ", 2)

This is assuming there is not any other code in the layer management that cares about spaces in the file names...