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 |
|---|---|---|---|---|---|
1,200 | 9,857,940 | 6,182,433 | public void run(IAction action) {
int style = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getStyle();
Shell shell = new Shell((style & SWT.MIRRORED) != 0 ? SWT.RIGHT_TO_LEFT : SWT.NONE);
GraphicalViewer viewer = new ScrollingGraphicalViewer();
viewer.createControl... | public String calculateProjectMD5(String scenarioName) throws Exception {
Scenario s = ScenariosManager.getInstance().getScenario(scenarioName);
s.loadParametersAndValues();
String scenarioMD5 = calculateScenarioMD5(s);
Map<ProjectComponent, String> map = getProjectMD5(new ProjectCom... | false |
1,201 | 7,350,139 | 2,099,972 | public static void messageDigestTest() {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update("computer".getBytes());
md.update("networks".getBytes());
System.out.println(new String(md.digest()));
System.out.println(new String(md.di... | public static void copyResource(String args) {
try {
URL url = copyURL.class.getResource(args);
InputStream is = url.openStream();
System.out.flush();
FileOutputStream fos = null;
fos = new FileOutputStream(System.getProperty("user.home") + "/JavaC... | false |
1,202 | 16,810,590 | 23,677,119 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | public static void copyFile6(File srcFile, File destFile) throws FileNotFoundException {
Scanner s = new Scanner(srcFile);
PrintWriter pw = new PrintWriter(destFile);
while(s.hasNextLine()) {
pw.println(s.nextLine());
}
pw.close();
s.close();
}
| false |
1,203 | 8,211,013 | 19,040,459 | protected byte[] computeHash() {
try {
final MessageDigest inputHash = MessageDigest.getInstance("SHA");
inputHash.update(bufferFileData().getBytes());
return inputHash.digest();
} catch (final NoSuchAlgorithmException nsae) {
lastException = nsae;
... | public static String getMD5(final String text) {
if (null == text) return null;
final MessageDigest algorithm;
try {
algorithm = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
algorithm... | true |
1,204 | 23,291,433 | 19,360,796 | public static String sendRequest(String urlstring) {
URL url;
String line;
Log.i("DVBMonitor", "Please wait while receiving data from dvb...");
try {
url = new URL(urlstring);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
... | private Set read() throws IOException {
URL url = new URL(urlPrefix + channelId + ".dat");
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String line = in.readLine();
Set programs = new HashSet();
while (line != null) {
String[] v... | true |
1,205 | 18,804,133 | 17,423,090 | public static String encryptPassword(String password) {
if (password == null) return null;
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
log.error("Algorithm not found", e);
r... | @Override
public void discoverPlugIns() throws PlugInManagerException {
LOG.info("Discovering plug-ins defined in JAR manifests...");
ClassLoader classLoader = this.getClass().getClassLoader();
Enumeration<URL> manifests = null;
try {
manifests = classLoader.getResour... | false |
1,206 | 11,838,691 | 13,247,325 | private void externalizeFiles(Document doc, File out) throws IOException {
File[] files = doc.getImages();
if (files.length > 0) {
File dir = new File(out.getParentFile(), out.getName() + ".images");
if (!dir.mkdirs()) throw new IOException("cannot create directory " + dir);
... | @Override
public String getPath() {
InputStream in = null;
OutputStream out = null;
File file = null;
try {
file = File.createTempFile("java-storage_" + RandomStringUtils.randomAlphanumeric(32), ".tmp");
file.deleteOnExit();
out = new FileOutpu... | true |
1,207 | 9,869,150 | 708,766 | private String unJar(String jarPath, String jarEntry) {
String path;
if (jarPath.lastIndexOf("lib/") >= 0) path = jarPath.substring(0, jarPath.lastIndexOf("lib/")); else path = jarPath.substring(0, jarPath.lastIndexOf("/"));
String relPath = jarEntry.substring(0, jarEntry.lastIndexOf("/"));
... | 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... | true |
1,208 | 14,137,256 | 7,038,631 | private final void copyTargetFileToSourceFile(File sourceFile, File targetFile) throws MJProcessorException {
if (!targetFile.exists()) {
targetFile.getParentFile().mkdirs();
try {
if (!targetFile.exists()) {
targetFile.createNewFile();
... | private FileLog(LOG_LEVEL displayLogLevel, LOG_LEVEL logLevel, String logPath) {
this.logLevel = logLevel;
this.displayLogLevel = displayLogLevel;
if (null != logPath) {
logFile = new File(logPath, "current.log");
log(LOG_LEVEL.DEBUG, "FileLog", "Initialising logfile ... | true |
1,209 | 15,588,201 | 14,297,060 | public void copy(File source, File destination) {
try {
FileInputStream fileInputStream = new FileInputStream(source);
FileOutputStream fileOutputStream = new FileOutputStream(destination);
FileChannel inputChannel = fileInputStream.getChannel();
FileChannel o... | static boolean generateKey() throws NoSuchAlgorithmException {
java.util.Random rand = new Random(reg_name.hashCode() + System.currentTimeMillis());
DecimalFormat vf = new DecimalFormat("000");
ccKey = keyProduct + FIELD_SEPERATOR + keyType + FIELD_SEPERATOR + keyQuantity + FIELD_SEPERATOR +... | false |
1,210 | 20,019,830 | 20,954,717 | public static void fileCopy(File sourceFile, File destFile) throws IOException {
FileChannel source = null;
FileChannel destination = null;
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(sourceFile);
fos = new ... | private static final void copyFile(File srcFile, File destDir, byte[] buffer) {
try {
File destFile = new File(destDir, srcFile.getName());
InputStream in = new FileInputStream(srcFile);
OutputStream out = new FileOutputStream(destFile);
int bytesRead;
... | true |
1,211 | 18,034,373 | 7,158,123 | public static void copyFile(File src, File dest) throws IOException, IllegalArgumentException {
if (src.isDirectory()) throw new IllegalArgumentException("Source file is a directory");
if (dest.isDirectory()) throw new IllegalArgumentException("Destination file is a directory");
int bufferSi... | public void truncateLog(long finalZxid) throws IOException {
long highestZxid = 0;
for (File f : dataDir.listFiles()) {
long zxid = isValidSnapshot(f);
if (zxid == -1) {
LOG.warn("Skipping " + f);
continue;
}
if (zxid > ... | true |
1,212 | 11,358,121 | 2,463,366 | public void run() {
try {
putEvent(new DebugEvent("about to place HTTP request"));
HttpGet req = new HttpGet(requestURL);
req.addHeader("Connection", "close");
HttpResponse httpResponse = httpClient.execute(req);
putEven... | public Object run() {
if (type == GET_THEME_DIR) {
String sep = File.separator;
String[] dirs = new String[] { userHome + sep + ".themes", System.getProperty("swing.metacitythemedir"), "/usr/share/themes", "/usr/gnome/share/themes", "/opt/gnome2/share/themes" };
... | false |
1,213 | 10,193,598 | 10,174,077 | public static String encodePassword(String password) {
try {
MessageDigest messageDiegest = MessageDigest.getInstance("SHA-1");
messageDiegest.update(password.getBytes("UTF-8"));
return Base64.encodeToString(messageDiegest.digest(), false);
} catch (NoSuchAlgorith... | public static String MD5(String text) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5ha... | true |
1,214 | 18,048,834 | 7,505,934 | public void delete(DeleteInterceptorChain chain, DistinguishedName dn, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + this.dbInsertName);
if (con == null) {
throw new LDAPException("Operations Error", LDAP... | public static byte[] generateAuthId(String userName, String password) {
byte[] ret = new byte[16];
try {
MessageDigest messageDigest = MessageDigest.getInstance("MD5");
String str = userName + password;
messageDigest.update(str.getBytes());
ret = messa... | false |
1,215 | 1,913,136 | 637,320 | private void copyFile(File in, File out) throws Exception {
FileChannel sourceChannel = new FileInputStream(in).getChannel();
FileChannel destinationChannel = new FileOutputStream(out).getChannel();
sourceChannel.transferTo(0, sourceChannel.size(), destinationChannel);
sourceChannel.... | public void uploadFile(File inputFile, String targetFile) throws IOException {
System.out.println("Uploading " + inputFile.getName() + " to " + targetFile);
File outputFile = new File(targetFile);
if (targetFile.endsWith("/")) {
outputFile = new File(outputFile, inputFile.getName... | true |
1,216 | 13,591,323 | 13,422,842 | private void downloadFiles() throws SocketException, IOException {
HashSet<String> files_set = new HashSet<String>();
boolean hasWildcarts = false;
FTPClient client = new FTPClient();
for (String file : downloadFiles) {
files_set.add(file);
if (file.contains(W... | public EVECalcControllerImpl(EVECalcView gui) {
this.view = gui;
properties = new Properties();
try {
InputStream resStream;
resStream = getClass().getResourceAsStream(REGION_PROPERTIES);
if (resStream == null) {
System.out.println("Loading... | false |
1,217 | 1,044,656 | 15,338,765 | public void open(String server, String user, String pass, int port, String option) throws Exception {
log.info("Login to FTP: " + server);
this.port = port;
ftp = new FTPClient();
ftp.connect(server, port);
ftp.login(user, pass);
checkReply("FTP server refused connect... | public void upload() throws UnknownHostException, SocketException, FTPConnectionClosedException, LoginFailedException, DirectoryChangeFailedException, CopyStreamException, RefusedConnectionException, IOException {
final int NUM_XML_FILES = 2;
final String META_XML_SUFFIX = "_meta.xml";
final... | true |
1,218 | 4,854,974 | 4,502,456 | public void GetFile(ClientConnector cc, Map<String, String> attributes) throws Exception {
log.debug("Starting FTP FilePull");
String sourceNode = attributes.get("src_name");
String sourceUser = attributes.get("src_user");
String sourcePassword = attributes.get("src_password");
... | public void initGet() throws Exception {
cl = new FTPClient();
URL url = new URL(getURL());
cl.setRemoteHost(url.getHost());
cl.connect();
cl.login(user, pass);
cl.setType(FTPTransferType.BINARY);
cl.setConnectMode(FTPConnectMode.PASV);
cl.restart(getP... | true |
1,219 | 16,583,451 | 12,524,253 | private static void setEnvEntry(File fromEAR, File toEAR, String ejbJarName, String envEntryName, String envEntryValue) throws Exception {
ZipInputStream earFile = new ZipInputStream(new FileInputStream(fromEAR));
FileOutputStream fos = new FileOutputStream(toEAR);
ZipOutputStream tempZip = ... | public DialogSongList(JFrame frame) {
super(frame, "Menu_SongList", "songList");
setMinimumSize(new Dimension(400, 200));
JPanel panel, spanel;
Container contentPane;
(contentPane = getContentPane()).add(songSelector = new SongSelector(configKey, null, true));
songSel... | true |
1,220 | 4,301,327 | 5,365,678 | private String doRawGet(URI uri) throws XdsInternalException {
HttpURLConnection conn = null;
String response = null;
try {
URL url;
try {
url = uri.toURL();
} catch (Exception e) {
throw HttpClient.getException(e, uri.toStr... | public void buildDocument(Files page) {
String uri = constructFileUrlString(page, true);
URL url;
try {
url = new URL(uri);
URLConnection connection = url.openConnection();
InputStream in = connection.getInputStream();
Reader reader = new Input... | false |
1,221 | 2,684,283 | 7,126,817 | private InputStream openConnection(URL url) throws IOException, DODSException {
connection = url.openConnection();
if (acceptDeflate) connection.setRequestProperty("Accept-Encoding", "deflate");
connection.connect();
InputStream is = null;
int retry = 1;
long backoff ... | private static String getRegistrationClasses() {
CentralRegistrationClass c = new CentralRegistrationClass();
String name = c.getClass().getCanonicalName().replace('.', '/').concat(".class");
try {
Enumeration<URL> urlEnum = c.getClass().getClassLoader().getResources("META-INF/MA... | false |
1,222 | 22,365,062 | 7,283,902 | private void inject(int x, int y) throws IOException {
Tag source = data.getTag();
Log.event(Log.DEBUG_INFO, "source: " + source.getString());
if (source == Tag.ORGANISM) {
String seed = data.readString();
data.readTag(Tag.STREAM);
... | public static String hashString(String pwd) {
StringBuffer hex = new StringBuffer();
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pwd.getBytes());
byte[] d = md.digest();
String plaintxt;
for (int i = 0; i < d.length... | false |
1,223 | 79,355 | 17,497,944 | 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 void format(File source, File target) {
if (!source.exists()) {
throw new IllegalArgumentException("Source '" + source + " doesn't exist");
}
if (!source.isFile()) {
throw new IllegalArgumentException("Source '" + source + " is not a file");
}
t... | true |
1,224 | 7,574,034 | 14,855,960 | public static String generateHash(String message) throws NoSuchAlgorithmException, UnsupportedEncodingException, DigestException {
MessageDigest digest;
digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(message.getBytes("iso-8859-1"), 0, message.length());
... | private static List<InputMethodDescriptor> loadIMDescriptors() {
String nm = SERVICES + InputMethodDescriptor.class.getName();
Enumeration<URL> en;
LinkedList<InputMethodDescriptor> imdList = new LinkedList<InputMethodDescriptor>();
NativeIM nativeIM = ContextStorage.getNativeIM();
... | false |
1,225 | 5,272,426 | 16,634,836 | public static final String hash(String data) {
MessageDigest digest = null;
if (digest == null) {
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException nsae) {
System.err.println("Failed to load the MD5 MessageDiges... | @Test
public void mockingURLWorks() throws Exception {
URL url = mock(URL.class);
URLConnection urlConnectionMock = mock(URLConnection.class);
when(url.openConnection()).thenReturn(urlConnectionMock);
URLConnection openConnection = url.openConnection();
assertSame(openCon... | false |
1,226 | 13,514,558 | 17,477,953 | public void load(String filename) throws VisbardException {
String defaultFilename = VisbardMain.getSettingsDir() + File.separator + DEFAULT_SETTINGS_FILE;
File defaultFile = new File(defaultFilename);
InputStream settingsInStreamFromFile = null;
try {
sLogger.info("Loadi... | public static void createModelZip(String filename, String tempdir, boolean overwrite) throws Exception {
FileTools.checkOutput(filename, overwrite);
BufferedInputStream origin = null;
FileOutputStream dest = new FileOutputStream(filename);
ZipOutputStream out = new ZipOutputStream(ne... | true |
1,227 | 5,506,807 | 4,598,940 | 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... | public static void retrieveAttachments(RemoteAttachment[] attachments, String id, String projectName, String key, SimpleDateFormat formatter, java.sql.Connection connect) {
if (attachments.length != 0) {
for (RemoteAttachment attachment : attachments) {
attachmentAuthor = attachm... | false |
1,228 | 5,335,270 | 23,299,951 | @Override
public String getData(String blipApiPath, String authHeader) {
try {
URL url = new URL(BLIP_API_URL + blipApiPath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
if (authHeader != null) {
conn.addRequestProperty("Authoriz... | private void readFromFile1() throws DException {
URL url1 = null;
if (url == null) {
url = getClass().getResource("/com/daffodilwoods/daffodildb/utils/parser/parser.schema");
try {
url = new URL(url.getProtocol() + ":" + url.getPath().substring(0, url.getPath(... | true |
1,229 | 892,621 | 14,956,125 | 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... | protected String getLibJSCode() throws IOException {
if (cachedLibJSCode == null) {
InputStream is = getClass().getResourceAsStream(JS_LIB_FILE);
StringWriter output = new StringWriter();
IOUtils.copy(is, output);
cachedLibJSCode = output.toString();
}... | true |
1,230 | 15,904,654 | 18,899,334 | protected static DynamicJasperDesign generateJasperDesign(DynamicReport dr) throws CoreException {
DynamicJasperDesign jd = null;
try {
if (dr.getTemplateFileName() != null) {
log.info("loading template file: " + dr.getTemplateFileName());
log.info("Attemp... | public static void parseSinaGGTJ(ArrayList<String> dataSource, final ArrayList<SinaGGTJBean> sinaGGTJBeanList) throws IOReactorException, InterruptedException {
HttpAsyncClient httpclient = new DefaultHttpAsyncClient();
httpclient.start();
if (dataSource != null && dataSource.size() > 0) {
... | false |
1,231 | 18,790,182 | 20,162,871 | public void testAddingEntries() throws Exception {
DiskCache c = new DiskCache();
{
c.setRoot(rootFolder.getAbsolutePath());
c.setHtmlExtension("htm");
c.setPropertiesExtension("txt");
assertEquals("htm", c.getHtmlExtension());
assertEquals... | public static void copyFile(String f_in, String f_out, boolean remove) throws FileNotFoundException, IOException {
if (remove) {
PogoString readcode = new PogoString(PogoUtil.readFile(f_in));
readcode = PogoUtil.removeLogMessages(readcode);
PogoUtil.writeFile(f_out, readc... | true |
1,232 | 5,435,234 | 2,177,544 | public static String getURLContent(String urlStr) throws MalformedURLException, IOException {
URL url = new URL(urlStr);
log.info("url: " + url);
URLConnection conn = url.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
S... | public static boolean makeBackup(File dir, String sourcedir, String destinationdir, String destinationDirEnding, boolean autoInitialized) {
boolean success = false;
String[] files;
files = dir.list();
File checkdir = new File(destinationdir + System.getProperty("file.separator") + de... | false |
1,233 | 9,547,229 | 20,623,710 | public void run() {
String masterUrl = "http://localhost:" + masterJetty.getLocalPort() + "/solr/replication?command=" + ReplicationHandler.CMD_DETAILS;
URL url;
InputStream stream = null;
try {
url = new URL(masterUrl);
... | 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... | false |
1,234 | 13,667,527 | 691,010 | private Bitmap fetchImage(String urlstr) throws Exception {
URL url;
url = new URL(urlstr);
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setDoInput(true);
c.setRequestProperty("User-Agent", "Agent");
c.connect();
InputStream is = c.getInpu... | 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... | false |
1,235 | 12,894,191 | 506,382 | @Override
public void doHandler(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
String directURL = request.getRequestURL().toString();
response.setCharacterEncoding("gbk");
PrintWriter out = response.getWriter();
try {
... | public static void doVersionCheck(View view) {
view.showWaitCursor();
try {
URL url = new URL(jEdit.getProperty("version-check.url"));
InputStream in = url.openStream();
BufferedReader bin = new BufferedReader(new InputStreamReader(in));
String line;
... | true |
1,236 | 19,322,944 | 1,831,863 | @Test
public void test_lookupType_TooShortName() throws Exception {
URL url = new URL(baseUrl + "/lookupType/A");
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setRequestProperty("Accept", "application/json... | public Document searchRelease(String id) throws Exception {
Document doc = null;
URL url = new URL("http://" + disgogsUrl + "/release/" + id + "?f=xml&api_key=" + apiKey[0]);
HttpURLConnection uc = (HttpURLConnection) url.openConnection();
uc.addRequestProperty("Accept-Encoding", "gz... | false |
1,237 | 17,835,466 | 16,752,474 | private void readXML() throws IOException, SAXException {
DocumentBuilder builder = null;
try {
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
} catch (ParserConfigurationException ex) {
throw new RuntimeException(ex);
}
InputSour... | public HttpResponse executeHttp(final HttpUriRequest request, final int beginExpectedCode, final int endExpectedCode) throws ClientProtocolException, IOException, HttpException {
final HttpResponse response = httpClient.execute(request);
final int statusCode = response.getStatusLine().getStatusCode(... | false |
1,238 | 7,529,744 | 10,654,982 | public Document retrieveDefinition(String uri) throws IOException, UnvalidResponseException {
if (!isADbPediaURI(uri)) throw new IllegalArgumentException("Not a DbPedia Resource URI");
String rawDataUri = fromResourceToRawDataUri(uri);
URL url = new URL(rawDataUri);
URLConnection con... | public static String getEncryptedPassword(String password) throws PasswordException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
md.update(password.getBytes("UTF-8"));
} catch (Exception e) {
throw new PasswordException(e);
... | false |
1,239 | 9,819,955 | 9,760,847 | @Override
public void write(OutputStream output) throws IOException, WebApplicationException {
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
final GZIPOutputStream gzipOs = new GZIPOutputStream(baos);
IOUtils.copy(is, gzipOs);
baos.close();
gzipOs.close(... | public static String getServerVersion() throws IOException {
URL url;
url = new URL(CHECKVERSIONURL);
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(false);
httpURLConne... | true |
1,240 | 849,586 | 19,197,300 | 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... | private void writeStatsToDatabase(long transferJobAIPCount, long reprocessingJobAIPCount, long transferJobAIPVolume, long reprocessingJobAIPVolume, long overallBinaryAIPCount, Map<String, AIPStatistics> mimeTypeRegister) throws SQLException {
int nextAIPStatsID;
long nextMimetypeStatsID;
Sta... | false |
1,241 | 18,488,106 | 13,462,484 | public static Document validateXml(File messageFile, URL inputUrl, String[] catalogs) throws IOException, ParserConfigurationException, Exception, SAXException, FileNotFoundException {
InputSource source = new InputSource(inputUrl.openStream());
Document logDoc = DomUtil.getNewDom();
XMLRead... | public static GoogleResponse getElevation(String lat, String lon) throws IOException {
String url = "http://maps.google.com/maps/api/elevation/xml?locations=";
url = url + String.valueOf(lat);
url = url + ",";
url = url + String.valueOf(lon);
url = url + "&sensor=false";
... | false |
1,242 | 19,462,026 | 2,269,290 | public void copy(final File source, final File dest) throws IOException {
final FileInputStream in = new FileInputStream(source);
try {
final FileOutputStream out = new FileOutputStream(dest);
try {
final FileChannel inChannel = in.getChannel();
... | public final void copyFile(final File fromFile, final File toFile) throws IOException {
this.createParentPathIfNeeded(toFile);
final FileChannel sourceChannel = new FileInputStream(fromFile).getChannel();
final FileChannel targetChannel = new FileOutputStream(toFile).getChannel();
fi... | true |
1,243 | 14,481,931 | 17,542,341 | public static InputStream download_file(String sessionid, String key) {
InputStream is = null;
String urlString = "https://s2.cloud.cm/rpc/raw?c=Storage&m=download_file&key=" + key;
try {
String apple = "";
URL url = new URL(urlString);
Log.d("current runn... | public GEItem lookup(final String itemName) {
try {
URL url = new URL(GrandExchange.HOST + "/m=itemdb_rs/results.ws?query=" + itemName + "&price=all&members=");
BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
String input;
whil... | false |
1,244 | 22,242,021 | 2,557,142 | public void testSavepoint4() throws Exception {
Statement stmt = con.createStatement();
stmt.execute("CREATE TABLE #savepoint4 (data int)");
stmt.close();
con.setAutoCommit(false);
for (int i = 0; i < 3; i++) {
System.out.println("iteration: " + i);
Pr... | public void login(LoginData loginData) throws ConnectionEstablishException, AccessDeniedException {
try {
int reply;
this.ftpClient.connect(loginData.getFtpServer());
reply = this.ftpClient.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
... | false |
1,245 | 5,697,523 | 527,051 | private static void fileUpload() throws Exception {
DefaultHttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(postURL);
file = new File("h:\\Fantastic face.jpg");
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
... | public static double getPrice(final String ticker) {
try {
final URL url = new URL("http://ichart.finance.yahoo.com/table.csv?s=" + ticker);
final BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
reader.readLine();
final Str... | false |
1,246 | 19,309,971 | 7,109,222 | private static void copyFile(String src, String dest) {
try {
File inputFile = new File(src);
File outputFile = new File(dest);
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outputFile);
FileChanne... | public static void zipMapBos(DitaBoundedObjectSet mapBos, File outputZipFile, MapBosProcessorOptions options) throws Exception {
log.debug("Determining zip file organization...");
BosVisitor visitor = new DxpFileOrganizingBosVisitor();
visitor.visit(mapBos);
if (!options.isQuiet()) l... | true |
1,247 | 20,063,872 | 16,706,229 | public void doInsertImage() {
logger.debug(">>> Inserting image...");
logger.debug(" fullFileName : #0", uploadedFileName);
String fileName = uploadedFileName.substring(uploadedFileName.lastIndexOf(File.separator) + 1);
logger.debug(" fileName : #0", fileName);
String newFile... | private void copy(File srouceFile, File destinationFile) throws IOException {
FileChannel sourceChannel = new FileInputStream(srouceFile).getChannel();
FileChannel destinationChannel = new FileOutputStream(destinationFile).getChannel();
destinationChannel.transferFrom(sourceChannel, 0, sourc... | true |
1,248 | 19,235,554 | 8,680,491 | protected BufferedImage handleKBRException() {
if (params.uri.startsWith("http://mara.kbr.be/kbrImage/CM/") || params.uri.startsWith("http://mara.kbr.be/kbrImage/maps/") || params.uri.startsWith("http://opteron2.kbr.be/kp/viewer/")) try {
URLConnection connection = new URL(params.uri).openConnec... | public static final boolean compressToZip(final String sSource, final String sDest, final boolean bDeleteSourceOnSuccess) {
ZipOutputStream os = null;
InputStream is = null;
try {
os = new ZipOutputStream(new FileOutputStream(sDest));
is = new FileInputStream(sSource)... | false |
1,249 | 13,644,040 | 14,417,449 | public static void main(String[] args) throws Exception {
String layerName = args[0];
String layerDescription = args[1];
String units = args[2];
String rawDataDirPath = args[3];
String processDirPath = args[4];
String divaDirPath = args[5];
String legendDirPat... | public static void compressAll(File dir, File file) throws IOException {
if (!dir.isDirectory()) throw new IllegalArgumentException("Given file is no directory");
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file));
out.setLevel(0);
String[] entries = dir.list();
... | false |
1,250 | 15,410,299 | 12,044,335 | public boolean isValid(WizardContext context) {
if (serviceSelection < 0) {
return false;
}
ServiceReference selection = (ServiceReference) serviceList.getElementAt(serviceSelection);
if (selection == null) {
return false;
}
String function = (... | JcrFile createBody(Part part) throws IOException, MessagingException {
JcrFile body = new JcrFile();
body.setName("part");
ByteArrayOutputStream pout = new ByteArrayOutputStream();
IOUtils.copy(part.getInputStream(), pout);
body.setDataProvider(new JcrDataProviderImpl(TYPE.BY... | false |
1,251 | 7,034,069 | 10,598,170 | public static String getSHA1Hash(String stringToHash) {
String result = "";
MessageDigest md;
try {
md = MessageDigest.getInstance("SHA-1");
md.update(stringToHash.getBytes("utf-8"));
byte[] hash = md.digest();
StringBuffer hashString = new Str... | private static String sort(final String item) {
final char[] chars = item.toCharArray();
for (int i = 1; i < chars.length; i++) {
for (int j = 0; j < chars.length - 1; j++) {
if (chars[j] > chars[j + 1]) {
final char temp = chars[j];
... | false |
1,252 | 12,243,391 | 5,537,139 | private byte[] getMD5(String string) throws IMException {
byte[] buffer = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(string.getBytes("utf-8"));
buffer = md.digest();
buffer = getHexString(buffer);
} catch (NoSuch... | public static String getDigest(String seed, byte[] code) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(seed.getBytes("UTF-8"));
byte[] passwordMD5Byte = md.digest(code);
StringBuffer sb = new StringBuffer();
for (int i = 0;... | true |
1,253 | 20,825,513 | 12,048,548 | private String md5(String pass) {
StringBuffer enteredChecksum = new StringBuffer();
byte[] digest;
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(pass.getBytes(), 0, pass.length());
digest = md5.digest();
f... | public static void exportDB(String input, String output) {
try {
Class.forName("org.sqlite.JDBC");
String fileName = input + File.separator + G.databaseName;
File dataBase = new File(fileName);
if (!dataBase.exists()) {
JOptionPane.showMessageD... | false |
1,254 | 17,374,912 | 19,643,373 | public void copyTo(File folder) {
if (!isNewFile()) {
return;
}
if (!folder.exists()) {
folder.mkdir();
}
File dest = new File(folder, name);
try {
FileInputStream in = new FileInputStream(cur... | public static boolean decodeFileToFile(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.... | true |
1,255 | 13,028,547 | 3,436,001 | public static boolean decodeFileToFile(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.... | public static void copyFile(File in, File out) {
if (!in.exists() || !in.canRead()) {
LOGGER.warn("Can't copy file : " + in);
return;
}
if (!out.getParentFile().exists()) {
if (!out.getParentFile().mkdirs()) {
LOGGER.info("Didn't create par... | true |
1,256 | 6,513,769 | 3,788,864 | @Before
public void BeforeTheTest() throws Exception {
URL url = ProfileParserTest.class.getClassLoader().getResource("ca/uhn/hl7v2/conf/parser/tests/example_ack.xml");
URLConnection conn = url.openConnection();
InputStream instream = conn.getInputStream();
if (instream == null) ... | public static void logout(String verify) throws NetworkException {
HttpClient client = HttpUtil.newInstance();
HttpGet get = new HttpGet(HttpUtil.KAIXIN_LOGOUT_URL + HttpUtil.KAIXIN_PARAM_VERIFY + verify);
HttpUtil.setHeader(get);
try {
HttpResponse response = client.exec... | false |
1,257 | 2,330,583 | 1,977,837 | private CExtractHelper getData(String p_url) {
CExtractHelper l_extractHelper = new CExtractHelper();
URL l_url;
HttpURLConnection l_connection;
try {
System.out.println("Getting [" + p_url + "]");
l_url = new URL(p_url);
try {
URLC... | public void copyFile(File sourceFile, String toDir, boolean create, boolean overwrite) throws FileNotFoundException, IOException {
FileInputStream source = null;
FileOutputStream destination = null;
byte[] buffer;
int bytes_read;
File toFile = new File(toDir);
if (cre... | false |
1,258 | 22,900,234 | 7,655,679 | public static String digestString(String data, String algorithm) {
String result = null;
if (data != null) {
try {
MessageDigest _md = MessageDigest.getInstance(algorithm);
_md.update(data.getBytes());
byte[] _digest = _md.digest();
... | public static void copy(String sourceName, String destName) throws IOException {
File src = new File(sourceName);
File dest = new File(destName);
BufferedInputStream source = null;
BufferedOutputStream destination = null;
byte[] buffer;
int bytes_read;
long by... | false |
1,259 | 20,826,307 | 12,879,112 | public static void createZipFromDataset(String localResourceId, File dataset, File metadata) {
CommunicationLogger.warning("System entered ZipFactory");
try {
String tmpDir = System.getProperty("java.io.tmpdir");
String outFilename = tmpDir + "/" + localResourceId + ".zip";
... | protected String getGraphPath(String name) throws ServletException {
String hash;
try {
MessageDigest md = MessageDigest.getInstance(m_messagedigest_algorithm);
md.update(name.getBytes());
hash = bytesToHex(md.digest());
} catch (NoSuchAlgorithmException e... | false |
1,260 | 18,616,801 | 14,988,339 | protected InputStream getAudioStream() {
InputStream in = null;
try {
URL url = getAudioURL();
if (url != null) in = url.openStream();
} catch (IOException ex) {
System.err.println(ex);
}
return in;
}
| public void copyTo(String newname) throws IOException {
FileChannel srcChannel = new FileInputStream(dosname).getChannel();
FileChannel dstChannel = new FileOutputStream(newname).getChannel();
dstChannel.transferFrom(srcChannel, 0, srcChannel.size());
srcChannel.close();
dstC... | false |
1,261 | 1,863,947 | 8,428,267 | protected void innerProcess(ProcessorURI curi) throws InterruptedException {
Pattern regexpr = curi.get(this, STRIP_REG_EXPR);
ReplayCharSequence cs = null;
try {
cs = curi.getRecorder().getReplayCharSequence();
} catch (Exception e) {
curi.getNonFatalFailures... | public static synchronized String hash(String data) {
if (digest == null) {
try {
digest = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException nsae) {
nsae.printStackTrace();
}
}
try {
digest.up... | true |
1,262 | 4,988,270 | 10,480,051 | public static void resize(File originalFile, File resizedFile, int width, String format) throws IOException {
if (format != null && "gif".equals(format.toLowerCase())) {
resize(originalFile, resizedFile, width, 1);
return;
}
FileInputStream fis = new FileInputStream(o... | public static RecordResponse loadRecord(RecordRequest recordRequest) {
RecordResponse recordResponse = new RecordResponse();
try {
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpPost httpPost = new HttpPost(recordRequest.isContact() ? URL_RECORD_CONTACT : URL_REC... | false |
1,263 | 8,565,955 | 357,303 | private static String webService(String strUrl) {
StringBuffer buffer = new StringBuffer();
try {
URL url = new URL(strUrl);
InputStream input = url.openStream();
String sCurrentLine = "";
InputStreamReader read = new InputStreamReader(input, "utf-8");... | public static String post(String strUrl, String strPostString) {
try {
URL url = new URL(strUrl);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoInput(true);
conn.setDoOutput(true);
... | true |
1,264 | 16,270,977 | 19,569,154 | public Scene load(URL url) throws FileNotFoundException, IncorrectFormatException, ParsingErrorException {
BufferedReader reader;
if (baseUrl == null) setBaseUrlFromUrl(url);
try {
reader = new BufferedReader(new InputStreamReader(url.openStream()));
} catch (IOException ... | @Override
public void incluir(Casa_festas casa_festas) throws Exception {
Connection connection = criaConexao(false);
String sql = "insert into casa_festas ? as idlocal, ? as area, ? as realiza_cerimonia, ? as tipo_principal, ? as idgrupo;";
String sql2 = "SELECT MAX(idlocal) FROM Local"... | false |
1,265 | 564,191 | 4,462,296 | private void processOrder() {
double neg = 0d;
if (intMode == MODE_CHECKOUT) {
if (round2Places(mBuf.getBufferTotal()) >= round2Places(order.getOrderTotal())) {
double cash, credit, allowedCredit = 0d;
allowedCredit = getStudentCredit();
if... | public synchronized void insertMessage(FrostUnsentMessageObject mo) throws SQLException {
AttachmentList files = mo.getAttachmentsOfType(Attachment.FILE);
AttachmentList boards = mo.getAttachmentsOfType(Attachment.BOARD);
Connection conn = AppLayerDatabase.getInstance().getPooledConnection()... | true |
1,266 | 22,416,749 | 17,630,909 | private int getRootNodeId(DataSource dataSource) throws SQLException {
Connection conn = null;
Statement st = null;
ResultSet rs = null;
String query = null;
try {
conn = dataSource.getConnection();
st = conn.createStatement();
query = "sel... | public static int[] sortAscending(double input[]) {
int[] order = new int[input.length];
for (int i = 0; i < order.length; i++) order[i] = i;
for (int i = input.length; --i >= 0; ) {
for (int j = 0; j < i; j++) {
if (input[j] > input[j + 1]) {
... | false |
1,267 | 4,591,683 | 23,611,768 | public static void copyFile(File source, File dest) throws IOException {
if (source.equals(dest)) throw new IOException("Source and destination cannot be the same file path");
FileChannel srcChannel = new FileInputStream(source).getChannel();
if (!dest.exists()) dest.createNewFile();
... | private static void reconfigureDebug() {
useFile = false;
logValue = 0;
String methodString = NodeUtil.walkNodeTree(Server.getConfig(), "//configuration/object[@type='engine.debug']/property[@type='engine.method']/@value");
String levelString = NodeUtil.walkNodeTree(Server.getConfig(... | true |
1,268 | 17,530,413 | 19,452,177 | protected void serveStaticContent(HttpServletRequest request, HttpServletResponse response, String pathInfo) throws ServletException {
InputStream is = servletConfig.getServletContext().getResourceAsStream(pathInfo);
if (is == null) {
throw new ServletException("Static resource " + pathI... | public static File createTempFile(InputStream contentStream, String ext) throws IOException {
ExceptionUtils.throwIfNull(contentStream, "contentStream");
File file = File.createTempFile("test", ext);
FileOutputStream fos = new FileOutputStream(file);
try {
IOUtils.copy(co... | true |
1,269 | 16,087,901 | 11,810,425 | public static String encryptPassword(String username, String realm, String password) throws GeneralSecurityException {
MessageDigest md = null;
md = MessageDigest.getInstance("MD5");
md.update(username.getBytes());
md.update(":".getBytes());
md.update(realm.getBytes());
... | private static String createBoundary(int number) {
MessageDigest digest;
try {
digest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
digest.update(String.valueOf(Math.random()).getBytes());
... | true |
1,270 | 23,609,709 | 9,223,155 | private File downloadPDB(String pdbId) {
File tempFile = new File(path + "/" + pdbId + ".pdb.gz");
File pdbHome = new File(path);
if (!pdbHome.canWrite()) {
System.err.println("can not write to " + pdbHome);
return null;
}
String ftp = String.format("f... | private String checkForUpdate() {
InputStream is = null;
try {
URL url = new URL(CHECK_UPDATES_URL);
try {
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("User-Agent", "TinyLaF");
Obje... | true |
1,271 | 15,228,322 | 254,039 | public void createIndex(File indexDir) throws SearchLibException, IOException {
if (!indexDir.mkdir()) throw new SearchLibException("directory creation failed (" + indexDir + ")");
InputStream is = null;
FileWriter target = null;
for (String resource : resources) {
String... | 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... | true |
1,272 | 934,048 | 431,295 | 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... | 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... | true |
1,273 | 10,277,293 | 7,511,780 | byte[] calculateDigest(String value) {
try {
MessageDigest mg = MessageDigest.getInstance("SHA1");
mg.update(value.getBytes());
return mg.digest();
} catch (Exception e) {
throw Bark.unchecker(e);
}
}
| public static String md5(String word) {
MessageDigest alg = null;
try {
alg = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ServletUtils.class.getName()).log(Level.SEVERE, null, ex);
}
alg.reset();
a... | true |
1,274 | 9,031,629 | 1,102,939 | public static byte[] readFromURI(URI uri) throws IOException {
if (uri.toString().contains("http:")) {
URL url = uri.toURL();
URLConnection urlConnection = url.openConnection();
int length = urlConnection.getContentLength();
System.out.println("length of conte... | public static long writeInputStreamToOutputStream(final InputStream in, final OutputStream out) {
long size = 0;
try {
size = IOUtils.copyLarge(in, out);
} catch (IOException e1) {
e1.printStackTrace();
}
return size;
}
| false |
1,275 | 16,810,590 | 11,419,588 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | public static String MD5(String text) {
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
return convertToHex(m... | true |
1,276 | 588,571 | 19,194,277 | public static void main(String[] args) throws Exception {
String uri = args[0];
Configuration conf = new Configuration();
FileSystem fs = FileSystem.get(URI.create(uri), conf);
InputStream in = null;
try {
in = fs.open(new Path(uri));
IOUtils.copyBytes... | public void create() throws IOException {
FileChannel fc = new FileInputStream(sourceFile).getChannel();
for (RangeArrayElement element : array) {
FileChannel fc_ = fc.position(element.starting());
File part = new File(destinationDirectory, "_0x" + Long.toHexString(element.st... | true |
1,277 | 23,597,499 | 3,156,435 | private File uploadFile(InputStream inputStream, File file) {
FileOutputStream fileOutputStream = null;
try {
File dir = file.getParentFile();
if (!dir.exists()) {
dir.mkdirs();
}
FileUtils.touch(file);
fileOutputStream = ne... | public static void fileCopy(File src, File dst) throws FileNotFoundException, IOException {
if (src.isDirectory() && (!dst.exists() || dst.isDirectory())) {
if (!dst.exists()) {
if (!dst.mkdirs()) throw new IOException("unable to mkdir " + dst);
}
File dst... | true |
1,278 | 17,258,629 | 11,825,739 | private void checkRoundtrip(byte[] content) throws Exception {
InputStream in = new ByteArrayInputStream(content);
ByteArrayOutputStream out = new ByteArrayOutputStream();
CodecUtil.encodeQuotedPrintableBinary(in, out);
in = new QuotedPrintableInputStream(new ByteArrayInputStream(out... | public static void copyFile(String from, String to, boolean append) throws IOException {
FileChannel in = new FileInputStream(from).getChannel();
FileChannel out = new FileOutputStream(to, append).getChannel();
ByteBuffer buffer = ByteBuffer.allocate(BSIZE);
while (in.read(buffer) !=... | true |
1,279 | 14,900,316 | 12,218,827 | @Override
public User createUser(User bean) throws SitoolsException {
checkUser();
if (!User.isValid(bean)) {
throw new SitoolsException("CREATE_USER_MALFORMED");
}
Connection cx = null;
try {
cx = ds.getConnection();
cx.setAutoCommit(f... | private HttpURLConnection prepare(URL url, String method) {
if (this.username != null && this.password != null) {
this.headers.put("Authorization", "Basic " + Codec.encodeBASE64(this.username + ":" + this.password));
}
try {
HttpURLConnection c... | false |
1,280 | 15,968,019 | 9,568,958 | public static String createHash(String password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] digest = md.digest();
return toHexString(digest);
} catch (NoSuchAlgorithmException nsae) {
... | private void getRandomGuid(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
}
... | true |
1,281 | 14,412,812 | 10,793,696 | public static String getMD5(String password) throws NoSuchAlgorithmException {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] b = md.digest();
StringBuffer sb = new StringBuffer();
for (byte aB : b) {
sb.append((Integer... | public static String SHA1(String text) throws NoSuchAlgorithmException, UnsupportedEncodingException {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
byte[] sha1hash = new byte[40];
md.update(text.getBytes("iso-8859-1"), 0, text.length());
sha1hash = md.digest();
... | true |
1,282 | 17,662,180 | 699,718 | public XlsBook(String path) throws IOException {
boolean isHttp = path.startsWith("http://");
InputStream is = null;
if (isHttp) {
URL url = new URL(path);
is = url.openStream();
} else {
File file = new File(path);
is = new FileInputSt... | PasswordTableWindow(String login) {
super(login + ", tecle a senha de uso �nico");
this.login = login;
Error.log(4001, "Autentica��o etapa 3 iniciada.");
Container container = getContentPane();
container.setLayout(new FlowLayout());
btnNumber = new JButton[10];
... | false |
1,283 | 20,661,433 | 19,809,975 | public static void copyFile(String fromFilePath, String toFilePath, boolean overwrite) throws IOException {
File fromFile = new File(fromFilePath);
File toFile = new File(toFilePath);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFilePath);
... | public static String getETag(final String uri, final long lastModified) {
try {
final MessageDigest dg = MessageDigest.getInstance("MD5");
dg.update(uri.getBytes("utf-8"));
dg.update(new byte[] { (byte) ((lastModified >> 24) & 0xFF), (byte) ((lastModified >> 16) & 0xFF), ... | false |
1,284 | 18,942,525 | 1,039,796 | public void updateUserInfo(AuthSession authSession, AuthUserExtendedInfo infoAuth) {
log.info("Start update auth");
PreparedStatement ps = null;
DatabaseAdapter db = null;
try {
db = DatabaseAdapter.getInstance();
String sql = "update WM_AUTH_USER " + "set " +... | public static void insert(Connection c, MLPApprox net, int azioneId, String descrizione, int[] indiciID, int output, Date from, Date to) throws SQLException {
try {
PreparedStatement ps = c.prepareStatement(insertNet, PreparedStatement.RETURN_GENERATED_KEYS);
ArrayList<Integer> index... | true |
1,285 | 10,072,636 | 5,597,187 | public Blowfish(String password) {
MessageDigest digest = null;
try {
digest = MessageDigest.getInstance("SHA1");
digest.update(password.getBytes());
} catch (Exception e) {
Log.error(e.getMessage(), e);
}
m_bfish = new BlowfishCBC(digest.d... | @Override
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;
ImagesService imgService = ImagesServiceFacto... | false |
1,286 | 5,981,201 | 15,129,123 | public static void copyFile(File src, File dst) throws IOException {
if (T.t) T.info("Copying " + src + " -> " + dst + "...");
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dst);
byte buf[] = new byte[40 * KB];
int read;
wh... | public String doGet() throws MalformedURLException, IOException {
uc = (HttpURLConnection) url.openConnection();
BufferedInputStream buffer = new BufferedInputStream(uc.getInputStream());
ByteArrayOutputStream bos = new ByteArrayOutputStream();
int c;
while ((c = buffer.read(... | false |
1,287 | 827,646 | 9,168,699 | public void elimina(Cliente cli) throws errorSQL, errorConexionBD {
System.out.println("GestorCliente.elimina()");
int id = cli.getId();
String sql;
Statement stmt = null;
try {
gd.begin();
sql = "DELETE FROM cliente WHERE cod_cliente =" + id;
... | public void insertArchiveEntries(ArchiveEntry entries[]) throws WeatherMonitorException {
String sql = null;
try {
Connection con = getConnection();
Statement stmt = con.createStatement();
ResultSet rslt = null;
con.setAutoCommit(false);
fo... | true |
1,288 | 22,142,748 | 17,726,029 | public static String getMD5(String password) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] digest = md.digest();
String out = "";
for (int i = 0; i < digest.length; i++) {
out +=... | private String getRandomGUID(final boolean secure) {
MessageDigest md5 = null;
final StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
... | true |
1,289 | 19,147,297 | 9,860,859 | public boolean ponerRivalxRonda(int idJugadorDiv, int idRonda, int dato) {
int intResult = 0;
String sql = "UPDATE jugadorxdivxronda " + " SET idPareoRival = " + dato + " WHERE jugadorxDivision_idJugadorxDivision = " + idJugadorDiv + " AND ronda_numeroRonda = " + idRonda;
try {
c... | @Override
public boolean identification(String username, String password) {
this.getLogger().info(DbUserServiceImpl.class, ">>>identification " + username + "<<<");
try {
IFeelerUser user = this.getDbServ().queryFeelerUser(username);
if (user == null) {
re... | false |
1,290 | 6,185,786 | 11,958,349 | protected void copyFile(File from, File to) throws IOException {
to.getParentFile().mkdirs();
InputStream in = new FileInputStream(from);
try {
OutputStream out = new FileOutputStream(to);
try {
byte[] buf = new byte[1024];
int readLeng... | public static void makeLPKFile(String[] srcFilePath, String makeFilePath, LPKHeader header) {
FileOutputStream os = null;
DataOutputStream dos = null;
try {
LPKTable[] fileTable = new LPKTable[srcFilePath.length];
long fileOffset = outputOffset(header);
fo... | true |
1,291 | 3,461,227 | 21,609,545 | private void calculateCoverageAndSpecificity(String mainCat) throws IOException, JSONException {
for (String cat : Rules.categoryTree.get(mainCat)) {
for (String queryString : Rules.queries.get(cat)) {
String urlEncodedQueryString = URLEncoder.encode(queryString, "UTF-8");
... | public static JSONObject update(String name, String uid, double lat, double lon, boolean online) throws ClientProtocolException, IOException, JSONException {
HttpClient client = new DefaultHttpClient(params);
HttpPost post = new HttpPost(UPDATE_URI);
List<NameValuePair> parameters = new Arra... | false |
1,292 | 1,158,842 | 9,837,647 | public static int unzipFile(File file_input, File dir_output) {
ZipInputStream zip_in_stream;
try {
FileInputStream in = new FileInputStream(file_input);
BufferedInputStream source = new BufferedInputStream(in);
zip_in_stream = new ZipInputStream(source);
... | private long newIndex(String indexname) {
Connection con = null;
ResultSet rs = null;
Statement stm = null;
StringBuffer sql = new StringBuffer();
indexname = indexname.trim().toUpperCase();
try {
long index = -1;
synchronized (FormularContextP... | false |
1,293 | 21,803,552 | 16,851,954 | public void doRender() throws IOException {
File file = new File(fileName);
if (!file.exists()) {
logger.error("Static resource not found: " + fileName);
isNotFound = true;
return;
}
if (fileName.endsWith("xml") || fileName.endsWith("asp")) servlet... | @Test
public void testTrainingQuickprop() throws IOException {
File temp = File.createTempFile("fannj_", ".tmp");
temp.deleteOnExit();
IOUtils.copy(this.getClass().getResourceAsStream("xor.data"), new FileOutputStream(temp));
List<Layer> layers = new ArrayList<Layer>();
l... | true |
1,294 | 474,163 | 8,126,683 | public static XMLShowInfo NzbSearch(TVRageShowInfo tvrage, XMLShowInfo xmldata, int latestOrNext) {
String newzbin_query = "", csvData = "", hellaQueueDir = "", newzbinUsr = "", newzbinPass = "";
String[] tmp;
DateFormat tvRageDateFormat = new SimpleDateFormat("MMM/dd/yyyy");
DateFor... | public Resource readResource(URL url, ResourceManager resourceManager) throws NAFException {
XMLResource resource = new XMLResource(resourceManager, url);
InputStream in = null;
try {
in = url.openStream();
ArrayList<Transformer> trList = null;
Document do... | false |
1,295 | 1,023,289 | 18,144,642 | public static String MD5(String s) {
try {
MessageDigest m = MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
return new BigInteger(1, m.digest()).toString(16);
} catch (NoSuchAlgorithmException ex) {
return "";
}
}
| public static String crypt(String senha) {
String md5 = null;
MessageDigest md;
try {
md = MessageDigest.getInstance(CRYPT_ALGORITHM);
md.update(senha.getBytes());
Hex hex = new Hex();
md5 = new String(hex.encode(md.digest()));
} catch ... | true |
1,296 | 5,271,062 | 11,026,173 | private void copyThemeProviderClass() throws Exception {
InputStream is = getClass().getResourceAsStream("/zkthemer/ThemeProvider.class");
if (is == null) throw new RuntimeException("Cannot find ThemeProvider.class");
File outFile = new File(theme.getJarRootFile(), "zkthemer/ThemeProvider.cl... | public static URLConnection getURLConnection(URL url, boolean ignoreBadCertificates) throws KeyManagementException, NoSuchAlgorithmException, UnknownHostException, IOException {
SSLSocketFactory sslSocketFactory = null;
if (ignoreBadCertificates) {
SSLContext sslContext = SSLContext.getI... | false |
1,297 | 23,614,264 | 9,552,428 | private static void copyFile(File sourceFile, File destFile) throws IOException {
System.out.println(sourceFile.getAbsolutePath());
System.out.println(destFile.getAbsolutePath());
FileChannel source = new FileInputStream(sourceFile).getChannel();
try {
FileChannel destina... | public static String stringOfUrl(String addr) throws IOException {
ByteArrayOutputStream output = new ByteArrayOutputStream();
System.out.println("test");
URL url = new URL(addr);
System.out.println("test2");
IOUtils.copy(url.openStream(), output);
return output.toStr... | true |
1,298 | 7,911,395 | 6,128,265 | public void executaAlteracoes() {
Album album = Album.getAlbum();
Photo[] fotos = album.getFotos();
Photo f;
int ultimoFotoID = -1;
int albumID = album.getAlbumID();
sucesso = true;
PainelWebFotos.setCursorWait(true);
albumID = recordAlbumData(album, a... | private void makeDailyBackup() throws CacheOperationException, ConfigurationException {
final int MAX_DAILY_BACKUPS = 5;
File cacheFolder = getBackupFolder();
cacheLog.debug("Making a daily backup of current Beehive archive...");
try {
File oldestDaily = new File(DAILY_BA... | true |
1,299 | 6,544,082 | 10,793,895 | private String readScriptFromURL(URL context, String s) {
Object content = null;
URL url;
try {
url = new URL(context, s);
} catch (MalformedURLException e) {
return null;
}
try {
content = url.getContent();
} catch (Unknown... | protected void configure() {
Enumeration<URL> resources = null;
try {
resources = classLoader.getResources(resourceName);
} catch (IOException e) {
binder().addError(e.getMessage(), e);
return;
}
int resourceCount = 0;
while (resour... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.