|
From: <ls...@us...> - 2007-01-07 08:25:34
|
Revision: 3007
http://jnode.svn.sourceforge.net/jnode/?rev=3007&view=rev
Author: lsantha
Date: 2007-01-07 00:25:33 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/javax/javax/sql/RowSet.java
trunk/core/src/classpath/javax/javax/swing/border/CompoundBorder.java
Modified: trunk/core/src/classpath/javax/javax/sql/RowSet.java
===================================================================
--- trunk/core/src/classpath/javax/javax/sql/RowSet.java 2007-01-07 08:25:14 UTC (rev 3006)
+++ trunk/core/src/classpath/javax/javax/sql/RowSet.java 2007-01-07 08:25:33 UTC (rev 3007)
@@ -78,9 +78,9 @@
void setTransactionIsolation(int level) throws SQLException;
- Map getTypeMap() throws SQLException;
+ Map<String, Class<?>> getTypeMap() throws SQLException;
- void setTypeMap(Map map) throws SQLException;
+ void setTypeMap(Map<String, Class<?>> map) throws SQLException;
String getCommand();
Modified: trunk/core/src/classpath/javax/javax/swing/border/CompoundBorder.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/border/CompoundBorder.java 2007-01-07 08:25:14 UTC (rev 3006)
+++ trunk/core/src/classpath/javax/javax/swing/border/CompoundBorder.java 2007-01-07 08:25:33 UTC (rev 3007)
@@ -115,15 +115,24 @@
*/
public boolean isBorderOpaque()
{
- // While it would be safe to assume true for the opacity of
- // a null border, this behavior would not be according to
- // the API specification. Also, it is pathological to have
- // null borders anyway.
- if ((insideBorder == null) || (outsideBorder == null))
- return false;
+ // Although the API specification states that this method
+ // returns true if both the inside and outside borders are non-null
+ // and opaque, and false otherwise, a mauve test shows that if both
+ // the inside or outside borders are null, then true is returned.
+ if ((insideBorder == null) && (outsideBorder == null))
+ return true;
- return insideBorder.isBorderOpaque()
- && outsideBorder.isBorderOpaque();
+ // A mauve test shows that if the inside border has a null value,
+ // then true is returned if the outside border is opaque; if the
+ // outside border has a null value, then true is returned if the
+ // inside border is opaque; else, true is returned if both the
+ // inside and outside borders are opaque.
+ if (insideBorder == null)
+ return outsideBorder.isBorderOpaque();
+ else if (outsideBorder == null)
+ return insideBorder.isBorderOpaque();
+ else
+ return insideBorder.isBorderOpaque() && outsideBorder.isBorderOpaque();
}
/**
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-01-07 12:57:58
|
Revision: 3025
http://jnode.svn.sourceforge.net/jnode/?rev=3025&view=rev
Author: lsantha
Date: 2007-01-07 04:57:57 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/javax/javax/crypto/CipherOutputStream.java
trunk/core/src/classpath/javax/javax/crypto/Mac.java
trunk/core/src/classpath/javax/javax/crypto/MacSpi.java
trunk/core/src/classpath/javax/javax/net/ssl/HandshakeCompletedEvent.java
trunk/core/src/classpath/javax/javax/net/ssl/HttpsURLConnection.java
trunk/core/src/classpath/javax/javax/net/ssl/SSLContext.java
trunk/core/src/classpath/javax/javax/net/ssl/SSLContextSpi.java
trunk/core/src/classpath/javax/javax/net/ssl/SSLServerSocketFactory.java
trunk/core/src/classpath/javax/javax/net/ssl/SSLSession.java
trunk/core/src/classpath/javax/javax/net/ssl/SSLSocketFactory.java
Added Paths:
-----------
trunk/core/src/classpath/javax/javax/management/MBeanServerPermission.java
trunk/core/src/classpath/javax/javax/net/ssl/CertPathTrustManagerParameters.java
trunk/core/src/classpath/javax/javax/net/ssl/KeyStoreBuilderParameters.java
trunk/core/src/classpath/javax/javax/net/ssl/SSLEngine.java
trunk/core/src/classpath/javax/javax/net/ssl/SSLEngineResult.java
trunk/core/src/classpath/javax/javax/net/ssl/X509ExtendedKeyManager.java
trunk/core/src/classpath/javax/javax/swing/text/html/CSSParser.java
Modified: trunk/core/src/classpath/javax/javax/crypto/CipherOutputStream.java
===================================================================
--- trunk/core/src/classpath/javax/javax/crypto/CipherOutputStream.java 2007-01-07 12:55:51 UTC (rev 3024)
+++ trunk/core/src/classpath/javax/javax/crypto/CipherOutputStream.java 2007-01-07 12:57:57 UTC (rev 3025)
@@ -50,33 +50,12 @@
*/
public class CipherOutputStream extends FilterOutputStream
{
-
- // Fields.
- // ------------------------------------------------------------------------
-
/** The underlying cipher. */
private Cipher cipher;
- private byte[][] inBuffer;
-
- private int inLength;
-
- private byte[] outBuffer;
-
- private static final int FIRST_TIME = 0;
- private static final int SECOND_TIME = 1;
- private static final int SEASONED = 2;
- private int state;
-
- /** True if the cipher is a stream cipher (blockSize == 1) */
- private boolean isStream;
-
- // Constructors.
- // ------------------------------------------------------------------------
-
/**
- * Create a new cipher output stream. The cipher argument must have
- * already been initialized.
+ * Create a new cipher output stream. The cipher argument must have already
+ * been initialized.
*
* @param out The sink for transformed data.
* @param cipher The cipher to transform data with.
@@ -84,20 +63,7 @@
public CipherOutputStream(OutputStream out, Cipher cipher)
{
super(out);
- if (cipher != null)
- {
- this.cipher = cipher;
- if (!(isStream = cipher.getBlockSize() == 1))
- {
- inBuffer = new byte[2][];
- inBuffer[0] = new byte[cipher.getBlockSize()];
- inBuffer[1] = new byte[cipher.getBlockSize()];
- inLength = 0;
- state = FIRST_TIME;
- }
- }
- else
- this.cipher = new NullCipher();
+ this.cipher = (cipher != null) ? cipher : new NullCipher();
}
/**
@@ -110,52 +76,36 @@
super(out);
}
- // Instance methods.
- // ------------------------------------------------------------------------
-
/**
* Close this output stream, and the sink output stream.
+ * <p>
+ * This method will first invoke the {@link Cipher#doFinal()} method of the
+ * underlying {@link Cipher}, and writes the output of that method to the
+ * sink output stream.
*
- * <p>This method will first invoke the {@link Cipher#doFinal()}
- * method of the underlying {@link Cipher}, and writes the output of
- * that method to the sink output stream.
- *
- * @throws java.io.IOException If an I/O error occurs, or if an error
- * is caused by finalizing the transformation.
+ * @throws IOException If an I/O error occurs, or if an error is caused by
+ * finalizing the transformation.
*/
public void close() throws IOException
{
try
{
- int len;
- if (state != FIRST_TIME)
- {
- len = cipher.update(inBuffer[0], 0, inBuffer[0].length, outBuffer);
- out.write(outBuffer, 0, len);
- }
- len = cipher.doFinal(inBuffer[0], 0, inLength, outBuffer);
- out.write(outBuffer, 0, len);
+ out.write(cipher.doFinal());
+ out.flush();
+ out.close();
}
- catch (javax.crypto.IllegalBlockSizeException ibse)
+ catch (Exception cause)
{
- throw new IOException(ibse.toString());
+ IOException ioex = new IOException(String.valueOf(cause));
+ ioex.initCause(cause);
+ throw ioex;
}
- catch (javax.crypto.BadPaddingException bpe)
- {
- throw new IOException(bpe.toString());
- }
- catch (ShortBufferException sbe)
- {
- throw new IOException(sbe.toString());
- }
- out.flush();
- out.close();
}
/**
* Flush any pending output.
*
- * @throws java.io.IOException If an I/O error occurs.
+ * @throws IOException If an I/O error occurs.
*/
public void flush() throws IOException
{
@@ -166,38 +116,20 @@
* Write a single byte to the output stream.
*
* @param b The next byte.
- * @throws java.io.IOException If an I/O error occurs, or if the
- * underlying cipher is not in the correct state to transform
- * data.
+ * @throws IOException If an I/O error occurs, or if the underlying cipher is
+ * not in the correct state to transform data.
*/
public void write(int b) throws IOException
{
- if (isStream)
- {
- byte[] buf = new byte[] { (byte) b };
- try
- {
- cipher.update(buf, 0, 1, buf, 0);
- }
- catch (ShortBufferException sbe)
- {
- throw new IOException(sbe.toString());
- }
- out.write(buf);
- return;
- }
- inBuffer[1][inLength++] = (byte) b;
- if (inLength == inBuffer[1].length)
- process();
+ write(new byte[] { (byte) b }, 0, 1);
}
/**
* Write a byte array to the output stream.
*
* @param buf The next bytes.
- * @throws java.io.IOException If an I/O error occurs, or if the
- * underlying cipher is not in the correct state to transform
- * data.
+ * @throws IOException If an I/O error occurs, or if the underlying cipher is
+ * not in the correct state to transform data.
*/
public void write(byte[] buf) throws IOException
{
@@ -210,59 +142,11 @@
* @param buf The next bytes.
* @param off The offset in the byte array to start.
* @param len The number of bytes to write.
- * @throws java.io.IOException If an I/O error occurs, or if the
- * underlying cipher is not in the correct state to transform
- * data.
+ * @throws IOException If an I/O error occurs, or if the underlying cipher is
+ * not in the correct state to transform data.
*/
public void write(byte[] buf, int off, int len) throws IOException
{
- if (isStream)
- {
out.write(cipher.update(buf, off, len));
- return;
- }
- int count = 0;
- while (count < len)
- {
- int l = Math.min(inBuffer[1].length - inLength, len - count);
- System.arraycopy(buf, off+count, inBuffer[1], inLength, l);
- count += l;
- inLength += l;
- if (inLength == inBuffer[1].length)
- process();
- }
}
-
- // Own method.
- // -------------------------------------------------------------------------
-
- private void process() throws IOException
- {
- if (state == SECOND_TIME)
- {
- state = SEASONED;
- }
- else
- {
- byte[] temp = inBuffer[0];
- inBuffer[0] = inBuffer[1];
- inBuffer[1] = temp;
- }
- if (state == FIRST_TIME)
- {
- inLength = 0;
- state = SECOND_TIME;
- return;
- }
- try
- {
- cipher.update(inBuffer[0], 0, inBuffer[0].length, outBuffer);
- }
- catch (ShortBufferException sbe)
- {
- throw new IOException(sbe.toString());
- }
- out.write(outBuffer);
- inLength = 0;
- }
}
Modified: trunk/core/src/classpath/javax/javax/crypto/Mac.java
===================================================================
--- trunk/core/src/classpath/javax/javax/crypto/Mac.java 2007-01-07 12:55:51 UTC (rev 3024)
+++ trunk/core/src/classpath/javax/javax/crypto/Mac.java 2007-01-07 12:57:57 UTC (rev 3025)
@@ -41,6 +41,7 @@
import gnu.java.security.Engine;
import java.lang.reflect.InvocationTargetException;
+import java.nio.ByteBuffer;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
@@ -406,6 +407,18 @@
}
/**
+ * Update this MAC with the remaining bytes in the given buffer
+ * @param buffer The input buffer.
+ * @since 1.5
+ */
+ public final void update (final ByteBuffer buffer)
+ {
+ if (virgin)
+ throw new IllegalStateException ("not initialized");
+ macSpi.engineUpdate(buffer);
+ }
+
+ /**
* Clone this instance, if the underlying implementation supports it.
*
* @return A clone of this instance.
Modified: trunk/core/src/classpath/javax/javax/crypto/MacSpi.java
===================================================================
--- trunk/core/src/classpath/javax/javax/crypto/MacSpi.java 2007-01-07 12:55:51 UTC (rev 3024)
+++ trunk/core/src/classpath/javax/javax/crypto/MacSpi.java 2007-01-07 12:57:57 UTC (rev 3025)
@@ -38,6 +38,7 @@
package javax.crypto;
+import java.nio.ByteBuffer;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.Key;
@@ -142,4 +143,21 @@
* @param length The number of bytes to update.
*/
protected abstract void engineUpdate(byte[] input, int offset, int length);
+
+ /**
+ * Update this MAC with the remaining bytes of a buffer.
+ *
+ * @param buffer The input buffer.
+ * @since 1.5
+ */
+ protected void engineUpdate (final ByteBuffer buffer)
+ {
+ byte[] buf = new byte[1024];
+ while (buffer.hasRemaining ())
+ {
+ int n = Math.min (buffer.remaining (), buf.length);
+ buffer.get (buf, 0, n);
+ engineUpdate (buf, 0, n);
+ }
+ }
}
Added: trunk/core/src/classpath/javax/javax/management/MBeanServerPermission.java
===================================================================
--- trunk/core/src/classpath/javax/javax/management/MBeanServerPermission.java (rev 0)
+++ trunk/core/src/classpath/javax/javax/management/MBeanServerPermission.java 2007-01-07 12:57:57 UTC (rev 3025)
@@ -0,0 +1,470 @@
+/* MBeanServerPermission.java -- Permissions controlling server creation.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+package javax.management;
+
+import java.security.BasicPermission;
+import java.security.Permission;
+import java.security.PermissionCollection;
+
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * <p>
+ * Represents the permissions required to perform
+ * operations provided by the {@link MBeanServerFactory}.
+ * As with all {@link java.security.Permission} objects, an
+ * instance of this class either represents a permission
+ * already held or one that is required to access a
+ * particular service. In the case of {@link MBeanServerPermission}s,
+ * implication checks are made using an instance of this class
+ * when a user requests an operation from the factory, and a
+ * {@link SecurityManager} is in place.
+ * </p>
+ * <p>
+ * The permission is defined by its name, which may be
+ * either a <code>'*'</code> (to allow all) or one or
+ * more of the following, separated by a <code>','</code>:
+ * </p>
+ * <ul>
+ * <li><code>createMBeanServer</code> -- allows a registered
+ * instance of a server to be obtained from the factory.</li>
+ * <li><code>findMBeanServer</code> -- allows all or one
+ * particular server instance to be retrieved from the factory.</li>
+ * <li><code>newMBeanServer</code> -- allows an unregistered
+ * instance of a server to be obtained from the factory.</li>
+ * <li><code>releaseMBeanServer</code> -- allows a reference to
+ * a server instance to be removed from the factory.</li>
+ * </ul>
+ * <p>
+ * The names may be surrounded by arbitrary amounts of whitespace.
+ * <code>createMBeanServer</code> implies <code>newMBeanServer</code>.
+ * </p>
+ *
+ * @author Andrew John Hughes (gnu...@me...)
+ * @since 1.5
+ */
+public class MBeanServerPermission
+ extends BasicPermission
+{
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = -5661980843569388590L;
+
+ /**
+ * <p>
+ * Constructs a new {@link MBeanServerPermission} with
+ * the given name. The name must not be <code>null</code>
+ * and must be equal to either <code>"*"</code> or a
+ * comma-separated list of valid permissions. The four
+ * valid constraints are:
+ * </p>
+ * <ol>
+ * <li><code>createMBeanServer</code></li>
+ * <li><code>findMBeanServer</code></li>
+ * <li><code>newMBeanServer</code></li>
+ * <li><code>releaseMBeanServer</code></li>
+ * </ol>
+ * <p>
+ * Calling this constructor is equivalent to calling
+ * <code>MBeanPermission(name, null)</code>.
+ * </p>
+ *
+ * @param name the name of this permission.
+ * @throws NullPointerException if <code>name</code>
+ * is <code>null</code>.
+ * @throws IllegalArgumentException if <code>name</code>
+ * is not either equal to
+ * <code>"*"</code> or forms
+ * a comma-separated list of
+ * valid constraints.
+ * @see #MBeanServerPermission(String,String)
+ */
+ public MBeanServerPermission(String name)
+ {
+ this(name, null);
+ }
+
+ /**
+ * <p>
+ * Constructs a new {@link MBeanServerPermission} with
+ * the given name and actions. The actions are unused,
+ * and must be either <code>null</code> or the empty
+ * string. The name must not be <code>null</code>
+ * and must be equal to either <code>"*"</code> or a
+ * comma-separated list of valid permissions. The four
+ * valid constraints are:
+ * </p>
+ * <ol>
+ * <li><code>createMBeanServer</code></li>
+ * <li><code>findMBeanServer</code></li>
+ * <li><code>newMBeanServer</code></li>
+ * <li><code>releaseMBeanServer</code></li>
+ * </ol>
+ * <p>
+ * Calling this constructor is equivalent to calling
+ * <code>MBeanPermission(name, null)</code>.
+ * </p>
+ *
+ * @param name the name of this permission.
+ * @throws NullPointerException if <code>name</code>
+ * is <code>null</code>.
+ * @throws IllegalArgumentException if <code>name</code>
+ * is not either equal to
+ * <code>"*"</code> or forms
+ * a comma-separated list of
+ * valid constraints, or if
+ * <code>actions</code> is not
+ * <code>null</code> or the
+ * empty string.
+ * @see #MBeanServerPermission(String,String)
+ */
+ public MBeanServerPermission(String name, String actions)
+ {
+ super(checkName(name), actions);
+ if (actions != null && actions.length() > 0)
+ throw new IllegalArgumentException("The supplied action list " +
+ "was not equal to null or the " +
+ "empty string.");
+ }
+
+ /**
+ * Returns true if the given object is also an {@link MBeanServerPermission}
+ * with the same name.
+ *
+ * @param obj the object to compare with this one.
+ * @return true if the object is an {@link MBeanPermission}
+ * with the same name.
+ */
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof MBeanServerPermission)
+ {
+ MBeanServerPermission o = (MBeanServerPermission) obj;
+ return o.getName().equals(getName());
+ }
+ return false;
+ }
+
+ /**
+ * Returns a unique hash code for this permission.
+ * This is simply the hashcode of {@link BasicPermission#getName()}.
+ *
+ * @return the hashcode of this permission.
+ */
+ public int hashCode()
+ {
+ return getName().hashCode();
+ }
+
+ /**
+ * Returns true if this {@link MBeanServerPermission} implies
+ * the given permission. This occurs if the given permission
+ * is also an {@link MBeanServerPermission} and its target names
+ * are a subset of the target names of this permission. Note that
+ * the name <code>createMBeanServer</code> implies
+ * <code>newMBeanServer</code>.
+ *
+ * @param p the permission to check for implication.
+ * @return true if this permission implies <code>p</code>.
+ */
+ public boolean implies(Permission p)
+ {
+ if (p instanceof MBeanServerPermission)
+ {
+ if (getName().equals("*"))
+ return true;
+ MBeanServerPermission msp = (MBeanServerPermission) p;
+ String[] thisCaps = getName().split(",");
+ String[] mspCaps = msp.getName().split(",");
+ for (int a = 0; a < mspCaps.length; ++a)
+ {
+ boolean found = false;
+ String mc = mspCaps[a].trim();
+ for (int b = 0; b < thisCaps.length; ++b)
+ {
+ String tc = thisCaps[b].trim();
+ if (tc.equals(mc))
+ found = true;
+ if (tc.equals("createMBeanServer") &&
+ mc.equals("newMBeanServer"))
+ found = true;
+ }
+ if (!found)
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Returns a {@link PermissionCollection} which stores
+ * a series of {@link MBeanServerPermission}s as the union
+ * of their capabilities.
+ *
+ * @return a collection for {@link MBeanServerPermission}s.
+ */
+ public PermissionCollection newPermissionCollection()
+ {
+ return new MBeanServerPermissionCollection();
+ }
+
+ /**
+ * A collection of {@link MBeanServerPermission}s, stored
+ * as a single permission with the union of the capabilities
+ * as its capabilities.
+ *
+ * @author Andrew John Hughes (gnu...@me...)
+ * @since 1.5
+ */
+ private class MBeanServerPermissionCollection
+ extends PermissionCollection
+ {
+
+ /**
+ * Compatible with JDK 1.5
+ */
+ private static final long serialVersionUID = -5661980843569388590L;
+
+ /**
+ * The collected permission. This is <code>null</code> or
+ * the union of the permissions held by all the collected
+ * permissions.
+ */
+ private MBeanServerPermission collectionPermission;
+
+ /**
+ * Adds a new permission by unifying it with the existing
+ * collection permission.
+ *
+ * @param p the permission to add.
+ * @throws SecurityException if the collection is read only.
+ * @see #isReadOnly()
+ * @see #setReadOnly(boolean)
+ */
+ public void add(Permission p)
+ {
+ if (isReadOnly())
+ throw new SecurityException("This collection is read only.");
+ if (p instanceof MBeanServerPermission)
+ {
+ MBeanServerPermission msp = (MBeanServerPermission) p;
+ if (collectionPermission == null)
+ collectionPermission = msp;
+ else
+ {
+ String finalString = collectionPermission.getName();
+ String[] cp = finalString.split(",");
+ String[] np = msp.getName().split(",");
+ int createms = finalString.indexOf("createMBeanServer");
+ int newms = finalString.indexOf("newMBeanServer");
+ for (int a = 0; a < np.length; ++a)
+ {
+ boolean found = false;
+ String nps = np[a].trim();
+ for (int b = 0; b < cp.length; ++b)
+ {
+ String cps = cp[b].trim();
+ if (cps.equals(nps))
+ found = true;
+ if (np.equals("newMBeanServer")
+ && createms != -1)
+ found = true;
+ if (np.equals("createMBeanServer")
+ && newms != -1)
+ finalString.replace("newMBeanServer",
+ "createMBeanServer");
+ }
+ if (!found)
+ finalString += "," + nps;
+ }
+ collectionPermission =
+ new MBeanServerPermission(finalString);
+ }
+ }
+ }
+
+ /**
+ * Returns an enumeration over the single permission.
+ *
+ * @return an enumeration over the collection permission.
+ */
+ public Enumeration elements()
+ {
+ return new
+ MBeanServerPermissionEnumeration(collectionPermission);
+ }
+
+ /**
+ * Provides an enumeration over a comma-separated list
+ * of capabilities.
+ *
+ * @author Andrew John Hughes (gnu...@me...)
+ * @since 1.5
+ */
+ private class MBeanServerPermissionEnumeration
+ implements Enumeration
+ {
+
+ /**
+ * The collected permission.
+ */
+ private MBeanServerPermission p;
+
+ /**
+ * True if we have returned the permission.
+ */
+ private boolean done;
+
+ /**
+ * Constructs a new {@link MBeanServerPermissionEnumeration}
+ * using the given collected permission.
+ *
+ * @param p the collected permission.
+ */
+ public MBeanServerPermissionEnumeration(MBeanServerPermission p)
+ {
+ this.p = p;
+ done = false;
+ }
+
+ /**
+ * Returns true if there are more capabilities to return.
+ *
+ * @return true if there are more capabilities available.
+ */
+ public boolean hasMoreElements()
+ {
+ return !done;
+ }
+
+ /**
+ * Returns the next capability.
+ *
+ * @return the next capability.
+ */
+ public Object nextElement()
+ {
+ if (hasMoreElements())
+ {
+ done = true;
+ return p;
+ }
+ else
+ throw new NoSuchElementException("No more elements are available.");
+ }
+
+ }
+
+ /**
+ * Returns true if the collected {@link MBeanServerPermission}
+ * implies the given permission. This occurs if the given permission
+ * is also an {@link MBeanServerPermission} and its target names
+ * are a subset of the target names of this permission. Note that
+ * the name <code>createMBeanServer</code> implies
+ * <code>newMBeanServer</code>.
+ *
+ * @param p the permission to check for implication.
+ * @return true if this permission implies <code>p</code>.
+ */
+ public boolean implies(Permission p)
+ {
+ return collectionPermission.implies(p);
+ }
+ }
+
+ /**
+ * Checks the name is valid, including removing
+ * the <code>newMBeanServer</code> permission when
+ * <code>createMBeanServer</code> is present.
+ *
+ * @param name the name to check.
+ * @throws NullPointerException if <code>name</code>
+ * is <code>null</code>.
+ * @throws IllegalArgumentException if <code>name</code>
+ * is not either equal to
+ * <code>"*"</code> or forms
+ * a comma-separated list of
+ * valid constraints.
+ */
+ private static String checkName(String name)
+ {
+ if (!(name.equals("*")))
+ {
+ String[] constraints = name.split(",");
+ name = "";
+ boolean seenCreate = false;
+ boolean seenNew = false;
+ boolean start = true;
+ for (int a = 0; a < constraints.length; ++a)
+ {
+ String next = constraints[a].trim();
+ if (!(next.equals("createMBeanServer") ||
+ next.equals("findMBeanServer") ||
+ next.equals("newMBeanServer") ||
+ next.equals("releaseMBeanServer")))
+ throw new IllegalArgumentException("An invalid constraint, " +
+ next + ", was specified.");
+ if (next.equals("newMBeanServer"))
+ seenNew = true;
+ else if (next.equals("createMBeanServer"))
+ seenCreate = true;
+ else
+ {
+ if (!start)
+ name += ",";
+ name += next;
+ start = false;
+ }
+ }
+ if (seenNew && !seenCreate)
+ name += (start ? "" : ",") + "newMBeanServer";
+ else if (seenCreate)
+ name += (start ? "" : ",") + "createMBeanServer";
+ }
+ return name;
+ }
+
+}
+
+
+
+
Added: trunk/core/src/classpath/javax/javax/net/ssl/CertPathTrustManagerParameters.java
===================================================================
--- trunk/core/src/classpath/javax/javax/net/ssl/CertPathTrustManagerParameters.java (rev 0)
+++ trunk/core/src/classpath/javax/javax/net/ssl/CertPathTrustManagerParameters.java 2007-01-07 12:57:57 UTC (rev 3025)
@@ -0,0 +1,71 @@
+/* CertPathTrustManagerParameters.java --
+ Copyright (C) 2006 Free Software Foundation, Inc.
+
+This file is a part of GNU Classpath.
+
+GNU Classpath is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; either version 2 of the License, or (at
+your option) any later version.
+
+GNU Classpath is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Classpath; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+USA
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package javax.net.ssl;
+
+import java.security.cert.CertPathParameters;
+
+/**
+ * Trust manager parameters for certification paths.
+ */
+public class CertPathTrustManagerParameters implements ManagerFactoryParameters
+{
+ private final CertPathParameters params;
+
+ /**
+ * Creates a new trust manager parameter instance. The argument is
+ * cloned to prevent modification of this instance.
+ *
+ * @param params The certificate path parameters.
+ * @throws NullPointerException If params is null.
+ */
+ public CertPathTrustManagerParameters (final CertPathParameters params)
+ {
+ this.params = (CertPathParameters) params.clone ();
+ }
+
+ /**
+ * Returns a copy of the certificate path parameters.
+ *
+ * @return A copy of the certificate path parameters.
+ */
+ public CertPathParameters getParameters ()
+ {
+ return (CertPathParameters) params.clone ();
+ }
+}
Modified: trunk/core/src/classpath/javax/javax/net/ssl/HandshakeCompletedEvent.java
===================================================================
--- trunk/core/src/classpath/javax/javax/net/ssl/HandshakeCompletedEvent.java 2007-01-07 12:55:51 UTC (rev 3024)
+++ trunk/core/src/classpath/javax/javax/net/ssl/HandshakeCompletedEvent.java 2007-01-07 12:57:57 UTC (rev 3025)
@@ -38,6 +38,7 @@
package javax.net.ssl;
+import java.security.Principal;
import java.security.cert.Certificate;
import javax.security.cert.X509Certificate;
@@ -108,6 +109,20 @@
}
/**
+ * Returns the local identity used in this connection, or
+ * <code>null</code> if there is none.
+ *
+ * @return The local identity.
+ * @since 1.5
+ */
+ public Principal getLocalPrincipal ()
+ {
+ if (session != null)
+ ...
[truncated message content] |
|
From: <ls...@us...> - 2007-01-07 18:42:16
|
Revision: 3044
http://jnode.svn.sourceforge.net/jnode/?rev=3044&view=rev
Author: lsantha
Date: 2007-01-07 10:42:15 -0800 (Sun, 07 Jan 2007)
Log Message:
-----------
Classpath patches.
Modified Paths:
--------------
trunk/core/src/classpath/javax/javax/security/sasl/Sasl.java
trunk/core/src/classpath/javax/javax/security/sasl/SaslClientFactory.java
trunk/core/src/classpath/javax/javax/security/sasl/SaslServerFactory.java
trunk/core/src/classpath/javax/javax/swing/undo/CompoundEdit.java
trunk/core/src/classpath/javax/javax/swing/undo/StateEdit.java
trunk/core/src/classpath/javax/javax/swing/undo/StateEditable.java
trunk/core/src/classpath/javax/javax/swing/undo/UndoableEditSupport.java
Modified: trunk/core/src/classpath/javax/javax/security/sasl/Sasl.java
===================================================================
--- trunk/core/src/classpath/javax/javax/security/sasl/Sasl.java 2007-01-07 18:41:27 UTC (rev 3043)
+++ trunk/core/src/classpath/javax/javax/security/sasl/Sasl.java 2007-01-07 18:42:15 UTC (rev 3044)
@@ -356,7 +356,8 @@
public static SaslClient createSaslClient(String[] mechanisms,
String authorizationID,
String protocol,
- String serverName, Map props,
+ String serverName,
+ Map<String, ?> props,
CallbackHandler cbh)
throws SaslException
{
@@ -444,7 +445,7 @@
* {@link SaslClient} instance.
* @see #createSaslClient(String[],String,String,String,Map,CallbackHandler)
*/
- public static Enumeration getSaslClientFactories()
+ public static Enumeration<SaslClientFactory> getSaslClientFactories()
{
Vector result = new Vector();
HashSet names = new HashSet();
@@ -559,7 +560,8 @@
*/
public static SaslServer createSaslServer(String mechanism, String protocol,
String serverName,
- Map props, CallbackHandler cbh)
+ Map<String, ?> props,
+ CallbackHandler cbh)
throws SaslException
{
if (mechanism == null)
@@ -636,7 +638,7 @@
* {@link SaslServer} instance.
* @see #createSaslServer(String,String,String,Map,CallbackHandler)
*/
- public static Enumeration getSaslServerFactories()
+ public static Enumeration<SaslServerFactory> getSaslServerFactories()
{
Vector result = new Vector();
HashSet names = new HashSet();
Modified: trunk/core/src/classpath/javax/javax/security/sasl/SaslClientFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/security/sasl/SaslClientFactory.java 2007-01-07 18:41:27 UTC (rev 3043)
+++ trunk/core/src/classpath/javax/javax/security/sasl/SaslClientFactory.java 2007-01-07 18:42:15 UTC (rev 3044)
@@ -97,8 +97,8 @@
* because of an error.
*/
SaslClient createSaslClient(String[] mechanisms, String authorizationID,
- String protocol, String serverName, Map props,
- CallbackHandler cbh)
+ String protocol, String serverName,
+ Map<String, ?> props, CallbackHandler cbh)
throws SaslException;
/**
@@ -114,5 +114,5 @@
* properties, if present in props, are ignored.
* @return a non-null array containing IANA-registered SASL mechanism names.
*/
- String[] getMechanismNames(Map props);
+ String[] getMechanismNames(Map<String, ?> props);
}
Modified: trunk/core/src/classpath/javax/javax/security/sasl/SaslServerFactory.java
===================================================================
--- trunk/core/src/classpath/javax/javax/security/sasl/SaslServerFactory.java 2007-01-07 18:41:27 UTC (rev 3043)
+++ trunk/core/src/classpath/javax/javax/security/sasl/SaslServerFactory.java 2007-01-07 18:42:15 UTC (rev 3044)
@@ -95,7 +95,8 @@
* of an error.
*/
SaslServer createSaslServer(String mechanism, String protocol,
- String serverName, Map props, CallbackHandler cbh)
+ String serverName, Map<String, ?> props,
+ CallbackHandler cbh)
throws SaslException;
/**
@@ -111,5 +112,5 @@
* properties, if present in props, are ignored.
* @return a non-null array containing IANA-registered SASL mechanism names.
*/
- String[] getMechanismNames(Map props);
+ String[] getMechanismNames(Map<String, ?> props);
}
Modified: trunk/core/src/classpath/javax/javax/swing/undo/CompoundEdit.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/undo/CompoundEdit.java 2007-01-07 18:41:27 UTC (rev 3043)
+++ trunk/core/src/classpath/javax/javax/swing/undo/CompoundEdit.java 2007-01-07 18:42:15 UTC (rev 3044)
@@ -1,5 +1,5 @@
/* CompoundEdit.java -- Combines multiple UndoableEdits.
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -75,7 +75,7 @@
* The <code>UndoableEdit</code>s being combined into a compound
* editing action.
*/
- protected Vector edits;
+ protected Vector<UndoableEdit> edits;
/**
@@ -92,7 +92,7 @@
*/
public CompoundEdit()
{
- edits = new Vector();
+ edits = new Vector<UndoableEdit>();
inProgress = true;
}
@@ -118,7 +118,7 @@
super.undo();
for (int i = edits.size() - 1; i >= 0; i--)
- ((UndoableEdit) edits.elementAt(i)).undo();
+ edits.elementAt(i).undo();
}
@@ -143,7 +143,7 @@
super.redo();
for (int i = 0; i < edits.size(); i++)
- ((UndoableEdit) edits.elementAt(i)).redo();
+ edits.elementAt(i).redo();
}
@@ -156,7 +156,7 @@
if (edits.size() == 0)
return null;
else
- return (UndoableEdit) edits.elementAt(edits.size() - 1);
+ return edits.elementAt(edits.size() - 1);
}
@@ -172,7 +172,7 @@
public void die()
{
for (int i = edits.size() - 1; i >= 0; i--)
- ((UndoableEdit) edits.elementAt(i)).die();
+ edits.elementAt(i).die();
super.die();
}
@@ -316,7 +316,7 @@
public boolean isSignificant()
{
for (int i = edits.size() - 1; i >= 0; i--)
- if (((UndoableEdit) edits.elementAt(i)).isSignificant())
+ if (edits.elementAt(i).isSignificant())
return true;
return false;
Modified: trunk/core/src/classpath/javax/javax/swing/undo/StateEdit.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/undo/StateEdit.java 2007-01-07 18:41:27 UTC (rev 3043)
+++ trunk/core/src/classpath/javax/javax/swing/undo/StateEdit.java 2007-01-07 18:42:15 UTC (rev 3044)
@@ -121,14 +121,14 @@
* The state of <code>object</code> at the time of constructing
* this <code>StateEdit</code>.
*/
- protected Hashtable preState;
+ protected Hashtable<Object, Object> preState;
/**
* The state of <code>object</code> at the time when {@link #end()}
* was called.
*/
- protected Hashtable postState;
+ protected Hashtable<Object, Object> postState;
/**
Modified: trunk/core/src/classpath/javax/javax/swing/undo/StateEditable.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/undo/StateEditable.java 2007-01-07 18:41:27 UTC (rev 3043)
+++ trunk/core/src/classpath/javax/javax/swing/undo/StateEditable.java 2007-01-07 18:42:15 UTC (rev 3044)
@@ -100,7 +100,7 @@
* @param state a hash table containing the relevant state
* information.
*/
- void restoreState(Hashtable state);
+ void restoreState(Hashtable<?, ?> state);
/**
@@ -110,5 +110,5 @@
* @param state a hash table for storing relevant state
* information.
*/
- void storeState(Hashtable state);
+ void storeState(Hashtable<Object, Object> state);
}
Modified: trunk/core/src/classpath/javax/javax/swing/undo/UndoableEditSupport.java
===================================================================
--- trunk/core/src/classpath/javax/javax/swing/undo/UndoableEditSupport.java 2007-01-07 18:41:27 UTC (rev 3043)
+++ trunk/core/src/classpath/javax/javax/swing/undo/UndoableEditSupport.java 2007-01-07 18:42:15 UTC (rev 3044)
@@ -69,7 +69,8 @@
/**
* The currently registered listeners.
*/
- protected Vector listeners = new Vector();
+ protected Vector<UndoableEditListener> listeners =
+ new Vector<UndoableEditListener>();
/**
@@ -148,7 +149,7 @@
public synchronized UndoableEditListener[] getUndoableEditListeners()
{
UndoableEditListener[] result = new UndoableEditListener[listeners.size()];
- return (UndoableEditListener[]) listeners.toArray(result);
+ return listeners.toArray(result);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-21 19:30:37
|
Revision: 3282
http://jnode.svn.sourceforge.net/jnode/?rev=3282&view=rev
Author: lsantha
Date: 2007-06-21 12:30:34 -0700 (Thu, 21 Jun 2007)
Log Message:
-----------
Openjdk integration.
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/sql/
trunk/core/src/classpath/javax/javax/transaction/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ls...@us...> - 2007-06-23 04:55:42
|
Revision: 3289
http://jnode.svn.sourceforge.net/jnode/?rev=3289&view=rev
Author: lsantha
Date: 2007-06-22 21:55:40 -0700 (Fri, 22 Jun 2007)
Log Message:
-----------
Openjdk integration.
Modified Paths:
--------------
trunk/core/src/classpath/javax/javax/crypto/Cipher.java
Removed Paths:
-------------
trunk/core/src/classpath/javax/javax/naming/
trunk/core/src/classpath/javax/javax/rmi/
Modified: trunk/core/src/classpath/javax/javax/crypto/Cipher.java
===================================================================
--- trunk/core/src/classpath/javax/javax/crypto/Cipher.java 2007-06-23 04:54:32 UTC (rev 3288)
+++ trunk/core/src/classpath/javax/javax/crypto/Cipher.java 2007-06-23 04:55:40 UTC (rev 3289)
@@ -1145,4 +1145,31 @@
}
return cipherSpi.engineWrap(key);
}
+
+ //jnode openjdk
+ /**
+ * Returns the maximum key length for the specified transformation
+ * according to the installed JCE jurisdiction policy files. If
+ * JCE unlimited strength jurisdiction policy files are installed,
+ * Integer.MAX_VALUE will be returned.
+ * For more information on default key size in JCE jurisdiction
+ * policy files, please see Appendix E in the
+ * <a href=
+ * "{@docRoot}/../technotes/guides/security/crypto/CryptoSpec.html#AppE">
+ * Java Cryptography Architecture Reference Guide</a>.
+ *
+ * @param transformation the cipher transformation.
+ * @return the maximum key length in bits or Integer.MAX_VALUE.
+ * @exception NullPointerException if <code>transformation</code> is null.
+ * @exception NoSuchAlgorithmException if <code>transformation</code>
+ * is not a valid transformation, i.e. in the form of "algorithm" or
+ * "algorithm/mode/padding".
+ * @since 1.5
+ */
+ public static final int getMaxAllowedKeyLength(String transformation)
+ throws NoSuchAlgorithmException
+ {
+ return 0;
+ }
+
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|