private void handleIOError(SVNException e, boolean readMalformedData) throws SVNException { if (readMalformedData && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_SVN_MALFORMED_DATA) { byte[] malfored = new byte[1024]; try { getInputStream().read(malfored); } catch (IOException e1) { // } } throw e; }
private void handleIOError(SVNException e, boolean readMalformedData) throws SVNException { if (readMalformedData && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_SVN_MALFORMED_DATA) { byte[] malfored = new byte[1024]; try { getInputStream().read(malfored); } catch (IOException e1) { // } } throw e; }
private void handleIOError(SVNException e, boolean readMalformedData) throws SVNException { if (readMalformedData && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_SVN_MALFORMED_DATA) { byte[] malfored = new byte[1024]; try { getInputStream().read(malfored); } catch (IOException e1) { // } } throw e; }
private InputStream skipLeadingGrabage(int attempt) throws SVNException { byte[] bytes = myHandshakeBuffer; int r = 0; try { r = getInputStream().read(bytes); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Handshake failed: ''{0}''", e.getMessage()); SVNErrorManager.error(err, SVNLogType.NETWORK); } if (r >= 0) { for (int i = 0; i < r; i++) { if (bytes[i] == '(' && bytes[i + 1] == ' ') { return new SequenceInputStream(new ByteArrayInputStream(bytes, i, r - i), getInputStream()); } } } if (r >= 0 && attempt == 0) { return skipLeadingGrabage(attempt + 1); } SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Handshake failed, received: ''{0}''", new String(bytes)); SVNErrorManager.error(err, SVNLogType.NETWORK); return null; }
private InputStream skipLeadingGrabage(int attempt) throws SVNException { byte[] bytes = myHandshakeBuffer; int r = 0; try { r = getInputStream().read(bytes); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Handshake failed: ''{0}''", e.getMessage()); SVNErrorManager.error(err, SVNLogType.NETWORK); } if (r >= 0) { for (int i = 0; i < r; i++) { if (bytes[i] == '(' && bytes[i + 1] == ' ') { return new SequenceInputStream(new ByteArrayInputStream(bytes, i, r - i), getInputStream()); } } } if (r >= 0 && attempt == 0) { return skipLeadingGrabage(attempt + 1); } SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Handshake failed, received: ''{0}''", new String(bytes)); SVNErrorManager.error(err, SVNLogType.NETWORK); return null; }
private InputStream skipLeadingGrabage(int attempt) throws SVNException { byte[] bytes = myHandshakeBuffer; int r = 0; try { r = getInputStream().read(bytes); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Handshake failed: ''{0}''", e.getMessage()); SVNErrorManager.error(err, SVNLogType.NETWORK); } if (r >= 0) { for (int i = 0; i < r; i++) { if (bytes[i] == '(' && bytes[i + 1] == ' ') { return new SequenceInputStream(new ByteArrayInputStream(bytes, i, r - i), getInputStream()); } } } if (r >= 0 && attempt == 0) { return skipLeadingGrabage(attempt + 1); } if (r <= 0) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Handshake failed, data stream ended unexpectedly"); SVNErrorManager.error(err, SVNLogType.NETWORK); } SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_SVN_MALFORMED_DATA, "Handshake failed, received: ''{0}''", new String(bytes, 0, r)); SVNErrorManager.error(err, SVNLogType.NETWORK); return null; }
public Object[] read(String template, Object[] items, boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.parse(getInputStream(), template, items); } catch (SVNException e) { if (readMalformedData && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_SVN_MALFORMED_DATA) { // read let's say next 255 bytes into the logging stream. byte[] malfored = new byte[1024]; try { // could it hang here for timeout? System.out.println("reading malformed data"); getInputStream().read(malfored); } catch (IOException e1) { // ignore. } } throw e; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public List readTuple(String template, boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.readTuple(getInputStream(), template); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public SVNItem readItem(boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.readItem(getInputStream()); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public List read(String template, List items, boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.parse(getInputStream(), template, items); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public List readTuple(String template, boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.readTuple(getInputStream(), template); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public SVNItem readItem(boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.readItem(getInputStream()); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public List readTuple(String template, boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.readTuple(getInputStream(), template); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public List read(String template, List items, boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.parse(getInputStream(), template, items); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public SVNItem readItem(boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.readItem(getInputStream()); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
public List read(String template, List items, boolean readMalformedData) throws SVNException { try { checkConnection(); return SVNReader.parse(getInputStream(), template, items); } catch (SVNException e) { handleIOError(e, readMalformedData); return null; } finally { myRepository.getDebugLog().flushStream(myLoggingInputStream); } }
protected SVNAuthenticator(SVNConnection connection) throws SVNException { myConnection = connection; // these are logged streams. myConnectionInputStream = connection.getInputStream(); myConnectionOutputStream = connection.getOutputStream(); // plain streams. try { myPlainInputStream = connection.getConnector().getInputStream(); myPlainOutputStream = connection.getConnector().getOutputStream(); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getMessage()); SVNErrorManager.error(err, SVNLogType.NETWORK); } }
protected SVNAuthenticator(SVNConnection connection) throws SVNException { myConnection = connection; // these are logged streams. myConnectionInputStream = connection.getInputStream(); myConnectionOutputStream = connection.getOutputStream(); // plain streams. try { myPlainInputStream = connection.getConnector().getInputStream(); myPlainOutputStream = connection.getConnector().getOutputStream(); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getMessage()); SVNErrorManager.error(err, SVNLogType.NETWORK); } }
protected SVNAuthenticator(SVNConnection connection) throws SVNException { myConnection = connection; // these are logged streams. myConnectionInputStream = connection.getInputStream(); myConnectionOutputStream = connection.getOutputStream(); // plain streams. try { myPlainInputStream = connection.getConnector().getInputStream(); myPlainOutputStream = connection.getConnector().getOutputStream(); } catch (IOException e) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e.getMessage()); SVNErrorManager.error(err, SVNLogType.NETWORK); } }