try { protocol.startTLS(); usingSSL = true; LOG.info("Switched to SSL"); } catch (IOException e) { int result = showErrorDialog(MailResourceLoader.getString( "dialog", "error", "ssl_handshake_error") + ": " + e.getLocalizedMessage() + "\n" + MailResourceLoader.getString("dialog", "error", "ssl_turn_off")); if (result == 1) { throw new CommandCancelledException(); } // turn off SSL for the future item.setBoolean("enable_ssl", false); // reopen the port protocol.openPort(); } catch (IMAPException e) { int result = showErrorDialog(MailResourceLoader.getString( "dialog", "error", "ssl_not_supported") + "\n" + MailResourceLoader.getString("dialog", "error", "ssl_turn_off")); if (result == 1) { throw new CommandCancelledException(); } // turn off SSL for the future item.setBoolean("enable_ssl", false); }
try { protocol.startTLS(); usingSSL = true; LOG.info("Switched to SSL"); } catch (IOException e) { int result = showErrorDialog(MailResourceLoader.getString( "dialog", "error", "ssl_handshake_error") + ": " + e.getLocalizedMessage() + "\n" + MailResourceLoader.getString("dialog", "error", "ssl_turn_off")); if (result == JOptionPane.CANCEL_OPTION) { throw new CommandCancelledException(); } // turn off SSL for the future popItem.setBoolean("enable_ssl", false); // reopen the port protocol.openPort(); } catch (POP3Exception e) { int result = showErrorDialog(MailResourceLoader.getString( "dialog", "error", "ssl_not_supported") + "\n" + MailResourceLoader.getString("dialog", "error", "ssl_turn_off")); if (result == JOptionPane.CANCEL_OPTION) { throw new CommandCancelledException(); } // turn off SSL for the future popItem.setBoolean("enable_ssl", false); }
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/imap/IMAPServer.java File path: /columba-1.4-src/mail/src/main/java/org/columba/mail/pop3/POP3Store.java
Method name: void openConnection() Method name: void openConnection()
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
					protocol.startTLS();
2
					protocol.startTLS();
3
					usingSSL = true;
3
					usingSSL = true;
4
					LOG.info("Switched to SSL");
4
					LOG.info("Switched to SSL");
5
				} catch (IOException e) {
5
				} catch (IOException e) {
6
					int result = showErrorDialog(MailResourceLoader.getString(
6
					int result = showErrorDialog(MailResourceLoader.getString(
7
							"dialog", "error", "ssl_handshake_error")
7
							"dialog", "error", "ssl_handshake_error")
8
							+ ": "
8
							+ ": "
9
							+ e.getLocalizedMessage()
9
							+ e.getLocalizedMessage()
10
							+ "\n"
10
							+ "\n"
11
							+ MailResourceLoader.getString("dialog", "error",
11
							+ MailResourceLoader.getString("dialog", "error",
12
									"ssl_turn_off"));
12
									"ssl_turn_off"));
13
					if (result == 1) {
13
					if (result == JOptionPane.CANCEL_OPTION) {
14
						throw new CommandCancelledException();
14
						throw new CommandCancelledException();
15
					}
15
					}
16
					// turn off SSL for the future
16
					// turn off SSL for the future
17
					item.setBoolean("enable_ssl", false);
17
					popItem.setBoolean("enable_ssl", false);
18
					// reopen the port
18
					// reopen the port
19
					protocol.openPort();
19
					protocol.openPort();
20
				} catch (IMAPException e) {
20
				} catch (POP3Exception e) {
21
					int result = showErrorDialog(MailResourceLoader.getString(
21
					int result = showErrorDialog(MailResourceLoader.getString(
22
							"dialog", "error", "ssl_not_supported")
22
							"dialog", "error", "ssl_not_supported")
23
							+ "\n"
23
							+ "\n"
24
							+ MailResourceLoader.getString("dialog", "error",
24
							+ MailResourceLoader.getString("dialog", "error",
25
									"ssl_turn_off"));
25
									"ssl_turn_off"));
26
					if (result == 1) {
26
					if (result == JOptionPane.CANCEL_OPTION) {
27
						throw new CommandCancelledException();
27
						throw new CommandCancelledException();
28
					}
28
					}
29
					// turn off SSL for the future
29
					// turn off SSL for the future
30
					item.setBoolean("enable_ssl", false);
30
					popItem.setBoolean("enable_ssl", false);
31
				}
31
				}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)2.5
Clones locationClones are in different classes
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    try
    11
    try
    10
    try
    Differences
    Expression1Expression2Difference
    1JOptionPane.CANCEL_OPTIONTYPE_COMPATIBLE_REPLACEMENT
    itempopItemVARIABLE_NAME_MISMATCH
    org.columba.mail.config.ImapItemorg.columba.mail.config.PopItemSUBCLASS_TYPE_MISMATCH
    org.columba.ristretto.imap.IMAPProtocolorg.columba.ristretto.pop3.POP3ProtocolSUBCLASS_TYPE_MISMATCH
    org.columba.ristretto.imap.IMAPExceptionorg.columba.ristretto.pop3.POP3ExceptionSUBCLASS_TYPE_MISMATCH
    org.columba.ristretto.imap.IMAPExceptionorg.columba.ristretto.pop3.POP3ExceptionSUBCLASS_TYPE_MISMATCH
    1JOptionPane.CANCEL_OPTIONTYPE_COMPATIBLE_REPLACEMENT
    itempopItemVARIABLE_NAME_MISMATCH
    org.columba.mail.config.ImapItemorg.columba.mail.config.PopItemSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression protocol cannot be unified with expression protocol , because common superclass org.columba.ristretto.auth.AuthenticationServer does not declare member(s) public void openPort() throws java.io.IOException, org.columba.ristretto.imap.IMAPException
    10
    try
    12
    protocol.startTLS();
    12
    protocol.startTLS();
    11
    protocol.startTLS();
    Differences
    Expression1Expression2Difference
    org.columba.ristretto.imap.IMAPProtocolorg.columba.ristretto.pop3.POP3ProtocolSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression protocol cannot be unified with expression protocol , because common superclass org.columba.ristretto.auth.AuthenticationServer does not declare member(s) public void startTLS() throws java.io.IOException, javax.net.ssl.SSLException, org.columba.ristretto.imap.IMAPException
    11
    protocol.startTLS();
    13
    usingSSL = true;
    12
    usingSSL = true;
    14
    LOG.info("Switched to SSL");
    13
    LOG.info("Switched to SSL");
    Precondition Violations (2)
    Row Violation
    1Expression protocol cannot be unified with expression protocol , because common superclass org.columba.ristretto.auth.AuthenticationServer does not declare member(s) public void openPort() throws java.io.IOException, org.columba.ristretto.imap.IMAPException
    2Expression protocol cannot be unified with expression protocol , because common superclass org.columba.ristretto.auth.AuthenticationServer does not declare member(s) public void startTLS() throws java.io.IOException, javax.net.ssl.SSLException, org.columba.ristretto.imap.IMAPException