diff options
author | Brian Hinz <bphinz@users.sourceforge.net> | 2012-12-14 22:40:02 +0000 |
---|---|---|
committer | Brian Hinz <bphinz@users.sourceforge.net> | 2012-12-14 22:40:02 +0000 |
commit | d93a26d665b18b0e779c524f54c7acdc18898b94 (patch) | |
tree | 54908596b5aff623723ce964e220549d7254dbd6 /java/com/tigervnc | |
parent | 32c46228f5e6d2e0c4bf1701bd36aeb0b89f4f32 (diff) | |
download | tigervnc-d93a26d665b18b0e779c524f54c7acdc18898b94.tar.gz tigervnc-d93a26d665b18b0e779c524f54c7acdc18898b94.zip |
Cleanup linter warnings wherever possible and suppress all linter warnings from Jsch code
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5020 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'java/com/tigervnc')
-rw-r--r-- | java/com/tigervnc/network/TcpListener.java | 4 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CConnection.java | 4 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CMsgWriterV3.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/CSecurityVeNCrypt.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/Configuration.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/ScreenSet.java | 6 | ||||
-rw-r--r-- | java/com/tigervnc/rfb/Security.java | 8 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/CConn.java | 8 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/MenuKey.java | 4 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/OptionsDialog.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/ServerDialog.java | 11 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/Viewport.java | 2 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/VncViewer.java | 5 | ||||
-rw-r--r-- | java/com/tigervnc/vncviewer/tunnel.java | 2 |
14 files changed, 33 insertions, 29 deletions
diff --git a/java/com/tigervnc/network/TcpListener.java b/java/com/tigervnc/network/TcpListener.java index b7dc4384..d56cd065 100644 --- a/java/com/tigervnc/network/TcpListener.java +++ b/java/com/tigervnc/network/TcpListener.java @@ -98,8 +98,8 @@ public class TcpListener extends SocketListener { // Accept an incoming connection try { if (selector.select(0) > 0) { - Set keys = selector.selectedKeys(); - Iterator iter = keys.iterator(); + Set<SelectionKey> keys = selector.selectedKeys(); + Iterator<SelectionKey> iter = keys.iterator(); while (iter.hasNext()) { SelectionKey key = (SelectionKey)iter.next(); iter.remove(); diff --git a/java/com/tigervnc/rfb/CConnection.java b/java/com/tigervnc/rfb/CConnection.java index 959f8138..a9230285 100644 --- a/java/com/tigervnc/rfb/CConnection.java +++ b/java/com/tigervnc/rfb/CConnection.java @@ -122,7 +122,7 @@ abstract public class CConnection extends CMsgHandler { throwConnFailedException(); } else if (secType == Security.secTypeNone || secType == Security.secTypeVncAuth) { - Iterator i; + Iterator<Integer> i; for (i = secTypes.iterator(); i.hasNext(); ) { int refType = (Integer)i.next(); if (refType == secType) { @@ -146,7 +146,7 @@ abstract public class CConnection extends CMsgHandler { if (nServerSecTypes == 0) throwConnFailedException(); - Iterator j; + Iterator<Integer> j; for (int i = 0; i < nServerSecTypes; i++) { int serverSecType = is.readU8(); diff --git a/java/com/tigervnc/rfb/CMsgWriterV3.java b/java/com/tigervnc/rfb/CMsgWriterV3.java index 1ac583b3..a730698d 100644 --- a/java/com/tigervnc/rfb/CMsgWriterV3.java +++ b/java/com/tigervnc/rfb/CMsgWriterV3.java @@ -55,7 +55,7 @@ public class CMsgWriterV3 extends CMsgWriter { os.writeU8(layout.num_screens()); os.pad(1); - for (Iterator iter = layout.screens.iterator(); iter.hasNext(); ) { + for (Iterator<Screen> iter = layout.screens.iterator(); iter.hasNext(); ) { Screen refScreen = (Screen)iter.next(); os.writeU32(refScreen.id); os.writeU16(refScreen.dimensions.tl.x); diff --git a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java index a1f22314..528158c3 100644 --- a/java/com/tigervnc/rfb/CSecurityVeNCrypt.java +++ b/java/com/tigervnc/rfb/CSecurityVeNCrypt.java @@ -131,7 +131,7 @@ public class CSecurityVeNCrypt extends CSecurity { if (!haveChosenType) { chosenType = Security.secTypeInvalid; int i; - Iterator j; + Iterator<Integer> j; List<Integer> secTypes = new ArrayList<Integer>(); secTypes = Security.GetEnabledExtSecTypes(); diff --git a/java/com/tigervnc/rfb/Configuration.java b/java/com/tigervnc/rfb/Configuration.java index aca8b536..fb635c7b 100644 --- a/java/com/tigervnc/rfb/Configuration.java +++ b/java/com/tigervnc/rfb/Configuration.java @@ -285,7 +285,7 @@ public class Configuration { return; } - for (Iterator i = props.stringPropertyNames().iterator(); i.hasNext();) { + for (Iterator<String> i = props.stringPropertyNames().iterator(); i.hasNext();) { String name = (String)i.next(); if (name.startsWith("[")) { // skip the section delimiters diff --git a/java/com/tigervnc/rfb/ScreenSet.java b/java/com/tigervnc/rfb/ScreenSet.java index b848b132..d20374f6 100644 --- a/java/com/tigervnc/rfb/ScreenSet.java +++ b/java/com/tigervnc/rfb/ScreenSet.java @@ -35,7 +35,7 @@ public class ScreenSet { public final void add_screen(Screen screen) { screens.add(screen); } public final void remove_screen(int id) { - for (Iterator iter = screens.iterator(); iter.hasNext(); ) { + for (Iterator<Screen> iter = screens.iterator(); iter.hasNext(); ) { Screen refScreen = (Screen)iter.next(); if (refScreen.id == id) iter.remove(); @@ -53,7 +53,7 @@ public class ScreenSet { fb_rect.setXYWH(0, 0, fb_width, fb_height); - for (Iterator iter = screens.iterator(); iter.hasNext(); ) { + for (Iterator<Screen> iter = screens.iterator(); iter.hasNext(); ) { Screen refScreen = (Screen)iter.next(); if (refScreen.dimensions.is_empty()) return false; @@ -68,7 +68,7 @@ public class ScreenSet { } public final void debug_print() { - for (Iterator iter = screens.iterator(); iter.hasNext(); ) { + for (Iterator<Screen> iter = screens.iterator(); iter.hasNext(); ) { Screen refScreen = (Screen)iter.next(); vlog.error(" "+refScreen.id+" (0x"+refScreen.id+"): "+ refScreen.dimensions.width()+"x"+refScreen.dimensions.height()+ diff --git a/java/com/tigervnc/rfb/Security.java b/java/com/tigervnc/rfb/Security.java index 6d52ede7..9df49951 100644 --- a/java/com/tigervnc/rfb/Security.java +++ b/java/com/tigervnc/rfb/Security.java @@ -77,7 +77,7 @@ public class Security { List<Integer> result = new ArrayList<Integer>(); result.add(secTypeVeNCrypt); - for (Iterator i = enabledSecTypes.iterator(); i.hasNext(); ) { + for (Iterator<Integer> i = enabledSecTypes.iterator(); i.hasNext(); ) { int refType = (Integer)i.next(); if (refType < 0x100) result.add(refType); @@ -90,7 +90,7 @@ public class Security { { List<Integer> result = new ArrayList<Integer>(); - for (Iterator i = enabledSecTypes.iterator(); i.hasNext(); ) { + for (Iterator<Integer> i = enabledSecTypes.iterator(); i.hasNext(); ) { int refType = (Integer)i.next(); if (refType != secTypeVeNCrypt) /* Do not include VeNCrypt to avoid loops */ result.add(refType); @@ -102,7 +102,7 @@ public class Security { public static final void EnableSecType(int secType) { - for (Iterator i = enabledSecTypes.iterator(); i.hasNext(); ) + for (Iterator<Integer> i = enabledSecTypes.iterator(); i.hasNext(); ) if ((Integer)i.next() == secType) return; @@ -111,7 +111,7 @@ public class Security { public boolean IsSupported(int secType) { - Iterator i; + Iterator<Integer> i; for (i = enabledSecTypes.iterator(); i.hasNext(); ) if ((Integer)i.next() == secType) diff --git a/java/com/tigervnc/vncviewer/CConn.java b/java/com/tigervnc/vncviewer/CConn.java index 9adb9675..e51cb444 100644 --- a/java/com/tigervnc/vncviewer/CConn.java +++ b/java/com/tigervnc/vncviewer/CConn.java @@ -297,7 +297,7 @@ public class CConn extends CConnection setServerPort(port); sock = new TcpSocket(host, port); vlog.info("Redirected to "+host+":"+port); - viewer.newViewer(viewer, sock, true); + VncViewer.newViewer(viewer, sock, true); } catch (java.lang.Exception e) { throw new Exception(e.toString()); } @@ -355,7 +355,7 @@ public class CConn extends CConnection else if (layout.num_screens() != 1) { while (true) { - Iterator iter = layout.screens.iterator(); + Iterator<Screen> iter = layout.screens.iterator(); Screen screen = (Screen)iter.next(); if (!iter.hasNext()) @@ -831,7 +831,7 @@ public class CConn extends CConnection /* Process non-VeNCrypt sectypes */ java.util.List<Integer> secTypes = new ArrayList<Integer>(); secTypes = Security.GetEnabledSecTypes(); - for (Iterator i = secTypes.iterator(); i.hasNext();) { + for (Iterator<Integer> i = secTypes.iterator(); i.hasNext();) { switch ((Integer)i.next()) { case Security.secTypeVeNCrypt: options.secVeNCrypt.setSelected(UserPreferences.getBool("viewer", "secVeNCrypt", true)); @@ -851,7 +851,7 @@ public class CConn extends CConnection if (options.secVeNCrypt.isSelected()) { java.util.List<Integer> secTypesExt = new ArrayList<Integer>(); secTypesExt = Security.GetEnabledExtSecTypes(); - for (Iterator iext = secTypesExt.iterator(); iext.hasNext();) { + for (Iterator<Integer> iext = secTypesExt.iterator(); iext.hasNext();) { switch ((Integer)iext.next()) { case Security.secTypePlain: options.encNone.setSelected(UserPreferences.getBool("viewer", "encNone", true)); diff --git a/java/com/tigervnc/vncviewer/MenuKey.java b/java/com/tigervnc/vncviewer/MenuKey.java index 0a240149..49677087 100644 --- a/java/com/tigervnc/vncviewer/MenuKey.java +++ b/java/com/tigervnc/vncviewer/MenuKey.java @@ -78,10 +78,10 @@ public class MenuKey } static int getMenuKeyCode() { - String menuKeyStr; int menuKeyCode = KeyEvent.VK_F8; - menuKeyStr = + @SuppressWarnings({"static"}) + String menuKeyStr = Configuration.global().getParam("menuKey").getValueStr(); for(int i = 0; i < getMenuKeySymbolCount(); i++) if (menuSymbols[i].name.equals(menuKeyStr)) diff --git a/java/com/tigervnc/vncviewer/OptionsDialog.java b/java/com/tigervnc/vncviewer/OptionsDialog.java index 80d9f40d..cd213410 100644 --- a/java/com/tigervnc/vncviewer/OptionsDialog.java +++ b/java/com/tigervnc/vncviewer/OptionsDialog.java @@ -39,6 +39,7 @@ class OptionsDialog extends Dialog implements OptionsDialogCallback cb; JPanel FormatPanel, InputsPanel, MiscPanel, DefaultsPanel, SecPanel; JCheckBox autoSelect, customCompressLevel, noJpeg; + @SuppressWarnings({"rawtypes"}) JComboBox menuKey, compressLevel, qualityLevel, scalingFactor; ButtonGroup encodingGroup, colourGroup; JRadioButton zrle, hextile, tight, raw; @@ -51,6 +52,7 @@ class OptionsDialog extends Dialog implements JButton ca, crl; JButton cfLoadButton, cfSaveAsButton, defSaveButton, defReloadButton, defClearButton; + @SuppressWarnings({"rawtypes","unchecked"}) public OptionsDialog(OptionsDialogCallback cb_) { super(true); cb = cb_; diff --git a/java/com/tigervnc/vncviewer/ServerDialog.java b/java/com/tigervnc/vncviewer/ServerDialog.java index 976dc7f2..a1345850 100644 --- a/java/com/tigervnc/vncviewer/ServerDialog.java +++ b/java/com/tigervnc/vncviewer/ServerDialog.java @@ -33,6 +33,7 @@ class ServerDialog extends Dialog implements ItemListener { + @SuppressWarnings({"unchecked","rawtypes"}) public ServerDialog(OptionsDialog options_, String defaultServerName, CConn cc_) { @@ -41,10 +42,10 @@ class ServerDialog extends Dialog implements setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); setResizable(false); setSize(new Dimension(340, 135)); - setTitle("VNC Viewer : Connection Details"); + setTitle("VNC Viewer: Connection Details"); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - if (cc.viewer.nViewers == 1) { + if (VncViewer.nViewers == 1) { cc.viewer.exit(1); } else { ret = false; @@ -120,13 +121,14 @@ class ServerDialog extends Dialog implements return; } + @SuppressWarnings({"unchecked","rawtypes"}) public void actionPerformed(ActionEvent e) { Object s = e.getSource(); if (s instanceof JButton && (JButton)s == okButton) { commit(); endDialog(); } else if (s instanceof JButton && (JButton)s == cancelButton) { - if (cc.viewer.nViewers == 1) + if (VncViewer.nViewers == 1) cc.viewer.exit(1); ret = false; endDialog(); @@ -148,7 +150,7 @@ class ServerDialog extends Dialog implements String serverName = (String)server.getSelectedItem(); if (serverName == null || serverName.equals("")) { vlog.error("Invalid servername specified"); - if (cc.viewer.nViewers == 1) + if (VncViewer.nViewers == 1) cc.viewer.exit(1); ret = false; endDialog(); @@ -177,6 +179,7 @@ class ServerDialog extends Dialog implements } CConn cc; + @SuppressWarnings("rawtypes") JComboBox server; ComboBoxEditor editor; JButton aboutButton, optionsButton, okButton, cancelButton; diff --git a/java/com/tigervnc/vncviewer/Viewport.java b/java/com/tigervnc/vncviewer/Viewport.java index c148416b..95489fac 100644 --- a/java/com/tigervnc/vncviewer/Viewport.java +++ b/java/com/tigervnc/vncviewer/Viewport.java @@ -53,7 +53,7 @@ public class Viewport extends JFrame }); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { - if (cc.viewer.nViewers == 1) { + if (VncViewer.nViewers == 1) { cc.viewer.exit(1); } else { cc.close(); diff --git a/java/com/tigervnc/vncviewer/VncViewer.java b/java/com/tigervnc/vncviewer/VncViewer.java index 8cc9fc63..cf38760f 100644 --- a/java/com/tigervnc/vncviewer/VncViewer.java +++ b/java/com/tigervnc/vncviewer/VncViewer.java @@ -40,8 +40,7 @@ import java.io.File; import java.lang.Character; import java.util.jar.Attributes; import java.util.jar.Manifest; -import java.util.ArrayList; -import java.util.Iterator; +import java.util.*; import javax.swing.*; import javax.swing.plaf.FontUIResource; import javax.swing.UIManager.*; @@ -80,7 +79,7 @@ public class VncViewer extends java.applet.Applet implements Runnable UIManager.put("TitledBorder.titleColor",Color.blue); if (UIManager.getLookAndFeel().getName().equals("Metal")) { UIManager.put("swing.boldMetal", Boolean.FALSE); - java.util.Enumeration keys = UIManager.getDefaults().keys(); + Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); diff --git a/java/com/tigervnc/vncviewer/tunnel.java b/java/com/tigervnc/vncviewer/tunnel.java index 23da0a99..a66d83ae 100644 --- a/java/com/tigervnc/vncviewer/tunnel.java +++ b/java/com/tigervnc/vncviewer/tunnel.java @@ -287,7 +287,7 @@ public class tunnel ArrayList<File> privateKeys = new ArrayList<File>(); privateKeys.add(new File(homeDir+"/.ssh/id_rsa")); privateKeys.add(new File(homeDir+"/.ssh/id_dsa")); - for (Iterator i = privateKeys.iterator(); i.hasNext();) { + for (Iterator<File> i = privateKeys.iterator(); i.hasNext();) { File privateKey = (File)i.next(); if (privateKey.exists() && privateKey.canRead()) jsch.addIdentity(privateKey.getAbsolutePath()); |