Examples of Fault


Examples of org.apache.cxf.interceptor.Fault

        } catch (RuntimeException ex) {
            LOG.log(Level.FINE, ex.getMessage(), ex);
            throw ex;
        } catch (Exception ex) {
            LOG.log(Level.FINE, ex.getMessage(), ex);
            throw new Fault(ex);
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                         tokIncluded,
                         enc,
                         false);
        } catch (Exception e) {
            LOG.log(Level.FINE, e.getMessage(), e);
            throw new Fault(e);
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                handleOutBoundMessage(message, boi);
            } else {
                handleInBoundMessage(message, boi);
            }
        } catch (Exception ex) {
            throw new Fault(ex);
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                handleNotRequestMessage(message, destination);               
            } else {            
                handleRequestMessage(message, destination);
            }
        } catch (Exception ex) {
            throw new Fault(ex);
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                                                              service);
               
                CorbaStreamable exStreamable = new CorbaStreamable(handler, elName);
                exStreamable._read(except.create_input_stream());
                message.setStreamableException(exStreamable);
                message.setContent(Exception.class, new Fault(userEx));
            } else {
                message.setContent(Exception.class, new Fault(ex));
            }
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

        } catch (Exception ex) {
            if (ex instanceof javax.xml.bind.MarshalException) {
                javax.xml.bind.MarshalException marshalEx = (javax.xml.bind.MarshalException)ex;
                Message faultMessage = new Message("MARSHAL_ERROR", LOG, marshalEx.getLinkedException()
                    .getMessage());
                throw new Fault(faultMessage, ex);
            } else {
                throw new Fault(new Message("MARSHAL_ERROR", LOG, ex.getMessage()), ex);
            }
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                bridge.marshal(elValue, s1);
                ((OutputStream)source).write(sw.toString().getBytes());
            } else if (source instanceof Node) {
                bridge.marshal(elValue, (Node)source, am);
            } else {
                throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
            }
        } catch (Exception ex) {
            if (ex instanceof javax.xml.bind.MarshalException) {
                javax.xml.bind.MarshalException marshalEx = (javax.xml.bind.MarshalException)ex;
                Message faultMessage = new Message("MARSHAL_ERROR", LOG, marshalEx.getLinkedException()
                    .getMessage());
                throw new Fault(faultMessage, ex);
            } else {
                throw new Fault(new Message("MARSHAL_ERROR", LOG, ex.getMessage()), ex);
            }
        }

    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

            } else if (source instanceof InputStream) {
                return bridge.unmarshal((InputStream)source);
            } else if (source instanceof Node) {
                return bridge.unmarshal((Node)source, am);
            } else {
                throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
            }
        } catch (Exception ex) {
            if (ex instanceof javax.xml.bind.MarshalException) {
                javax.xml.bind.MarshalException marshalEx = (javax.xml.bind.MarshalException)ex;
                Message faultMessage = new Message("MARSHAL_ERROR", LOG, marshalEx.getLinkedException()
                    .getMessage());
                throw new Fault(faultMessage, ex);
            } else {
                throw new Fault(new Message("MARSHAL_ERROR", LOG, ex.getMessage()), ex);
            }
        }

    }   
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

            }

            writer.writeEndElement();
            writer.flush();
        } catch (Exception e) {
            throw new Fault(new Message("MARSHAL_ERROR", LOG, e.getMessage()), e);
        } finally {
            StaxUtils.close(writer);
        }
    }
View Full Code Here

Examples of org.apache.cxf.interceptor.Fault

                reader.nextTag();
            } catch (XMLStreamException e) {
                // ignore
            }
        } else {
            throw new Fault(new Message("UNKNOWN_SOURCE", LOG, source.getClass().getName()));
        }
        try {
            QName qn = part.getElementQName();
            if (!qn.equals(reader.getName())) {
                throw new Fault(new Message("ELEMENT_NAME_MISMATCH", LOG, qn, reader.getName()));
            }

            Class<?> cls = part.getTypeClass();
            Object obj = null;
            try {
                Constructor<?> cons = cls.getConstructor();
                obj = cons.newInstance();
            } catch (NoSuchMethodException nse) {
                Constructor<?> cons = cls.getConstructor(new Class[] {String.class});
                obj = cons.newInstance(new Object[1]);
            }

            XmlAccessType accessType = Utils.getXmlAccessType(cls);
            reader.nextTag();
            while (reader.getEventType() == XMLStreamReader.START_ELEMENT) {
                QName q = reader.getName();
                String fieldName = q.getLocalPart();
                Field f = Utils.getField(cls, accessType, fieldName);
                if (f != null) {
                    Type type = f.getGenericType();
                    ReflectionUtil.setAccessible(f);
                    if (JAXBSchemaInitializer.isArray(type)) {
                        Class<?> compType = JAXBSchemaInitializer.getArrayComponentType(type);
                        List<Object> ret = unmarshallArray(u, reader, q, compType, createList(type));
                        Object o = ret;
                        if (!isList(type)) {
                            if (compType.isPrimitive()) {
                                o = java.lang.reflect.Array.newInstance(compType, ret.size());
                                for (int x = 0; x < ret.size(); x++) {
                                    Array.set(o, x, ret.get(x));
                                }
                            } else {
                                o = ret.toArray((Object[]) Array.newInstance(compType, ret.size()));
                            }
                        }

                        f.set(obj, o);
                    } else {
                        Object o = getElementValue(u.unmarshal(reader, Utils.getFieldType(f)));
                        Utils.setFieldValue(f, obj, o);
                    }
                } else {
                    String s = Character.toUpperCase(q.getLocalPart().charAt(0))
                               + q.getLocalPart().substring(1);
                    Method m = Utils.getMethod(cls, accessType, "get" + s);
                    if (m == null) {
                        m = Utils.getMethod(cls, accessType, "is" + s);
                    }
                    Type type = m.getGenericReturnType();
                    Object o = null;
                    if (JAXBSchemaInitializer.isArray(type)) {
                        Class<?> compType = JAXBSchemaInitializer
                            .getArrayComponentType(type);
                        List<Object> ret = unmarshallArray(u, reader,
                                                           q,
                                                           compType,
                                                           createList(type));
                        o = ret;
                        if (!isList(type)) {
                            if (compType.isPrimitive()) {
                                o = java.lang.reflect.Array.newInstance(compType, ret.size());
                                for (int x = 0; x < ret.size(); x++) {
                                    Array.set(o, x, ret.get(x));
                                }
                            } else {
                                o = ret.toArray((Object[])Array.newInstance(compType, ret.size()));
                            }
                        }
                    } else {
                        o = getElementValue(u.unmarshal(reader, Utils.getMethodReturnType(m)));
                    }
                    Method m2 = Utils.getMethod(cls, accessType, "set" + s, m.getReturnType());
                    if (m2 != null) {
                        if (JAXBSchemaInitializer.isArray(type)) {
                            m2.invoke(obj, o);
                        } else {
                            Utils.setMethodValue(m, m2, obj, o);
                        }
                    } else {
                        Field fn = ReflectionUtil.getDeclaredField(cls, q.getLocalPart());
                        if (fn != null) {
                            ReflectionUtil.setAccessible(fn);
                            fn.set(obj, o);
                        }
                    }               
                }
                if (reader.getEventType() == XMLStreamReader.END_ELEMENT && q.equals(reader.getName())) {
                    reader.next();
                }
            }
            return (Exception)obj;
        } catch (Exception e) {
            throw new Fault(new Message("MARSHAL_ERROR", LOG, e.getMessage()), e);
        }
    }
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.