private static void handleInconsistentEOL(SVNException svne, Object path) throws SVNException { SVNErrorMessage errorMessage = svne.getErrorMessage(); while (errorMessage != null && errorMessage.getErrorCode() != SVNErrorCode.IO_INCONSISTENT_EOL) { errorMessage = errorMessage.getChildErrorMessage(); } if (errorMessage != null && errorMessage.getErrorCode() == SVNErrorCode.IO_INCONSISTENT_EOL) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "File ''{0}'' has inconsistent newlines", path); SVNErrorManager.error(error, SVNLogType.DEFAULT); } Throwable cause = svne.getCause(); if (cause == null) { return; } if (cause instanceof SVNException) { handleInconsistentEOL((SVNException) cause, path); } else if (cause instanceof IOExceptionWrapper) { IOExceptionWrapper wrapper = (IOExceptionWrapper) cause; handleInconsistentEOL(wrapper.getOriginalException(), path); } } }
private static void handleInconsistentEOL(SVNException svne, Object path) throws SVNException { SVNErrorMessage errorMessage = svne.getErrorMessage(); while (errorMessage != null && errorMessage.getErrorCode() != SVNErrorCode.IO_INCONSISTENT_EOL) { errorMessage = errorMessage.getChildErrorMessage(); } if (errorMessage != null && errorMessage.getErrorCode() == SVNErrorCode.IO_INCONSISTENT_EOL) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "File ''{0}'' has inconsistent newlines", path); SVNErrorManager.error(error, SVNLogType.DEFAULT); } Throwable cause = svne.getCause(); if (cause == null) { return; } if (cause instanceof SVNException) { handleInconsistentEOL((SVNException) cause, path); } else if (cause instanceof IOExceptionWrapper) { IOExceptionWrapper wrapper = (IOExceptionWrapper) cause; handleInconsistentEOL(wrapper.getOriginalException(), path); } } }
public static void validateEOLProperty(String path, ISVNFileContentFetcher fetcher) throws SVNException { SVNTranslatorOutputStream out = new SVNTranslatorOutputStream(SVNFileUtil.DUMMY_OUT, new byte[0], false, null, false); try { fetcher.fetchFileContent(out); } catch (SVNException e) { handleInconsistentEOL(e, path); } finally { try { out.close(); } catch (IOExceptionWrapper wrapper) { handleInconsistentEOL(wrapper.getOriginalException(), path); } catch (IOException e) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), SVNLogType.DEFAULT); } } if (fetcher.fileIsBinary()) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "File ''{0}'' has binary mime type property", path); SVNErrorManager.error(error, SVNLogType.WC); } }
public static void validateEOLProperty(Object path, ISVNFileContentFetcher fetcher) throws SVNException { SVNTranslatorOutputStream out = new SVNTranslatorOutputStream(SVNFileUtil.DUMMY_OUT, new byte[0], false, null, false); try { fetcher.fetchFileContent(out); } catch (SVNException e) { handleInconsistentEOL(e, path); throw e; } finally { try { out.close(); } catch (IOExceptionWrapper wrapper) { handleInconsistentEOL(wrapper.getOriginalException(), path); throw wrapper.getOriginalException(); } catch (IOException e) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), SVNLogType.DEFAULT); } } if (fetcher.fileIsBinary()) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "File ''{0}'' has binary mime type property", path); SVNErrorManager.error(error, SVNLogType.WC); } }
public static void validateEOLProperty(Object path, ISVNFileContentFetcher fetcher) throws SVNException { if (fetcher == null) { return; } final SVNPropertyValue charset = fetcher.getProperty(SVNProperty.CHARSET); final OutputStream out = SVNTranslator.getTranslatingOutputStream(SVNFileUtil.DUMMY_OUT, SVNPropertyValue.getPropertyAsString(charset), new byte[0], false, null, false); try { fetcher.fetchFileContent(out); } catch (SVNException e) { handleInconsistentEOL(e, path); throw e; } finally { try { out.close(); } catch (IOExceptionWrapper wrapper) { handleInconsistentEOL(wrapper.getOriginalException(), path); throw wrapper.getOriginalException(); } catch (IOException e) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), SVNLogType.DEFAULT); } } if (fetcher.fileIsBinary()) { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.ILLEGAL_TARGET, "File ''{0}'' has binary mime type property", path); SVNErrorManager.error(error, SVNLogType.WC); } }