semeru/Code-Code-CloneDetection-BigCloneBench huggingface dataset:
public FTPClient sample1c(String server, int port, String username, String password) throws SocketException, IOException {
		FTPClient ftpClient = new FTPClient();
		ftpClient.setDefaultPort(port);
		ftpClient.connect(server);
		ftpClient.login(username, password);
		return ftpClient;
	}
public FTPClient sample2a(String server, int port, String username, String password) throws SocketException, IOException {
		FTPSClient ftpClient = new FTPSClient();
		ftpClient.connect(server, port);
		ftpClient.login(username, password);
		return ftpClient;
	}
public FTPClient sample2c(String server, int port, String username, String password) throws SocketException, IOException {
		FTPSClient ftpClient = new FTPSClient();
		ftpClient.setDefaultPort(port);
		ftpClient.connect(server);
		ftpClient.login(username, password);
		return ftpClient;
	}
public FTPClient sample3a(String ftpserver, int ftpport, String proxyserver, int proxyport, String username, String password) throws SocketException, IOException {
		FTPHTTPClient ftpClient = new FTPHTTPClient(proxyserver, proxyport);
		ftpClient.connect(ftpserver, ftpport);
		ftpClient.login(username, password);
		return ftpClient;
	}
public FTPClient sample3b(String ftpserver, String proxyserver, int proxyport, String username, String password) throws SocketException, IOException {
		FTPHTTPClient ftpClient = new FTPHTTPClient(proxyserver, proxyport);
		ftpClient.connect(ftpserver);
		ftpClient.login(username, password);
		return ftpClient;
	}
public FTPClient sample3c(String ftpserver, int ftpport, String proxyserver, int proxyport, String username, String password) throws SocketException, IOException {
		FTPHTTPClient ftpClient = new FTPHTTPClient(proxyserver, proxyport);
		ftpClient.setDefaultPort(ftpport);
		ftpClient.connect(ftpserver);
		ftpClient.login(username, password);
		return ftpClient;
	}
public FTPClient sample1(String server, int port, String username, String password) throws IllegalStateException, IOException, FTPIllegalReplyException, FTPException {
		FTPClient ftpClient = new FTPClient();
		ftpClient.connect(server, port);
		ftpClient.login(username, password);
		return ftpClient;
	}
public FTPClient sample2(String server, String username, String password) throws IllegalStateException, IOException, FTPIllegalReplyException, FTPException {
		FTPClient ftpClient = new FTPClient();
		ftpClient.connect(server);
		ftpClient.login(username, password);
		return ftpClient;
	}
public static void BubbleSortInt1(int[] num) {
		boolean flag = true; // set flag to true to begin first pass
		int temp; // holding variable

		while (flag) {
			flag = false; // set flag to false awaiting a possible swap
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1]) // change to > for ascending sort
				{
					temp = num[j]; // swap elements
					num[j] = num[j + 1];
					num[j + 1] = temp;
					flag = true; // shows a swap occurred
				}
			}
		}
	}
public static void BubbleSortInt2(int[] num) {
		int last_exchange;
		int right_border = num.length - 1;
		do {
			last_exchange = 0;
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1])
				{
					int temp = num[j];
					num[j] = num[j + 1];
					num[j + 1] = temp;
					last_exchange = j;
				}
			}
			right_border = last_exchange;
		} while (right_border > 0);
	}
public static void BubbleSortFloat1(float[] num) {
		boolean flag = true; // set flag to true to begin first pass
		float temp; // holding variable

		while (flag) {
			flag = false; // set flag to false awaiting a possible swap
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1]) // change to > for ascending sort
				{
					temp = num[j]; // swap elements
					num[j] = num[j + 1];
					num[j + 1] = temp;
					flag = true; // shows a swap occurred
				}
			}
		}
	}
public static void BubbleSortFloat2(float[] num) {
		int last_exchange;
		int right_border = num.length - 1;
		do {
			last_exchange = 0;
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1])
				{
					float temp = num[j];
					num[j] = num[j + 1];
					num[j + 1] = temp;
					last_exchange = j;
				}
			}
			right_border = last_exchange;
		} while (right_border > 0);
	}
