Fork me on GitHub

CPD Results

The following document contains the results of PMD's CPD 6.13.0.

Duplications

File Line
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 337
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 493
            responseWebService = ( (AdresseServicePortType) portType ).searchAddress( getDefaultCity( ), labeladresse, null, getDateSearch( ) );

            // check null result and then return null list
            if ( responseWebService == null )
            {
                return null;
            }
        }
        catch( ServiceException e )
        {
            AppLogService.error( e.getMessage( ), e );
        }

        // traitement du flux xml
        Adresses adresses = null;

        JAXBContext jc;

        try
        {
            jc = JAXBContext.newInstance( JAXB_CONTEXT_WS_SEARCH_ADDRESS );

            Unmarshaller u = jc.createUnmarshaller( );
            StringBuffer xmlStr = new StringBuffer( responseWebService );
            adresses = (Adresses) u.unmarshal( new StreamSource( new StringReader( xmlStr.toString( ) ) ) );
        }
        catch( JAXBException e )
        {
            AppLogService.error( e.getMessage( ), e );
        }

        List<fr.paris.lutece.plugins.address.business.jaxb.wsSearchAdresse.Adresse> listAdresses = adresses.getAdresse( );

        ReferenceList refList = null;

        // Added for filter the double adresse
        Set<AdresseElement> eltSet = null;

        // build the list choice
        if ( ( listAdresses != null ) && !listAdresses.isEmpty( ) )
        {
            refList = new ReferenceList( );

            // Added for filter the double adresse
            eltSet = new HashSet<AdresseElement>( );

            for ( fr.paris.lutece.plugins.address.business.jaxb.wsSearchAdresse.Adresse currentAdresse : listAdresses )
            {
                String suffixe = "";

                if ( currentAdresse.getSuffixe( ) != null )
                {
                    suffixe = currentAdresse.getSuffixe( );
                }

                String strCurrentAdresse = "";

                if ( currentAdresse.getTypeVoie( ) == null )
                {
                    strCurrentAdresse = currentAdresse.getNumero( ) + " " + suffixe + " " + currentAdresse.getNomVoie( ) + " " + currentAdresse.getCommune( );
                }
                else
                    if ( LibraryAddressUtils.isTerminateByApostrophe( currentAdresse.getTypeVoie( ) ) )
                    {
                        strCurrentAdresse = currentAdresse.getNumero( ) + " " + suffixe + " " + currentAdresse.getTypeVoie( ) + currentAdresse.getNomVoie( )
                                + " " + currentAdresse.getCommune( );
                    }
                    else
                    {
                        strCurrentAdresse = currentAdresse.getNumero( ) + " " + suffixe + " " + currentAdresse.getTypeVoie( ) + " "
                                + currentAdresse.getNomVoie( ) + " " + currentAdresse.getCommune( );
                    }

                String strIdAdresse = currentAdresse.getIdentifiant( ).toString( );
File Line
fr/paris/lutece/plugins/address/service/DummyAddressService.java 89
fr/paris/lutece/plugins/address/service/DummyAddressService.java 169
    public ReferenceList searchAddress( HttpServletRequest request, String labeladresse )
    {
        String strFluxAddress = null;

        String strFilePath = AppPathService.getPath( PROPERTY_XML_PATH_DIRECTORY );
        String strFileName = AppPropertiesService.getProperty( PROPERTY_XML_FILE_SEARCH_ADDRESS );

        byte [ ] out = new byte [ 128];

        try
        {
            out = read( strFilePath + strFileName );
        }
        catch( Exception e )
        {
            AppLogService.error( e.getMessage( ), e );
        }

        strFluxAddress = new String( out );

        // traitement du flux xml
        Adresses adresses = null;

        JAXBContext jc;

        try
        {
            jc = JAXBContext.newInstance( JAXB_CONTEXT_WS_SEARCH_ADDRESS );

            Unmarshaller u = jc.createUnmarshaller( );
            StringBuffer xmlStr = new StringBuffer( strFluxAddress );
            adresses = (Adresses) u.unmarshal( new StreamSource( new StringReader( xmlStr.toString( ) ) ) );
        }
        catch( JAXBException e )
        {
            AppLogService.error( e.getMessage( ), e );
        }

        List<fr.paris.lutece.plugins.address.business.jaxb.wsSearchAdresse.Adresse> listAdresses = adresses.getAdresse( );

        ReferenceList refList = null;

        // build the list choice
        if ( ( listAdresses != null ) && !listAdresses.isEmpty( ) )
        {
            refList = new ReferenceList( );

            for ( fr.paris.lutece.plugins.address.business.jaxb.wsSearchAdresse.Adresse currentAdresse : listAdresses )
            {
                String suffixe = "";

                if ( currentAdresse.getSuffixe( ) != null )
                {
                    suffixe = currentAdresse.getSuffixe( );
                }

                String strCurrentAdresse = currentAdresse.getNumero( ) + " " + suffixe + " " + currentAdresse.getTypeVoie( ) + " "
                        + currentAdresse.getNomVoie( ) + " " + currentAdresse.getCommune( );

                String strIdAdresse = currentAdresse.getIdentifiant( ).toString( );

                refList.addItem( strIdAdresse, strCurrentAdresse );
            }

            _listAdresses = adresses;
        }

        return refList;
    }

    /**
     * @param request
     *            Request
     * @param labeladresse
     *            the label adress
     * @param strArrondissement
     *            Arrondissement
     * @return the XML flux of all adress corresponding
     *
     */
    public ReferenceList searchAddress( HttpServletRequest request, String labeladresse, String strArrondissement )
File Line
fr/paris/lutece/plugins/address/service/DummyAddressService.java 251
fr/paris/lutece/plugins/address/service/DummyAddressService.java 332
    public Adresse getGeolocalisation( HttpServletRequest request, long id, String strAddress, String strDate, boolean bIsTest )
    {
        String strFluxAddress = null;

        String strFilePath = AppPathService.getPath( PROPERTY_XML_PATH_DIRECTORY );
        String strFileName = AppPropertiesService.getProperty( PROPERTY_XML_FILE_ADDRESS_INFO );

        byte [ ] out = new byte [ 128];

        try
        {
            out = read( strFilePath + strFileName );
        }
        catch( Exception e )
        {
            AppLogService.error( e.getMessage( ), e );
        }

        strFluxAddress = new String( out );

        // traitement du flux xml
        fr.paris.lutece.plugins.address.business.jaxb.wsFicheAdresse.Adresse adresse = null;

        JAXBContext jc;

        try
        {
            jc = JAXBContext.newInstance( JAXB_CONTEXT_WS_FICHE_ADDRESS );

            Unmarshaller u = jc.createUnmarshaller( );
            StringBuffer xmlStr = new StringBuffer( strFluxAddress );
            adresse = (fr.paris.lutece.plugins.address.business.jaxb.wsFicheAdresse.Adresse) u
                    .unmarshal( new StreamSource( new StringReader( xmlStr.toString( ) ) ) );
        }
        catch( JAXBException e )
        {
            AppLogService.error( e.getMessage( ), e );
        }

        Adresse adresseReturn = new Adresse( );

        adresseReturn.setIadresse( adresse.getIdentifiant( ) );
        adresseReturn.setDunumero( adresse.getNumero( ) );
        adresseReturn.setDubis( adresse.getSuffixe1( ) );
        adresseReturn.setCodeCommune( adresse.getCodeInsee( ).toString( ) );
File Line
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 303
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 459
    public ReferenceList searchAddress( HttpServletRequest request, String labeladresse ) throws RemoteException
    {
        String responseWebService = null;
        AdresseService adresseService = new AdresseServiceLocator( );

        try
        {
            URL urlWS = null;

            Stub portType = null;

            if ( ( getUrlWS( ) == null ) || getUrlWS( ).equals( "" ) )
            {
                portType = (Stub) adresseService.getAdresseServiceHttpPort( );
            }
            else
            {
                try
                {
                    urlWS = new URL( getUrlWS( ) );
                }
                catch( MalformedURLException e )
                {
                    AppLogService.error( e.getMessage( ), e );
                }

                portType = (Stub) adresseService.getAdresseServiceHttpPort( urlWS );
            }

            portType.setUsername( getUserName( ) );
            portType.setPassword( getPassword( ) );

            setTimeout( portType );

            responseWebService = ( (AdresseServicePortType) portType ).searchAddress( getDefaultCity( ), labeladresse, null, getDateSearch( ) );
File Line
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 135
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 197
    public Adresse getGeolocalisation( HttpServletRequest request, long id, String addresse, String date, boolean bIsTest ) throws RemoteException
    {
        String responseWebService = null;
        AdresseService adresseService = new AdresseServiceLocator( );

        try
        {
            URL urlWS = null;

            Stub portType = null;

            if ( ( getUrlWS( ) == null ) || getUrlWS( ).equals( "" ) )
            {
                portType = (Stub) adresseService.getAdresseServiceHttpPort( );
            }
            else
            {
                try
                {
                    urlWS = new URL( getUrlWS( ) );
                }
                catch( MalformedURLException e )
                {
                    AppLogService.error( e.getMessage( ), e );
                }

                portType = (Stub) adresseService.getAdresseServiceHttpPort( urlWS );
            }

            portType.setUsername( getUserName( ) );
            portType.setPassword( getPassword( ) );

            setTimeout( portType );

            responseWebService = ( (AdresseServicePortType) portType ).geolocalization( getDefaultCity( ), addresse, String.valueOf( id ), date );
File Line
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 135
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 197
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 303
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 459
    public Adresse getGeolocalisation( HttpServletRequest request, long id, String addresse, String date, boolean bIsTest ) throws RemoteException
    {
        String responseWebService = null;
        AdresseService adresseService = new AdresseServiceLocator( );

        try
        {
            URL urlWS = null;

            Stub portType = null;

            if ( ( getUrlWS( ) == null ) || getUrlWS( ).equals( "" ) )
            {
                portType = (Stub) adresseService.getAdresseServiceHttpPort( );
            }
            else
            {
                try
                {
                    urlWS = new URL( getUrlWS( ) );
                }
                catch( MalformedURLException e )
                {
                    AppLogService.error( e.getMessage( ), e );
                }

                portType = (Stub) adresseService.getAdresseServiceHttpPort( urlWS );
            }

            portType.setUsername( getUserName( ) );
            portType.setPassword( getPassword( ) );

            setTimeout( portType );

            responseWebService = ( (AdresseServicePortType) portType ).geolocalization( getDefaultCity( ), addresse, String.valueOf( id ), date );
File Line
fr/paris/lutece/plugins/address/service/DummyAddressService.java 415
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 601
    }

    /**
     *
     * @return the date for parameter methodes of web service
     */
    public String getDateSearch( )
    {
        return _strDateSearch;
    }

    /**
     *
     * @param strDateSearch
     *            the new date search
     */
    public void setDateSearch( String strDateSearch )
    {
        _strDateSearch = strDateSearch;
    }

    /**
     *
     * @return the default city for parameter methodes of web service
     */
    public String getDefaultCity( )
    {
        return _strDefaultCity;
    }

    /**
     *
     * @param strDefaultCity
     *            the new default city
     */
    public void setDefaultCity( String strDefaultCity )
    {
        _strDefaultCity = strDefaultCity;
    }

    /**
     *
     * @return the url of the web service
     */
    public String getUrlWS( )
    {
        return _strUrlWS;
    }

    /**
     *
     * @param strUrlWS
     *            the new web service url
     */
    public void setUrlWS( String strUrlWS )
    {
        _strUrlWS = strUrlWS;
    }

    /**
     *
     * @return the password
     */
    public String getPassword( )
    {
        return _strPassword;
    }

    /**
     *
     * @param password
     *            the password
     */
    public void setPassword( String password )
    {
        _strPassword = password;
    }

    /**
     *
     * @return the user name
     */
    public String getUserName( )
    {
        return _strUserName;
    }

    /**
     *
     * @param userName
     *            the user name
     */
    public void setUserName( String userName )
    {
        _strUserName = userName;
    }

    /**
     *
     * @return the timeout
     */
    public String getTimeOut( )
    {
        return _strTimeOut;
    }

    /**
     *
     * @param timeOut
     *            the timeout
     */
    public void setTimeOut( String timeOut )
    {
        _strTimeOut = timeOut;
    }
File Line
fr/paris/lutece/plugins/address/service/DummyAddressService.java 281
fr/paris/lutece/plugins/address/service/DummyAddressService.java 362
fr/paris/lutece/plugins/address/service/WebServiceAddressService.java 248
            StringBuffer xmlStr = new StringBuffer( strFluxAddress );
            adresse = (fr.paris.lutece.plugins.address.business.jaxb.wsFicheAdresse.Adresse) u
                    .unmarshal( new StreamSource( new StringReader( xmlStr.toString( ) ) ) );
        }
        catch( JAXBException e )
        {
            AppLogService.error( e.getMessage( ), e );
        }

        Adresse adresseReturn = new Adresse( );

        adresseReturn.setIadresse( adresse.getIdentifiant( ) );
        adresseReturn.setDunumero( adresse.getNumero( ) );
        adresseReturn.setDubis( adresse.getSuffixe1( ) );
        adresseReturn.setCodeCommune( adresse.getCodeInsee( ).toString( ) );
File Line
fr/paris/lutece/plugins/address/service/DummyAddressService.java 301
fr/paris/lutece/plugins/address/service/DummyAddressService.java 376
        adresseReturn.setGeoY( Float.parseFloat( responseWebService.substring( responseWebService.lastIndexOf( " " ), responseWebService.length( ) ) ) );

        if ( !bIsTest )
        {
            List<fr.paris.lutece.plugins.address.business.jaxb.wsSearchAdresse.Adresse> listAddress = _listAdresses.getAdresse( );

            for ( fr.paris.lutece.plugins.address.business.jaxb.wsSearchAdresse.Adresse currentAdresse : listAddress )
            {
                if ( String.valueOf( currentAdresse.getIdentifiant( ) ).equals( String.valueOf( id ) ) )
                {
                    adresseReturn.setTypeVoie( currentAdresse.getTypeVoie( ) );
                    adresseReturn.setLibelleVoie( currentAdresse.getNomVoie( ) );

                    break;
                }
            }
        }

        return adresseReturn;
    }