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 |
|---|---|---|---|---|---|
900,500 | 6,310,814 | 12,734,324 | public boolean downloadNextTLE() {
boolean success = true;
if (!downloadINI) {
errorText = "startTLEDownload() must be ran before downloadNextTLE() can begin";
return false;
}
if (!this.hasMoreToDownload()) {
errorText = "There are no more TLEs to ... | public static String post(String url, Map params, String line_delimiter) {
String response = "";
try {
URL _url = new URL(url);
URLConnection conn = _url.openConnection();
conn.setDoOutput(true);
OutputStreamWriter wr = new OutputStreamWriter(conn.getO... | false |
900,501 | 9,104,988 | 11,433,309 | public String getHashedPhoneId(Context aContext) {
if (hashedPhoneId == null) {
final String androidId = BuildInfo.getAndroidID(aContext);
if (androidId == null) {
hashedPhoneId = "EMULATOR";
} else {
try {
final Message... | public File extractID3v2TagDataIntoFile(File outputFile) throws TagNotFoundException, IOException {
int startByte = (int) ((MP3AudioHeader) audioHeader).getMp3StartByte();
if (startByte >= 0) {
FileInputStream fis = new FileInputStream(file);
FileChannel fc = fis.getChannel()... | false |
900,502 | 3,820,224 | 23,429,413 | private String hashString(String key) {
MessageDigest digest;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(key.getBytes());
byte[] hash = digest.digest();
BigInteger bi = new BigInteger(1, hash);
return Strin... | public static String plainToMD(LoggerCollection loggerCol, String input) {
byte[] byteHash = null;
MessageDigest md = null;
StringBuilder md4result = new StringBuilder();
try {
md = MessageDigest.getInstance("MD4", new BouncyCastleProvider());
md.reset();
... | true |
900,503 | 22,625,085 | 120,983 | @Transient
private String md5sum(String text) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(text.getBytes());
byte messageDigest[] = md.digest();
return bufferToHex(messageDigest, 0, messageDigest.length);
... | void sort(int a[]) throws Exception {
for (int i = a.length; --i >= 0; ) {
boolean flipped = false;
for (int j = 0; j < i; j++) {
if (stopRequested) {
return;
}
if (a[j] > a[j + 1]) {
int T = a[j]... | false |
900,504 | 3,224,152 | 18,456,843 | 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... | public String storeUploadedZip(byte[] zip, String name) {
List filesToStore = new ArrayList();
int i = 0;
ZipInputStream zipIs = new ZipInputStream(new ByteArrayInputStream(zip));
ZipEntry zipEntry = zipIs.getNextEntry();
while (zipEntry != null) {
if (zipEntry.is... | true |
900,505 | 9,591,960 | 8,389,315 | protected Object serveFile(MyServerSocket socket, String filenm, URL url) {
PrintStream out = null;
InputStream in = null;
long len = 0;
try {
out = new PrintStream(socket.getOutputStream());
in = url.openStream();
len = in.available();
} c... | public void copy(File s, File t) throws IOException {
FileChannel in = (new FileInputStream(s)).getChannel();
FileChannel out = (new FileOutputStream(t)).getChannel();
in.transferTo(0, s.length(), out);
in.close();
out.close();
}
| false |
900,506 | 3,000,477 | 9,983,984 | private static String hashWithDigest(String in, String digest) {
try {
MessageDigest Digester = MessageDigest.getInstance(digest);
Digester.update(in.getBytes("UTF-8"), 0, in.length());
byte[] sha1Hash = Digester.digest();
return toSimpleHexString(sha1Hash);
... | private 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 |
900,507 | 23,141,718 | 7,492,253 | protected URLConnection openConnection(URL url) throws IOException {
if (bundleEntry != null) return (new BundleURLConnection(url, bundleEntry));
String bidString = url.getHost();
if (bidString == null) {
throw new IOException(NLS.bind(AdaptorMsg.URL_NO_BUNDLE_ID, url.toExternalF... | protected Connection openRelativeFile(String file) throws IOException {
if (cachedBits == null) {
cachedBits = new ByteArray(url.openConnection().getInputStream()).getBytes();
}
ZipInputStream zin = new ZipInputStream(new ByteArrayInputStream(cachedBits));
ZipEntry zentry... | false |
900,508 | 373,792 | 3,024,981 | 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... | @Test
public void testCopy_inputStreamToWriter_Encoding_nullIn() throws Exception {
ByteArrayOutputStream baout = new ByteArrayOutputStream();
OutputStream out = new YellOnFlushAndCloseOutputStreamTest(baout, true, true);
Writer writer = new OutputStreamWriter(baout, "US-ASCII");
... | true |
900,509 | 12,883,277 | 18,892,407 | private void createWikiPages(WikiContext context) throws PluginException {
OntologyWikiPageName owpn = new OntologyWikiPageName(omemo.getFormDataAlias().toUpperCase(), omemo.getFormDataVersionDate());
String wikiPageFullFileName = WikiPageName2FullFileName(context, owpn.toString());
String r... | private void copyTemplateFile(String sourceRoot, String targetRoot, String extension) throws Exception {
String inputFileName = sourceRoot + extension;
String outputFileName = targetRoot + extension;
System.out.println("Copying resource file: " + outputFileName);
File inputFile = new... | true |
900,510 | 13,506,128 | 19,652,844 | public static String gerarDigest(String mensagem) {
String mensagemCriptografada = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA");
System.out.println("Mensagem original: " + mensagem);
md.update(mensagem.getBytes());
byte[] digest = md... | public long getLastModified() {
if (lastModified == 0) {
if (connection == null) try {
connection = url.openConnection();
} catch (IOException e) {
}
if (connection != null) lastModified = connection.getLastModified();
}
return ... | false |
900,511 | 16,002,345 | 9,830,409 | public OAIRecord getRecord(String identifier, String metadataPrefix) throws OAIException {
PrefixResolverDefault prefixResolver;
XPath xpath;
XPathContext xpathSupport;
int ctxtNode;
XObject list;
Node node;
OAIRecord rec = new OAIRecord();
priCheckBas... | @Test
public final void testCheckCookies() {
URL url = null;
try {
url = new URL("http://localhost:8080");
} catch (MalformedURLException e1) {
e1.printStackTrace();
}
StringBuffer content = new StringBuffer();
try {
HttpURLConn... | false |
900,512 | 20,359,284 | 22,177,057 | private void SaveToArchive(Layer layer, String layerFileName) throws Exception {
Object archiveObj = layer.getBlackboard().get("ArchiveFileName");
Object entryObj = layer.getBlackboard().get("ArchiveEntryPrefix");
if ((archiveObj == null) || (entryObj == null)) return;
String archive... | private void saveFile(File destination) {
InputStream in = null;
OutputStream out = null;
try {
if (fileScheme) in = new BufferedInputStream(new FileInputStream(source.getPath())); else in = new BufferedInputStream(getContentResolver().openInputStream(source));
out = ... | false |
900,513 | 13,776,078 | 22,530,929 | private GmailContact convertContactToGmailContact(Contact contact) throws GmailManagerException {
boolean homePhone = false, homePhone2 = false, homeFax = false, homeMobile = false, homePager = false;
boolean businessPhone = false, businessPhone2 = false, businessFax = false, businessMobile = false,... | public static String md5Encode(String pass) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pass.getBytes());
byte[] result = md.digest();
return bytes2hexStr(result);
} catch (NoSuchAlgorithmException e) {
throw new ... | true |
900,514 | 4,773,756 | 14,624,031 | public void zipDocsetFiles(SaxHandler theXmlHandler, int theEventId, Attributes theAtts) throws BpsProcessException {
ZipOutputStream myZipOut = null;
BufferedInputStream myDocumentInputStream = null;
String myFinalFile = null;
String myTargetPath = null;
String myTargetFileN... | public static void copyFile(File in, File out) throws ObclipseException {
try {
FileChannel inChannel = null;
FileChannel outChannel = null;
try {
inChannel = new FileInputStream(in).getChannel();
outChannel = new FileOutputStream(out).getC... | true |
900,515 | 5,933,080 | 23,429,413 | public void addUser(String username, String password, String filename) {
String data = "";
try {
open(filename);
MessageDigest mdAlgorithm = MessageDigest.getInstance("MD5");
mdAlgorithm.update(password.getBytes());
byte[] digest = mdAlgorithm.digest()... | public static String plainToMD(LoggerCollection loggerCol, String input) {
byte[] byteHash = null;
MessageDigest md = null;
StringBuilder md4result = new StringBuilder();
try {
md = MessageDigest.getInstance("MD4", new BouncyCastleProvider());
md.reset();
... | true |
900,516 | 12,908,415 | 12,214,439 | private synchronized void persist() {
Connection conn = null;
try {
PoolManager pm = PoolManager.getInstance();
conn = pm.getConnection(JukeXTrackStore.DB_NAME);
conn.setAutoCommit(false);
Statement state = conn.createStatement();
state.exe... | public boolean saveNote(NoteData n) {
String query;
try {
conn.setAutoCommit(false);
Statement stmt = null;
ResultSet rset = null;
stmt = conn.createStatement();
query = "select * from notes where noteid = " + n.getID();
rset = ... | true |
900,517 | 23,390,255 | 17,597,668 | 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... | private boolean copyFiles(File sourceDir, File destinationDir) {
boolean result = false;
try {
if (sourceDir != null && destinationDir != null && sourceDir.exists() && destinationDir.exists() && sourceDir.isDirectory() && destinationDir.isDirectory()) {
File sourceFiles[]... | true |
900,518 | 9,150,851 | 1,022,820 | public static String encrypt(String text) {
MessageDigest md;
try {
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
md.update(text.getBytes("UTF-8"), 0, text.length());
md5hash = md.digest();
return convertToHex(md5has... | public static final String computeHash(String stringToCompile) {
String retVal = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.reset();
md5.update(stringToCompile.getBytes());
byte[] result = md5.digest();
StringBuff... | true |
900,519 | 20,286,589 | 93,208 | public static void copyFile(final File source, final File target) throws FileNotFoundException, IOException {
FileChannel in = new FileInputStream(source).getChannel(), out = new FileOutputStream(target).getChannel();
ByteBuffer buffer = ByteBuffer.allocate(1024);
while (in.read(buffer) != -... | 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 |
900,520 | 9,530,015 | 4,774,514 | public static void main(String[] args) throws Throwable {
Options options = new Options();
options.addOption(new CommandLineOptionBuilder("cas", "cas file").isRequired(true).build());
options.addOption(new CommandLineOptionBuilder("o", "output directory").longName("outputDir").isRequired(tru... | protected synchronized String encryptThis(String seed, String text) throws EncryptionException {
String encryptedValue = null;
String textToEncrypt = text;
if (seed != null) {
textToEncrypt = seed.toLowerCase() + text;
}
try {
MessageDigest md = Messag... | false |
900,521 | 22,447,616 | 8,080,019 | public Usuario insertUsuario(IUsuario usuario) throws SQLException {
Connection conn = null;
String insert = "insert into Usuario (idusuario, nome, email, telefone, cpf, login, senha) " + "values " + "(nextval('seq_usuario'), '" + usuario.getNome() + "', '" + usuario.getEmail() + "', " + "'" + usuar... | public static String getInstanceUserdata() throws IOException {
int retries = 0;
while (true) {
try {
URL url = new URL("http://169.254.169.254/latest/user-data/");
InputStreamReader rdr = new InputStreamReader(url.openStream());
StringWrit... | false |
900,522 | 19,392,395 | 14,212,319 | private void updateIngredients(Recipe recipe, int id) throws Exception {
PreparedStatement pst1 = null;
PreparedStatement pst2 = null;
try {
conn = getConnection();
pst1 = conn.prepareStatement("DELETE FROM ingredients WHERE recipe_id = ?");
pst1.setInt(1,... | @Override
public String resolveItem(String oldJpgFsPath) throws DatabaseException {
if (oldJpgFsPath == null || "".equals(oldJpgFsPath)) throw new NullPointerException("oldJpgFsPath");
try {
getConnection().setAutoCommit(false);
} catch (SQLException e) {
LOGGER.w... | true |
900,523 | 3,689,392 | 1,162,514 | public static String encrypt(String plaintext) throws Exception {
String algorithm = XML.get("security.algorithm");
if (algorithm == null) algorithm = "SHA-1";
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(plaintext.getBytes("UTF-8"));
return new BASE64En... | private LSInput resolveResource(String aPublicId, String aSystemId, String aBaseURI, boolean baseUsed) {
LSInput lsInput = new DefaultLSInput();
lsInput.setPublicId(aPublicId);
lsInput.setSystemId(aSystemId);
String base = null;
try {
int baseEndPos = -1;
... | false |
900,524 | 1,663,419 | 11,562,158 | 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... | private File writeResourceToFile(String resource) throws IOException {
File tmp = File.createTempFile("zfppt" + resource, null);
InputStream res = Thread.currentThread().getContextClassLoader().getResourceAsStream(resource);
OutputStream out = new FileOutputStream(tmp);
IOUtils.copy(... | true |
900,525 | 2,994,948 | 13,325,917 | public JSONObject getTargetGraph(HttpSession session, JSONObject json) throws JSONException {
StringBuffer out = new StringBuffer();
Graph tgt = null;
MappingManager manager = (MappingManager) session.getAttribute(RuncibleConstants.MAPPING_MANAGER.key());
try {
tgt = mana... | public static void copy(File fromFile, File toFile) throws IOException {
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFile.getCanonicalPath());
if (!fromFile.isFile()) throw new IOException("FileCopy: " + "can't copy directory: " + fromFile.getCanonicalP... | true |
900,526 | 14,481,932 | 23,353,199 | public static String upload_file(String sessionid, String localFilePath, String remoteTagPath) {
String jsonstring = "If you see this message, there is some problem inside the function:upload_file()";
String srcPath = localFilePath;
String uploadUrl = "https://s2.cloud.cm/rpc/json/?session_i... | public static void extractZip(Resource zip, FileObject outputDirectory) {
ZipInputStream zis = null;
try {
zis = new ZipInputStream(zip.getResourceURL().openStream());
ZipEntry entry;
while ((entry = zis.getNextEntry()) != null) {
String[] pathElem... | false |
900,527 | 9,270,406 | 2,273,819 | public void downSync(Vector v) throws SQLException {
try {
con = allocateConnection(tableName);
PreparedStatement update = con.prepareStatement("update cal_Event set owner=?,subject=?,text=?,place=?," + "contactperson=?,startdate=?,enddate=?,starttime=?,endtime=?,allday=?," + "syncst... | String digest(final UserAccountEntity account) {
try {
final MessageDigest digest = MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(account.getUserId().getBytes("UTF-8"));
digest.update(account.getLastLogin().toString(... | false |
900,528 | 13,020,691 | 19,710,610 | private void getRandomGUID(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
}
try {
long time = System.currentTi... | public void copyImage(String from, String to) {
File inputFile = new File(from);
File outputFile = new File(to);
try {
if (inputFile.canRead()) {
FileInputStream in = new FileInputStream(inputFile);
FileOutputStream out = new FileOutputStream(outpu... | false |
900,529 | 5,951,609 | 12,568,442 | public void testCryptHash() {
Log.v("Test", "[*] testCryptHash()");
String testStr = "Hash me";
byte messageDigest[];
MessageDigest digest = null;
try {
digest = java.security.MessageDigest.getInstance("MD5");
digest.update(testStr.getBytes());
... | public static String MD5(String text) {
byte[] md5hash = new byte[32];
try {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
md.update(text.getBytes("iso-8859-1"), 0, text.length());
md5hash = md.digest();
} catch (Exception e) {
... | true |
900,530 | 18,096,549 | 8,694,461 | public static void copyFile(File src, File dest, boolean notifyUserOnError) {
if (src.exists()) {
try {
BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
BufferedInputStream in = new BufferedInputStream(new FileInputStream(src));
... | public InputStream getFtpInputStream() throws IOException {
try {
URL url = getURL();
URLConnection urlc = url.openConnection();
return urlc.getInputStream();
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
... | false |
900,531 | 8,335,460 | 8,841,555 | public static String encrypt(String password, String algorithm, byte[] salt) {
StringBuffer buffer = new StringBuffer();
MessageDigest digest = null;
int size = 0;
if ("CRYPT".equalsIgnoreCase(algorithm)) {
throw new InternalError("Not implemented");
} else if ("S... | 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... | true |
900,532 | 662,799 | 9,591,165 | 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 void writeAndCheckFile(DataFileReader reader, String base, String path, String hash, Reference ref, boolean hashall) throws Exception {
Data data = ref.data;
File file = new File(base + path);
file.getParentFile().mkdirs();
if (Debug.level > 1) System.err.println("read file "... | true |
900,533 | 3,498,857 | 18,317,332 | public static void main(String[] args) throws IOException {
String zipPath = "C:\\test.zip";
CZipInputStream zip_in = null;
try {
byte[] c = new byte[1024];
int slen;
zip_in = new CZipInputStream(new FileInputStream(zipPath), "utf-8");
do {
... | 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 |
900,534 | 14,341,903 | 18,506,484 | private static void processFile(String file) throws IOException {
FileInputStream in = new FileInputStream(file);
int read = 0;
byte[] buf = new byte[2048];
ByteArrayOutputStream bout = new ByteArrayOutputStream();
while ((read = in.read(buf)) > 0) bout.write(buf, 0, read);
... | private int addPollToDB(DataSource database) {
int pollid = -2;
Connection con = null;
try {
con = database.getConnection();
con.setAutoCommit(false);
String add = "insert into polls" + " values( ?, ?, ?, ?)";
PreparedStatement prepStatement = ... | false |
900,535 | 23,030,047 | 3,850,809 | public static void downloadImage(File file, String imageUrl) throws IOException {
int size = 0;
int copied = 0;
InputStream in = null;
FileOutputStream out = null;
try {
URL url;
url = new URL(imageUrl);
HttpURLConnection httpURLConnection ... | private void buildBundle() {
if (targetProject == null) {
MessageDialog.openError(getShell(), "Error", "No target SPAB project selected!");
return;
}
if (projectProcessDirSelector.getText().trim().length() == 0) {
MessageDialog.openError(getShell(), "Error... | false |
900,536 | 10,482,004 | 6,371,585 | public static void main(String[] args) throws IOException {
System.out.println("Start filtering zgps...");
final Config config = ConfigUtils.loadConfig(args[0]);
final String CONFIG_MODULE = "GPSFilterZGPS";
File sourceFileSelectedStages = new File(config.findParam(CONFIG_MODULE, "so... | public void setDefaultDomain(final int domainId) {
try {
connection.setAutoCommit(false);
new ProcessEnvelope().executeNull(new ExecuteProcessAbstractImpl(connection, false, false, true, true) {
@Override
public void executeProcessReturnNull() throws ... | false |
900,537 | 555,928 | 6,198,171 | private static File copyFileTo(File file, File directory) throws IOException {
File newFile = new File(directory, file.getName());
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(file);
fos = new FileOutputStream(newFil... | public static JSONObject doJSONQuery(String urlstr) throws IOException, MalformedURLException, JSONException, SolrException {
URL url = new URL(urlstr);
HttpURLConnection con = null;
try {
con = (HttpURLConnection) url.openConnection();
BufferedReader in = new Buffere... | false |
900,538 | 23,069,799 | 699,718 | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | 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 |
900,539 | 1,156,852 | 16,379,577 | private List<String> getRobots(String beginURL, String contextRoot) {
List<String> vtRobots = new ArrayList<String>();
BufferedReader bfReader = null;
try {
URL urlx = new URL(beginURL + "/" + contextRoot + "/" + "robots.txt");
URLConnection urlConn = urlx.openConnect... | public InputStream sendGetMessage(Properties args) throws IOException {
String argString = "";
if (args != null) {
argString = "?" + toEncodedString(args);
}
URL url = new URL(servlet.toExternalForm() + argString);
URLConnection con = url.openConnection();
... | false |
900,540 | 6,214,331 | 11,346,792 | public static void copyFile(File src, File dest) {
try {
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
int c;
while ((c = in.read()) != -1) out.write(c);
in.close();
out.close();
... | public void generate(FileObject outputDirectory, FileObject generatedOutputDirectory, List<Library> libraryModels, String tapdocXml) throws FileSystemException {
if (!generatedOutputDirectory.exists()) {
generatedOutputDirectory.createFolder();
}
if (outputDirectory.exists()) {
... | true |
900,541 | 1,953,925 | 10,247,943 | public boolean deploy(MMedia[] media) {
if (this.getIP_Address().equals("127.0.0.1") || this.getName().equals("localhost")) {
log.warning("You have not defined your own server, we will not really deploy to localhost!");
return true;
}
FTPClient ftp = new FTPClient();
... | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException, NotAuthorizedException, BadRequestException {
try {
if (vtf == null) {
LOG.debug("Serializing from database");
existDocument.st... | false |
900,542 | 12,760,982 | 19,541,856 | public static String MD5Encode(String password) {
MessageDigest messageDigest;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.update(password.getBytes());
final byte[] digest = messageDigest.digest();
final StringBuilder buf = ne... | @RequestMapping(value = "/image/{fileName}", method = RequestMethod.GET)
public void getImage(@PathVariable String fileName, HttpServletRequest req, HttpServletResponse res) throws Exception {
File file = new File(STORAGE_PATH + fileName + ".jpg");
res.setHeader("Cache-Control", "no-store");
... | false |
900,543 | 17,385,831 | 21,733,173 | public static void copyFile(String sourceName, String destName) throws IOException {
FileChannel sourceChannel = null;
FileChannel destChannel = null;
try {
sourceChannel = new FileInputStream(sourceName).getChannel();
destChannel = new FileOutputStream(destName).getC... | private void downloadFtp(File file, URL jurl) throws SocketException, IOException {
System.out.println("downloadFtp(" + file + ", " + jurl + ")");
FTPClient client = new FTPClient();
client.addProtocolCommandListener(new ProtocolCommandListener() {
public void protocolCommandSen... | false |
900,544 | 9,857,940 | 10,242,903 | 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... | private List<Feature> getFeatures(String source, EntryPoint e) throws MalformedURLException, SAXException, IOException, ParserConfigurationException, URISyntaxException {
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
FeatureParser featp = new FeatureParser();
parser.parse... | false |
900,545 | 16,022,022 | 16,069,456 | public boolean copy(Class<?> subCls, String subCol, long id) {
boolean bool = false;
this.result = null;
Connection conn = null;
Object vo = null;
try {
conn = ConnectUtil.getConnect();
conn.setAutoCommit(false);
PojoParser parser = PojoPar... | public void delete(int id) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
stmt = conn.createStatement();
... | true |
900,546 | 11,843,018 | 4,511,510 | public RespID(PublicKey key) throws OCSPException {
try {
MessageDigest digest = MessageDigest.getInstance("SHA1");
ASN1InputStream aIn = new ASN1InputStream(key.getEncoded());
SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(aIn.readObject());
dig... | public static String cryptoSHA(String _strSrc) {
try {
BASE64Encoder encoder = new BASE64Encoder();
MessageDigest sha = MessageDigest.getInstance("SHA");
sha.update(_strSrc.getBytes());
byte[] buffer = sha.digest();
return encoder.encode(buffer);
... | true |
900,547 | 15,805,164 | 6,146,146 | @Override
public boolean isPasswordValid(String encPass, String rawPass, Object salt) throws DataAccessException {
try {
MessageDigest digest = MessageDigest.getInstance(digestAlgorithm);
digest.reset();
digest.update(((String) salt).getBytes("UTF-8"));
St... | public static String encrypt(String text) throws NoSuchAlgorithmException {
MessageDigest md;
md = MessageDigest.getInstance("MD5");
byte[] md5hash = new byte[32];
try {
md.update(text.getBytes("iso-8859-1"), 0, text.length());
} catch (UnsupportedEncodingExceptio... | true |
900,548 | 1,637,147 | 7,990,229 | protected PredicateAnnotationRecord generatePredicateAnnotationRecord(PredicateAnnotationRecord par, String miDescriptor) {
String annotClass = par.annotation.getType().substring(1, par.annotation.getType().length() - 1).replace('/', '.');
String methodName = getMethodName(par);
String hashK... | public static InputStream gunzip(final InputStream inputStream) throws IOException {
Assert.notNull(inputStream, "inputStream");
GZIPInputStream gzipInputStream = new GZIPInputStream(inputStream);
InputOutputStream inputOutputStream = new InputOutputStream();
IOUtils.copy(gzipInputSt... | true |
900,549 | 3,768,628 | 13,212,350 | 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.... | public static void copyFile(File source, File dest) {
try {
FileChannel in = new FileInputStream(source).getChannel();
if (!dest.getParentFile().exists()) dest.getParentFile().mkdirs();
FileChannel out = new FileOutputStream(dest).getChannel();
in.transferTo(0... | true |
900,550 | 2,970,674 | 23,531,658 | private void chopFileDisk() throws IOException {
File tempFile = new File("" + logFile + ".tmp");
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
long startCopyPos;
byte readBuffer[] = new byte[2048];
int readCount;
long totalBytesRead = 0;
... | public void objectParserAssesmentItem(int file, int currentquestion, Resource resTemp) {
NodeList nl = null;
Node n = null;
NamedNodeMap nnp = null;
Node nsrc = null;
URL url = null;
String sFilename = "";
String sNewPath = "";
int indexLastSeparator;
... | true |
900,551 | 19,409,751 | 11,981,880 | public static void compress(final File zip, final Map<InputStream, String> entries) throws IOException {
if (zip == null || entries == null || CollectionUtils.isEmpty(entries.keySet())) throw new IllegalArgumentException("One ore more parameters are empty!");
if (zip.exists()) zip.delete(); else if ... | private void loadProperties() {
if (properties == null) {
properties = new Properties();
try {
URL url = getClass().getResource(propsFile);
properties.load(url.openStream());
} catch (IOException ioe) {
ioe.printStackTrace()... | false |
900,552 | 55,568 | 12,626,918 | public static void httpOnLoad(String fileName, String urlpath) throws Exception {
URL url = new URL(urlpath);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
int responseCode = conn.getResponseCode();
Sy... | public void xtestURL2() throws Exception {
URL url = new URL(IOTest.URL);
InputStream inputStream = url.openStream();
OutputStream outputStream = new FileOutputStream("C:/Temp/testURL2.mp4");
IOUtils.copy(inputStream, outputStream);
inputStream.close();
outputStream.c... | false |
900,553 | 6,641,464 | 20,815,980 | private void SaveLoginInfo() {
int iSize;
try {
if (m_bSavePwd) {
byte[] MD5PWD = new byte[80];
java.security.MessageDigest md = java.security.MessageDigest.getInstance("SHA-1");
String szPath = System.getProperty("user.home");
... | private void getRandomGUID(boolean secure) throws NoSuchAlgorithmException {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("... | true |
900,554 | 22,765,730 | 17,341,373 | public void addUser(String name, String unit, String organizeName, int userId, int orgId, String email) {
Connection connection = null;
PreparedStatement ps = null;
DBOperation dbo = factory.createDBOperation(POOL_NAME);
try {
connection = dbo.getConnection();
... | private void handleServerIntroduction(DataPacket serverPacket) {
DataPacketIterator iter = serverPacket.getDataPacketIterator();
String version = iter.nextString();
int serverReportedUDPPort = iter.nextUByte2();
_authKey = iter.nextUByte4();
_introKey = iter.nextUByte4();
... | false |
900,555 | 20,929,227 | 10,797,166 | private void insertService(String table, int type) {
Connection con = null;
log.info("");
log.info("正在生成" + table + "的服务。。。。。。。");
try {
con = DODataSource.getDefaultCon();
con.setAutoCommit(false);
Statement stmt = con.createStatement();
... | public static String readFromUrl(String url) {
URL url_ = null;
URLConnection uc = null;
BufferedReader in = null;
StringBuilder str = new StringBuilder();
try {
url_ = new URL(url);
uc = url_.openConnection();
in = new BufferedReader(new I... | false |
900,556 | 2,217,508 | 5,832,949 | public static void copyFile(final File sourceFile, final File destFile) throws IOException {
if (destFile.getParentFile() != null && !destFile.getParentFile().mkdirs()) {
LOG.error("GeneralHelper.copyFile(): Cannot create parent directories from " + destFile);
}
FileInputStream f... | private void getImage(String filename) throws MalformedURLException, IOException, SAXException, FileNotFoundException {
String url = Constants.STRATEGICDOMINATION_URL + "/images/gameimages/" + filename;
WebRequest req = new GetMethodWebRequest(url);
WebResponse response = wc.getResponse(req)... | true |
900,557 | 7,245,722 | 73,657 | private String listaArquivo() {
String arquivo = "";
String linha = "";
try {
URL url = new URL(this.getCodeBase(), "./listador?dir=" + "cenarios" + "/" + user);
URLConnection con = url.openConnection();
con.setUseCaches(false);
InputStream in ... | 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... | true |
900,558 | 14,800,064 | 20,453,777 | protected Set<String> moduleNamesFromReader(URL url) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
Set<String> names = new HashSet<String>();
String line;
while ((line = reader.readLine()) != null) {
line = line.... | private static List retrieveQuotes(Report report, Symbol symbol, TradingDate startDate, TradingDate endDate) throws ImportExportException {
List quotes = new ArrayList();
String URLString = constructURL(symbol, startDate, endDate);
EODQuoteFilter filter = new YahooEODQuoteFilter(symbol);
... | true |
900,559 | 8,708,052 | 13,281,981 | public ActionForward dbExecute(ActionMapping pMapping, ActionForm pForm, HttpServletRequest pRequest, HttpServletResponse pResponse) throws DatabaseException {
Integer key;
SubmitUserForm form = (SubmitUserForm) pForm;
if (pRequest.getParameter("key") == null) {
key = form.getPri... | private void bokActionPerformed(java.awt.event.ActionEvent evt) {
Vector vret = this.uniformtitlepanel.getEnteredValuesKeys();
String[] patlib = newgen.presentation.NewGenMain.getAppletInstance().getPatronLibraryIds();
String xmlreq = newgen.presentation.administration.AdministrationXMLGener... | false |
900,560 | 10,425,169 | 23,465,746 | private void getRandomGUID(boolean secure, Object o) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("Error: " + e);
... | 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 |
900,561 | 9,312,243 | 3,430,781 | 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... | public static String getTextFromPart(Part part) {
try {
if (part != null && part.getBody() != null) {
InputStream in = part.getBody().getInputStream();
String mimeType = part.getMimeType();
if (mimeType != null && MimeUtility.mimeTypeMatches(mimeTy... | true |
900,562 | 14,287,646 | 488,614 | private String getStoreName() {
try {
final MessageDigest digest = MessageDigest.getInstance("MD5");
digest.update(protectionDomain.getBytes());
final byte[] bs = digest.digest();
final StringBuffer sb = new StringBuffer(bs.length * 2);
for (int i ... | 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;
... | false |
900,563 | 10,142,186 | 10,005,623 | public static String getMD5Str(String str) {
MessageDigest messageDigest = null;
try {
messageDigest = MessageDigest.getInstance("MD5");
messageDigest.reset();
messageDigest.update(str.getBytes("UTF-8"));
} catch (NoSuchAlgorithmException e) {
... | public synchronized String getSerialNumber() {
if (serialNum != null) return serialNum;
final StringBuffer buf = new StringBuffer();
Iterator it = classpath.iterator();
while (it.hasNext()) {
ClassPathEntry entry = (ClassPathEntry) it.next();
buf.append(entry.... | true |
900,564 | 16,199,085 | 22,950,125 | @Override
public byte[] read(String path) throws PersistenceException {
path = fmtPath(path);
try {
S3Object fileObj = s3Service.getObject(bucketObj, path);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(fileObj.getDataInputStream(), out... | private boolean importPKC(String keystoreLocation, String pw, String pkcFile, String alias) {
boolean imported = false;
KeyStore ks = null;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
ks.load(new BufferedInputStream(new FileInputStream(keystoreLocation... | true |
900,565 | 831,650 | 7,960,119 | 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.... | private void getRandomGuid(boolean secure) {
MessageDigest md5 = null;
StringBuffer sbValueBeforeMD5 = new StringBuffer();
try {
md5 = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
}
lon... | false |
900,566 | 20,508,694 | 17,296,395 | private void tar(FileHolder fileHolder, boolean gzipIt) {
byte[] buffer = new byte[BUFFER_SIZE];
int bytes_read;
if (fileHolder.selectedFileList.size() == 0) {
return;
}
File tarDestFile = new File(fileHolder.destFiles[0]);
try {
OutputStream o... | public static File copyToLibDirectory(final File file) throws FileNotFoundException, IOException {
if (file == null || !file.exists()) {
throw new FileNotFoundException();
}
File directory = new File("lib/");
File dest = new File(directory, file.getName());
File p... | true |
900,567 | 11,656,036 | 21,513,130 | @SuppressWarnings("unchecked")
public static void createInstance(ExternProtoDeclare externProtoDeclare) {
ExternProtoDeclareImport epdi = new ExternProtoDeclareImport();
HashMap<String, ProtoDeclareImport> protoMap = X3DImport.getTheImport().getCurrentParser().getProtoMap();
boolean load... | public static String hashMD5(String passw) {
String passwHash = "";
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(passw.getBytes());
byte[] result = md.digest();
StringBuffer sb = new StringBuffer();
for (int i = 0; i... | false |
900,568 | 14,563,781 | 18,005,008 | public static void parseString(String str, String name) {
BufferedReader reader;
String zeile = null;
boolean firstL = true;
int lambda;
float intens;
int l_b = 0;
int l_e = 0;
HashMap<Integer, Float> curve = new HashMap<Integer, Float>();
Stri... | public IUserProfile getUserProfile(String profileID) throws MM4UUserProfileNotFoundException {
SimpleUserProfile tempProfile = null;
String tempProfileString = this.profileURI + profileID + FILE_SUFFIX;
try {
URL url = new URL(tempProfileString);
Debug.println("Retrie... | true |
900,569 | 18,178,530 | 13,307,307 | public static void copyFile(File src, File dst) throws IOException {
LOGGER.info("Copying file '" + src.getAbsolutePath() + "' to '" + dst.getAbsolutePath() + "'");
FileChannel in = null;
FileChannel out = null;
try {
FileInputStream fis = new FileInputStream(src);
... | private static void doCopyFile(FileInputStream in, FileOutputStream out) {
FileChannel inChannel = null, outChannel = null;
try {
inChannel = in.getChannel();
outChannel = out.getChannel();
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IO... | true |
900,570 | 9,952,202 | 3,709,102 | public void testIntegrityViolation() throws Exception {
if (getDialect() instanceof MySQLMyISAMDialect) {
reportSkip("MySQL (ISAM) does not support FK violation checking", "exception conversion");
return;
}
SQLExceptionConverter converter = getDialect().buildSQLExcept... | public void removerTopicos(Topicos topicos) throws ClassNotFoundException, SQLException {
this.criaConexao(false);
String sql = "DELETE FROM \"Topicos\" " + " WHERE \"id_Topicos\" = ?";
PreparedStatement stmt = null;
try {
stmt = connection.prepareStatement(sql);... | true |
900,571 | 13,616,724 | 22,301,096 | public void write(File file) throws Exception {
if (medooFile != null) {
if (!medooFile.renameTo(file)) {
BufferedInputStream in = null;
BufferedOutputStream out = null;
try {
in = new BufferedInputStream(new FileInputStream(med... | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | true |
900,572 | 19,130,322 | 19,538,929 | 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... | public void invoke(WorkflowContext arg0, ProgressMonitor arg1, Issues arg2) {
File inputFile = new File(getInputFile());
File outputFile = new File(getOutputFile());
if (!getFileExtension(getInputFile()).equalsIgnoreCase(getFileExtension(getOutputFile())) || !getFileExtension(getInputFile())... | false |
900,573 | 20,492,176 | 7,839,474 | public String postEvent(EventDocument eventDoc, Map attachments) {
if (eventDoc == null || eventDoc.getEvent() == null) return null;
if (jmsTemplate == null) {
sendEvent(eventDoc, attachments);
return eventDoc.getEvent().getEventId();
}
if (attachments != null... | private Map<String, DomAttr> getAttributesFor(final BaseFrame frame) throws IOException {
final Map<String, DomAttr> map = createAttributesCopyWithClonedAttribute(frame, "src");
final DomAttr srcAttr = map.get("src");
if (srcAttr == null) {
return map;
}
final Pag... | true |
900,574 | 3,253,205 | 20,777,139 | private String generateUniqueIdMD5(Run run, HttpServletRequest request, String groupIdString) {
String portalUrl = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
String uniqueportalUrl = portalUrl + "run:" + run.getId().toString() + "group:" + groupIdString;
... | protected static String encodePassword(String password) {
try {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(password.getBytes());
return HexString.bufferToHex(md.digest());
} catch (NoSuchAlgorithmException e) {
throw new RuntimeExce... | true |
900,575 | 3,573,436 | 22,415,294 | public HttpURLConnection getConnection(String urlString) throws IOException {
URL url = new URL(urlString);
HttpURLConnection connection = null;
if (_proxy == null) {
connection = (HttpURLConnection) url.openConnection();
} else {
URLConnection con = url.openC... | private String getRenderedBody(String spec) throws Exception {
log.entering(Rss2MailTask.class.getName(), "getRenderedBody");
final URL url = new URL(spec);
final HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.connect();
final InputStream ... | false |
900,576 | 3,636,960 | 13,028,547 | public void display(WebPage page, HttpServletRequest req, HttpServletResponse resp) throws DisplayException {
page.getDisplayInitialiser().initDisplay(new HttpRequestDisplayContext(req), req);
StreamProvider is = (StreamProvider) req.getAttribute(INPUTSTREAM_KEY);
if (is == null) {
... | 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 |
900,577 | 73,110 | 20,898,459 | 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 static void copy(String fromFileName, String toFileName) throws IOException {
File fromFile = new File(fromFileName);
File toFile = new File(toFileName);
if (!fromFile.exists()) throw new IOException("FileCopy: " + "no such source file: " + fromFileName);
if (!fromFile.isFile(... | false |
900,578 | 13,026,685 | 15,017,482 | public DoSearch(String searchType, String searchString) {
String urlString = dms_url + "/servlet/com.ufnasoft.dms.server.ServerDoSearch";
String rvalue = "";
String filename = dms_home + FS + "temp" + FS + username + "search.xml";
try {
String urldata = urlString + "?user... | private static String getSuitableWCSVersion(String host, String _version) throws ConnectException, IOException {
String request = WCSProtocolHandler.buildCapabilitiesSuitableVersionRequest(host, _version);
String version = new String();
StringReader reader = null;
DataInputStream dis... | false |
900,579 | 12,524,253 | 18,956,180 | 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... | private void copyMerge(Path[] sources, OutputStream out) throws IOException {
Configuration conf = getConf();
for (int i = 0; i < sources.length; ++i) {
FileSystem fs = sources[i].getFileSystem(conf);
InputStream in = fs.open(sources[i]);
try {
IOU... | true |
900,580 | 18,115,173 | 15,571,541 | private void copy(File in, File out) {
log.info("Copying yam file from: " + in.getName() + " to: " + out.getName());
try {
FileChannel ic = new FileInputStream(in).getChannel();
FileChannel oc = new FileOutputStream(out).getChannel();
ic.transferTo(0, ic.size(), o... | 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.... | true |
900,581 | 4,298,180 | 10,634,007 | public static String md5(String texto) {
String resultado;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(texto.getBytes());
BigInteger hash = new BigInteger(1, md5.digest());
resultado = hash.toString(16);
if (resul... | public static EXISchema getEXISchema(String fileName, Class<?> cls, EXISchemaFactoryErrorHandler compilerErrorHandler) throws IOException, ClassNotFoundException, EXISchemaFactoryException {
EXISchemaFactory schemaCompiler = new EXISchemaFactory();
schemaCompiler.setCompilerErrorHandler(compilerErro... | false |
900,582 | 13,192,162 | 10,107,377 | protected List<String> execute(String queryString, String sVar, String filter) throws UnsupportedEncodingException, IOException {
String query = URLEncoder.encode(queryString, "UTF-8");
String urlString = "http://sparql.bibleontology.com/sparql.jsp?sparql=" + query + "&type1=xml";
URL url;
... | @Deprecated
public static Collection<SearchKeyResult> searchKey(String iText, String iKeyServer) throws Exception {
List<SearchKeyResult> outVec = new ArrayList<SearchKeyResult>();
String uri = iKeyServer + "/pks/lookup?search=" + URLEncoder.encode(iText, UTF8);
URL url = new URL(uri);
... | false |
900,583 | 20,953,556 | 20,601,756 | public String loadFileContent(final String _resourceURI) {
final Lock readLock = this.fileLock.readLock();
final Lock writeLock = this.fileLock.writeLock();
boolean hasReadLock = false;
boolean hasWriteLock = false;
try {
readLock.lock();
hasReadLock =... | public static File copyFile(String path) {
File src = new File(path);
File dest = new File(src.getName());
try {
if (!dest.exists()) {
dest.createNewFile();
}
FileChannel source = new FileInputStream(src).getChannel();
FileChann... | true |
900,584 | 92,552 | 7,999,742 | 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 InputStream urlToInputStream(URL url) throws IOException {
URLConnection conn = url.openConnection();
conn.setRequestProperty("User-Agent", IE);
conn.setRequestProperty("Accept-Encoding", "gzip, deflate");
conn.connect();
String encoding = conn.getContentEncoding();
... | false |
900,585 | 12,754,270 | 15,031,489 | private void fileUpload() throws IOException {
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(postURL);
MultipartEntity mpEntity = new MultipartEntity(HttpMultipartMode.BROWSER_COMPATIBLE);
mpEntity.addPart("Filename", new StringBody(file.getName())... | public Point getCoordinates(String address, String city, String state, String country) {
StringBuilder queryString = new StringBuilder();
StringBuilder urlString = new StringBuilder();
StringBuilder response = new StringBuilder();
if (address != null) {
queryString.append... | false |
900,586 | 14,832,930 | 10,785,895 | private static String format(String check) throws NoSuchAlgorithmException, UnsupportedEncodingException {
check = check.replaceAll(" ", "");
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(check.getBytes("ISO-8859-1"));
byte[] end = md5.digest();
String dige... | private void createPropertyName(String objectID, String value, String propertyName, Long userID) throws JspTagException {
rObject object = new rObject(new Long(objectID), userID);
ClassProperty classProperty = new ClassProperty(propertyName, object.getClassName());
String newValue = value;
... | true |
900,587 | 18,560,649 | 13,279,978 | private static final void addFile(ZipArchiveOutputStream os, File file, String prefix) throws IOException {
ArchiveEntry entry = os.createArchiveEntry(file, file.getAbsolutePath().substring(prefix.length() + 1));
os.putArchiveEntry(entry);
FileInputStream fis = new FileInputStream(file);
... | @Override
public void sendContent(OutputStream out, Range range, Map<String, String> params, String contentType) throws IOException {
LOGGER.debug("DOWNLOAD - Send content: " + realFile.getAbsolutePath());
LOGGER.debug("Output stream: " + out.toString());
if (ServerConfiguration.isDynami... | true |
900,588 | 22,207,815 | 21,113,767 | 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... | @Override
public void render(Output output) throws IOException {
output.setStatus(headersFile.getStatusCode(), headersFile.getStatusMessage());
for (Entry<String, Set<String>> header : headersFile.getHeadersMap().entrySet()) {
Set<String> values = header.getValue();
for (... | true |
900,589 | 7,893,892 | 10,249,398 | public static String md5EncodeString(String s) throws UnsupportedEncodingException, NoSuchAlgorithmException {
if (s == null) return null;
if (StringUtils.isBlank(s)) return "";
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(s.... | public 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 |
900,590 | 8,364,547 | 1,953,115 | @Override
public void executeInterruptible() {
encodingTerminated = false;
File destinationFile = null;
try {
Runtime runtime = Runtime.getRuntime();
IconAndFileListElement element;
while ((element = getNextFileElement()... | protected int doWork() {
SAMFileReader reader = new SAMFileReader(IoUtil.openFileForReading(INPUT));
reader.getFileHeader().setSortOrder(SORT_ORDER);
SAMFileWriter writer = new SAMFileWriterFactory().makeSAMOrBAMWriter(reader.getFileHeader(), false, OUTPUT);
Iterator<SAMRecord> itera... | true |
900,591 | 8,162,671 | 14,778,878 | public static String getMD5Hash(String hashthis) throws NoSuchAlgorithmException {
byte[] key = "PATIENTISAUTHENTICATION".getBytes();
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(hashthis.getBytes());
return new String(HashUtility.base64Encode(md5.digest(key)));
... | public void copyFile(String oldPathFile, String newPathFile) {
try {
int bytesum = 0;
int byteread = 0;
File oldfile = new File(oldPathFile);
if (oldfile.exists()) {
InputStream inStream = new FileInputStream(oldPathFile);
FileO... | false |
900,592 | 8,961,871 | 18,741,084 | public Transaction() throws Exception {
Connection Conn = null;
Statement Stmt = null;
try {
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
Conn = DriverManager.getConnection(DBUrl);
Conn.setAutoCommit(true);
Stmt = Conn.createStatemen... | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | false |
900,593 | 14,263,421 | 20,251,886 | void copyFile(String sInput, String sOutput) throws IOException {
File inputFile = new File(sInput);
File outputFile = new File(sOutput);
FileReader in = new FileReader(inputFile);
FileWriter out = new FileWriter(outputFile);
int c;
while ((c = in.read()) != -1) out.w... | private void initJarURL() {
try {
URL url = getKwantuJarURLInMavenRepo(artifactId, version);
File tempJarFile = File.createTempFile(artifactId + "-" + version, ".jar");
OutputStream out = new FileOutputStream(tempJarFile);
InputStream in = url.openStream();
... | false |
900,594 | 8,364,547 | 1,048,665 | @Override
public void executeInterruptible() {
encodingTerminated = false;
File destinationFile = null;
try {
Runtime runtime = Runtime.getRuntime();
IconAndFileListElement element;
while ((element = getNextFileElement()... | public static void copy(String from_name, String to_name) throws IOException {
File from_file = new File(from_name);
File to_file = new File(to_name);
if (!from_file.exists()) abort("FileCopy: no such source file: " + from_name);
if (!from_file.isFile()) abort("FileCopy: can't copy d... | true |
900,595 | 725,986 | 7,604,737 | public void writeToFtp(String login, String password, String address, String directory, String filename) {
String newline = System.getProperty("line.separator");
try {
URL url = new URL("ftp://" + login + ":" + password + "@ftp." + address + directory + filename + ".html" + ";type=i");
... | public String get(String url) {
String buf = null;
StringBuilder resultBuffer = new StringBuilder(512);
if (debug.DEBUG) debug.logger("gov.llnl.tox.util.href", "get(url)>> " + url);
try {
URL theURL = new URL(url);
URLConnection urlConn = theURL.openConnection... | false |
900,596 | 22,242,021 | 2,113,293 | 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... | protected void setUp() throws Exception {
testOutputDirectory = new File(getClass().getResource("/").getPath());
zipFile = new File(this.testOutputDirectory, "/plugin.zip");
zipOutputDirectory = new File(this.testOutputDirectory, "zip");
zipOutputDirectory.mkdir();
logger.fin... | false |
900,597 | 13,387,011 | 20,493,867 | private void updateViewerContent(ScrollingGraphicalViewer viewer) {
BioPAXGraph graph = (BioPAXGraph) viewer.getContents().getModel();
if (!graph.isMechanistic()) return;
Map<String, Color> highlightMap = new HashMap<String, Color>();
for (Object o : graph.getNodes()) {
I... | @Override
public void execute(JobExecutionContext context) throws JobExecutionException {
super.execute(context);
debug("Start execute job " + this.getClass().getName());
try {
String name = "nixspam-ip.dump.gz";
String f = this.path_app_root + "/" + this.properti... | false |
900,598 | 4,645,054 | 4,981,909 | public ActualTask(TEditor editor, TIGDataBase dataBase, String directoryPath, Vector images) {
int i;
lengthOfTask = images.size();
Element dataBaseXML = new Element("dataBase");
for (i = 0; ((i < images.size()) && !stop && !cancel); i++) {
Vector ... | public static File enregistrerFichier(String fileName, File file, String path, String fileMime) throws Exception {
if (file != null) {
try {
HttpServletRequest request = ServletActionContext.getRequest();
HttpSession session = request.getSession();
... | true |
900,599 | 6,403,884 | 18,741,084 | private boolean copyOldSetupClass(File lastVerPath, File destPath) throws java.io.FileNotFoundException, IOException {
byte[] buf;
File oldClass = new File(lastVerPath.getAbsolutePath() + File.separator + installClassName_ + ".class");
if (oldClass.exists()) {
FileOutputStream ou... | public static void copyFile(File sourceFile, File destFile) throws IOException {
if (!destFile.exists()) {
destFile.createNewFile();
}
FileChannel source = null;
FileChannel destination = null;
try {
source = new FileInputStream(sourceFile).getChannel(... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.