public static void BubbleSortDouble1(double[] num) {
		boolean flag = true; // set flag to true to begin first pass
		double temp; // holding variable

		while (flag) {
			flag = false; // set flag to false awaiting a possible swap
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1]) // change to > for ascending sort
				{
					temp = num[j]; // swap elements
					num[j] = num[j + 1];
					num[j + 1] = temp;
					flag = true; // shows a swap occurred
				}
			}
		}
	}
public static void BubbleSortDouble2(double[] num) {
		int last_exchange;
		int right_border = num.length - 1;
		do {
			last_exchange = 0;
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1])
				{
					double temp = num[j];
					num[j] = num[j + 1];
					num[j + 1] = temp;
					last_exchange = j;
				}
			}
			right_border = last_exchange;
		} while (right_border > 0);
	}
public static void BubbleSortLong1(long[] num) {
		boolean flag = true; // set flag to true to begin first pass
		long temp; // holding variable

		while (flag) {
			flag = false; // set flag to false awaiting a possible swap
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1]) // change to > for ascending sort
				{
					temp = num[j]; // swap elements
					num[j] = num[j + 1];
					num[j + 1] = temp;
					flag = true; // shows a swap occurred
				}
			}
		}
	}
public static void BubbleSortLong2(long[] num) {
		int last_exchange;
		int right_border = num.length - 1;
		do {
			last_exchange = 0;
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1])
				{
					long temp = num[j];
					num[j] = num[j + 1];
					num[j + 1] = temp;
					last_exchange = j;
				}
			}
			right_border = last_exchange;
		} while (right_border > 0);
	}
public static void BubbleSortShort1(short[] num) {
		boolean flag = true; // set flag to true to begin first pass
		short temp; // holding variable

		while (flag) {
			flag = false; // set flag to false awaiting a possible swap
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1]) // change to > for ascending sort
				{
					temp = num[j]; // swap elements
					num[j] = num[j + 1];
					num[j + 1] = temp;
					flag = true; // shows a swap occurred
				}
			}
		}
	}
public static void BubbleSortShort2(short[] num) {
		int last_exchange;
		int right_border = num.length - 1;
		do {
			last_exchange = 0;
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1])
				{
					short temp = num[j];
					num[j] = num[j + 1];
					num[j + 1] = temp;
					last_exchange = j;
				}
			}
			right_border = last_exchange;
		} while (right_border > 0);
	}
public static void BubbleSortByte1(byte[] num) {
		boolean flag = true; // set flag to true to begin first pass
		byte temp; // holding variable

		while (flag) {
			flag = false; // set flag to false awaiting a possible swap
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1]) // change to > for ascending sort
				{
					temp = num[j]; // swap elements
					num[j] = num[j + 1];
					num[j + 1] = temp;
					flag = true; // shows a swap occurred
				}
			}
		}
	}
public static void BubbleSortByte2(byte[] num) {
		int last_exchange;
		int right_border = num.length - 1;
		do {
			last_exchange = 0;
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j] > num[j + 1])
				{
					byte temp = num[j];
					num[j] = num[j + 1];
					num[j + 1] = temp;
					last_exchange = j;
				}
			}
			right_border = last_exchange;
		} while (right_border > 0);
	}
public static <T extends Comparable<T>> void BubbleSortComparable1(T[] num) {
		int j;
		boolean flag = true; // set flag to true to begin first pass
		T temp; // holding variable

		while (flag) {
			flag = false; // set flag to false awaiting a possible swap
			for (j = 0; j < num.length - 1; j++) {
				if (num[j].compareTo(num[j + 1]) > 0) // change to > for ascending sort
				{
					temp = num[j]; // swap elements
					num[j] = num[j + 1];
					num[j + 1] = temp;
					flag = true; // shows a swap occurred
				}
			}
		}
	}
public static <T extends Comparable<T>> void BubbleSortComparable2(T[] num) {
		int last_exchange;
		int right_border = num.length - 1;
		do {
			last_exchange = 0;
			for (int j = 0; j < num.length - 1; j++) {
				if (num[j].compareTo(num[j + 1]) > 0)
				{
					T temp = num[j];
					num[j] = num[j + 1];
					num[j + 1] = temp;
					last_exchange = j;
				}
			}
			right_border = last_exchange;
		} while (right_border > 0);
	}
