src/main/java/org/jboss/loom/migrators/deploymentScanner/DeploymentScannerMigrator.java
private List<ValueType> checkDestinationPath(List<ValueType> valueList)
        throws LoadMigrationException {

        AS7Config as7Config = super.getGlobalConfig().getAS7Config();

        File f = new File(as7Config.getConfigFilePath());
        if( ! (f.exists() && f.canRead() ) )
            return valueList;
        
        try {
            DocumentBuilder docBuilder = XmlUtils.createXmlDocumentBuilder();
            Document doc = docBuilder.parse(f);

            XPath xpath = XPathFactory.newInstance().newXPath();
            String exp = "/server/profile/subsystem/deployment-scanner";
            NodeList nodeList = (NodeList) xpath.evaluate(exp, doc, XPathConstants.NODESET );

            int cnt = nodeList.getLength();
            for( int i =0; i < cnt; i++ ){
                Element node = (Element) nodeList.item(i);
                String tmpPath = node.getAttribute("path");

                List<ValueType> removeList = new LinkedList();
                for (ValueType v: valueList){
                    if (tmpPath.equals(v.getDeployPath()))
                        removeList.add(v);
                }

                // remove the duplicates
                for (ValueType v: removeList)
                    valueList.remove(v);
            }
        }
        catch ( SAXException | IOException | XPathExpressionException saxe) {
            throw new LoadMigrationException(saxe);
        }
        return valueList;
    }
/**
     * Check the destination subsystem entries for duplicate directory names.
     * Remove the dup ones from the create list.
     *
     * @param valueList
     * @return
     * @throws LoadMigrationException
     */
Check the destination subsystem entries for duplicate directory names.
Remove the dup ones from the create list.

@param valueList
@return
@throws LoadMigrationException
Check the destination subsystem entries for duplicate directory names . Remove the dup ones from the create list . @param valueList @return @throws LoadMigrationException
private List<ValueType> checkDestinationPath(List<ValueType> valueList)
        throws LoadMigrationException {
        AS7Config as7Config = super.getGlobalConfig().getAS7Config();
        File f = new File(as7Config.getConfigFilePath());
        if( ! (f.exists() && f.canRead() ) )
            return valueList;
        try {
            DocumentBuilder docBuilder = XmlUtils.createXmlDocumentBuilder();
            Document doc = docBuilder.parse(f);
            XPath xpath = XPathFactory.newInstance().newXPath();
            String exp = "/server/profile/subsystem/deployment-scanner";
            NodeList nodeList = (NodeList) xpath.evaluate(exp, doc, XPathConstants.NODESET );
            int cnt = nodeList.getLength();
            for( int i =0; i < cnt; i++ ){
                Element node = (Element) nodeList.item(i);
                String tmpPath = node.getAttribute("path");
                List<ValueType> removeList = new LinkedList();
                for (ValueType v: valueList){
                    if (tmpPath.equals(v.getDeployPath()))
                        removeList.add(v);
                }
                for (ValueType v: removeList)
                    valueList.remove(v);
            }
        }
        catch ( SAXException | IOException | XPathExpressionException saxe) {
            throw new LoadMigrationException(saxe);
        }
        return valueList;
    }
private List < ValueType > checkDestinationPath ( List < ValueType > valueList ) throws LoadMigrationException { AS7Config as7Config = super . getGlobalConfig ( ) . getAS7Config ( ) ; File f = new File ( as7Config . getConfigFilePath ( ) ) ; if ( ! ( f . exists ( ) && f . canRead ( ) ) ) return valueList ; try { DocumentBuilder docBuilder = XmlUtils . createXmlDocumentBuilder ( ) ; Document doc = docBuilder . parse ( f ) ; XPath xpath = XPathFactory . newInstance ( ) . newXPath ( ) ; String exp = "/server/profile/subsystem/deployment-scanner" ; NodeList nodeList = ( NodeList ) xpath . evaluate ( exp , doc , XPathConstants . NODESET ) ; int cnt = nodeList . getLength ( ) ; for ( int i = 0 ; i < cnt ; i ++ ) { Element node = ( Element ) nodeList . item ( i ) ; String tmpPath = node . getAttribute ( "path" ) ; List < ValueType > removeList = new LinkedList ( ) ; for ( ValueType v : valueList ) { if ( tmpPath . equals ( v . getDeployPath ( ) ) ) removeList . add ( v ) ; } for ( ValueType v : removeList ) valueList . remove ( v ) ; } } catch ( SAXException | IOException | XPathExpressionException saxe ) { throw new LoadMigrationException ( saxe ) ; } return valueList ; }
Check the destination subsystem entries for duplicate directory names.
Check the destination subsystem entries for duplicate directory names .
// remove the duplicates