-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Fix demo-spec webapp failures #10178
Conversation
context.setAttribute("org.example.Foo", new ArrayList<Class>(classes)); | ||
ServletRegistration.Dynamic reg = context.addServlet("AnnotationTest", "org.example.AnnotationTest"); | ||
context.setAttribute("org.example.Foo", new ArrayList<>(classes)); | ||
ServletRegistration.Dynamic reg = context.addServlet("AnnotationTest", "org.example.test.AnnotationTest"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the bug that caused all of the varying failures.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some further refinements could be done, but as this is test code, it's not super critical.
context.setAttribute("org.example.Foo", new ArrayList<Class>(classes)); | ||
ServletRegistration.Dynamic reg = context.addServlet("AnnotationTest", "org.example.AnnotationTest"); | ||
context.setAttribute("org.example.Foo", new ArrayList<>(classes)); | ||
ServletRegistration.Dynamic reg = context.addServlet("AnnotationTest", "org.example.test.AnnotationTest"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should refer to the class, rather than the name of the class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AnnotationTest
class is in the jetty-ee10-demo-spec-webapp
project.
The above line in FooInitializer
is in the jetty-ee10-demo-container-initializer
project (It cannot see the AnnotationTest
class)
try (FileSystem fs = FileSystems.newFileSystem(uri, env)) | ||
{ | ||
Path root = fs.getPath("/"); | ||
IO.copyDir(depPath.resolve("target/classes"), root); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhm this assume you are running full build
this should use dependency:unpack
or dependency:copy
but not rely on the availability of build directory (this is breaking incremental/cache/partial build support :( )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in a branch with this change b37aacf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Submit PR with that change.
Fix for
FooInitializer
to correct renamed class file reference.This sometimes caused a failure to start the webapp as the classname wasn't found.
This also caused a NPE on AnnotationTest.
This also caused FAIL conditions on the
FooInitializer.onStartup()
classes tests. (Either the attribute wouldn't be there, or it contained too few classes)