Fix the use of quickstart with a combined base resource. - #15556
Fix the use of quickstart with a combined base resource.#15556lachlan-roberts wants to merge 3 commits into
Conversation
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
joakime
left a comment
There was a problem hiding this comment.
Mostly questions at this point.
| //check that webapp is suitable for quick start - it is not a packed war | ||
| String war = context.getWar(); | ||
| if (StringUtil.isBlank(war) || !context.getBaseResource().isDirectory()) | ||
| Resource baseResource = context.getBaseResource(); |
There was a problem hiding this comment.
is setWar() and setBaseResource() modifying the same variable?
In past versions, this was 2 separate concepts that got selected/merged at this point.
There was a problem hiding this comment.
is setWar() and setBaseResource() modifying the same variable?
No, but they are still closely related. For example setBaseResource() may be called with a resource obtained from getWar() by the WebInfConfiguration.
Or if setWar() was not explicitly set, then getWar() will initialize _war with a string obtained from the base resource path.
| } | ||
|
|
||
| @Test | ||
| public void testQuickStartWithCombinedBaseResource() throws Exception |
There was a problem hiding this comment.
Is there an existing testcase that only uses WebAppContext.setWar()?
There was a problem hiding this comment.
The test directly above this (testDuplicateGenerationFromContextXml) only uses setWar and not setBaseResource().
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
| if (StringUtil.isBlank(war) || !context.getBaseResource().isDirectory()) | ||
| Resource baseResource = context.getBaseResource(); | ||
| if (!Resources.isReadableDirectory(baseResource)) | ||
| throw new IllegalStateException("Invalid Quickstart location"); |
There was a problem hiding this comment.
It would be nice to add the baseResource in the ISE message to help quickly figuring out what the location is when this problem occurs.
Maybe something like: "Invalid Quickstart location, base resource is not a readable directory: " + baseResource?
There was a problem hiding this comment.
Have done this now for both EE10 and EE11.
Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
In the case of a
CombinedResourceas the base resource,context.getWar()will return null, which was causing this ISE to be thrown.We should instead test the value of
context.getBaseResource()due to the fact thatCombinedResourcecannot be converted toStringbycontext.getWar().