Example usage for java.util Vector iterator

List of usage examples for java.util Vector iterator

Introduction

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

Prototype

public synchronized Iterator<E> iterator() 

Source Link

Document

Returns an iterator over the elements in this list in proper sequence.

Usage

From source file:org.kepler.sms.NamedOntClass.java

/**
 * @param sorted/*from   w ww  .  j  a  v a  2s  . c o  m*/
 *            Return sorted list if true.
 */
public Iterator<NamedOntClass> getNamedSuperClasses(boolean sorted) {
    Vector<NamedOntClass> result = new Vector<NamedOntClass>();
    for (OWLDescription desc : _ontClass.getSuperClasses(_ontology)) {
        OWLClass supcls;
        try {
            supcls = desc.asOWLClass();
        } catch (OWLRuntimeException ex) {
            log.warn("Failed to parse: " + desc + " (" + desc.getClass().getName() + ")");
            continue;
        }
        boolean hasLabel = !supcls.getAnnotations(_ontology, OWLRDFVocabulary.RDFS_LABEL.getURI()).isEmpty();
        if (hasLabel || supcls.toString() != null) {
            // NOTE: Does supcls.toString == null happen?
            result.add(new NamedOntClass(supcls, _ontology));
        }
    }
    if (sorted) {
        Collections.sort(result);
    }
    return result.iterator();
}

From source file:org.pentaho.di.job.entries.ssh2get.JobEntrySSH2GET.java

/**
 * copy a directory from the remote host to the local one recursivly.
 *
 * @param sourceLocation/*from   w ww.j a  v a2  s.co  m*/
 *          the source directory on the remote host
 * @param targetLocation
 *          the target directory on the local host
 * @param sftpClient
 *          is an instance of SFTPv3Client that makes SFTP client connection over SSH-2
 * @return the number of files successfully copied
 * @throws Exception
 */
private void copyRecursive(String sourceLocation, String targetLocation, SFTPv3Client sftpClient,
        Pattern pattern, Job parentJob) throws Exception {
    String sourceFolder = "." + FTPUtils.FILE_SEPARATOR;
    if (sourceLocation != null) {
        sourceFolder = sourceLocation;
    }

    if (this.isDirectory(sftpClient, sourceFolder)) {
        Vector<?> filelist = sftpClient.ls(sourceFolder);
        Iterator<?> iterator = filelist.iterator();

        while (iterator.hasNext()) {

            SFTPv3DirectoryEntry dirEntry = (SFTPv3DirectoryEntry) iterator.next();

            if (dirEntry == null) {
                continue;
            }
            if (dirEntry.filename.equals(".") || dirEntry.filename.equals("..")) {
                continue;
            }
            copyRecursive(sourceFolder + FTPUtils.FILE_SEPARATOR + dirEntry.filename,
                    targetLocation + Const.FILE_SEPARATOR + dirEntry.filename, sftpClient, pattern, parentJob);
        }
    } else if (isFile(sftpClient, sourceFolder)) {
        if (getFileWildcard(sourceFolder, pattern)) {
            copyFile(sourceFolder, targetLocation, sftpClient);
        }
    }
}

From source file:it.eng.spagobi.engines.chart.bo.charttypes.targetcharts.TargetCharts.java

public void configureChart(SourceBean content) {
    logger.debug("IN");
    super.configureChart(content);
    confParameters = new HashMap<String, String>();
    SourceBean confSB = (SourceBean) content.getAttribute("CONF");
    if (confSB == null)
        return;// ww  w.jav  a 2 s  .c o  m
    List confAttrsList = confSB.getAttributeAsList("PARAMETER");
    Iterator confAttrsIter = confAttrsList.iterator();
    while (confAttrsIter.hasNext()) {
        SourceBean param = (SourceBean) confAttrsIter.next();
        String nameParam = (String) param.getAttribute("name");
        String valueParam = (String) param.getAttribute("value");
        confParameters.put(nameParam, valueParam);
    }

    //check if targets or baselines are defined as parameters, if not then search for them in template
    //**************************** PARAMETERES TARGET OR BASELINES DEFINITION **********************
    boolean targets = false;
    boolean baselines = false;
    boolean parameterThresholdDefined = false;
    Vector<String> targetNames = new Vector<String>();
    Vector<String> baselinesNames = new Vector<String>();
    for (Iterator iterator = parametersObject.keySet().iterator(); iterator.hasNext();) {
        String name = (String) iterator.next();
        Object value = parametersObject.get(name);
        if (name.startsWith("target") && !value.toString().equalsIgnoreCase("[]")) {
            targets = true;
            targetNames.add(name);
        }
        if (name.startsWith("baseline") && !value.toString().equalsIgnoreCase("[]")) { // if targets are used baseline will be ignored
            baselines = true;
            baselinesNames.add(name);
        }
    }

    if (targets == true) { // Case Target Found on parameters
        useTargets = true;
        for (Iterator iterator = targetNames.iterator(); iterator.hasNext();) {
            String targetName = (String) iterator.next();
            String valueToParse = (String) parametersObject.get(targetName);
            TargetThreshold targThres = new TargetThreshold(valueToParse);
            if (targThres.getName().equalsIgnoreCase("bottom"))
                bottomThreshold = targThres;
            else {
                if (targThres.isVisible()) {
                    thresholds.put(targThres.getValue(), targThres);
                    if (targThres.isMain() == true)
                        mainThreshold = targThres.getValue();
                }
            }
        }
        if (bottomThreshold == null)
            bottomThreshold = new TargetThreshold("bottom", null, Color.BLACK, false, true);
    } else if (baselines == true) { // Case Baselines found on parameters
        useTargets = false;
        for (Iterator iterator = baselinesNames.iterator(); iterator.hasNext();) {
            String targetName = (String) iterator.next();
            String valueToParse = (String) parametersObject.get(targetName);
            TargetThreshold targThres = new TargetThreshold(valueToParse);
            if (targThres.getName().equalsIgnoreCase("bottom"))
                bottomThreshold = targThres;
            else {
                if (targThres.isVisible()) {
                    thresholds.put(targThres.getValue(), targThres);
                    if (targThres.isMain() == true)
                        mainThreshold = targThres.getValue();
                }
            }
        }
        if (bottomThreshold == null)
            bottomThreshold = new TargetThreshold("bottom", null, Color.BLACK, false, true);

    }
    //**************************** TEMPLATE TARGET OR BASELINES DEFINITION **********************
    else { // Case targets or baselines defined in template
        /* <TARGETS>
         *  <TARGET name='first' value='5' main='true'>
         *  </TARGETS>
         */
        List thresAttrsList = null;
        SourceBean thresholdsSB = (SourceBean) content.getAttribute(TARGETS);
        if (thresholdsSB == null) {
            thresholdsSB = (SourceBean) content.getAttribute(BASELINES);
            if (thresholdsSB == null)
                return;
            useTargets = false;
        }

        if (thresholdsSB != null) {
            thresAttrsList = thresholdsSB.getContainedSourceBeanAttributes();
        }
        if (thresAttrsList == null || thresAttrsList.isEmpty()) {
            logger.error("targets or baselines not defined; error ");
            return;
        } else {
            thresholds = new HashMap<Double, TargetThreshold>();
            //thresholdColors=new HashMap<String, Color>();         
            Iterator targetsAttrsIter = thresAttrsList.iterator();
            while (targetsAttrsIter.hasNext()) {
                SourceBeanAttribute paramSBA = (SourceBeanAttribute) targetsAttrsIter.next();
                SourceBean param = (SourceBean) paramSBA.getValue();
                String name = (String) param.getAttribute("name");
                String value = (String) param.getAttribute("value");
                String main = (String) param.getAttribute("main");
                String colorS = (String) param.getAttribute("color");
                String visibleS = (String) param.getAttribute("visible");

                Color colorC = Color.BLACK;
                boolean isMain = (main != null && main.equalsIgnoreCase("true")) ? true : false;
                if (colorS != null) {
                    try {
                        colorC = Color.decode(colorS);
                    } catch (Exception e) {
                        logger.error("error in color defined, put BLACK as default");
                    }
                }
                boolean isVisible = (visibleS != null && (visibleS.equalsIgnoreCase("false")
                        || visibleS.equalsIgnoreCase("0") || visibleS.equalsIgnoreCase("0.0"))) ? false : true;

                // The value of the threshold is bottom or a double value
                if (value != null) {
                    if (value.equalsIgnoreCase("bottom")) { //if definin bottom case
                        bottomThreshold = new TargetThreshold("bottom", null, colorC, false, true);
                    } else if (!value.equalsIgnoreCase("bottom")) {
                        Double valueD = null;
                        try {
                            valueD = Double.valueOf(value);
                        } catch (NumberFormatException e) {
                            logger.error("Error in converting threshold double", e);
                            return;
                        }
                        if (isVisible == true) {
                            thresholds.put(valueD,
                                    new TargetThreshold(name, valueD, colorC, isMain, isVisible));
                            if (isMain == true) {
                                mainThreshold = valueD;
                            }
                        }
                    }

                }
            }
        } // Template definition
    }

    if (confParameters.get(WLT_MODE) != null) {
        String wltModeS = (String) confParameters.get(WLT_MODE);
        wlt_mode = Double.valueOf(wltModeS);
    }

    if (confParameters.get(MAXIMUM_BAR_WIDTH) != null) {
        String maxBarWidthS = (String) confParameters.get(MAXIMUM_BAR_WIDTH);
        try {
            maxBarWidth = Double.valueOf(maxBarWidthS);
        } catch (NumberFormatException e) {
            logger.error("error in defining parameter " + MAXIMUM_BAR_WIDTH
                    + ": should be a double, it will be ignored", e);
        }
    }

    SourceBean styleValueLabelsSB = (SourceBean) content.getAttribute(STYLE_VALUE_LABELS);
    if (styleValueLabelsSB != null) {

        String fontS = (String) styleValueLabelsSB.getAttribute(FONT_STYLE);
        if (fontS == null) {
            fontS = defaultLabelsStyle.getFontName();
        }
        String sizeS = (String) styleValueLabelsSB.getAttribute(SIZE_STYLE);
        String colorS = (String) styleValueLabelsSB.getAttribute(COLOR_STYLE);
        String orientationS = (String) styleValueLabelsSB.getAttribute(ORIENTATION_STYLE);
        if (orientationS == null) {
            orientationS = "horizontal";
        }

        try {
            Color color = Color.BLACK;
            if (colorS != null) {
                color = Color.decode(colorS);
            } else {
                defaultLabelsStyle.getColor();
            }
            int size = 12;
            if (sizeS != null) {
                size = Integer.valueOf(sizeS).intValue();
            } else {
                size = defaultLabelsStyle.getSize();
            }

            styleValueLabels = new StyleLabel(fontS, size, color, orientationS);

        } catch (Exception e) {
            logger.error("Wrong style labels settings, use default");
        }

    } else {
        styleValueLabels = defaultLabelsStyle;
    }

    logger.debug("OUT");
}

From source file:org.apache.axis.SOAPPart.java

/**
 * Get the contents of this Part (not the MIME headers!), as a
 * SOAPEnvelope.  This will force a complete parse of the
 * message./*from w w w . ja  va 2 s .  c om*/
 *
 * @return a <code>SOAPEnvelope</code> containing the message content
 * @throws AxisFault if the envelope could not be constructed
 */
public SOAPEnvelope getAsSOAPEnvelope() throws AxisFault {
    if (log.isDebugEnabled()) {
        log.debug("Enter: SOAPPart::getAsSOAPEnvelope()");
        log.debug(Messages.getMessage("currForm", formNames[currentForm]));
    }
    if (currentForm == FORM_SOAPENVELOPE)
        return (SOAPEnvelope) currentMessage;

    if (currentForm == FORM_BODYINSTREAM) {
        InputStreamBody bodyEl = new InputStreamBody((InputStream) currentMessage);
        SOAPEnvelope env = new SOAPEnvelope();
        env.setOwnerDocument(this);
        env.addBodyElement(bodyEl);
        setCurrentForm(env, FORM_SOAPENVELOPE);
        return env;
    }

    InputSource is;

    if (currentForm == FORM_INPUTSTREAM) {
        is = new InputSource((InputStream) currentMessage);
        String encoding = XMLUtils.getEncoding(msgObject, null, null);
        if (encoding != null) {
            currentEncoding = encoding;
            is.setEncoding(currentEncoding);
        }
    } else {
        is = new InputSource(new StringReader(getAsString()));
    }
    DeserializationContext dser = new DeserializationContext(is, getMessage().getMessageContext(),
            getMessage().getMessageType());
    dser.getEnvelope().setOwnerDocument(this);
    // This may throw a SAXException
    try {
        dser.parse();
    } catch (SAXException e) {
        Exception real = e.getException();
        if (real == null)
            real = e;
        throw AxisFault.makeFault(real);
    }

    SOAPEnvelope nse = dser.getEnvelope();
    if (currentMessageAsEnvelope != null) {
        //Need to synchronize back processed header info.
        Vector newHeaders = nse.getHeaders();
        Vector oldHeaders = currentMessageAsEnvelope.getHeaders();
        if (null != newHeaders && null != oldHeaders) {
            Iterator ohi = oldHeaders.iterator();
            Iterator nhi = newHeaders.iterator();
            while (ohi.hasNext() && nhi.hasNext()) {
                SOAPHeaderElement nhe = (SOAPHeaderElement) nhi.next();
                SOAPHeaderElement ohe = (SOAPHeaderElement) ohi.next();

                if (ohe.isProcessed())
                    nhe.setProcessed(true);
            }
        }

    }

    setCurrentForm(nse, FORM_SOAPENVELOPE);

    log.debug("Exit: SOAPPart::getAsSOAPEnvelope");
    SOAPEnvelope env = (SOAPEnvelope) currentMessage;
    env.setOwnerDocument(this);
    return env;
}

From source file:com.vsquaresystem.safedeals.marketprice.MarketPriceService.java

public boolean saveExcelToDatabase() throws IOException {

    Vector dataHolder = read();
    marketPriceDAL.truncateAll();/*  w ww .jav a 2s .  c  o m*/
    dataHolder.remove(0);
    System.out.println("data line 147" + dataHolder);
    MarketPrice marketPrice = new MarketPrice();
    String id = "";
    String cityId = "";
    String locationId = "";
    String year = "";
    String month = "";
    String mpAgriLandLowest = "";
    String mpAgriLandHighest = "";
    String mpPlotLowest = "";
    String mpPlotHighest = "";
    String mpResidentialLowest = "";
    String mpResidentialHighest = "";
    String mpCommercialLowest = "";
    String mpCommercialHighest = "";
    String sdZoneId = "";
    String locationTypeId = "";
    String locationCategories = "";
    String description = "";
    String majorApproachRoad = "";
    String sourceOfWater = "";
    String publicTransport = "";
    String advantage = "";
    String disadvantage = "";
    String population = "";
    String migrationRate = "";
    String isCommercialCenter = "";

    DataFormatter formatter = new DataFormatter();
    for (Iterator iterator = dataHolder.iterator(); iterator.hasNext();) {

        List list = (List) iterator.next();

        System.out.println("list for save" + list);
        cityId = list.get(1).toString();
        locationId = list.get(2).toString();
        year = list.get(3).toString();
        month = list.get(4).toString();
        mpAgriLandLowest = list.get(5).toString();
        mpAgriLandHighest = list.get(6).toString();
        mpPlotLowest = list.get(7).toString();
        mpPlotHighest = list.get(8).toString();
        mpResidentialLowest = list.get(9).toString();
        mpResidentialHighest = list.get(10).toString();
        mpCommercialLowest = list.get(11).toString();
        mpCommercialHighest = list.get(12).toString();

        List<Integer> numberList = new ArrayList<Integer>();

        try {

            marketPrice.setCityId(Integer.parseInt(cityId));
            marketPrice.setLocationId(Integer.parseInt(locationId));
            marketPrice.setYear(Integer.parseInt(year));
            marketPrice.setMonth(Integer.parseInt(month));
            marketPrice.setMpAgriLandLowest(Double.parseDouble(mpAgriLandLowest));
            marketPrice.setMpAgriLandHighest(Double.parseDouble(mpAgriLandHighest));

            marketPrice.setMpPlotLowest(Double.parseDouble(mpPlotLowest));
            marketPrice.setMpPlotHighest(Double.parseDouble(mpPlotHighest));

            marketPrice.setMpResidentialLowest(Double.parseDouble(mpResidentialLowest));
            marketPrice.setMpResidentialHighest(Double.parseDouble(mpResidentialHighest));

            marketPrice.setMpCommercialLowest(Double.parseDouble(mpCommercialLowest));
            marketPrice.setMpCommercialHighest(Double.parseDouble(mpCommercialHighest));

            marketPriceDAL.insert(marketPrice);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    File excelFile = attachmentUtils.getDirectoryByAttachmentType(AttachmentUtils.AttachmentType.MARKET_PRICE);
    FileUtils.cleanDirectory(excelFile);
    return true;

}

From source file:com.panet.imeta.job.entries.ssh2get.JobEntrySSH2GET.java

/**
 * copy a directory from the remote host to the local one recursivly.
 * /* w  w w  .ja v  a 2s  .c  o m*/
 * @param sourceLocation the source directory on the remote host
 * @param targetLocation the target directory on the local host
 * @param sftpClient is an instance of SFTPv3Client that makes SFTP client connection over SSH-2
 * @return the number of files successfully copied
 * @throws Exception
 */
@SuppressWarnings("unchecked")
private void copyRecursive(String sourceLocation, String targetLocation, SFTPv3Client sftpClient,
        String wildcardin, Job parentJob) throws Exception {
    String sourceFolder = "";
    if (sourceLocation != null)
        sourceFolder = sourceLocation + FTPUtils.FILE_SEPARATOR;

    if (this.isDirectory(sftpClient, sourceFolder)) {

        Vector<SFTPv3DirectoryEntry> filelist = sftpClient.ls(sourceFolder);

        Iterator<SFTPv3DirectoryEntry> iterator = filelist.iterator();

        while (iterator.hasNext() && !parentJob.isStopped()) {

            SFTPv3DirectoryEntry dirEntry = iterator.next();

            if (dirEntry == null)
                continue;

            if (dirEntry.filename.equals(".") || dirEntry.filename.equals(".."))
                continue;

            copyRecursive(sourceFolder + dirEntry.filename,
                    targetLocation + FTPUtils.FILE_SEPARATOR + dirEntry.filename, sftpClient, wildcardin,
                    parentJob);

        }

    } else {

        if (GetFileWildcard(sourceFolder, wildcardin)) {
            // It's a file...so let's start transferring it
            copyFile(sourceFolder, targetLocation, sftpClient);
        }

    }
}

From source file:net.rim.ejde.internal.ui.views.objects.ObjectsView.java

void fillContextMenu(IMenuManager menuMgr) {
    Vector<MenuItem> menuVector = null;

    try {/*from w w w .j  a va  2s .com*/
        menuVector = ObjectsView.getObjectsContentsHelper().getMenu();
    } catch (IDEError e) {
        log.error(e.getMessage(), e);
    }

    if (menuVector == null) {
        return;
    }

    MenuItem menuItem;
    for (Iterator<MenuItem> iterator = menuVector.iterator(); iterator.hasNext();) {
        menuItem = iterator.next();

        if (menuItem.isSeparator) {
            menuMgr.add(new Separator());
        } else {
            menuMgr.add(new MenuAction(this, menuItem));
        }
    }

    menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
}

From source file:com.globalsight.everest.webapp.pagehandler.administration.users.UserMainHandler.java

private void filtrateUsers(Vector users, SessionManager sessionMgr) {
    String uProjectFilter = (String) sessionMgr.getAttribute("uProjectFilter");
    String uPermissionFilter = (String) sessionMgr.getAttribute("uPermissionFilter");
    String uCompanyFilter = (String) sessionMgr.getAttribute("uCompanyFilter");
    HashMap<String, String> ProjectNameMap = UserHandlerHelper
            .getAllPerAndProNameForUser(UserHandlerHelper.PROJECT);
    HashMap<String, String> PermissionGroupNamesMap = UserHandlerHelper
            .getAllPerAndProNameForUser(UserHandlerHelper.PERMISSIONGROUP);
    for (Iterator iter = users.iterator(); iter.hasNext();) {
        User user = (User) iter.next();/*from w  w w .ja v  a2 s.  c  om*/
        String pName = user.getCompanyName();
        if (matchCondition(uCompanyFilter, pName)) {
            iter.remove();
            continue;
        }

        pName = ProjectNameMap.get(user.getUserId());

        if (matchCondition(uProjectFilter, pName)) {
            iter.remove();
            continue;
        }
        user.setProjectNames(pName);
        pName = PermissionGroupNamesMap.get(user.getUserId());

        if (matchCondition(uPermissionFilter, pName)) {
            iter.remove();
            continue;
        }

        user.setPermissiongNames(pName);
    }
}

From source file:com.panet.imeta.job.entries.ssh2get.JobEntrySSH2GET.java

/**
 * copy a directory from the remote host to the local one.
 * /*from w w w. j  a  va 2 s  .  c om*/
 * @param sourceLocation the source directory on the remote host
 * @param targetLocation the target directory on the local host
 * @param sftpClient is an instance of SFTPv3Client that makes SFTP client connection over SSH-2
 * @return the number of files successfully copied
 * @throws Exception
 */
@SuppressWarnings("unchecked")
private void GetFiles(String sourceLocation, String targetLocation, SFTPv3Client sftpClient, String wildcardin,
        Job parentJob) throws Exception {

    String sourceFolder = ".";
    if (!Const.isEmpty(sourceLocation))
        sourceFolder = sourceLocation + FTPUtils.FILE_SEPARATOR;
    else
        sourceFolder += FTPUtils.FILE_SEPARATOR;

    Vector<SFTPv3DirectoryEntry> filelist = sftpClient.ls(sourceFolder);

    if (filelist != null) {
        Iterator<SFTPv3DirectoryEntry> iterator = filelist.iterator();

        while (iterator.hasNext() && !parentJob.isStopped()) {
            SFTPv3DirectoryEntry dirEntry = iterator.next();

            if (dirEntry == null)
                continue;

            if (dirEntry.filename.equals(".") || dirEntry.filename.equals("..")
                    || isDirectory(sftpClient, sourceFolder + dirEntry.filename))
                continue;

            if (GetFileWildcard(dirEntry.filename, wildcardin)) {
                // Copy file from remote host
                copyFile(sourceFolder + dirEntry.filename,
                        targetLocation + FTPUtils.FILE_SEPARATOR + dirEntry.filename, sftpClient);
            }

        }
    }
}

From source file:com.dragonflow.StandardMonitor.URLMonitor.java

private static Vector finalHTTPClientlRequestPreparation(URLContext urlcontext,
        HTTPRequestSettings httprequestsettings, Array array, long l) throws Exception {
    if (httprequestsettings.getAuthUserName() == null || httprequestsettings.getAuthUserName().length() == 0) {
        String s = urlcontext.getMonitor().getSetting("_defaultAuthUsername");
        if (s.length() > 0) {
            httprequestsettings.setAuthUserName(s);
            httprequestsettings.setAuthNTLMDomain(urlcontext.getMonitor().getSetting("_defaultAuthNTLMDomain"));
            httprequestsettings.setAuthPassword(urlcontext.getMonitor().getSetting("_defaultAuthPassword"));
        }//w ww . jav  a  2  s .c o  m
    }
    if (httprequestsettings.getAuthenticationOnFirstRequest() == null) {
        String s1 = urlcontext.getMonitor().getSetting("_defaultAuthWhenToAuthenticate");
        if (!$assertionsDisabled && s1.length() <= 0) {
            throw new AssertionError(
                    "add or set _defaultAuthWhenToAuthenticate=authOnFirst setting in master.config");
        }
        httprequestsettings.setAuthenticationOnFirstRequest(authOnFirstRequest(s1));
    }
    if (httprequestsettings.getAuthNTLMDomain().length() <= 0) {
        String as[] = splitUserDomain_If_NTChallengeInMonitor(httprequestsettings.getAuthUserName(),
                urlcontext.getMonitor().getSetting("_challengeResponse"));
        if (as != null) {
            httprequestsettings.setAuthNTLMDomain(as[0]);
            httprequestsettings.setAuthUserName(as[1]);
        }
    }
    long l1 = l - System.currentTimeMillis();
    if (l1 <= 0L) {
        throw new Exception("timed out");
    }
    httprequestsettings.setConnectionTimeoutMS((int) l1);
    httprequestsettings.setRequestTimeoutMS((int) l1);
    String s2 = urlcontext.getMonitor().getSetting("_URLMonitorProxyExceptions");
    String s3 = httprequestsettings.getHost();
    if (httprequestsettings.getProxy().length() != 0 && isProxyExcluded(s2, s3)) {
        httprequestsettings.setProxy("");
    }
    Vector vector = new Vector();
    if (urlcontext.getMonitor().getSetting("_sslKeepAlive").length() > 0) {
        if (httprequestsettings.getProxy().length() > 0) {
            vector.add(new Header("Proxy-Connection", "Keep-Alive"));
        } else {
            vector.add(new Header("Connection", "Keep-Alive"));
        }
    }
    String s4 = getUserAgent(array);
    if (s4.length() == 0) {
        s4 = urlcontext.getMonitor().getSetting("_URLUserAgent");
    }
    vector.add(new Header("User-Agent", s4));
    if (array != null) {
        Enumeration enumeration = array.elements();
        do {
            if (!enumeration.hasMoreElements()) {
                break;
            }
            String s5 = (String) enumeration.nextElement();
            if (TextUtils.startsWithIgnoreCase(s5, CUSTOM_HEADER)) {
                String s7 = s5.substring(CUSTOM_HEADER.length());
                String as1[] = s7.split(":", 2);
                if (!$assertionsDisabled && (as1 == null || as1.length <= 0)) {
                    throw new AssertionError();
                }
                if (as1.length > 1) {
                    vector.add(new Header(as1[0].trim(), as1[1].trim()));
                } else {
                    vector.add(new Header(as1[0].trim(), ""));
                }
            }
        } while (true);
    }
    Vector vector1 = urlcontext.getCookieHeader(httprequestsettings.getUrl());
    if (vector1 != null) {
        if (debugURL != 0) {
            System.out.println(
                    "URLMonitor.checkURLRetrieveDoneHere: COOKIE ADD TO HEADERS: " + vector1.toString());
        }
        httprequestsettings.setCookies(vector1);
    } else if (debugURL != 0) {
        System.out.println("URLMonitor.checkURLRetrieveDoneHere: COOKIE ADD TO HEADERS: NULL - NONE TO ADD ");
    }
    String s6 = urlcontext.getStreamEncoding();
    if (s6.length() > 0) {
        vector.add(new Header("Accept-charset", s6));
    }
    vector.add(new Header("Accept", "*/*"));
    Vector vector2 = prepareParametersForApache(array);
    if (vector2.size() > 0) {
        String s8 = "";
        if (s6.length() > 0) {
            s8 = "; charset=" + s6;
        }
        String s9 = getContentType(array);
        vector.add(new Header("Content-Type", s9 + s8));
    }
    checkPostFieldForRequestProtocol(array);
    long l2 = urlcontext.getMonitor().getSettingAsLong("_urlKeepAlive");
    if (urlcontext.getMonitor().getSetting("_HTTPVersion10").length() > 0) {
        httprequestsettings.setHttp11(false);
    }
    if (urlcontext.getMonitor().getSetting("_sslAcceptAllUntrustedCerts").length() > 0) {
        httprequestsettings.setAcceptAllUntrustedCerts(true);
    }
    if (urlcontext.getMonitor().getSetting("_sslAcceptInvalidCerts").length() > 0) {
        httprequestsettings.setAcceptInvalidCerts(true);
    }
    httprequestsettings.setHeaders(vector);
    String s10 = urlcontext.getEncodePostData();
    if (s10.equals(urlencodedDropDown[0]) || s10.equals("")) {
        Vector vector3 = httprequestsettings.getHeaders();
        httprequestsettings.setEncodePostData(false);
        Iterator iterator = vector3.iterator();
        do {
            if (!iterator.hasNext()) {
                break;
            }
            Header header = (Header) iterator.next();
            if (!header.getName().equalsIgnoreCase("Content-Type")
                    || header.getValue().toLowerCase().indexOf("urlencoded") < 0) {
                continue;
            }
            httprequestsettings.setEncodePostData(true);
            break;
        } while (true);
        String s12 = urlcontext.getMonitor().getSetting("_urlMonitorEncodePostData");
        if (s12.length() > 0) {
            httprequestsettings.setEncodePostData(s12.equalsIgnoreCase("true"));
        }
    } else if (s10.equals(urlencodedDropDown[2])) {
        httprequestsettings.setEncodePostData(true);
    } else if (s10.equals(urlencodedDropDown[4])) {
        httprequestsettings.setEncodePostData(false);
    } else if (!$assertionsDisabled) {
        throw new AssertionError("_dontEncodePostData= " + s10
                + ". Must be contentTypeUrlencoded, forceEncode, or forceNoEncode.");
    }
    int i = 0;
    String s11 = urlcontext.getMonitor().getSetting("_keepTryingForGoodStatus");
    if (s11.length() > 0) {
        i = TextUtils.toInt(s11);
    }
    if (i > 0) {
        httprequestsettings.setRetries(i);
    }
    setClientSideCertSettings(urlcontext, httprequestsettings);
    return vector2;
}