Example usage for java.util StringTokenizer nextElement

List of usage examples for java.util StringTokenizer nextElement

Introduction

In this page you can find the example usage for java.util StringTokenizer nextElement.

Prototype

public Object nextElement() 

Source Link

Document

Returns the same value as the nextToken method, except that its declared return value is Object rather than String .

Usage

From source file:org.wso2.carbon.identity.sso.saml.builders.assertion.DefaultSAMLAssertionBuilder.java

private AttributeStatement buildAttributeStatement(Map<String, String> claims) {

    String claimSeparator = claims.get(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
    if (StringUtils.isNotBlank(claimSeparator)) {
        userAttributeSeparator = claimSeparator;
    }/*from w w  w. ja  v  a  2s . c o m*/
    claims.remove(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);

    AttributeStatement attStmt = new AttributeStatementBuilder().buildObject();
    Iterator<Map.Entry<String, String>> iterator = claims.entrySet().iterator();
    boolean atLeastOneNotEmpty = false;
    for (int i = 0; i < claims.size(); i++) {
        Map.Entry<String, String> claimEntry = iterator.next();
        String claimUri = claimEntry.getKey();
        String claimValue = claimEntry.getValue();
        if (claimUri != null && !claimUri.trim().isEmpty() && claimValue != null
                && !claimValue.trim().isEmpty()) {
            atLeastOneNotEmpty = true;
            Attribute attribute = new AttributeBuilder().buildObject();
            attribute.setName(claimUri);
            //setting NAMEFORMAT attribute value to basic attribute profile
            attribute.setNameFormat(SAMLSSOConstants.NAME_FORMAT_BASIC);
            // look
            // https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaAnyTypes
            XSStringBuilder stringBuilder = (XSStringBuilder) Configuration.getBuilderFactory()
                    .getBuilder(XSString.TYPE_NAME);
            XSString stringValue;

            //Need to check if the claim has multiple values
            if (userAttributeSeparator != null && claimValue.contains(userAttributeSeparator)) {
                StringTokenizer st = new StringTokenizer(claimValue, userAttributeSeparator);
                while (st.hasMoreElements()) {
                    String attValue = st.nextElement().toString();
                    if (attValue != null && attValue.trim().length() > 0) {
                        stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                                XSString.TYPE_NAME);
                        stringValue.setValue(attValue);
                        attribute.getAttributeValues().add(stringValue);
                    }
                }
            } else {
                stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                        XSString.TYPE_NAME);
                stringValue.setValue(claimValue);
                attribute.getAttributeValues().add(stringValue);
            }

            attStmt.getAttributes().add(attribute);
        }
    }
    if (atLeastOneNotEmpty) {
        return attStmt;
    } else {
        return null;
    }
}

From source file:org.jasig.ssp.service.impl.StudentDocumentServiceImpl.java

private void initVolumes() {

    if (StringUtils.isEmpty(studentDocumentsVolumes)) {
        volumes.add("");
    } else {//  w  ww. j a  va 2  s  . c o m
        StringTokenizer tokenizer = new StringTokenizer(studentDocumentsVolumes, ",");
        while (tokenizer.hasMoreElements()) {
            volumes.add((String) tokenizer.nextElement());
        }
    }
}

From source file:com.frameworkset.orm.engine.model.JavaNameGenerator.java

/**
 * Converts a database schema name to java object name.  Removes
 * <code>STD_SEPARATOR_CHAR</code> and <code>SCHEMA_SEPARATOR_CHAR</code>,
 * capitilizes first letter of name and each letter after the 
 * <code>STD_SEPERATOR</code> and <code>SCHEMA_SEPARATOR_CHAR</code>,
 * converts the rest of the letters to lowercase.
 *
 * @param schemaName name to be converted.
 * @return converted name.//www.ja va  2  s .c  o m
 * @see com.frameworkset.orm.engine.model.NameGenerator
 * @see #underscoreMethod(String)
 */
