Package org.webharvest.exception

Examples of org.webharvest.exception.FileException


    }

    private Variable executeFileList(String filePath, String listFilter, boolean listFiles, boolean listDirs, boolean listRecursive) {
        File dir = new File(filePath);
        if ( !dir.exists() ) {
            throw new FileException("Directory \"" + dir + "\" doesn't exist!");
        } else if ( !dir.isDirectory() ) {
            throw new FileException("\"" + dir + "\" is not directory!");
        }

        Collection collection = listFiles(dir, new CommandPromptFilenameFilter(listFilter), listRecursive);
        TreeSet sortedFileNames = new TreeSet();
        Iterator iterator = collection.iterator();
View Full Code Here


            out.flush();
            out.close();

            return result;
        } catch (IOException e) {
            throw new FileException("Error writing data to file: " + fullPath, e);
        }
    }
View Full Code Here

                if ( scraper.getLogger().isInfoEnabled() ) {
                    scraper.getLogger().info("Binary file read processor: " + data.length + " bytes read.");
                }
                return new NodeVariable(data);
            } catch (IOException e) {
                throw new FileException("Error reading file: " + fullPath, e);
            }
        } else {
            try {
                String content = CommonUtil.readStringFromFile(new File(fullPath), charset);
                if ( scraper.getLogger().isInfoEnabled() ) {
                    scraper.getLogger().info( "Text file read processor: " + (content == null ? 0 : content.length()) + " characters read." );
                }
                return new NodeVariable(content);
            } catch (IOException e) {
                throw new FileException("Error reading the file: " + fullPath, e);
            }
        }
    }
View Full Code Here

        try {
            includedConfig = isUrl ? new ScraperConfiguration(new URL(fullPath)) : new ScraperConfiguration(fullPath);
            scraper.execute(includedConfig.getOperations());
            return new EmptyVariable();
        } catch (FileNotFoundException e) {
            throw new FileException("Cannot include configuration file " + fullPath, e);
        } catch (MalformedURLException e) {
            throw new FileException("Cannot include configuration file " + fullPath, e);
        } catch (IOException e) {
            throw new FileException("Cannot include configuration file " + fullPath, e);
        }
    }
View Full Code Here

TOP

Related Classes of org.webharvest.exception.FileException

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.