Package org.uberfire.java.nio

Examples of org.uberfire.java.nio.IOException


            boolean isClosed = false;

            @Override
            public void close() throws IOException {
                if ( isClosed ) {
                    throw new IOException();
                }
                isClosed = true;
            }

            @Override
            public Iterator<Path> iterator() {
                if ( isClosed ) {
                    throw new IOException();
                }
                return new Iterator<Path>() {
                    private int i = -1;
                    private Path nextEntry = null;
                    public boolean atEof = false;
View Full Code Here


                try {
                    FileUtils.forceDelete( file );
                } catch ( final FileNotFoundException ignore ) {
                } catch ( java.io.IOException e ) {
                    throw new IOException( e );
                }

                return result;
            } finally {
                toGeneralPathImpl( path ).clearCache();
View Full Code Here

                FileUtils.copyDirectory( source.toFile(), target.toFile() );
            } else {
                FileUtils.copyFile( source.toFile(), target.toFile() );
            }
        } catch ( java.io.IOException ex ) {
            throw new IOException( ex );
        }
    }
View Full Code Here

                FileUtils.moveDirectory( source.toFile(), target.toFile() );
            } else {
                FileUtils.moveFile( source.toFile(), target.toFile() );
            }
        } catch ( java.io.IOException ex ) {
            throw new IOException( ex );
        }
    }
View Full Code Here

        checkNotNull( "repoFolder", repoFolder );

        try {
            return Git.init().setBare( bare ).setDirectory( repoFolder ).call();
        } catch ( GitAPIException e ) {
            throw new IOException( e );
        }
    }
View Full Code Here

        final RevWalk revWalk = new RevWalk( repo );

        final ObjectId[] commits = resolveObjectIds( git, _commits );

        if ( _commits.length != commits.length ) {
            throw new IOException( "Couldn't resolve some commits." );
        }

        try {
            final Ref headRef = getBranch( git, targetBranch );
            newHead = revWalk.parseCommit( headRef.getObjectId() );

            // loop through all refs to be cherry-picked
            for ( final ObjectId src : commits ) {
                final RevCommit srcCommit = revWalk.parseCommit( src );

                // get the parent of the commit to cherry-pick
                if ( srcCommit.getParentCount() != 1 ) {
                    throw new IOException( new MultipleParentsNotAllowedException(
                            MessageFormat.format(
                                    JGitText.get().canOnlyCherryPickCommitsWithOneParent,
                                    srcCommit.name(),
                                    Integer.valueOf( srcCommit.getParentCount() ) ) ) );
                }

                final RevCommit srcParent = srcCommit.getParent( 0 );
                revWalk.parseHeaders( srcParent );

                final RevCommit revCommit = revWalk.parseCommit( src );
                final RefUpdate ru = git.getRepository().updateRef( "refs/heads/" + targetBranch );
                if ( newHead == null ) {
                    ru.setExpectedOldObjectId( ObjectId.zeroId() );
                } else {
                    ru.setExpectedOldObjectId( newHead );
                }
                ru.setNewObjectId( src );
                ru.setRefLogMessage( reflogPrefix + " " + srcCommit.getShortMessage(), false );
                final RefUpdate.Result rc = ru.forceUpdate();
                switch ( rc ) {
                    case NEW:
                    case FORCED:
                    case FAST_FORWARD:
                        newHead = revCommit;
                        break;
                    case REJECTED:
                    case LOCK_FAILURE:
                        throw new ConcurrentRefUpdateException( JGitText.get().couldNotLockHEAD, ru.getRef(), rc );
                    default:
                        throw new JGitInternalException( MessageFormat.format( JGitText.get().updatingRefFailed, Constants.HEAD, src.toString(), rc ) );
                }
            }
        } catch ( final java.io.IOException e ) {
            throw new IOException( new JGitInternalException(
                    MessageFormat.format(
                            JGitText.get().exceptionCaughtDuringExecutionOfCherryPickCommand,
                            e ), e ) );
        } catch ( final Exception e ) {
            throw new IOException( e );
        } finally {
            revWalk.release();
        }
    }
View Full Code Here

    public static void deleteBranch( final Git git,
                                     final Ref branch ) {
        try {
            git.branchDelete().setBranchNames( branch.getName() ).setForce( true ).call();
        } catch ( final GitAPIException e ) {
            throw new IOException( e );
        }
    }
View Full Code Here

        checkNotNull( "path", path );

        try {
            newByteChannel( path, CREATE_NEW_FILE_OPTIONS, attrs ).close();
        } catch ( java.io.IOException e ) {
            throw new IOException( e );
        }

        return path;
    }
View Full Code Here

            }
            parent = parent.getParent();
        }

        if ( parent == null ) {
            throw new IOException( "Root directory does not exist" );
        }

        // create directories
        Path child = parent;
        for ( final Path name : parent.relativize( dir ) ) {
View Full Code Here

            return internalCopy( in, out );
        } finally {
            try {
                out.close();
            } catch ( java.io.IOException e ) {
                throw new IOException( e );
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.uberfire.java.nio.IOException

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.