Examples of ConnectionIOException


Examples of com.subgraph.orchid.ConnectionIOException

    return new InetSocketAddress(address, router.getOnionPort());
  }

  public void sendCell(Cell cell) throws ConnectionIOException  {
    if(!socket.isConnected()) {
      throw new ConnectionIOException("Cannot send cell because connection is not connected");
    }
    updateLastActivity();
    synchronized(output) {
      try {
        output.write(cell.getCellBytes());
      } catch (IOException e) {
        logger.fine("IOException writing cell to connection "+ e.getMessage());
        closeSocket();
        throw new ConnectionIOException(e.getClass().getName() + " : "+ e.getMessage());
      }
    }
  }
View Full Code Here

Examples of com.subgraph.orchid.ConnectionIOException

  private Cell recvCell() throws ConnectionIOException {
    try {
      return CellImpl.readFromInputStream(input);
    } catch(EOFException e) {
      closeSocket();
      throw new ConnectionIOException();
    } catch (IOException e) {
      if(!isClosed) {
        logger.fine("IOException reading cell from connection "+ this + " : "+ e.getMessage());
        closeSocket();
      }
      throw new ConnectionIOException(e.getClass().getName() + " " + e.getMessage());
    }
  }
View Full Code Here

Examples of com.subgraph.orchid.ConnectionIOException

  Cell readConnectionControlCell() throws ConnectionIOException {
    try {
      return connectionControlCells.take();
    } catch (InterruptedException e) {
      closeSocket();
      throw new ConnectionIOException();
    }
  }
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.ConnectionIOException

        {
            document = saxReader.read( stream );
        }
        catch ( DocumentException e )
        {
            throw new ConnectionIOException( e.getMessage() );
        }

        Element rootElement = document.getRootElement();
        if ( !rootElement.getName().equals( BROWSER_CONNECTIONS_TAG ) )
        {
            throw new ConnectionIOException( "The file does not seem to be a valid BrowserConnections file." );
        }

        for ( Iterator<?> i = rootElement.elementIterator( BROWSER_CONNECTION_TAG ); i.hasNext(); )
        {
            Element browserConnectionElement = ( Element ) i.next();
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.ConnectionIOException

            {
                searchParameter.setSearchBase( new LdapDN( searchBaseAttribute.getValue() ) );
            }
            catch ( InvalidNameException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Search Base' of search '"
                    + searchParameter.getName() + "' :" + searchBaseAttribute.getValue() );
            }
        }

        // Filter
        Attribute filterAttribute = searchParameterElement.attribute( FILTER_TAG );
        if ( filterAttribute != null )
        {
            searchParameter.setFilter( filterAttribute.getValue() );
        }

        // Returning Attributes
        Element returningAttributesElement = searchParameterElement.element( RETURNING_ATTRIBUTES_TAG );
        if ( returningAttributesElement != null )
        {
            List<String> returningAttributes = new ArrayList<String>();
            for ( Iterator<?> i = returningAttributesElement.elementIterator( RETURNING_ATTRIBUTE_TAG ); i.hasNext(); )
            {
                Element returningAttributeElement = ( Element ) i.next();

                Attribute valueAttribute = returningAttributeElement.attribute( VALUE_TAG );
                if ( valueAttribute != null )
                {
                    returningAttributes.add( valueAttribute.getValue() );
                }
            }
            searchParameter.setReturningAttributes( returningAttributes
                .toArray( new String[returningAttributes.size()] ) );
        }

        // Scope
        Attribute scopeAttribute = searchParameterElement.attribute( SCOPE_TAG );
        if ( scopeAttribute != null )
        {
            try
            {
                searchParameter.setScope( SearchScope.valueOf( scopeAttribute.getValue() ) );
            }
            catch ( IllegalArgumentException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Scope' of search '" + searchParameter.getName()
                    + "' as int value. Scope value :" + scopeAttribute.getValue() );
            }
        }

        // Time limit
        Attribute timeLimitAttribute = searchParameterElement.attribute( TIME_LIMIT_TAG );
        if ( timeLimitAttribute != null )
        {
            try
            {
                searchParameter.setTimeLimit( Integer.parseInt( timeLimitAttribute.getValue() ) );
            }
            catch ( NumberFormatException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Time limit' of search '" + searchParameter.getName()
                    + "' as int value. Time limit value :" + timeLimitAttribute.getValue() );
            }
        }

        // Count limit
        Attribute countLimitAttribute = searchParameterElement.attribute( COUNT_LIMIT_TAG );
        if ( countLimitAttribute != null )
        {
            try
            {
                searchParameter.setCountLimit( Integer.parseInt( countLimitAttribute.getValue() ) );
            }
            catch ( NumberFormatException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Count limit' of search '"
                    + searchParameter.getName() + "' as int value. Count limit value :"
                    + countLimitAttribute.getValue() );
            }
        }

        // Alias dereferencing method
        Attribute aliasesDereferencingMethodAttribute = searchParameterElement
            .attribute( ALIASES_DEREFERENCING_METHOD_TAG );
        if ( aliasesDereferencingMethodAttribute != null )
        {
            try
            {
                searchParameter.setAliasesDereferencingMethod( Connection.AliasDereferencingMethod
                    .valueOf( aliasesDereferencingMethodAttribute.getValue() ) );
            }
            catch ( IllegalArgumentException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Aliases Dereferencing Method' of search '"
                    + searchParameter.getName() + "' as int value. Aliases Dereferencing Method value :"
                    + aliasesDereferencingMethodAttribute.getValue() );
            }
        }

        // Referrals handling method
        Attribute referralsHandlingMethodAttribute = searchParameterElement.attribute( REFERRALS_HANDLING_METHOD_TAG );
        if ( referralsHandlingMethodAttribute != null )
        {
            try
            {
                searchParameter.setReferralsHandlingMethod( Connection.ReferralHandlingMethod
                    .valueOf( referralsHandlingMethodAttribute.getValue() ) );
            }
            catch ( IllegalArgumentException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Referrals Handling Method' of search '"
                    + searchParameter.getName() + "' as int value. Referrals Handling Method value :"
                    + referralsHandlingMethodAttribute.getValue() );
            }
        }

        // Controls
        Element controlsElement = searchParameterElement.element( CONTROLS_TAG );
        if ( controlsElement != null )
        {
            for ( Iterator<?> i = controlsElement.elementIterator( CONTROL_TAG ); i.hasNext(); )
            {
                Element controlElement = ( Element ) i.next();

                Attribute valueAttribute = controlElement.attribute( VALUE_TAG );
                if ( valueAttribute != null )
                {
                    byte[] bytes = Base64.decode( valueAttribute.getValue().toCharArray() );
                    ByteArrayInputStream bais = null;
                    ObjectInputStream ois = null;
                    try
                    {
                        bais = new ByteArrayInputStream( bytes );
                        ois = new ObjectInputStream( bais );
                        StudioControl control = ( StudioControl ) ois.readObject();
                        searchParameter.getControls().add( control );
                        ois.close();
                    }
                    catch ( Exception e )
                    {
                        throw new ConnectionIOException( "Unable to parse 'Control' of search '"
                            + searchParameter.getName() + "'. Control value :" + valueAttribute.getValue() );
                    }
                }
            }
        }
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.ConnectionIOException

            {
                bookmarkParameter.setDn( new LdapDN( dnAttribute.getValue() ) );
            }
            catch ( InvalidNameException e )
            {
                throw new ConnectionIOException( "Unable to parse 'DN' of bookmark '" + bookmarkParameter.getName()
                    + "' :" + dnAttribute.getValue() );
            }
        }

        return bookmarkParameter;
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.ConnectionIOException

        {
            document = saxReader.read( stream );
        }
        catch ( DocumentException e )
        {
            throw new ConnectionIOException( e.getMessage() );
        }

        Element rootElement = document.getRootElement();
        if ( !rootElement.getName().equals( BROWSER_CONNECTIONS_TAG ) )
        {
            throw new ConnectionIOException( "The file does not seem to be a valid BrowserConnections file." );
        }

        for ( Iterator<?> i = rootElement.elementIterator( BROWSER_CONNECTION_TAG ); i.hasNext(); )
        {
            Element browserConnectionElement = ( Element ) i.next();
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.ConnectionIOException

            {
                searchParameter.setSearchBase( new LdapDN( searchBaseAttribute.getValue() ) );
            }
            catch ( InvalidNameException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Search Base' of search '" + searchParameter.getName()
                    + "' :" + searchBaseAttribute.getValue() );
            }
        }
       
        // Filter
        Attribute filterAttribute = searchParameterElement.attribute( FILTER_TAG );
        if ( filterAttribute != null )
        {
            searchParameter.setFilter( filterAttribute.getValue() );
        }
       
        // Returning Attributes
        Element returningAttributesElement = searchParameterElement.element( RETURNING_ATTRIBUTES_TAG );
        if ( returningAttributesElement != null )
        {
            List<String> returningAttributes = new ArrayList<String>();
            for ( Iterator<?> i = returningAttributesElement.elementIterator( RETURNING_ATTRIBUTE_TAG ); i.hasNext(); )
            {
                Element returningAttributeElement = ( Element ) i.next();
               
                Attribute valueAttribute = returningAttributeElement.attribute( VALUE_TAG );
                if ( valueAttribute != null )
                {
                    returningAttributes.add( valueAttribute.getValue() );
                }
            }
            searchParameter.setReturningAttributes( returningAttributes
                .toArray( new String[returningAttributes.size()] ) );
        }
       
        // Scope
        Attribute scopeAttribute = searchParameterElement.attribute( SCOPE_TAG );
        if ( scopeAttribute != null )
        {
            try
            {
                searchParameter.setScope( SearchScope.valueOf( scopeAttribute.getValue() ) );
            }
            catch ( IllegalArgumentException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Scope' of search '"
                    + searchParameter.getName() + "' as int value. Scope value :"
                    + scopeAttribute.getValue() );
            }
        }
       
        // Time limit
        Attribute timeLimitAttribute = searchParameterElement.attribute( TIME_LIMIT_TAG );
        if ( timeLimitAttribute != null )
        {
            try
            {
                searchParameter.setTimeLimit( Integer.parseInt( timeLimitAttribute.getValue() ) );
            }
            catch ( NumberFormatException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Time limit' of search '" + searchParameter.getName()
                    + "' as int value. Time limit value :" + timeLimitAttribute.getValue() );
            }
        }
       
        // Count limit
        Attribute countLimitAttribute = searchParameterElement.attribute( COUNT_LIMIT_TAG );
        if ( countLimitAttribute != null )
        {
            try
            {
                searchParameter.setCountLimit( Integer.parseInt( countLimitAttribute.getValue() ) );
            }
            catch ( NumberFormatException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Count limit' of search '" + searchParameter.getName()
                    + "' as int value. Count limit value :" + countLimitAttribute.getValue() );
            }
        }
       
        // Alias dereferencing method
        Attribute aliasesDereferencingMethodAttribute = searchParameterElement.attribute( ALIASES_DEREFERENCING_METHOD_TAG );
        if ( aliasesDereferencingMethodAttribute != null )
        {
            try
            {
                searchParameter.setAliasesDereferencingMethod( Connection.AliasDereferencingMethod
                    .valueOf( aliasesDereferencingMethodAttribute.getValue() ) );
            }
            catch ( IllegalArgumentException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Aliases Dereferencing Method' of search '"
                    + searchParameter.getName() + "' as int value. Aliases Dereferencing Method value :"
                    + aliasesDereferencingMethodAttribute.getValue() );
            }
        }
       
        // Referrals handling method
        Attribute referralsHandlingMethodAttribute = searchParameterElement.attribute( REFERRALS_HANDLING_METHOD_TAG );
        if ( referralsHandlingMethodAttribute != null )
        {
            try
            {
                searchParameter.setReferralsHandlingMethod( Connection.ReferralHandlingMethod
                    .valueOf( referralsHandlingMethodAttribute.getValue() ) );
            }
            catch ( IllegalArgumentException e )
            {
                throw new ConnectionIOException( "Unable to parse 'Referrals Handling Method' of search '"
                    + searchParameter.getName() + "' as int value. Referrals Handling Method value :"
                    + referralsHandlingMethodAttribute.getValue() );
            }
        }
   
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.ConnectionIOException

            {
                bookmarkParameter.setDn( new LdapDN( dnAttribute.getValue() ) );
            }
            catch ( InvalidNameException e )
            {
                throw new ConnectionIOException( "Unable to parse 'DN' of bookmark '" + bookmarkParameter.getName()
                    + "' :" + dnAttribute.getValue() );
            }
        }
   
        return bookmarkParameter;
View Full Code Here

Examples of org.apache.directory.studio.connection.core.io.ConnectionIOException

        {
            document = saxReader.read( stream );
        }
        catch ( DocumentException e )
        {
            throw new ConnectionIOException( e.getMessage() );
        }

        Element rootElement = document.getRootElement();
        if ( !rootElement.getName().equals( BROWSER_CONNECTIONS_TAG ) )
        {
            throw new ConnectionIOException( "The file does not seem to be a valid BrowserConnections file." );
        }

        for ( Iterator<?> i = rootElement.elementIterator( BROWSER_CONNECTION_TAG ); i.hasNext(); )
        {
            Element browserConnectionElement = ( Element ) i.next();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.