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 |
|---|---|---|---|---|---|
4,200 | 16,545,678 | 14,855,960 | private boolean copyFile(File inFile, File outFile) {
BufferedReader reader = null;
BufferedWriter writer = null;
try {
reader = new BufferedReader(new FileReader(inFile));
writer = new BufferedWriter(new FileWriter(outFile));
while (reader.ready()) {
... | 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 |
4,201 | 4,591,684 | 9,543,279 | public static void copyDirs(File sourceDir, File destDir) throws IOException {
if (!destDir.exists()) destDir.mkdirs();
for (File file : sourceDir.listFiles()) {
if (file.isDirectory()) {
copyDirs(file, new File(destDir, file.getName()));
} else {
... | @Override
protected void write(InputStream in, OutputStream out, javax.sound.sampled.AudioFormat javaSoundFormat) throws IOException {
if (USE_JAVASOUND) {
super.write(in, out, javaSoundFormat);
} else {
try {
byte[] header = JavaSoundCodec.createWavHeader... | true |
4,202 | 14,380,467 | 8,107,001 | public String readTemplateToString(String fileName) {
URL url = null;
url = classLoader.getResource(fileName);
StringBuffer content = new StringBuffer();
if (url == null) {
String error = "Template file could not be found: " + fileName;
throw new RuntimeExcept... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.listview);
HttpGet request = new HttpGet(SERVICE_URI + "/json/getroutes/1");
request.setHeader("Accept", "application/json");
request.setHeader("Content... | true |
4,203 | 20,627,152 | 1,856,551 | public void loadLicenceText() {
try {
URL url = this.getClass().getResource("/licences/" + this.files[this.licence_text_id]);
InputStreamReader ins = new InputStreamReader(url.openStream());
BufferedReader br = new BufferedReader(ins);
String line;
... | public InputStream open() {
try {
if ("file".equals(url.getProtocol())) {
if (new File(url.toURI()).exists()) {
inputStream = url.openStream();
}
} else {
con = url.openConnection();
if (con instanceo... | false |
4,204 | 461,629 | 13,368,519 | 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... | public void sendTemplate(String filename, TemplateValues values) throws IOException {
Checker.checkEmpty(filename, "filename");
Checker.checkNull(values, "values");
URL url = _getFile(filename);
boolean writeSpaces = Context.getRootContext().getRunMode() == RUN_MODE.DEV ? true : fals... | false |
4,205 | 9,152,056 | 4,961,139 | public AbstractASiCSignatureService(InputStream documentInputStream, DigestAlgo digestAlgo, RevocationDataService revocationDataService, TimeStampService timeStampService, String claimedRole, IdentityDTO identity, byte[] photo, TemporaryDataStorage temporaryDataStorage, OutputStream documentOutputStream) throws IOE... | @Override
public void delArtista(Integer numeroInscricao) throws Exception {
Connection conn = null;
PreparedStatement ps = null;
try {
conn = C3P0Pool.getConnection();
String sql = "delete from artista where numeroinscricao = ?";
ps = conn.prepareStat... | false |
4,206 | 19,172,383 | 17,415,425 | public void readEntry(String name, InputStream input) throws Exception {
File file = new File(this.directory, name);
OutputStream output = new BufferedOutputStream(FileUtils.openOutputStream(file));
try {
org.apache.commons.io.IOUtils.copy(input, output);
... | public void overwriteTest() throws Exception {
SRBAccount srbAccount = new SRBAccount("srb1.ngs.rl.ac.uk", 5544, this.cred);
srbAccount.setDefaultStorageResource("ral-ngs1");
SRBFileSystem client = new SRBFileSystem(srbAccount);
client.setFirewallPorts(64000, 65000);
String h... | true |
4,207 | 6,368,468 | 235,245 | boolean copyFileStructure(File oldFile, File newFile) {
if (oldFile == null || newFile == null) return false;
File searchFile = newFile;
do {
if (oldFile.equals(searchFile)) return false;
searchFile = searchFile.getParentFile();
} while (searchFile != null);
... | public void 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... | true |
4,208 | 316,364 | 20,559,735 | public void addFinance(int clubid, int quarterid, String date, String desc, String loc, BigDecimal amount) throws FinanceException, SQLException {
String budgetQuery = "SELECT used, available FROM Budget WHERE club_id=" + clubid + " and quarter_id=" + quarterid + ";";
String financeUpdate = "INSERT ... | public void deletePortletName(PortletNameBean portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (portletNameBean.getPortletId() == null) throw new IllegalArgumentException("portletNameId is nu... | true |
4,209 | 19,643,372 | 17,360,683 | 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 String generateMD5(String clear) {
byte hash[] = null;
try {
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(clear.getBytes());
hash = md5.digest();
} catch (NoSuchAlgorithmException e) {
}
if (hash != null) {... | false |
4,210 | 10,398,988 | 1,026,390 | public void putDataFiles(String server, String username, String password, String folder, String destinationFolder) {
try {
FTPClient ftp = new FTPClient();
ftp.connect(server);
System.out.println("Connected");
ftp.login(username, password);
System.... | public boolean login(String strUrl, String loginName, String loginPwd) throws ApplicationException {
String starter = "-----------------------------";
String returnChar = "\r\n";
String lineEnd = "--";
String urlString = strUrl;
String input = null;
List txtList = new... | false |
4,211 | 4,594,844 | 3,236,017 | @Override
public void execute() throws BuildException {
final String GC_USERNAME = "google-code-username";
final String GC_PASSWORD = "google-code-password";
if (StringUtils.isBlank(this.projectName)) throw new BuildException("undefined project");
if (this.file == null) throw new... | public static void copyFile(String source, String dest) throws IOException {
FileChannel in = null, out = null;
try {
in = new FileInputStream(new File(source)).getChannel();
out = new FileOutputStream(new File(dest)).getChannel();
in.transferTo(0, in.size(), out)... | true |
4,212 | 3,818,339 | 19,076,701 | public String hash(String plainTextPassword) {
try {
MessageDigest digest = MessageDigest.getInstance(digestAlgorithm);
digest.update(plainTextPassword.getBytes(charset));
byte[] rawHash = digest.digest();
return new String(org.jboss.seam.util.Hex.encodeHex(ra... | public static String crypt(String str) {
if (str == null || str.length() == 0) {
throw new IllegalArgumentException("String to encript cannot be null or zero length");
}
StringBuffer hexString = new StringBuffer();
try {
MessageDigest md = MessageDigest.getIns... | true |
4,213 | 951,388 | 20,601,756 | public static void zipFile(String file, String entry) throws IOException {
FileInputStream in = new FileInputStream(file);
ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file + ".zip"));
out.putNextEntry(new ZipEntry(entry));
byte[] buffer = new byte[4096];
in... | 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 |
4,214 | 15,854,397 | 2,915,107 | 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... | public static void unZip(String unZipfileName, String outputDirectory) throws IOException, FileNotFoundException {
FileOutputStream fileOut;
File file;
ZipEntry zipEntry;
ZipInputStream zipIn = new ZipInputStream(new BufferedInputStream(new FileInputStream(unZipfileName)), encoder);
... | true |
4,215 | 20,109,527 | 3,402,498 | private void writeMessage(ChannelBuffer buffer, File dst) throws IOException {
ChannelBufferInputStream is = new ChannelBufferInputStream(buffer);
OutputStream os = null;
try {
os = new FileOutputStream(dst);
IOUtils.copyLarge(is, os);
} finally {
... | private static void readFileEntry(Zip64File zip64File, FileEntry fileEntry, File destFolder) {
FileOutputStream fileOut;
File target = new File(destFolder, fileEntry.getName());
File targetsParent = target.getParentFile();
if (targetsParent != null) {
targetsParent.mkdirs... | true |
4,216 | 23,594,635 | 15,016,151 | private void copyFileToPhotoFolder(File photo, String personId) {
try {
FileChannel in = new FileInputStream(photo).getChannel();
File dirServer = new File(Constants.PHOTO_DIR);
if (!dirServer.exists()) {
dirServer.mkdirs();
}
File ... | private void readChildrenData() throws Exception {
URL url;
URLConnection connect;
BufferedInputStream in;
try {
url = getURL("CHILDREN.TAB");
connect = url.openConnection();
InputStream ois = connect.getInputStream();
if (ois == null) ... | false |
4,217 | 9,838,495 | 21,496,578 | public void go() throws FBConnectionException, FBErrorException, IOException {
clearError();
results = new LoginResults();
URL url = new URL(getHost() + getPath());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestProperty("X-FB-User", getUser... | public Object construct() {
String fullName = lRegatta.getSaveDirectory() + lRegatta.getSaveName();
System.out.println(MessageFormat.format(res.getString("MainMessageBackingUp"), new Object[] { fullName + BAK }));
try {
FileInputStream fis ... | false |
4,218 | 19,824,066 | 5,244,020 | public boolean visar() throws SQLException, ClassNotFoundException, Exception {
Connection conn = null;
PreparedStatement ps = null;
Date fechaSystem = new Date();
DateFormat aaaammdd = new SimpleDateFormat("yyyyMMdd");
DateFormat hhmmss = new SimpleDateFormat("HHmmss");
... | public static AddUserResponse napiUserAdd(String user, String pass, String email) throws TimeoutException, InterruptedException, IOException {
if (user.matches("^[a-zA-Z0-9]{2,20}$") == false) {
return AddUserResponse.NAPI_ADD_USER_BAD_LOGIN;
}
if (pass.equals("")) {
... | false |
4,219 | 18,880,060 | 4,247,524 | public static boolean copy(File source, File target) {
try {
if (!source.exists()) return false;
target.getParentFile().mkdirs();
InputStream input = new FileInputStream(source);
OutputStream output = new FileOutputStream(target);
byte[] buf = new ... | public static String backupFile(File source) {
File backup = new File(source.getParent() + "/~" + source.getName());
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(source)));
BufferedWriter writer = new BufferedWriter(new OutputStre... | true |
4,220 | 916,271 | 10,005,879 | 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... | @Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
HttpClient client = new DefaultHttpClient();
HttpGet httpGetRequest = new HttpGet("http://www.google.com/");
String line = "", responseString ... | false |
4,221 | 934,048 | 5,644,911 | 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 long writeVMDKFile(String absoluteFile, String urlString) throws Exception {
URL urlCon = new URL(urlString);
HttpsURLConnection conn = (HttpsURLConnection) urlCon.openConnection();
conn.setDoInput(true);
conn.setDoOutput(true);
conn.setAllowUserInteraction(tru... | false |
4,222 | 13,207,436 | 21,652,268 | public Object sendObjectRequestToSpecifiedServer(java.lang.String serverName, java.lang.String servletName, java.lang.Object request) {
Object reqxml = null;
org.jdom.Document retdoc = null;
String myurl = java.util.prefs.Preferences.systemRoot().get("serverurl", "");
String myport =... | private final synchronized Vector<Class<?>> findSubclasses(URL location, String packageName, Class<?> superClass) {
Map<Class<?>, URL> thisResult = new TreeMap<Class<?>, URL>(CLASS_COMPARATOR);
Vector<Class<?>> v = new Vector<Class<?>>();
String fqcn = searchClass.getName();
List<URL... | false |
4,223 | 12,358,637 | 22,880,847 | public AudioInputStream getAudioInputStream(URL url) throws UnsupportedAudioFileException, IOException {
InputStream inputStream = url.openStream();
try {
return getAudioInputStream(inputStream);
} catch (UnsupportedAudioFileException e) {
inputStream.close();
... | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
long time = System.currentTimeMillis(... | false |
4,224 | 10,778,361 | 16,098,010 | public void writeData(String name, int items, int mznum, int mzscale, long tstart, long tdelta, int[] peaks) {
PrintWriter file = getWriter(name + ".txt");
file.println("999 9999");
file.println("Doe, John");
file.println("TEST Lab");
if (mzscale == 1) file.println("PALMS Pos... | public static void copyFile(String src, String target) throws IOException {
FileChannel ic = new FileInputStream(src).getChannel();
FileChannel oc = new FileOutputStream(target).getChannel();
ic.transferTo(0, ic.size(), oc);
ic.close();
oc.close();
}
| true |
4,225 | 14,263,421 | 1,048,665 | 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... | 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 |
4,226 | 13,209,824 | 15,700,614 | private void loadConfig(ServletContext ctx, String configFileName) {
Digester digester = new Digester();
digester.push(this);
digester.addFactoryCreate("pagespy/server", new AbstractObjectCreationFactory() {
public Object createObject(Attributes attrs) {
String c... | public void open() throws IOException, RecursionException {
String encoding = null;
if (source != null) {
Reader sourceReader = source.getCharacterStream();
if (sourceReader != null) {
if (readerReader == null) readerReader = new XMLReaderReader();
... | false |
4,227 | 5,927,306 | 2,453,985 | boolean createSessionArchive(String archiveFilename) {
byte[] buffer = new byte[1024];
try {
ZipOutputStream archive = new ZipOutputStream(new FileOutputStream(archiveFilename));
for (mAnnotationsCursor.moveToFirst(); !mAnnotationsCursor.isAfterLast(); mAnnotationsCursor.move... | @Override
public void login() {
loginsuccessful = false;
try {
HttpParams params = new BasicHttpParams();
params.setParameter("http.useragent", "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-GB; rv:1.9.2) Gecko/20100115 Firefox/3.6");
DefaultHttpClient httpclien... | false |
4,228 | 14,227,643 | 3,854,738 | public String hmacSHA256(String message, byte[] key) {
MessageDigest sha256 = null;
try {
sha256 = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException e) {
throw new java.lang.AssertionError(this.getClass().getName() + ".hmacSHA256(): SHA-256 algor... | public void loadProperties() throws IOException {
File file = new File(filename);
URL url = file.toURI().toURL();
Properties temp = new Properties();
temp.load(url.openStream());
Point2d start = new Point2d();
Point2d end = new Point2d();
if (temp.getProperty(... | false |
4,229 | 21,461,424 | 10,682,592 | public static final void copy(String source, String destination) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(source);
fos = new FileOutputStream(destination);
java.nio.channels.FileChannel channelSrc = fis.get... | private InputStream open(String url) throws IOException {
debug(url);
if (!useCache) {
return new URL(url).openStream();
}
File f = new File(System.getProperty("java.io.tmpdir", "."), Digest.SHA1.encrypt(url) + ".xml");
debug("Cache : " + f);
if (f.exists(... | true |
4,230 | 16,951,199 | 23,582,992 | public void testReleaseOnIOException() throws Exception {
localServer.register("/dropdead", new HttpRequestHandler() {
public void handle(final HttpRequest request, final HttpResponse response, final HttpContext context) throws HttpException, IOException {
BasicHttpEntity entity... | public int doCheck(URL url) throws IOException {
long start = (System.currentTimeMillis());
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null) {
}
in.close();
long end ... | false |
4,231 | 22,924,615 | 13,222,049 | @Override
public void run() {
try {
bitmapDrawable = new BitmapDrawable(new URL(url).openStream());
imageCache.put(id, new SoftReference<Drawable>(bitmapDrawable));
log("image::: put: id = " + id + " ");
... | public void testAutoCommit() throws Exception {
Connection con = getConnectionOverrideProperties(new Properties());
try {
Statement stmt = con.createStatement();
assertEquals(0, stmt.executeUpdate("create table #testAutoCommit (i int)"));
con.setAutoCommit(false);... | false |
4,232 | 16,499,419 | 20,287,675 | public String doAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
UploadFileForm vo = (UploadFileForm) form;
String review = request.getParameter("review");
String realpath = getServlet().getServletContext().getRealPath("... | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String pathInfo = request.getPathInfo();
getLog().info("Process request " + pathInfo);
if (null != pathInfo) {
String pathId = getPathId(pathInfo);
J... | true |
4,233 | 16,466,520 | 1,577,152 | 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 void run() {
try {
File inf = new File(dest);
if (!inf.exists()) {
inf.getParentFile().mkdirs();
}
FileChannel in = new FileInputStream(src).getChannel();
FileCh... | true |
4,234 | 1,851,606 | 241,286 | private void parseExternalCss(Document d) throws XPathExpressionException, IOException {
InputStream is = null;
try {
XPath xp = xpf.newXPath();
XPathExpression xpe = xp.compile("//link[@type='text/css']/@href");
NodeList nl = (NodeList) xpe.evaluate(d, XPathConst... | 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 |
4,235 | 8,587,767 | 4,928,350 | public static String encodeMD5(String input) {
MessageDigest md = null;
byte[] byteHash = null;
StringBuffer resultString = new StringBuffer();
try {
md = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e) {
System.out.println("NoSu... | private static String getBase64(String text, String algorithm) throws NoSuchAlgorithmException {
AssertUtility.notNull(text);
AssertUtility.notNullAndNotSpace(algorithm);
String base64;
MessageDigest md = MessageDigest.getInstance(algorithm);
md.update(text.getBytes());
... | true |
4,236 | 87,685 | 1,024,884 | 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;
... | @Override
protected URLConnection openConnection(URL url) throws IOException {
try {
final HttpServlet servlet;
String path = url.getPath();
if (path.matches("reg:.+")) {
String registerName = path.replaceAll("reg:([^/]*)/.*", "$1");
se... | false |
4,237 | 23,677,135 | 21,273,051 | public static void BubbleSortFloat1(float[] num) {
boolean flag = true; // set flag to true to begin first pass
float temp; // holding variable
while (flag) {
flag = false; // set flag to false awaiting a possible swap
for (int j = 0; j < num.length - 1; j++) {
if (num[j] > num[j + 1]) // change to > ... | public RobotList<Float> sort_incr_Float(RobotList<Float> list, String field) {
int length = list.size();
Index_value[] distri = new Index_value[length];
for (int i = 0; i < length; i++) {
distri[i] = new Index_value(i, list.get(i));
}
boolean permut;
do {
... | true |
4,238 | 10,252,057 | 9,324,781 | public void deletePortletName(PortletName portletNameBean) {
DatabaseAdapter dbDyn = null;
PreparedStatement ps = null;
try {
dbDyn = DatabaseAdapter.getInstance();
if (portletNameBean.getPortletId() == null) throw new IllegalArgumentException("portletNameId is null")... | public void parse(InputStream stream, ContentHandler handler, Metadata metadata, ParseContext context) throws IOException, SAXException, TikaException {
String name = metadata.get(Metadata.RESOURCE_NAME_KEY);
if (name != null && wanted.containsKey(name)) {
FileOutputStream out = new File... | false |
4,239 | 7,916,951 | 19,042,037 | @Override
public List<WebSearchResult> search(String term) {
List<GoogleResult> results = null;
try {
URL url = new URL(GoogleWebSearch.GOOGLE_URL + URLEncoder.encode(term, GoogleWebSearch.CHARSET));
Reader reader = new InputStreamReader(url.openStream(), GoogleWebSearch.... | public static void copyFile(File src, File dest, boolean preserveFileDate) throws IOException {
if (src.exists() && src.isDirectory()) {
throw new IOException("source file exists but is a directory");
}
if (dest.exists() && dest.isDirectory()) {
dest = new File(dest, ... | false |
4,240 | 11,075,647 | 880,670 | @Test
public void testWriteModel() {
Model model = new Model();
model.setName("MY_MODEL1");
Stereotype st1 = new Stereotype();
st1.setName("Pirulito1");
PackageObject p1 = new PackageObject("p1");
ClassType type1 = new ClassType("Class1");
type1.setStereot... | public static void main(String args[]) {
int i, j, l;
short NUMNUMBERS = 256;
short numbers[] = new short[NUMNUMBERS];
Darjeeling.print("START");
for (l = 0; l < 100; l++) {
for (i = 0; i < NUMNUMBERS; i++) numbers[i] = (short) (NUMNUMBERS - 1 - i);
fo... | false |
4,241 | 775,447 | 16,930,288 | void copyFile(String src, String dest) throws IOException {
int amount;
byte[] buffer = new byte[4096];
FileInputStream in = new FileInputStream(src);
FileOutputStream out = new FileOutputStream(dest);
while ((amount = in.read(buffer)) != -1) out.write(buffer, 0, amount);
... | public TempFileTextBody(InputStream is, String mimeCharset) throws IOException {
this.mimeCharset = mimeCharset;
TempPath tempPath = TempStorage.getInstance().getRootTempPath();
tempFile = tempPath.createTempFile("attachment", ".txt");
OutputStream out = tempFile.getOutputStream();
... | true |
4,242 | 5,675,396 | 15,340,278 | private void putFile(String location, String file) throws Exception {
System.out.println("Put file to " + location);
URL url = new URL(location);
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("PUT");
conn.setDoOutput(true);
R... | @Override
public String encode(String password) {
String hash = null;
MessageDigest m;
try {
m = MessageDigest.getInstance("MD5");
m.update(password.getBytes(), 0, password.length());
hash = String.format("%1$032X", new BigInteger(1, m.digest()));
... | false |
4,243 | 7,286,006 | 7,220,840 | public void reset(String componentName, int currentPilot) {
try {
PreparedStatement psta = jdbc.prepareStatement("DELETE FROM component_prop " + "WHERE pilot_id = ? " + "AND component_name = ?");
psta.setInt(1, currentPilot);
psta.setString(2, componentName);
... | @Test
public void testSecondary() throws Exception {
ConnectionFactoryIF cf = new DefaultConnectionFactory(PropertyUtils.loadProperties(StreamUtils.getInputStream(propfile)), false);
Connection conn = cf.requestConnection();
try {
Statement stm = conn.createStatement();
... | true |
4,244 | 372,172 | 18,899,338 | public static void main(String[] args) throws Exception {
String linesep = System.getProperty("line.separator");
FileOutputStream fos = new FileOutputStream(new File("lib-licenses.txt"));
fos.write(new String("JCP contains the following libraries. Please read this for comments on copyright e... | public static void parseSohuStock(ArrayList<String> dataSource, final ArrayList<SohuStockBean> sohuStockBeanList) throws IOReactorException, InterruptedException {
HttpAsyncClient httpclient = new DefaultHttpAsyncClient();
httpclient.start();
if (dataSource != null && dataSource.size() > 0) ... | false |
4,245 | 17,608,158 | 13,247,325 | public static void main(String[] args) {
FileInputStream in;
DeflaterOutputStream out;
FileOutputStream fos;
FileDialog fd;
fd = new FileDialog(new Frame(), "Find a file to deflate", FileDialog.LOAD);
fd.show();
if (fd.getFile() != null) {
try {
... | @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 |
4,246 | 21,266,476 | 7,231,926 | 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... | public static PipeID getPipeIDForService(ServiceDescriptor descriptor) {
PipeID id = null;
URI uri = descriptor.getUri();
if (uri != null) {
try {
id = (PipeID) IDFactory.fromURI(uri);
} catch (URISyntaxException e) {
throw new RuntimeE... | true |
4,247 | 3,375,714 | 16,499,419 | public void importarHistoricoDeCotacoesDosPapeis(File[] pArquivosTXT, boolean pApagarDadosImportadosAnteriormente, Andamento pAndamento) throws FileNotFoundException, SQLException {
if (pApagarDadosImportadosAnteriormente) {
Statement stmtLimpezaInicialDestino = conDestino.createStatement();
... | public String doAdd(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
UploadFileForm vo = (UploadFileForm) form;
String review = request.getParameter("review");
String realpath = getServlet().getServletContext().getRealPath("... | false |
4,248 | 22,991,277 | 1,327,097 | public static final String encryptSHA(String decrypted) {
try {
MessageDigest sha = MessageDigest.getInstance("SHA-1");
sha.reset();
sha.update(decrypted.getBytes());
byte hash[] = sha.digest();
sha.reset();
return hashToHex(hash);
... | public String generateMappackMD5(File mapPackFile) throws IOException, NoSuchAlgorithmException {
ZipFile zip = new ZipFile(mapPackFile);
try {
Enumeration<? extends ZipEntry> entries = zip.entries();
MessageDigest md5Total = MessageDigest.getInstance("MD5");
Mess... | true |
4,249 | 20,258,159 | 18,292,115 | private void checkSettings() throws ConfigurationException {
List serverList = getConfiguration().getServerList();
for (Object aServerList : serverList) {
JiraServerDetails jiraServerDetails = (JiraServerDetails) aServerList;
URL url = null;
try {
... | public static String hashString(String password) {
String hashword = null;
try {
MessageDigest sha = MessageDigest.getInstance("SHA");
sha.update(password.getBytes("UTF-8"));
BigInteger hash = new BigInteger(1, sha.digest());
hashword = hash.toString(1... | false |
4,250 | 7,872,660 | 20,815,136 | private static boolean genCustomerLocationsFileAndCustomerIndexFile(String completePath, String masterFile, String CustLocationsFileName, String CustIndexFileName) {
try {
TIntObjectHashMap CustInfoHash = new TIntObjectHashMap(480189, 1);
File inFile = new File(completePath + fSep + ... | public static void copyTo(File src, File dest) throws IOException {
if (src.equals(dest)) throw new IOException("copyTo src==dest file");
FileOutputStream fout = new FileOutputStream(dest);
InputStream in = new FileInputStream(src);
IOUtils.copyTo(in, fout);
fout.flush();
... | true |
4,251 | 827,646 | 4,047,586 | 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 toValueSAX(Property property, Value value, int valueType, ContentHandler contentHandler, AttributesImpl na, Context context) throws SAXException, RepositoryException {
na.clear();
String _value = null;
switch(valueType) {
case PropertyType.DATE:
... | false |
4,252 | 5,557,048 | 22,319,064 | private void copyDirContent(String fromDir, String toDir) throws Exception {
String fs = System.getProperty("file.separator");
File[] files = new File(fromDir).listFiles();
if (files == null) {
throw new FileNotFoundException("Sourcepath: " + fromDir + " not found!");
}
... | public void addRegisterInfo(HttpServletRequest request) throws ApplicationException {
String[] pids = request.getParameterValues("pid");
if (pids == null || pids.length <= 0) throw new ApplicationException("��ѡ��Ҫ���IJ�Ʒ");
RegisterDao registerDao = new RegisterDao();
Register registe... | false |
4,253 | 20,438,542 | 7,606,030 | public static Shader loadShader(String vspath, String fspath, int textureUnits, boolean separateCam, boolean fog) throws ShaderProgramProcessException {
if (vspath == "" || fspath == "") return null;
BufferedReader in;
String vert = "", frag = "";
try {
URL v_url = Graphi... | public String excute(String targetUrl, String params, String type) {
URL url;
HttpURLConnection connection = null;
try {
url = new URL(targetUrl);
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod(type);
connect... | true |
4,254 | 7,781,594 | 1,113,240 | @Override
protected IStatus runCancelableRunnable(IProgressMonitor monitor) {
IStatus returnValue = Status.OK_STATUS;
monitor.beginTask(NLS.bind(Messages.SaveFileOnDiskHandler_SavingFiles, open), informationUnitsFromExecutionEvent.size());
... | public RemotePolicyMigrator createRemotePolicyMigrator() {
return new RemotePolicyMigrator() {
public String migratePolicy(InputStream stream, String url) throws ResourceMigrationException, IOException {
ByteArrayOutputCreator oc = new ByteArrayOutputCreator();
... | true |
4,255 | 23,400,223 | 6,371,585 | public void update(Channel channel) throws Exception {
DBOperation dbo = null;
Connection connection = null;
PreparedStatement preparedStatement = null;
ResultSet resultSet = null;
String exp = channel.getExtendParent();
String path = channel.getPath();
try {
... | 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 ... | true |
4,256 | 19,360,483 | 19,060,603 | private void initLogging() {
File logging = new File(App.getHome(), "logging.properties");
if (!logging.exists()) {
InputStream input = getClass().getResourceAsStream("logging.properties-setup");
OutputStream output = null;
try {
output = new FileO... | public static void copyFile(File in, File out) throws IOException {
if (in.getCanonicalPath().equals(out.getCanonicalPath())) {
return;
}
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
... | true |
4,257 | 3,637,605 | 3,734,993 | public void actionPerformed(ActionEvent e) {
String digest = null;
try {
MessageDigest m = MessageDigest.getInstance("sha1");
m.reset();
String pw = String.copyValueOf(this.login.getPassword());
m.update(pw.getBytes());
byte[] digestByte = ... | private void fetchAlignment() throws IOException {
String urlString = BASE_URL + ALN_URL + DATASET_URL + "&family=" + mFamily;
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
processAlignment(in);
}
| false |
4,258 | 3,634,782 | 9,223,602 | public static void main(String[] args) {
paraProc(args);
CanonicalGFF cgff = new CanonicalGFF(gffFilename);
CanonicalGFF geneModel = new CanonicalGFF(modelFilename);
CanonicalGFF transcriptGff = new CanonicalGFF(transcriptFilename);
TreeMap ksTable1 = getKsTable(ksTable1Filen... | private File uploadToTmp() {
if (fileFileName == null) {
return null;
}
File tmpFile = dataDir.tmpFile(shortname, fileFileName);
log.debug("Uploading dwc archive file for new resource " + shortname + " to " + tmpFile.getAbsolutePath());
InputStream input = null;
... | true |
4,259 | 9,070,085 | 17,224,030 | 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... | 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 |
4,260 | 9,152,056 | 555,928 | public AbstractASiCSignatureService(InputStream documentInputStream, DigestAlgo digestAlgo, RevocationDataService revocationDataService, TimeStampService timeStampService, String claimedRole, IdentityDTO identity, byte[] photo, TemporaryDataStorage temporaryDataStorage, OutputStream documentOutputStream) throws IOE... | 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... | true |
4,261 | 3,852,700 | 3,992,343 | public URLConnection getResourceConnection(String name) throws ResourceException {
if (context == null) throw new ResourceException("There is no ServletContext to get the requested resource");
URL url = null;
try {
url = context.getResource("/WEB-INF/scriptags/" + name);
... | public File createTemporaryFile() throws IOException {
URL url = clazz.getResource(resource);
if (url == null) {
throw new IOException("No resource available from '" + clazz.getName() + "' for '" + resource + "'");
}
String extension = getExtension(resource);
Stri... | false |
4,262 | 4,452,454 | 3,233,094 | private InputStream getManifestAsResource() {
ClassLoader cl = getClass().getClassLoader();
try {
Enumeration manifests = cl != null ? cl.getResources(Constants.OSGI_BUNDLE_MANIFEST) : ClassLoader.getSystemResources(Constants.OSGI_BUNDLE_MANIFEST);
while (manifests.hasMoreEle... | @Override
protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws IOException, ClassNotFoundException {
HttpPost postMethod = new HttpPost(config.getServiceUrl());
postMethod.setEntity(new ByteArrayEntity(baos.toByteArray()));
... | false |
4,263 | 14,137,256 | 1,944,560 | private final void copyTargetFileToSourceFile(File sourceFile, File targetFile) throws MJProcessorException {
if (!targetFile.exists()) {
targetFile.getParentFile().mkdirs();
try {
if (!targetFile.exists()) {
targetFile.createNewFile();
... | private static boolean copyFile(File src, File dest) {
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(src);
fos = new FileOutputStream(dest);
for (int c = fis.read(); c != -1; c = fis.read()) fos.write(c);
... | true |
4,264 | 750,310 | 7,704,001 | public static boolean changeCredentials() {
boolean passed = false;
boolean credentials = false;
HashMap info = null;
Debug.log("Main.changeCredentials", "show dialog for userinfo");
info = getUserInfo();
if ((Boolean) info.get("submit")) {
try {
... | public void deleteGroupInstruction(int id, int rank) throws FidoDatabaseException, InstructionNotFoundException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit... | false |
4,265 | 11,992,308 | 18,396,375 | public static String generateStringSHA256(String content) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
} catch (NoSuchAlgorithmException ex) {
Logger.getLogger(ScannerChecksum.class.getName()).log(Level.SEVERE, null, ex);
}
... | public static String hash(String plaintext) {
if (plaintext == null) {
return "";
}
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA1");
md.update(plaintext.getBytes("UTF-8"));
} catch (Exception e) {
}
ret... | true |
4,266 | 16,700,020 | 17,533,362 | public static byte[] computeMD5(String s) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.reset();
md.update(s.getBytes());
return md.digest();
} catch (NoSuchAlgorithmException ex) {
throw new RuntimeException(ex);
... | private long getLastModified(Set resourcePaths, Map jarPaths) throws Exception {
long lastModified = 0;
Iterator paths = resourcePaths.iterator();
while (paths.hasNext()) {
String path = (String) paths.next();
URL url = context.getServletContext().getResource(path);
... | false |
4,267 | 9,195,362 | 5,704,569 | public static long copy(File src, File dest) throws UtilException {
FileChannel srcFc = null;
FileChannel destFc = null;
try {
srcFc = new FileInputStream(src).getChannel();
destFc = new FileOutputStream(dest).getChannel();
long srcLength = srcFc.size();
... | public static void copy(File src, File dest) throws IOException {
if (!src.exists()) {
throw new IOException(StaticUtils.format(OStrings.getString("LFC_ERROR_FILE_DOESNT_EXIST"), new Object[] { src.getAbsolutePath() }));
}
FileInputStream fis = new FileInputStream(src);
d... | true |
4,268 | 8,068,393 | 12,445,282 | public static boolean copyFile(String fileIn, String fileOut) {
FileChannel in = null;
FileChannel out = null;
boolean retour = false;
try {
in = new FileInputStream(fileIn).getChannel();
out = new FileOutputStream(fileOut).getChannel();
in.transfe... | static boolean writeProperties(Map<String, String> customProps, File destination) throws IOException {
synchronized (PropertiesIO.class) {
L.info(Msg.msg("PropertiesIO.writeProperties.start"));
File tempFile = null;
BufferedInputStream existingCfgInStream = null;
... | true |
4,269 | 18,134,394 | 3,296,963 | private String fetch(String urlstring) {
String content = "";
try {
URL url = new URL(urlstring);
InputStream is = url.openStream();
BufferedReader d = new BufferedReader(new InputStreamReader(is));
String s;
while (null != (s = d.readLine(... | public String fetchDataDailyByStockId(String StockId, String market) throws IOException {
URL url = new URL(urlDailyStockPrice.replace("{0}", StockId + "." + market));
URLConnection con = url.openConnection();
con.setConnectTimeout(20000);
InputStream is = con.getInputStream();
... | false |
4,270 | 6,680,022 | 16,397,911 | public ResourceMigratorBuilder createResourceMigratorBuilder(NotificationReporter reporter) {
return new ResourceMigratorBuilder() {
public ResourceMigrator getCompletedResourceMigrator() {
return new ResourceMigrator() {
public void migr... | private static void doCopyFile(File srcFile, File destFile, boolean preserveFileDate) throws IOException {
if (destFile.exists() && destFile.isDirectory()) {
throw new IOException("Destination '" + destFile + "' exists but is a directory");
}
FileInputStream input = new FileInput... | true |
4,271 | 17,404,914 | 14,900,320 | public static boolean installMetricsCfg(Db db, String xmlFileName) throws Exception {
String xmlText = FileHelper.asString(xmlFileName);
Bundle bundle = new Bundle();
loadMetricsCfg(bundle, xmlFileName, xmlText);
try {
db.begin();
PreparedStatement psExists = ... | @Override
public User updateUser(User bean) throws SitoolsException {
checkUser();
Connection cx = null;
try {
cx = ds.getConnection();
cx.setAutoCommit(false);
PreparedStatement st;
int i = 1;
if (bean.getSecret() != null && !"... | true |
4,272 | 22,327,409 | 7,034,031 | @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException {
PrintWriter writer = null;
InputStream is = null;
FileOutputStream fos = null;
try {
writer = response.getWriter();
} catch (IOException ex) {
... | private void copyFile(File sourceFile, File destFile) throws IOException {
if (log.isDebugEnabled()) {
log.debug("CopyFile : Source[" + sourceFile.getAbsolutePath() + "] Dest[" + destFile.getAbsolutePath() + "]");
}
if (!destFile.exists()) {
destFile.createNewFile();
... | true |
4,273 | 13,862,568 | 12,553,787 | private String getShaderIncludeSource(String path) throws Exception {
URL url = this.getClass().getResource(path);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
boolean run = true;
String str;
String ret = new String();
while (run) {... | public static String getHash(String plaintext) {
String hash = null;
try {
String text = plaintext;
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-256");
md.update(text.getBytes("UTF-8"));
byte[] ... | false |
4,274 | 949,221 | 9,371,509 | 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 SWORDEntry ingestDepost(final DepositCollection pDeposit, final ServiceDocument pServiceDocument) throws SWORDException {
try {
ZipFileAccess tZipFile = new ZipFileAccess(super.getTempDir());
LOG.debug("copying file");
String tZipTempFileName = super.getTempDir() +... | true |
4,275 | 2,058,791 | 8,544,627 | public void doPreparedStatementQueryAndUpdate(Connection conn, String id) throws SQLException {
try {
int key = getNextKey();
String bValue = "doPreparedStatementQueryAndUpdate:" + id + ":" + testId;
PreparedStatement s1;
if (key >= MAX_KEY_VALUE) {
... | @Override
protected void copyContent(String filename) throws IOException {
InputStream in = null;
try {
in = LOADER.getResourceAsStream(RES_PKG + filename);
ByteArrayOutputStream out = new ByteArrayOutputStream();
IOUtils.copy(in, o... | false |
4,276 | 9,956,094 | 8,009,241 | public void importNotesFromServer() {
boolean downloaded = true;
try {
makeBackupFile();
File f = new File(UserSettings.getInstance().getNotesFile());
FileOutputStream fos = new FileOutputStream(f);
String urlString = protocol + "://" + UserSettings.ge... | public static final synchronized String md5(final String data) {
try {
final MessageDigest md = MessageDigest.getInstance("MD5");
md.update(data.getBytes());
final byte[] b = md.digest();
return toHexString(b);
} catch (final Exception e) {
}
... | false |
4,277 | 23,452,538 | 16,337,161 | private long config(final String options) throws SQLException {
MessageDigest msgDigest = null;
try {
msgDigest = MessageDigest.getInstance("MD5");
} catch (NoSuchAlgorithmException e1) {
e1.printStackTrace();
}
msgDigest.update(options.getBytes());
... | public String index(URL url) {
InputStream is = null;
try {
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
urlConnection.setInstanceFollowRedirects(true);
urlConnection.setAllowUserInteraction(false);
System.setProperty("su... | false |
4,278 | 5,506,808 | 1,039,796 | public void testTransactions0010() throws Exception {
Statement stmt = con.createStatement();
stmt.executeUpdate("create table #t0010 " + " (i integer not null, " + " s char(10) not null) ");
con.setAutoCommit(false);
PreparedStatement pstmt = con.prepareStatement("in... | 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 |
4,279 | 14,808,281 | 934,048 | 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 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 |
4,280 | 662,799 | 7,797,615 | 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... | protected String readFileUsingHttp(String fileUrlName) {
String response = "";
try {
URL url = new URL(fileUrlName);
URLConnection connection = url.openConnection();
HttpURLConnection httpConn = (HttpURLConnection) connection;
httpConn.setRequestProper... | false |
4,281 | 13,949,581 | 14,175,532 | public static String cryptografar(String senha) {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(senha.getBytes());
BigInteger hash = new BigInteger(1, md.digest());
senha = hash.toString(16);
} catch (NoSuchAlgorithmException ns)... | public String getLongToken(String md5Str) {
MessageDigest md5 = null;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update(md5Str.getBytes(JspRunConfig.charset));
} catch (Exception e) {
e.printStackTrace();
}
StringBuffer token = toHex... | true |
4,282 | 430,406 | 7,419,810 | 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;
... | static void test() throws SQLException {
Connection conn = null;
Statement st = null;
ResultSet rs = null;
Savepoint sp = null;
try {
conn = JdbcUtils.getConnection();
conn.setAutoCommit(false);
st = conn.createStatement();
Stri... | true |
4,283 | 1,042,173 | 22,717,352 | @Test
public void config() throws IOException {
Reader reader = new FileReader(new File("src/test/resources/test.yml"));
Writer writer = new FileWriter(new File("src/site/apt/config.apt"));
writer.write("------\n");
writer.write(FileUtils.readFully(reader));
writer.flush(... | public void add(AddInterceptorChain chain, Entry entry, LDAPConstraints constraints) throws LDAPException {
Connection con = (Connection) chain.getRequest().get(JdbcInsert.MYVD_DB_CON + "LDAPBaseServer");
if (con == null) {
throw new LDAPException("Operations Error", LDAPException.OPERAT... | false |
4,284 | 23,658,098 | 14,417,163 | public 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.c... | @Test
public void testWrite() throws Exception {
MrstkXmlFileReader reader = new MrstkXmlFileReader();
reader.setFileName("..//data//MrstkXML//prototype3.xml");
reader.read();
SpectrumArray sp = reader.getOutput();
File tmp = File.createTempFile("mrstktest", ".xml");
... | true |
4,285 | 16,478,537 | 4,431,397 | public ForkJavaProject(String projectName, Class<?> activatorClass) {
this.activatorClass = activatorClass;
try {
IWorkspaceRoot rootWorkspace = ResourcesPlugin.getWorkspace().getRoot();
this.prj = rootWorkspace.getProject(projectName);
if (this.prj.exists()) {
... | private void processar() {
boolean bOK = false;
String sSQL = "DELETE FROM FNSALDOLANCA WHERE CODEMP=? AND CODFILIAL=?";
try {
state("Excluindo base atual de saldos...");
PreparedStatement ps = con.prepareStatement(sSQL);
ps.setInt(1, Aplicativo.iCodEmp);
... | false |
4,286 | 14,386,499 | 10,520,135 | public synchronized String encrypt(String plaintext) throws SystemUnavailableException {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA");
} catch (NoSuchAlgorithmException e) {
throw new SystemUnavailableException(e.getMessage());
}
... | public RegionInfo(String name, int databaseID, int units, float xMin, float xMax, float yMin, float yMax, float zMin, float zMax, String imageURL) {
this.name = name;
this.databaseID = databaseID;
this.units = units;
this.xMin = xMin;
this.xMax = xMax;
this.yMin = yMi... | true |
4,287 | 765,071 | 14,430,650 | public static void testString(String string, String expected) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("MD5");
md.update(string.getBytes(), 0, string.length());
String result = toString(md.digest());
System.out.println(expected);... | private String computeHash(String str) {
StringBuffer hexBuffer = new StringBuffer();
byte[] bytes;
int i;
try {
MessageDigest hashAlgorithm = MessageDigest.getInstance(hashAlgorithmName);
hashAlgorithm.reset();
hashAlgorithm.update(str.getBytes())... | true |
4,288 | 23,247,146 | 9,777,355 | @Override
public synchronized HttpURLConnection getTileUrlConnection(int zoom, int tilex, int tiley) throws IOException {
HttpURLConnection conn = null;
try {
String url = getTileUrl(zoom, tilex, tiley);
conn = (HttpURLConnection) new URL(url).openConnection();
} ... | public static boolean download(String address, String localFileName) {
OutputStream out = null;
URLConnection conn = null;
InputStream in = null;
try {
URL url = new URL(address);
out = new BufferedOutputStream(new FileOutputStream(localFileName));
... | false |
4,289 | 2,362,445 | 20,623,710 | public static void copyFile(File in, File out) throws IOException {
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOExcep... | public static synchronized void repartition(File[] sourceFiles, File targetDirectory, String prefix, long maxUnitBases, long maxUnitEntries) throws Exception {
if (!targetDirectory.exists()) {
if (!targetDirectory.mkdirs()) throw new Exception("Could not create directory " + targetDirectory.getA... | true |
4,290 | 18,456,843 | 8,452,132 | 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... | public void get(String path, File fileToGet) throws IOException {
FTPClient ftp = new FTPClient();
try {
int reply = 0;
ftp.connect(this.endpointURL, this.endpointPort);
reply = ftp.getReplyCode();
if (!FTPReply.isPositiveCompletion(reply)) {
... | false |
4,291 | 12,107,388 | 4,470,706 | private static List<CountryEntry> retrieveCountries() throws IOException {
URL url = new URL("http://" + ISO_3166_HOST + ISO_3166_TXT_FILE_PATH);
BufferedReader input = new BufferedReader(new InputStreamReader(url.openStream()));
List<CountryEntry> countries = new LinkedList<CountryEntry>();... | @Override
public boolean validatePublisher(Object object, String... dbSettingParams) {
DBConnectionListener listener = (DBConnectionListener) object;
String host = dbSettingParams[0];
String port = dbSettingParams[1];
String driver = dbSettingParams[2];
String type = dbSe... | false |
4,292 | 15,144,864 | 1,849,189 | public static String encryptMd5(String plaintext) {
String hashtext = "";
try {
MessageDigest m;
m = MessageDigest.getInstance("MD5");
m.reset();
m.update(plaintext.getBytes());
byte[] digest = m.digest();
BigInteger bigInt = ne... | public InputPort getInputPort(String file) throws IOException {
if (file.equals("/dev/null")) {
return new StreamInputPort(new NullInputStream(), file);
}
URL url = Util.tryURL(file);
if (url != null) {
return new StreamInputPort(url.openStream(), url.toExtern... | false |
4,293 | 21,570,957 | 320,979 | private static long saveAndClosePDFDocument(PDDocument document, OutputStreamProvider outProvider) throws IOException, COSVisitorException {
File tempFile = null;
InputStream in = null;
OutputStream out = null;
try {
tempFile = File.createTempFile("temp", "pdf");
... | 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... | true |
4,294 | 16,902,397 | 13,927,065 | private void convertClasses(File source, File destination) throws PostProcessingException, CodeCheckException, IOException {
Stack sourceStack = new Stack();
Stack destinationStack = new Stack();
sourceStack.push(source);
destinationStack.push(destination);
while (!sourceStac... | void copyFile(File src, File dst) throws IOException {
FileInputStream fis = new FileInputStream(src);
byte[] buf = new byte[10000];
int n;
FileOutputStream fos = new FileOutputStream(dst);
while ((n = fis.read(buf)) > 0) fos.write(buf, 0, n);
fis.close();
fos... | true |
4,295 | 970,639 | 21,803,552 | public static String unsecureHashConstantSalt(String password) throws NoSuchAlgorithmException, UnsupportedEncodingException {
password = SALT3 + password;
MessageDigest md5 = MessageDigest.getInstance("MD5");
md5.update(password.getBytes(), 0, password.length());
password += convert... | 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... | false |
4,296 | 18,781,063 | 13,650,923 | private void createGraphicalViewer(Composite parent) {
viewer = new ScrollingGraphicalViewer();
viewer.createControl(parent);
viewer.getControl().setBackground(parent.getBackground());
viewer.setRootEditPart(new ScalableFreeformRootEditPart());
viewer.setKeyHandler(new Graphi... | public boolean consolidateCrossrefGet(BiblioItem bib, ArrayList<BiblioItem> bib2) throws Exception {
boolean result = false;
String doi = bib.getDOI();
String aut = bib.getFirstAuthorSurname();
String title = bib.getTitle();
String firstPage = null;
String pageRange =... | false |
4,297 | 4,381,118 | 7,599,899 | private void loadFile(File file) throws Exception {
Edl edl = new Edl("file:///" + file.getAbsolutePath());
URL url = ExtractaHelper.retrieveUrl(edl.getUrlRetrievalDescriptor());
String sUrlString = url.toExternalForm();
if (sUrlString.startsWith("file:/") && (sUrlString.charAt(6) !=... | public static void parse(URL url, ContentHandler handler) {
InputStream input = null;
try {
input = url.openStream();
SAXParser parser = createSaxParser();
XMLReader reader = parser.getXMLReader();
reader.setContentHandler(handler);
reader.... | false |
4,298 | 22,337,078 | 18,420,618 | private List getPluginClassList(List pluginFileList) {
ArrayList l = new ArrayList();
for (Iterator i = pluginFileList.iterator(); i.hasNext(); ) {
URL url = (URL) i.next();
log.debug("Trying file " + url.toString());
try {
BufferedReader r = new B... | public static String hashURL(String url) {
if (url == null) {
throw new IllegalArgumentException("URL may not be null. ");
}
String result = null;
try {
MessageDigest md = MessageDigest.getInstance("SHA-1");
if (md != null) {
md.res... | false |
4,299 | 10,158,742 | 9,636,735 | public void moveRuleDown(String language, String tag, int row) throws FidoDatabaseException {
try {
Connection conn = null;
Statement stmt = null;
try {
conn = fido.util.FidoDataSource.getConnection();
conn.setAutoCommit(false);
... | public static HttpURLConnection createSoapHttpURLConnection(String url) throws MalformedURLException, IOException {
HttpURLConnection connection = (HttpURLConnection) new URL(url).openConnection();
connection.setRequestMethod("POST");
connection.addRequestProperty("Connection", "close");
... | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.