try {
write(f, body);
return f;
- } catch (Error e) {
- f.delete();
- throw e;
- } catch (RuntimeException e) {
- f.delete();
- throw e;
- } catch (IOException e) {
+ } catch (Error | RuntimeException | IOException e) {
f.delete();
throw e;
}
git.branchCreate().setName(branch).setStartPoint(commit).call();
return commit;
- } catch (IOException e) {
- throw new RuntimeException(e);
- } catch (GitAPIException e) {
+ } catch (IOException | GitAPIException e) {
throw new RuntimeException(e);
}
}
final Class<? extends TextBuiltin> clazz;
try {
clazz = Class.forName(cn, false, ldr).asSubclass(TextBuiltin.class);
- } catch (ClassNotFoundException notBuiltin) {
+ } catch (ClassNotFoundException | ClassCastException notBuiltin) {
// Doesn't exist, even though the service entry is present.
- //
- return;
- } catch (ClassCastException notBuiltin) {
// Isn't really a builtin, even though its listed as such.
- //
return;
}
final Constructor<? extends TextBuiltin> c;
try {
c = impl.getDeclaredConstructor();
- } catch (SecurityException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (NoSuchMethodException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
+ } catch (SecurityException | NoSuchMethodException e) {
+ throw new RuntimeException(MessageFormat
+ .format(CLIText.get().cannotCreateCommand, getName(), e));
}
c.setAccessible(true);
final TextBuiltin r;
try {
r = c.newInstance();
- } catch (InstantiationException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (IllegalAccessException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
- } catch (InvocationTargetException e) {
- throw new RuntimeException(MessageFormat.format(CLIText.get().cannotCreateCommand, getName(), e));
+ } catch (InstantiationException | IllegalAccessException
+ | IllegalArgumentException | InvocationTargetException e) {
+ throw new RuntimeException(MessageFormat
+ .format(CLIText.get().cannotCreateCommand, getName(), e));
}
r.setCommandName(getName());
return r;
install("org.eclipse.jgit.console.ConsoleAuthenticator"); //$NON-NLS-1$
install("org.eclipse.jgit.console.ConsoleCredentialsProvider"); //$NON-NLS-1$
return true;
- } catch (ClassNotFoundException e) {
+ } catch (ClassNotFoundException | NoClassDefFoundError
+ | UnsupportedClassVersionError e) {
return false;
- } catch (NoClassDefFoundError e) {
- return false;
- } catch (UnsupportedClassVersionError e) {
- return false;
-
- } catch (IllegalArgumentException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (SecurityException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (IllegalAccessException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (InvocationTargetException e) {
- throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
- } catch (NoSuchMethodException e) {
+ } catch (IllegalArgumentException | SecurityException
+ | IllegalAccessException | InvocationTargetException
+ | NoSuchMethodException e) {
throw new RuntimeException(CLIText.get().cannotSetupConsole, e);
}
}
}
}
}
- } catch (IllegalArgumentException e) {
- throw die("Cannot determine names", e); //$NON-NLS-1$
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw die("Cannot determine names", e); //$NON-NLS-1$
}
-
return all;
}
folds.add(fold);
}
}
- } catch (IllegalArgumentException e) {
- throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new RuntimeException("Cannot determine names", e); //$NON-NLS-1$
}
final CanonicalTreeParser p = new CanonicalTreeParser();
try (ObjectReader curs = clp.getRepository().newObjectReader()) {
p.reset(curs, clp.getRevWalk().parseTree(id));
- } catch (MissingObjectException e) {
- throw new CmdLineException(clp,
- CLIText.format(CLIText.get().notATree), name);
- } catch (IncorrectObjectTypeException e) {
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
throw new CmdLineException(clp,
CLIText.format(CLIText.get().notATree), name);
} catch (IOException e) {
final RevCommit c;
try {
c = clp.getRevWalk().parseCommit(id);
- } catch (MissingObjectException e) {
- throw new CmdLineException(clp,
- CLIText.format(CLIText.get().notACommit), name);
- } catch (IncorrectObjectTypeException e) {
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
throw new CmdLineException(clp,
CLIText.format(CLIText.get().notACommit), name);
} catch (IOException e) {
final RevTree c;
try {
c = clp.getRevWalk().parseTree(id);
- } catch (MissingObjectException e) {
- throw new CmdLineException(clp,
- CLIText.format(CLIText.get().notATree), name);
- } catch (IncorrectObjectTypeException e) {
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
throw new CmdLineException(clp,
CLIText.format(CLIText.get().notATree), name);
} catch (IOException e) {
timeoutMillis -= TimeUnit.NANOSECONDS
.toMillis(System.nanoTime() - start);
}
- } catch (IOException e) {
- exec.close(true);
- throw e;
- } catch (RuntimeException e) {
+ } catch (IOException | RuntimeException e) {
exec.close(true);
throw e;
}
try {
refUpdateLockedRef.await();
packRefsDone.await();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- } catch (BrokenBarrierException e) {
+ } catch (InterruptedException | BrokenBarrierException e) {
Thread.currentThread().interrupt();
}
return super.isForceUpdate();
RevCommit commit = null;
try {
commit = walk.parseCommit(objectId);
- } catch (MissingObjectException e) {
- // ignore: the ref points to an object that does not exist;
- // it should be ignored as traversal starting point.
- } catch (IncorrectObjectTypeException e) {
- // ignore: the ref points to an object that is not a commit
- // (e.g. a tree or a blob);
- // it should be ignored as traversal starting point.
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
+ // ignore as traversal starting point:
+ // - the ref points to an object that does not exist
+ // - the ref points to an object that is not a commit (e.g. a
+ // tree or a blob)
}
if (commit != null)
add(commit);
} else
walk.markUninteresting(walk.lookupCommit(start));
return this;
- } catch (MissingObjectException e) {
- throw e;
- } catch (IncorrectObjectTypeException e) {
+ } catch (MissingObjectException | IncorrectObjectTypeException e) {
throw e;
} catch (IOException e) {
throw new JGitInternalException(MessageFormat.format(
}
}
return newCommit;
- } catch (RefAlreadyExistsException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (RefNotFoundException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (InvalidRefNameException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (CheckoutConflictException e) {
+ } catch (RefAlreadyExistsException | RefNotFoundException
+ | InvalidRefNameException | CheckoutConflictException e) {
throw new JGitInternalException(e.getMessage(), e);
}
}
modulesConfig.setString(ConfigConstants.CONFIG_SUBMODULE_SECTION,
name, ConfigConstants.CONFIG_KEY_URL, uri);
modulesConfig.save();
- } catch (IOException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (ConfigInvalidException e) {
+ } catch (IOException | ConfigInvalidException e) {
throw new JGitInternalException(e.getMessage(), e);
}
if (!initialized.isEmpty())
config.save();
return initialized;
- } catch (IOException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (ConfigInvalidException e) {
+ } catch (IOException | ConfigInvalidException e) {
throw new JGitInternalException(e.getMessage(), e);
}
}
statuses.put(status.getPath(), status);
}
return statuses;
- } catch (IOException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (ConfigInvalidException e) {
+ } catch (IOException | ConfigInvalidException e) {
throw new JGitInternalException(e.getMessage(), e);
}
}
if (!synced.isEmpty())
config.save();
return synced;
- } catch (IOException e) {
- throw new JGitInternalException(e.getMessage(), e);
- } catch (ConfigInvalidException e) {
+ } catch (IOException | ConfigInvalidException e) {
throw new JGitInternalException(e.getMessage(), e);
}
}
try {
c.read();
- } catch (IOException e) {
- c.unlock();
- throw e;
- } catch (RuntimeException e) {
- c.unlock();
- throw e;
- } catch (Error e) {
+ } catch (IOException | RuntimeException | Error e) {
c.unlock();
throw e;
}
try (OutputStream o = tmp.getOutputStream();
OutputStream bo = new BufferedOutputStream(o)) {
writeTo(liveFile.getParentFile(), bo);
- } catch (IOException err) {
- tmp.unlock();
- throw err;
- } catch (RuntimeException err) {
- tmp.unlock();
- throw err;
- } catch (Error err) {
+ } catch (IOException | RuntimeException | Error err) {
tmp.unlock();
throw err;
}
// Don't worry about a file that doesn't exist yet, it
// conceptually has no current content to copy.
//
- } catch (IOException ioe) {
- unlock();
- throw ioe;
- } catch (RuntimeException ioe) {
- unlock();
- throw ioe;
- } catch (Error ioe) {
+ } catch (IOException | RuntimeException | Error ioe) {
unlock();
throw ioe;
}
}
os.close();
os = null;
- } catch (IOException ioe) {
- unlock();
- throw ioe;
- } catch (RuntimeException ioe) {
- unlock();
- throw ioe;
- } catch (Error ioe) {
+ } catch (IOException | RuntimeException | Error ioe) {
unlock();
throw ioe;
}
os.getChannel().force(true);
out.close();
os = null;
- } catch (IOException ioe) {
- unlock();
- throw ioe;
- } catch (RuntimeException ioe) {
- unlock();
- throw ioe;
- } catch (Error ioe) {
+ } catch (IOException | RuntimeException | Error ioe) {
unlock();
throw ioe;
}
if (mmap)
return pack.mmap(offset, windowSize);
return pack.read(offset, windowSize);
- } catch (IOException e) {
- close(pack);
- throw e;
- } catch (RuntimeException e) {
- close(pack);
- throw e;
- } catch (Error e) {
+ } catch (IOException | RuntimeException | Error e) {
close(pack);
throw e;
}
resObj.setCachedDelta(deltaCache.cache(zbuf, len, deltaLen));
resObj.setCachedSize(deltaLen);
- } catch (IOException err) {
- deltaCache.credit(deltaLen);
- } catch (OutOfMemoryError err) {
+ } catch (IOException | OutOfMemoryError err) {
deltaCache.credit(deltaLen);
}
}
bundles.put(type, bundle);
}
return (T) bundle;
- } catch (InstantiationException e) {
- throw new Error(e);
- } catch (IllegalAccessException e) {
+ } catch (InstantiationException | IllegalAccessException e) {
throw new Error(e);
}
}
field.set(this, translatedText);
} catch (MissingResourceException e) {
throw new TranslationStringMissingException(bundleClass, locale, field.getName(), e);
- } catch (IllegalArgumentException e) {
- throw new Error(e);
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
}
} catch (TransportException err) {
close();
throw err;
- } catch (IOException err) {
- close();
- throw new TransportException(err.getMessage(), err);
- } catch (RuntimeException err) {
+ } catch (IOException | RuntimeException err) {
close();
throw new TransportException(err.getMessage(), err);
}
} catch (CancelledException ce) {
close();
return; // Caller should test (or just know) this themselves.
- } catch (IOException err) {
- close();
- throw new TransportException(err.getMessage(), err);
- } catch (RuntimeException err) {
+ } catch (IOException | RuntimeException err) {
close();
throw new TransportException(err.getMessage(), err);
}
} catch (TransportException err) {
close();
throw err;
- } catch (IOException err) {
- close();
- throw new TransportException(transport.uri, err.getMessage(), err);
- } catch (RuntimeException err) {
+ } catch (IOException | RuntimeException err) {
close();
throw new TransportException(transport.uri, err.getMessage(), err);
}
packLock = parser.parse(NullProgressMonitor.INSTANCE);
ins.flush();
}
- } catch (IOException err) {
- close();
- throw new TransportException(transport.uri, err.getMessage(), err);
- } catch (RuntimeException err) {
+ } catch (IOException | RuntimeException err) {
close();
throw new TransportException(transport.uri, err.getMessage(), err);
}
SecretKeySpec signingKey = new SecretKeySpec(keyBytes, "HmacSHA1"); //$NON-NLS-1$
mac = Mac.getInstance("HmacSHA1"); //$NON-NLS-1$
mac.init(signingKey);
- } catch (InvalidKeyException e) {
- throw new IllegalStateException(e);
- } catch (NoSuchAlgorithmException e) {
+ } catch (InvalidKeyException | NoSuchAlgorithmException e) {
throw new IllegalStateException(e);
}
}
try {
final UploadPack rp = uploadPackFactory.create(req, remote);
rp.upload(out_r, in_w, null);
- } catch (ServiceNotEnabledException e) {
+ } catch (ServiceNotEnabledException
+ | ServiceNotAuthorizedException e) {
// Ignored. Client cannot use this repository.
- } catch (ServiceNotAuthorizedException e) {
- // Ignored. Client cannot use this repository.
- } catch (IOException err) {
+ } catch (IOException | RuntimeException err) {
// Client side of the pipes should report the problem.
err.printStackTrace();
- } catch (RuntimeException err) {
- // Client side will notice we went away, and report.
- err.printStackTrace();
} finally {
try {
out_r.close();
try {
final ReceivePack rp = receivePackFactory.create(req, remote);
rp.receive(out_r, in_w, System.err);
- } catch (ServiceNotEnabledException e) {
- // Ignored. Client cannot use this repository.
- } catch (ServiceNotAuthorizedException e) {
+ } catch (ServiceNotEnabledException
+ | ServiceNotAuthorizedException e) {
// Ignored. Client cannot use this repository.
} catch (IOException e) {
- // Since the InternalPushConnection
- // is used in tests, we want to avoid hiding exceptions
- // because they can point to programming errors on the server
- // side. By rethrowing, the default handler will dump it
- // to stderr.
+ // Since the InternalPushConnection is used in tests, we
+ // want to avoid hiding exceptions because they can point to
+ // programming errors on the server side. By rethrowing, the
+ // default handler will dump it to stderr.
throw new UncheckedIOException(e);
} finally {
try {
TransportProtocol proto;
try {
proto = (TransportProtocol) f.get(null);
- } catch (IllegalArgumentException e) {
- // If we cannot access the field, don't.
- continue;
- } catch (IllegalAccessException e) {
+ } catch (IllegalArgumentException | IllegalAccessException e) {
// If we cannot access the field, don't.
continue;
}
try (InputStream in = openInputStream(c)) {
return getConnection(c, in, service);
}
- } catch (NotSupportedException err) {
- throw err;
- } catch (TransportException err) {
+ } catch (NotSupportedException | TransportException err) {
throw err;
} catch (IOException err) {
throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
throw new NotSupportedException(msg);
}
}
- } catch (NotSupportedException err) {
- throw err;
- } catch (TransportException err) {
+ } catch (NotSupportedException | TransportException err) {
throw err;
} catch (IOException err) {
throw new TransportException(uri, JGitText.get().errorReadingInfoRefs, err);
String err = status + " " + conn.getResponseMessage(); //$NON-NLS-1$
throw new TransportException(uri, err);
}
- } catch (NotSupportedException e) {
- throw e;
- } catch (TransportException e) {
+ } catch (NotSupportedException | TransportException e) {
throw e;
} catch (SSLHandshakeException e) {
handleSslFailure(e);
} catch (ServiceMayNotContinueException noPack) {
// This was already reported on (below).
throw noPack;
- } catch (IOException err) {
- if (reportInternalServerErrorOverSideband())
+ } catch (IOException | RuntimeException | Error err) {
+ if (reportInternalServerErrorOverSideband()) {
throw new UploadPackInternalServerErrorException(err);
- else
- throw err;
- } catch (RuntimeException err) {
- if (reportInternalServerErrorOverSideband())
- throw new UploadPackInternalServerErrorException(err);
- else
- throw err;
- } catch (Error err) {
- if (reportInternalServerErrorOverSideband())
- throw new UploadPackInternalServerErrorException(err);
- else
+ } else {
throw err;
+ }
}
} else {
sendPack(false, req, accumulator, allTags, unshallowCommits, deepenNots);
} else
throw new ServiceNotEnabledException();
- } catch (RuntimeException e) {
- db.close();
- throw new RepositoryNotFoundException(name, e);
-
- } catch (IOException e) {
+ } catch (RuntimeException | IOException e) {
db.close();
throw new RepositoryNotFoundException(name, e);
return (GSSManager) GSS_MANAGER_IMPL_CONSTRUCTOR
.newInstance(httpCaller);
- } catch (InstantiationException e) {
- throw new Error(e);
- } catch (IllegalAccessException e) {
- throw new Error(e);
- } catch (IllegalArgumentException e) {
- throw new Error(e);
- } catch (InvocationTargetException e) {
+ } catch (InstantiationException | IllegalAccessException
+ | IllegalArgumentException | InvocationTargetException e) {
throw new Error(e);
}
}
try {
conn.configure(null, trustAllCerts, null);
conn.setHostnameVerifier(new DummyHostnameVerifier());
- } catch (KeyManagementException e) {
- throw new IOException(e.getMessage());
- } catch (NoSuchAlgorithmException e) {
+ } catch (KeyManagementException | NoSuchAlgorithmException e) {
throw new IOException(e.getMessage());
}
}