src/share/classes/java/io/FilePermission.java
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -29,14 +29,10 @@
import java.util.Enumeration;
import java.util.List;
import java.util.ArrayList;
import java.util.Vector;
import java.util.Collections;
-import java.io.ObjectStreamField;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
import sun.security.util.SecurityConstants;
/**
* This class represents access to a file or directory. A FilePermission consists
* of a pathname and a set of actions valid for that pathname.
@@ -422,13 +418,14 @@
}
/**
* Converts an actions String to an actions mask.
*
- * @param action the action string.
+ * @param actions the action string.
* @return the actions mask.
*/
+ @SuppressWarnings("fallthrough")
private static int getMask(String actions) {
int mask = NONE;
// Null action valid?
@@ -796,11 +793,11 @@
* container.
*
* @return an enumeration of all the FilePermission objects.
*/
- public Enumeration elements() {
+ public Enumeration<Permission> elements() {
// Convert Iterator into Enumeration
synchronized (this) {
return Collections.enumeration(perms);
}
}
@@ -841,19 +838,19 @@
}
/*
* Reads in a Vector of FilePermissions and saves them in the perms field.
*/
- @SuppressWarnings("unchecked")
private void readObject(ObjectInputStream in) throws IOException,
ClassNotFoundException {
// Don't call defaultReadObject()
// Read in serialized fields
ObjectInputStream.GetField gfields = in.readFields();
// Get the one we want
+ @SuppressWarnings("unchecked")
Vector<Permission> permissions = (Vector<Permission>)gfields.get("permissions", null);
perms = new ArrayList<>(permissions.size());
perms.addAll(permissions);
}
}