Mercurial > jhg
annotate src/org/tmatesoft/hg/core/HgIOException.java @ 643:a8ce405da1f5
v1.2 line of dev: update versions, use patch merge code by default
author | Artem Tikhomirov <tikhomirov.artem@gmail.com> |
---|---|
date | Wed, 19 Jun 2013 16:03:11 +0200 |
parents | 6526d8adbc0f |
children | ae2d439fbed3 |
rev | line source |
---|---|
498
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
1 /* |
618
7c0d2ce340b8
Refactor approach how content finds it way down to a commit revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
498
diff
changeset
|
2 * Copyright (c) 2012-2013 TMate Software Ltd |
498
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
3 * |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
4 * This program is free software; you can redistribute it and/or modify |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
6 * the Free Software Foundation; version 2 of the License. |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
7 * |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
8 * This program is distributed in the hope that it will be useful, |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
11 * GNU General Public License for more details. |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
12 * |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
13 * For information on how to redistribute this software under |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
14 * the terms of a license other than GNU General Public License |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
15 * contact TMate Software at support@hg4j.com |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
16 */ |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
17 package org.tmatesoft.hg.core; |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
18 |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
19 import java.io.File; |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
20 import java.io.IOException; |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
21 |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
22 /** |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
23 * Tailored wrap for {@link IOException} and similar I/O-related issues. Unlike {@link IOException}, |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
24 * keeps track of {@link File} that caused the problem. Besides, additional information (like revision, |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
25 * see {@link HgException}) may be attached. |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
26 * |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
27 * @author Artem Tikhomirov |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
28 * @author TMate Software Ltd. |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
29 */ |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
30 @SuppressWarnings("serial") |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
31 public class HgIOException extends HgException { |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
32 private final File file; |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
33 |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
34 public HgIOException(String message, File troubleFile) { |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
35 this(message, null, troubleFile); |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
36 } |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
37 |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
38 /** |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
39 * @param message describes the issue, never <code>null</code> |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
40 * @param cause root cause for the error, likely {@link IOException} or its subclass, but not necessarily, and may be omitted. |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
41 * @param troubleFile file we tried to deal with, never <code>null</code> |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
42 */ |
628
6526d8adbc0f
Explicit HgRuntimeException to facilitate easy switch from runtime to checked exceptions
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
618
diff
changeset
|
43 public HgIOException(String message, Throwable cause, File troubleFile) { |
498
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
44 super(message, cause); |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
45 file = troubleFile; |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
46 } |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
47 |
618
7c0d2ce340b8
Refactor approach how content finds it way down to a commit revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
498
diff
changeset
|
48 /** |
7c0d2ce340b8
Refactor approach how content finds it way down to a commit revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
498
diff
changeset
|
49 * @return file that causes trouble, may be <code>null</code> |
7c0d2ce340b8
Refactor approach how content finds it way down to a commit revision
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
498
diff
changeset
|
50 */ |
498
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
51 public File getFile() { |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
52 return file; |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
53 } |
0205a5c4566b
Issue 38: preserve user formatting and comments when updating configuration files
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff
changeset
|
54 } |