vmassol 02/01/27 12:00:38
Modified: src/framework/share/org/apache/cactus/client
AutoReadHttpURLConnection.java
src/framework/share/org/apache/cactus/client/authentication
AbstractAuthentication.java
BasicAuthentication.java
Log:
audit fix
Revision Changes Path
1.14 +57 -10
jakarta-cactus/src/framework/share/org/apache/cactus/client/AutoReadHttpURLConnection.java
Index: AutoReadHttpURLConnection.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/AutoReadHttpURLConnection.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- AutoReadHttpURLConnection.java 27 Jan 2002 16:57:08 -0000 1.13
+++ AutoReadHttpURLConnection.java 27 Jan 2002 20:00:38 -0000 1.14
@@ -53,15 +53,20 @@
*/
package org.apache.cactus.client;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
import java.net.HttpURLConnection;
-import java.net.URL;
import java.net.ProtocolException;
-import java.io.*;
+import java.net.URL;
import java.security.Permission;
-import org.apache.cactus.util.log.LogService;
import org.apache.cactus.util.log.Log;
-
+import org.apache.cactus.util.log.LogService;
/**
* Wrapper class for the real <code>HttpURLConnection</code> to the test servlet
@@ -78,7 +83,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Bob Davison</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
*
- * @version $Id: AutoReadHttpURLConnection.java,v 1.13 2002/01/27 16:57:08 vmassol
Exp $
+ * @version $Id: AutoReadHttpURLConnection.java,v 1.14 2002/01/27 20:00:38 vmassol
Exp $
*/
final class AutoReadHttpURLConnection extends HttpURLConnection
{
@@ -153,7 +158,7 @@
new ByteArrayOutputStream(DEFAULT_CHUNK_SIZE);
copy(theInputStream, os);
ByteArrayInputStream bais =
- new ByteArrayInputStream(os.toByteArray());
+ new ByteArrayInputStream(os.toByteArray());
return bais;
}
@@ -175,7 +180,7 @@
byte[] buf = new byte[DEFAULT_CHUNK_SIZE];
int count;
- while(-1 != (count = theInputStream.read(buf))) {
+ while (-1 != (count = theInputStream.read(buf))) {
// log read data
printReadLogs(count, buf);
@@ -204,7 +209,7 @@
} else if (theBuffer[i] == 13) {
prefix.append("\\n");
} else {
- prefix.append((char)theBuffer[i]);
+ prefix.append((char) theBuffer[i]);
}
}
@@ -215,7 +220,7 @@
} else if (theBuffer[i] == 13) {
suffix.append("\\n");
} else {
- suffix.append((char)theBuffer[i]);
+ suffix.append((char) theBuffer[i]);
}
}
@@ -228,71 +233,113 @@
// Delegated methods
+ /**
+ * @see java.net.HttpURLConnection.connect()
+ */
public void connect() throws IOException
{
this.delegate.connect();
}
+ /**
+ * @see java.net.HttpURLConnection.getAllowUserInteraction()
+ */
public boolean getAllowUserInteraction()
{
return this.delegate.getAllowUserInteraction();
}
+ /**
+ * @see java.net.HttpURLConnection.getContent()
+ */
public Object getContent() throws IOException
{
return this.delegate.getContent();
}
+ /**
+ * @see java.net.HttpURLConnection.getContentEncoding()
+ */
public String getContentEncoding()
{
return this.delegate.getContentEncoding();
}
+ /**
+ * @see java.net.HttpURLConnection.getContentLength()
+ */
public int getContentLength()
{
return this.delegate.getContentLength();
}
+ /**
+ * @see java.net.HttpURLConnection.getContentType()
+ */
public String getContentType()
{
return this.delegate.getContentType();
}
+ /**
+ * @see java.net.HttpURLConnection.getDate()
+ */
public long getDate()
{
return this.delegate.getDate();
}
+ /**
+ * @see java.net.HttpURLConnection.getDefaultUseCaches()
+ */
public boolean getDefaultUseCaches()
{
- return this.delegate.getDefaultUseCaches();
+ return this.delegate.getDefaultUseCaches();
}
+ /**
+ * @see java.net.HttpURLConnection.getDoInput()
+ */
public boolean getDoInput()
{
return this.delegate.getDoInput();
}
+ /**
+ * @see java.net.HttpURLConnection.getDoOutput()
+ */
public boolean getDoOutput()
{
return this.delegate.getDoOutput();
}
+ /**
+ * @see java.net.HttpURLConnection.getExpiration()
+ */
public long getExpiration()
{
return this.delegate.getExpiration();
}
+ /**
+ * @see java.net.HttpURLConnection.getHeaderField(int)
+ */
public String getHeaderField(int a0)
{
return this.delegate.getHeaderField(a0);
}
+ /**
+ * @see java.net.HttpURLConnection.getHeaderField(String)
+ */
public String getHeaderField(String a0)
{
return this.delegate.getHeaderField(a0);
}
+ /**
+ * @see java.net.HttpURLConnection.getHeaderFieldDate(String, int)
+ */
public long getHeaderFieldDate(String a0, long a1)
{
return this.delegate.getHeaderFieldDate(a0, a1);
1.3 +1 -7
jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/AbstractAuthentication.java
Index: AbstractAuthentication.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/AbstractAuthentication.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AbstractAuthentication.java 27 Jan 2002 19:52:02 -0000 1.2
+++ AbstractAuthentication.java 27 Jan 2002 20:00:38 -0000 1.3
@@ -69,7 +69,7 @@
* @author <a href="mailto:[EMAIL PROTECTED]">Vincent Massol</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Jason Robertson</a>
*
- * @version $Id: AbstractAuthentication.java,v 1.2 2002/01/27 19:52:02 vmassol Exp $
+ * @version $Id: AbstractAuthentication.java,v 1.3 2002/01/27 20:00:38 vmassol Exp $
*/
public abstract class AbstractAuthentication
{
@@ -106,14 +106,8 @@
this.password = thePassword;
}
- /**
- * @exception IllegalArgumentException if invalid
- */
protected abstract void validateUserId(String theUserId);
- /**
- * @exception IllegalArgumentException if invalid
- */
protected abstract void validatePassword(String thePassword);
public abstract void configure(HttpURLConnection theConnection);
1.4 +19 -25
jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/BasicAuthentication.java
Index: BasicAuthentication.java
===================================================================
RCS file:
/home/cvs/jakarta-cactus/src/framework/share/org/apache/cactus/client/authentication/BasicAuthentication.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BasicAuthentication.java 27 Jan 2002 19:52:02 -0000 1.3
+++ BasicAuthentication.java 27 Jan 2002 20:00:38 -0000 1.4
@@ -80,8 +80,7 @@
// Validate the given userid
// The userid is optional, it can be blank.
- if (userid == null)
- {
+ if (userid == null) {
return;
}
@@ -91,10 +90,10 @@
StringCharacterIterator iter = new StringCharacterIterator(userid);
for (char c = iter.first(); c != CharacterIterator.DONE;
- c = iter.next()) {
+ c = iter.next()) {
if ((illegalChars.indexOf(c) != -1) ||
- ((c >=0 ) && (c <= 31)) ||
+ ((c >= 0) && (c <= 31)) ||
(c == 127)) {
// Bad userid! Go to your room!
@@ -121,8 +120,7 @@
// Validate the given password
// The password can have zero characters, i.e. be blank.
- if (password == null)
- {
+ if (password == null) {
return;
}
@@ -132,10 +130,9 @@
StringCharacterIterator iter = new StringCharacterIterator(password);
for (char c = iter.first(); c != CharacterIterator.DONE; c = iter.next()) {
- if (((c >=0 ) && (c <= 31)) || (c == 127)) {
+ if (((c >= 0) && (c <= 31)) || (c == 127)) {
- if (exceptionChars.indexOf(c) != -1 )
- {
+ if (exceptionChars.indexOf(c) != -1) {
continue;
}
@@ -178,17 +175,17 @@
static
{
- for (int i=0; i<256; i++) {
+ for (int i = 0; i < 256; i++) {
codes[i] = -1;
}
for (int i = 'A'; i <= 'Z'; i++) {
- codes[i] = (byte)( i - 'A');
+ codes[i] = (byte) (i - 'A');
}
for (int i = 'a'; i <= 'z'; i++) {
- codes[i] = (byte)(26 + i - 'a');
+ codes[i] = (byte) (26 + i - 'a');
}
for (int i = '0'; i <= '9'; i++) {
- codes[i] = (byte)(52 + i - '0');
+ codes[i] = (byte) (52 + i - '0');
}
codes['+'] = 62;
codes['/'] = 63;
@@ -209,38 +206,35 @@
// 3 bytes encode to 4 chars. Output is always an even
// multiple of 4 characters.
//
- for (int i=0, index=0; i<data.length; i+=3, index+=4)
- {
+ for (int i = 0, index = 0; i < data.length; i += 3, index += 4) {
boolean quad = false;
boolean trip = false;
int val = (0xFF & (int) data[i]);
val <<= 8;
- if ((i+1) < data.length)
- {
- val |= (0xFF & (int) data[i+1]);
+ if ((i + 1) < data.length) {
+ val |= (0xFF & (int) data[i + 1]);
trip = true;
}
val <<= 8;
- if ((i+2) < data.length)
- {
- val |= (0xFF & (int) data[i+2]);
+ if ((i + 2) < data.length) {
+ val |= (0xFF & (int) data[i + 2]);
quad = true;
}
- out[index+3] = alphabet[(quad? (val & 0x3F): 64)];
+ out[index + 3] = alphabet[(quad ? (val & 0x3F): 64)];
val >>= 6;
- out[index+2] = alphabet[(trip? (val & 0x3F): 64)];
+ out[index + 2] = alphabet[(trip ? (val & 0x3F): 64)];
val >>= 6;
- out[index+1] = alphabet[val & 0x3F];
+ out[index + 1] = alphabet[val & 0x3F];
val >>= 6;
- out[index+0] = alphabet[val & 0x3F];
+ out[index + 0] = alphabet[val & 0x3F];
}
return out;
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>