You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2009/10/06 16:57:51 UTC
svn commit: r822302 [4/5] - in /harmony/enhanced/classlib/branches/java6: ./
depends/build/ depends/build/platform/ depends/files/
depends/libs/windows.x86/ depends/oss/ make/ modules/accessibility/
modules/annotation/ modules/annotation/make/ modules/...
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/AbstractPreferences.java Tue Oct 6 14:57:42 2009
@@ -38,25 +38,24 @@
* Preferences, which can be used to simplify {@code Preferences} provider's
* implementation. This class defines nine abstract SPI methods, which must be
* implemented by a preference provider.
- *
+ *
* @since 1.4
* @see Preferences
*/
public abstract class AbstractPreferences extends Preferences {
/*
- * -----------------------------------------------------------
- * Class fields
+ * ----------------------------------------------------------- Class fields
* -----------------------------------------------------------
*/
/** the unhandled events collection */
private static final List<EventObject> events = new LinkedList<EventObject>();
/** the event dispatcher thread */
- private static final EventDispatcher dispatcher = new EventDispatcher("Preference Event Dispatcher"); //$NON-NLS-1$
+ private static final EventDispatcher dispatcher = new EventDispatcher(
+ "Preference Event Dispatcher"); //$NON-NLS-1$
/*
- * -----------------------------------------------------------
- * Class initializer
- * -----------------------------------------------------------
+ * ----------------------------------------------------------- Class
+ * initializer -----------------------------------------------------------
*/
static {
dispatcher.setDaemon(true);
@@ -79,28 +78,29 @@
}
});
}
-
+
/*
- * -----------------------------------------------------------
- * Instance fields (package-private)
+ * ----------------------------------------------------------- Instance
+ * fields (package-private)
* -----------------------------------------------------------
*/
/** true if this node is in user preference hierarchy */
boolean userNode;
/*
- * -----------------------------------------------------------
- * Instance fields (private)
+ * ----------------------------------------------------------- Instance
+ * fields (private)
* -----------------------------------------------------------
*/
/** Marker class for 'lock' field. */
- private static class Lock {}
+ private static class Lock {
+ }
/**
* The object used to lock this node.
*/
protected final Object lock;
-
+
/**
* This field is true if this node is created while it doesn't exist in the
* backing store. This field's default value is false, and it is checked
@@ -112,31 +112,30 @@
/** cached child nodes */
private Map<String, AbstractPreferences> cachedNode;
- //the collections of listeners
+ // the collections of listeners
private List<EventListener> nodeChangeListeners;
private List<EventListener> preferenceChangeListeners;
- //this node's name
+ // this node's name
private String nodeName;
- //handler to this node's parent
+ // handler to this node's parent
private AbstractPreferences parentPref;
- //true if this node has been removed
+ // true if this node has been removed
private boolean isRemoved;
- //handler to this node's root node
+ // handler to this node's root node
private AbstractPreferences root;
/*
- * -----------------------------------------------------------
- * Constructors
+ * ----------------------------------------------------------- Constructors
* -----------------------------------------------------------
*/
/**
* Constructs a new {@code AbstractPreferences} instance using the given
* parent node and node name.
- *
+ *
* @param parent
* the parent node of the new node or {@code null} to indicate
* that the new node is a root node.
@@ -163,8 +162,7 @@
}
/*
- * -----------------------------------------------------------
- * Methods
+ * ----------------------------------------------------------- Methods
* -----------------------------------------------------------
*/
/**
@@ -173,7 +171,8 @@
* @return the array of cached child nodes.
*/
protected final AbstractPreferences[] cachedChildren() {
- return cachedNode.values().toArray(new AbstractPreferences[cachedNode.size()]);
+ return cachedNode.values().toArray(
+ new AbstractPreferences[cachedNode.size()]);
}
/**
@@ -211,7 +210,7 @@
/**
* Returns whether this node has been removed by invoking the method {@code
* removeNode()}.
- *
+ *
* @return {@code true}, if this node has been removed, {@code false}
* otherwise.
*/
@@ -224,20 +223,20 @@
/**
* Flushes changes of this node to the backing store. This method should
* only flush this node and should not include the descendant nodes. Any
- * implementation that wants to provide functionality to flush all nodes
- * at once should override the method {@link #flush() flush()}.
- *
+ * implementation that wants to provide functionality to flush all nodes at
+ * once should override the method {@link #flush() flush()}.
+ *
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
*/
protected abstract void flushSpi() throws BackingStoreException;
-
+
/**
* Returns the names of all of the child nodes of this node or an empty
* array if this node has no children. The names of cached children are not
* required to be returned.
- *
+ *
* @return the names of this node's children.
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
@@ -246,12 +245,11 @@
protected abstract String[] childrenNamesSpi() throws BackingStoreException;
/**
- * Returns the child preference node with the given name, creating it
- * if it does not exist. The caller of this method should ensure that the
- * given name is valid and that this node has not been removed or cached.
- * If the named node has just been removed, the implementation
- * of this method must create a new one instead of reactivating the removed
- * one.
+ * Returns the child preference node with the given name, creating it if it
+ * does not exist. The caller of this method should ensure that the given
+ * name is valid and that this node has not been removed or cached. If the
+ * named node has just been removed, the implementation of this method must
+ * create a new one instead of reactivating the removed one.
* <p>
* The new creation is not required to be persisted immediately until the
* flush method will be invoked.
@@ -263,12 +261,11 @@
*/
protected abstract AbstractPreferences childSpi(String name);
-
/**
* Puts the given key-value pair into this node. Caller of this method
- * should ensure that both of the given values are valid and that this
- * node has not been removed.
- *
+ * should ensure that both of the given values are valid and that this node
+ * has not been removed.
+ *
* @param name
* the given preference key.
* @param value
@@ -282,19 +279,18 @@
* not been removed. This method should not throw any exceptions but if it
* does, the caller will ignore the exception, regarding it as a {@code
* null} return value.
- *
+ *
* @param key
* the given key to be searched for.
* @return the preference value mapped to the given key.
*/
protected abstract String getSpi(String key);
-
/**
* Returns an array of all preference keys of this node or an empty array if
* no preferences have been found. The caller of this method should ensure
* that this node has not been removed.
- *
+ *
* @return the array of all preference keys.
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
@@ -308,7 +304,7 @@
* method {@link Preferences#removeNode() Preferences.removeNode()} should
* invoke this method multiple-times in bottom-up pattern. The removal is
* not required to be persisted until after it is flushed.
- *
+ *
* @throws BackingStoreException
* if the backing store is unavailable or causes an operation
* failure.
@@ -338,8 +334,8 @@
protected abstract void syncSpi() throws BackingStoreException;
/*
- * -----------------------------------------------------------
- * Methods inherited from Preferences
+ * ----------------------------------------------------------- Methods
+ * inherited from Preferences
* -----------------------------------------------------------
*/
@Override
@@ -378,9 +374,9 @@
@Override
public void exportNode(OutputStream ostream) throws IOException,
BackingStoreException {
- if(ostream == null) {
+ if (ostream == null) {
// prefs.5=Stream is null
- throw new NullPointerException(Messages.getString("prefs.5")); //$NON-NLS-1$
+ throw new NullPointerException(Messages.getString("prefs.5")); //$NON-NLS-1$
}
checkState();
XMLParser.exportPrefs(this, ostream, false);
@@ -390,9 +386,9 @@
@Override
public void exportSubtree(OutputStream ostream) throws IOException,
BackingStoreException {
- if(ostream == null) {
+ if (ostream == null) {
// prefs.5=Stream is null
- throw new NullPointerException(Messages.getString("prefs.5")); //$NON-NLS-1$
+ throw new NullPointerException(Messages.getString("prefs.5")); //$NON-NLS-1$
}
checkState();
XMLParser.exportPrefs(this, ostream, true);
@@ -448,7 +444,7 @@
if (svalue == null) {
return deflt;
}
- if (svalue.length() == 0) {
+ if (svalue.length() == 0) {
return new byte[0];
}
try {
@@ -560,34 +556,34 @@
private void validateName(String name) {
if (name.endsWith("/") && name.length() > 1) { //$NON-NLS-1$
- // prefs.6=Name cannot end with '/'\!
+ // prefs.6=Name cannot end with '/'
throw new IllegalArgumentException(Messages.getString("prefs.6")); //$NON-NLS-1$
}
if (name.indexOf("//") >= 0) { //$NON-NLS-1$
- // prefs.7=Name cannot contains consecutive '/'\!
+ // prefs.7=Name cannot contains consecutive '/'
throw new IllegalArgumentException(Messages.getString("prefs.7")); //$NON-NLS-1$
}
}
private AbstractPreferences nodeImpl(String path, boolean createNew)
throws BackingStoreException {
+
String[] names = path.split("/");//$NON-NLS-1$
AbstractPreferences currentNode = this;
AbstractPreferences temp = null;
- if (null != currentNode) {
- for (int i = 0; i < names.length; i++) {
- String name = names[i];
- synchronized (currentNode.lock) {
- temp = currentNode.cachedNode.get(name);
- if (temp == null) {
- temp = getNodeFromBackend(createNew, currentNode, name);
- }
- }
- currentNode = temp;
- if (null == currentNode) {
- break;
+
+ for (int i = 0; i < names.length; i++) {
+ String name = names[i];
+ synchronized (currentNode.lock) {
+ temp = currentNode.cachedNode.get(name);
+ if (temp == null) {
+ temp = getNodeFromBackend(createNew, currentNode, name);
}
}
+ currentNode = temp;
+ if (null == currentNode) {
+ break;
+ }
}
return currentNode;
}
@@ -624,8 +620,8 @@
if ("".equals(name)) { //$NON-NLS-1$
return false;
}
- // prefs.9=This node has been removed\!
- throw new IllegalStateException(Messages.getString("prefs.9")); //$NON-NLS-1$
+ // prefs.9=This node has been removed
+ throw new IllegalStateException(Messages.getString("prefs.9")); //$NON-NLS-1$
}
validateName(name);
if ("".equals(name) || "/".equals(name)) { //$NON-NLS-1$ //$NON-NLS-2$
@@ -641,7 +637,7 @@
try {
Preferences result = startNode.nodeImpl(name, false);
return null == result ? false : true;
- } catch(IllegalArgumentException e) {
+ } catch (IllegalArgumentException e) {
return false;
}
}
@@ -654,8 +650,8 @@
private void checkState() {
if (isRemoved()) {
- // prefs.9=This node has been removed\!
- throw new IllegalStateException(Messages.getString("prefs.9")); //$NON-NLS-1$
+ // prefs.9=This node has been removed
+ throw new IllegalStateException(Messages.getString("prefs.9")); //$NON-NLS-1$
}
}
@@ -725,8 +721,9 @@
@Override
public void removeNode() throws BackingStoreException {
if (root == this) {
- // prefs.A=Cannot remove root node\!
- throw new UnsupportedOperationException(Messages.getString("prefs.A")); //$NON-NLS-1$
+ // prefs.A=Cannot remove root node
+ throw new UnsupportedOperationException(Messages
+ .getString("prefs.A")); //$NON-NLS-1$
}
synchronized (parentPref.lock) {
removeNodeImpl();
@@ -743,9 +740,10 @@
cachedNode.put(childrenNames[i], child);
}
}
-
+
final Collection<AbstractPreferences> values = cachedNode.values();
- final AbstractPreferences[] children = values.toArray(new AbstractPreferences[values.size()]);
+ final AbstractPreferences[] children = values
+ .toArray(new AbstractPreferences[values.size()]);
for (AbstractPreferences child : children) {
child.removeNodeImpl();
}
@@ -852,10 +850,10 @@
}
private static class EventDispatcher extends Thread {
- EventDispatcher(String name){
+ EventDispatcher(String name) {
super(name);
}
-
+
@Override
public void run() {
while (true) {
@@ -895,7 +893,8 @@
private void dispatchPrefChange(PreferenceChangeEvent event,
List<EventListener> preferenceChangeListeners) {
synchronized (preferenceChangeListeners) {
- Iterator<EventListener> i = preferenceChangeListeners.iterator();
+ Iterator<EventListener> i = preferenceChangeListeners
+ .iterator();
while (i.hasNext()) {
PreferenceChangeListener pcl = (PreferenceChangeListener) i
.next();
@@ -928,7 +927,7 @@
}
private static class NodeAddEvent extends NodeChangeEvent {
- //The base class is NOT serializable, so this class isn't either.
+ // The base class is NOT serializable, so this class isn't either.
private static final long serialVersionUID = 1L;
public NodeAddEvent(Preferences p, Preferences c) {
@@ -937,9 +936,9 @@
}
private static class NodeRemoveEvent extends NodeChangeEvent {
- //The base class is NOT serializable, so this class isn't either.
+ // The base class is NOT serializable, so this class isn't either.
private static final long serialVersionUID = 1L;
-
+
public NodeRemoveEvent(Preferences p, Preferences c) {
super(p, c);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/BackingStoreException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/BackingStoreException.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/BackingStoreException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/BackingStoreException.java Tue Oct 6 14:57:42 2009
@@ -20,7 +20,7 @@
/**
* An exception to indicate that an error was encountered while accessing the
* backing store.
- *
+ *
* @since 1.4
*/
public class BackingStoreException extends Exception {
@@ -34,18 +34,18 @@
* @param s
* the detailed exception message.
*/
- public BackingStoreException (String s) {
+ public BackingStoreException(String s) {
super(s);
}
/**
* Constructs a new {@code BackingStoreException} instance with a nested
* {@code Throwable}.
- *
+ *
* @param t
* the nested {@code Throwable}.
*/
- public BackingStoreException (Throwable t) {
+ public BackingStoreException(Throwable t) {
super(t);
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesFactoryImpl.java Tue Oct 6 14:57:42 2009
@@ -17,16 +17,17 @@
package java.util.prefs;
/**
- * The default implementation of <code>PreferencesFactory</code> for the Linux
+ * The default implementation of {@code PreferencesFactory} for the Linux
* platform, using the file system as its back end.
*
* @since 1.4
*/
class FilePreferencesFactoryImpl implements PreferencesFactory {
- // user root preferences
+
+ // user root preferences
private static final Preferences USER_ROOT = new FilePreferencesImpl(true);
- // system root preferences
+ // system root preferences
private static final Preferences SYSTEM_ROOT = new FilePreferencesImpl(false);
public FilePreferencesFactoryImpl() {
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/FilePreferencesImpl.java Tue Oct 6 14:57:42 2009
@@ -28,7 +28,7 @@
import org.apache.harmony.prefs.internal.nls.Messages;
/**
- * The default implementation of <code>AbstractPreferences</code> for the Linux
+ * The default implementation of {@code AbstractPreferences} for the Linux
* platform, using the file system as its back end.
*
* TODO some sync mechanism with backend, Performance - check file edit date
@@ -37,69 +37,47 @@
*/
class FilePreferencesImpl extends AbstractPreferences {
- /*
- * --------------------------------------------------------------
- * Class fields
- * --------------------------------------------------------------
- */
-
- //prefs file name
+ // prefs file name
private static final String PREFS_FILE_NAME = "prefs.xml"; //$NON-NLS-1$
- //home directory for user prefs
+ // home directory for user prefs
private static String USER_HOME;
- //home directory for system prefs
+ // home directory for system prefs
private static String SYSTEM_HOME;
- /*
- * --------------------------------------------------------------
- * Class initializer
- * --------------------------------------------------------------
- */
static {
AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @SuppressWarnings("nls")
public Void run() {
- USER_HOME = System.getProperty("user.home") + "/.java/.userPrefs";//$NON-NLS-1$ //$NON-NLS-2$
- SYSTEM_HOME = System.getProperty("java.home") + "/.systemPrefs";//$NON-NLS-1$//$NON-NLS-2$
+ USER_HOME = System.getProperty("user.home") + "/.java/.userPrefs";
+ SYSTEM_HOME = System.getProperty("java.home") + "/.systemPrefs";
return null;
}
});
}
- /*
- * --------------------------------------------------------------
- * Instance fields
- * --------------------------------------------------------------
- */
-
- //file path for this preferences node
+ // file path for this preferences node
private String path;
- //internal cache for prefs key-value pair
+ // internal cache for prefs key-value pair
private Properties prefs;
- //file represents this preferences node
+ // file represents this preferences node
private File prefsFile;
- //parent dir for this preferences node
+ // parent dir for this preferences node
private File dir;
- //cache for removed prefs key-value pair
+ // cache for removed prefs key-value pair
private Set<String> removed = new HashSet<String>();
- //cache for updated prefs key-value pair
+ // cache for updated prefs key-value pair
private Set<String> updated = new HashSet<String>();
- /*
- * --------------------------------------------------------------
- * Constructors
- * --------------------------------------------------------------
- */
-
/**
- * Construct root <code>FilePreferencesImpl</code> instance, construct
- * user root if userNode is true, system root otherwise
+ * Construct root {@code FilePreferencesImpl} instance, construct user
+ * root if userNode is true, system root otherwise
*/
FilePreferencesImpl(boolean userNode) {
super(null, ""); //$NON-NLS-1$
@@ -109,7 +87,7 @@
}
/**
- * Construct a prefs using given parent and given name
+ * Construct a prefs using given parent and given name
*/
private FilePreferencesImpl(AbstractPreferences parent, String name) {
super(parent, name);
@@ -120,10 +98,10 @@
private void initPrefs() {
dir = new File(path);
newNode = (AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
- public Boolean run() {
- return Boolean.valueOf(!dir.exists());
- }
- })).booleanValue();
+ public Boolean run() {
+ return Boolean.valueOf(!dir.exists());
+ }
+ })).booleanValue();
prefsFile = new File(path + File.separator + PREFS_FILE_NAME);
prefs = XMLParser.loadFilePrefs(prefsFile);
}
@@ -142,7 +120,7 @@
}
});
if (null == names) {// file is not a directory, exception case
- // prefs.3=Cannot get children names for {0}!
+ // prefs.3=Cannot get children names for {0}
throw new BackingStoreException(
Messages.getString("prefs.3", toString())); //$NON-NLS-1$
}
@@ -158,8 +136,8 @@
@Override
protected void flushSpi() throws BackingStoreException {
try {
- //if removed, return
- if(isRemoved()){
+ // if removed, return
+ if (isRemoved()) {
return;
}
// reload
@@ -218,7 +196,7 @@
}
})).booleanValue();
if (!removeSucceed) {
- // prefs.4=Cannot remove {0}!
+ // prefs.4=Cannot remove {0}
throw new BackingStoreException(Messages.getString("prefs.4", toString())); //$NON-NLS-1$
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/InvalidPreferencesFormatException.java Tue Oct 6 14:57:42 2009
@@ -33,7 +33,7 @@
* @param s
* the detailed exception message.
*/
- public InvalidPreferencesFormatException (String s) {
+ public InvalidPreferencesFormatException(String s) {
super(s);
}
@@ -46,18 +46,18 @@
* @param t
* the nested {@code Throwable}.
*/
- public InvalidPreferencesFormatException (String s, Throwable t) {
- super(s,t);
+ public InvalidPreferencesFormatException(String s, Throwable t) {
+ super(s, t);
}
/**
* Constructs a new {@code InvalidPreferencesFormatException} instance with
* a nested {@code Throwable}.
- *
+ *
* @param t
* the nested {@code Throwable}.
*/
- public InvalidPreferencesFormatException (Throwable t) {
+ public InvalidPreferencesFormatException(Throwable t) {
super(t);
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeEvent.java Tue Oct 6 14:57:42 2009
@@ -16,19 +16,19 @@
package java.util.prefs;
-import java.io.Serializable;
-import java.util.EventObject;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.NotSerializableException;
import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.EventObject;
/**
* This is the event class to indicate that one child of the preference node has
* been added or deleted.
* <p>
- * Please note that the serialization functionality has not yet been
- * implemented, so the serialization methods do nothing but throw a {@code
+ * Please note that although the class is marked as {@code Serializable} by
+ * inheritance from {@code EventObject}, this type is not intended to be
+ * serialized so the serialization methods do nothing but throw a {@code
* NotSerializableException}.
*
* @see java.util.prefs.Preferences
@@ -36,7 +36,7 @@
*
* @since 1.4
*/
-public class NodeChangeEvent extends EventObject implements Serializable {
+public class NodeChangeEvent extends EventObject {
private static final long serialVersionUID = 8068949086596572957L;
@@ -47,12 +47,13 @@
* Constructs a new {@code NodeChangeEvent} instance.
*
* @param p
- * the {@code Preferences} instance that fired this event; this object is
- * considered as the event source.
+ * the {@code Preferences} instance that fired this event; this
+ * object is considered as the event source.
* @param c
- * the child {@code Preferences} instance that was added or deleted.
+ * the child {@code Preferences} instance that was added or
+ * deleted.
*/
- public NodeChangeEvent (Preferences p, Preferences c) {
+ public NodeChangeEvent(Preferences p, Preferences c) {
super(p);
parent = p;
child = c;
@@ -77,18 +78,19 @@
}
/**
- * This method always throws a <code>NotSerializableException</code>,
- * because this object cannot be serialized,
+ * This method always throws a {@code NotSerializableException}, because
+ * this object cannot be serialized,
*/
- private void writeObject (ObjectOutputStream out) throws IOException {
+ private void writeObject(ObjectOutputStream out) throws IOException {
throw new NotSerializableException();
}
/**
- * This method always throws a <code>NotSerializableException</code>,
- * because this object cannot be serialized,
+ * This method always throws a {@code NotSerializableException}, because
+ * this object cannot be serialized,
*/
- private void readObject (ObjectInputStream in) throws IOException, ClassNotFoundException {
+ private void readObject(ObjectInputStream in) throws IOException,
+ ClassNotFoundException {
throw new NotSerializableException();
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeListener.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeListener.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeListener.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/NodeChangeListener.java Tue Oct 6 14:57:42 2009
@@ -36,7 +36,7 @@
* @param e
* the node change event.
*/
- public void childAdded (NodeChangeEvent e);
+ public void childAdded(NodeChangeEvent e);
/**
* This method gets called whenever a child node is removed from another
@@ -45,5 +45,5 @@
* @param e
* the node change event.
*/
- public void childRemoved (NodeChangeEvent e);
+ public void childRemoved(NodeChangeEvent e);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeEvent.java Tue Oct 6 14:57:42 2009
@@ -4,9 +4,9 @@
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +20,6 @@
import java.io.NotSerializableException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
-import java.io.Serializable;
import java.util.EventObject;
/**
@@ -30,10 +29,10 @@
* Please note that although the class is marked as {@code Serializable} by
* inheritance from {@code EventObject}, this type is not intended to be serialized
* so the serialization methods do nothing but throw a {@code NotSerializableException}.
- *
+ *
* @see java.util.prefs.Preferences
* @see java.util.prefs.PreferenceChangeListener
- *
+ *
* @since 1.4
*/
public class PreferenceChangeEvent extends EventObject {
@@ -48,7 +47,7 @@
/**
* Construct a new {@code PreferenceChangeEvent} instance.
- *
+ *
* @param p
* the {@code Preferences} instance that fired this event; this object is
* considered as the event's source.
@@ -67,7 +66,7 @@
/**
* Gets the key of the changed preference.
- *
+ *
* @return the changed preference's key.
*/
public String getKey() {
@@ -77,7 +76,7 @@
/**
* Gets the new value of the changed preference or {@code null} if the
* preference has been removed.
- *
+ *
* @return the new value of the changed preference or {@code null} if the
* preference has been removed.
*/
@@ -87,7 +86,7 @@
/**
* Gets the {@code Preferences} instance that fired this event.
- *
+ *
* @return the {@code Preferences} instance that fired this event.
*/
public Preferences getNode() {
@@ -95,7 +94,7 @@
}
/**
- * This method always throws a <code>NotSerializableException</code>,
+ * This method always throws a {@code NotSerializableException},
* because this object cannot be serialized,
*/
private void writeObject(ObjectOutputStream out) throws IOException {
@@ -103,7 +102,7 @@
}
/**
- * This method always throws a <code>NotSerializableException</code>,
+ * This method always throws a {@code NotSerializableException},
* because this object cannot be serialized,
*/
private void readObject(ObjectInputStream in) throws IOException{
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferenceChangeListener.java Tue Oct 6 14:57:42 2009
@@ -25,7 +25,7 @@
*
* @see Preferences
* @see PreferenceChangeEvent
- *
+ *
*
* @since 1.4
*/
@@ -36,8 +36,8 @@
* updated.
*
* @param pce
- * the event instance which describes the changed {@code Preferences}
- * instance and the preference value.
+ * the event instance which describes the changed {@code
+ * Preferences} instance and the preference value.
*/
- void preferenceChange (PreferenceChangeEvent pce);
+ void preferenceChange(PreferenceChangeEvent pce);
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/Preferences.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/Preferences.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/Preferences.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/Preferences.java Tue Oct 6 14:57:42 2009
@@ -35,12 +35,12 @@
* in an implementation-dependent back-end.
* <p>
* Every node has one name and one unique absolute path following the same
- * notational conventions as directories in a file system. The root node's
- * name is "", and other node name strings cannot contain the slash character
- * and cannot be empty. The root node's absolute path is "/", and all other
- * nodes' absolute paths are constructed in the standard way: <parent's
- * absolute path> + "/" + <node's name>. Since the set of nodes forms a
- * tree with the root node at its base, all absolute paths start with the slash
+ * notational conventions as directories in a file system. The root node's name
+ * is "", and other node name strings cannot contain the slash character and
+ * cannot be empty. The root node's absolute path is "/", and all other nodes'
+ * absolute paths are constructed in the standard way: <parent's absolute
+ * path> + "/" + <node's name>. Since the set of nodes forms a tree
+ * with the root node at its base, all absolute paths start with the slash
* character. Every node has one relative path to each of its ancestors. The
* relative path doesn't start with slash: it equals the node's absolute path
* with leading substring removed corresponding to the ancestor's absolute path
@@ -50,38 +50,41 @@
* preference update method calls may return immediately instead of blocking.
* The {@code flush()} and {@code sync()} methods force the back-end to
* synchronously perform all pending updates, but the implementation is
- * permitted to perform the modifications on the underlying back-end data
- * at any time between the moment the request is made and the moment the
- * {@code flush()} or {@code sync()} method returns.
- * Please note that if JVM exit normally, the implementation must assure all
- * modifications are persisted implicitly.
+ * permitted to perform the modifications on the underlying back-end data at any
+ * time between the moment the request is made and the moment the {@code
+ * flush()} or {@code sync()} method returns. Please note that if the JVM exits
+ * normally, the implementation must assure all modifications are persisted
+ * implicitly.
* <p>
- * When invoking a method that retrieves preferences, the user must provide
- * a default value. The default value is returned when the preferences cannot
- * be found or the back-end is unavailable. Some other methods will throw
- * {@code BackingStoreException} when the back-end is unavailable.
+ * When invoking a method that retrieves preferences, the user must provide a
+ * default value. The default value is returned when the preferences cannot be
+ * found or the back-end is unavailable. Some other methods will throw {@code
+ * BackingStoreException} when the back-end is unavailable.
* </p>
* <p>
* Preferences can be exported to and imported from an XML files. These
* documents must have an XML DOCTYPE declaration:
- * <pre>{@code
- * <!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">
- * }</pre>
- * This system URI is not really accessed by network, it is only a
- * identification string. Visit the DTD location to see the actual format
- * permitted.
+ *
+ * <pre>
+ * @code
+ * <!DOCTYPE preferences SYSTEM "http://java.sun.com/dtd/preferences.dtd">
+ * }
+ * </pre>
+ *
+ * This system URI is not accessed, it is only a identification string for
+ * verifying parsers. Visit the DTD location to see the actual format permitted.
* <p>
* There must be a concrete {@code PreferencesFactory} type for every concrete
- * {@code Preferences} type developed. Every J2SE implementation must provide a
+ * {@code Preferences} type developed. Every implementation must provide a
* default implementation for every supported platform, and must also provide a
* means of replacing the default implementation. This implementation uses the
- * system property {@code java.util.prefs.PreferencesFactory} to detemine which
+ * system property {@code java.util.prefs.PreferencesFactory} to determine which
* preferences implementation to use.
* <p>
* The methods of this class are thread-safe. If multiple JVMs are using the
* same back-end concurrently, the back-end won't be corrupted, but no other
* behavior guarantees are made.
- *
+ *
* @see PreferencesFactory
*
* @since 1.4
@@ -102,10 +105,10 @@
*/
public static final int MAX_VALUE_LENGTH = 8192;
- //permission
+ // permission
private static final RuntimePermission PREFS_PERM = new RuntimePermission("preferences"); //$NON-NLS-1$
- //factory used to get user/system prefs root
+ // factory used to get user/system prefs root
private static final PreferencesFactory factory;
// default provider factory name for Windows
@@ -132,7 +135,7 @@
// only comparing ASCII, so assume english locale
osName = (osName == null ? null : osName.toLowerCase(Locale.ENGLISH));
- if (osName != null && osName.startsWith("windows")) {
+ if (osName != null && osName.startsWith("windows")) { //$NON-NLS-1$
factoryClassName = DEFAULT_FACTORY_NAME_WIN;
} else {
factoryClassName = DEFAULT_FACTORY_NAME_UNIX;
@@ -477,10 +480,11 @@
* if {@code RuntimePermission("preferences")} is denied by a
* SecurityManager.
*/
- public static void importPreferences (InputStream istream) throws InvalidPreferencesFormatException, IOException {
+ public static void importPreferences(InputStream istream)
+ throws InvalidPreferencesFormatException, IOException {
checkSecurity();
- if(null == istream){
- // prefs.0=Inputstream cannot be null\!
+ if (null == istream) {
+ // prefs.0=Input stream cannot be null
throw new MalformedURLException(Messages.getString("prefs.0")); //$NON-NLS-1$
}
XMLParser.importPrefs(istream);
@@ -859,13 +863,12 @@
return factory.systemRoot();
}
- //check the RuntimePermission("preferences")
+ // check the RuntimePermission("preferences")
private static void checkSecurity() {
SecurityManager manager = System.getSecurityManager();
- if(null != manager){
+ if (null != manager) {
manager.checkPermission(PREFS_PERM);
}
-
}
/**
@@ -888,18 +891,18 @@
* if the {@code RuntimePermission("preferences")} is denied by
* a SecurityManager.
*/
- public static Preferences userNodeForPackage (Class<?> c) {
+ public static Preferences userNodeForPackage(Class<?> c) {
checkSecurity();
return factory.userRoot().node(getNodeName(c));
}
- //parse node's absolute path from class instance
- private static String getNodeName(Class<?> c){
+ // parse node's absolute path from class instance
+ private static String getNodeName(Class<?> c) {
Package p = c.getPackage();
- if(null == p){
+ if (null == p) {
return "/<unnamed>"; //$NON-NLS-1$
}
- return "/"+p.getName().replace('.', '/'); //$NON-NLS-1$
+ return "/" + p.getName().replace('.', '/'); //$NON-NLS-1$
}
/**
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferencesFactory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferencesFactory.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferencesFactory.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/PreferencesFactory.java Tue Oct 6 14:57:42 2009
@@ -26,6 +26,7 @@
* @since 1.4
*/
public interface PreferencesFactory {
+
/**
* Returns the root node of the preferences hierarchy for the calling user
* context.
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesFactoryImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesFactoryImpl.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesFactoryImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesFactoryImpl.java Tue Oct 6 14:57:42 2009
@@ -20,17 +20,20 @@
import java.util.prefs.PreferencesFactory;
/**
- * Default implementation of <code>PreferencesFactory</code> for windows platform, using windows
- * Registry as back end.
+ * Default implementation of {@code PreferencesFactory} for windows
+ * platform, using windows Registry as back end.
*
* @since 1.4
*/
class RegistryPreferencesFactoryImpl implements PreferencesFactory {
+
// user root preferences
- private static final Preferences USER_ROOT = new RegistryPreferencesImpl(true);
+ private static final Preferences USER_ROOT = new RegistryPreferencesImpl(
+ true);
// system root preferences
- private static final Preferences SYSTEM_ROOT = new RegistryPreferencesImpl(false);
+ private static final Preferences SYSTEM_ROOT = new RegistryPreferencesImpl(
+ false);
public RegistryPreferencesFactoryImpl() {
super();
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/RegistryPreferencesImpl.java Tue Oct 6 14:57:42 2009
@@ -19,8 +19,8 @@
import org.apache.harmony.prefs.internal.nls.Messages;
/**
- * Default implementation of <code>AbstractPreferences</code> for windows platform, using windows
- * registry as back end.
+ * Default implementation of {@code AbstractPreferences} for windows
+ * platform, using windows registry as back end.
*
* @since 1.4
*/
@@ -30,13 +30,13 @@
System.loadLibrary("hyprefs"); //$NON-NLS-1$
}
- // registry path for root preferences
+ // Registry path for root preferences.
private static final String ROOT_PATH = "SOFTWARE\\JavaSoft\\Prefs"; //$NON-NLS-1$
- // index for returned error code
+ // Index for returned error code.
private static final int ERROR_CODE = 0;
- // error code for registry access
+ // Error code for registry access.
private static final int RETURN_SUCCESS = 0;
@SuppressWarnings("unused")
@@ -47,11 +47,12 @@
@SuppressWarnings("unused")
private static final int RETURN_UNKNOWN_ERROR = 3;
- // registry path for this preferences, default value is the root path
+ // Registry path for this preferences, default value is the root path
private byte[] path = ROOT_PATH.getBytes();
/**
- * Construct <code>RegistryPreferencesImpl</code> instance using given parent and given name
+ * Construct {@code RegistryPreferencesImpl} instance using given parent and
+ * given name
*/
public RegistryPreferencesImpl(AbstractPreferences parent, String name) {
super(parent, name);
@@ -60,8 +61,8 @@
}
/**
- * Construct root <code>RegistryPreferencesImpl</code> instance, construct user root if userNode
- * is true, system root otherwise
+ * Construct root {@code RegistryPreferencesImpl} instance, construct user
+ * root if userNode is true, system root otherwise
*/
public RegistryPreferencesImpl(boolean userNode) {
super(null, ""); //$NON-NLS-1$
@@ -73,7 +74,7 @@
int[] error = new int[1];
byte[][] names = getChildNames(path, userNode, error);
if (error[ERROR_CODE] != RETURN_SUCCESS) {
- // prefs.B=Enumerate child nodes error\!
+ // prefs.B=Enumerate child nodes error
throw new BackingStoreException(Messages.getString("prefs.B")); //$NON-NLS-1$
}
String[] result = new String[names.length];
@@ -88,9 +89,11 @@
int[] error = new int[1];
RegistryPreferencesImpl result = new RegistryPreferencesImpl(this, name);
// FIXME: is it right thing to set newNode here?
- result.newNode = getNode(path, encodeWindowsStr(name).getBytes(), result.userNode, error);
+ result.newNode = getNode(path, encodeWindowsStr(name).getBytes(),
+ result.userNode, error);
if (error[ERROR_CODE] == RETURN_ACCESS_DENIED) {
- throw new SecurityException();
+ // prefs.E=Access denied
+ throw new SecurityException(Messages.getString("prefs.E")); //$NON-NLS-1$
}
return result;
}
@@ -100,7 +103,7 @@
int[] error = new int[1];
flushPrefs(path, userNode, error);
if (error[ERROR_CODE] != RETURN_SUCCESS) {
- // prefs.C=Flush error\!
+ // prefs.C=Flush error
throw new BackingStoreException(Messages.getString("prefs.C")); //$NON-NLS-1$
}
}
@@ -108,7 +111,8 @@
@Override
protected String getSpi(String key) {
int[] error = new int[1];
- byte[] result = getValue(path, encodeWindowsStr(key).getBytes(), userNode, error);
+ byte[] result = getValue(path, encodeWindowsStr(key).getBytes(),
+ userNode, error);
if (error[ERROR_CODE] != RETURN_SUCCESS) {
return null;
}
@@ -120,7 +124,7 @@
int[] errorCode = new int[1];
byte[][] keys = keys(path, userNode, errorCode);
if (errorCode[ERROR_CODE] != RETURN_SUCCESS) {
- // prefs.D=Enumerate keys error\!
+ // prefs.D=Enumerate keys error
throw new BackingStoreException(Messages.getString("prefs.D")); //$NON-NLS-1$
}
String[] result = new String[keys.length];
@@ -133,9 +137,10 @@
@Override
protected void putSpi(String name, String value) {
int[] errorCode = new int[1];
- putValue(path, encodeWindowsStr(name).getBytes(), encodeWindowsStr(value).getBytes(), userNode, errorCode);
+ putValue(path, encodeWindowsStr(name).getBytes(), encodeWindowsStr(
+ value).getBytes(), userNode, errorCode);
if (errorCode[ERROR_CODE] == RETURN_ACCESS_DENIED) {
- // prefs.E=Access denied\!
+ // prefs.E=Access denied
throw new SecurityException(Messages.getString("prefs.E")); //$NON-NLS-1$
}
}
@@ -143,10 +148,10 @@
@Override
protected void removeNodeSpi() throws BackingStoreException {
int[] error = new int[1];
- removeNode(((RegistryPreferencesImpl) parent()).path, encodeWindowsStr(name()).getBytes(),
- userNode, error);
+ removeNode(((RegistryPreferencesImpl) parent()).path, encodeWindowsStr(
+ name()).getBytes(), userNode, error);
if (error[ERROR_CODE] != RETURN_SUCCESS) {
- // prefs.F=Remove node error\!
+ // prefs.F=Remove node error
throw new BackingStoreException(Messages.getString("prefs.F")); //$NON-NLS-1$
}
}
@@ -156,7 +161,7 @@
int[] errorCode = new int[1];
removeKey(path, encodeWindowsStr(key).getBytes(), userNode, errorCode);
if (errorCode[ERROR_CODE] == RETURN_ACCESS_DENIED) {
- // prefs.E=Access denied\!
+ // prefs.E=Access denied
throw new SecurityException(Messages.getString("prefs.E")); //$NON-NLS-1$
}
}
@@ -166,7 +171,7 @@
flushSpi();
}
- // handle the lower/upper case pitfall
+ // Handle the lower/upper case pitfall.
private static String encodeWindowsStr(String str) {
char[] chars = str.toCharArray();
StringBuilder buffer = new StringBuilder();
@@ -186,7 +191,7 @@
}
private static String decodeWindowsStr(String str) {
- StringBuilder buffer = new StringBuilder();
+ StringBuilder buffer = new StringBuilder(str.length());
char[] chars = str.toCharArray();
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
@@ -205,31 +210,27 @@
return buffer.toString();
}
- /*
- * --------------------------------------------------------------
- * Native method declarations
- * --------------------------------------------------------------
- */
+ private native byte[] getValue(byte[] registryPath, byte[] key,
+ boolean isUserNode, int[] errorCode);
- private native byte[] getValue(byte[] registryPath, byte[] key, boolean isUserNode,
- int[] errorCode);
+ private native void putValue(byte[] registryPath, byte[] key, byte[] value,
+ boolean isUserNode, int[] errorCode);
- private native void putValue(byte[] registryPath, byte[] key, byte[] value, boolean isUserNode,
- int[] errorCode);
+ private native void removeKey(byte[] registryPath, byte[] key,
+ boolean isUserNode, int[] errorCode);
- private native void removeKey(byte[] registryPath, byte[] key, boolean isUserNode,
+ private native byte[][] keys(byte[] registryPath, boolean isUserNode,
int[] errorCode);
- private native byte[][] keys(byte[] registryPath, boolean isUserNode, int[] errorCode);
+ private native void removeNode(byte[] registryPath, byte[] name,
+ boolean isUserNode, int[] errorCode);
- private native void removeNode(byte[] registryPath, byte[] name, boolean isUserNode,
- int[] errorCode);
-
- private native boolean getNode(byte[] registryPath, byte[] name, boolean isUserNode,
- int[] errorCode);
+ private native boolean getNode(byte[] registryPath, byte[] name,
+ boolean isUserNode, int[] errorCode);
- private native byte[][] getChildNames(byte[] registryPath, boolean isUserNode, int[] errorCode);
+ private native byte[][] getChildNames(byte[] registryPath,
+ boolean isUserNode, int[] errorCode);
- private native void flushPrefs(byte[] registryPath, boolean isUserNode, int[] errorCode)
- throws SecurityException;
+ private native void flushPrefs(byte[] registryPath, boolean isUserNode,
+ int[] errorCode) throws SecurityException;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/XMLParser.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/XMLParser.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/XMLParser.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/java/util/prefs/XMLParser.java Tue Oct 6 14:57:42 2009
@@ -66,16 +66,17 @@
/*
* Constant - the DTD string
*/
- static final String PREFS_DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" //$NON-NLS-1$
- + " <!ELEMENT preferences (root)>" //$NON-NLS-1$
- + " <!ATTLIST preferences EXTERNAL_XML_VERSION CDATA \"0.0\" >" //$NON-NLS-1$
- + " <!ELEMENT root (map, node*) >" //$NON-NLS-1$
- + " <!ATTLIST root type (system|user) #REQUIRED >" //$NON-NLS-1$
- + " <!ELEMENT node (map, node*) >" //$NON-NLS-1$
- + " <!ATTLIST node name CDATA #REQUIRED >" //$NON-NLS-1$
- + " <!ELEMENT map (entry*) >" //$NON-NLS-1$
- + " <!ELEMENT entry EMPTY >" //$NON-NLS-1$
- + " <!ATTLIST entry key CDATA #REQUIRED value CDATA #REQUIRED >"; //$NON-NLS-1$
+ @SuppressWarnings("nls")
+ static final String PREFS_DTD = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+ + " <!ELEMENT preferences (root)>"
+ + " <!ATTLIST preferences EXTERNAL_XML_VERSION CDATA \"0.0\" >"
+ + " <!ELEMENT root (map, node*) >"
+ + " <!ATTLIST root type (system|user) #REQUIRED >"
+ + " <!ELEMENT node (map, node*) >"
+ + " <!ATTLIST node name CDATA #REQUIRED >"
+ + " <!ELEMENT map (entry*) >"
+ + " <!ELEMENT entry EMPTY >"
+ + " <!ATTLIST entry key CDATA #REQUIRED value CDATA #REQUIRED >";
/*
* Constant - the specified header
@@ -93,14 +94,15 @@
private static final String[] EMPTY_SARRAY = new String[0];
/*
- * Constant - used by FilePreferencesImpl, which is default implementation of Linux platform
+ * Constant - used by FilePreferencesImpl, which is default implementation
+ * of Linux platform
*/
private static final String FILE_PREFS = "<!DOCTYPE map SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>"; //$NON-NLS-1$
/*
* Constant - specify the DTD version
*/
- private static final float XML_VERSION = 1.0f;
+ private static final float XML_VERSION = 1.0f;
/*
* DOM builder
@@ -108,7 +110,7 @@
private static final DocumentBuilder builder;
/*
- * specify the indent level
+ * specify the indent level
*/
private static int indent = -1;
@@ -125,7 +127,7 @@
}
builder.setEntityResolver(new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId)
- throws SAXException, IOException {
+ throws SAXException, IOException {
if (systemId.equals(PREFS_DTD_NAME)) {
InputSource result = new InputSource(new StringReader(
PREFS_DTD));
@@ -133,8 +135,7 @@
return result;
}
// prefs.1=Invalid DOCTYPE declaration: {0}
- throw new SAXException(
- Messages.getString("prefs.1", systemId)); //$NON-NLS-1$
+ throw new SAXException(Messages.getString("prefs.1", systemId)); //$NON-NLS-1$
}
});
builder.setErrorHandler(new ErrorHandler() {
@@ -155,43 +156,45 @@
private XMLParser() {// empty constructor
}
- /***************************************************************************
- * utilities for Preferences export
- **************************************************************************/
+ /*
+ * Utilities for Preferences export
+ */
+ @SuppressWarnings("nls")
static void exportPrefs(Preferences prefs, OutputStream stream,
boolean withSubTree) throws IOException, BackingStoreException {
indent = -1;
- BufferedWriter out = new BufferedWriter(new OutputStreamWriter(stream, "UTF-8")); //$NON-NLS-1$
+ BufferedWriter out = new BufferedWriter(new OutputStreamWriter(stream,
+ "UTF-8"));
out.write(HEADER);
out.newLine();
out.newLine();
out.write(DOCTYPE);
- out.write(" '"); //$NON-NLS-1$
+ out.write(" '");
out.write(PREFS_DTD_NAME);
- out.write("'>"); //$NON-NLS-1$
+ out.write("'>");
out.newLine();
out.newLine();
- flushStartTag(
- "preferences", new String[] { "EXTERNAL_XML_VERSION" }, new String[] { String.valueOf(XML_VERSION) }, out); //$NON-NLS-1$ //$NON-NLS-2$
- flushStartTag(
- "root", new String[] { "type" }, new String[] { prefs.isUserNode() ? "user" : "system" }, out); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- flushEmptyElement("map", out); //$NON-NLS-1$
+ flushStartTag("preferences", new String[] { "EXTERNAL_XML_VERSION" },
+ new String[] { String.valueOf(XML_VERSION) }, out);
+ flushStartTag("root", new String[] { "type" }, new String[] { prefs
+ .isUserNode() ? "user" : "system" }, out);
+ flushEmptyElement("map", out);
StringTokenizer ancestors = new StringTokenizer(prefs.absolutePath(),
- "/"); //$NON-NLS-1$
+ "/");
exportNode(ancestors, prefs, withSubTree, out);
- flushEndTag("root", out); //$NON-NLS-1$
- flushEndTag("preferences", out); //$NON-NLS-1$
+ flushEndTag("root", out);
+ flushEndTag("preferences", out);
out.flush();
out = null;
}
private static void exportNode(StringTokenizer ancestors,
Preferences prefs, boolean withSubTree, BufferedWriter out)
- throws IOException, BackingStoreException {
+ throws IOException, BackingStoreException {
if (ancestors.hasMoreTokens()) {
String name = ancestors.nextToken();
flushStartTag(
@@ -210,7 +213,7 @@
}
private static void exportSubTree(Preferences prefs, BufferedWriter out)
- throws BackingStoreException, IOException {
+ throws BackingStoreException, IOException {
String[] names = prefs.childrenNames();
if (names.length > 0) {
for (int i = 0; i < names.length; i++) {
@@ -225,7 +228,7 @@
}
private static void exportEntries(Preferences prefs, BufferedWriter out)
- throws BackingStoreException, IOException {
+ throws BackingStoreException, IOException {
String[] keys = prefs.keys();
String[] values = new String[keys.length];
for (int i = 0; i < keys.length; i++) {
@@ -251,7 +254,7 @@
}
private static void flushEndTag(String tagName, BufferedWriter out)
- throws IOException {
+ throws IOException {
flushIndent(indent--, out);
out.write("</"); //$NON-NLS-1$
out.write(tagName);
@@ -260,7 +263,7 @@
}
private static void flushEmptyElement(String tagName, BufferedWriter out)
- throws IOException {
+ throws IOException {
flushIndent(++indent, out);
out.write("<"); //$NON-NLS-1$
out.write(tagName);
@@ -292,7 +295,7 @@
}
private static void flushIndent(int ind, BufferedWriter out)
- throws IOException {
+ throws IOException {
for (int i = 0; i < ind; i++) {
out.write(" "); //$NON-NLS-1$
}
@@ -309,7 +312,7 @@
}
private static void flushStartTag(String tagName, BufferedWriter out)
- throws IOException {
+ throws IOException {
flushIndent(++indent, out);
out.write("<"); //$NON-NLS-1$
out.write(tagName);
@@ -345,11 +348,11 @@
return sb.toString();
}
- /***************************************************************************
- * utilities for Preferences import
- **************************************************************************/
+ /*
+ * Utilities for Preferences import
+ */
static void importPrefs(InputStream in) throws IOException,
- InvalidPreferencesFormatException {
+ InvalidPreferencesFormatException {
try {
// load XML document
Document doc = builder.parse(new InputSource(in));
@@ -359,14 +362,15 @@
preferences = doc.getDocumentElement();
String version = preferences.getAttribute("EXTERNAL_XML_VERSION"); //$NON-NLS-1$
if (version != null && Float.parseFloat(version) > XML_VERSION) {
- // prefs.2=This preferences exported version is not supported:{0}
- throw new InvalidPreferencesFormatException(
- Messages.getString("prefs.2", version)); //$NON-NLS-1$
+ // prefs.2=This preferences exported version is not
+ // supported:{0}
+ throw new InvalidPreferencesFormatException(Messages.getString(
+ "prefs.2", version)); //$NON-NLS-1$
}
// check preferences root's type
Element root = (Element) preferences
- .getElementsByTagName("root").item(0); //$NON-NLS-1$
+ .getElementsByTagName("root").item(0); //$NON-NLS-1$
Preferences prefsRoot = null;
String type = root.getAttribute("type"); //$NON-NLS-1$
if (type.equals("user")) { //$NON-NLS-1$
@@ -387,7 +391,7 @@
}
private static void loadNode(Preferences prefs, Element node)
- throws TransformerException {
+ throws TransformerException {
// load preferences
NodeList children = XPathAPI.selectNodeList(node, "node"); //$NON-NLS-1$
NodeList entries = XPathAPI.selectNodeList(node, "map/entry"); //$NON-NLS-1$
@@ -418,29 +422,32 @@
}
}
- /***************************************************************************
- * utilities for FilePreferencesImpl, which is default implementation of Linux platform
- **************************************************************************/
/**
- * load preferences from file, if cannot load, create a new one FIXME: need
- * lock or not?
+ * Load preferences from file, if cannot load, create a new one.
*
- * @param file the XML file to be read
- * @return Properties instance which indicates the preferences key-value pairs
+ * @param file
+ * the XML file to be read
+ * @return Properties instance which indicates the preferences key-value
+ * pairs
*/
+ //FIXME: need lock or not?
static Properties loadFilePrefs(final File file) {
- return AccessController.doPrivileged(new PrivilegedAction<Properties>() {
- public Properties run() {
- return loadFilePrefsImpl(file);
- }
- });
+ return AccessController
+ .doPrivileged(new PrivilegedAction<Properties>() {
+ public Properties run() {
+ return loadFilePrefsImpl(file);
+ }
+ });
}
static Properties loadFilePrefsImpl(final File file) {
Properties result = new Properties();
if (!file.exists()) {
file.getParentFile().mkdirs();
- } else if (file.canRead()) {
+ return result;
+ }
+
+ if (file.canRead()) {
InputStream in = null;
FileLock lock = null;
try {
@@ -474,13 +481,8 @@
return result;
}
- /**
- *
- * @param file
- * @param prefs
- * @throws PrivilegedActionException
- */
- static void flushFilePrefs(final File file, final Properties prefs) throws PrivilegedActionException {
+ static void flushFilePrefs(final File file, final Properties prefs)
+ throws PrivilegedActionException {
AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
public Object run() throws IOException {
flushFilePrefsImpl(file, prefs);
@@ -489,7 +491,8 @@
});
}
- static void flushFilePrefsImpl(File file, Properties prefs) throws IOException {
+ static void flushFilePrefsImpl(File file, Properties prefs)
+ throws IOException {
BufferedWriter out = null;
FileLock lock = null;
try {
@@ -504,7 +507,8 @@
if (prefs.size() == 0) {
exportEntries(EMPTY_SARRAY, EMPTY_SARRAY, out);
} else {
- String[] keys = prefs.keySet().toArray(new String[prefs.size()]);
+ String[] keys = prefs.keySet()
+ .toArray(new String[prefs.size()]);
int length = keys.length;
String[] values = new String[length];
for (int i = 0; i < length; i++) {
@@ -518,31 +522,34 @@
closeQuietly(out);
}
}
-
+
private static void releaseQuietly(FileLock lock) {
if (lock == null) {
return;
}
try {
lock.release();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
-
+
private static void closeQuietly(Writer out) {
if (out == null) {
return;
}
try {
out.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
-
+
private static void closeQuietly(InputStream in) {
if (in == null) {
return;
}
try {
in.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
}
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/java/org/apache/harmony/prefs/internal/nls/messages.properties Tue Oct 6 14:57:42 2009
@@ -14,20 +14,20 @@
# limitations under the License.
# messages for EN locale
-prefs.0=Inputstream cannot be null\!
+prefs.0=Input stream cannot be null
prefs.1=Invalid DOCTYPE declaration: {0}
prefs.10=Cannot initiate PreferencesFactory: {0}. Caused by {1}
prefs.2=This preferences exported version is not supported:{0}
prefs.3=Cannot get children names for {0}!
-prefs.4=Cannot remove {0}!
+prefs.4=Cannot remove {0}
prefs.5=Stream is null
-prefs.6=Name cannot end with '/'\!
-prefs.7=Name cannot contains consecutive '/'\!
+prefs.6=Name cannot end with '/'
+prefs.7=Name cannot contains consecutive '/'
prefs.8=Name length is too long: {0}
-prefs.9=This node has been removed\!
+prefs.9=This node has been removed
prefs.A=Cannot remove root node\!
-prefs.B=Enumerate child nodes error\!
-prefs.C=Flush error\!
-prefs.D=Enumerate keys error\!
-prefs.E=Access denied\!
+prefs.B=Enumerate child nodes error
+prefs.C=Flush error
+prefs.D=Enumerate keys error
+prefs.E=Access denied
prefs.F=Remove node error\!
Propchange: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/
('svn:ignore' removed)
Modified: harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/prefs/src/main/native/prefs/windows/makefile Tue Oct 6 14:57:42 2009
@@ -20,7 +20,7 @@
!include <$(HY_HDK)\build\make\defines.mak>
LIBBASE=hyprefs
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(DLLPATH)$(LIBBASE).dll
LIBNAME=$(LIBPATH)$(LIBBASE).lib
HYCFLAGS = $(HYCFLAGS) /I$(SHAREDSUB)
HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
Modified: harmony/enhanced/classlib/branches/java6/modules/print/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/build.xml Tue Oct 6 14:57:42 2009
@@ -88,14 +88,13 @@
<target name="build-native" depends="build-native-all" />
<target name="build-native-all" if="is.windows">
<make dir="src/main/native/print/${hy.os.family}" />
- <!-- Copy the built shared libs over to the jre/bin dir -->
- <copy todir="${hy.jdk}/jre/bin" preservelastmodified="true">
- <fileset dir="src/main/native/print/">
- <include name="*${shlib.suffix}*"/>
- <include name="*${progdb.suffix}*" if="is.windows" />
- <exclude name="*${manifest.suffix}"/>
- </fileset>
- </copy>
+ </target>
+
+ <target name="findbugs" depends="build-jar">
+ <run-findBugs
+ jarFile="${hy.jdk}/jre/lib/boot/print.jar"
+ excludeFilter="make/findbugs-exclude-filter.xml"
+ outputFile="${findBugs.report}/print.xml"/>
</target>
<target name="build-jar" depends="svn-info,class-patternset">
Propchange: harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/
('svn:ignore' removed)
Modified: harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile (original)
+++ harmony/enhanced/classlib/branches/java6/modules/print/src/main/native/print/windows/makefile Tue Oct 6 14:57:42 2009
@@ -16,7 +16,7 @@
!include <$(HY_HDK)\build\make\defines.mak>
LIBBASE=print
-DLLNAME=..\$(LIBBASE).dll
+DLLNAME=$(DLLPATH)$(LIBBASE).dll
LIBNAME=$(LIBPATH)$(LIBBASE).lib
HYLDFLAGS = $(HYLDFLAGS) -def:$(LIBBASE).def
Modified: harmony/enhanced/classlib/branches/java6/modules/regex/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/regex/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/regex/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/regex/build.xml Tue Oct 6 14:57:42 2009
@@ -81,6 +81,13 @@
</javac>
</target>
+ <target name="findbugs" depends="build-jar">
+ <run-findBugs
+ jarFile="${hy.jdk}/jre/lib/boot/regex.jar"
+ excludeFilter="make/findbugs-exclude-filter.xml"
+ outputFile="${findBugs.report}/regex.xml"/>
+ </target>
+
<target name="build-jar" depends="svn-info,class-patternset">
<jar destfile="${hy.jdk}/jre/lib/boot/regex.jar"
manifest="META-INF/MANIFEST.MF"
Modified: harmony/enhanced/classlib/branches/java6/modules/rmi/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/rmi/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/rmi/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/rmi/build.xml Tue Oct 6 14:57:42 2009
@@ -81,6 +81,13 @@
</javac>
</target>
+ <target name="findbugs" depends="build-jar">
+ <run-findBugs
+ jarFile="${hy.jdk}/jre/lib/boot/rmi.jar"
+ excludeFilter="make/findbugs-exclude-filter.xml"
+ outputFile="${findBugs.report}/rmi.xml"/>
+ </target>
+
<target name="build-jar" depends="svn-info,class-patternset">
<jar destfile="${hy.jdk}/jre/lib/boot/rmi.jar"
manifest="META-INF/MANIFEST.MF"
Modified: harmony/enhanced/classlib/branches/java6/modules/security/build.xml
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/build.xml?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/build.xml (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/build.xml Tue Oct 6 14:57:42 2009
@@ -50,19 +50,6 @@
<target name="build-native" depends="build-native-all" />
<target name="build-native-all" if="native.present" >
<make dir="src/main/native/security/${hy.os.family}" />
-
- <!-- Copy the built shared libs over to the jre/bin dir -->
- <copy todir="${hy.jdk}/jre/bin" overwrite="yes">
- <fileset dir="src/main/native/security">
- <include name="*${shlib.suffix}*"/>
- <include name="*${progdb.suffix}*" if="is.windows" />
- <exclude name="*${manifest.suffix}"/>
- </fileset>
- <!-- Copy link exports file on z/OS -->
- <fileset dir="src/main/native/security/${hy.os.family}">
- <include name="*${linklib.suffix}*" if="is.zos" />
- </fileset>
- </copy>
</target>
<target name="clean-java" depends="class-patternset">
@@ -111,6 +98,13 @@
</javac>
</target>
+ <target name="findbugs" depends="build-jar">
+ <run-findBugs
+ jarFile="${hy.jdk}/jre/lib/boot/security.jar"
+ excludeFilter="make/findbugs-exclude-filter.xml"
+ outputFile="${findBugs.report}/security.xml"/>
+ </target>
+
<target name="build-jar" depends="svn-info,class-patternset">
<jar destfile="${hy.jdk}/jre/lib/boot/security.jar"
manifest="META-INF/MANIFEST.MF"
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AlgorithmParameters.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AlgorithmParameters.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AlgorithmParameters.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AlgorithmParameters.java Tue Oct 6 14:57:42 2009
@@ -309,6 +309,7 @@
*
* @return a printable representation for this {@code AlgorithmParameters}.
*/
+ @Override
public final String toString() {
if (!initialized) {
return null;
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermission.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermission.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermission.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermission.java Tue Oct 6 14:57:42 2009
@@ -71,6 +71,7 @@
* AllPermission}, otherwise {@code false}.
* @see #hashCode
*/
+ @Override
public boolean equals(Object obj) {
return (obj instanceof AllPermission);
}
@@ -84,6 +85,7 @@
* @see Object#equals(Object)
* @see AllPermission#equals(Object)
*/
+ @Override
public int hashCode() {
return 1;
}
@@ -95,6 +97,7 @@
*
* @return the actions associated with this {@code AllPermission}.
*/
+ @Override
public String getActions() {
return ALL_ACTIONS;
}
@@ -107,6 +110,7 @@
* @param permission
* the permission to check.
*/
+ @Override
public boolean implies(Permission permission) {
return true;
}
@@ -117,6 +121,7 @@
*
* @return a new {@code PermissionCollection}.
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new AllPermissionCollection();
}
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermissionCollection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermissionCollection.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermissionCollection.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/AllPermissionCollection.java Tue Oct 6 14:57:42 2009
@@ -46,6 +46,7 @@
/**
* Adds an {@code AllPermission} to the collection.
*/
+ @Override
public void add(Permission permission) {
if (isReadOnly()) {
throw new SecurityException(Messages.getString("security.15")); //$NON-NLS-1$
@@ -60,6 +61,7 @@
/**
* Returns the enumeration of the collection.
*/
+ @Override
public Enumeration<Permission> elements() {
return new SingletonEnumeration<Permission>(all);
}
@@ -74,6 +76,7 @@
/**
* Constructor taking the single element.
+ * @param single the element
*/
public SingletonEnumeration(E single) {
element = single;
@@ -108,6 +111,7 @@
* @param permission
* the permission to check.
*/
+ @Override
public boolean implies(Permission permission) {
return all != null;
}
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermission.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermission.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermission.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermission.java Tue Oct 6 14:57:42 2009
@@ -104,6 +104,7 @@
* @return {@code true} if the specified object is equal to this {@code
* BasicPermission}, otherwise {@code false}.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -124,6 +125,7 @@
* @see Object#equals(Object)
* @see BasicPermission#equals(Object)
*/
+ @Override
public int hashCode() {
return getName().hashCode();
}
@@ -134,6 +136,7 @@
*
* @return an empty string.
*/
+ @Override
public String getActions() {
return ""; //$NON-NLS-1$
}
@@ -146,6 +149,7 @@
* @return {@code true} if the specified permission is implied by this
* permission, {@code false} otherwise.
*/
+ @Override
public boolean implies(Permission permission) {
if (permission != null && permission.getClass() == this.getClass()) {
String name = getName();
@@ -205,6 +209,7 @@
* @return an empty {@link PermissionCollection} for holding permissions.
* @see BasicPermissionCollection
*/
+ @Override
public PermissionCollection newPermissionCollection() {
return new BasicPermissionCollection();
}
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/BasicPermissionCollection.java Tue Oct 6 14:57:42 2009
@@ -62,6 +62,7 @@
*
* @see java.security.PermissionCollection#add(java.security.Permission)
*/
+ @Override
public void add(Permission permission) {
if (isReadOnly()) {
throw new SecurityException(Messages.getString("security.15")); //$NON-NLS-1$
@@ -98,6 +99,7 @@
/**
* Returns enumeration of contained elements.
*/
+ @Override
public Enumeration<Permission> elements() {
return Collections.enumeration(items.values());
}
@@ -111,6 +113,7 @@
* the permission to check.
* @see Permission
*/
+ @Override
public boolean implies(Permission permission) {
if (permission == null || permission.getClass() != permClass) {
return false;
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSigner.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSigner.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSigner.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSigner.java Tue Oct 6 14:57:42 2009
@@ -67,6 +67,7 @@
* @return {@code true} if the specified object is equal to this {@code
* CodeSigner}, otherwise {@code false}.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -110,6 +111,7 @@
* @see Object#equals(Object)
* @see CodeSigner#equals(Object)
*/
+ @Override
public int hashCode() {
if (hash == 0) {
hash = signerCertPath.hashCode()
@@ -125,6 +127,7 @@
*
* @return a printable representation for this {@code CodeSigner}.
*/
+ @Override
public String toString() {
// There is no any special reason for '256' here, it's taken abruptly
StringBuilder buf = new StringBuilder(256);
Modified: harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSource.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSource.java?rev=822302&r1=822301&r2=822302&view=diff
==============================================================================
--- harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSource.java (original)
+++ harmony/enhanced/classlib/branches/java6/modules/security/src/main/java/common/java/security/CodeSource.java Tue Oct 6 14:57:42 2009
@@ -118,6 +118,7 @@
* @return {@code true} if the specified object is equal to this {@code
* CodeSource}, otherwise {@code false}.
*/
+ @Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
@@ -313,6 +314,7 @@
* @see Object#equals(Object)
* @see CodeSource#equals(Object)
*/
+ @Override
public int hashCode() {
//
// hashCode() is undocumented there. Should we also use certs[i] to
@@ -539,6 +541,7 @@
*
* @return a printable representation for this {@code CodeSource}.
*/
+ @Override
public String toString() {
StringBuilder buf = new StringBuilder();
buf.append("CodeSource, url="); //$NON-NLS-1$