Example usage for java.util Vector isEmpty

List of usage examples for java.util Vector isEmpty

Introduction

In this page you can find the example usage for java.util Vector isEmpty.

Prototype

public synchronized boolean isEmpty() 

Source Link

Document

Tests if this vector has no components.

Usage

From source file:org.globus.ftp.test.GridFTPClientTest.java

private void testMList(int mode, int type) throws Exception {
    logger.info("show list output using GridFTPClient");

    GridFTPClient client = connect();//from   w  ww  . ja v a2s.c  o  m
    client.setType(type);
    client.setMode(mode);
    client.changeDir(TestEnv.serverADir);
    Vector v = client.mlsd(null);
    logger.debug("list received");
    while (!v.isEmpty()) {
        MlsxEntry f = (MlsxEntry) v.remove(0);
        logger.info(f.toString());
    }
    client.close();
}

From source file:org.globus.ftp.test.GridFTPClientTest.java

private void testList(int mode, int type) throws Exception {
    logger.info("show list output using GridFTPClient");

    GridFTPClient client = connect();/*  w  w  w. ja v  a2  s .c om*/
    client.setType(type);
    client.setMode(mode);
    client.changeDir(TestEnv.serverADir);
    Vector v = client.list(null, null);
    logger.debug("list received");
    while (!v.isEmpty()) {
        FileInfo f = (FileInfo) v.remove(0);
        logger.info(f.toString());
    }
    client.close();
}

From source file:com.granule.json.utils.internal.JSONObject.java

/**
 * Internal method to write out all children JSON objects attached to this JSON object.
 * @param writer The writer to use while writing the JSON text.
 * @param depth The indention depth of the JSON text.
 * @param compact Flag to denote whether or not to write in nice indent format, or compact format.
 * @throws IOException Trhown if an error occurs on write.
 */// w ww  .  jav a 2s. c  om
private void writeChildren(Writer writer, int depth, boolean compact) throws IOException {
    if (logger.isLoggable(Level.FINER))
        logger.entering(className, "writeChildren(Writer, int, boolean)");

    if (!jsonObjects.isEmpty()) {
        Enumeration keys = jsonObjects.keys();
        while (keys.hasMoreElements()) {
            String objName = (String) keys.nextElement();
            Vector vect = (Vector) jsonObjects.get(objName);
            if (vect != null && !vect.isEmpty()) {
                /**
                 * Non-array versus array elements.
                 */
                if (vect.size() == 1) {
                    if (logger.isLoggable(Level.FINEST))
                        logger.logp(Level.FINEST, className, "writeChildren(Writer, int, boolean)",
                                "Writing child object: [" + objName + "]");

                    JSONObject obj = (JSONObject) vect.elementAt(0);
                    obj.writeObject(writer, depth + 1, false, compact);
                    if (keys.hasMoreElements()) {
                        try {
                            if (!compact) {
                                if (!obj.isTextOnlyObject() && !obj.isEmptyObject()) {
                                    writeIndention(writer, depth + 1);
                                }
                                writer.write(",\n");
                            } else {
                                writer.write(",");
                            }
                        } catch (Exception ex) {
                            IOException iox = new IOException("Error occurred on serialization of JSON text.");
                            iox.initCause(ex);
                            throw iox;
                        }
                    } else {
                        if (obj.isTextOnlyObject() && !compact) {
                            writer.write("\n");
                        }
                    }
                } else {
                    if (logger.isLoggable(Level.FINEST))
                        logger.logp(Level.FINEST, className, "writeChildren(Writer, int, boolean)",
                                "Writing array of JSON objects with attribute name: [" + objName + "]");

                    try {
                        if (!compact) {
                            writeIndention(writer, depth + 1);
                            writer.write("\"" + objName + "\"");
                            writer.write(" : [\n");
                        } else {
                            writer.write("\"" + objName + "\"");
                            writer.write(":[");
                        }
                        for (int i = 0; i < vect.size(); i++) {
                            JSONObject obj = (JSONObject) vect.elementAt(i);
                            obj.writeObject(writer, depth + 2, true, compact);

                            /**
                             * Still more we haven't handled.
                             */
                            if (i != (vect.size() - 1)) {
                                if (!compact) {
                                    if (!obj.isTextOnlyObject() && !obj.isEmptyObject()) {
                                        writeIndention(writer, depth + 2);
                                    }
                                    writer.write(",\n");
                                } else {
                                    writer.write(",");
                                }
                            }
                        }

                        if (!compact) {
                            writer.write("\n");
                            writeIndention(writer, depth + 1);
                        }

                        writer.write("]");
                        if (keys.hasMoreElements()) {
                            writer.write(",");
                        }

                        if (!compact) {
                            writer.write("\n");
                        }
                    } catch (Exception ex) {
                        IOException iox = new IOException("Error occurred on serialization of JSON text.");
                        iox.initCause(ex);
                        throw iox;
                    }
                }
            }
        }
    }

    if (logger.isLoggable(Level.FINER))
        logger.exiting(className, "writeChildren(Writer, int, boolean)");
}