protected String underscoreMethod(String schemaName, boolean IGNORE_FIRST_TOKEN) {
    StringBuffer name = new StringBuffer();

    // remove the STD_SEPARATOR_CHARs and capitalize 
    // the tokens
    StringTokenizer tok = new StringTokenizer(schemaName, String.valueOf(STD_SEPARATOR_CHAR));
    while (tok.hasMoreTokens()) {
        String namePart = ((String) tok.nextElement()).toLowerCase();
        name.append(StringUtils.capitalize(namePart));
    }

    // remove the SCHEMA_SEPARATOR_CHARs and capitalize 
    // the tokens
    schemaName = name.toString();
    name = new StringBuffer();
    tok = new StringTokenizer(schemaName, String.valueOf(SCHEMA_SEPARATOR_CHAR));
    while (tok.hasMoreTokens()) {
        String namePart = (String) tok.nextElement();
        name.append(StringUtils.capitalize(namePart));
    }
    return name.toString();
}

From source file:org.openmrs.module.addresshierarchyrwanda.htmlformentry.element.AddressHierarchySubmissionElement.java

public AddressHierarchySubmissionElement(FormEntryContext context, HttpServletRequest request,
        Map<String, String> parameters) {
    Patient existingPatient = context.getExistingPatient();
    addressWidgetList = new ArrayList<Widget>();
    errorWidget = new ErrorWidget();

    // check parameter types (optional)
    String types = parameters.get(FIELD_TYPES);
    if (types != null && types.length() > 1) {
        StringTokenizer tokenizer = new StringTokenizer(types, ",");
        while (tokenizer.hasMoreElements()) {
            String element = ((String) tokenizer.nextElement()).trim();
            if (element.equalsIgnoreCase(AddressHierarchyWidget.TYPE_COUNTRY)
                    || element.equalsIgnoreCase(AddressHierarchyWidget.TYPE_PROVINCE)
                    || element.equalsIgnoreCase(AddressHierarchyWidget.TYPE_DISTRICT)
                    || element.equalsIgnoreCase(AddressHierarchyWidget.TYPE_SECTOR)
                    || element.equalsIgnoreCase(AddressHierarchyWidget.TYPE_CELL)
                    || element.equalsIgnoreCase(AddressHierarchyWidget.TYPE_UMUDUGUDU)) {
                addressWidgetList.add(new AddressHierarchyWidget(element, existingPatient.getPersonAddress()));
            } else {
                throw new IllegalArgumentException(
                        "You must provide a valid type for example country in " + parameters);
            }//from   w w  w  .j  a  va 2s .  c om
        }
    } else {
        addressWidgetList.add(new AddressHierarchyWidget(AddressHierarchyWidget.TYPE_COUNTRY,
                existingPatient.getPersonAddress()));
        addressWidgetList.add(new AddressHierarchyWidget(AddressHierarchyWidget.TYPE_PROVINCE,
                existingPatient.getPersonAddress()));
        addressWidgetList.add(new AddressHierarchyWidget(AddressHierarchyWidget.TYPE_DISTRICT,
                existingPatient.getPersonAddress()));
        addressWidgetList.add(new AddressHierarchyWidget(AddressHierarchyWidget.TYPE_SECTOR,
                existingPatient.getPersonAddress()));
        addressWidgetList.add(new AddressHierarchyWidget(AddressHierarchyWidget.TYPE_CELL,
                existingPatient.getPersonAddress()));
        addressWidgetList.add(new AddressHierarchyWidget(AddressHierarchyWidget.TYPE_UMUDUGUDU,
                existingPatient.getPersonAddress()));
    }

    // Register widgets
    registerWidgetList(addressWidgetList, context);
    context.registerWidget(errorWidget);
}

From source file:org.wso2.carbon.identity.saml.inbound.builders.assertion.DefaultSAMLAssertionBuilder.java

private AttributeStatement buildAttributeStatement(Map<String, String> claims) {

    String claimSeparator = claims.get(MULTI_ATTRIBUTE_SEPARATOR);
    if (StringUtils.isNotBlank(claimSeparator)) {
        userAttributeSeparator = claimSeparator;
    }//  ww w.j  a  v  a2 s  . com
    claims.remove(MULTI_ATTRIBUTE_SEPARATOR);

    AttributeStatement attStmt = new AttributeStatementBuilder().buildObject();
    Iterator<Map.Entry<String, String>> iterator = claims.entrySet().iterator();
    boolean atLeastOneNotEmpty = false;
    for (int i = 0; i < claims.size(); i++) {
        Map.Entry<String, String> claimEntry = iterator.next();
        String claimUri = claimEntry.getKey();
        String claimValue = claimEntry.getValue();
        if (claimUri != null && !claimUri.trim().isEmpty() && claimValue != null
                && !claimValue.trim().isEmpty()) {
            atLeastOneNotEmpty = true;
            Attribute attribute = new AttributeBuilder().buildObject();
            attribute.setName(claimUri);
            //setting NAMEFORMAT attribute value to basic attribute profile
            attribute.setNameFormat(SAMLSSOConstants.NAME_FORMAT_BASIC);
            // look
            // https://wiki.shibboleth.net/confluence/display/OpenSAML/OSTwoUsrManJavaAnyTypes
            XSStringBuilder stringBuilder = (XSStringBuilder) Configuration.getBuilderFactory()
                    .getBuilder(XSString.TYPE_NAME);
            XSString stringValue;

            //Need to check if the claim has multiple values
            if (userAttributeSeparator != null && claimValue.contains(userAttributeSeparator)) {
                StringTokenizer st = new StringTokenizer(claimValue, userAttributeSeparator);
                while (st.hasMoreElements()) {
                    String attValue = st.nextElement().toString();
                    if (attValue != null && attValue.trim().length() > 0) {
                        stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                                XSString.TYPE_NAME);
                        stringValue.setValue(attValue);
                        attribute.getAttributeValues().add(stringValue);
                    }
                }
            } else {
                stringValue = stringBuilder.buildObject(AttributeValue.DEFAULT_ELEMENT_NAME,
                        XSString.TYPE_NAME);
                stringValue.setValue(claimValue);
                attribute.getAttributeValues().add(stringValue);
            }

            attStmt.getAttributes().add(attribute);
        }
    }
    if (atLeastOneNotEmpty) {
        return attStmt;
    } else {
        return null;
    }
}

From source file:gtu.zcognos.SimpleUI.java

