HDFS-12805. Ozone: Redundant characters printed in exception log. Contributed by Yiqun Lin.

This commit is contained in:
Xiaoyu Yao 2017-11-15 11:40:44 -08:00 committed by Owen O'Malley
parent 93f1b04949
commit 419e86d580
3 changed files with 10 additions and 11 deletions

View File

@ -99,7 +99,7 @@ public abstract class BucketProcessTemplate {
return response; return response;
} catch (IllegalArgumentException argEx) { } catch (IllegalArgumentException argEx) {
LOG.error("Invalid bucket. ex:{}", argEx); LOG.error("Invalid bucket.", argEx);
throw ErrorTable.newError(ErrorTable.INVALID_BUCKET_NAME, userArgs, throw ErrorTable.newError(ErrorTable.INVALID_BUCKET_NAME, userArgs,
argEx); argEx);
} catch (IOException fsExp) { } catch (IOException fsExp) {
@ -149,7 +149,7 @@ public abstract class BucketProcessTemplate {
*/ */
void handleIOException(String bucket, String reqID, String hostName, void handleIOException(String bucket, String reqID, String hostName,
IOException fsExp) throws OzoneException { IOException fsExp) throws OzoneException {
LOG.error("IOException: {}", fsExp); LOG.error("IOException:", fsExp);
OzoneException exp = null; OzoneException exp = null;
if (fsExp instanceof FileAlreadyExistsException) { if (fsExp instanceof FileAlreadyExistsException) {

View File

@ -94,10 +94,10 @@ public abstract class KeyProcessTemplate {
return response; return response;
} catch (IllegalArgumentException argExp) { } catch (IllegalArgumentException argExp) {
LOG.error("Invalid bucket in key call. ex:{}", argExp); LOG.error("Invalid bucket in key call.", argExp);
throw newError(INVALID_BUCKET_NAME, userArgs, argExp); throw newError(INVALID_BUCKET_NAME, userArgs, argExp);
} catch (IOException fsExp) { } catch (IOException fsExp) {
LOG.error("IOException. ex : {}", fsExp); LOG.error("IOException:", fsExp);
// Map KEY_NOT_FOUND to INVALID_KEY // Map KEY_NOT_FOUND to INVALID_KEY
if (fsExp.getMessage().endsWith( if (fsExp.getMessage().endsWith(
KeySpaceManagerProtocolProtos.Status.KEY_NOT_FOUND.name())) { KeySpaceManagerProtocolProtos.Status.KEY_NOT_FOUND.name())) {
@ -109,7 +109,7 @@ public abstract class KeyProcessTemplate {
throw ErrorTable.newError(ErrorTable.SERVER_ERROR, userArgs, fsExp); throw ErrorTable.newError(ErrorTable.SERVER_ERROR, userArgs, fsExp);
} catch (NoSuchAlgorithmException algoEx) { } catch (NoSuchAlgorithmException algoEx) {
LOG.error("NoSuchAlgorithmException. Probably indicates an unusual java " LOG.error("NoSuchAlgorithmException. Probably indicates an unusual java "
+ "installation. ex : {}", algoEx); + "installation.", algoEx);
throw ErrorTable.newError(SERVER_ERROR, userArgs, algoEx); throw ErrorTable.newError(SERVER_ERROR, userArgs, algoEx);
} }
} }

View File

@ -97,7 +97,7 @@ public abstract class VolumeProcessTemplate {
return response; return response;
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
LOG.error("illegal argument. {}", ex); LOG.error("Illegal argument.", ex);
throw ErrorTable.newError(ErrorTable.INVALID_VOLUME_NAME, userArgs, ex); throw ErrorTable.newError(ErrorTable.INVALID_VOLUME_NAME, userArgs, ex);
} catch (IOException ex) { } catch (IOException ex) {
handleIOException(volume, reqID, hostName, ex); handleIOException(volume, reqID, hostName, ex);
@ -130,7 +130,7 @@ public abstract class VolumeProcessTemplate {
*/ */
private void handleIOException(String volume, String reqID, String hostName, private void handleIOException(String volume, String reqID, String hostName,
IOException fsExp) throws OzoneException { IOException fsExp) throws OzoneException {
LOG.error("IOException: {}", fsExp); LOG.error("IOException:", fsExp);
OzoneException exp = null; OzoneException exp = null;
if ((fsExp != null && fsExp.getMessage().endsWith( if ((fsExp != null && fsExp.getMessage().endsWith(
@ -178,7 +178,7 @@ public abstract class VolumeProcessTemplate {
try { try {
args.setQuota(quota); args.setQuota(quota);
} catch (IllegalArgumentException ex) { } catch (IllegalArgumentException ex) {
LOG.debug("Malformed Quota: {}", ex); LOG.debug("Malformed Quota.", ex);
throw ErrorTable.newError(ErrorTable.MALFORMED_QUOTA, args, ex); throw ErrorTable.newError(ErrorTable.MALFORMED_QUOTA, args, ex);
} }
} }
@ -235,7 +235,7 @@ public abstract class VolumeProcessTemplate {
ListVolumes volumes = fs.listVolumes(listArgs); ListVolumes volumes = fs.listVolumes(listArgs);
return OzoneUtils.getResponse(user, HTTP_OK, volumes.toJsonString()); return OzoneUtils.getResponse(user, HTTP_OK, volumes.toJsonString());
} catch (IOException ex) { } catch (IOException ex) {
LOG.debug("unable to get the volume list for the user. Ex: {}", ex); LOG.debug("unable to get the volume list for the user.", ex);
OzoneException exp = ErrorTable.newError(ErrorTable.SERVER_ERROR, OzoneException exp = ErrorTable.newError(ErrorTable.SERVER_ERROR,
user, ex); user, ex);
exp.setMessage("unable to get the volume list for the user"); exp.setMessage("unable to get the volume list for the user");
@ -264,8 +264,7 @@ public abstract class VolumeProcessTemplate {
ListBuckets bucketList = fs.listBuckets(listArgs); ListBuckets bucketList = fs.listBuckets(listArgs);
return OzoneUtils.getResponse(args, HTTP_OK, bucketList.toJsonString()); return OzoneUtils.getResponse(args, HTTP_OK, bucketList.toJsonString());
} catch (IOException ex) { } catch (IOException ex) {
LOG.debug("unable to get the bucket list for the specified volume." + LOG.debug("unable to get the bucket list for the specified volume.", ex);
" Ex: {}", ex);
OzoneException exp = OzoneException exp =
ErrorTable.newError(ErrorTable.SERVER_ERROR, args, ex); ErrorTable.newError(ErrorTable.SERVER_ERROR, args, ex);
exp.setMessage("unable to get the bucket list for the specified volume."); exp.setMessage("unable to get the bucket list for the specified volume.");