Enumeration keys = context.keys(); while (keys.hasMoreElements()) { Object key = (Object) keys.nextElement(); Object value = context.get(key); String stringVal = value.toString();  final String localPart = key.toString(); fault.addFaultDetail(new QName( Constants.SMARTFROG_NAMESPACE, localPart) , value.toString());
if(context!=null) { Enumeration keys = context.keys(); while (keys.hasMoreElements()) { Object key = (Object) keys.nextElement(); Object value = context.get(key); String stringVal = value.toString();  final String localPart = key.toString(); fault.addFaultDetail(new QName( Constants.SMARTFROG_NAMESPACE, localPart) , value.toString()); }
    public static BaseException translateSmartFrogException(SmartFrogException exception) {        BaseException fault = BaseException.makeFault(exception);        QName faultCode = Constants.FAULT_NESTED_EXCEPTION;        //compilation and subclasses        if (exception instanceof SmartFrogCompilationException) {            faultCode = Constants.FAULT_DESCRIPTOR_PARSE_ERROR;            SmartFrogCompilationException ex = (SmartFrogCompilationException) exception;        }        if (exception instanceof SmartFrogParseException) {            faultCode = Constants.FAULT_DESCRIPTOR_PARSE_ERROR;        }        if (exception instanceof SmartFrogCompileResolutionException) {            faultCode = Constants.FAULT_COMPILE_RESOLUTION_FAILURE;        }        //init failure        if (exception instanceof SmartFrogInitException) {            faultCode = Constants.FAULT_INITIALIZATION_FAILURE;        }        //runtime faults        if (exception instanceof SmartFrogRuntimeException) {            faultCode = Constants.FAULT_RUNTIME_EXCEPTION;        }        if (exception instanceof SmartFrogResolutionException) {            faultCode = Constants.FAULT_RESOLUTION_FAILURE;        }        if (exception instanceof SmartFrogLivenessException) {            faultCode = Constants.FAULT_LIVENESS_EXCEPTION;        }        if (exception instanceof SmartFrogDeploymentException) {            faultCode = Constants.FAULT_DEPLOYMENT_FAILURE;        }        //TODO: add the other runtime faults        //copy all context keys        Context context = exception.getContext();        Enumeration keys = context.keys();        while (keys.hasMoreElements()) {            Object key = (Object) keys.nextElement();            Object value = context.get(key);            String stringVal = value.toString();            //TODO: escape local parts that are not valid.            final String localPart = key.toString();            fault.addFaultDetail(new QName(                    Constants.SMARTFROG_NAMESPACE,                    localPart)                    , value.toString());        }        fault.setFaultCode(faultCode);        return fault;    }