Package org.jaggeryjs.scriptengine.exceptions

Examples of org.jaggeryjs.scriptengine.exceptions.ScriptException


            readable = true;
            try {
                stream = fileItem.getInputStream();
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
        } else {
            String msg = "Invalid or unsupported file mode, path : " + path + ", mode : " + mode;
            log.error(msg);
            throw new ScriptException(msg);
        }
        opened = true;
    }
View Full Code Here


        try {
            stream.close();
            opened = false;
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        }
    }
View Full Code Here

        try {
            BoundedInputStream boundedInputStream = new BoundedInputStream(stream, count);
            return IOUtils.toString(boundedInputStream, "UTF-8");
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        }
    }
View Full Code Here

        try {
            InputStream inputStream = fileItem.getInputStream();
            return IOUtils.toString(inputStream, "UTF-8");
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        }
    }
View Full Code Here

            outputStream.flush();
            outputStream.close();
            return true;
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        }
    }
View Full Code Here

            uploadedFile.setFileManager(this);
            return uploadedFile;
        } else {
            String msg = "Unsupported parameter to the File constructor : " + object.getClass();
            log.error(msg);
            throw new ScriptException(msg);
        }
    }
View Full Code Here

        String oldPath = path;
        path = FilenameUtils.normalizeNoEndSeparator(path);
        if (path == null) {
            String msg = "Invalid file path : " + oldPath;
            log.error(msg);
            throw new ScriptException(msg);
        }

        File file = new File(context.getRealPath("/"), path);
        if (file.isDirectory()) {
            String msg = "File hostobject doesn't handle directories. Specified path contains a directory : " + path;
            log.error(msg);
            throw new ScriptException(msg);
        }
        return file;
    }
View Full Code Here

        String parent = includesCallstack.lastElement();
        try {
            String keys[] = WebAppManager.getKeys(context.getContextPath(), parent, fileURL);
            fileURL = "/".equals(keys[1]) ? keys[2] : keys[1] + keys[2];
        } catch (NullPointerException ne) {
            throw new ScriptException("Invalid file path : " + fileURL, ne);
        }
        return fileURL;
    }
View Full Code Here

        if ("r".equals(mode)) {
            try {
                file = new RandomAccessFile(realPath, "r");
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
        } else if ("r+".equals(mode)) {
            try {
                file = new RandomAccessFile(realPath, "rw");
                file.seek(0);
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
            writable = true;
        } else if ("w".equals(mode)) {
            try {
                file = new RandomAccessFile(realPath, "rw");
                file.setLength(0);
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            writable = true;
        } else if ("w+".equals(mode)) {
            try {
                file = new RandomAccessFile(realPath, "rw");
                file.setLength(0);
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
            writable = true;
        } else if ("a".equals(mode)) {
            try {
                file = new RandomAccessFile(realPath, "rw");
                file.seek(file.length());
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            writable = true;
        } else if ("a+".equals(mode)) {
            try {
                file = new RandomAccessFile(realPath, "rw");
                file.seek(file.length());
            } catch (FileNotFoundException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            } catch (IOException e) {
                log.error(e.getMessage(), e);
                throw new ScriptException(e);
            }
            readable = true;
            writable = true;
        } else {
            String msg = "Invalid or unsupported file mode, path : " + realPath + ", mode : " + mode;
            log.error(msg);
            throw new ScriptException(msg);
        }
        opened = true;
    }
View Full Code Here

        try {
            file.close();
            opened = false;
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new ScriptException(e);
        }
    }
View Full Code Here

TOP

Related Classes of org.jaggeryjs.scriptengine.exceptions.ScriptException

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.