Esempio n. 1
0
 virtual void exception_CasB(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const C& ex)
     {
         test(ex.aMem == 1);
         test(ex.bMem == 2);
         test(ex.cMem == 3);
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 2
0
 void
 exception_unknownDerivedAsBase(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Base& b)
     {
         test(b.b == "UnknownDerived.b");
         test(b.ice_id() == "::Test::Base");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 3
0
 void
 exception_baseAsBase(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Base& b)
     {
         test(b.b == "Base.b");
         test(b.ice_id() =="::Test::Base");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 4
0
 void
 exception_knownDerivedAsKnownDerived(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownDerived& k)
     {
         test(k.b == "KnownDerived.b");
         test(k.kd == "KnownDerived.kd");
         test(k.ice_id() == "::Test::KnownDerived");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 5
0
 void
 exception_knownIntermediateAsBase(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownIntermediate& ki)
     {
         test(ki.b == "KnownIntermediate.b");
         test(ki.ki == "KnownIntermediate.ki");
         test(ki.ice_id() == "::Test::KnownIntermediate");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 6
0
 void
 exception_unknownMostDerived1AsKnownIntermediate(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownIntermediate& ki)
     {
         test(ki.b == "UnknownMostDerived1.b");
         test(ki.ki == "UnknownMostDerived1.ki");
         test(ki.ice_id() == "::Test::KnownIntermediate");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 7
0
 void exceptAbortI(const Ice::Exception& ex)
 {
     try
     {
         ex.ice_throw();
     }
     catch(const Ice::ConnectionLostException&)
     {
     }
     catch(const Ice::ConnectFailedException&)
     {
     }
     catch(const Ice::Exception& ex)
     {
         cout << ex << endl;
         test(false);
     }
     called();
 }
Esempio n. 8
0
void
ProxyOutgoingAsyncBase::abort(const Ice::Exception& ex)
{
    assert(!_childObserver);

    if(finished(ex))
    {
        invokeCompletedAsync();
    }
    else if(dynamic_cast<const Ice::CommunicatorDestroyedException*>(&ex))
    {
        //
        // If it's a communicator destroyed exception, don't swallow
        // it but instead notify the user thread. Even if no callback
        // was provided.
        //
        ex.ice_throw();
    }
}
Esempio n. 9
0
 void
 exception_knownMostDerivedAsKnownIntermediate(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const KnownMostDerived& kmd)
     {
         test(kmd.b == "KnownMostDerived.b");
         test(kmd.ki == "KnownMostDerived.ki");
         test(kmd.kmd == "KnownMostDerived.kmd");
         test(kmd.ice_id() == "::Test::KnownMostDerived");
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 10
0
 virtual void exception_AorDasAorD(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const A& ex)
     {
         test(ex.aMem == 1);
     }
     catch(const D& ex)
     {
         test(ex.dMem == -1);
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 11
0
File: AdminI.cpp Progetto: zmyer/ice
 void
 handleException(const Ice::Exception& ex) const
 {
     try
     {
         ex.ice_throw();
     }
     catch(const Ice::UserException&)
     {
         throw;
     }
     catch(const Ice::ObjectNotExistException&)
     {
         throw ServerNotExistException(_id);
     }
     catch(const Ice::LocalException& e)
     {
         ostringstream os;
         os << e;
         throw NodeUnreachableException(_node, os.str());
     }
 }
Esempio n. 12
0
 virtual void exception_ModA(const Ice::Exception& exc)
 {
     try
     {
         exc.ice_throw();
     }
     catch(const Mod::A& ex)
     {
         test(ex.aMem == 1);
         test(ex.a2Mem == 2);
     }
     catch(const Ice::OperationNotExistException&)
     {
         //
         // This operation is not supported in Java.
         //
     }
     catch(...)
     {
         test(false);
     }
     called();
 }
Esempio n. 13
0
void 
IceInternal::LocatorInfo::getEndpointsException(const ReferencePtr& ref, const Ice::Exception& exc)
{
    assert(ref->isIndirect());

    try
    {
        exc.ice_throw();
    }
    catch(const AdapterNotFoundException&)
    {
        if(ref->getInstance()->traceLevels()->location >= 1)
        {
            Trace out(ref->getInstance()->initializationData().logger,
                      ref->getInstance()->traceLevels()->locationCat);
            out << "adapter not found" << "\n";
            out << "adapter = " << ref->getAdapterId();
        }

        NotRegisteredException ex(__FILE__, __LINE__);
        ex.kindOfObject = "object adapter";
        ex.id = ref->getAdapterId();
        throw ex;
    }
    catch(const ObjectNotFoundException&)
    {
        if(ref->getInstance()->traceLevels()->location >= 1)
        {
            Trace out(ref->getInstance()->initializationData().logger,
                      ref->getInstance()->traceLevels()->locationCat);
            out << "object not found" << "\n";
            out << "object = " << ref->getInstance()->identityToString(ref->getIdentity());
        }

        NotRegisteredException ex(__FILE__, __LINE__);
        ex.kindOfObject = "object";
        ex.id = ref->getInstance()->identityToString(ref->getIdentity());
        throw ex;
    }
    catch(const NotRegisteredException&)
    {
        throw;
    }
    catch(const LocalException& ex)
    {
        if(ref->getInstance()->traceLevels()->location >= 1)
        {
            Trace out(ref->getInstance()->initializationData().logger, ref->getInstance()->traceLevels()->locationCat);
            out << "couldn't contact the locator to retrieve adapter endpoints\n";
            if(ref->getAdapterId().empty())
            {
                out << "object = " << ref->getInstance()->identityToString(ref->getIdentity()) << "\n";
            }
            else
            {
                out << "adapter = " << ref->getAdapterId() << "\n";
            }
            out << "reason = " << ex;
        }
        throw;
    }
}
void AMI_PeraWsAstICE_CreateWSByXpdlStream_I::ice_exception( const Ice::Exception& ex )
{
	SendIceMsg( ex.ice_name().c_str(), "createws" );
}
Esempio n. 15
0
void
IceInternal::IncomingBase::__handleException(const Ice::Exception& ex)
{
    try
    {
        ex.ice_throw();
    }
    catch(RequestFailedException& ex)
    {
        if(ex.id.name.empty())
        {
            ex.id = _current.id;
        }
        
        if(ex.facet.empty() && !_current.facet.empty())
        {
            ex.facet = _current.facet;
        }
        
        if(ex.operation.empty() && !_current.operation.empty())
        {
            ex.operation = _current.operation;
        }

        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 1)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            if(dynamic_cast<ObjectNotExistException*>(&ex))
            {
                _os.write(static_cast<Byte>(DispatchObjectNotExist));
            }
            else if(dynamic_cast<FacetNotExistException*>(&ex))
            {
                _os.write(static_cast<Byte>(DispatchFacetNotExist));
            }
            else if(dynamic_cast<OperationNotExistException*>(&ex))
            {
                _os.write(static_cast<Byte>(DispatchOperationNotExist));
            }
            else
            {
                assert(false);
            }

            ex.id.__write(&_os);

            //
            // For compatibility with the old FacetPath.
            //
            if(ex.facet.empty())
            {
                _os.write(static_cast<string*>(0), static_cast<string*>(0));
            }
            else
            {
                _os.write(&ex.facet, &ex.facet + 1);
            }

            _os.write(ex.operation, false);
            
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UnknownLocalException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownLocalException));
            _os.write(ex.unknown, false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UnknownUserException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownUserException));
            _os.write(ex.unknown, false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UnknownException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownException));
            _os.write(ex.unknown, false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const LocalException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownLocalException));
            ostringstream str;
            str << ex;
            _os.write(str.str(), false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const UserException& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownUserException));
            ostringstream str;
            str << ex;
            _os.write(str.str(), false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
    catch(const Exception& ex)
    {
        if(_os.instance()->initializationData().properties->getPropertyAsIntWithDefault("Ice.Warn.Dispatch", 1) > 0)
        {
            __warning(ex);
        }

        if(_response)
        {
            _os.endWriteEncaps();
            _os.b.resize(headerSize + 4); // Dispatch status position.
            _os.write(static_cast<Byte>(DispatchUnknownException));
            ostringstream str;
            str << ex;
            _os.write(str.str(), false);
            _connection->sendResponse(&_os, _compress);
        }
        else
        {
            _connection->sendNoResponse();
        }
    }
}
Esempio n. 16
0
	void IceExceptionCounter::increase(Ice::Exception& e) {
		LOG_INFO("[" << fileName_ << "]-IceExceptionCounter::increase with " << e.what());
		increase();	
	}
Esempio n. 17
0
void
ProxyFlushBatch::handleRetryException(const Ice::Exception& ex)
{
    _proxy->__setRequestHandler(_handler, 0); // Clear request handler
    ex.ice_throw(); // No retries, we want to notify the user of potentially lost batch requests
}
Esempio n. 18
0
 virtual void ice_exception(const Ice::Exception& ex)
 {
     fprintf(stderr, "sayHello AMI called failed:\n%s\n", ex.toString().c_str());
 }
Esempio n. 19
0
void
IcePHP::convertException(zval* zex, const Ice::Exception& ex)
{
    ZVAL_UNDEF(zex);

    ostringstream ostr;
    ostr << ex;
    string str = ostr.str();

    try
    {
        ex.ice_throw();
    }
    catch(const Ice::LocalException& e)
    {
        zend_class_entry* cls = idToClass(e.ice_id());
        if(cls)
        {
            if(object_init_ex(zex, cls) != SUCCESS)
            {
                runtimeError("unable to create exception %s", cls->name->val);
                return;
            }
            if(!convertLocalException(e, zex))
            {
                return;
            }
        }
        else
        {
            cls = idToClass("Ice::UnknownLocalException");
            assert(cls);
            if(object_init_ex(zex, cls) != SUCCESS)
            {
                runtimeError("unable to create exception %s", cls->name->val);
                return;
            }
            setStringMember(zex, "unknown", str);
        }
    }
    catch(const Ice::UserException&)
    {
        zend_class_entry* cls = idToClass("Ice::UnknownUserException");
        assert(cls);
        if(object_init_ex(zex, cls) != SUCCESS)
        {
            runtimeError("unable to create exception %s", cls->name->val);
            return;
        }
        setStringMember(zex, "unknown", str);
    }
    catch(const Ice::Exception&)
    {
        zend_class_entry* cls = idToClass("Ice::UnknownException");
        assert(cls);
        if(object_init_ex(zex, cls) != SUCCESS)
        {
            runtimeError("unable to create exception %s", cls->name->val);
            return;
        }
        setStringMember(zex, "unknown", str);
    }

    return;
}
void AMI_PeraWsAstICE_CreateCacheByWS_I::ice_exception( const Ice::Exception& ex )
{
	SendIceMsg( ex.ice_name().c_str(), "open" );
}
void AMI_PeraWsAstICE_CreateWSByCache_I::ice_exception( const Ice::Exception& ex )
{
	SendIceMsg( ex.ice_name().c_str(), "save" );
}
void AMI_PeraWsAstICE_CopyCache_I::ice_exception( const Ice::Exception& ex )
{
	SendIceMsg( ex.ice_name().c_str(), "resume" );
}
void AMI_PeraWsAstICE_DeleteCache_I::ice_exception( const Ice::Exception& ex )
{
	SendIceMsg( ex.ice_name().c_str(), "delete" );
}