diff --git a/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java b/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java index 245ef5c33f..d94905136a 100644 --- a/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java +++ b/maven-plugins/maven-project-info-reports-plugin/src/main/java/org/apache/maven/report/projectinfo/ScmReport.java @@ -196,6 +196,19 @@ public class ScmReport anonymousConnection = scm.getConnection(); devConnection = scm.getDeveloperConnection(); + if ( StringUtils.isEmpty( anonymousConnection ) && + StringUtils.isEmpty( devConnection ) && + StringUtils.isEmpty( scm.getUrl() ) ) + { + startSection( getTitle() ); + + paragraph( getBundle( locale ).getString( "report.scm.noscm" ) ); + + endSection(); + + return; + } + ScmRepository anonymousRepository = getScmRepository( anonymousConnection ); ScmRepository devRepository = getScmRepository( devConnection ); @@ -264,7 +277,7 @@ public class ScmReport { startSection( getBundle( locale ).getString( "report.scm.webaccess.title" ) ); - if ( scmUrl == null ) + if ( StringUtils.isEmpty( scmUrl ) ) { paragraph( getBundle( locale ).getString( "report.scm.webaccess.nourl" ) ); } @@ -288,7 +301,8 @@ public class ScmReport { if ( ( isScmSystem( anonymousRepository, "clearcase" ) ) || ( isScmSystem( anonymousRepository, "perforce" ) ) - || ( isScmSystem( anonymousRepository, "starteam" ) ) ) + || ( isScmSystem( anonymousRepository, "starteam" ) ) + || ( StringUtils.isEmpty( anonymousConnection ) ) ) { return; } @@ -313,6 +327,11 @@ public class ScmReport { paragraph( getBundle( locale ).getString( "report.scm.anonymousaccess.general.intro" ) ); + if ( anonymousConnection.length() < 4 ) + { + throw new IllegalArgumentException( "The source repository connection is too short." ); + } + verbatimText( anonymousConnection.substring( 4 ) ); } @@ -326,6 +345,11 @@ public class ScmReport */ private void renderDeveloperAccessSection( ScmRepository devRepository ) { + if ( StringUtils.isEmpty( devConnection ) ) + { + return; + } + startSection( getBundle( locale ).getString( "report.scm.devaccess.title" ) ); if ( ( devRepository != null ) && ( isScmSystem( devRepository, "clearcase" ) ) ) @@ -365,6 +389,11 @@ public class ScmReport { paragraph( getBundle( locale ).getString( "report.scm.devaccess.general.intro" ) ); + if ( devConnection.length() < 4 ) + { + throw new IllegalArgumentException( "The source repository connection is too short." ); + } + verbatimText( devConnection.substring( 4 ) ); } @@ -622,7 +651,7 @@ public class ScmReport */ public ScmRepository getScmRepository( String scmUrl ) { - if ( scmUrl == null ) + if ( StringUtils.isEmpty( scmUrl ) ) { return null; } diff --git a/maven-plugins/maven-project-info-reports-plugin/src/test/projects/project-info-reports-plugin-test11/pom.xml b/maven-plugins/maven-project-info-reports-plugin/src/test/projects/project-info-reports-plugin-test11/pom.xml new file mode 100644 index 0000000000..facf24045c --- /dev/null +++ b/maven-plugins/maven-project-info-reports-plugin/src/test/projects/project-info-reports-plugin-test11/pom.xml @@ -0,0 +1,56 @@ + + + + + + 4.0.0 + org.apache.maven.report.projectinfo.test11 + project-info-reports-plugin-test11 + jar + 1.0-SNAPSHOT + 2005 + Maven ProjectInfo Report Test11 + MNG-695 developerConnection is empty + http://maven.apache.org + + scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:maven-plugins/dist + + http://cvs.apache.org/ + + + + vsiveton + Vincent Siveton + vsiveton@apache.org + Apache Software Foundation + + Java Developer + + -5 + + + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + + + +