semeru/Code-Code-CloneDetection-BigCloneBench huggingface dataset:
public String ask(String s) {
        System.out.println("asking ---> " + s);
        try {
            String result = null;
            URL url = new URL("http://www.google.com/search?hl=en&rls=GGLR,GGLR:2005-50,GGLR:en&sa=X&oi=spell&resnum=0&ct=result&cd=1&q=" + URLEncoder.encode(s, "UTF-8"));
            URLConnection connection = url.openConnection();
            connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
            connection.setDoOutput(false);
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
            String inputLine;
            while ((inputLine = in.readLine()) != null) {
                int textPos = inputLine.indexOf("Web definitions for ");
                if (textPos >= 0) {
                    int ltrPos = inputLine.indexOf("<font size=-1>", textPos + 18);
                    if (ltrPos >= 0) {
                        int closePos = inputLine.indexOf("<", ltrPos + 14);
                        if (closePos >= 0) {
                            result = inputLine.substring(ltrPos + 14, closePos);
                        }
                    }
                } else {
                    int ltrPos = inputLine.indexOf("&#8212; Location: ");
                    if (ltrPos >= 0) {
                        int closePos = inputLine.indexOf("<br", ltrPos + 18);
                        if (closePos >= 0) {
                            result = inputLine.substring(ltrPos + 18, closePos);
                        }
                    }
                }
            }
            in.close();
            if (result != null) {
                result = result.replaceAll("<b>", "");
                result = result.replaceAll("</b>", "");
                result = result.replaceAll("(&quot;|&#39;)", "'");
                System.out.println("result ---> " + result);
            } else {
                System.out.println("result ---> none!");
                String ss = s.toUpperCase();
                if (ss.startsWith("WHAT IS ")) {
                    String toSearch = ss.substring(8).trim();
                    try {
                        String str = getResultStr("http://www.google.com/search?hl=en&q=define%3A" + toSearch);
                        str = cutAfter(str, "on the Web");
                        str = cutAfter(str, "<li>");
                        str = getBefore(str, "<br>");
                        result = str.replaceAll("\n", "");
                    } catch (Exception ee) {
                    }
                }
            }
            return result;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
public String getResultStr(String urls) {
        try {
            String result = null;
            URL url = new URL(urls);
            URLConnection connection = url.openConnection();
            connection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)");
            connection.setDoOutput(false);
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
            String inputLine;
            int state = 0;
            StringBuilder sb = new StringBuilder();
            while ((inputLine = in.readLine()) != null) {
                sb.append(inputLine);
            }
            in.close();
            return sb.toString();
        } catch (Exception e) {
            return "";
        }
    }
public void doWrite() {
        System.out.print("\nSerializing...");
        try {
            IFile ifile = null;
            File file = null;
            if (null != method.getResource()) {
                ifile = method.getJavaProject().getResource().getProject().getFile(Statics.CFG_DIR + Statics.SEPARATOR + path.substring(path.lastIndexOf(Statics.SEPARATOR)));
            }
            file = new File(path);
            if (file.exists()) {
                boolean ans = MessageDialog.openQuestion(wb.getSite().getShell(), "Flow Plug-in", "File already exists. Do you want to overwrite it?");
                if (ans) {
                    file.delete();
                }
            }
            if (!file.exists()) {
                FileOutputStream fos = new FileOutputStream(path);
                ObjectOutputStream oos = new ObjectOutputStream(fos);
                BufferedOutputStream bo = new BufferedOutputStream(oos);
                oos.writeObject(anode);
                oos.flush();
                oos.close();
                InputStream is = new FileInputStream(path);
                if (null != ifile) {
                    if (ifile.exists()) ifile.delete(true, null);
                    ifile.create(is, IResource.NONE, null);
                }
                Path fullpath = new Path(path);
                IDE.openEditorOnFileStore(wb.getSite().getPage(), EFS.getLocalFileSystem().getStore(fullpath));
                method.getResource().refreshLocal(10, null);
                System.out.println("Serializing ...Done!");
            }
        } catch (PartInitException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (CoreException e) {
            e.printStackTrace();
        }
    }
protected void setUp() throws Exception {
        this.testOutputDirectory = new File(getClass().getResource("/").getPath());
        this.pluginFile = new File(this.testOutputDirectory, "/plugin.zip");
        ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(pluginFile));
        zos.putNextEntry(new ZipEntry("WEB-INF/"));
        zos.putNextEntry(new ZipEntry("WEB-INF/classes/"));
        zos.putNextEntry(new ZipEntry("WEB-INF/classes/system.properties"));
        System.getProperties().store(zos, null);
        zos.closeEntry();
        zos.putNextEntry(new ZipEntry("WEB-INF/lib/"));
        zos.putNextEntry(new ZipEntry("WEB-INF/lib/plugin.jar"));
        File jarFile = new File(this.testOutputDirectory.getPath() + "/plugin.jar");
        JarOutputStream jos = new JarOutputStream(new FileOutputStream(jarFile));
        jos.putNextEntry(new ZipEntry("vqwiki/"));
        jos.putNextEntry(new ZipEntry("vqwiki/plugins/"));
        jos.putNextEntry(new ZipEntry("vqwiki/plugins/system.properties"));
        System.getProperties().store(jos, null);
        jos.closeEntry();
        jos.close();
        IOUtils.copy(new FileInputStream(jarFile), zos);
        zos.closeEntry();
        zos.close();
        jarFile.delete();
        pcl = new PluginClassLoader(new File(testOutputDirectory, "/work"));
        pcl.addPlugin(pluginFile);
    }
public static MMissing load(URL url) throws IOException {
        MMissing ret = new MMissing();
        InputStream is = url.openStream();
        try {
            Reader r = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(r);
            String line;
            while ((line = br.readLine()) != null) {
                if (line.length() > 0) {
                    ret.add(line);
                }
            }
            return ret;
        } finally {
            is.close();
        }
    }
public static void copyFiles(String strPath, String dstPath) throws IOException {
        File src = new File(strPath);
        File dest = new File(dstPath);
        if (src.isDirectory()) {
            dest.mkdirs();
            String list[] = src.list();
            for (int i = 0; i < list.length; i++) {
                String dest1 = dest.getAbsolutePath() + File.separatorChar + list[i];
                String src1 = src.getAbsolutePath() + File.separatorChar + list[i];
                copyFiles(src1, dest1);
            }
        } else {
            FileInputStream fin = new FileInputStream(src);
            FileOutputStream fout = new FileOutputStream(dest);
            int c;
            while ((c = fin.read()) >= 0) fout.write(c);
            fin.close();
            fout.close();
        }
    }
public String generateToken(String code) {
        try {
            MessageDigest md = MessageDigest.getInstance("SHA1");
            md.update(code.getBytes());
            byte[] bytes = md.digest();
            return toHex(bytes);
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("SHA1 missing");
        }
    }