Move DexException to dx.util.

Change-Id: I86bf83bc3adcc55eb8bbeac2fc28822cb5f2d2b9
diff --git a/dx/src/com/android/dx/dex/TableOfContents.java b/dx/src/com/android/dx/dex/TableOfContents.java
index 313ecad..a85e9bc 100644
--- a/dx/src/com/android/dx/dex/TableOfContents.java
+++ b/dx/src/com/android/dx/dex/TableOfContents.java
@@ -17,6 +17,7 @@
 package com.android.dx.dex;
 
 import com.android.dx.io.DexBuffer;
+import com.android.dx.util.DexException;
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
diff --git a/dx/src/com/android/dx/io/CodeReader.java b/dx/src/com/android/dx/io/CodeReader.java
index 26430bd..cab1063 100644
--- a/dx/src/com/android/dx/io/CodeReader.java
+++ b/dx/src/com/android/dx/io/CodeReader.java
@@ -16,8 +16,8 @@
 
 package com.android.dx.io;
 
-import com.android.dx.dex.DexException;
 import com.android.dx.io.instructions.DecodedInstruction;
+import com.android.dx.util.DexException;
 
 /**
  * Walks through a block of code and calls visitor call backs.
diff --git a/dx/src/com/android/dx/io/DexBuffer.java b/dx/src/com/android/dx/io/DexBuffer.java
index 833f18d..e971ae6 100644
--- a/dx/src/com/android/dx/io/DexBuffer.java
+++ b/dx/src/com/android/dx/io/DexBuffer.java
@@ -16,9 +16,9 @@
 
 package com.android.dx.io;
 
-import com.android.dx.dex.DexException;
 import com.android.dx.dex.SizeOf;
 import com.android.dx.dex.TableOfContents;
+import com.android.dx.util.DexException;
 import com.android.dx.util.Leb128Utils;
 import com.android.dx.util.Mutf8;
 import java.io.ByteArrayOutputStream;
diff --git a/dx/src/com/android/dx/io/instructions/DecodedInstruction.java b/dx/src/com/android/dx/io/instructions/DecodedInstruction.java
index f9bdcf8..c526f87 100644
--- a/dx/src/com/android/dx/io/instructions/DecodedInstruction.java
+++ b/dx/src/com/android/dx/io/instructions/DecodedInstruction.java
@@ -16,10 +16,10 @@
 
 package com.android.dx.io.instructions;
 
-import com.android.dx.dex.DexException;
 import com.android.dx.io.IndexType;
 import com.android.dx.io.OpcodeInfo;
 import com.android.dx.io.Opcodes;
+import com.android.dx.util.DexException;
 import com.android.dx.util.Hex;
 
 import java.io.EOFException;
diff --git a/dx/src/com/android/dx/io/instructions/InstructionCodec.java b/dx/src/com/android/dx/io/instructions/InstructionCodec.java
index 2523f86..b178019 100644
--- a/dx/src/com/android/dx/io/instructions/InstructionCodec.java
+++ b/dx/src/com/android/dx/io/instructions/InstructionCodec.java
@@ -16,10 +16,10 @@
 
 package com.android.dx.io.instructions;
 
-import com.android.dx.dex.DexException;
 import com.android.dx.io.IndexType;
 import com.android.dx.io.OpcodeInfo;
 import com.android.dx.io.Opcodes;
+import com.android.dx.util.DexException;
 import com.android.dx.util.Hex;
 
 import java.io.EOFException;
diff --git a/dx/src/com/android/dx/merge/InstructionTransformer.java b/dx/src/com/android/dx/merge/InstructionTransformer.java
index 48d6642..339055b 100644
--- a/dx/src/com/android/dx/merge/InstructionTransformer.java
+++ b/dx/src/com/android/dx/merge/InstructionTransformer.java
@@ -16,11 +16,11 @@
 
 package com.android.dx.merge;
 
-import com.android.dx.dex.DexException;
 import com.android.dx.io.CodeReader;
 import com.android.dx.io.OpcodeInfo;
 import com.android.dx.io.instructions.DecodedInstruction;
 import com.android.dx.io.instructions.ShortArrayCodeOutput;
+import com.android.dx.util.DexException;
 
 final class InstructionTransformer {
     private final IndexMap indexMap;
diff --git a/dx/src/com/android/dx/dex/DexException.java b/dx/src/com/android/dx/util/DexException.java
similarity index 75%
rename from dx/src/com/android/dx/dex/DexException.java
rename to dx/src/com/android/dx/util/DexException.java
index 255d559..527b0b9 100644
--- a/dx/src/com/android/dx/dex/DexException.java
+++ b/dx/src/com/android/dx/util/DexException.java
@@ -14,18 +14,18 @@
  * limitations under the License.
  */
 
-package com.android.dx.dex;
-
-// TODO: Move this class to dx.util.
+package com.android.dx.util;
 
 /**
- * Thrown when there's a format problem reading or writing a dex file.
+ * Thrown when there's a format problem reading, writing, or generally
+ * processing a dex file.
  */
-public final class DexException extends RuntimeException {
+public final class DexException extends ExceptionWithContext {
     public DexException(String message) {
         super(message);
     }
-    public DexException(Exception cause) {
+
+    public DexException(Throwable cause) {
         super(cause);
     }
 }