Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMException


    public InputStream getXMLInputStream(String encoding
        throws UnsupportedEncodingException {
        try{
            return data.readParserInputStream();
        }catch(XMLStreamException e){
            throw new OMException(e);
        }
    }
View Full Code Here


                    if(log.isDebugEnabled()){
                        log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)");
                    }
                    return baos.toByteArray();
                } catch (IOException e) {
                    throw new OMException(e);
                }
            }else{
                //Someone already read the parser, happens in serialize call. I expect user to invoke this
                //via SerializeAndConsume call
                if(log.isDebugEnabled()){
                    log.warn("Parser was already read, recovering by just returning new byte[0]");
                    log.debug("Exit ParserInputStreamDataSource.getXMLBytes(encoding)");
                }
                return new byte[0];
            }
        }catch(XMLStreamException e){
            throw new OMException(e);
        }
    }
View Full Code Here

        }
        if (data.payload != null) {
            try {
                data.payload.close();
            } catch (IOException e) {
                throw new OMException(e);
            }
            data.payload = null;
        }
        if(log.isDebugEnabled()){
            log.debug("Exit ParserInputStreamDataSource.close()");
View Full Code Here

            return new ParserInputStreamDataSource(baais, data.encoding, data.behavior);
        } catch (Throwable t) {
            if(log.isDebugEnabled()){
                log.debug("Error ParserInputStreamDataSource.copy(): ", t);
            }
            throw new OMException(t);
        }
       
    }
View Full Code Here

                log.debug("Data Encoding = "+encoding);
                log.debug("numReads = "+numReads);
                log.debug("behavior = "+behavior);
               
                // The call stack is helpful to identify non-performant call flows
                String stack = CommonUtils.stackToString(new OMException());
                log.debug("call stack:" + stack);
            }
           
           
            // TODO NLS
            if(payload == null){
                throw new OMException("ParserInputStreamDataSource's InputStream is null.");
            }  
           
            if (behavior == Behavior.NOT_DESTRUCTIVE) {
                if (numReads > 1) {
                    try {
                        // For NOT_DESTRUCTIVE, the
                        // InputStream (either the original or copied InputStream)
                        // is reset for reuse.
                        if(log.isDebugEnabled()){
                            log.debug("reset InputStream for reuse");
                        }
                        payload.reset();
                    } catch (Throwable t) {
                        throw new OMException(t);
                    }
                }
            } else if (behavior == Behavior.ONE_USE_UNSAFE) {
               
                // For ONE_USE_UNSAFE,
                //    remember the first call
                //    intentionally fail on the second call
                if (numReads == 1) {
                    firstUseStack = CommonUtils.stackToString(new OMException());
                    if(log.isDebugEnabled()){
                        log.debug("ONE_USE_UNSAFE mode stack:" + firstUseStack);
                    }
                } else {
                    // TODO NLS
                    OMException ome =
                        new OMException("A second read of ParserInputStreamDataSource is not allowed."
                           + "The first read was done here: " + firstUseStack);
                    if(log.isDebugEnabled()){
                        log.debug("ONE_USE_UNSAFE second use exception:" + ome);
                    }
                    throw ome;
View Full Code Here

                        payload.mark(Integer.MAX_VALUE);
                    } catch (Throwable t) {
                        if(log.isDebugEnabled()){
                            log.debug("Error:", t);
                        }
                        throw new OMException(t);
                    }
                }
            } else {
                payload = inputStream;
            }
View Full Code Here

            }
            dos.close();
            md.update(baos.toByteArray());
            digest = md.digest();
        } catch (NoSuchAlgorithmException e) {
            throw new OMException(e);
        } catch (IOException e) {
            throw new OMException(e);
        }
        return digest;
    }
View Full Code Here

            }
            dos.close();
            md.update(baos.toByteArray());
            digest = md.digest();
        } catch (NoSuchAlgorithmException e) {
            throw new OMException(e);
        } catch (IOException e) {
            throw new OMException(e);
        }
        return digest;
    }
View Full Code Here

            md.update((byte) 0);
            md.update((byte) 0);
            md.update(pi.getValue().getBytes("UnicodeBigUnmarked"));
            digest = md.digest();
        } catch (NoSuchAlgorithmException e) {
            throw new OMException(e);
        } catch (UnsupportedEncodingException e) {
            throw new OMException(e);
        }
        return digest;
    }
View Full Code Here

                    Part part = (Part)it.next();
                    multipartWriter.writePart(part.getDataHandler(), part.getContentID());
                }
                multipartWriter.complete();
            } catch (IOException e) {
                throw new OMException(e);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axiom.om.OMException

Copyright © 2018 www.massapicom. 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.