public static void Sample1(String myField, String condition1, String condition2) throws SQLException {
		Connection connection = DriverManager.getConnection("jdbc:postgresql://localhost/test", "user", "password");
		connection.setAutoCommit(false);
		
		PreparedStatement ps = connection.prepareStatement("UPDATE myTable SET myField = ? WHERE myOtherField1 = ? AND myOtherField2 = ?");
		ps.setString(1, myField);
		ps.setString(2, condition1);
		ps.setString(3, condition2);
		
		// If more than 10 entries change, panic and rollback
		int numChanged = ps.executeUpdate();
		if(numChanged > 10) {
			connection.rollback();
		} else {
			connection.commit();
		}
		
		ps.close();
		connection.close();
	}
public static void Sample2(String myField, String condition1, String condition2) throws SQLException {
		Connection connection = DriverManager.getConnection("jdbc:postgresql://localhost/test", "user", "password");
		connection.setAutoCommit(false);
		
		Statement st = connection.createStatement();
		
		String sql = "UPDATE myTable SET myField = '" + myField + "' WHERE myOtherField1 = '" + condition1 + "' AND myOtherField2 = '" + condition2 + "'";
		
		int numChanged = st.executeUpdate(sql);
		
		// If more than 10 entries change, panic and rollback
		if(numChanged > 10) {
			connection.rollback();
		} else {
			connection.commit();
		}
		
		st.close();
		connection.close();
	}
public static IProject CreateJavaProject(String name, IPath classpath) throws CoreException {
		// Create and Open New Project in Workspace
		IWorkspace workspace = ResourcesPlugin.getWorkspace();
		IWorkspaceRoot root = workspace.getRoot();
		IProject project = root.getProject(name);
		project.create(null);
		project.open(null);
		
		// Add Java Nature to new Project
		IProjectDescription desc = project.getDescription();
		desc.setNatureIds(new String[] { JavaCore.NATURE_ID});
		project.setDescription(desc, null);
		
		// Get Java Project Object
		IJavaProject javaProj = JavaCore.create(project);
		
		// Set Output Folder
		IFolder binDir = project.getFolder("bin");
		IPath binPath = binDir.getFullPath();
		javaProj.setOutputLocation(binPath, null);
		
		// Set Project's Classpath
		IClasspathEntry cpe = JavaCore.newLibraryEntry(classpath, null, null);
		javaProj.setRawClasspath(new IClasspathEntry[] {cpe}, null);
		
		return project;
	}
public static void copyFile(final File in, final File out) throws IOException {
        final FileChannel sourceChannel = new FileInputStream(in).getChannel();
        final FileChannel destinationChannel = new FileOutputStream(out).getChannel();
        sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
        sourceChannel.close();
        destinationChannel.close();
    }
private static String getHash(char[] passwd, String algorithm) throws NoSuchAlgorithmException {
        MessageDigest alg = MessageDigest.getInstance(algorithm);
        alg.reset();
        alg.update(new String(passwd).getBytes());
        byte[] digest = alg.digest();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < digest.length; i++) {
            String hex = Integer.toHexString(0xff & digest[i]);
            if (hex.length() == 1) {
                sb.append('0');
            }
            sb.append(hex);
        }
        return sb.toString();
    }
public boolean run() {
            Connection conn = null;
            Statement stmt = null;
            try {
                conn = getDataSource().getConnection();
                conn.setAutoCommit(false);
                conn.rollback();
                stmt = conn.createStatement();
                for (String task : tasks) {
                    if (task.length() == 0) continue;
                    LOGGER.info("Executing SQL migration: " + task);
                    stmt.executeUpdate(task);
                }
                conn.commit();
            } catch (SQLException ex) {
                try {
                    conn.rollback();
                } catch (Throwable th) {
                }
                throw new SystemException("Cannot execute SQL migration", ex);
            } finally {
                try {
                    if (stmt != null) stmt.close();
                } catch (Throwable th) {
                    LOGGER.error(th);
                }
                try {
                    if (stmt != null) conn.close();
                } catch (Throwable th) {
                    LOGGER.error(th);
                }
            }
            return true;
        }
