Package io.apigee.trireme.core.internal

Examples of io.apigee.trireme.core.internal.NodeOSException


        if (clientChannel != null) {
            try {
                clientChannel.socket().setKeepAlive(nd);
            } catch (SocketException e) {
                log.error("Error setting TCP keep alive on {}: {}", this, e);
                throw new NodeOSException(Constants.EIO);
            }
        }
    }
View Full Code Here


                }

                trans.transform(src, result);

            } catch (TransformerConfigurationException tce) {
                throw new NodeOSException(tce.toString());
            } catch (TransformerException e) {
                // Fall through! We already collected them below
            }

            // Use the error handler to collect all the errors, not just the first one.
            if (!errs.getErrors().isEmpty()) {
                StringBuilder msgs = new StringBuilder();
                for (TransformerException te : errs.getErrors()) {
                    msgs.append(te.getLocationAsString() + ": " + te.toString() + '\n');
                }
                throw new NodeOSException(msgs.toString());
            }

            return output.toString();
        }
View Full Code Here

        private Path translatePath(String path)
            throws NodeOSException
        {
            File trans = runner.translatePath(path);
            if (trans == null) {
                throw new NodeOSException(Constants.ENOENT, path);
            }
            return Paths.get(trans.getPath());
        }
View Full Code Here

            FileHandle handle = descriptors.get(fd);
            if (handle == null) {
                if (log.isTraceEnabled()) {
                    log.trace("File handle {} is not a regular file, fd");
                }
                throw new NodeOSException(Constants.EBADF);
            }
            return handle;
        }
View Full Code Here

            if (h.file == null) {
                if (Files.isDirectory(h.path)) {
                    if (log.isTraceEnabled()) {
                        log.trace("File handle {} is a directory and not a regular file", fd);
                    }
                    throw new NodeOSException(Constants.EISDIR);
                }
                if (log.isTraceEnabled()) {
                    log.trace("File handle {} is not a regular file", fd);
                }
                throw new NodeOSException(Constants.EBADF);
            }
            return h;
        }
View Full Code Here

                                                            new FileAttribute<?>[0]);
                        setModeNoPosix(path, mode);
                    }

                } catch (IOException ioe) {
                    throw new NodeOSException(getErrorCode(ioe), ioe, pathStr);
                }
            }

            try {
                FileHandle fileHandle = new FileHandle(path, file);
                // Replace this if we choose to support "lchmod"
                /*
                if ((flags & Constants.O_SYMLINK) != 0) {
                    fileHandle.noFollow = true;
                }
                */
                int fd = nextFd.getAndIncrement();
                if (log.isDebugEnabled()) {
                    log.debug("  open({}) = {}", pathStr, fd);
                }
                if (((flags & Constants.O_APPEND) != 0) && (file != null) && (file.size() > 0)) {
                    if (log.isDebugEnabled()) {
                        log.debug("  setting file position to {}", file.size());
                    }
                    fileHandle.position = file.size();
                }
                descriptors.put(fd, fileHandle);
                return new Object [] { Context.getUndefinedValue(), fd };
            } catch (IOException ioe) {
                throw new NodeOSException(getErrorCode(ioe), ioe, pathStr);
            }
        }
View Full Code Here

                if (handle.file != null) {
                    handle.file.close();
                }
                descriptors.remove(fd);
            } catch (IOException ioe) {
                throw new NodeOSException(getErrorCode(ioe), ioe);
            }
        }
View Full Code Here

                    Future<Integer> result = handle.file.read(readBuf, pos);
                    count = result.get();
                    handle.position += count;

                } catch (InterruptedException ie) {
                    throw new NodeOSException(Constants.EINTR);
                } catch (ExecutionException e) {
                    throw new NodeOSException(Constants.EIO, e.getCause());
                }
                // Node (like C) expects 0 on EOF, not -1
                if (count < 0) {
                    count = 0;
                }
View Full Code Here

                        log.debug("write({}, {}, {}) = {}",
                                  off, len, pos, count);
                    }

                } catch (InterruptedException e) {
                    throw new NodeOSException(Constants.EINTR);
                } catch (ExecutionException e) {
                    throw new NodeOSException(Constants.EIO, e.getCause());
                }
                return new Object[] { Context.getUndefinedValue(), count, buf };

            } else {
                final Scriptable domain = runner.getDomain();
View Full Code Here

                log.debug("fsync({})", fd);
            }
            try {
                handle.file.force(metaData);
            } catch (IOException ioe) {
                throw new NodeOSException(getErrorCode(ioe), ioe);
            }
        }
View Full Code Here

TOP

Related Classes of io.apigee.trireme.core.internal.NodeOSException

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.