Comments (9)
Ok, now I see, it was refactored a while ago.
Thanks.
But the changes will be available only in master branch, meaning - only for new versions.
You can update your implementation of CollectionResource to not return null but empty collection.
from milton2.
Which Java version do you use?
What I see here is
java.lang.NullPointerException: null
at java.base/java.util.ArrayList.addAll(ArrayList.java:702)
Array list throws an error on addAll.
Constructor of ArrayList doesn't use addAll - at least in recent versions of Java.
DeleteHelperImpl doesn't use any addAll calls.
I suspect it might be somewhere inside your CollectionResource implementation
from milton2.
java 11. Indeed, the constructor doesn't use addAll
, but:
public ArrayList(Collection<? extends E> c) {
Object[] a = c.toArray();
if ((size = a.length) != 0) {
Thus, c.toArray()
will fail with NPE, if c
is a null
.
from milton2.
and if you look at the javadoc, then ist clearly stated:
/**
* Constructs a list containing the elements of the specified
* collection, in the order they are returned by the collection's
* iterator.
*
* @param c the collection whose elements are to be placed into this list
* @throws NullPointerException if the specified collection is null
*/
from milton2.
Yes, I agree with javadoc. But what's confusing me - is the stacktrace
java.lang.NullPointerException: null
at java.base/java.util.ArrayList.addAll(ArrayList.java:702)
Why there is addAll?
I'm trying to reproduce it
List<? extends String> list = new ArrayList<>(null);
for (String s : list) {
System.out.println(s);
}
Here small code
It gives different trace
Exception in thread "main" java.lang.NullPointerException
at java.base/java.util.ArrayList.(ArrayList.java:179)
at Main.main(Main.java:6)
And it throws it exactly at constructor, while in your case it is thrown in the for loop
from milton2.
we use milton 2.7.3
from milton2.
It doesn't reject the fact it fails not on the constructor, but on the addAll method.
Can you check you CollectionResource implementation - the getChildren method - if it executes somewhere addAll?
from milton2.
In tag 2.7.3 code looks like this:
} else if (r instanceof CollectionResource) {
CollectionResource col = (CollectionResource) r;
List<Resource> list = new ArrayList<Resource>();
list.addAll(col.getChildren());
from milton2.
Related Issues (20)
- BeanPropertyResource does not work for AnnoCollectionResources? HOT 3
- CALDAV verification fails with iOS. HOT 4
- CVE-2014-0114: Upgrade commons-beanutils dependency HOT 2
- ERROR: Failed to resolve: io.milton:aspirin:0.10.03.03 HOT 1
- CVE-2019-10086: Upgrade commons-beanutils dependency HOT 3
- Change Propfind directory directive programming HOT 1
- FileItem: Add method to access Headers if file is multipart HOT 2
- Add support for multipart/mixed HOT 2
- No git tags, change logs or release notes HOT 1
- NullPointerException in SpecificityUtils
- Failed to read license xml HOT 1
- Milton CE GetableResource#sendContent() adds unwanted zero-bytes HOT 1
- 2.8.0.x < 2.8.0.2 no longer available on mvnrepository.com HOT 2
- Dependency org.apache.mina:mina-core, leading to CVE problem HOT 2
- Milton leaks ThreadLocals HOT 2
- Wrong website content HOT 3
- JSP views cannot set any headers
- Unable to set the HTTP status code via exception for POST, DELETE, MOVE and MKCOL
- javax jakarta HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from milton2.