Package org.apache.excalibur.source

Examples of org.apache.excalibur.source.SourceException


                thread.start();
                if (this.getLogger().isDebugEnabled()) {
                    this.getLogger().debug("Thread started for " + uri);
                }
            } catch (ComponentException ce) {
                throw new SourceException("Unable to lookup thread pool or xml serializer.", ce);
            } catch (Exception e) {
                throw new SourceException("Unable to get pooled thread.", e);
            }
        }
        return uri;
    }
View Full Code Here


            if ((buf[0] == (byte)0xFF) &&
                (buf[1] == (byte)0xD8))
                return true;
        } catch (IOException ioe) {
            throw new SourceException("Could not read source", ioe);
        } finally {
            if (in != null)
                try {
                    in.close();
                } catch(Exception e) {}
View Full Code Here

        try {
            in = new BufferedInputStream(source.getInputStream());
            // check for "magic" header
            byte[] buf = new byte[2];
            int count = in.read(buf, 0, 2);
            if (count < 2) throw new SourceException("Not a valid Jpeg file!");
            if((buf[0]) != (byte)0xFF
            || (buf[1]) != (byte)0xD8 )
            throw new SourceException("Not a valid Jpeg file!");

            int width = 0;
            int height = 0;

            boolean done = false;
            int ch = 0;

            try {
                while(ch != 0xDA && !done) {
                    /* Find next marker (JPEG markers begin with 0xFF) */
                    while (ch != 0xFF) { ch = in.read(); }
                    /* JPEG markers can be padded with unlimited 0xFF's */
                    while (ch == 0xFF) { ch = in.read(); }
                    /* Now, ch contains the value of the marker. */
                    if(ch >= 0xC0 && ch <= 0xC3) {
                        // skip 3 bytes
                        in.read();
                        in.read();
                        in.read();
                        height = 256 * in.read();
                        height += in.read();
                        width = 256 * in.read();
                        width += in.read();
                        done = true;
                    } else {
                        /* We MUST skip variables, since FF's within variable names
                           are NOT valid JPEG markers */
                        int length = 256 * in.read();
                        length += in.read();
                        if(length < 2) throw new RuntimeException("Erroneous JPEG marker length");
                        for(int foo = 0; foo<length-2; foo++)
                            in.read();
                    }
                }
            } catch (Exception e) {
                throw new SourceException("Not a valid Jpeg file!", e);
            }

            int[] dim = { width, height };
            return dim;

        } catch (IOException ioe) {
            throw new SourceException("Could not read source", ioe);
        } finally {
            if (in != null)
                try {
                    in.close();
                } catch (Exception e) {}
View Full Code Here

            if ((buf[0] == (byte)'G') &&
                (buf[1] == (byte)'I') &&
                (buf[2] == (byte)'F'))
                return true;
        } catch (IOException ioe) {
            throw new SourceException("Could not read source", ioe);
        } finally {
            if (in != null)
                try {
                    in.close();
                } catch(Exception e) {}
View Full Code Here

        BufferedInputStream in = null;
        try {
            in = new BufferedInputStream(source.getInputStream());
            byte[] buf = new byte[10];
            int count = in.read(buf, 0, 10);
            if(count < 10) throw new SourceException("Not a valid GIF file!");
            if((buf[0]) != (byte)'G'
            || (buf[1]) != (byte)'I'
            || (buf[2]) != (byte)'F' )
            throw new SourceException("Not a valid GIF file!");

            int w1 = ((int)buf[6] & 0xff) | (buf[6] & 0x80);
            int w2 = ((int)buf[7] & 0xff) | (buf[7] & 0x80);
            int h1 = ((int)buf[8] & 0xff) | (buf[8] & 0x80);
            int h2 = ((int)buf[9] & 0xff) | (buf[9] & 0x80);

            int width = w1 + (w2 << 8);
            int height = h1 + (h2 << 8);

            int[] dim = { width, height };
            return dim;
        } catch (IOException ioe) {
            throw new SourceException("Could not read source", ioe);
        } finally {
            if (in != null)
                try {
                    in.close();
                } catch (Exception e) {}
View Full Code Here

            this.sourcerevisionbranch = null;
        } catch (ObjectNotFoundException onfe) {
            // getLogger().debug("Source doesn't exist", onfe);
            // ignore
        } catch (SlideException se) {
            throw new SourceException("Access denied for source '"+this.uri+
                                      "'", se);
        }

    }
View Full Code Here

            */

            return content.retrieve(slideToken, this.revisionDescriptors,
                                    this.revisionDescriptor).streamContent();
        } catch (SlideException se) {
            throw new SourceException("Could not get source", se);
        }
    }
View Full Code Here

    public void cancel(OutputStream stream) throws SourceException {
        if (outputstream==stream) {
            try {
                outputstream.cancel();
            } catch (Exception e) {
                throw new SourceException("Could not cancel output stream",
                                          e);
            }
        }
    }
View Full Code Here

                try {
                    nat.rollback();
                } catch (Exception rbe) {
                    getLogger().error("Rollback failed for moving source", rbe);
                }
                throw new SourceException("Could not move source.", se);
            }
        } else {
            org.apache.excalibur.source.SourceUtil.move(this, source);
        }
    }
View Full Code Here

                try {
                    nat.rollback();
                } catch (Exception rbe) {
                    getLogger().error("Rollback failed for moving source", rbe);
                }
                throw new SourceException("Could not move source.", se);
            }
        } else {
            org.apache.excalibur.source.SourceUtil.copy(this, source);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.excalibur.source.SourceException

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.