Merge \"Include cause when reporting errors.\" into nyc-dev

am: 60585e6c54

Change-Id: I9a0ba14d358fedd7287e4bd0c5710953a9f21d27
This commit is contained in:
Steve McKay
2016-06-16 19:18:28 +00:00
committed by android-build-merger
3 changed files with 11 additions and 17 deletions

View File

@@ -227,7 +227,7 @@ class CopyJob extends Job {
try {
mBatchSize = calculateSize(mSrcs);
} catch (ResourceException e) {
Log.w(TAG, "Failed to calculate total size. Copying without progress.");
Log.w(TAG, "Failed to calculate total size. Copying without progress.", e);
mBatchSize = -1;
}
@@ -236,25 +236,19 @@ class CopyJob extends Job {
for (int i = 0; i < mSrcs.size() && !isCanceled(); ++i) {
srcInfo = mSrcs.get(i);
// Guard unsupported recursive operation.
try {
if (dstInfo.equals(srcInfo) || isDescendentOf(srcInfo, dstInfo)) {
throw new ResourceException("Cannot copy to itself recursively.");
}
} catch (ResourceException e) {
Log.e(TAG, e.toString());
onFileFailed(srcInfo);
continue;
}
if (DEBUG) Log.d(TAG,
"Copying " + srcInfo.displayName + " (" + srcInfo.derivedUri + ")"
+ " to " + dstInfo.displayName + " (" + dstInfo.derivedUri + ")");
try {
processDocument(srcInfo, null, dstInfo);
if (dstInfo.equals(srcInfo) || isDescendentOf(srcInfo, dstInfo)) {
Log.e(TAG, "Skipping recursive copy of " + srcInfo.derivedUri);
onFileFailed(srcInfo);
} else {
processDocument(srcInfo, null, dstInfo);
}
} catch (ResourceException e) {
Log.e(TAG, e.toString());
Log.e(TAG, "Failed to copy " + srcInfo.derivedUri, e);
onFileFailed(srcInfo);
}
}
@@ -306,7 +300,7 @@ class CopyJob extends Job {
}
} catch (RemoteException | RuntimeException e) {
Log.e(TAG, "Provider side copy failed for: " + src.derivedUri
+ " due to an exception: " + e);
+ " due to an exception.", e);
}
// If optimized copy fails, then fallback to byte-by-byte copy.
if (DEBUG) Log.d(TAG, "Fallback to byte-by-byte copy for: " + src.derivedUri);

View File

@@ -86,7 +86,7 @@ final class DeleteJob extends Job {
try {
deleteDocument(doc, mSrcParent);
} catch (ResourceException e) {
Log.e(TAG, "Failed to delete document @ " + doc.derivedUri);
Log.e(TAG, "Failed to delete document @ " + doc.derivedUri, e);
onFileFailed(doc);
}
}

View File

@@ -98,7 +98,7 @@ final class MoveJob extends CopyJob {
}
} catch (RemoteException | RuntimeException e) {
Log.e(TAG, "Provider side move failed for: " + src.derivedUri
+ " due to an exception: " + e);
+ " due to an exception: ", e);
}
// If optimized move fails, then fallback to byte-by-byte copy.
if (DEBUG) Log.d(TAG, "Fallback to byte-by-byte move for: " + src.derivedUri);