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

JarEntry.getComment() returns incorrect result from NestedJarFile instances #39166

Closed
ql2023 opened this issue Jan 17, 2024 · 0 comments
Closed
Assignees
Labels
type: regression A regression from a previous release
Milestone

Comments

@ql2023
Copy link

ql2023 commented Jan 17, 2024

spring-boot-loader 3.2.0

test code:

public class NestedJarFileTests {

    public static void main(String[] args) throws IOException {

        try (JarArchiveOutputStream jar = new JarArchiveOutputStream(new FileOutputStream("app.jar"))) {
            jar.putArchiveEntry(new JarArchiveEntry("BOOT-INF"));
            jar.closeArchiveEntry();

            jar.putArchiveEntry(new JarArchiveEntry("BOOT-INF/classes/"));
            jar.closeArchiveEntry();
            for (int i = 0; i < 5; i++) {
                JarArchiveEntry entry = new JarArchiveEntry("BOOT-INF/classes/T" + i + ".class");
                entry.setComment("T" + i);
                jar.putArchiveEntry(entry);
                jar.write(UUID.randomUUID().toString().getBytes());
                jar.closeArchiveEntry();
            }
        }

        try (JarFile jf = new JarFile(new File("app.jar"))) {
            Enumeration<JarEntry> entries = jf.entries();
            while (entries.hasMoreElements()) {
                JarEntry entry = entries.nextElement();
                System.out.printf("entry=%s, comment=%s%n", entry.getName(), entry.getComment());
            }
        }

        try (NestedJarFile jf = new NestedJarFile(new File("app.jar"), "BOOT-INF/classes/")) {
            Enumeration<JarEntry> entries = jf.entries();
            while (entries.hasMoreElements()) {
                JarEntry entry = entries.nextElement();
                System.out.printf("entry=%s, comment=%s%n", entry.getName(), entry.getComment());
            }
        }
    }
}

output:

entry=BOOT-INF, comment=null
entry=BOOT-INF/classes/, comment=null
entry=BOOT-INF/classes/T0.class, comment=T0
entry=BOOT-INF/classes/T1.class, comment=T1
entry=BOOT-INF/classes/T2.class, comment=T2
entry=BOOT-INF/classes/T3.class, comment=T3
entry=BOOT-INF/classes/T4.class, comment=T4
entry=T0.class, comment=�1
entry=T1.class, comment=�1
entry=T2.class, comment=�1
entry=T3.class, comment=�1
entry=T4.class, comment=�1
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 17, 2024
@philwebb philwebb self-assigned this Jan 17, 2024
@philwebb philwebb changed the title JarEntry#getComment() get different value when use JarFile and NestedJarFile ? JarEntry.getComment() returns incorrect result from NestedJarFile instances Jan 17, 2024
@philwebb philwebb added type: regression A regression from a previous release and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 17, 2024
@philwebb philwebb added this to the 3.2.2 milestone Jan 17, 2024
ndwlocatieservices added a commit to ndwnu/nls-accessibility-map that referenced this issue Jun 28, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [nu.ndw.nls.springboot:openapi](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | build | patch | `3.2.6` -> `3.2.8` |
| [nu.ndw.nls.springboot:oauth2-client-credentials](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `3.2.6` -> `3.2.8` |
| [nu.ndw.nls.springboot:test](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | test | patch | `3.2.6` -> `3.2.8` |
| [nu.ndw.nls.springboot:security](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `3.2.6` -> `3.2.8` |
| [nu.ndw.nls.springboot:messaging](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `3.2.6` -> `3.2.8` |
| [nu.ndw.nls.springboot:datadog](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `3.2.6` -> `3.2.8` |
| [nu.ndw:nls-nwb-data-access-jooq](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | patch | `4.2.5` -> `4.2.6` |
| [org.springframework.boot:spring-boot-starter-parent](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | parent | patch | `3.2.1` -> `3.2.2` |

---

### Release Notes

<details>
<summary>spring-projects/spring-boot (org.springframework.boot:spring-boot-starter-parent)</summary>

### [`v3.2.2`](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.2)

[Compare Source](spring-projects/spring-boot@v3.2.1...v3.2.2)

#### 🐞 Bug Fixes

-   SslBundle implementations do not provide useful toString() results [#&#8203;39167](spring-projects/spring-boot#39167)
-   JarEntry.getComment() returns incorrect result from NestedJarFile instances [#&#8203;39166](spring-projects/spring-boot#39166)
-   Mixing PEM and JKS certificate material in server.ssl properties does not work [#&#8203;39158](spring-projects/spring-boot#39158)
-   Having AspectJ and Micrometer on the classpath is not a strong enough signal to enable support for Micrometer observation annotations [#&#8203;39128](spring-projects/spring-boot#39128)
-   Actuator endpoints with no operations that use selectors are not accessible when mapped to / [#&#8203;39122](spring-projects/spring-boot#39122)
-   Spring Boot 3.2 app that uses WebFlux, Security, and Actuator may fail to start due to a missing authentication manager [#&#8203;39096](spring-projects/spring-boot#39096)
-   management.observations.http.server.requests.name no longer has any effect [...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: regression A regression from a previous release
Projects
None yet
Development

No branches or pull requests

3 participants