@Test(expected = GadgetException.class)
    public void badFetchServesCached() throws Exception {
        HttpRequest firstRequest = createCacheableRequest();
        expect(pipeline.execute(firstRequest)).andReturn(new HttpResponse(LOCAL_SPEC_XML)).once();
        HttpRequest secondRequest = createIgnoreCacheRequest();
        expect(pipeline.execute(secondRequest)).andReturn(HttpResponse.error()).once();
        replay(pipeline);
        GadgetSpec original = specFactory.getGadgetSpec(createContext(SPEC_URL, false));
        GadgetSpec cached = specFactory.getGadgetSpec(createContext(SPEC_URL, true));
        assertEquals(original.getUrl(), cached.getUrl());
        assertEquals(original.getChecksum(), cached.getChecksum());
    }
@Test(expected = GadgetException.class)
    public void malformedGadgetSpecThrows() throws Exception {
        HttpRequest request = createIgnoreCacheRequest();
        expect(pipeline.execute(request)).andReturn(new HttpResponse("malformed junk"));
        replay(pipeline);
        specFactory.getGadgetSpec(createContext(SPEC_URL, true));
    }
@Test(expected = GadgetException.class)
    public void malformedGadgetSpecIsCachedAndThrows() throws Exception {
        HttpRequest request = createCacheableRequest();
        expect(pipeline.execute(request)).andReturn(new HttpResponse("malformed junk")).once();
        replay(pipeline);
        try {
            specFactory.getGadgetSpec(createContext(SPEC_URL, false));
            fail("No exception thrown on bad parse");
        } catch (GadgetException e) {
        }
        specFactory.getGadgetSpec(createContext(SPEC_URL, false));
    }
@Override
    public void setContentAsStream(InputStream input) throws IOException {
        BufferedOutputStream output = new BufferedOutputStream(new FileOutputStream(htmlFile));
        try {
            IOUtils.copy(input, output);
        } finally {
            output.close();
        }
        if (this.getLastModified() != -1) {
            htmlFile.setLastModified(this.getLastModified());
        }
    }
