mirror of
https://github.com/moparisthebest/davmail
synced 2024-12-13 03:02:22 -05:00
Fix from audit : improve ICSBufferedReader performance, reuse StringBuilder
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@285 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
780e6fb827
commit
ec59882589
@ -731,7 +731,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
|
||||
}
|
||||
|
||||
protected class CaldavRequest {
|
||||
protected static class CaldavRequest {
|
||||
protected HashSet<String> properties = new HashSet<String>();
|
||||
protected HashSet<String> hrefs;
|
||||
protected boolean isMultiGet;
|
||||
|
@ -10,6 +10,7 @@ import java.io.IOException;
|
||||
*/
|
||||
public class ICSBufferedReader extends BufferedReader {
|
||||
protected String nextLine;
|
||||
protected StringBuilder currentLine = new StringBuilder(75);
|
||||
|
||||
public ICSBufferedReader(Reader in, int sz) throws IOException {
|
||||
super(in, sz);
|
||||
@ -23,12 +24,17 @@ public class ICSBufferedReader extends BufferedReader {
|
||||
|
||||
@Override
|
||||
public String readLine() throws IOException {
|
||||
String currentLine = nextLine;
|
||||
nextLine = super.readLine();
|
||||
while (nextLine != null && nextLine.charAt(0) == ' ') {
|
||||
currentLine += nextLine.substring(1);
|
||||
if (nextLine == null) {
|
||||
return null;
|
||||
} else {
|
||||
currentLine.setLength(0);
|
||||
currentLine.append(nextLine);
|
||||
nextLine = super.readLine();
|
||||
while (nextLine != null && nextLine.charAt(0) == ' ') {
|
||||
currentLine.append(nextLine.substring(1));
|
||||
nextLine = super.readLine();
|
||||
}
|
||||
return currentLine.toString();
|
||||
}
|
||||
return currentLine;
|
||||
}
|
||||
}
|
||||
|
@ -135,7 +135,9 @@ public class ImapConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
/**
|
||||
* Decode SMTP credentials
|
||||
* Decode IMAP credentials
|
||||
* @param tokens tokens
|
||||
* @throws java.io.IOException on error
|
||||
*/
|
||||
protected void parseCredentials(StringTokenizer tokens) throws IOException {
|
||||
if (tokens.hasMoreTokens()) {
|
||||
|
@ -16,6 +16,9 @@ public class ImapServer extends AbstractServer {
|
||||
/**
|
||||
* Create a ServerSocket to listen for connections.
|
||||
* Start the thread.
|
||||
*
|
||||
* @param port imap listen port, 143 if not defined (0)
|
||||
* @throws java.io.IOException on error
|
||||
*/
|
||||
public ImapServer(int port) throws IOException {
|
||||
super("ImapServer", port, ImapServer.DEFAULT_PORT);
|
||||
|
Loading…
Reference in New Issue
Block a user