[jbosstools-issues] [JBoss JIRA] (JBIDE-12079) NPE in ExpressPublishMethod.publishStart(ExpressPublishMethod.java:71)

Rob Stryker (JIRA) jira-events at lists.jboss.org
Tue Jun 5 06:38:17 EDT 2012


    [ https://issues.jboss.org/browse/JBIDE-12079?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12698749#comment-12698749 ] 

Rob Stryker commented on JBIDE-12079:
-------------------------------------

{code}
### Eclipse Workspace Patch 1.0
#P org.jboss.tools.openshift.express.ui
Index: src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java
===================================================================
--- src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java	(revision 41709)
+++ src/org/jboss/tools/openshift/express/internal/core/behaviour/ExpressPublishMethod.java	(working copy)
@@ -70,14 +70,18 @@
 		
 		String destProjName = ExpressServerUtils.getExpressDeployProject(behaviour.getServer());
 		IProject destProj = ResourcesPlugin.getWorkspace().getRoot().getProject(destProjName);
-		if( destProj != null ) {
-			if( destProj.exists() ) {
+		boolean allSubModulesPublished = areAllPublished(behaviour);
+		if( destProj != null && destProj.exists()) {
+			String destinationFolder = ExpressServerUtils.getExpressDeployFolder(behaviour.getServer());
+			IContainer destFolder = "".equals(destinationFolder) ? destProj : (IContainer)destProj.findMember(new Path(destinationFolder));
+			if( allSubModulesPublished || (destFolder != null && destFolder.isAccessible())) {
 				refreshProject(destProj, submon(monitor, 100));
 				commitAndPushProject(destProj, behaviour, submon(monitor, 100));
-			}
+			} // else ignore. (one or more modules not published AND magic folder doesn't exist
+			  // The previous exception will be propagated. 
 		}
 
-        return areAllPublished(behaviour) ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;	
+        return allSubModulesPublished ? IServer.PUBLISH_STATE_NONE : IServer.PUBLISH_STATE_INCREMENTAL;	
     }
 	
 	protected boolean areAllPublished(DeployableServerBehavior behaviour) {
@@ -111,15 +115,13 @@
 		if( isInDestProjectTree(destProjName, module))
 			return IServer.PUBLISH_STATE_NONE;
 		
+		// Cannot be null, checked for in publishStart
 		IProject destProj = ResourcesPlugin.getWorkspace().getRoot().getProject(destProjName);
-		
 		if( destProj.equals(module[module.length-1].getProject()))
 			return 0;
 		
 		String destinationFolder = ExpressServerUtils.getExpressDeployFolder(behaviour.getServer());
-		
 		IContainer destFolder = "".equals(destinationFolder) ? destProj : (IContainer)destProj.findMember(new Path(destinationFolder));
-		
 		if( destFolder == null || !destFolder.isAccessible()) {
 			StringBuffer missingPath = new StringBuffer("");
 			if(destFolder==null) {

{code}

Here's a patch but I'd like to have it double-tested since I'm not sure I'm doing the test properly. 
                
> NPE in ExpressPublishMethod.publishStart(ExpressPublishMethod.java:71)
> ----------------------------------------------------------------------
>
>                 Key: JBIDE-12079
>                 URL: https://issues.jboss.org/browse/JBIDE-12079
>             Project: Tools (JBoss Tools)
>          Issue Type: Bug
>          Components: openshift
>    Affects Versions: 3.3.0.CR1
>            Reporter: Fred Bricon
>            Assignee: Max Rydahl Andersen
>             Fix For: 3.3.0.CR1, 3.4.0.M1
>
>         Attachments: ExpressPublishMethod.patch, JBIDE-12079.patch, JBIDE-12079bettererror.patch
>
>
> Messing around with some DIY app on openshift, after deployment, I got that nasty NPE
> {noformat}
> java.lang.NullPointerException
> 	at org.jboss.tools.openshift.express.internal.core.behaviour.ExpressPublishMethod.publishStart(ExpressPublishMethod.java:71)
> 	at org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior.publishStart(DeployableServerBehavior.java:66)
> 	at org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior.publishStart(DelegatingServerBehavior.java:138)
> 	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:927)
> 	at org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour.publish(ExpressBehaviour.java:27)
> 	at org.eclipse.wst.server.core.model.ServerBehaviourDelegate.publish(ServerBehaviourDelegate.java:774)
> 	at org.jboss.tools.openshift.express.internal.core.behaviour.ExpressBehaviour.publish(ExpressBehaviour.java:34)
> 	at org.eclipse.wst.server.core.internal.Server.publishImpl(Server.java:3087)
> 	at org.eclipse.wst.server.core.internal.Server$PublishJob.run(Server.java:345)
> 	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jbosstools-issues mailing list