@Override
    protected void processImport() throws SudokuInvalidFormatException {
        importFolder(mUri.getLastPathSegment());
        try {
            URL url = new URL(mUri.toString());
            InputStreamReader isr = new InputStreamReader(url.openStream());
            BufferedReader br = null;
            try {
                br = new BufferedReader(isr);
                String s;
                while ((s = br.readLine()) != null) {
                    if (!s.equals("")) {
                        importGame(s);
                    }
                }
            } finally {
                if (br != null) br.close();
            }
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
public ObjectInputStream sendObject(String sMethod, Serializable obj) {
        String sServlet = System.getProperty("servlet.jstat");
        if (sServlet != null) {
            try {
                URL url = new URL(sServlet);
                URLConnection conn = url.openConnection();
                conn.setDoInput(true);
                conn.setDoOutput(true);
                conn.setUseCaches(false);
                conn.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
                ObjectOutputStream out = new ObjectOutputStream(conn.getOutputStream());
                out.writeObject(sMethod);
                out.writeObject(obj);
                out.flush();
                out.close();
                return new ObjectInputStream(conn.getInputStream());
            } catch (Exception exc) {
                System.out.println("Error on SpaceJobRunner::sendObjectPOST() --> " + exc);
            }
        } else {
        }
        return null;
    }
public static Vector getMetaKeywordsFromURL(String p_url) throws Exception {
        URL x_url = new URL(p_url);
        URLConnection x_conn = x_url.openConnection();
        InputStreamReader x_is_reader = new InputStreamReader(x_conn.getInputStream());
        BufferedReader x_reader = new BufferedReader(x_is_reader);
        String x_line = null;
        String x_lc_line = null;
        int x_body = -1;
        String x_keyword_list = null;
        int x_keywords = -1;
        String[] x_meta_keywords = null;
        while ((x_line = x_reader.readLine()) != null) {
            x_lc_line = x_line.toLowerCase();
            x_keywords = x_lc_line.indexOf("<meta name=\"keywords\" content=\"");
            if (x_keywords != -1) {
                x_keywords = "<meta name=\"keywords\" content=\"".length();
                x_keyword_list = x_line.substring(x_keywords, x_line.indexOf("\">", x_keywords));
                x_keyword_list = x_keyword_list.replace(',', ' ');
                x_meta_keywords = Parser.extractWordsFromSpacedList(x_keyword_list);
            }
            x_body = x_lc_line.indexOf("<body");
            if (x_body != -1) break;
        }
        Vector x_vector = new Vector(x_meta_keywords.length);
        for (int i = 0; i < x_meta_keywords.length; i++) x_vector.add(x_meta_keywords[i]);
        return x_vector;
    }
public static Vector getKeywordsFromURL(String p_url) throws Exception {
        URL x_url = new URL(p_url);
        URLConnection x_conn = x_url.openConnection();
        InputStreamReader x_is_reader = new InputStreamReader(x_conn.getInputStream());
        BufferedReader x_reader = new BufferedReader(x_is_reader);
        String x_line = null;
        String x_lc_line = null;
        Vector x_words = new Vector(1000);
        int x_body = -1;
        while ((x_line = x_reader.readLine()) != null) {
            x_lc_line = x_line.toLowerCase();
            x_body = x_lc_line.indexOf("<body");
            if (x_body != -1) {
                x_line = x_line.substring(x_body + 5);
                break;
            }
        }
        boolean x_status = false;
        int x_end = -1;
        if (x_lc_line == null) {
            System.out.println("No <body start");
            return null;
        }
        do {
            x_lc_line = x_line.toLowerCase();
            x_end = x_lc_line.indexOf("</body>");
            if (x_end != -1) {
                extractOutsideText(x_line.substring(0, x_end), "<", ">", x_words, x_status);
                break;
            }
            x_status = extractOutsideText(x_line, "<", ">", x_words, x_status);
        } while ((x_line = x_reader.readLine()) != null);
        return x_words;
    }
public static Vector[] getLinksFromURLFast(String p_url) throws Exception {
        timeCheck("getLinksFromURLFast ");
        URL x_url = new URL(p_url);
        URLConnection x_conn = x_url.openConnection();
        InputStreamReader x_is_reader = new InputStreamReader(x_conn.getInputStream());
        BufferedReader x_reader = new BufferedReader(x_is_reader);
        String x_line = null;
        RE e = new RE("(.*/)", RE.REG_ICASE);
        System.out.println("RE: " + e.toString());
        REMatch x_match = e.getMatch(p_url);
        String x_dir = p_url.substring(x_match.getSubStartIndex(1), x_match.getSubEndIndex(1));
        e = new RE("(http://.*?)/?", RE.REG_ICASE);
        x_match = e.getMatch(p_url);
        String x_root = p_url.substring(x_match.getSubStartIndex(1), x_match.getSubEndIndex(1));
        e = new RE("<a href=\"?(.*?)\"?>(.*?)</a>", RE.REG_ICASE);
        System.out.println("RE: " + e.toString());
        Vector x_links = new Vector(100);
        Vector x_texts = new Vector(100);
        StringBuffer x_buf = new StringBuffer(10000);
        REMatch[] x_matches = null;
        timeCheck("starting parsing ");
        while ((x_line = x_reader.readLine()) != null) {
            x_buf.append(x_line);
        }
        String x_page = x_buf.toString();
        String x_link = null;
        x_matches = e.getAllMatches(x_page);
        for (int i = 0; i < x_matches.length; i++) {
            x_link = x_page.substring(x_matches[i].getSubStartIndex(1), x_matches[i].getSubEndIndex(1));
            if (x_link.indexOf("mailto:") != -1) continue;
            x_link = toAbsolute(x_root, x_dir, x_link);
            x_links.addElement(x_link);
            x_texts.addElement(x_page.substring(x_matches[i].getSubStartIndex(2), x_matches[i].getSubEndIndex(2)));
        }
        Vector[] x_result = new Vector[2];
        x_result[0] = x_links;
        x_result[1] = x_texts;
        timeCheck("end parsing ");
        return x_result;
    }
public static String getTitleFromURLFast(String p_url) throws Exception {
        URL x_url = new URL(p_url);
        URLConnection x_conn = x_url.openConnection();
        InputStreamReader x_is_reader = new InputStreamReader(x_conn.getInputStream());
        BufferedReader x_reader = new BufferedReader(x_is_reader);
        String x_line = null;
        String x_title_line = null;
        String x_lc_line = null;
        int x_title = -1;
        int x_end = -1;
        while ((x_line = x_reader.readLine()) != null) {
            x_lc_line = x_line.toLowerCase();
            x_title = x_lc_line.indexOf("<title");
            if (x_title != -1) {
                x_end = x_lc_line.indexOf("</title>");
                x_title_line = x_line.substring((x_title + 7), (x_end == -1 ? x_line.length() : x_end));
                break;
            }
        }
        return x_title_line;
    }