Skip to content

"java.lang.IllegalStateException: zip file closed" when call JarFileWrapper.stream() of spring-boot-loader  #23821

@tunefun

Description

@tunefun

spring-boot-maven-plugin:2.3.4.RELEASE

package test;

import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URLConnection;

@SpringBootApplication
public class App {

    public static void main(String[] args) throws IOException {
        URLConnection urlConnection = App.class.getResource("/test/App.class").openConnection();
        if (urlConnection instanceof JarURLConnection) {
            JarURLConnection jarURLConnection = (JarURLConnection) urlConnection;
            // will case java.lang.IllegalStateException: zip file closed
            jarURLConnection.getJarFile().stream();
        }
    }

}

The reason causing this problem is org.springframework.boot.loader.jar.JarFileWrapper not override method stream()

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions