Imported GNU Classpath 0.92

2006-08-14  Mark Wielaard  <mark@klomp.org>

       Imported GNU Classpath 0.92
       * HACKING: Add more importing hints. Update automake version
       requirement.

       * configure.ac (gconf-peer): New enable AC argument.
       Add --disable-gconf-peer and --enable-default-preferences-peer
       to classpath configure when gconf is disabled.
       * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and
       gnu/java/awt/dnd/peer/gtk to bc. Classify
       gnu/java/security/Configuration.java as generated source file.

       * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java,
       gnu/java/lang/management/VMClassLoadingMXBeanImpl.java,
       gnu/java/lang/management/VMRuntimeMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java,
       gnu/java/lang/management/VMThreadMXBeanImpl.java,
       gnu/java/lang/management/VMMemoryMXBeanImpl.java,
       gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub
       classes.
       * java/lang/management/VMManagementFactory.java: Likewise.
       * java/net/VMURLConnection.java: Likewise.
       * gnu/java/nio/VMChannel.java: Likewise.

       * java/lang/Thread.java (getState): Add stub implementation.
       * java/lang/Class.java (isEnum): Likewise.
       * java/lang/Class.h (isEnum): Likewise.

       * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed.

       * javax/naming/spi/NamingManager.java: New override for StackWalker
       functionality.

       * configure, sources.am, Makefile.in, gcj/Makefile.in,
       include/Makefile.in, testsuite/Makefile.in: Regenerated.

From-SVN: r116139
This commit is contained in:
Mark Wielaard 2006-08-14 23:12:35 +00:00
parent abab460491
commit ac1ed908de
1294 changed files with 99479 additions and 35933 deletions

View file

@ -38,11 +38,12 @@ exception statement from your version. */
package gnu.javax.crypto.sasl;
import gnu.java.security.Configuration;
import gnu.java.security.util.Util;
import java.io.OutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.OutputStream;
import java.util.logging.Logger;
import javax.security.sasl.Sasl;
import javax.security.sasl.SaslClient;
@ -52,51 +53,23 @@ import javax.security.sasl.SaslServer;
* An output stream that uses either a {@link SaslClient} or a {@link SaslServer}
* to process the data through these entities' security layer filter(s).
*/
public class SaslOutputStream extends OutputStream
public class SaslOutputStream
extends OutputStream
{
// Debugging methods and variables
// -------------------------------------------------------------------------
private static final String NAME = "SaslOutputStream";
// private static final String ERROR = "ERROR";
// private static final String WARN = " WARN";
// private static final String INFO = " INFO";
private static final String TRACE = "DEBUG";
private static final boolean DEBUG = true;
private static final int debuglevel = 3;
private static final PrintWriter err = new PrintWriter(System.out, true);
private static void debug(String level, Object obj)
{
err.println("[" + level + "] " + NAME + ": " + String.valueOf(obj));
}
// Constants and variables
// -------------------------------------------------------------------------
private static final Logger log = Logger.getLogger(SaslOutputStream.class.getName());
private SaslClient client;
private SaslServer server;
private int maxRawSendSize;
private OutputStream dest;
// Constructor(s)
// -------------------------------------------------------------------------
public SaslOutputStream(SaslClient client, OutputStream dest)
throws IOException
{
super();
this.client = client;
maxRawSendSize = Integer.parseInt((String) client.getNegotiatedProperty(Sasl.RAW_SEND_SIZE));
String size = (String) client.getNegotiatedProperty(Sasl.RAW_SEND_SIZE);
maxRawSendSize = Integer.parseInt(size);
server = null;
this.dest = dest;
}
@ -107,17 +80,12 @@ public class SaslOutputStream extends OutputStream
super();
this.server = server;
maxRawSendSize = Integer.parseInt((String) server.getNegotiatedProperty(Sasl.RAW_SEND_SIZE));
String size = (String) server.getNegotiatedProperty(Sasl.RAW_SEND_SIZE);
maxRawSendSize = Integer.parseInt(size);
client = null;
this.dest = dest;
}
// Class methods
// -------------------------------------------------------------------------
// Overloaded java.io.OutputStream methods
// -------------------------------------------------------------------------
public void close() throws IOException
{
dest.flush();
@ -148,71 +116,60 @@ public class SaslOutputStream extends OutputStream
*/
public void write(byte[] b, int off, int len) throws IOException
{
if (b == null)
{
throw new NullPointerException("b");
}
if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "write");
if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length)
|| ((off + len) < 0))
{
throw new IndexOutOfBoundsException("off=" + String.valueOf(off)
+ ", len=" + String.valueOf(len)
+ ", b.length="
+ String.valueOf(b.length));
}
throw new IndexOutOfBoundsException("off=" + off + ", len=" + len
+ ", b.length=" + b.length);
if (len == 0)
{
if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "write");
return;
}
if (DEBUG && debuglevel > 8)
debug(TRACE, "==> write()");
int chunckSize, length, chunck = 1;
byte[] output = null, result;
if (DEBUG && debuglevel > 6)
debug(TRACE, "About to wrap " + String.valueOf(len) + " byte(s)...");
if (Configuration.DEBUG)
log.finer("About to wrap " + len + " byte(s)...");
while (len > 0)
{
chunckSize = (len > maxRawSendSize ? maxRawSendSize : len);
if (DEBUG && debuglevel > 6)
debug(TRACE, "Outgoing buffer (before security) (hex): "
+ Util.dumpString(b, off, chunckSize));
if (DEBUG && debuglevel > 6)
debug(TRACE, "Outgoing buffer (before security) (str): \""
+ new String(b, off, chunckSize) + "\"");
if (Configuration.DEBUG)
{
log.finer("Outgoing buffer (before security) (hex): "
+ Util.dumpString(b, off, chunckSize));
log.finer("Outgoing buffer (before security) (str): \""
+ new String(b, off, chunckSize) + "\"");
}
if (client != null)
output = client.wrap(b, off, chunckSize);
else
output = server.wrap(b, off, chunckSize);
if (DEBUG && debuglevel > 6)
debug(TRACE, "Outgoing buffer (after security) (hex): "
+ Util.dumpString(output));
if (DEBUG && debuglevel > 6)
debug(TRACE, "Outgoing buffer (after security) (str): \""
+ new String(output) + "\"");
if (Configuration.DEBUG)
{
log.finer("Outgoing buffer (after security) (hex): "
+ Util.dumpString(output));
log.finer("Outgoing buffer (after security) (str): \""
+ new String(output) + "\"");
}
length = output.length;
result = new byte[length + 4];
result[0] = (byte) (length >>> 24);
result[1] = (byte) (length >>> 16);
result[2] = (byte) (length >>> 8);
result[0] = (byte)(length >>> 24);
result[1] = (byte)(length >>> 16);
result[2] = (byte)(length >>> 8);
result[3] = (byte) length;
System.arraycopy(output, 0, result, 4, length);
dest.write(result);
off += chunckSize;
len -= chunckSize;
if (DEBUG && debuglevel > 6)
debug(TRACE, "Wrapped chunck #" + String.valueOf(chunck));
if (Configuration.DEBUG)
log.finer("Wrapped chunck #" + chunck);
chunck++;
}
dest.flush();
if (DEBUG && debuglevel > 8)
debug(TRACE, "<== write()");
if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "write");
}
}
}