SPARK-1469: Code cleanup: Fix probable bugs: Remove empty statements.

Also remove the code that does nothing.
This commit is contained in:
arthur
2020-11-13 21:53:51 +03:00
parent b7f4fe241a
commit caaf9db56f
16 changed files with 51 additions and 113 deletions

View File

@ -104,8 +104,6 @@ public class Installer implements InstallAction {
*/
private void setURI(String path) {
boolean exists = WinRegistry.keyExists(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp");
if (exists) {
}
// JOptionPane.showConfirmDialog(null, "Another application is currently registered to handle XMPP instant messaging. Make Spark the default XMPP instant messaging client?", "Confirmation", }
WinRegistry.deleteKey(RegistryRoot.HKEY_CLASSES_ROOT, "xmpp", true);

View File

@ -75,20 +75,10 @@ public class CheckTree extends JPanel {
CheckNode node = (CheckNode)path.getLastPathComponent();
boolean isSelected = !node.isSelected();
node.setSelected(isSelected);
if (node.getSelectionMode() == CheckNode.DIG_IN_SELECTION) {
if (isSelected) {
//tree.expandPath(path);
}
else {
//tree.collapsePath(path);
}
}
((DefaultTreeModel)tree.getModel()).nodeChanged(node);
// I need revalidate if node is root. but why?
tree.revalidate();
tree.repaint();
}
}
}

View File

@ -275,9 +275,6 @@ public abstract class JiveSortableTable extends Table {
else {
setForeground(Color.black);
setBackground(Color.white);
if (row % 2 == 0) {
//setBackground( new Color( 156, 207, 255 ) );
}
}
if (isBordered) {
@ -362,9 +359,6 @@ public abstract class JiveSortableTable extends Table {
else {
setForeground(Color.black);
setBackground(Color.white);
if (row % 2 == 0) {
//setBackground( new Color( 156, 207, 255 ) );
}
}
if (isBordered) {

View File

@ -143,9 +143,6 @@ public class JiveTable extends JTable {
else {
setForeground(Color.black);
setBackground(Color.white);
if (row % 2 == 0) {
//setBackground( new Color( 156, 207, 255 ) );
}
}
if (isBordered) {
@ -197,9 +194,6 @@ public class JiveTable extends JTable {
else {
setForeground(Color.black);
setBackground(Color.white);
if (row % 2 == 0) {
//setBackground( new Color( 156, 207, 255 ) );
}
}
if (isBordered) {

View File

@ -304,9 +304,6 @@ public abstract class Table extends JXTable {
else {
setForeground(Color.black);
setBackground(Color.white);
if (row % 2 == 0) {
//setBackground( new Color( 156, 207, 255 ) );
}
}
if (isBordered) {
@ -393,9 +390,6 @@ public abstract class Table extends JXTable {
else {
setForeground(Color.black);
setBackground(Color.white);
if (row % 2 == 0) {
//setBackground( new Color( 156, 207, 255 ) );
}
}
if (isBordered) {

View File

@ -824,9 +824,7 @@ public class ContactList extends JPanel implements ActionListener,
ContactGroup unfiledGrp = getUnfiledGroup();
ContactItem unfiledItem = unfiledGrp.getContactItemByJID(jid.asBareJid());
if (unfiledItem != null) {
} else {
if (unfiledItem == null) {
ContactItem offlineItem = offlineGroup.getContactItemByJID(jid.asBareJid());
if (offlineItem != null) {
if ((rosterEntry.getType() == RosterPacket.ItemType.none || rosterEntry.getType() == RosterPacket.ItemType.from)

View File

@ -344,27 +344,21 @@ public class ConferenceRoomBrowser extends JPanel implements ActionListener,
}
private RoomObject getRoomsAndInfo(final HostedRoom room) {
boolean stillSearchForOccupants = true;
RoomObject result = null;
try {
try {
String roomName = room.getName();
EntityBareJid roomJID = room.getJid();
int numberOfOccupants = -1;
if (stillSearchForOccupants) {
RoomInfo roomInfo = null;
try {
roomInfo = MultiUserChatManager.getInstanceFor( SparkManager.getConnection() ).getRoomInfo( roomJID );
roomInfo = MultiUserChatManager.getInstanceFor(SparkManager.getConnection()).getRoomInfo(roomJID);
} catch (Exception e) {
// Nothing to do
}
if (roomInfo != null) {
numberOfOccupants = roomInfo.getOccupantsCount();
if (numberOfOccupants == -1) {
}
} else {
}
}
result = new RoomObject();

View File

@ -662,9 +662,6 @@ public class GroupChatParticipantList extends JPanel {
while (true) {
newNickname = newNickname.trim();
String nick = chat.getNickname().toString();
if (newNickname.equals(nick)) {
// return;
}
try {
chat.changeNickname(Resourcepart.from(newNickname));
break;

View File

@ -241,10 +241,7 @@ public class CustomMessages {
Iterator<CustomStatusItem> iter = customItems.iterator();
while (iter.hasNext()) {
CustomStatusItem item = iter.next();
if (item.getType().equals(messageType) && item.getStatus().equals(messageStatus)) {
}
else {
if (!item.getType().equals(messageType) || !item.getStatus().equals(messageStatus)) {
list.add(item);
}
}
@ -597,4 +594,4 @@ public class CustomMessages {
}
}
}

View File

@ -281,52 +281,50 @@ public class StringUtils {
/**
* This method takes a string and strips out all tags while still leaving
* the tag body intact.
*
* @param in
* the text to be converted.
* @param stripBRTag
* Remove BR tags.
*
* @param in the text to be converted.
* @param stripBRTag Remove BR tags.
* @return the input string with all tags removed.
*/
public static String stripTags(String in, boolean stripBRTag) {
if (in == null) {
return null;
}
if (in == null) {
return null;
}
char ch;
int i = 0;
int last = 0;
char[] input = in.toCharArray();
int len = input.length;
StringBuilder out = new StringBuilder((int) (len * 1.3));
for (; i < len; i++) {
ch = input[i];
if (ch > '>') {
// Nothing to do
} else if (ch == '<') {
if (!stripBRTag && i + 3 < len && input[i + 1] == 'b'
&& input[i + 2] == 'r' && input[i + 3] == '>') {
i += 3;
continue;
}
if (i > last) {
if (last > 0) {
out.append(" ");
}
out.append(input, last, i - last);
}
last = i + 1;
} else if (ch == '>') {
last = i + 1;
}
}
if (last == 0) {
return in;
}
if (i > last) {
out.append(input, last, i - last);
}
return out.toString();
char ch;
int i = 0;
int last = 0;
char[] input = in.toCharArray();
int len = input.length;
StringBuilder out = new StringBuilder((int) (len * 1.3));
for (; i < len; i++) {
ch = input[i];
if (ch <= '>') {
if (ch == '<') {
if (!stripBRTag && i + 3 < len && input[i + 1] == 'b'
&& input[i + 2] == 'r' && input[i + 3] == '>') {
i += 3;
continue;
}
if (i > last) {
if (last > 0) {
out.append(" ");
}
out.append(input, last, i - last);
}
last = i + 1;
} else if (ch == '>') {
last = i + 1;
}
}
}
if (last == 0) {
return in;
}
if (i > last) {
out.append(input, last, i - last);
}
return out.toString();
}
/**

View File

@ -57,9 +57,6 @@ public class PluginRenderer extends JLabel implements TableCellRenderer {
else {
setForeground(Color.black);
setBackground(Color.white);
if (row % 2 == 0) {
//setBackground( new Color( 156, 207, 255 ) );
}
}
if (isBordered) {

View File

@ -316,7 +316,6 @@ public class SoundPreference implements Preference {
return incomingInvitationBox.isSelected();
}
private void pickFile(String title, JTextField field) {
if (fc == null) {
fc = new JFileChooser();
@ -336,11 +335,7 @@ public class SoundPreference implements Preference {
Log.error(e);
}
}
else {
}
}
}
private File getSoundSettingsFile() {

View File

@ -460,10 +460,7 @@ public class VCardManager {
// Create temp vcard.
vcard = new VCard();
vcard.setJabberId(jid.toString());
} else {
//System.out.println(jid+" HDD ---------->");
}
return vcard;
}

View File

@ -139,16 +139,11 @@ public class UserSearchForm extends JPanel {
Log.error(ioe);
}
}
else {
// Log.error("Search-Searvice-Error: Properties-file does not exist= " + pluginsettings.getPath());
}
}
if (servicesBox.getItemCount() > 0) {
servicesBox.setSelectedIndex(0);
}
titlePanel = new TitlePanel("", "", SparkRes.getImageIcon(SparkRes.BLANK_IMAGE), true);
add(titlePanel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

View File

@ -107,9 +107,9 @@ public class ReversiPanel extends JPanel {
// Redraw board.
ReversiPanel.this.repaint();
}
else {
// TODO: other user automatically forfeits!
}
// TODO: other user automatically forfeits!
// else {
// }
// Execute move.
}
}

View File

@ -240,9 +240,9 @@ public class ReversiPlugin implements Plugin {
// before adding the new one (possible if the opponent sends two invites
// in a row).
Object oldInvitation = gameInvitations.put(invitation.getFrom(), inviteAlert);
if (oldInvitation != null) {
// TODO: clean it up by removing it from the transcript window.
}
// TODO: clean it up by removing it from the transcript window.
// if (oldInvitation != null) {
// }
// Add the response panel to the transcript window.
room.getTranscriptWindow().addComponent(inviteAlert);