17819 nit roundup
authorStephen Talley <stephen.talley@oracle.com>
Thu, 03 Feb 2011 14:10:29 -0500
changeset 647 ddbb04508ea4
parent 646 e1e91f5b0cb1
child 648 05d2cd78123d
17819 nit roundup
usr/src/java/rad/org/opensolaris/os/rad/UnixTransport.java
usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXAFUnixConnector.java
usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXConnector.java
usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXSSHConnector.java
usr/src/java/util/org/opensolaris/os/uds/UDSocket.java
usr/src/java/util/org/opensolaris/os/vp/util/misc/DialogMessage.java
usr/src/java/util/org/opensolaris/os/vp/util/swing/FadablePanel.java
usr/src/java/util/org/opensolaris/os/vp/util/swing/GUIUtil.java
usr/src/java/util/org/opensolaris/os/vp/util/swing/WrappingText.java
usr/src/java/util/org/opensolaris/os/vp/util/swing/glass/BusyGlassPane.java
--- a/usr/src/java/rad/org/opensolaris/os/rad/UnixTransport.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/rad/org/opensolaris/os/rad/UnixTransport.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,36 +20,49 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.rad;
 
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import org.opensolaris.os.uds.UDSocket;
-import org.opensolaris.os.uds.UnixDomainSocket;
+import java.io.*;
+import org.opensolaris.os.uds.*;
 
