SPARK-2204: Code cleanup: Remove unused fields and variables

This commit is contained in:
arthur 2020-11-17 23:26:30 +03:00
parent 0fb85eeb68
commit 7c6b4e827f
22 changed files with 20 additions and 122 deletions

View File

@ -35,8 +35,6 @@ public class Res {
}
static ClassLoader cl = Res.class.getClassLoader();
static {
prb = (PropertyResourceBundle)ResourceBundle.getBundle("i18n/spark_i18n");
}

View File

@ -172,7 +172,6 @@ public class BroadcastHistoryFrame extends javax.swing.JFrame {
// Variables declaration - do not modify//GEN-BEGIN:variables
private final javax.swing.JTextArea BroadcastHistoryArea;
private javax.swing.JLabel SearchDate;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JToggleButton SearchButton;
// End of variables declaration//GEN-END:variables
}

View File

@ -272,7 +272,6 @@ public class ContactList extends JPanel implements ActionListener,
@Override
public Object construct() {
mainPanel.add(_reconnectpanelsmall, 0);
_reconnectpanelsmall.setClosedOnError(onError);
final Collection<RosterEntry> roster = Roster.getInstanceFor(SparkManager.getConnection()).getEntries();
for (RosterEntry r : roster) {
@ -294,7 +293,6 @@ public class ContactList extends JPanel implements ActionListener,
public Object construct() {
_reconnectpanelicon.getPanel().add(_reconnectpanelicon.getButton(), 0);
_reconnectpanelicon.getPanel().revalidate();
_reconnectpanelicon.setClosedOnError(onError);
final Collection<RosterEntry> roster = Roster.getInstanceFor(SparkManager.getConnection()).getEntries();
for (RosterEntry r : roster) {
Presence p = new Presence(Presence.Type.unavailable);
@ -2265,7 +2263,6 @@ public class ContactList extends JPanel implements ActionListener,
switch (localPreferences.getReconnectPanelType()) {
case 0:
_reconnectPanel.setClosedOnError(false);
_reconnectPanel.setDisconnectReason(errorMessage);
removeAllUsers();
workspace.changeCardLayout(RETRY_PANEL);
@ -2377,7 +2374,6 @@ public class ContactList extends JPanel implements ActionListener,
case 0:
final String message = errorMessage;
SwingUtilities.invokeLater(() -> {
_reconnectPanel.setClosedOnError(true);
reconnect(message);
});
break;

View File

@ -42,7 +42,6 @@ public class ReconnectPanel extends JPanel implements ConnectionListener, Reconn
private static final long serialVersionUID = -7099075581561760774L;
private final JEditorPane pane;
private final JLabel _icon;
private boolean closedOnError;
/**
* Construct the RetryPanel.
@ -113,11 +112,6 @@ public class ReconnectPanel extends JPanel implements ConnectionListener, Reconn
_icon.setVisible(false);
}
public void setClosedOnError(boolean onError) {
closedOnError = onError;
}
@Override
public void connected( XMPPConnection xmppConnection )
{

View File

@ -35,7 +35,6 @@ public class ReconnectPanelIcon implements ConnectionListener {
private static final long serialVersionUID = 437696141257704105L;
private final JLabel _icon;
private final JPanel _commandpanel;
private boolean _closedOnError;
/**
* creates a new Panel
@ -56,11 +55,6 @@ public class ReconnectPanelIcon implements ConnectionListener {
return _icon;
}
public void setClosedOnError(boolean onError) {
_closedOnError = onError;
}
public void setReconnectText(String text) {
_icon.setToolTipText(text);
}

View File

@ -37,8 +37,6 @@ public class ReconnectPanelSmall extends ContactGroup implements
private final JLabel _reconnectionlabel = new JLabel(
Res.getString("message.reconnect.attempting"),
SparkRes.getImageIcon(SparkRes.BUSY_IMAGE), SwingConstants.CENTER);
private final Component thiscomp;
private boolean _closedOnError;
/**
* creates a new Panel
@ -49,11 +47,6 @@ public class ReconnectPanelSmall extends ContactGroup implements
super(groupName);
this.add(_reconnectionlabel);
this.setIcon(SparkRes.getImageIcon(SparkRes.BUSY_IMAGE));
thiscomp = this;
}
public void setClosedOnError(boolean onError) {
_closedOnError = onError;
}
public void setReconnectText(String text) {

View File

@ -53,11 +53,9 @@ import org.jivesoftware.sparkimpl.settings.local.LocalPreferences;
public class CertificateDialog extends JDialog implements ActionListener {
private final static Insets DEFAULT_INSETS = new Insets(5, 5, 5, 5);
private final LocalPreferences localPreferences;
private final CertificateModel certModel;
private final CertificateModel certModel;
private final CertManager certControll;
private final CertificateDialogReason reason;
private boolean addCert = false;
private boolean addCert = false;
private final JScrollPane scrollPane;
private final JPanel panel = new JPanel();
@ -116,13 +114,11 @@ public class CertificateDialog extends JDialog implements ActionListener {
}
certControll = certificateController;
this.localPreferences = localPreferences;
this.certModel = certModel;
this.certModel = certModel;
this.certExtensions = certModel.getExtensions();
this.certUnsupportedCriticalExtensions = certModel.getUnsupportedCriticalExtensions();
this.certUnsupportedNonCriticalExtensions = certModel.getUnsupportedNonCriticalExtensions();
this.reason = reason;
setTitle(Res.getString("title.certificate"));
setTitle(Res.getString("title.certificate"));
setSize(500, 600);
setLayout(new GridBagLayout());
Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();

View File

@ -49,10 +49,8 @@ public class CertificateModel {
private String subjectUniqueID;
private final boolean valid;
private boolean expired;
private boolean revoked;
private boolean notValidYet;
private Set<String> criticalExtensionSet;
private Set<String> criticalExtensionSet;
private Set<String> nonCriticalExtensionSet;
private final HashMap<String, String> extensions = new HashMap<>();
private final ArrayList<String> unsupportedCriticalExtensions = new ArrayList<>();
@ -450,14 +448,6 @@ public class CertificateModel {
this.revoked = revoked;
}
public boolean isNotValidYet() {
return notValidYet;
}
public boolean isExpired() {
return expired;
}
public String getIssuerCommonName() {
return issuerCommonName;
}

View File

@ -52,7 +52,8 @@ public class SparkTrustManager extends GeneralTrustManager implements X509TrustM
private CertStore crlStore;
private final X509TrustManager exceptionsTrustManager;
private KeyStore trustStore, blackStore, displayedCaCerts;
private KeyStore trustStore;
private KeyStore displayedCaCerts;
private final Collection<X509CRL> crlCollection = new ArrayList<>();
public SparkTrustManager() {

View File

@ -196,17 +196,10 @@ public class PrivacyListTree extends JPanel implements SparkPrivacyListListener
PrivacyTreeNode parent1 = (PrivacyTreeNode) path.getPathComponent(1);
SparkPrivacyList list = parent1.getPrivacyList();
// Remove contact or group
try
{
list.removeItem( node1.getPrivacyItem().getValue());
//list.removePrivacyItem(node.getPrivacyItem().getType(), node.getPrivacyItem().getValue());
list.save();
_model.removeNodeFromParent( node1 );
}
catch ( SmackException.NotConnectedException e1 )
{
Log.warning( "Unable to remove item for privacly list.", e1 );
}
list.removeItem( node1.getPrivacyItem().getValue());
//list.removePrivacyItem(node.getPrivacyItem().getType(), node.getPrivacyItem().getValue());
list.save();
_model.removeNodeFromParent( node1 );
}
} );
@ -236,22 +229,13 @@ public class PrivacyListTree extends JPanel implements SparkPrivacyListListener
addContact.addActionListener( e -> {
PrivacyAddDialogUI browser = new PrivacyAddDialogUI();
Collection<PrivacyItem> col = browser.showRoster(_comp, !node.isContactGroup());
try
{
for (PrivacyItem pI : col) {
final PrivacyItem clone = new PrivacyItem( pI.getType(), pI.getValue(), pI.isAllow(), list.getNewItemOrder() );
list.addItem(clone);
PrivacyTreeNode newChild = new PrivacyTreeNode(clone);
_model.insertNodeInto(newChild, parent, 0);
}
list.save();
for (PrivacyItem pI : col) {
final PrivacyItem clone = new PrivacyItem( pI.getType(), pI.getValue(), pI.isAllow(), list.getNewItemOrder() );
list.addItem(clone);
PrivacyTreeNode newChild = new PrivacyTreeNode(clone);
_model.insertNodeInto(newChild, parent, 0);
}
catch ( SmackException.NotConnectedException e1 )
{
Log.warning( "Unable to add item to privacy list.", e1 );
}
list.save();
} );
menu.add(addContact);

View File

@ -300,27 +300,7 @@ public class ChatTranscriptPlugin implements ChatRoomListener {
Frame.setVisible(true);
}
/**
* Sort HistoryMessages by date.
*/
final Comparator<HistoryMessage> dateComparator = ( messageOne, messageTwo ) -> {
long time1 = messageOne.getDate().getTime();
long time2 = messageTwo.getDate().getTime();
if (time1 < time2) {
return 1;
}
else if (time1 > time2) {
return -1;
}
return 0;
};
private class ChatRoomDecorator implements ActionListener, ChatRoomClosingListener {
private ChatRoom chatRoom;
private ChatRoomButton chatHistoryButton;
private final LocalPreferences localPreferences;

View File

@ -31,8 +31,6 @@ public class FpRes {
}
static ClassLoader cl = FpRes.class.getClassLoader();
static {
prb = (PropertyResourceBundle)ResourceBundle.getBundle("i18n/fastpath_i18n");
}

View File

@ -47,7 +47,6 @@ import org.jxmpp.jid.EntityBareJid;
public class UserHistory extends JPanel {
private static final long serialVersionUID = -1067239194964815379L;
private final DefaultListModel model = new DefaultListModel();
private JFrame userFrame;
private final JList list;
private final EntityBareJid userID;

View File

@ -32,8 +32,6 @@ import org.jivesoftware.spark.util.log.Log;
import org.jxmpp.jid.Jid;
public class InvitationManager {
private static final List<ChatRoom> inviteListeners = new ArrayList<>();
private InvitationManager() {
}

View File

@ -31,7 +31,6 @@ public class ChatSearchResult {
private final SimpleDateFormat UTC_FORMAT = new SimpleDateFormat("yyyyMMdd'T'HH:mm:ss");
private final String sessionID;
private Date creationDate;
private final int relevance;
private final String question;
private final String customerName;
@ -61,11 +60,6 @@ public class ChatSearchResult {
authors.append(" ");
}
String rell = getFirstValue(row, "relevance");
double o = Double.parseDouble(rell);
relevance = ((int) (double) o * 100);
question = getFirstValue(row, "question");
customerName = getFirstValue(row, "username");
email = getFirstValue(row, "email");

View File

@ -46,7 +46,6 @@ public class ChatRoomDecorator
{
public RolloverButton fileuploadButton;
public final ChatRoom room;
private StanzaListener uploadResponseListener;
public ChatRoomDecorator(final ChatRoom room, final SparkFileUploadPlugin plugin)
{

View File

@ -24,8 +24,6 @@ import org.jivesoftware.spark.util.log.Log;
public class FlashingResources {
private static final PropertyResourceBundle prb;
static ClassLoader cl = FlashingResources.class.getClassLoader();
static {
prb = (PropertyResourceBundle)ResourceBundle.getBundle("i18n/flashing_i18n");
}

View File

@ -31,13 +31,9 @@ public class ChatRoomDecorator
public RolloverButton ofmeetButton;
public final ChatRoom room;
private final String url;
public ChatRoomDecorator(final ChatRoom room, final String url, final SparkMeetPlugin plugin)
{
this.room = room;
this.url = url;
try {
BASE64Decoder decoder = new BASE64Decoder();

View File

@ -61,9 +61,7 @@ public class ReversiPanel extends JPanel {
private final ReversiModel reversi;
// All images used by the game.
ImageIcon imageIcon = ReversiRes.getImageIcon(ReversiRes.REVERSI_ICON);
private final Image imageBackground = ReversiRes.getImageIcon(ReversiRes.REVERSI_BOARD).getImage();
private final Image imageScoreWhite = ReversiRes.getImageIcon(ReversiRes.REVERSI_SCORE_WHITE).getImage();
private final Image imageScoreBlack = ReversiRes.getImageIcon(ReversiRes.REVERSI_SCORE_BLACK).getImage();

View File

@ -10,8 +10,6 @@ public class RoarResources {
private static final PropertyResourceBundle prb;
static ClassLoader cl = RoarResources.class.getClassLoader();
static {
prb = (PropertyResourceBundle) ResourceBundle.getBundle("i18n/roar_i18n");
}

View File

@ -31,11 +31,8 @@ public class TTTRes {
private static final PropertyResourceBundle prb;
static ClassLoader cl = TTTRes.class.getClassLoader();
static {
prb = (PropertyResourceBundle) ResourceBundle
.getBundle("i18n/tictactoe_i18n");
prb = (PropertyResourceBundle) ResourceBundle.getBundle("i18n/tictactoe_i18n");
}
public static String getString(String propertyName) {

View File

@ -16,9 +16,7 @@ public class TGuardRes {
private TGuardRes() {
}
static ClassLoader cl = TGuardRes.class.getClassLoader();
static {
prb = (PropertyResourceBundle) ResourceBundle
.getBundle("i18n/transferguard_i18n");