List of usage examples for java.util Vector size
public synchronized int size()
From source file:eionet.gdem.dcm.business.StylesheetManager.java
/** * Gets conversion types/*from w ww . j a v a 2 s .c o m*/ * @return Conversion types * @throws DCMException If an error occurs. */ public ConvTypeHolder getConvTypes() throws DCMException { ConvTypeHolder ctHolder = new ConvTypeHolder(); ArrayList convs; try { convs = new ArrayList(); Vector convTypes = convTypeDao.getConvTypes(); for (int i = 0; i < convTypes.size(); i++) { Hashtable hash = (Hashtable) convTypes.get(i); String conv_type = (String) hash.get("conv_type"); ConvType conv = new ConvType(); conv.setConvType(conv_type); convs.add(conv); } ctHolder.setConvTypes(convs); } catch (Exception e) { e.printStackTrace(); LOGGER.error("Error getting conv types", e); throw new DCMException(BusinessConstants.EXCEPTION_GENERAL); } return ctHolder; }
From source file:cc.abstra.trantor.security.ssl.OwnSSLProtocolSocketFactory.java
/** * Parses a X.500 distinguished name for the value of the * "Common Name" field./*from w w w .j a va 2 s . co m*/ * This is done a bit sloppy right now and should probably be done a bit * more according to <code>RFC 2253</code>. * * @param dn a X.500 distinguished name. * @return the value of the "Common Name" field. */ private String getCN(String dn) { X509Name name = new X509Name(dn); Vector<?> vector = name.getValues(X509Name.CN); if ((vector != null) && (vector.size() > 0)) { return (String) vector.get(0); } else { return null; } }
From source file:com.sittinglittleduck.DirBuster.workGenerators.WorkerGeneratorURLFuzz.java
/** Thread run method */ public void run() { /*/*from w w w. j av a2 s .co m*/ * Read in all the items and create all the work we need to. */ BufferedReader d = null; try { manager.setURLFuzzGenFinished(false); String currentDir = "/"; int failcode = 404; String line; Vector extToCheck = new Vector(10, 5); boolean recursive = true; int passTotal = 0; try { d = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile))); passTotal = 0; while ((line = d.readLine()) != null) { if (!line.startsWith("#")) { passTotal++; } } manager.setTotalPass(passTotal); } catch (FileNotFoundException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } if (manager.getAuto()) { try { URL headurl = new URL(firstPart); HeadMethod httphead = new HeadMethod(headurl.toString()); Vector HTTPheaders = manager.getHTTPHeaders(); for (int a = 0; a < HTTPheaders.size(); a++) { HTTPHeader httpHeader = (HTTPHeader) HTTPheaders.elementAt(a); httphead.setRequestHeader(httpHeader.getHeader(), httpHeader.getValue()); } httphead.setFollowRedirects(Config.followRedirects); int responceCode = httpclient.executeMethod(httphead); if (Config.debug) { System.out.println("DEBUG WokerGen: responce code for head check = " + responceCode); } if (responceCode == 501 || responceCode == 400 || responceCode == 405) { if (Config.debug) { System.out.println( "DEBUG WokerGen: Changing to GET only HEAD test returned 501(method no implmented) or a 400"); } manager.setAuto(false); } } catch (MalformedURLException e) { } catch (IOException e) { } } d = new BufferedReader(new InputStreamReader(new FileInputStream(inputFile))); System.out.println("Starting fuzz on " + firstPart + urlFuzzStart + "{dir}" + urlFuzzEnd); int filesProcessed = 0; BaseCase baseCaseObj = GenBaseCase.genURLFuzzBaseCase(manager, firstPart + urlFuzzStart, urlFuzzEnd); while ((line = d.readLine()) != null) { if (stopMe) { return; } if (!line.startsWith("#")) { String method; if (manager.getAuto() && !baseCaseObj.useContentAnalysisMode() && !baseCaseObj.isUseRegexInstead()) { method = "HEAD"; } else { method = "GET"; } // url encode all the items line = URLEncoder.encode(line); URL currentURL = new URL(firstPart + urlFuzzStart + line + urlFuzzEnd); // BaseCase baseCaseObj = new BaseCase(currentURL, failcode, true, failurl, // baseResponce); // if the base case is null then we need to switch to content anylsis mode workQueue.put(new WorkUnit(currentURL, true, method, baseCaseObj, line)); } Thread.sleep(3); } } catch (InterruptedException ex) { Logger.getLogger(WorkerGeneratorURLFuzz.class.getName()).log(Level.SEVERE, null, ex); } catch (MalformedURLException ex) { Logger.getLogger(WorkerGeneratorURLFuzz.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(WorkerGeneratorURLFuzz.class.getName()).log(Level.SEVERE, null, ex); } finally { try { d.close(); manager.setURLFuzzGenFinished(true); } catch (IOException ex) { Logger.getLogger(WorkerGeneratorURLFuzz.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:com.panet.imeta.job.entries.sftp.SFTPClient.java
public String[] dir() throws KettleJobException { String[] fileList = null;//from w ww . j av a2s . c o m try { java.util.Vector<?> v = c.ls("."); java.util.Vector<String> o = new java.util.Vector<String>(); if (v != null) { for (int i = 0; i < v.size(); i++) { Object obj = v.elementAt(i); if (obj != null && obj instanceof com.jcraft.jsch.ChannelSftp.LsEntry) { LsEntry lse = (com.jcraft.jsch.ChannelSftp.LsEntry) obj; if (!lse.getAttrs().isDir()) o.add(lse.getFilename()); } } } if (o.size() > 0) { fileList = new String[o.size()]; o.copyInto(fileList); } } catch (SftpException e) { throw new KettleJobException(e); } return fileList; }
From source file:dao.PblogMonthlyQuery.java
public HashSet run(Connection conn, String pblogid, String month, String year) { //String sqlQuery = "select LEFT(entrydate,10) as entrydate from pblogtopics where pblogid='"+pblogid+"' and MONTH(entrydate)='"+month+"' and year(entrydate)='"+year+"'"; String sqlQuery = "select LEFT(entrydate,10) as entrydate from pblogtopics where pblogid='" + pblogid + "' and MONTH(entrydate)='" + month + "' and year(entrydate)='" + year + "'"; try {//ww w .j a v a 2 s . c o m PreparedStatement stmt = conn.prepareStatement(sqlQuery); ResultSet rs = stmt.executeQuery(); Vector columnNames = null; HashSet blogSet = new HashSet(); Blog blog = null; if (rs != null) { columnNames = dbutils.getColumnNames(rs); } while (rs.next()) { blog = (Blog) eop.newObject(DbConstants.BLOG); for (int j = 0; j < columnNames.size(); j++) { blog.setValue((String) columnNames.elementAt(j), (String) rs.getString((String) columnNames.elementAt(j))); } blogSet.add(blog); } return blogSet; } catch (Exception e) { logger.warn("Error occured while executing PblogMonthlyQuery run query" + sqlQuery, e); throw new BaseDaoException("Error occured while executing PblogMonthlyQuery run query " + sqlQuery, e); } }
From source file:com.vsquaresystem.safedeals.readyreckoner.ReadyReckonerService.java
public Boolean checkExistingDataa() throws IOException { logger.info("check ke andar hai bhai??"); Vector checkCellVectorHolder = read(); logger.info("checkCellVectorHolder line116 :{}", checkCellVectorHolder); logger.info("read in check line117 :{}", read()); int excelSize = checkCellVectorHolder.size() - 1; System.out.println("excelSize" + excelSize); List<Readyreckoner> rs = readyReckonerDAL.getAll(); JFrame parent = new JFrame(); System.out.println("rs" + rs); int listSize = rs.size(); logger.info("rsss:::::", listSize); System.out.println("rsss:::::" + listSize); if (excelSize == listSize || excelSize > listSize) { JDialog.setDefaultLookAndFeelDecorated(true); int response = JOptionPane.showConfirmDialog(null, "Do you want to continue?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); switch (response) { case JOptionPane.NO_OPTION: System.out.println("No button clicked"); JOptionPane.showMessageDialog(parent, "upload Cancelled"); break; case JOptionPane.YES_NO_OPTION: saveToDatabase(checkCellVectorHolder); System.out.println("Yes button clicked"); JOptionPane.showMessageDialog(parent, "Saved succesfully"); break; case JOptionPane.CLOSED_OPTION: System.out.println("JOptionPane closed"); break; }/*from w w w.j ava 2 s . co m*/ } else { System.out.println("No selected"); } return true; }
From source file:com.adito.jdbc.JDBCConnectionImpl.java
synchronized PreparedStatement aquirePreparedStatement(String key, String sqlString) throws SQLException { Vector avail = (Vector) preparedStatements.get(key); if (avail == null) { avail = new Vector(); preparedStatements.put(key, avail); }/*from ww w .j av a 2 s . c o m*/ if (avail.size() > 0) { return (PreparedStatement) avail.remove(0); } else return conn.prepareStatement(sqlString); }
From source file:dao.PblogDateQuery.java
public HashSet run(Connection conn, String pblogid, String month, String year, String day) { //String sqlQuery = "select LEFT(entrydate,10) as entrydate from pblogtopics where pblogid='"+pblogid+"' and MONTH(entrydate)='"+month+"' and year(entrydate)='"+year+"'"; String sqlQuery = "select LEFT(entrydate,10) as entrydate from pblogtopics where pblogid='" + pblogid + "' and MONTH(entrydate)='" + month + "' and year(entrydate)='" + year + "' and day(entrydate)='" + day + "'"; logger.info("sqlQuery = " + sqlQuery); try {/*from w w w .ja v a 2s . c om*/ PreparedStatement stmt = conn.prepareStatement(sqlQuery); ResultSet rs = stmt.executeQuery(); Vector columnNames = null; HashSet blogSet = new HashSet(); Blog blog = null; if (rs != null) { columnNames = dbutils.getColumnNames(rs); } while (rs.next()) { blog = (Blog) eop.newObject(DbConstants.BLOG); for (int j = 0; j < columnNames.size(); j++) { blog.setValue((String) columnNames.elementAt(j), (String) rs.getString((String) columnNames.elementAt(j))); } blogSet.add(blog); } return blogSet; } catch (Exception e) { logger.warn("Error occured while executing pblogdailyQuery run query", e); throw new BaseDaoException("Error occured while executing pblogdailyQuery run query " + sqlQuery, e); } }
From source file:de.escidoc.core.test.om.container.ContainerReferenceIT.java
/** * References that are to skip (or non valid GET refs). * * @param ref The reference (path)./*from w w w . ja v a 2 s .co m*/ * @return True if the reference is to skip, false otherwise. */ private boolean skipRefCheck(final String ref) { Vector<String> skipList = new Vector<String>(); skipList.add("members/filter"); skipList.add("members/filter/refs"); for (int i = 0; i < skipList.size(); i++) { if (ref.endsWith(skipList.get(i))) { return (true); } } return false; }
From source file:es.prodevelop.gvsig.mini.tasks.namefinder.NameFinderFunc.java
@Override public boolean execute() { NameFinder NFTask = new NameFinder(); String query = new String(NFTask.URL + NFTask.parms).replaceAll(" ", "%20"); try {//from w w w .j a va 2 s .c o m log.log(Level.FINE, query); InputStream is = Utils.openConnection(query); BufferedInputStream bis = new BufferedInputStream(is); /* Read bytes to the Buffer until there is nothing more to read(-1). */ ByteArrayBuffer baf = new ByteArrayBuffer(50); int current = 0; while ((current = bis.read()) != -1) { if (this.isCanceled()) { res = TaskHandler.CANCELED; return true; } baf.append((byte) current); } Vector result = NFTask.parse(baf.toByteArray()); if (result != null) { // handler.sendEmptyMessage(map.POI_SUCCEEDED); Named[] searchRes = new Named[result.size()]; desc = new String[result.size()]; for (int i = 0; i < result.size(); i++) { Named n = (Named) result.elementAt(i); desc[i] = n.description; searchRes[i] = n; if (this.isCanceled()) { res = TaskHandler.CANCELED; return true; } } if (this.isCanceled()) { res = TaskHandler.CANCELED; return true; } nm = new NamedMultiPoint(searchRes); res = TaskHandler.FINISHED; } else { res = TaskHandler.CANCELED; } } catch (IOException e) { if (e instanceof UnknownHostException) { res = TaskHandler.NO_RESPONSE; } } catch (Exception e) { log.log(Level.SEVERE, "Namefinder" + e.getMessage(), e); } finally { } return true; }