public String readLine(int limit) throws SVNException { allocateReadBuffer(limit); try { while(myReadLineBuffer.hasRemaining()) { int b = read(); if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err); } else if (b == '\n') { break; } myReadLineBuffer.put((byte) (b & 0XFF)); } myReadLineBuffer.flip(); return myDecoder.decode(myReadLineBuffer).toString(); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e); } return null; }
public String readLine(StringBuffer buffer) throws SVNException { if (buffer == null) { buffer = new StringBuffer(); } boolean endOfLineMet = false; try { while (!endOfLineMet) { allocateReadBuffer(160); while(myReadLineBuffer.hasRemaining()) { int b = read(); if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err); } else if (b == '\n') { endOfLineMet = true; break; } myReadLineBuffer.put((byte) (b & 0XFF)); } myReadLineBuffer.flip(); buffer.append(myDecoder.decode(myReadLineBuffer).toString()); } } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e); } return buffer.toString(); }
public String readLine(int limit) throws SVNException { allocateReadBuffer(limit); try { while(myReadLineBuffer.hasRemaining()) { int b = read(); if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err, SVNLogType.DEFAULT); } else if (b == '\n') { break; } myReadLineBuffer.put((byte) (b & 0XFF)); } myReadLineBuffer.flip(); return myDecoder.decode(myReadLineBuffer).toString(); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } return null; }
public String readLine(int limit) throws SVNException { allocateReadBuffer(limit); try { while(myReadLineBuffer.hasRemaining()) { int b = read(); if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err, SVNLogType.DEFAULT); } else if (b == '\n') { break; } myReadLineBuffer.put((byte) (b & 0XFF)); } myReadLineBuffer.flip(); return myDecoder.decode(myReadLineBuffer).toString(); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } return null; }
if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err, lineStart ? Level.FINEST : Level.FINE, SVNLogType.DEFAULT); } else if (b == '\n') { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
public String readLine(int limit) throws SVNException { long currentLimit = limit < 0 ? 1024 : limit; //if limit < 0, read line buffer should have infinite size allocateReadBuffer((int) currentLimit); try { while(myReadLineBuffer.hasRemaining()) { int b = read(); if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err, SVNLogType.DEFAULT); } else if (b == '\n') { break; } myReadLineBuffer.put((byte) (b & 0XFF)); if (limit < 0 && !myReadLineBuffer.hasRemaining()) { //make myReadLineBuffer twice as larger byte[] oldArray = myReadLineBuffer.array(); int oldLimit = (int) currentLimit; currentLimit = currentLimit * 2; allocateReadBuffer((int) currentLimit); myReadLineBuffer.put(oldArray, 0, oldLimit); } } myReadLineBuffer.flip(); return myDecoder.decode(myReadLineBuffer).toString(); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e, SVNLogType.DEFAULT); } return null; }
if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err, lineStart ? Level.FINEST : Level.FINE, SVNLogType.DEFAULT); } else if (b == '\n') { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
if (b < 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.STREAM_UNEXPECTED_EOF, "Can''t read length line from file {0}", getFile()); SVNErrorManager.error(err, lineStart ? Level.FINEST : Level.FINE, SVNLogType.DEFAULT); } else if (b == '\n') { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Can''t read length line from file {0}: {1}", new Object[]{getFile(), e.getLocalizedMessage()}); SVNErrorManager.error(err, e, SVNLogType.DEFAULT);
} catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Format file ''{0}'' contains an unexpected non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); new Object[] {formatFile.getFile(), line}); SVNErrorManager.error(err, SVNLogType.FSFS);
} catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Format file ''{0}'' contains an unexpected non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); new Object[] {formatFile.getFile(), line}); SVNErrorManager.error(err, SVNLogType.FSFS);
} catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Format file ''{0}'' contains an unexpected non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); new Object[] {formatFile.getFile(), line}); SVNErrorManager.error(err, SVNLogType.FSFS);
public void openRoot() throws SVNException { // repo format /root/format FSFile formatFile = new FSFile(getRepositoryFormatFile()); int format = -1; try { format = formatFile.readInt(); } catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "First line of ''{0}'' contains non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } finally { formatFile.close(); } if (format != REPOSITORY_FORMAT && format != REPOSITORY_FORMAT_LEGACY) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.REPOS_UNSUPPORTED_VERSION, "Expected repository format ''{0}'' or " + "''{1}''; found format ''{2}''", new Object[] {new Integer(REPOSITORY_FORMAT_LEGACY), new Integer(REPOSITORY_FORMAT), new Integer(format)}); SVNErrorManager.error(err, SVNLogType.FSFS); } myReposFormat = format; }
public void openRoot() throws SVNException { // repo format /root/format FSFile formatFile = new FSFile(getRepositoryFormatFile()); int format = -1; try { format = formatFile.readInt(); } catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "First line of ''{0}'' contains non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } finally { formatFile.close(); } if (format != REPOSITORY_FORMAT && format != REPOSITORY_FORMAT_LEGACY) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.REPOS_UNSUPPORTED_VERSION, "Expected repository format ''{0}'' or " + "''{1}''; found format ''{2}''", new Object[] {new Integer(REPOSITORY_FORMAT_LEGACY), new Integer(REPOSITORY_FORMAT), new Integer(format)}); SVNErrorManager.error(err, SVNLogType.FSFS); } myReposFormat = format; }
public void openRoot() throws SVNException { // repo format /root/format FSFile formatFile = new FSFile(getRepositoryFormatFile()); int format = -1; try { format = formatFile.readInt(); } catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "First line of ''{0}'' contains non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } finally { formatFile.close(); } if (format != REPOSITORY_FORMAT && format != REPOSITORY_FORMAT_LEGACY) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.REPOS_UNSUPPORTED_VERSION, "Expected repository format ''{0}'' or " + "''{1}''; found format ''{2}''", new Object[] {new Integer(REPOSITORY_FORMAT_LEGACY), new Integer(REPOSITORY_FORMAT), new Integer(format)}); SVNErrorManager.error(err, SVNLogType.FSFS); } myReposFormat = format; }
properties.put(key, dst); } else { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "File ''{0}'' contains unexpected binary property value", getFile()); SVNErrorManager.error(error, cce, SVNLogType.DEFAULT);
properties.put(key, dst); } else { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "File ''{0}'' contains unexpected binary property value", getFile()); SVNErrorManager.error(error, cce, SVNLogType.DEFAULT);
properties.put(key, dst); } else { SVNErrorMessage error = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "File ''{0}'' contains unexpected binary property value", getFile()); SVNErrorManager.error(error, cce, SVNLogType.DEFAULT);
public int readDBFormat() throws SVNException { int format = -1; // fs format /root/db/format FSFile formatFile = new FSFile(getDBFormatFile()); try { format = formatFile.readInt(); readOptions(formatFile, format); } catch (SVNException svne) { if (svne.getCause() instanceof FileNotFoundException) { format = DB_FORMAT_LOW; myMaxFilesPerDirectory = 0; } else if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.STREAM_UNEXPECTED_EOF) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Can''t read first line of format file ''{0}''", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } else { throw svne; } } catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Format file ''{0}'' contains an unexpected non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } finally { formatFile.close(); } return format; }
public int readDBFormat() throws SVNException { int format = -1; // fs format /root/db/format FSFile formatFile = new FSFile(getDBFormatFile()); try { format = formatFile.readInt(); readOptions(formatFile, format); } catch (SVNException svne) { if (svne.getCause() instanceof FileNotFoundException) { format = DB_FORMAT_LOW; } else if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.STREAM_UNEXPECTED_EOF) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Can''t read first line of format file ''{0}''", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } else { throw svne; } } catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Format file ''{0}'' contains an unexpected non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } finally { formatFile.close(); } return format; }
public int readDBFormat() throws SVNException { int format = -1; // fs format /root/db/format FSFile formatFile = new FSFile(getDBFormatFile()); try { format = formatFile.readInt(); readOptions(formatFile, format); } catch (SVNException svne) { if (svne.getCause() instanceof FileNotFoundException) { format = DB_FORMAT_LOW; } else if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.STREAM_UNEXPECTED_EOF) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Can''t read first line of format file ''{0}''", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } else { throw svne; } } catch (NumberFormatException nfe) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.BAD_VERSION_FILE_FORMAT, "Format file ''{0}'' contains an unexpected non-digit", formatFile.getFile()); SVNErrorManager.error(err, SVNLogType.FSFS); } finally { formatFile.close(); } return format; }