Commit 97c95732 authored by Christian Schudt's avatar Christian Schudt

Java 7: Collapse identical catch blocks.

parent 6cc1e42d
......@@ -751,11 +751,7 @@ public class XMPPServer {
if (openfireHome == null) {
try {
openfireHome = verifyHome("..", jiveConfigName).getCanonicalFile();
}
catch (FileNotFoundException fe) {
// Ignore.
}
catch (IOException ie) {
} catch (IOException ie) {
// Ignore.
}
}
......
......@@ -768,8 +768,6 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
rootE.addElement("newSecret").setText(newSecret);
executeRequest(POST, path, groupDoc.asXML());
} catch (UnauthorizedException ue) {
Log.error("Error updating the password of Clearspace", ue);
} catch (Exception e) {
Log.error("Error updating the password of Clearspace", e);
}
......@@ -808,8 +806,6 @@ public class ClearspaceManager extends BasicModule implements ExternalComponentM
rootE.addElement("tcpPort").setText(xmppPort);
executeRequest(POST, path, groupDoc.asXML());
} catch (UnauthorizedException ue) {
Log.error("Error updating the client settings of Clearspace", ue);
} catch (Exception e) {
Log.error("Error updating the client settings of Clearspace", e);
}
......
......@@ -92,17 +92,7 @@ public class AuthenticateUser extends AdHocCommand {
try {
AuthFactory.authenticate(user.getUsername(), password);
}
catch (UnauthorizedException e) {
// Auth failed
note.addAttribute("type", "error");
note.setText("Authentication failed.");
return;
} catch (ConnectionException e) {
// Auth failed
note.addAttribute("type", "error");
note.setText("Authentication failed.");
return;
} catch (InternalUnauthenticatedException e) {
catch (UnauthorizedException | ConnectionException | InternalUnauthenticatedException e) {
// Auth failed
note.addAttribute("type", "error");
note.setText("Authentication failed.");
......
......@@ -193,20 +193,11 @@ public class IQAuthHandler extends IQHandler implements IQAuthInfo {
}
}
}
catch (UserNotFoundException e) {
response = IQ.createResultIQ(packet);
response.setChildElement(packet.getChildElement().createCopy());
response.setError(PacketError.Condition.not_authorized);
}
catch (UnauthorizedException e) {
catch (UserNotFoundException | UnauthorizedException e) {
response = IQ.createResultIQ(packet);
response.setChildElement(packet.getChildElement().createCopy());
response.setError(PacketError.Condition.not_authorized);
} catch (ConnectionException e) {
response = IQ.createResultIQ(packet);
response.setChildElement(packet.getChildElement().createCopy());
response.setError(PacketError.Condition.internal_server_error);
} catch (InternalUnauthenticatedException e) {
} catch (ConnectionException | InternalUnauthenticatedException e) {
response = IQ.createResultIQ(packet);
response.setChildElement(packet.getChildElement().createCopy());
response.setError(PacketError.Condition.internal_server_error);
......
......@@ -219,13 +219,10 @@ public class HttpBindServlet extends HttpServlet {
Log.info(new Date() + ": HTTP RECV(" + connection.getSession().getStreamID().getID() + "): " + rootNode.asXML());
}
}
catch (UnauthorizedException e) {
catch (UnauthorizedException | HttpBindException e) {
// Server wasn't initialized yet.
sendLegacyError(context, BoshBindingError.internalServerError, "Server has not finished initialization." );
}
catch (HttpBindException e) {
sendLegacyError(context, BoshBindingError.internalServerError, "Server has not finished initialization." );
}
}
private void handleSessionRequest(String sid, AsyncContext context, Element rootNode)
......
......@@ -74,9 +74,7 @@ public class HttpConnection {
try {
deliverBody(null, true);
}
catch (HttpConnectionClosedException e) {
Log.warn("Unexpected exception occurred while trying to close an HttpException.", e);
} catch (IOException e) {
catch (HttpConnectionClosedException | IOException e) {
Log.warn("Unexpected exception occurred while trying to close an HttpException.", e);
}
}
......
......@@ -208,14 +208,7 @@ public class HttpSessionManager {
try {
connection.deliverBody(createSessionCreationResponse(session), true);
}
catch (HttpConnectionClosedException e) {
Log.error("Error creating session.", e);
throw new HttpBindException("Internal server error", BoshBindingError.internalServerError);
}
catch (DocumentException e) {
Log.error("Error creating session.", e);
throw new HttpBindException("Internal server error", BoshBindingError.internalServerError);
} catch (IOException e) {
catch (HttpConnectionClosedException | DocumentException | IOException e) {
Log.error("Error creating session.", e);
throw new HttpBindException("Internal server error", BoshBindingError.internalServerError);
}
......
......@@ -110,14 +110,10 @@ public class DroppableFrame extends JFrame implements DropTargetListener, DragSo
dropTargetDropEvent.rejectDrop();
}
}
catch (IOException io) {
catch (IOException | UnsupportedFlavorException io) {
io.printStackTrace();
dropTargetDropEvent.rejectDrop();
}
catch (UnsupportedFlavorException ufe) {
ufe.printStackTrace();
dropTargetDropEvent.rejectDrop();
}
}
@Override
......
......@@ -110,14 +110,10 @@ public abstract class DroppableTextPane extends JTextPane implements DropTargetL
dropTargetDropEvent.rejectDrop();
}
}
catch (IOException io) {
catch (IOException | UnsupportedFlavorException io) {
io.printStackTrace();
dropTargetDropEvent.rejectDrop();
}
catch (UnsupportedFlavorException ufe) {
ufe.printStackTrace();
dropTargetDropEvent.rejectDrop();
}
}
@Override
......
......@@ -57,16 +57,7 @@ public class Echo implements Runnable {
for (int i = 0; i < 3; i++)
socket.send(packet);
}
}
catch (UnknownHostException uhe) {
if (enabled) {
}
}
catch (SocketException se) {
if (enabled) {
}
}
catch (IOException ioe) {
} catch (IOException ioe) {
if (enabled) {
}
}
......
......@@ -114,9 +114,7 @@ public class MediaProxyService extends BasicModule
echo = new Echo(echoPort);
Thread t = new Thread(echo);
t.start();
} catch (UnknownHostException e) {
// Ignore
} catch (SocketException e) {
} catch (UnknownHostException | SocketException e) {
// Ignore
}
......
......@@ -501,7 +501,7 @@ public class LocalMUCUser implements MUCUser {
catch (ServiceUnavailableException e) {
sendErrorPacket(packet, PacketError.Condition.service_unavailable);
}
catch (UserAlreadyExistsException e) {
catch (UserAlreadyExistsException | ConflictException e) {
sendErrorPacket(packet, PacketError.Condition.conflict);
}
catch (RoomLockedException e) {
......@@ -513,11 +513,7 @@ public class LocalMUCUser implements MUCUser {
}
catch (RegistrationRequiredException e) {
sendErrorPacket(packet, PacketError.Condition.registration_required);
}
catch (ConflictException e) {
sendErrorPacket(packet, PacketError.Condition.conflict);
}
catch (NotAcceptableException e) {
} catch (NotAcceptableException e) {
sendErrorPacket(packet, PacketError.Condition.not_acceptable);
}
catch (NotAllowedException e) {
......
......@@ -641,11 +641,7 @@ public class MUCPersistenceManager {
default:
Log.error("Unknown affiliation value " + affiliation + " for user " + affiliationJID + " in persistent room " + room.getID());
}
} catch (ForbiddenException e) {
Log.warn("An exception prevented affiliations to be added to the room with id " + roomID, e);
} catch (ConflictException e) {
Log.warn("An exception prevented affiliations to be added to the room with id " + roomID, e);
} catch (NotAllowedException e) {
} catch (ForbiddenException | ConflictException | NotAllowedException e) {
Log.warn("An exception prevented affiliations to be added to the room with id " + roomID, e);
}
} catch (SQLException e) {
......@@ -680,9 +676,7 @@ public class MUCPersistenceManager {
// might be a group JID
affiliationJID = GroupJID.fromString(resultSet.getString(2));
room.addMember(affiliationJID, resultSet.getString(3), room.getRole());
} catch (ForbiddenException e) {
Log.warn("Unable to add member to room.", e);
} catch (ConflictException e) {
} catch (ForbiddenException | ConflictException e) {
Log.warn("Unable to add member to room.", e);
}
} catch (SQLException e) {
......
......@@ -113,9 +113,7 @@ public class ClientTrustManager implements X509TrustManager {
try {
crlStore = CertStore.getInstance("Collection", params);
}
catch (InvalidAlgorithmParameterException ex) {
Log.warn("ClientTrustManager: ",ex);
} catch (NoSuchAlgorithmException ex) {
catch (InvalidAlgorithmParameterException | NoSuchAlgorithmException ex) {
Log.warn("ClientTrustManager: ",ex);
}
......@@ -311,15 +309,10 @@ public class ClientTrustManager implements X509TrustManager {
Log.debug("ClientTrustManager: Trusted CA: "+trustedCert.getSubjectDN());
}
}
catch(CertPathBuilderException e) {
catch(CertPathBuilderException | CertPathValidatorException e) {
Log.debug("ClientTrustManager:",e);
throw new CertificateException("certificate path failed: "+e.getMessage());
}
catch(CertPathValidatorException e) {
Log.debug("ClientTrustManager:",e);
throw new CertificateException("certificate path failed: "+e.getMessage());
}
catch(Exception e) {
} catch(Exception e) {
Log.debug("ClientTrustManager:",e);
throw new CertificateException("unexpected error: "+e.getMessage());
}
......
......@@ -66,11 +66,7 @@ public class SSLJiveTrustManager implements X509TrustManager {
try {
x509Certificates[0].checkValidity();
}
catch (CertificateExpiredException e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
trusted = false;
}
catch (CertificateNotYetValidException e) {
catch (CertificateExpiredException | CertificateNotYetValidException e) {
Log.error(LocaleUtils.getLocalizedString("admin.error"), e);
trusted = false;
}
......
......@@ -88,12 +88,9 @@ public class XMPPCallbackHandler implements CallbackHandler {
//Log.debug("XMPPCallbackHandler: PasswordCallback");
}
catch (UserNotFoundException e) {
catch (UserNotFoundException | UnsupportedOperationException e) {
throw new IOException(e.toString());
}
catch (UnsupportedOperationException uoe) {
throw new IOException(uoe.toString());
}
}
else if (callback instanceof VerifyPasswordCallback) {
......
......@@ -170,12 +170,9 @@ public class RosterManager extends BasicModule implements GroupEventListener, Us
}
}
}
catch (UnsupportedOperationException e) {
catch (UnsupportedOperationException | UserNotFoundException e) {
// Do nothing
}
catch (UserNotFoundException e) {
// Do nothing.
}
}
/**
......
......@@ -143,10 +143,7 @@ public class SaslServerPlainImpl implements SaslServer {
}
return null;
}
} catch (UnsupportedCallbackException e) {
aborted = true;
throw new SaslException("PLAIN authentication failed for: "+username, e);
} catch (IOException e) {
} catch (UnsupportedCallbackException | IOException e) {
aborted = true;
throw new SaslException("PLAIN authentication failed for: "+username, e);
}
......
......@@ -195,11 +195,7 @@ public class User implements Cacheable, Externalizable, Result {
UserEventDispatcher.dispatchEvent(this, UserEventDispatcher.EventType.user_modified,
params);
}
catch (UserNotFoundException e) {
Log.error(e.getMessage(), e);
} catch (ConnectionException e) {
Log.error(e.getMessage(), e);
} catch (InternalUnauthenticatedException e) {
catch (UserNotFoundException | ConnectionException | InternalUnauthenticatedException e) {
Log.error(e.getMessage(), e);
}
}
......
......@@ -505,12 +505,9 @@ public class EmailService {
transport.sendMessage(message,
message.getRecipients(MimeMessage.RecipientType.TO));
}
catch (AddressException ae) {
catch (AddressException | SendFailedException ae) {
Log.error(ae.getMessage(), ae);
}
catch (SendFailedException sfe) {
Log.error(sfe.getMessage(), sfe);
}
}
}
finally {
......
......@@ -61,10 +61,7 @@ public class SimpleSSLSocketFactory extends SSLSocketFactory {
new java.security.SecureRandom());
factory = sslcontent.getSocketFactory();
}
catch (NoSuchAlgorithmException e) {
Log.error(e.getMessage(), e);
}
catch (KeyManagementException e) {
catch (NoSuchAlgorithmException | KeyManagementException e) {
Log.error(e.getMessage(), e);
}
}
......
......@@ -1097,10 +1097,7 @@ public class XMLWriter extends XMLFilterImpl implements LexicalHandler {
parent.setProperty(LEXICAL_HANDLER_NAMES[i], this);
break;
}
catch (SAXNotRecognizedException ex) {
// ignore
}
catch (SAXNotSupportedException ex) {
catch (SAXNotRecognizedException | SAXNotSupportedException ex) {
// ignore
}
}
......
......@@ -447,9 +447,7 @@ public class CacheFactory {
clusteredCacheFactoryStrategy = (CacheFactoryStrategy) Class.forName(
clusteredCacheFactoryClass, true,
getClusteredCacheStrategyClassLoader()).newInstance();
} catch (NoClassDefFoundError e) {
log.warn("Clustered cache factory strategy " + clusteredCacheFactoryClass + " not found");
} catch (Exception e) {
} catch (NoClassDefFoundError | Exception e) {
log.warn("Clustered cache factory strategy " + clusteredCacheFactoryClass + " not found");
}
}
......
......@@ -93,8 +93,7 @@ public class SANCertificateIdentityMapping implements CertificateIdentityMapping
// OF-517: othername formats are extensible. If we don't recognize the format, skip it.
Log.debug("Cannot parse altName, likely because of unknown record format.", ex);
}
}
catch (IOException e) {
} catch (IOException e) {
// Ignore
}
catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment