mirror of
https://github.com/moparisthebest/davmail
synced 2024-08-13 16:53:51 -04: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> properties = new HashSet<String>();
|
||||||
protected HashSet<String> hrefs;
|
protected HashSet<String> hrefs;
|
||||||
protected boolean isMultiGet;
|
protected boolean isMultiGet;
|
||||||
|
@ -10,6 +10,7 @@ import java.io.IOException;
|
|||||||
*/
|
*/
|
||||||
public class ICSBufferedReader extends BufferedReader {
|
public class ICSBufferedReader extends BufferedReader {
|
||||||
protected String nextLine;
|
protected String nextLine;
|
||||||
|
protected StringBuilder currentLine = new StringBuilder(75);
|
||||||
|
|
||||||
public ICSBufferedReader(Reader in, int sz) throws IOException {
|
public ICSBufferedReader(Reader in, int sz) throws IOException {
|
||||||
super(in, sz);
|
super(in, sz);
|
||||||
@ -23,12 +24,17 @@ public class ICSBufferedReader extends BufferedReader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String readLine() throws IOException {
|
public String readLine() throws IOException {
|
||||||
String currentLine = nextLine;
|
if (nextLine == null) {
|
||||||
nextLine = super.readLine();
|
return null;
|
||||||
while (nextLine != null && nextLine.charAt(0) == ' ') {
|
} else {
|
||||||
currentLine += nextLine.substring(1);
|
currentLine.setLength(0);
|
||||||
|
currentLine.append(nextLine);
|
||||||
nextLine = super.readLine();
|
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 {
|
protected void parseCredentials(StringTokenizer tokens) throws IOException {
|
||||||
if (tokens.hasMoreTokens()) {
|
if (tokens.hasMoreTokens()) {
|
||||||
|
@ -16,6 +16,9 @@ public class ImapServer extends AbstractServer {
|
|||||||
/**
|
/**
|
||||||
* Create a ServerSocket to listen for connections.
|
* Create a ServerSocket to listen for connections.
|
||||||
* Start the thread.
|
* 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 {
|
public ImapServer(int port) throws IOException {
|
||||||
super("ImapServer", port, ImapServer.DEFAULT_PORT);
|
super("ImapServer", port, ImapServer.DEFAULT_PORT);
|
||||||
|
Loading…
Reference in New Issue
Block a user