1
2
3
4
5
6
7
8
9
10
11 package org.eclipse.jgit.notes;
12
13 import java.io.IOException;
14 import java.text.MessageFormat;
15
16 import org.eclipse.jgit.internal.JGitText;
17
18
19
20
21
22
23 public class NotesMergeConflictException extends IOException {
24 private static final long serialVersionUID = 1L;
25
26
27
28
29
30
31
32
33
34
35
36
37 public NotesMergeConflictException(Note base, Note ours, Note theirs) {
38 super(MessageFormat.format(JGitText.get().mergeConflictOnNotes,
39 noteOn(base, ours, theirs), noteData(base), noteData(ours),
40 noteData(theirs)));
41 }
42
43
44
45
46
47
48
49
50
51
52
53
54 public NotesMergeConflictException(NonNoteEntry base, NonNoteEntry ours,
55 NonNoteEntry theirs) {
56 super(MessageFormat.format(
57 JGitText.get().mergeConflictOnNonNoteEntries, name(base),
58 name(ours), name(theirs)));
59 }
60
61 private static String noteOn(Note base, Note ours, Note theirs) {
62 if (base != null)
63 return base.name();
64 if (ours != null)
65 return ours.name();
66 return theirs.name();
67 }
68
69 private static String noteData(Note n) {
70 if (n != null)
71 return n.getData().name();
72 return "";
73 }
74
75 private static String name(NonNoteEntry e) {
76 return e != null ? e.name() : "";
77 }
78 }