X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;ds=sidebyside;f=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Fversion%2FInvalidVersionSpecificationException.java;fp=org.argeo.slc.repo%2Fsrc%2Forg%2Feclipse%2Faether%2Fversion%2FInvalidVersionSpecificationException.java;h=b3690c5a0e376fb276a4783aa8c44d6ca6ac2780;hb=825d60c5348dbe3f5be25b0bccf7bdebfe694219;hp=0000000000000000000000000000000000000000;hpb=5e991fff5cba01858dcc5747a27e637325bc5c8e;p=gpl%2Fargeo-jcr.git diff --git a/org.argeo.slc.repo/src/org/eclipse/aether/version/InvalidVersionSpecificationException.java b/org.argeo.slc.repo/src/org/eclipse/aether/version/InvalidVersionSpecificationException.java new file mode 100644 index 0000000..b3690c5 --- /dev/null +++ b/org.argeo.slc.repo/src/org/eclipse/aether/version/InvalidVersionSpecificationException.java @@ -0,0 +1,71 @@ +/******************************************************************************* + * Copyright (c) 2010, 2014 Sonatype, Inc. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Sonatype, Inc. - initial API and implementation + *******************************************************************************/ +package org.eclipse.aether.version; + +import org.eclipse.aether.RepositoryException; + +/** + * Thrown when a version or version range could not be parsed. + */ +public class InvalidVersionSpecificationException + extends RepositoryException +{ + + private final String version; + + /** + * Creates a new exception with the specified version and detail message. + * + * @param version The invalid version specification, may be {@code null}. + * @param message The detail message, may be {@code null}. + */ + public InvalidVersionSpecificationException( String version, String message ) + { + super( message ); + this.version = version; + } + + /** + * Creates a new exception with the specified version and cause. + * + * @param version The invalid version specification, may be {@code null}. + * @param cause The exception that caused this one, may be {@code null}. + */ + public InvalidVersionSpecificationException( String version, Throwable cause ) + { + super( "Could not parse version specification " + version + getMessage( ": ", cause ), cause ); + this.version = version; + } + + /** + * Creates a new exception with the specified version, detail message and cause. + * + * @param version The invalid version specification, may be {@code null}. + * @param message The detail message, may be {@code null}. + * @param cause The exception that caused this one, may be {@code null}. + */ + public InvalidVersionSpecificationException( String version, String message, Throwable cause ) + { + super( message, cause ); + this.version = version; + } + + /** + * Gets the version or version range that could not be parsed. + * + * @return The invalid version specification or {@code null} if unknown. + */ + public String getVersion() + { + return version; + } + +}