Browse Source

Revert "The constructor CmdLineException(String) is deprecated"

This reverts commit 07f9936257.

07f9 seems to require a more recent args4j, but I cannot locate a CQ
that verifies we can use a version more recent then 2.0.12. 2.0.16
has been released, but the Hudson CI instance at Eclipse won't
build it.

Since the commit fixes an issue identified in March but wasn't
actually submitted to the tree until September, we can continue to
ignore whatever the problem is/was until someone can attempt a more
correctly working solution.

Change-Id: I94fa432c219bda21c1126976bb60e5292760092e
stable-2.2
Shawn O. Pearce 12 years ago
parent
commit
31261b5c2f
  1. 1
      org.eclipse.jgit.pgm/pom.xml
  2. 17
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java
  3. 5
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java
  4. 17
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java
  5. 14
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java
  6. 2
      org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java

1
org.eclipse.jgit.pgm/pom.xml

@ -69,7 +69,6 @@
<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>

17
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java

@ -109,8 +109,7 @@ public class AbstractTreeIteratorHandler extends
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(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notAnIndexFile, name), e);
CLIText.get().notAnIndexFile, name), e);
} }
setter.addValue(new DirCacheIterator(dirc)); setter.addValue(new DirCacheIterator(dirc));
return 1; return 1;
@ -120,25 +119,21 @@ public class AbstractTreeIteratorHandler extends
try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(owner, e.getMessage()); throw new CmdLineException(e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
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(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
CLIText.get().notATree, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
CLIText.get().notATree, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
CLIText.get().cannotReadBecause, name, e.getMessage()));
} finally { } finally {
curs.release(); curs.release();
} }

5
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java

@ -86,15 +86,14 @@ public class ObjectIdHandler extends OptionHandler<ObjectId> {
try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(owner, e.getMessage()); throw new CmdLineException(e.getMessage());
} }
if (id != null) { if (id != null) {
setter.addValue(id); setter.addValue(id);
return 1; return 1;
} }
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notAnObject, name));
CLIText.get().notAnObject, name));
} }
@Override @Override

17
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java

@ -96,8 +96,7 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
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(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn
CLIText.get().onlyOneMetaVarExpectedIn
, option.metaVar(), name)); , option.metaVar(), name));
final String left = name.substring(0, dot2); final String left = name.substring(0, dot2);
@ -117,24 +116,20 @@ public class RevCommitHandler extends OptionHandler<RevCommit> {
try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(owner, e.getMessage()); throw new CmdLineException(e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
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(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
CLIText.get().notACommit, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name));
CLIText.get().notACommit, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
CLIText.get().cannotReadBecause, name, e.getMessage()));
} }
if (interesting) if (interesting)

14
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java

@ -89,24 +89,20 @@ public class RevTreeHandler extends OptionHandler<RevTree> {
try { try {
id = clp.getRepository().resolve(name); id = clp.getRepository().resolve(name);
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(owner, e.getMessage()); throw new CmdLineException(e.getMessage());
} }
if (id == null) if (id == null)
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
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(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
CLIText.get().notATree, name));
} catch (IncorrectObjectTypeException e) { } catch (IncorrectObjectTypeException e) {
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name));
CLIText.get().notATree, name));
} catch (IOException e) { } catch (IOException e) {
throw new CmdLineException(owner, MessageFormat.format( throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage()));
CLIText.get().cannotReadBecause, name, e.getMessage()));
} }
setter.addValue(c); setter.addValue(c);
return 1; return 1;

2
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java

@ -82,7 +82,7 @@ public class SubcommandHandler extends OptionHandler<TextBuiltin> {
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(owner, MessageFormat.format( throw new CmdLineException(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