From source file:alter.vitro.vgw.service.VitroGatewayService.java

public VgwResponse invokeWSIService(VgwRequestObservation request) throws VitroGatewayException {
    if (!getUseIdas()) {
        VgwResponse vgwResponse = new VgwResponse();
        vgwResponse.setSuccess(false);/*  ww  w  .  j  a va  2 s .c om*/
        return vgwResponse;
    }

    // REDUNDANT CODE FOR DEBUGGING PURPOSES (SKIPPING THE REGISTRATION). TODO: remove later (perhaps make  gwWithNodeDescriptorList a private var, although will that create any race conditions for it?)
    CGateway myGateway = new CGateway();
    myGateway.setId(getAssignedGatewayUniqueIdFromReg());
    myGateway.setName("");
    myGateway.setDescription("");

    // TODO: transfer the code for acquiring GW description, in the createWSIDescr() method
    CGatewayWithSmartDevices gwWithNodeDescriptorList = myDCon.createWSIDescr(myGateway);
    logger.debug("nodeDescriptorList = {}", gwWithNodeDescriptorList.getSmartDevVec());
    List<CSmartDevice> alterNodeDescriptorsList = gwWithNodeDescriptorList.getSmartDevVec();
    ResourceAvailabilityService.getInstance().updateCachedNodeList(alterNodeDescriptorsList,
            ResourceAvailabilityService.INIT_DISCOVERY);
    // END OF REDUNDANT CODE

    logger.debug("request = {}", request);

    //Get requested resource
    String resourceName = request.getObsType().value();
    Resource requestedResource = Resource.getResource(resourceName);
    if (requestedResource == null) {
        throw new VitroGatewayException(resourceName + " not managed by VITRO gateway");
    }

    //List<Observation> observationList = rsController.getWSIData(requestedResource);
    Vector<QueriedMoteAndSensors> motesAndTheirSensorAndFunctsVec = new Vector<QueriedMoteAndSensors>();
    Vector<ReqFunctionOverData> reqFunctionVec = new Vector<ReqFunctionOverData>();
    ReqFunctionType rftObject = new ReqFunctionType();
    rftObject.setId(BigInteger.valueOf(1));
    rftObject.setDescription(ReqFunctionOverData.lastValFunc);
    reqFunctionVec.add(new ReqFunctionOverData(rftObject));

    //List<CSmartDevice> alterNodeDescriptorsList = gwWithNodeDescriptorList.getSmartDevVec();
    for (CSmartDevice alterNodeDescriptor : alterNodeDescriptorsList) {
        QueriedMoteAndSensors tmpQueriedMoteAndSensors = new QueriedMoteAndSensors();
        tmpQueriedMoteAndSensors.setMoteid(alterNodeDescriptor.getId());

        Vector<ReqSensorAndFunctions> QueriedSensorIdsAndFuncVec = new Vector<ReqSensorAndFunctions>();
        ReqSensorAndFunctions tmpReqSensingAndFunct = new ReqSensorAndFunctions();

        Integer thedigestInt = request.getObsType().value().hashCode();
        if (thedigestInt < 0)
            thedigestInt = thedigestInt * (-1);

        tmpReqSensingAndFunct.setSensorModelid(Integer.toString(thedigestInt));
        tmpReqSensingAndFunct.getFid().add(BigInteger.valueOf(1));
        QueriedSensorIdsAndFuncVec.add(tmpReqSensingAndFunct);

        tmpQueriedMoteAndSensors.setQueriedSensorIdsAndFuncVec(QueriedSensorIdsAndFuncVec);

        motesAndTheirSensorAndFunctsVec.addElement(tmpQueriedMoteAndSensors);
    }

    Vector<ReqResultOverData> observationsList = myDCon.translateAggrQuery(motesAndTheirSensorAndFunctsVec,
            reqFunctionVec);

    if (observationsList != null && !observationsList.isEmpty()) {
        //            // we only have one function, so only one element in the observarionList
        //            ReqResultOverData observations = observationsList.elementAt(0);
        //            Vector<ResultAggrStruct> tmpResultsStructVec = observations.getAllResultsforFunct();

        for (ReqResultOverData observations : observationsList) {
            Vector<ResultAggrStruct> tmpResultsStructVec = observations.getAllResultsforFunct();
            if (tmpResultsStructVec != null && !tmpResultsStructVec.isEmpty()) {
                for (ResultAggrStruct resultStruct : tmpResultsStructVec) {
                    if (resultStruct.getVal().equalsIgnoreCase(ReqResultOverData.specialValueNoReading)
                            || resultStruct.getVal().equalsIgnoreCase(ReqResultOverData.specialValuePending)
                            || resultStruct.getVal()
                                    .equalsIgnoreCase(ReqResultOverData.specialValueNotSupported)
                            || resultStruct.getVal().equalsIgnoreCase(ReqResultOverData.specialValueBinary)
                            || resultStruct.getVal().equalsIgnoreCase(ReqResultOverData.specialValueTimedOut)) {
                        System.out.println("Special values should not be sent!!");
                        continue;
                    }
                    Observation vgwObservation = new Observation();
                    Node theNode = new Node();
                    theNode.setId(resultStruct.getMid());

                    vgwObservation.setNode(theNode);
                    vgwObservation.setResource(requestedResource);
                    // TODO PRODUCES ERROR!!!
                    //System.out.println("Error prone!!");
                    Timestamp tmpTs = resultStruct.getTis().getFromTimestamp();
                    if (tmpTs == null) {
                        java.util.Date today = new java.util.Date();
                        tmpTs = new java.sql.Timestamp(today.getTime());
                    }
                    //System.out.println("Error prone!!");

                    vgwObservation.setTimestamp(tmpTs.getTime());//????
                    vgwObservation.setValue(resultStruct.getVal());
                    //Node node = observation.getNode();
                    String assignedSensorId = idasNodeMapping.get(resultStruct.getMid());
                    logger.debug("Node {} -> assignedSensotId {}", resultStruct.getMid(), assignedSensorId);
                    InsertObservation insertObservation = sensorMLMessageAdapter.getInsertObservationMessage(
                            assignedGatewayUniqueIdFromReg, assignedSensorId, vgwObservation);
                    InsertObservationResponse insertObservationResponse = idas
                            .insertObservation(insertObservation);
                    logger.debug("insertObservationResponse = {}", insertObservationResponse);
                }
            }
        }
    }
    VgwResponse vgwResponse = new VgwResponse();
    vgwResponse.setSuccess(true);
    return vgwResponse;
}