-public class UnixTransport implements Transport
-{
+public class UnixTransport implements Transport {
+    //
+    // Instance data
+    //
+
     private UDSocket socket_;
 
+    //
+    // Constructors
+    //
+
     public UnixTransport(File path) throws IOException {
 	socket_ = UnixDomainSocket.connect(path);
     }
 
+    //
+    // Closeable methods
+    //
+
+    @Override
+    public void close() throws IOException {
+	socket_.close();
+    }
+
+    //
+    // Transport methods
+    //
+
+    @Override
     public InputStream getInputStream() {
 	return socket_.getInputStream();
     }
 
+    @Override
     public OutputStream getOutputStream() {
 	return socket_.getOutputStream();
     }
-
-    public void close() throws IOException {
-	socket_.close();
-    }
 }
--- a/usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXAFUnixConnector.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXAFUnixConnector.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,23 +20,28 @@
  */
 
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.rad.jmx;
 
-import java.io.File;
-import java.io.IOException;
+import java.io.*;
 import java.net.MalformedURLException;
 import java.util.Map;
 import javax.management.remote.JMXServiceURL;
-import org.opensolaris.os.rad.Transport;
-import org.opensolaris.os.rad.UnixTransport;
+import org.opensolaris.os.rad.*;
 
 class RadJMXAFUnixConnector extends RadJMXConnector {
+    //
+    // Private methods
+    //
 
     private File path_;
 
+    //
+    // Constructors
+    //
+
     RadJMXAFUnixConnector(JMXServiceURL url, Map<String, ?> env)
 	throws MalformedURLException {
 
@@ -47,6 +52,10 @@
 	    throw new MalformedURLException("Absolute path required");
     }
 
+    //
+    // RadJMXConnector methods
+    //
+
     @Override
     Transport getTransport(Map<String, ?> env) throws IOException {
 	return new UnixTransport(path_);
--- a/usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXConnector.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXConnector.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,36 +20,23 @@
  */
 
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.rad.jmx;
 
 import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import javax.management.ListenerNotFoundException;
-import javax.management.MBeanServerConnection;
-import javax.management.NotificationBroadcasterSupport;
-import javax.management.NotificationFilter;
-import javax.management.NotificationListener;
-import javax.management.remote.JMXConnectionNotification;
-import javax.management.remote.JMXConnector;
-import javax.management.remote.JMXServiceURL;
+import java.util.*;
+import java.util.logging.*;
+import javax.management.*;
+import javax.management.remote.*;
 import javax.security.auth.Subject;
 import org.opensolaris.os.rad.*;
 
-public abstract class RadJMXConnector implements JMXConnector
-{
-    static private final Logger log =
-	Logger.getLogger(RadJMXConnector.class.getName());
-    private static int connectorid_ = 0;
-
-    private static synchronized String makeConnectionId(JMXServiceURL url) {
-	return url.toString() + " rad " + connectorid_++;
-    }
+public abstract class RadJMXConnector implements JMXConnector {
+    //
+    // Enums
+    //
 
     public enum ClientState {
 	NONE,
@@ -58,6 +45,18 @@
 	CLOSED
     }
 
+    //
+    // Static data
+    //
+
+    static private final Logger log =
+	Logger.getLogger(RadJMXConnector.class.getName());
+    private static int connectorid_ = 0;
+
+    //
+    // Instance data
+    //
+
     private Map<String, ?> env_;
 
     private Client client_ = null;
@@ -68,26 +67,55 @@
     private int serial_;
     private String connectionid_;
 
+    //
+    // Constructors
+    //
+
     RadJMXConnector(JMXServiceURL url, Map<String, ?> env) {
 	env_ = env;
 	connectionid_ = makeConnectionId(url);
     }
 
-    private void checkState() throws IOException {
-	if (state_ == ClientState.CLOSED)
-	    throw new IOException("Connection is closed.");
-	if (state_ == ClientState.NONE)
-	    throw new IOException("Connection not established.");
-	if (state_ == ClientState.FAILED)
-	    throw new IOException("Connection is broken.");
+    //
+    // Closeable methods
+    //
+
+    @Override
+    synchronized public void close() throws IOException {
+	if (state_ == ClientState.NONE || state_ == ClientState.CLOSED)
+	    return;
+
+	log.fine("closing connection: " + connectionid_);
+	if (state_ != ClientState.FAILED) {
+	    client_.close();
+	    client_ = null;
+	    mbsc_ = null;
+	}
+	state_ = ClientState.CLOSED;
+
+	notify_.sendNotification(new JMXConnectionNotification(
+	    JMXConnectionNotification.CLOSED, this, connectionid_, ++serial_,
+	    null, null));
     }
 
+    //
+    // JMXConnector methods
+    //
+
+    @Override
+    public void addConnectionNotificationListener(NotificationListener listener,
+	NotificationFilter filter, Object handback) {
+
+	log.finer("adding notification listener:" + connectionid_);
+	notify_.addNotificationListener(listener, filter, handback);
+    }
+
+    @Override
     public void connect() throws IOException {
 	connect(env_);
     }
 
-    abstract Transport getTransport(Map<String, ?> env) throws IOException;
-
+    @Override
     synchronized public void connect(Map<String, ?> env) throws IOException {
 	switch (state_) {
 	case CONNECTED:
@@ -113,6 +141,13 @@
 	    serial_++, null, null));
     }
 
+    @Override
+    synchronized public String getConnectionId() throws IOException {
+	checkState();
+	return connectionid_;
+    }
+
+    @Override
     public synchronized MBeanServerConnection getMBeanServerConnection()
 	throws IOException {
 
@@ -123,6 +158,7 @@
 	return (mbsc_);
     }
 
+    @Override
     public MBeanServerConnection getMBeanServerConnection(
 	Subject delegationSubject) throws IOException {
 
@@ -133,22 +169,25 @@
 	throw new IOException("Subject delegation not supported");
     }
 
-    synchronized public void close() throws IOException {
-	if (state_ == ClientState.NONE || state_ == ClientState.CLOSED)
-	    return;
+    @Override
+    public void removeConnectionNotificationListener(
+	NotificationListener listener) throws ListenerNotFoundException {
+
+	log.finer("removing notification listener:" + connectionid_);
+	notify_.removeNotificationListener(listener);
+    }
 
-	log.fine("closing connection: " + connectionid_);
-	if (state_ != ClientState.FAILED) {
-	    client_.close();
-	    client_ = null;
-	    mbsc_ = null;
-	}
-	state_ = ClientState.CLOSED;
+    @Override
+    public void removeConnectionNotificationListener(NotificationListener l,
+	NotificationFilter f, Object handback) throws ListenerNotFoundException
+    {
+	log.finer("removing notification listener:" + connectionid_);
+	notify_.removeNotificationListener(l, f, handback);
+    }
 
-	notify_.sendNotification(new JMXConnectionNotification(
-	    JMXConnectionNotification.CLOSED, this, connectionid_, ++serial_,
-	    null, null));
-    }
+    //
+    // RadJMXConnector methods
+    //
 
     synchronized void fail(Exception ex) throws IOException {
 	if (state_ == ClientState.FAILED)
@@ -168,29 +207,26 @@
 	    null, null));
     }
 
-    public void addConnectionNotificationListener(NotificationListener listener,
-	NotificationFilter filter, Object handback) {
+    abstract Transport getTransport(Map<String, ?> env) throws IOException;
+
+    //
+    // Private methods
+    //
 
-	log.finer("adding notification listener:" + connectionid_);
-	notify_.addNotificationListener(listener, filter, handback);
+    private void checkState() throws IOException {
+	if (state_ == ClientState.CLOSED)
+	    throw new IOException("Connection is closed.");
+	if (state_ == ClientState.NONE)
+	    throw new IOException("Connection not established.");
+	if (state_ == ClientState.FAILED)
+	    throw new IOException("Connection is broken.");
     }
 
-    public void removeConnectionNotificationListener(
-	NotificationListener listener) throws ListenerNotFoundException {
-
-	log.finer("removing notification listener:" + connectionid_);
-	notify_.removeNotificationListener(listener);
-    }
+    //
+    // Static methods
+    //
 
-    public void removeConnectionNotificationListener(NotificationListener l,
-	NotificationFilter f, Object handback) throws ListenerNotFoundException
-    {
-	log.finer("removing notification listener:" + connectionid_);
-	notify_.removeNotificationListener(l, f, handback);
-    }
-
-    synchronized public String getConnectionId() throws IOException {
-	checkState();
-	return connectionid_;
+    private static synchronized String makeConnectionId(JMXServiceURL url) {
+	return url + " rad " + connectorid_++;
     }
 }
--- a/usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXSSHConnector.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/rad/org/opensolaris/os/rad/jmx/RadJMXSSHConnector.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.rad.jmx;
@@ -29,14 +29,21 @@
 import java.net.MalformedURLException;
 import java.util.Map;
 import javax.management.remote.JMXServiceURL;
-import org.opensolaris.os.rad.SSHTransport;
-import org.opensolaris.os.rad.Transport;
+import org.opensolaris.os.rad.*;
 
 class RadJMXSSHConnector extends RadJMXConnector {
 
+    //
+    // Instance data
+    //
+
     private String host_;
     private String user_;
 
+    //
+    // Constructors
+    //
+
     RadJMXSSHConnector(JMXServiceURL url, Map<String, ?> env)
 	throws MalformedURLException {
 
@@ -52,6 +59,10 @@
 	    path.substring(1);
     }
 
+    //
+    // RadJMXConnector methods
+    //
+
     @Override
     Transport getTransport(Map<String, ?> env) throws IOException {
 	return new SSHTransport(host_, user_);
--- a/usr/src/java/util/org/opensolaris/os/uds/UDSocket.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/util/org/opensolaris/os/uds/UDSocket.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.uds;
@@ -32,7 +31,7 @@
 /**
  * Represents a unix domain socket connection.
  */
-public class UDSocket
+public class UDSocket implements Closeable
 {
 	private boolean closed_ = false;    /* Protected by rwlock_ */
 	private boolean closeme_ = false;   /* Protected by sync(this) */
@@ -97,6 +96,7 @@
 	/**
 	 * Closes the socket.
 	 */
+	@Override
 	public void close() throws IOException
 	{
 		synchronized (this) {
--- a/usr/src/java/util/org/opensolaris/os/vp/util/misc/DialogMessage.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/util/org/opensolaris/os/vp/util/misc/DialogMessage.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.vp.util.misc;
@@ -48,11 +47,11 @@
      *		    the message text
      *
      * @param	    type
-     *		    JoptionPane.ERROR_MESSAGE,
-     *		    JoptionPane.INFORMATION_MESSAGE,
-     *		    JoptionPane.WARNING_MESSAGE,
-     *		    JoptionPane.QUESTION_MESSAGE, or
-     *		    JoptionPane.PLAIN_MESSAGE
+     *		    JOptionPane.ERROR_MESSAGE,
+     *		    JOptionPane.INFORMATION_MESSAGE,
+     *		    JOptionPane.WARNING_MESSAGE,
+     *		    JOptionPane.QUESTION_MESSAGE, or
+     *		    JOptionPane.PLAIN_MESSAGE
      */
     public DialogMessage(String text, int type) {
 	this.text = text;
--- a/usr/src/java/util/org/opensolaris/os/vp/util/swing/FadablePanel.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/util/org/opensolaris/os/vp/util/swing/FadablePanel.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.vp.util.swing;
@@ -161,7 +160,7 @@
     }
 
     public void setFaded(boolean value) {
-	faded.setValue(value, isShowing());
+	setFaded(value, isShowing());
     }
 
     public void setFaded(boolean value, boolean animated) {
--- a/usr/src/java/util/org/opensolaris/os/vp/util/swing/GUIUtil.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/util/org/opensolaris/os/vp/util/swing/GUIUtil.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.vp.util.swing;
@@ -347,10 +347,10 @@
      * via the API; in this case local defaults will be returned.
      *
      * @param	    messageType
-     *		    JoptionPane.ERROR_MESSAGE,
-     *		    JoptionPane.INFORMATION_MESSAGE,
-     *		    JoptionPane.WARNING_MESSAGE, or
-     *		    JoptionPane.QUESTION_MESSAGE.
+     *		    JOptionPane.ERROR_MESSAGE,
+     *		    JOptionPane.INFORMATION_MESSAGE,
+     *		    JOptionPane.WARNING_MESSAGE, or
+     *		    JOptionPane.QUESTION_MESSAGE.
      *
      * @return	    an {@code Icon}, or {@code null} if no icon could be found
      *		    for the given message type
--- a/usr/src/java/util/org/opensolaris/os/vp/util/swing/WrappingText.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/util/org/opensolaris/os/vp/util/swing/WrappingText.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,8 +20,7 @@
  */
 
 /*
- * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
+ * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.vp.util.swing;
@@ -226,6 +225,9 @@
     }
 
     public void setText(String text) {
+	if (text == null) {
+	    text = "";
+	}
 	this.text = text;
 	revalidateLater();
 	repaint();
--- a/usr/src/java/util/org/opensolaris/os/vp/util/swing/glass/BusyGlassPane.java	Thu Feb 03 13:55:27 2011 -0500
+++ b/usr/src/java/util/org/opensolaris/os/vp/util/swing/glass/BusyGlassPane.java	Thu Feb 03 14:10:29 2011 -0500
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
  */
 
 package org.opensolaris.os.vp.util.swing.glass;
@@ -113,6 +113,18 @@
 	return message;
     }
 
+    public JProgressBar getProgressBar() {
+	return progressBar;
+    }
+
+    protected void reset() {
+	setActions();
+	setDelay(_DELAY);
+	setMessage(null);
+	progressBar.setIndeterminate(true);
+	fadePanel.setFaded(true, false);
+    }
+
     public void setActions(Action... actions) {
 	SettingsButtonBar buttonBar = mainPanel.getButtonBar();
 	if (buttons != null) {
@@ -145,22 +157,6 @@
 	messageLabel.setVisible(m != null && !m.isEmpty());
     }
 
-    public JProgressBar getProgressBar() {
-	return progressBar;
-    }
-
-    //
-    // BusyGlassPane methods
-    //
-
-    protected void reset() {
-	setActions();
-	setDelay(_DELAY);
-	setMessage(null);
-	progressBar.setIndeterminate(true);
-	fadePanel.setFaded(true, false);
-    }
-
     //
     // Private methods
     //