[MAGNOLIA-6326] Don't fail when a resource exists as a folder in an origin and a file in another Created: 28/Jul/15 Updated: 07/Aug/15 Resolved: 04/Aug/15 |
|
| Status: | Closed |
| Project: | Magnolia |
| Component/s: | resource-loader |
| Affects Version/s: | None |
| Fix Version/s: | 5.4.1 |
| Type: | Improvement | Priority: | Critical |
| Reporter: | Magnolia International | Assignee: | Jaroslav Simak |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | backlog541, support | ||
| Remaining Estimate: | 0d | ||
| Time Spent: | 0.25d | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||
| Template: |
|
||||
| Acceptance criteria: |
Empty
|
||||
| Task DoD: |
[ ]*
Doc/release notes changes? Comment present?
[ ]*
Downstream builds green?
[ ]*
Solution information and context easily available?
[ ]*
Tests
[ ]*
FixVersion filled and not yet released
[ ] 
Architecture Decision Record (ADR)
|
||||
| Release notes required: |
Yes
|
||||
| Date of First Response: | |||||
| Epic Link: | Config by file / code | ||||
| Sprint: | Sprint 4 (Kromeriz) | ||||
| Story Points: | 5 | ||||
| Description |
|
Unfortunately, the following situation happens quite often: java.lang.IllegalStateException: Given resources are not all directory/file: [JcrResource{path=/foo/bar}, ClasspathResource{path=/foo/bar}] This is happening in info.magnolia.resourceloader.layered.LayeredResourceOrigin#newLayeredResource. We originally thought this would be a really unlikely and extreme case, so we just added a protective if block. It looks like this is happening to a few folks, especially with e.g themes, where for some reason we still strip the extension when importing nodes into JCR. TODO:
Workarounds:
|
| Comments |
| Comment by Magnolia International [ 06/Aug/15 ] |
|
Committed a few minor changes – have a look, take or reject.
In tests:
I was on the fence about the filtering – since we already apply the function once on the collection anyway (with the if (all()) statement), we might as well just filter right away. (We don't because we want to log.warn, although we could do that in predicate). OTOH, it's probably best to avoid filter/copy of the collection for 99% of the cases, and leave the double-execution of the predicate for the very rare cases that this issue fixes. Otherwise |