Datasets:
id int32 0 901k | id1 int32 74 23.7M | id2 int32 74 23.7M | func1 stringlengths 234 68.5k | func2 stringlengths 234 68.5k | label bool 2
classes |
|---|---|---|---|---|---|
0 | 13,988,825 | 8,660,836 | private void setNodekeyInJsonResponse(String service) throws Exception {
String filename = this.baseDirectory + service + ".json";
Scanner s = new Scanner(new File(filename));
PrintWriter fw = new PrintWriter(new File(filename + ".new"));
while (s.hasNextLine()) {
fw.prin... | public void transform(String style, String spec, OutputStream out) throws IOException {
URL url = new URL(rootURL, spec);
InputStream in = new PatchXMLSymbolsStream(new StripDoctypeStream(url.openStream()));
transform(style, in, out);
in.close();
}
| false |
1 | 80,378 | 18,548,122 | public static void test(String args[]) {
int trace;
int bytes_read = 0;
int last_contentLenght = 0;
try {
BufferedReader reader;
URL url;
url = new URL(args[0]);
URLConnection istream = url.openConnection();
last_contentLeng... | private static String loadUrlToString(String a_url) throws IOException {
URL l_url1 = new URL(a_url);
BufferedReader br = new BufferedReader(new InputStreamReader(l_url1.openStream()));
String l_content = "";
String l_ligne = null;
l_content = br.readLine();
while ((l... | true |
2 | 21,354,223 | 7,421,563 | public String kodetu(String testusoila) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(testusoila.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
new MezuLeiho("Ez da zifraketa algoritmoa aurkitu", "Ados", "Zif... | private StringBuffer encoder(String arg) {
if (arg == null) {
arg = "";
}
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(arg.getBytes(SysConstant.charset));
} catch (Exception e) {
e.printStac... | true |
3 | 15,826,299 | 19,728,871 | public static void printResponseHeaders(String address) {
logger.info("Address: " + address);
try {
URL url = new URL(address);
URLConnection conn = url.openConnection();
for (int i = 0; ; i++) {
String headerName = conn.getHeaderFieldKey(i);
... | public static String getEncodedPassword(String buff) {
if (buff == null) return null;
String t = new String();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(buff.getBytes());
byte[] r = md.digest();
for (int i = 0; i < r.... | false |
4 | 9,938,081 | 11,517,213 | public void load(String fileName) {
BufferedReader bufReader;
loaded = false;
vector.removeAllElements();
try {
if (fileName.startsWith("http:")) {
URL url = new URL(fileName);
bufReader = new BufferedReader(new InputStreamReader(url.openSt... | private static void copyFile(File sourceFile, File destFile) {
try {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream... | false |
5 | 18,220,543 | 17,366,812 | private MapProperties readProperties(URL url) {
@SuppressWarnings("unchecked") MapProperties properties = new MapProperties(new LinkedHashMap());
InputStream is = null;
try {
is = url.openStream();
properties.load(is);
} catch (IOException ex) {
th... | public String tranportRemoteUnitToLocalTempFile(String urlStr) throws UnitTransportException {
InputStream input = null;
BufferedOutputStream bos = null;
File tempUnit = null;
try {
URL url = null;
int total = 0;
try {
url = new URL... | false |
6 | 22,328,849 | 17,334,846 | protected void doRestoreOrganize() throws Exception {
Connection con = null;
PreparedStatement ps = null;
ResultSet result = null;
String strDelQuery = "DELETE FROM " + Common.ORGANIZE_TABLE;
String strSelQuery = "SELECT organize_id,organize_type_id,organize_name,organize_man... | static String encodeEmailAsUserId(String email) {
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(email.toLowerCase().getBytes());
StringBuilder builder = new StringBuilder();
builder.append("1");
for (byte b : md5.digest()) ... | false |
7 | 19,130,322 | 15,710,690 | private String sha1(String s) {
String encrypt = s;
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
sha.update(s.getBytes());
byte[] digest = sha.digest();
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < di... | @SuppressWarnings("unused")
private String getMD5(String value) {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
return "";
}
md5.reset();
md5.update(value.getBytes());
byte[]... | true |
8 | 1,111,832 | 789,472 | private void storeFieldMap(WorkingContent c, Connection conn) throws SQLException {
SQLDialect dialect = getDatabase().getSQLDialect();
if (TRANSACTIONS_ENABLED) {
conn.setAutoCommit(false);
}
try {
Object thisKey = c.getPrimaryKey();
deleteFieldCo... | public void elimina(Pedido pe) throws errorSQL, errorConexionBD {
System.out.println("GestorPedido.elimina()");
int id = pe.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM pedido WHERE id=" + id;
System.out.... | true |
9 | 7,046,481 | 18,317,332 | public InlineImageChunk(URL url) {
super();
this.url = url;
try {
URLConnection urlConn = url.openConnection();
urlConn.setReadTimeout(15000);
ImageInputStream iis = ImageIO.createImageInputStream(urlConn.getInputStream());
Iterator<ImageReader... | void execute(Connection conn, Component parent, String context, final ProgressMonitor progressMonitor, ProgressWrapper progressWrapper) throws Exception {
int noOfComponents = m_components.length;
Statement statement = null;
StringBuffer pmNoteBuf = new StringBuffer(m_update ... | false |
10 | 190,292 | 978,946 | private static void main(String[] args) {
try {
File f = new File("test.txt");
if (f.exists()) {
throw new IOException(f + " already exists. I don't want to overwrite it.");
}
StraightStreamReader in;
char[] cbuf = new char[0x1000]... | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | true |
11 | 19,653,581 | 9,312,243 | public List<SuspectFileProcessingStatus> retrieve() throws Exception {
BufferedOutputStream bos = null;
try {
String listFilePath = GeneralUtils.generateAbsolutePath(getDownloadDirectoryPath(), getListName(), "/");
listFilePath = listFilePath.concat(".xml");
if (!... | void shutdown(final boolean unexpected) {
if (unexpected) {
log.warn("S H U T D O W N --- received unexpected shutdown request.");
} else {
log.info("S H U T D O W N --- start regular shutdown.");
}
if (this.uncaughtException != null) {
log... | true |
12 | 369,572 | 4,761,833 | private void displayDiffResults() throws IOException {
File outFile = File.createTempFile("diff", ".htm");
outFile.deleteOnExit();
FileOutputStream outStream = new FileOutputStream(outFile);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(outStream));
out.write... | private void copyFileToDir(MyFile file, MyFile to, wlPanel panel) throws IOException {
Utilities.print("started copying " + file.getAbsolutePath() + "\n");
FileOutputStream fos = new FileOutputStream(new File(to.getAbsolutePath()));
FileChannel foc = fos.getChannel();
FileInputStream... | true |
13 | 2,285,441 | 16,987,999 | static synchronized Person lookup(PhoneNumber number, String siteName) {
Vector<Person> foundPersons = new Vector<Person>(5);
if (number.isFreeCall()) {
Person p = new Person("", "FreeCall");
p.addNumber(number);
foundPersons.add(p);
} else if (number.isSI... | private void copyFile(File sourceFile, File destFile) throws IOException {
if (!sourceFile.exists()) {
return;
}
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
source = n... | false |
14 | 13,041,693 | 116,038 | @Override
public void vote(String urlString, Map<String, String> headData, Map<String, String> paramData) {
HttpURLConnection httpConn = null;
try {
URL url = new URL(urlString);
httpConn = (HttpURLConnection) url.openConnection();
String cookies = getCookies(... | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | false |
15 | 14,157,859 | 3,791,822 | static void copyFile(File file, File file1) throws IOException {
byte abyte0[] = new byte[512];
FileInputStream fileinputstream = new FileInputStream(file);
FileOutputStream fileoutputstream = new FileOutputStream(file1);
int i;
while ((i = fileinputstream.read(abyte0)) > 0) ... | public Void doInBackground() {
setProgress(0);
for (int i = 0; i < uploadFiles.size(); i++) {
String filePath = uploadFiles.elementAt(i).getFilePath();
String fileName = uploadFiles.elementAt(i).getFileName();
String fileMsg = "Uploading fi... | true |
16 | 23,270,032 | 21,907,871 | public void checkin(Object _document) {
this.document = (Document) _document;
synchronized (url) {
OutputStream outputStream = null;
try {
if ("file".equals(url.getProtocol())) {
outputStream = new FileOutputStream(url.getFile());
... | public static void extractFile(String jarArchive, String fileToExtract, String destination) {
FileWriter writer = null;
ZipInputStream zipStream = null;
try {
FileInputStream inputStream = new FileInputStream(jarArchive);
BufferedInputStream bufferedStream = new Buffe... | false |
17 | 17,586,131 | 14,533,184 | protected void update(String sql, Object[] args) {
Connection conn = null;
PreparedStatement pstmt = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
pstmt = conn.prepareStatement(sql);
this.setParameters(pstmt, args);
... | public boolean delete(int id) {
boolean deletionOk = false;
Connection conn = null;
try {
conn = db.getConnection();
conn.setAutoCommit(false);
String sql = "DELETE FROM keyphrases WHERE website_id=?";
PreparedStatement ps = conn.prepareStateme... | true |
18 | 18,865,693 | 1,477,578 | private static void copyFile(File inputFile, File outputFile) throws IOException {
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
}
| public static void copy(FileInputStream source, FileOutputStream dest) throws IOException {
FileChannel in = null, out = null;
try {
in = source.getChannel();
out = dest.getChannel();
long size = in.size();
MappedByteBuffer buf = in.map(FileChannel.Map... | true |
19 | 5,506,807 | 10,176,882 | public void testPreparedStatement0009() throws Exception {
Statement stmt = con.createStatement();
stmt.executeUpdate("create table #t0009 " + " (i integer not null, " + " s char(10) not null) ");
con.setAutoCommit(false);
PreparedStatement pstmt = con.prepareStatemen... | @SuppressWarnings("unchecked")
protected void processDownloadAction(HttpServletRequest request, HttpServletResponse response) throws Exception {
File transformationFile = new File(xslBase, "file-info.xsl");
HashMap<String, Object> params = new HashMap<String, Object>();
params.putAll(req... | false |
20 | 2,746,011 | 5,105,540 | @RequestMapping(value = "/privatefiles/{file_name}")
public void getFile(@PathVariable("file_name") String fileName, HttpServletResponse response, Principal principal) {
try {
Boolean validUser = false;
final String currentUser = principal.getName();
Authentication au... | public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
if (TDebug.TraceAudioFileReader) {
TDebug.out("MpegAudioFileReader.getAudioInputStream(URL): begin");
}
long lFileLengthInBytes = AudioSystem.NOT_SPECIFIED;
URLConnect... | false |
21 | 3,287,282 | 13,431,536 | public void googleImageSearch(String start) {
try {
String u = "http://images.google.com/images?q=" + custom + start;
if (u.contains(" ")) {
u = u.replace(" ", "+");
}
URL url = new URL(u);
HttpURLConnection httpcon = (HttpURLConnec... | @Override
public int updateStatus(UserInfo userInfo, String status) throws Exception {
OAuthConsumer consumer = SnsConstant.getOAuthConsumer(SnsConstant.SOHU);
consumer.setTokenWithSecret(userInfo.getAccessToken(), userInfo.getAccessSecret());
try {
URL url = new URL(SnsConst... | false |
22 | 16,744,397 | 18,315,736 | public void copyToZip(ZipOutputStream zout, String entryName) throws IOException {
close();
ZipEntry entry = new ZipEntry(entryName);
zout.putNextEntry(entry);
if (!isEmpty() && this.tmpFile.exists()) {
InputStream in = new FileInputStream(this.tmpFile);
IOUti... | private List<String> getTaxaList() {
List<String> taxa = new Vector<String>();
String domain = m_domain.getStringValue();
String id = "";
if (domain.equalsIgnoreCase("Eukaryota")) id = "eukaryota";
try {
URL url = new URL("http://www.ebi.ac.uk/genomes/" + id + ".d... | false |
23 | 18,269,744 | 10,140,251 | public static boolean encodeFileToFile(String infile, String outfile) {
boolean success = false;
java.io.InputStream in = null;
java.io.OutputStream out = null;
try {
in = new Base64.InputStream(new java.io.BufferedInputStream(new java.io.FileInputStream(infile)), Base64.... | protected String contentString() {
String result = null;
URL url;
String encoding = null;
try {
url = url();
URLConnection connection = url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(false);
connec... | false |
24 | 14,876,163 | 3,260,787 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public CopyAllDataToOtherFolderResponse CopyAllDataToOtherFolder(DPWSContext context, CopyAllDataToOtherFolder CopyAllDataInps) throws DPWSException {
CopyAllDataToOtherFolderResponse cpyRp = new CopyAllDataToOtherFolderResponseImpl();
int hany = 0;
String errorMsg = null;
try {
... | true |
25 | 14,313,659 | 10,109,343 | private int writeTraceFile(final File destination_file, final String trace_file_name, final String trace_file_path) {
URL url = null;
BufferedInputStream is = null;
FileOutputStream fo = null;
BufferedOutputStream os = null;
int b = 0;
if (destination_file == null) {
... | public void readData() throws IOException {
i = 0;
j = 0;
URL url = getClass().getResource("resources/tuneGridMaster.dat");
InputStream is = url.openStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
s = b... | false |
26 | 13,745,376 | 10,567,003 | public IStatus runInUIThread(IProgressMonitor monitor) {
monitor.beginTask(Strings.MSG_CONNECT_SERVER, 3);
InputStream in = null;
try {
URL url = createOpenUrl(resource, pref);
if (url != null) {
URLConnection con = url.open... | private InputStream loadSource(String url) throws ClientProtocolException, IOException {
HttpClient httpclient = new DefaultHttpClient();
httpclient.getParams().setParameter(HTTP.USER_AGENT, "Mozilla/4.0 (compatible; MSIE 7.0b; Windows NT 6.0)");
HttpGet httpget = new HttpGet(url);
H... | false |
27 | 22,075,089 | 20,623,710 | public static void executa(String arquivo, String filial, String ip) {
String drive = arquivo.substring(0, 2);
if (drive.indexOf(":") == -1) drive = "";
Properties p = Util.lerPropriedades(arquivo);
String servidor = p.getProperty("servidor");
String impressora = p.getPropert... | public static synchronized void repartition(File[] sourceFiles, File targetDirectory, String prefix, long maxUnitBases, long maxUnitEntries) throws Exception {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) throw new Exception("Could not create directory " + targetDirectory.getA... | true |
28 | 19,217,522 | 10,385,493 | boolean copyFileStructure(File oldFile, File newFile) {
if (oldFile == null || newFile == null) return false;
File searchFile = newFile;
do {
if (oldFile.equals(searchFile)) return false;
searchFile = searchFile.getParentFile();
} while (searchFile != null);
... | public void writeBack(File destinationFile, boolean makeCopy) throws IOException {
if (makeCopy) {
FileChannel sourceChannel = new java.io.FileInputStream(getFile()).getChannel();
FileChannel destinationChannel = new java.io.FileOutputStream(destinationFile).getChannel();
... | true |
29 | 7,681,426 | 11,717,079 | public void extractProfile(String parentDir, String fileName, String profileName) {
try {
byte[] buf = new byte[1024];
ZipInputStream zipinputstream = null;
ZipEntry zipentry;
if (createProfileDirectory(profileName, parentDir)) {
debug("the pro... | void copyFile(File inputFile, File outputFile) {
try {
FileReader in;
in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
... | true |
30 | 8,831,301 | 8,365,268 | public void run() {
String s;
s = "";
try {
URL url = new URL("http://www.m-w.com/dictionary/" + word);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String str;
while (((str = in.readLine()) != null) && (!sto... | public static String[] readStats() throws Exception {
URL url = null;
BufferedReader reader = null;
StringBuilder stringBuilder;
try {
url = new URL("http://localhost:" + port + webctx + "/shared/js/libOO/health_check.sjs");
HttpURLConnection connection = (Htt... | true |
31 | 308,643 | 21,172,450 | public void convert(File src, File dest) throws IOException {
InputStream in = new BufferedInputStream(new FileInputStream(src));
DcmParser p = pfact.newDcmParser(in);
Dataset ds = fact.newDataset();
p.setDcmHandler(ds.getDcmHandler());
try {
FileFormat format = p... | public static void unzip2(String strZipFile, String folder) throws IOException, ArchiveException {
FileUtil.fileExists(strZipFile, true);
final InputStream is = new FileInputStream(strZipFile);
ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
Zi... | true |
32 | 11,322,573 | 3,224,152 | private void preprocessObjects(GeoObject[] objects) throws IOException {
System.out.println("objects.length " + objects.length);
for (int i = 0; i < objects.length; i++) {
String fileName = objects[i].getPath();
int dotindex = fileName.lastIndexOf(".");
dotindex =... | private String transferWSDL(String usernameAndPassword) throws WiseConnectionException {
String filePath = null;
try {
URL endpoint = new URL(wsdlURL);
HttpURLConnection conn = (HttpURLConnection) endpoint.openConnection();
conn.setDoOutput(false);
con... | true |
33 | 13,569,337 | 11,394,767 | public static String getMD5HashFromString(String message) {
String hashword = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(message.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
hashword = hash.toString(... | public static byte[] gerarHash(String frase) {
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
md.update(frase.getBytes());
return md.digest();
} catch (NoSuchAlgorithmException e) {
return null;
}
}
| true |
34 | 254,039 | 16,016,623 | protected void doDownload(S3Bucket bucket, S3Object s3object) throws Exception {
String key = s3object.getKey();
key = trimPrefix(key);
String[] path = key.split("/");
String fileName = path[path.length - 1];
String dirPath = "";
for (int i = 0; i < path.length - 1; i... | @Override
protected ModelAndView handleRequestInternal(final HttpServletRequest request, final HttpServletResponse response) throws Exception {
final String filename = ServletRequestUtils.getRequiredStringParameter(request, "id");
final File file = new File(path, filename + ".html");
log... | true |
35 | 4,147,990 | 1,663,419 | public static void copyFile(File dst, File src, boolean append) throws FileNotFoundException, IOException {
dst.createNewFile();
FileChannel in = new FileInputStream(src).getChannel();
FileChannel out = new FileOutputStream(dst).getChannel();
long startAt = 0;
if (append) sta... | private static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExce... | true |
36 | 16,603,670 | 12,576,210 | private String generateUniqueIdMD5(String workgroupIdString, String runIdString) {
String passwordUnhashed = workgroupIdString + "-" + runIdString;
MessageDigest m = null;
try {
m = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmExceptio... | public static FTPClient createConnection(String hostname, int port, char[] username, char[] password, String workingDirectory, FileSystemOptions fileSystemOptions) throws FileSystemException {
if (username == null) username = "anonymous".toCharArray();
if (password == null) password = "anonymous".to... | false |
37 | 19,825,038 | 9,385,633 | public static byte[] post(String path, Map<String, String> params, String encode) throws Exception {
StringBuilder parambuilder = new StringBuilder("");
if (params != null && !params.isEmpty()) {
for (Map.Entry<String, String> entry : params.entrySet()) {
parambuilder.app... | protected void setRankOrder() {
this.rankOrder = new int[values.length];
for (int i = 0; i < rankOrder.length; i++) {
rankOrder[i] = i;
assert (!Double.isNaN(values[i]));
}
for (int i = rankOrder.length - 1; i >= 0; i--) {
boolean swapped = false;
... | false |
38 | 810,724 | 22,207,815 | private static void readAndRewrite(File inFile, File outFile) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new BufferedInputStream(new FileInputStream(inFile)));
DcmParser dcmParser = DcmParserFactory.getInstance().newDcmParser(iis);
Dataset ds = DcmObjectFactor... | public static Checksum checksum(File file, Checksum checksum) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
InputStream in = null;
try {
in = new CheckedInputStream(new FileIn... | true |
39 | 1,643,091 | 23,277,837 | private static void download(String urlString) throws IOException {
URL url = new URL(urlString);
url = handleRedirectUrl(url);
URLConnection cn = url.openConnection();
Utils.setHeader(cn);
long fileLength = cn.getContentLength();
Statics.getInstance().setFileLength(f... | private File download(String filename, URL url) {
int size = -1;
int received = 0;
try {
fireDownloadStarted(filename);
File file = createFile(filename);
BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));
System.out.println("下载资源:" + filename + ", url=" + url);
// Buf... | false |
40 | 1,214,975 | 21,172,450 | public static void writeToFile(InputStream input, File file, ProgressListener listener, long length) {
OutputStream output = null;
try {
output = new CountingOutputStream(new FileOutputStream(file), listener, length);
IOUtils.copy(input, output);
} catch (IOException ... | public static void unzip2(String strZipFile, String folder) throws IOException, ArchiveException {
FileUtil.fileExists(strZipFile, true);
final InputStream is = new FileInputStream(strZipFile);
ArchiveInputStream in = new ArchiveStreamFactory().createArchiveInputStream("zip", is);
Zi... | true |
41 | 9,070,085 | 17,832,320 | public String getMd5CodeOf16(String str) {
StringBuffer buf = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(str.getBytes());
byte b[] = md.digest();
int i;
buf = new StringBuffer("");
for (int offset... | public void run() {
Pair p = null;
try {
while ((p = queue.pop()) != null) {
GetMethod get = new GetMethod(p.getRemoteUri());
try {
get.setFollowRedirects(true);
get.setRequestHeader("Mariner-Application", "prerender... | false |
42 | 10,445,018 | 19,295,210 | public String MD5(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
retu... | public static String generateHash(String value) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(value.getBytes());
} catch (NoSuchAlgorithmException e) {
log.error("Could not find the requested ... | true |
43 | 6,988,217 | 701,471 | public void testQueryForBinary() throws InvalidNodeTypeDefException, ParseException, Exception {
JCRNodeSource source = (JCRNodeSource) resolveSource(BASE_URL + "images/photo.png");
assertNotNull(source);
assertEquals(false, source.exists());
OutputStream os = source.getOutputStream(... | private boolean enregistreToi() {
PrintWriter lEcrivain;
String laDest = "./img_types/" + sonImage;
if (!new File("./img_types").exists()) {
new File("./img_types").mkdirs();
}
try {
FileChannel leFicSource = new FileInputStream(sonFichier).getChannel(... | true |
44 | 4,855,600 | 12,853,333 | public void schema(final Row row, TestResults testResults) throws Exception {
String urlString = row.text(1);
String schemaBase = null;
if (row.cellExists(2)) {
schemaBase = row.text(2);
}
try {
StreamSource schemaSource;
if (urlString.star... | public static String getURLContent(String href) throws BuildException {
URL url = null;
String content;
try {
URL context = new URL("file:" + System.getProperty("user.dir") + "/");
url = new URL(context, href);
InputStream is = url.openStream();
... | false |
45 | 1,989,226 | 11,961,013 | public void actualizar() throws SQLException, ClassNotFoundException, Exception {
Connection conn = null;
PreparedStatement ms = null;
registroActualizado = false;
try {
conn = ToolsBD.getConn();
conn.setAutoCommit(false);
Date fechaSystem = new Da... | public static Builder fromURL(URL url) {
try {
InputStream in = null;
try {
in = url.openStream();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int read = -1;
byte[] buf = new byte[4096];
whi... | false |
46 | 15,596,950 | 14,782,656 | private static ImageIcon tryLoadImageIconFromResource(String filename, String path, int width, int height) {
ImageIcon icon = null;
try {
URL url = cl.getResource(path + pathSeparator + fixFilename(filename));
if (url != null && url.openStream() != null) {
ico... | private static Long statusSWGCraftTime() {
long current = System.currentTimeMillis() / 1000L;
if (current < (previousStatusCheck + SWGCraft.STATUS_CHECK_DELAY)) return previousStatusTime;
URL url = null;
try {
synchronized (previousStatusTime) {
if (curren... | false |
47 | 249,428 | 6,166,363 | public boolean onStart() {
log("Starting up, this may take a minute...");
gui = new ApeAtollGUI();
gui.setVisible(true);
while (waitGUI) {
sleep(100);
}
URLConnection url = null;
BufferedReader in = null;
BufferedWriter out = null;
... | private static byte[] gerarHash(String frase) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(frase.getBytes());
return md.digest();
} catch (Exception e) {
return null;
}
}
| false |
48 | 6,751,999 | 18,761,618 | public static void main(String[] args) throws Exception {
TripleDES tdes = new TripleDES();
StreamBlockReader reader = new StreamBlockReader(new FileInputStream("D:\\test.txt"));
StreamBlockWriter writer = new StreamBlockWriter(new FileOutputStream("D:\\testTDESENC.txt"));
SingleKey ... | private FileInputStream getPackageStream(String archivePath) throws IOException, PackageManagerException {
final int lastSlashInName = filename.lastIndexOf("/");
final String newFileName = filename.substring(lastSlashInName);
File packageFile = new File((new StringBuilder()).append(archivePa... | true |
49 | 19,193,813 | 18,568,751 | public void writeTo(File f) throws IOException {
if (state != STATE_OK) throw new IllegalStateException("Upload failed");
if (tempLocation == null) throw new IllegalStateException("File already saved");
if (f.isDirectory()) f = new File(f, filename);
FileInputStream fis = new FileInp... | public static Boolean decompress(File source, File destination) {
FileOutputStream outputStream;
ZipInputStream inputStream;
try {
outputStream = null;
inputStream = new ZipInputStream(new FileInputStream(source));
int read;
byte buffer[] = new... | true |
50 | 418,257 | 21,900,384 | public BufferedWriter createOutputStream(String inFile, String outFile) throws IOException {
int k_blockSize = 1024;
int byteCount;
char[] buf = new char[k_blockSize];
File ofp = new File(outFile);
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(ofp));
... | @Override
protected ActionForward executeAction(ActionMapping mapping, ActionForm form, User user, HttpServletRequest request, HttpServletResponse response) throws Exception {
long resourceId = ServletRequestUtils.getLongParameter(request, "resourceId", 0L);
String attributeIdentifier = request.... | true |
Dataset Card for "code_x_glue_cc_clone_detection_big_clone_bench"
Dataset Summary
CodeXGLUE Clone-detection-BigCloneBench dataset, available at https://github.com/microsoft/CodeXGLUE/tree/main/Code-Code/Clone-detection-BigCloneBench
Given two codes as the input, the task is to do binary classification (0/1), where 1 stands for semantic equivalence and 0 for others. Models are evaluated by F1 score. The dataset we use is BigCloneBench and filtered following the paper Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree.
Supported Tasks and Leaderboards
semantic-similarity-classification: The dataset can be used to train a model for classifying if two given java methods are cloens of each other.
Languages
- Java programming language
Dataset Structure
Data Instances
An example of 'test' looks as follows.
{
"func1": " @Test(expected = GadgetException.class)\n public void malformedGadgetSpecIsCachedAndThrows() throws Exception {\n HttpRequest request = createCacheableRequest();\n expect(pipeline.execute(request)).andReturn(new HttpResponse(\"malformed junk\")).once();\n replay(pipeline);\n try {\n specFactory.getGadgetSpec(createContext(SPEC_URL, false));\n fail(\"No exception thrown on bad parse\");\n } catch (GadgetException e) {\n }\n specFactory.getGadgetSpec(createContext(SPEC_URL, false));\n }\n",
"func2": " public InputStream getInputStream() throws TGBrowserException {\n try {\n if (!this.isFolder()) {\n URL url = new URL(this.url);\n InputStream stream = url.openStream();\n return stream;\n }\n } catch (Throwable throwable) {\n throw new TGBrowserException(throwable);\n }\n return null;\n }\n",
"id": 0,
"id1": 2381663,
"id2": 4458076,
"label": false
}
Data Fields
In the following each data field in go is explained for each config. The data fields are the same among all splits.
default
| field name | type | description |
|---|---|---|
| id | int32 | Index of the sample |
| id1 | int32 | The first function id |
| id2 | int32 | The second function id |
| func1 | string | The full text of the first function |
| func2 | string | The full text of the second function |
| label | bool | 1 is the functions are not equivalent, 0 otherwise |
Data Splits
| name | train | validation | test |
|---|---|---|---|
| default | 901028 | 415416 | 415416 |
Dataset Creation
Curation Rationale
[More Information Needed]
Source Data
Initial Data Collection and Normalization
Data was mined from the IJaDataset 2.0 dataset. [More Information Needed]
Who are the source language producers?
[More Information Needed]
Annotations
Annotation process
Data was manually labeled by three judges by automatically identifying potential clones using search heuristics. [More Information Needed]
Who are the annotators?
[More Information Needed]
Personal and Sensitive Information
[More Information Needed]
Considerations for Using the Data
Social Impact of Dataset
[More Information Needed]
Discussion of Biases
Most of the clones are type 1 and 2 with type 3 and especially type 4 being rare.
[More Information Needed]
Other Known Limitations
[More Information Needed]
Additional Information
Dataset Curators
https://github.com/microsoft, https://github.com/madlag
Licensing Information
Computational Use of Data Agreement (C-UDA) License.
Citation Information
@inproceedings{svajlenko2014towards,
title={Towards a big data curated benchmark of inter-project code clones},
author={Svajlenko, Jeffrey and Islam, Judith F and Keivanloo, Iman and Roy, Chanchal K and Mia, Mohammad Mamun},
booktitle={2014 IEEE International Conference on Software Maintenance and Evolution},
pages={476--480},
year={2014},
organization={IEEE}
}
@inproceedings{wang2020detecting,
title={Detecting Code Clones with Graph Neural Network and Flow-Augmented Abstract Syntax Tree},
author={Wang, Wenhan and Li, Ge and Ma, Bo and Xia, Xin and Jin, Zhi},
booktitle={2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER)},
pages={261--271},
year={2020},
organization={IEEE}
}
Contributions
Thanks to @madlag (and partly also @ncoop57) for adding this dataset.
- Downloads last month
- 1,005