From source file:edu.umn.cs.spatialHadoop.nasa.StockQuadTree.java

/**
 * Perform a selection query that retrieves all points in the given range.
 * The range is specified in the two-dimensional array positions.
 * @param in/*from  ww  w  .j ava 2s.com*/
 * @param query_mbr
 * @param output
 * @return number of matched records
 * @throws IOException
 */
public static int selectionQuery(FSDataInputStream in, Rectangle query_mbr, ResultCollector<PointValue> output)
        throws IOException {
    long treeStartPosition = in.getPos();
    int numOfResults = 0;
    int resolution = in.readInt();
    short fillValue = in.readShort();
    int cardinality = in.readInt();
    long[] timestamps = new long[cardinality];
    for (int i = 0; i < cardinality; i++)
        timestamps[i] = in.readLong();
    Vector<Integer> selectedStarts = new Vector<Integer>();
    Vector<Integer> selectedEnds = new Vector<Integer>();
    StockQuadTree stockQuadTree = getOrCreateStockQuadTree(resolution);
    // Nodes to be searched. Contains node positions in the array of nodes
    Stack<Integer> nodes_2b_searched = new Stack<Integer>();
    nodes_2b_searched.add(0); // Root node (ID=1)
    Rectangle node_mbr = new Rectangle();
    while (!nodes_2b_searched.isEmpty()) {
        int node_pos = nodes_2b_searched.pop();
        stockQuadTree.getNodeMBR(node_pos, node_mbr);
        if (query_mbr.contains(node_mbr)) {
            // Add this node to the selection list and stop this branch
            if (!selectedEnds.isEmpty()
                    && selectedEnds.lastElement() == stockQuadTree.nodesStartPosition[node_pos]) {
                // Merge with an adjacent range
                selectedEnds.set(selectedEnds.size() - 1, stockQuadTree.nodesEndPosition[node_pos]);
            } else {
                // add a new range
                selectedStarts.add(stockQuadTree.nodesStartPosition[node_pos]);
                selectedEnds.add(stockQuadTree.nodesEndPosition[node_pos]);
            }
            numOfResults += stockQuadTree.nodesEndPosition[node_pos]
                    - stockQuadTree.nodesStartPosition[node_pos];
        } else if (query_mbr.intersects(node_mbr)) {
            int first_child_id = stockQuadTree.nodesID[node_pos] * 4 + 0;
            int first_child_pos = Arrays.binarySearch(stockQuadTree.nodesID, first_child_id);
            if (first_child_pos < 0) {
                // No children. Hit a leaf node
                // Scan and add matching points only
                java.awt.Point record_coords = new Point();
                for (int record_pos = stockQuadTree.nodesStartPosition[node_pos]; record_pos < stockQuadTree.nodesEndPosition[node_pos]; record_pos++) {
                    stockQuadTree.getRecordCoords(record_pos, record_coords);
                    if (query_mbr.contains(record_coords)) {
                        // matched a record.
                        if (!selectedEnds.isEmpty() && selectedEnds.lastElement() == record_pos) {
                            // Merge with an adjacent range
                            selectedEnds.set(selectedEnds.size() - 1, record_pos + 1);
                        } else {
                            // Add a new range of unit width
                            selectedStarts.add(record_pos);
                            selectedEnds.add(record_pos + 1);
                        }
                        numOfResults++;
                    }
                }
            } else {
                // Non-leaf node. Add all children to the list of nodes to search
                // Add in reverse order to the stack so that results come in sorted order
                nodes_2b_searched.add(first_child_pos + 3);
                nodes_2b_searched.add(first_child_pos + 2);
                nodes_2b_searched.add(first_child_pos + 1);
                nodes_2b_searched.add(first_child_pos + 0);
            }
        }
    }
    if (output != null) {
        PointValue returnValue = new PointValue();
        long dataStartPosition = treeStartPosition + getValuesStartOffset(cardinality);
        // Return all values in the selected ranges
        for (int iRange = 0; iRange < selectedStarts.size(); iRange++) {
            int treeStart = selectedStarts.get(iRange);
            int treeEnd = selectedEnds.get(iRange);
            long startPosition = dataStartPosition + selectedStarts.get(iRange) * cardinality * 2;
            in.seek(startPosition);
            for (int treePos = treeStart; treePos < treeEnd; treePos++) {
                // Retrieve the coords for the point at treePos
                stockQuadTree.getRecordCoords(treePos, returnValue);
                // Read all entries at current position
                for (int iValue = 0; iValue < cardinality; iValue++) {
                    short value = in.readShort();
                    if (value != fillValue) {
                        returnValue.value = value;
                        returnValue.timestamp = timestamps[iValue];
                        output.collect(returnValue);
                    }
                }
            }
        }
    }
    return numOfResults;
}

From source file:org.mahasen.util.SearchUtil.java

/**
 * @param searchParameters/* w  ww .  java2s.  co  m*/
 * @return
 * @throws MahasenException
 * @throws InterruptedException
 */
public Vector<String> multipleOrSearch(Hashtable<String, Vector<String>> searchParameters)
        throws MahasenException, InterruptedException {
    ArrayList<SearchBean> searchValues = createSearchBeans(searchParameters);
    Vector<String> fileNames = new Vector<String>();

    Vector<Id> finalResultIds = new Vector<Id>();
    for (SearchBean searchBean : searchValues) {
        Vector<Id> resultIds;
        if (searchBean.isRangeBased()) {
            resultIds = getRangeSearchResultIds(searchBean.getPropertyName(), searchBean.getInitialValue(),
                    searchBean.getLastValue());

        } else {
            resultIds = getSearchResultIds(searchBean.getPropertyName(), searchBean.getInitialValue());

        }

        if (finalResultIds.isEmpty()) {
            finalResultIds.addAll(resultIds);
        } else {
            for (Id id : resultIds) {
                if (!finalResultIds.contains(id)) {
                    finalResultIds.add(id);
                }
            }
        }
    }
    fileNames = getResultantFileNames(finalResultIds);
    return fileNames;
}

