From 31261b5c2f261653e11d0d9960ce26fa0d4c82d5 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 26 Sep 2012 10:19:00 -0700 Subject: [PATCH] Revert "The constructor CmdLineException(String) is deprecated" This reverts commit 07f99362575f324e466d7f5ae49d5f8f69cf7a8a. 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 --- org.eclipse.jgit.pgm/pom.xml | 1 - .../pgm/opt/AbstractTreeIteratorHandler.java | 17 ++++++----------- .../eclipse/jgit/pgm/opt/ObjectIdHandler.java | 5 ++--- .../eclipse/jgit/pgm/opt/RevCommitHandler.java | 17 ++++++----------- .../eclipse/jgit/pgm/opt/RevTreeHandler.java | 14 +++++--------- .../eclipse/jgit/pgm/opt/SubcommandHandler.java | 2 +- 6 files changed, 20 insertions(+), 36 deletions(-) diff --git a/org.eclipse.jgit.pgm/pom.xml b/org.eclipse.jgit.pgm/pom.xml index a889a5453..02d346365 100644 --- a/org.eclipse.jgit.pgm/pom.xml +++ b/org.eclipse.jgit.pgm/pom.xml @@ -69,7 +69,6 @@ args4j args4j - [2.0.12,2.1.0) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java index 6e028ec06..ca9710491 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/AbstractTreeIteratorHandler.java @@ -109,8 +109,7 @@ public int parseArguments(final Parameters params) throws CmdLineException { try { dirc = DirCache.read(new File(name), FS.DETECTED); } catch (IOException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notAnIndexFile, name), e); + throw new CmdLineException(MessageFormat.format(CLIText.get().notAnIndexFile, name), e); } setter.addValue(new DirCacheIterator(dirc)); return 1; @@ -120,25 +119,21 @@ public int parseArguments(final Parameters params) throws CmdLineException { try { id = clp.getRepository().resolve(name); } catch (IOException e) { - throw new CmdLineException(owner, e.getMessage()); + throw new CmdLineException(e.getMessage()); } if (id == null) - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notATree, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); final CanonicalTreeParser p = new CanonicalTreeParser(); final ObjectReader curs = clp.getRepository().newObjectReader(); try { p.reset(curs, clp.getRevWalk().parseTree(id)); } catch (MissingObjectException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notATree, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IncorrectObjectTypeException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notATree, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IOException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().cannotReadBecause, name, e.getMessage())); + throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage())); } finally { curs.release(); } diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java index fada8fc07..f6550a5d8 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/ObjectIdHandler.java @@ -86,15 +86,14 @@ public int parseArguments(final Parameters params) throws CmdLineException { try { id = clp.getRepository().resolve(name); } catch (IOException e) { - throw new CmdLineException(owner, e.getMessage()); + throw new CmdLineException(e.getMessage()); } if (id != null) { setter.addValue(id); return 1; } - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notAnObject, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notAnObject, name)); } @Override diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java index b7a2314db..bf1753634 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevCommitHandler.java @@ -96,8 +96,7 @@ public int parseArguments(final Parameters params) throws CmdLineException { final int dot2 = name.indexOf(".."); if (dot2 != -1) { if (!option.isMultiValued()) - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().onlyOneMetaVarExpectedIn + throw new CmdLineException(MessageFormat.format(CLIText.get().onlyOneMetaVarExpectedIn , option.metaVar(), name)); final String left = name.substring(0, dot2); @@ -117,24 +116,20 @@ private void addOne(final String name, final boolean interesting) try { id = clp.getRepository().resolve(name); } catch (IOException e) { - throw new CmdLineException(owner, e.getMessage()); + throw new CmdLineException(e.getMessage()); } if (id == null) - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notACommit, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name)); final RevCommit c; try { c = clp.getRevWalk().parseCommit(id); } catch (MissingObjectException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notACommit, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name)); } catch (IncorrectObjectTypeException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notACommit, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notACommit, name)); } catch (IOException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().cannotReadBecause, name, e.getMessage())); + throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage())); } if (interesting) diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java index 2798c5b9d..0b607ee06 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/RevTreeHandler.java @@ -89,24 +89,20 @@ public int parseArguments(final Parameters params) throws CmdLineException { try { id = clp.getRepository().resolve(name); } catch (IOException e) { - throw new CmdLineException(owner, e.getMessage()); + throw new CmdLineException(e.getMessage()); } if (id == null) - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notATree, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); final RevTree c; try { c = clp.getRevWalk().parseTree(id); } catch (MissingObjectException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notATree, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IncorrectObjectTypeException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().notATree, name)); + throw new CmdLineException(MessageFormat.format(CLIText.get().notATree, name)); } catch (IOException e) { - throw new CmdLineException(owner, MessageFormat.format( - CLIText.get().cannotReadBecause, name, e.getMessage())); + throw new CmdLineException(MessageFormat.format(CLIText.get().cannotReadBecause, name, e.getMessage())); } setter.addValue(c); return 1; diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java index 08d01f4f0..35ed22bd3 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/opt/SubcommandHandler.java @@ -82,7 +82,7 @@ public int parseArguments(final Parameters params) throws CmdLineException { final String name = params.getParameter(0); final CommandRef cr = CommandCatalog.get(name); if (cr == null) - throw new CmdLineException(owner, MessageFormat.format( + throw new CmdLineException(MessageFormat.format( CLIText.get().notAJgitCommand, name)); // Force option parsing to stop. Everything after us should