Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove redundant "throws SecurityException" clauses.

These were unchecked exceptions anyway, and now they can't even be thrown.

Bug: 2585285
Change-Id: Ifc8048262fe4b1699924241944beaa6a5bf09e0a
  • Loading branch information...
commit 2f2001f2f769c710ce7ee63412d3e2580388bf4d 1 parent 1c4b8eb
@enh enh authored
View
4 luni/src/main/java/java/io/ObjectInputStream.java
@@ -353,7 +353,7 @@ public abstract Object get(String name, Object defaultValue)
* @throws IOException
* if an error occurs when creating this stream.
*/
- protected ObjectInputStream() throws IOException, SecurityException {
+ protected ObjectInputStream() throws IOException {
super();
// WARNING - we should throw IOException if not called from a subclass
// according to the JavaDoc. Add the test.
@@ -487,7 +487,7 @@ public void defaultReadObject() throws IOException, ClassNotFoundException,
* @see #resolveObject
* @see ObjectOutputStream#enableReplaceObject
*/
- protected boolean enableResolveObject(boolean enable) throws SecurityException {
+ protected boolean enableResolveObject(boolean enable) {
boolean originalValue = enableResolve;
enableResolve = enable;
return originalValue;
View
4 luni/src/main/java/java/io/ObjectOutputStream.java
@@ -250,7 +250,7 @@
* @throws IOException
* if an error occurs when creating this stream.
*/
- protected ObjectOutputStream() throws IOException, SecurityException {
+ protected ObjectOutputStream() throws IOException {
super();
/*
* WARNING - we should throw IOException if not called from a subclass
@@ -451,7 +451,7 @@ private int dumpCycle(Object obj) throws IOException {
* @see #replaceObject
* @see ObjectInputStream#enableResolveObject
*/
- protected boolean enableReplaceObject(boolean enable) throws SecurityException {
+ protected boolean enableReplaceObject(boolean enable) {
boolean originalValue = enableReplace;
enableReplace = enable;
return originalValue;
View
32 luni/src/main/java/java/lang/Class.java
@@ -434,7 +434,7 @@ ClassLoader getClassLoaderImpl() {
* @see #getDeclaredConstructor(Class...)
*/
@SuppressWarnings("unchecked")
- public Constructor<T> getConstructor(Class<?>... parameterTypes) throws NoSuchMethodException, SecurityException {
+ public Constructor<T> getConstructor(Class<?>... parameterTypes) throws NoSuchMethodException {
return getMatchingConstructor(getDeclaredConstructors(this, true), parameterTypes);
}
@@ -448,7 +448,7 @@ ClassLoader getClassLoaderImpl() {
* this {@code Class}.
* @see #getDeclaredConstructors()
*/
- public Constructor<?>[] getConstructors() throws SecurityException {
+ public Constructor<?>[] getConstructors() {
return getDeclaredConstructors(this, true);
}
@@ -474,7 +474,7 @@ ClassLoader getClassLoaderImpl() {
* @return an array with {@code Class} objects for all the classes and
* interfaces that are used in member declarations.
*/
- public Class<?>[] getDeclaredClasses() throws SecurityException {
+ public Class<?>[] getDeclaredClasses() {
return getDeclaredClasses(this, false);
}
@@ -529,7 +529,7 @@ ClassLoader getClassLoaderImpl() {
*/
@SuppressWarnings("unchecked")
public Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes)
- throws NoSuchMethodException, SecurityException {
+ throws NoSuchMethodException {
return getMatchingConstructor(getDeclaredConstructors(this, false), parameterTypes);
}
@@ -543,7 +543,7 @@ ClassLoader getClassLoaderImpl() {
* by this {@code Class}.
* @see #getConstructors()
*/
- public Constructor<?>[] getDeclaredConstructors() throws SecurityException {
+ public Constructor<?>[] getDeclaredConstructors() {
return getDeclaredConstructors(this, false);
}
@@ -604,7 +604,7 @@ ClassLoader getClassLoaderImpl() {
* if the requested field can not be found.
* @see #getField(String)
*/
- public Field getDeclaredField(String name) throws NoSuchFieldException, SecurityException {
+ public Field getDeclaredField(String name) throws NoSuchFieldException {
Field[] fields = getClassCache().getDeclaredFields();
Field field = findFieldByName(fields, name);
@@ -625,7 +625,7 @@ public Field getDeclaredField(String name) throws NoSuchFieldException, Security
* this class.
* @see #getFields()
*/
- public Field[] getDeclaredFields() throws SecurityException {
+ public Field[] getDeclaredFields() {
// Return a copy of the private (to the package) array.
Field[] fields = getClassCache().getDeclaredFields();
return ClassCache.deepCopy(fields);
@@ -659,7 +659,7 @@ public Field getDeclaredField(String name) throws NoSuchFieldException, Security
* @see #getMethod(String, Class...)
*/
public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
- throws NoSuchMethodException, SecurityException {
+ throws NoSuchMethodException {
Method[] methods = getClassCache().getDeclaredMethods();
Method method = findMethodByName(methods, name, parameterTypes);
@@ -680,7 +680,7 @@ public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
* this {@code Class}.
* @see #getMethods()
*/
- public Method[] getDeclaredMethods() throws SecurityException {
+ public Method[] getDeclaredMethods() {
// Return a copy of the private (to the package) array.
Method[] methods = getClassCache().getDeclaredMethods();
return ClassCache.deepCopy(methods);
@@ -781,7 +781,7 @@ public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
* if the field can not be found.
* @see #getDeclaredField(String)
*/
- public Field getField(String name) throws NoSuchFieldException, SecurityException {
+ public Field getField(String name) throws NoSuchFieldException {
Field[] fields = getClassCache().getAllPublicFields();
Field field = findFieldByName(fields, name);
@@ -817,16 +817,15 @@ private Field findFieldByName(Field[] list, String name) throws NoSuchFieldExcep
* for the class C represented by this {@code Class}. Fields may be declared
* in C, the interfaces it implements or in the superclasses of C. The
* elements in the returned array are in no particular order.
- * <p>
- * If there are no public fields or if this class represents an array class,
+ *
+ * <p>If there are no public fields or if this class represents an array class,
* a primitive type or {@code void} then an empty array is returned.
- * </p>
*
* @return an array with the public fields of the class represented by this
* {@code Class}.
* @see #getDeclaredFields()
*/
- public Field[] getFields() throws SecurityException {
+ public Field[] getFields() {
// Return a copy of the private (to the package) array.
Field[] fields = getClassCache().getAllPublicFields();
return ClassCache.deepCopy(fields);
@@ -888,8 +887,7 @@ public Type getGenericSuperclass() {
* if the method can not be found.
* @see #getDeclaredMethod(String, Class...)
*/
- public Method getMethod(String name, Class<?>... parameterTypes) throws NoSuchMethodException,
- SecurityException {
+ public Method getMethod(String name, Class<?>... parameterTypes) throws NoSuchMethodException {
Method[] methods = getClassCache().getMethods();
Method method = findMethodByName(methods, name, parameterTypes);
@@ -914,7 +912,7 @@ public Method getMethod(String name, Class<?>... parameterTypes) throws NoSuchMe
* {@code Class}.
* @see #getDeclaredMethods()
*/
- public Method[] getMethods() throws SecurityException {
+ public Method[] getMethods() {
// Return a copy of the private (to the package) array.
Method[] methods = getClassCache().getMethods();
return ClassCache.deepCopy(methods);
View
17 luni/src/main/java/java/lang/reflect/AccessibleObject.java
@@ -52,11 +52,10 @@
* @see Field
* @see Constructor
* @see Method
- * @see ReflectPermission
*/
public class AccessibleObject implements AnnotatedElement {
- // If true, object is accessible, bypassing normal security checks
+ // If true, object is accessible, bypassing normal access checks
boolean flag = false;
/**
@@ -92,7 +91,7 @@
/**
* Attempts to set the value of the accessible flag for all the objects in
- * the array provided. Only one security check is performed. Setting this
+ * the array provided. Setting this
* flag to {@code false} will enable access checks, setting to {@code true}
* will disable them.
*
@@ -102,10 +101,8 @@
* the new value for the accessible flag
*
* @see #setAccessible(boolean)
- * @see ReflectPermission
*/
- public static void setAccessible(AccessibleObject[] objects, boolean flag)
- throws SecurityException {
+ public static void setAccessible(AccessibleObject[] objects, boolean flag) {
synchronized(AccessibleObject.class) {
for (int i = 0; i < objects.length; i++) {
objects[i].flag = flag;
@@ -123,10 +120,10 @@ protected AccessibleObject() {
}
/**
- * Indicates whether this object is accessible without security checks being
+ * Indicates whether this object is accessible without access checks being
* performed. Returns the accessible flag.
*
- * @return {@code true} if this object is accessible without security
+ * @return {@code true} if this object is accessible without access
* checks, {@code false} otherwise
*/
public boolean isAccessible() {
@@ -140,10 +137,8 @@ public boolean isAccessible() {
*
* @param flag
* the new value for the accessible flag
- *
- * @see ReflectPermission
*/
- public void setAccessible(boolean flag) throws SecurityException {
+ public void setAccessible(boolean flag) {
this.flag = flag;
}
View
3  luni/src/main/java/java/util/logging/Handler.java
@@ -286,8 +286,7 @@ void internalSetEncoding(String newEncoding) throws UnsupportedEncodingException
* @throws UnsupportedEncodingException
* if the specified encoding is not supported by the runtime.
*/
- public void setEncoding(String encoding) throws SecurityException,
- UnsupportedEncodingException {
+ public void setEncoding(String encoding) throws UnsupportedEncodingException {
LogManager.getLogManager().checkAccess();
internalSetEncoding(encoding);
}
View
3  luni/src/main/java/java/util/logging/StreamHandler.java
@@ -186,8 +186,7 @@ protected void setOutputStream(OutputStream os) {
* if the specified encoding is not supported by the runtime.
*/
@Override
- public void setEncoding(String encoding) throws SecurityException,
- UnsupportedEncodingException {
+ public void setEncoding(String encoding) throws UnsupportedEncodingException {
// flush first before set new encoding
this.flush();
super.setEncoding(encoding);
Please sign in to comment.
Something went wrong with that request. Please try again.