aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/util/sha1/Sha1CollisionException.java
blob: ce95ba5e85c107b25ad9b47be218d466a64156d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
 * Copyright (C) 2017, Google Inc. and others
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Distribution License v. 1.0 which is available at
 * https://www.eclipse.org/org/documents/edl-v10.php.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

package org.eclipse.jgit.util.sha1;

import java.text.MessageFormat;

import org.eclipse.jgit.internal.JGitText;
import org.eclipse.jgit.lib.ObjectId;

/**
 * Thrown by {@link org.eclipse.jgit.util.sha1.SHA1} if it detects a likely hash
 * collision.
 *
 * @since 4.7
 */
public class Sha1CollisionException extends RuntimeException {
	private static final long serialVersionUID = 1L;

	/**
	 * Initialize with default message.
	 *
	 * @param id
	 *            object whose contents are a hash collision.
	 */
	public Sha1CollisionException(ObjectId id) {
		super(MessageFormat.format(
				JGitText.get().sha1CollisionDetected,
				id.name()));
	}
}