private void initGUI() {
    try {//from   w  w w .  ja  va 2  s.  c  o  m

        final SwingActionUtil swingUtil = (SwingActionUtil) SwingActionUtil.newInstance(this);
        {
            GroupLayout thisLayout = new GroupLayout((JComponent) getContentPane());
            getContentPane().setLayout(thisLayout);
            this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            {
                projectId = new JTextField();
            }
            {
                packageId = new JTextField();
            }
            {
                jLabel1 = new JLabel();
                jLabel1.setText("PROJECT_ID");
            }
            {
                jLabel2 = new JLabel();
                jLabel2.setText("PACKAGE_ID");
            }
            {
                jLabel3 = new JLabel();
                jLabel3.setText("DATATABLE");
            }
            {
                jScrollPane1 = new JScrollPane();
                {
                    dataTable = new JTextArea();
                    jScrollPane1.setViewportView(dataTable);
                }
            }
            {
                create = new JButton();
                create.setText("create");
                create.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        swingUtil.invokeAction("create.actionPerformed", evt);
                    }
                });
            }
            thisLayout.setVerticalGroup(thisLayout.createSequentialGroup().addContainerGap(16, 16)
                    .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(projectId, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(thisLayout.createParallelGroup().addGroup(GroupLayout.Alignment.LEADING,
                            thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(packageId, GroupLayout.Alignment.BASELINE,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel2, GroupLayout.Alignment.BASELINE,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(GroupLayout.Alignment.LEADING,
                                    thisLayout.createSequentialGroup()
                                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0,
                                                    Short.MAX_VALUE)
                                            .addComponent(create, GroupLayout.PREFERRED_SIZE, 22,
                                                    GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 217, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap());
            thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup().addContainerGap(31, 31).addGroup(
                    thisLayout.createParallelGroup().addGroup(GroupLayout.Alignment.LEADING, thisLayout
                            .createSequentialGroup()
                            .addGroup(thisLayout.createParallelGroup()
                                    .addComponent(jLabel2, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel1, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel3, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(thisLayout.createParallelGroup()
                                    .addComponent(packageId, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(projectId, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(create, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE))
                            .addGroup(thisLayout.createSequentialGroup()
                                    .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 417,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, Short.MAX_VALUE)))
                    .addContainerGap(17, 17));
        }
        this.setSize(473, 356);

        swingUtil.addAction("create.actionPerformed", new Action() {
            public void action(EventObject evt) throws Exception {
                String project = projectId.getText();
                String dataTab = dataTable.getText();
                Validate.notEmpty(project);
                Validate.notEmpty(dataTab);
                String pkgId = StringUtils.defaultIfEmpty(packageId.getText(), project);

                List<String> dataTableList = new ArrayList<String>();
                StringTokenizer tok = new StringTokenizer(dataTab);
                for (int ii = 0; tok.hasMoreElements(); ii++) {
                    String column = (String) tok.nextElement();
                    System.out.format("%d -- %s\n", ii, column);
                    if (StringUtils.isBlank(column)) {
                        continue;
                    }
                    dataTableList.add(column.trim());
                }

                File destDir = new File(CREATE_DEST + "\\" + project);
                destDir.mkdirs();

                Map<String, Object> map = new HashMap<String, Object>();
                map.put("PROJECT_ID", project);
                map.put("PACKAGE_ID", pkgId);
                map.put("DATATABLE", dataTableList);

                ConfigCopy.getInstance().applyBaseDir(new File(CREATE_DEST)).applyProjectId(project).execute();

                Simple.getInstance()//
                        .applyDestDir(destDir.getAbsolutePath())//
                        .applyParameter(map)//
                        .execute();

                JOptionPaneUtil.newInstance().iconInformationMessage()
                        .showMessageDialog(pkgId + " create completed!!\r\n dir : " //
                                + destDir.getAbsolutePath(), pkgId);

                Desktop.getDesktop().open(destDir);
            }
        });

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:org.apache.jcs.auxiliary.remote.RemoteCacheFactory.java

/**
 * For LOCAL clients we get a handle to all the failovers, but we do not register a listener
 * with them. We create the RemoteCacheManager, but we do not get a cache. The failover runner
 * will get a cache from the manager. When the primary is restored it will tell the manager for
 * the failover to deregister the listener.
 * <p>/*w  ww.  ja v  a  2  s  . c o  m*/
 * (non-Javadoc)
 * @see org.apache.jcs.auxiliary.AuxiliaryCacheFactory#createCache(org.apache.jcs.auxiliary.AuxiliaryCacheAttributes,
 *      org.apache.jcs.engine.behavior.ICompositeCacheManager)
 */
public AuxiliaryCache createCache(AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr) {
    RemoteCacheAttributes rca = (RemoteCacheAttributes) iaca;

    ArrayList noWaits = new ArrayList();

    // if LOCAL
    if (rca.getRemoteType() == RemoteCacheAttributes.LOCAL) {
        // a list toi be turned into an array of failover server information
        ArrayList failovers = new ArrayList();

        // not necessary if a failover list is defined
        // REGISTER PRIMARY LISTENER
        // if it is a primary
        boolean primayDefined = false;
        if (rca.getRemoteHost() != null) {
            primayDefined = true;

            failovers.add(rca.getRemoteHost() + ":" + rca.getRemotePort());

            RemoteCacheManager rcm = RemoteCacheManager.getInstance(rca, cacheMgr);
            ICache ic = rcm.getCache(rca);
            if (ic != null) {
                noWaits.add(ic);
            } else {
                log.info("noWait is null");
            }
        }

        // GET HANDLE BUT DONT REGISTER A LISTENER FOR FAILOVERS
        String failoverList = rca.getFailoverServers();
        if (failoverList != null) {
            StringTokenizer fit = new StringTokenizer(failoverList, ",");
            int fCnt = 0;
            while (fit.hasMoreElements()) {
                fCnt++;

                String server = (String) fit.nextElement();
                failovers.add(server);

                rca.setRemoteHost(server.substring(0, server.indexOf(":")));
                rca.setRemotePort(Integer.parseInt(server.substring(server.indexOf(":") + 1)));
                RemoteCacheManager rcm = RemoteCacheManager.getInstance(rca, cacheMgr);
                // add a listener if there are none, need to tell rca what
                // number it is at
                if ((!primayDefined && fCnt == 1) || noWaits.size() <= 0) {
                    ICache ic = rcm.getCache(rca);
                    if (ic != null) {
                        noWaits.add(ic);
                    } else {
                        log.info("noWait is null");
                    }
                }
            }
            // end while
        }
        // end if failoverList != null

        rca.setFailovers((String[]) failovers.toArray(new String[0]));

        // if CLUSTER
    } else if (rca.getRemoteType() == RemoteCacheAttributes.CLUSTER) {
        // REGISTER LISTENERS FOR EACH SYSTEM CLUSTERED CACHEs
        StringTokenizer it = new StringTokenizer(rca.getClusterServers(), ",");
        while (it.hasMoreElements()) {
            // String server = (String)it.next();
            String server = (String) it.nextElement();
            // p( "tcp server = " + server );
            rca.setRemoteHost(server.substring(0, server.indexOf(":")));
            rca.setRemotePort(Integer.parseInt(server.substring(server.indexOf(":") + 1)));
            RemoteCacheManager rcm = RemoteCacheManager.getInstance(rca, cacheMgr);
            rca.setRemoteType(RemoteCacheAttributes.CLUSTER);
            ICache ic = rcm.getCache(rca);
            if (ic != null) {
                noWaits.add(ic);
            } else {
                log.info("noWait is null");
            }
        }

    }
    // end if CLUSTER

    RemoteCacheNoWaitFacade rcnwf = new RemoteCacheNoWaitFacade(
            (RemoteCacheNoWait[]) noWaits.toArray(new RemoteCacheNoWait[0]), rca, cacheMgr);

    getFacades().put(rca.getCacheName(), rcnwf);

    return rcnwf;
}

From source file:org.bibsonomy.rest.strategy.Context.java

private Strategy chooseStrategy(final HttpMethod httpMethod, final String url) {
    final StringTokenizer urlTokens = new StringTokenizer(url, "/");
    if (urlTokens.countTokens() > 0) {
        final String nextElement = (String) urlTokens.nextElement();
        final ContextHandler contextHandler = Context.urlHandlers.get(nextElement);
        if (contextHandler != null) {
            return contextHandler.createStrategy(this, urlTokens, httpMethod);
        }//from   ww w  . j a va 2  s  .c o m
    }
    return null;
}

From source file:org.apache.jcs.auxiliary.lateral.socket.tcp.LateralTCPCacheFactory.java

public AuxiliaryCache createCache(AuxiliaryCacheAttributes iaca, ICompositeCacheManager cacheMgr) {
    ITCPLateralCacheAttributes lac = (ITCPLateralCacheAttributes) iaca;
    ArrayList noWaits = new ArrayList();

    // pars up the tcp servers and set the tcpServer value and
    // get the manager and then get the cache
    // no servers are required.
    if (lac.getTcpServers() != null) {
        StringTokenizer it = new StringTokenizer(lac.getTcpServers(), ",");
        if (log.isDebugEnabled()) {
            log.debug("Configured for [" + it.countTokens() + "]  servers.");
        }//w ww  .  j a  va 2s  .com
        while (it.hasMoreElements()) {
            String server = (String) it.nextElement();
            if (log.isDebugEnabled()) {
                log.debug("tcp server = " + server);
            }
            ITCPLateralCacheAttributes lacC = (ITCPLateralCacheAttributes) lac.copy();
            lacC.setTcpServer(server);
            LateralTCPCacheManager lcm = LateralTCPCacheManager.getInstance(lacC, cacheMgr);
            ICache ic = lcm.getCache(lacC.getCacheName());
            if (ic != null) {
                noWaits.add(ic);
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("noWait is null, no lateral connection made");
                }
            }
        }
    }

    createListener((ILateralCacheAttributes) iaca, cacheMgr);

    // create the no wait facade.
    LateralCacheNoWaitFacade lcnwf = new LateralCacheNoWaitFacade(
            (LateralCacheNoWait[]) noWaits.toArray(new LateralCacheNoWait[0]), (ILateralCacheAttributes) iaca);

    // create udp discovery if available.
    createDiscoveryService(lac, lcnwf, cacheMgr);

    return lcnwf;
}

From source file:com.telefonica.euro_iaas.sdc.rest.validation.ProductInstanceResourceValidatorImpl.java

private void validateAttributesType(List<Attribute> attributes) throws InvalidProductException {
    String msg = "Attribute type is incorrect.";
    for (Attribute att : attributes) {
        if (att.getType() == null) {
            att.setType("Plain");
        }//from  ww w . ja  va2  s  .c om

        String availableTypes = systemPropertiesProvider
                .getProperty(SystemPropertiesProvider.AVAILABLE_ATTRIBUTE_TYPES);

        StringTokenizer st2 = new StringTokenizer(availableTypes, "|");
        boolean error = true;
        while (st2.hasMoreElements()) {
            if (att.getType().equals(st2.nextElement())) {
                error = false;
                break;
            }
        }
        if (error) {
            throw new InvalidProductException(msg);
        }
    }
}