From f134ef63e016bf13b70bef1ec277603b8a9a6f21 Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 25 Apr 2012 11:06:50 +0000
Subject: [PATCH] Fix OPENDJ-474: Remove requirement for clients to deal with InterruptedExceptions in synchronous APIs
---
opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java | 52 +++++-----------------------------------------------
1 files changed, 5 insertions(+), 47 deletions(-)
diff --git a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
index 9bed33d..cf9dbb4 100644
--- a/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
+++ b/opendj3/opendj-ldap-toolkit/src/main/java/com/forgerock/opendj/ldap/tools/LDAPModify.java
@@ -22,7 +22,7 @@
*
*
* Copyright 2010 Sun Microsystems, Inc.
- * Portions copyright 2011 ForgeRock AS
+ * Portions copyright 2011-2012 ForgeRock AS
*/
package com.forgerock.opendj.ldap.tools;
@@ -30,7 +30,6 @@
import static com.forgerock.opendj.ldap.tools.ToolConstants.*;
import static com.forgerock.opendj.ldap.tools.ToolsMessages.*;
import static com.forgerock.opendj.ldap.tools.Utils.filterExitCode;
-import static org.forgerock.opendj.ldap.ErrorResultException.newErrorResult;
import java.io.FileInputStream;
import java.io.IOException;
@@ -81,16 +80,7 @@
println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
if (connection != null) {
try {
- Result r;
- try {
- r = connection.add(change);
- } catch (final InterruptedException e) {
- // This shouldn't happen because there are no other
- // threads
- // to interrupt this one.
- throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
- .getLocalizedMessage(), e);
- }
+ Result r = connection.add(change);
printResult(opType, change.getName().toString(), r);
return r.getResultCode().intValue();
} catch (final ErrorResultException ere) {
@@ -108,16 +98,7 @@
println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
if (connection != null) {
try {
- Result r;
- try {
- r = connection.delete(change);
- } catch (final InterruptedException e) {
- // This shouldn't happen because there are no other
- // threads
- // to interrupt this one.
- throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
- .getLocalizedMessage(), e);
- }
+ Result r = connection.delete(change);
printResult(opType, change.getName().toString(), r);
return r.getResultCode().intValue();
} catch (final ErrorResultException ere) {
@@ -135,16 +116,7 @@
println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
if (connection != null) {
try {
- Result r;
- try {
- r = connection.modifyDN(change);
- } catch (final InterruptedException e) {
- // This shouldn't happen because there are no other
- // threads
- // to interrupt this one.
- throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
- .getLocalizedMessage(), e);
- }
+ Result r = connection.modifyDN(change);
printResult(opType, change.getName().toString(), r);
return r.getResultCode().intValue();
} catch (final ErrorResultException ere) {
@@ -162,16 +134,7 @@
println(INFO_PROCESSING_OPERATION.get(opType, change.getName().toString()));
if (connection != null) {
try {
- Result r;
- try {
- r = connection.modify(change);
- } catch (final InterruptedException e) {
- // This shouldn't happen because there are no other
- // threads
- // to interrupt this one.
- throw newErrorResult(ResultCode.CLIENT_SIDE_USER_CANCELLED, e
- .getLocalizedMessage(), e);
- }
+ Result r = connection.modify(change);
printResult(opType, change.getName().toString(), r);
return r.getResultCode().intValue();
} catch (final ErrorResultException ere) {
@@ -501,11 +464,6 @@
connection = connectionFactory.getConnection();
} catch (final ErrorResultException ere) {
return Utils.printErrorMessage(this, ere);
- } catch (final InterruptedException e) {
- // This shouldn't happen because there are no other threads to
- // interrupt this one.
- println(LocalizableMessage.raw(e.getLocalizedMessage()));
- return ResultCode.CLIENT_SIDE_USER_CANCELLED.intValue();
}
}
--
Gitblit v1.10.0