From source file:org.globus.ftp.test.GridFTPClientTest.java

public void testList2() throws Exception {
    logger.info("test two consective list, using both list functions, using GridFTPClient");

    GridFTPClient client = connect();//  ww  w .ja  va  2 s. c  o  m

    String output1 = null;
    String output2 = null;

    // using list()

    client.changeDir(TestEnv.serverADir);
    Vector v = client.list(null, null);
    logger.debug("list received");
    StringBuffer output1Buffer = new StringBuffer();
    while (!v.isEmpty()) {
        FileInfo f = (FileInfo) v.remove(0);
        output1Buffer.append(f.toString()).append("\n");

    }
    output1 = output1Buffer.toString();

    // using list(String,String, DataSink)

    HostPort hp2 = client.setPassive();
    client.setLocalActive();

    final ByteArrayOutputStream received2 = new ByteArrayOutputStream(1000);

    // unnamed DataSink subclass will write data channel content
    // to "received" stream.

    client.list(null, null, new DataSink() {
        public void write(Buffer buffer) throws IOException {
            logger.debug("received " + buffer.getLength() + " bytes of directory listing");
            received2.write(buffer.getBuffer(), 0, buffer.getLength());
        }

        public void close() throws IOException {
        };
    });

    // transfer done. Data is in received2 stream.

    output2 = received2.toString();
    logger.debug(output2);

    client.close();
}

From source file:com.ah.be.cloudauth.HmCloudAuthCertMgmtImpl.java

@SuppressWarnings("rawtypes")
private void verifyCSRContent(BeRadSecCertCreationResultEvent result, String commonName)
        throws HmCloudAuthException {
    String methodName = "verifyCSRContent";
    if (result.isCreateError()) {
        throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_CREATE_ERR);
    }/* www .  ja va 2  s .co m*/
    if (result.isNeedCreate()) {
        byte[] csrContent = result.getCsrContent();
        final List pemItems = org.apache.commons.ssl.PEMUtil.decode(csrContent);
        if (pemItems.isEmpty()) {
            throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_DECODE_ERR);
        }

        final PEMItem csrPemItem = (PEMItem) pemItems.get(0);
        if (csrPemItem.pemType.startsWith(CERTIFICATE_REQUEST)) {
            final PKCS10CertificationRequest csr = new PKCS10CertificationRequest(csrPemItem.getDerBytes());
            CertificationRequestInfo requestInfo = csr.getCertificationRequestInfo();
            X509Name subject = requestInfo.getSubject();

            Vector commondNameVector = subject.getValues(X509Name.CN);
            Vector countryVector = subject.getValues(X509Name.C);
            Vector organizationVector = subject.getValues(X509Name.O);
            if (commondNameVector.isEmpty() || countryVector.isEmpty() || organizationVector.isEmpty()) {
                throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_FORMAT_ERR);
            }
            if (!commonName.equalsIgnoreCase(commondNameVector.get(0).toString())
                    || !ORGANIZATION.equals(organizationVector.get(0).toString())
                    || !COUNTRY.equals(countryVector.get(0).toString())) {
                throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_VERIFY_ERR);
            }
        } else {
            throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_DECODE_ERR);
        }
    } else {
        throw new HmCloudAuthException(methodName, UpdateCAStatus.CSR_STATUS_ERR);
    }
    return;
}

From source file:org.parosproxy.paros.core.spider.Collector.java

