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

The "spring-boot-starter-test" package:3.1.5" carries with it an incomplete implementation of the "json" library, which leads to an error in runtime #41201

Closed
Nphox opened this issue Jun 21, 2024 · 2 comments
Labels
status: duplicate A duplicate of another issue

Comments

@Nphox
Copy link

Nphox commented Jun 21, 2024

The "spring-boot-starter-test:3.1.5" there is a dependency on the library "jsonassert:1.5.1" which in turn has a dependency on the library "android-json:0.0.20131108.vaadin1".

Screenshot_190

The latter contains its own implementation of the "json" library from the group "org.json" (https://mvnrepository.com/artifact/org.json/json).

This implementation is incomplete and incompatible with the API declared in the original library, namely the org.json.JSONArray class does not have the "isEmpty" method.

This leads to the addition of the "spring-boot-starter-test" dependency:3.1.5" to a project that already uses the library "json:20220924" leads to the replacement of the original library with an implementation from "android-json:0.0.20131108.vaadin1".

And as a result, your application will crash in runtime with the error "java.lang.NoSuchMethodError 'boolean org.json.JSONArray.isEmpty()"if you use this method anywhere in your code.

Of course, you can solve the problem by excluding this library from the package "spring-boot-starter-test" for example, using the element in MAVEN

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>com.vaadin.external.google</groupId>
                    <artifactId>android-json</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

but nevertheless, I think it's worth solving this problem in another way - not to supply the "spring-boot-starter-test" library package with this "android-json" dependency.:0.0.20131108.vaadin1".

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 21, 2024
@wilkinsona
Copy link
Member

wilkinsona commented Jun 21, 2024

Duplicates #9248.

I'm afraid that nothing's changed since #9248 and there's nothing that we can do about this due to the licensing of org.json:json. While the licence was changed in 2022, it now simply states that it is "Public Domain". This is not a recognised open source licence so, unfortunately, we and many other projects in the Java ecosystem do not feel that they can safely depend upon it.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue and removed status: waiting-for-triage An issue we've not yet triaged labels Jun 21, 2024
@Nphox
Copy link
Author

Nphox commented Jun 22, 2024

Eh, but thanks for your answer anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants