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

Display error message when module fails to publish #29

Closed
johnmcollier opened this issue Oct 3, 2017 · 2 comments
Closed

Display error message when module fails to publish #29

johnmcollier opened this issue Oct 3, 2017 · 2 comments
Assignees

Comments

@johnmcollier
Copy link
Contributor

johnmcollier commented Oct 3, 2017

Currently if a module fails to publish on to a server, a NPE will be thrown without any further information as to which module failed to publish. A solution is to wrap the call to either publishDir in JEEPublisher.publishModule (or the call to publishSmart in ApplicationPublisher.publishDir) with a try/catch and print out an error message informing the user which module failed to publish.

Example Stack Trace:

java.lang.NullPointerException
at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:331)
at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:367)
at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:367)
at org.eclipse.wst.server.core.util.PublishHelper.publishSmart(PublishHelper.java:188)
at com.ibm.ws.st.core.internal.ApplicationPublisher.publishDir(ApplicationPublisher.java:886)
at com.ibm.ws.st.jee.core.internal.JEEPublisher.publishModule(JEEPublisher.java:170)
at com.ibm.ws.st.core.internal.ApplicationPublisher.publishModuleAndChildren(ApplicationPublisher.java:147)
at com.ibm.ws.st.core.internal.ApplicationPublisher.publishModuleAndChildren(ApplicationPublisher.java:153)
at com.ibm.ws.st.core.internal.ServerExtensionWrapper.publishModuleAndChildren(ServerExtensionWrapper.java:358)
at com.ibm.ws.st.core.internal.WebSphereServerBehaviour.publishApplication(WebSphereServerBehaviour.java:1195)
at com.ibm.ws.st.core.internal.WebSphereServerBehaviour.publishModules(WebSphereServerBehaviour.java:946)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:987)
at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3172)
at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
@johnmcollier
Copy link
Contributor Author

@eharris369 Assigning this to you since this seems to be server tools change that needs to be made, feel free to reassign if necessary.

@johnmcollier
Copy link
Contributor Author

johnmcollier commented Oct 3, 2017

Potential fix:
Change line 168 in JEEPublisher.publishModule from:
publishDir(kind, unit.getDeltaKind(), module, getDeployPath(module, false), helper, status, monitor);

to:

try {
    publishDir(kind, unit.getDeltaKind(), module, getDeployPath(module, false), helper, status, monitor);
} catch (NullPointerException e) {
    status.add(new Status(IStatus.ERROR, Activator.PLUGIN_ID, NLS.bind(Messages.errorPublishingModule, moduleTypeId));
    e.printStackTrace();
}

johnmcollier added a commit to johnmcollier/open-liberty-tools that referenced this issue Oct 4, 2017
… publish

When a module fails to publish in OLT, only a NPE will be thrown,
without any further useful information being shown. To fix this, I've
surrounded the function that throws the NPE with a try/catch and when an
NPE is caught, a message and a stack trace will be printed out.
johnmcollier added a commit to johnmcollier/open-liberty-tools that referenced this issue Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants