Browse Source

Avoiding use of Error for clauses that indicat programming errors, using runtime exceptions instead.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@278322 13f79535-47bb-0310-9956-ffa450edef68
master
Jacobus Martinus Kruithof 20 years ago
parent
commit
3783d9744b
2 changed files with 7 additions and 6 deletions
  1. +3
    -2
      src/main/org/apache/tools/ant/types/Resource.java
  2. +4
    -4
      src/main/org/apache/tools/bzip2/CBZip2InputStream.java

+ 3
- 2
src/main/org/apache/tools/ant/types/Resource.java View File

@@ -201,8 +201,9 @@ public class Resource implements Cloneable, Comparable {
try { try {
return super.clone(); return super.clone();
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new Error("CloneNotSupportedException for a "
+ "Clonable Resource caught?");
throw new UnsupportedOperationException(
"CloneNotSupportedException for a Resource caught. "+
"Derived classes must support cloning.");
} }
} }




+ 4
- 4
src/main/org/apache/tools/bzip2/CBZip2InputStream.java View File

@@ -190,10 +190,10 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
return -1; return -1;


case START_BLOCK_STATE: case START_BLOCK_STATE:
throw new Error();
throw new IllegalStateException();


case RAND_PART_A_STATE: case RAND_PART_A_STATE:
throw new Error();
throw new IllegalStateException();


case RAND_PART_B_STATE: case RAND_PART_B_STATE:
setupRandPartB(); setupRandPartB();
@@ -204,7 +204,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
break; break;


case NO_RAND_PART_A_STATE: case NO_RAND_PART_A_STATE:
throw new Error();
throw new IllegalStateException();


case NO_RAND_PART_B_STATE: case NO_RAND_PART_B_STATE:
setupNoRandPartB(); setupNoRandPartB();
@@ -215,7 +215,7 @@ public class CBZip2InputStream extends InputStream implements BZip2Constants {
break; break;


default: default:
throw new Error();
throw new IllegalStateException();
} }


return retChar; return retChar;


Loading…
Cancel
Save