Browse Source

The constructor CmdLineException(String) is deprecated

Use CmdLineException(CmdLineParser, String) instead. The new constructor
has been added in args4j 2.0.12, so in pom.xml that would be the minimum
version. Set the upper boundary in pom.xml to 2.1.0 (exclusive), just
like in the MANIFEST.MF.

Change-Id: If45d809e4ffa11a3572d958ce121422fb03cf8f3
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
tags/v2.2.0.201212191850-r
Tomasz Zarna 12 years ago
parent
commit
07f9936257

+ 1
- 0
org.eclipse.jgit.pgm/pom.xml View File

<dependency> <dependency>
<groupId>args4j</groupId> <groupId>args4j</groupId>
<artifactId>args4j</artifactId> <artifactId>args4j</artifactId>
<version>[2.0.12,2.1.0)</version>
</dependency> </dependency>


<dependency> <dependency>

+ 11
- 6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java View File

try { try {
dirc = DirCache.read(new File(name), FS.DETECTED); dirc = DirCache.read(new File(name), FS.DETECTED);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notAnIndexFile, name), e);
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notAnIndexFile, name), e);
} }
setter.addValue(new DirCacheIterator(dirc)); setter.addValue(new DirCacheIterator(dirc));
return 1; return 1;
try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(e.getMessage());
throw new CmdLineException(owner, e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notATree, name));


final CanonicalTreeParser p = new CanonicalTreeParser(); final CanonicalTreeParser p = new CanonicalTreeParser();
final ObjectReader curs = clp.getRepository().newObjectReader(); final ObjectReader curs = clp.getRepository().newObjectReader();
try { try {
p.reset(curs, clp.getRevWalk().parseTree(id)); p.reset(curs, clp.getRevWalk().parseTree(id));
} catch (MissingObjectException e) { } catch (MissingObjectException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notATree, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notATree, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().cannotReadBecause, name, e.getMessage()));
} finally { } finally {
curs.release(); curs.release();
} }

+ 3
- 2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java View File

try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(e.getMessage());
throw new CmdLineException(owner, e.getMessage());
} }
if (id != null) { if (id != null) {
setter.addValue(id); setter.addValue(id);
return 1; return 1;
} }


throw new CmdLineException(MessageFormat.format(CLIText.get().notAnObject, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notAnObject, name));
} }


@Override @Override

+ 11
- 6
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java View File

final int dot2 = name.indexOf(".."); final int dot2 = name.indexOf("..");
if (dot2 != -1) { if (dot2 != -1) {
if (!option.isMultiValued()) if (!option.isMultiValued())
throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().onlyOneMetaVarExpectedIn
, option.metaVar(), name)); , option.metaVar(), name));


final String left = name.substring(0, dot2); final String left = name.substring(0, dot2);
try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(e.getMessage());
throw new CmdLineException(owner, e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notACommit, name));


final RevCommit c; final RevCommit c;
try { try {
c = clp.getRevWalk().parseCommit(id); c = clp.getRevWalk().parseCommit(id);
} catch (MissingObjectException e) { } catch (MissingObjectException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notACommit, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notACommit, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().cannotReadBecause, name, e.getMessage()));
} }


if (interesting) if (interesting)

+ 9
- 5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java View File

try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(e.getMessage());
throw new CmdLineException(owner, e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notATree, name));


final RevTree c; final RevTree c;
try { try {
c = clp.getRevWalk().parseTree(id); c = clp.getRevWalk().parseTree(id);
} catch (MissingObjectException e) { } catch (MissingObjectException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notATree, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notATree, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().cannotReadBecause, name, e.getMessage()));
} }
setter.addValue(c); setter.addValue(c);
return 1; return 1;

+ 1
- 1
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java View File

final String name = params.getParameter(0); final String name = params.getParameter(0);
final CommandRef cr = CommandCatalog.get(name); final CommandRef cr = CommandCatalog.get(name);
if (cr == null) if (cr == null)
throw new CmdLineException(MessageFormat.format(
throw new CmdLineException(owner, MessageFormat.format(
CLIText.get().notAJgitCommand, name)); CLIText.get().notAJgitCommand, name));


// Force option parsing to stop. Everything after us should // Force option parsing to stop. Everything after us should

Loading…
Cancel
Save