Return-Path: Delivered-To: apmail-continuum-commits-archive@www.apache.org Received: (qmail 52199 invoked from network); 13 Jul 2009 07:42:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jul 2009 07:42:24 -0000 Received: (qmail 63685 invoked by uid 500); 13 Jul 2009 07:42:33 -0000 Delivered-To: apmail-continuum-commits-archive@continuum.apache.org Received: (qmail 63643 invoked by uid 500); 13 Jul 2009 07:42:33 -0000 Mailing-List: contact commits-help@continuum.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@continuum.apache.org Delivered-To: mailing list commits@continuum.apache.org Received: (qmail 63634 invoked by uid 99); 13 Jul 2009 07:42:33 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 07:42:33 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 13 Jul 2009 07:42:23 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 5EBAA2388877; Mon, 13 Jul 2009 07:42:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r793478 - in /continuum/trunk/continuum-core/src: main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Date: Mon, 13 Jul 2009 07:42:02 -0000 To: commits@continuum.apache.org From: ctan@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090713074202.5EBAA2388877@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: ctan Date: Mon Jul 13 07:42:01 2009 New Revision: 793478 URL: http://svn.apache.org/viewvc?rev=793478&view=rev Log: [CONTINUUM-2295] - more on preventing NPE when scm result is null - added unit test merge -r 793474:793475 from 1.3.x branch Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Modified: continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java?rev=793478&r1=793477&r2=793478&view=diff ============================================================================== --- continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java (original) +++ continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/buildcontroller/DefaultBuildController.java Mon Jul 13 07:42:01 2009 @@ -485,11 +485,14 @@ project.getState() != ContinuumProjectState.NEW && project.getState() != ContinuumProjectState.CHECKEDOUT ) { // Check SCM changes - allChangesUnknown = checkAllChangesUnknown( context.getScmResult().getChanges() ); + if ( context.getScmResult() != null ) + { + allChangesUnknown = checkAllChangesUnknown( context.getScmResult().getChanges() ); + } if ( allChangesUnknown ) { - if ( !context.getScmResult().getChanges().isEmpty() ) + if ( context.getScmResult() != null && !context.getScmResult().getChanges().isEmpty() ) { log.info( "The project was not built because all changes are unknown (maybe local modifications or ignored files not defined in your SCM tool." ); @@ -510,14 +513,19 @@ } // Check changes - if ( !shouldBuild && ( ( !allChangesUnknown && !context.getScmResult().getChanges().isEmpty() ) || + if ( !shouldBuild && ( ( !allChangesUnknown && context.getScmResult() != null && !context.getScmResult().getChanges().isEmpty() ) || project.getExecutorId().equals( ContinuumBuildExecutorConstants.MAVEN_TWO_BUILD_EXECUTOR ) ) ) { try { ContinuumBuildExecutor executor = buildExecutorManager.getBuildExecutor( project.getExecutorId() ); - if ( context.getScmResult() != null ) + if ( executor == null ) + { + log.warn( "No continuum build executor found for project " + project.getId() + + " with executor '" + project.getExecutorId() + "'" ); + } + else if ( context.getScmResult() != null ) { shouldBuild = executor.shouldBuild( context.getScmResult().getChanges(), project, workingDirectoryService.getWorkingDirectory( project ), Modified: continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java?rev=793478&r1=793477&r2=793478&view=diff ============================================================================== --- continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java (original) +++ continuum/trunk/continuum-core/src/test/java/org/apache/maven/continuum/buildcontroller/DefaultBuildControllerTest.java Mon Jul 13 07:42:01 2009 @@ -185,6 +185,16 @@ assertTrue( controller.shouldBuild( context ) ); } + public void testWithNullScmResult() + throws Exception + { + BuildContext context = getContext( +1 ); + context.setScmResult( null ); + controller.checkProjectDependencies( context ); + assertEquals( 0, context.getModifiedDependencies().size() ); + assertFalse( controller.shouldBuild( context ) ); + } + private File getWorkingDirectory() throws Exception {