private Vector addSelectField(Vector qry, Select select) {
    Vector newQryList = new Vector();
    String queryString = null;//  www.  ja va 2s. co  m
    if (select.getOption() == null) {
        return newQryList;
    }

    for (int i = 0; i < select.getOption().length && i < 2; i++) {
        // only select at most 2 option to avoid too much combinations

        // if 2nd option exist, don't use first option because first option is usually not valid option
        if (i == 0 && select.getOption().length > 1) {
            continue;
        }

        String value = select.getOption()[i].getValue();
        try {
            if (qry.isEmpty()) {
                queryString = buildPostQueryString("", select.getName(), value);
                newQryList.addElement(queryString);
            } else {
                for (int j = 0; j < qry.size(); j++) {
                    queryString = (String) qry.elementAt(j);
                    queryString = buildPostQueryString(queryString, select.getName(), value);
                    newQryList.addElement(queryString);
                }
            }
        } catch (Exception e) {
        }
    }
    return newQryList;
}

From source file:org.ecoinformatics.seek.dataquery.DBTablesGenerator.java

private synchronized void loadDataIntoTable(String tableName, Entity table, InputStream dataStream)
        throws SQLException, ClassNotFoundException, IllegalArgumentException, Exception {
    if (dataStream == null) {
        return;//from w w  w  . j a  v a2 s .  c o  m
    }

    PreparedStatement pStatement = null;
    Connection conn = DatabaseFactory.getDBConnection();
    conn.setAutoCommit(false);
    try {
        String insertCommand = generateInsertCommand(tableName, table);
        pStatement = conn.prepareStatement(insertCommand);
        // int length = data.length;

        if (!table.getIsImageEntity() && table.isSimpleDelimited()) {
            // create SimpleDelimiter reader
            int numCols = table.getAttributes().length;
            String delimiter = table.getDelimiter();
            int numHeaderLines = table.getNumHeaderLines();
            String lineEnding = table.getPhysicalLineDelimiter();
            if (lineEnding == null || lineEnding.trim().equals("")) {
                lineEnding = table.getRecordDelimiter();
            }
            int numRecords = table.getNumRecords();
            boolean stripHeader = true;
            DelimitedReader simpleReader = new DelimitedReader(dataStream, numCols, delimiter, numHeaderLines,
                    lineEnding, numRecords, stripHeader);
            Vector row = simpleReader.getRowDataVectorFromStream();
            while (!row.isEmpty()) {
                // insert one row data into table
                int sizeOfRow = row.size();
                for (int j = 0; j < sizeOfRow; j++) {
                    String dataElement = (String) row.elementAt(j);
                    // get data type for the vector which already has the
                    // cloumn java
                    // type info after parsing attribute in private method
                    // parseAttributeList
                    String javaType = (String) dbJavaDataTypeList.elementAt(j);
                    // this method will binding data into preparedstatement
                    // base on
                    // java data type
                    // The index of pstatement start 1 (Not 0), so it should
                    // j+1.
                    pStatement = setupPreparedStatmentParameter(j + 1, pStatement, dataElement, javaType);

                }
                pStatement.execute();
                row = simpleReader.getRowDataVectorFromStream();
            }
        } else if (!table.getIsImageEntity() && !table.isSimpleDelimited()) {
            TextComplexFormatDataReader complexReader = new TextComplexFormatDataReader(dataStream, table);
            Vector row = complexReader.getRowDataVectorFromStream();
            while (!row.isEmpty()) {
                // insert one row data into table
                int sizeOfRow = row.size();
                for (int j = 0; j < sizeOfRow; j++) {
                    String dataElement = (String) row.elementAt(j);
                    dataElement = dataElement.trim();
                    // System.out.println("The data is "+ dataElement);
                    // get data type for the vector which already has the
                    // cloumn java
                    // type info after parsing attribute in private method
                    // parseAttributeList
                    String javaType = (String) dbJavaDataTypeList.elementAt(j);
                    // this method will binding data into preparedstatement
                    // base on
                    // java data type
                    // The index of pstatement start 1 (Not 0), so it should
                    // j+1.
                    pStatement = setupPreparedStatmentParameter(j + 1, pStatement, dataElement, javaType);

                }
                pStatement.execute();
                row = complexReader.getRowDataVectorFromStream();
            }
        }

    } catch (SQLException sqle) {
        conn.rollback();
        pStatement.close();
        conn.close();
        throw sqle;
    } catch (IllegalArgumentException le) {
        conn.rollback();
        pStatement.close();
        conn.close();
        throw le;
    } catch (Exception ue) {
        conn.rollback();
        pStatement.close();
        conn.close();
        throw ue;
    }
    conn.commit();
    pStatement.close();
    conn.close();
}