package org.gradle.plugin.release.action;

import org.gradle.api.Project;
import org.gradle.api.logging.Logger;
import org.gradle.api.InvalidUserDataException;
import org.gradle.plugin.release.SVNInfo;

/**
 * {@link ReleaseAction} implementation used to verify the SVN URL pattern.
 * 
 * @author christian.weber
 * @since 1.0
 */
public class VerifyUrlReleaseAction implements ReleaseAction {

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void action(SVNInfo info) {

		if (!isTrunkSvnUrl(info) && !isBranchSvnUrl(info)) {
			Project project = info.getProject();
			Logger logger = project.getLogger();
			logger.error("--> svn url must direct on a trunk or branch location");
			
			throw new InvalidUserDataException();
		}

	}

	/**
	 * Indicates if the given SVNInfo directs on a trunk URL.
	 * 
	 * @param info
	 * @return boolean
	 */
	private boolean isTrunkSvnUrl(SVNInfo info) {
		if (info == null) {
			throw new IllegalArgumentException("SVNInfo must not be null");
		}
		final String url = info.getUrl();
		return url.endsWith("/trunk");
	}

	/**
	 * Indicates if the given SVNInfo directs on a branch URL.
	 * 
	 * @param info
	 * @return boolean
	 */
	private boolean isBranchSvnUrl(SVNInfo info) {
		if (info == null) {
			throw new IllegalArgumentException("SVNInfo must not be null");
		}
		final String url = info.getUrl();
		return url.contains("/branches/");
	}

}

@@ -549,108 +549,44 @@
 %0A%09%09%09
-Project project = info.getProject();%0D%0A%09%09%09Logger logger = project.getLogger();%0D%0A%09%09%09logger.error(%22--%3E 
+throw new InvalidUserDataException(%22
 svn 
@@ -639,55 +639,8 @@
 );%0D%0A
-%09%09%09%0D%0A%09%09%09throw new InvalidUserDataException();%0D%0A
 %09%09%7D%0D
@@ -845,38 +845,38 @@
 %09throw new I
-llegalArgument
+nvalidUserData
 Exception(%22S
@@ -1192,22 +1192,22 @@
 ew I
-llegalArgument
+nvalidUserData
 Exce

Update VerifyUrlReleaseAction.java