diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-04-14 06:50:23 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-04-14 06:50:23 +0000 |
commit | fe67a5ac72d12dd8faf471d1c612492fed829a4b (patch) | |
tree | e63047006842dfddf0388368324211987cc15509 /gnu | |
parent | 71fa4db0b20e97806bd5b11d96370695112f21b4 (diff) | |
download | classpath-fe67a5ac72d12dd8faf471d1c612492fed829a4b.tar.gz |
2006-04-13 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD --> generics-branch from 2006/03/26 to 2006/04/13.
Diffstat (limited to 'gnu')
147 files changed, 1802 insertions, 840 deletions
diff --git a/gnu/CORBA/CDR/EncapsulationStream.java b/gnu/CORBA/CDR/EncapsulationStream.java index 4945d9c90..e42991232 100644 --- a/gnu/CORBA/CDR/EncapsulationStream.java +++ b/gnu/CORBA/CDR/EncapsulationStream.java @@ -79,6 +79,7 @@ public class EncapsulationStream boolean use_big_endian) { super(); + setBigEndian(use_big_endian); buffer = new AligningOutput(); setOutputStream(buffer); parent = _parent; diff --git a/gnu/CORBA/GIOP/MessageHeader.java b/gnu/CORBA/GIOP/MessageHeader.java index e1bdb512b..025283858 100644 --- a/gnu/CORBA/GIOP/MessageHeader.java +++ b/gnu/CORBA/GIOP/MessageHeader.java @@ -51,6 +51,7 @@ import org.omg.CORBA.MARSHAL; import org.omg.CORBA.portable.IDLEntity; import java.io.ByteArrayOutputStream; +import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -273,20 +274,36 @@ public class MessageHeader * Read the header from the stream. * * @param istream a stream to read from. - * * @throws MARSHAL if this is not a GIOP 1.0 header. */ - public void read(java.io.InputStream istream) - throws MARSHAL + public void read(java.io.InputStream istream) + throws MARSHAL, EOFException { try { byte[] xMagic = new byte[MAGIC.length]; - istream.read(xMagic); - if (!Arrays.equals(xMagic, MAGIC)) + int r = istream.read(xMagic); + int minor; + if (! Arrays.equals(xMagic, MAGIC)) { - MARSHAL m = new MARSHAL("Not a GIOP message"); - m.minor = Minor.Giop; + StringBuffer b = new StringBuffer(); + if (r == - 1) + { + b.append("Immediate EOF"); + minor = Minor.EOF; + } + else + { + minor = Minor.Giop; + b.append(r + " bytes: "); + for (int i = 0; i < xMagic.length; i++) + { + b.append(Integer.toHexString(xMagic[i] & 0xFF)); + b.append(' '); + } + } + MARSHAL m = new MARSHAL("Not a GIOP message: " + b); + m.minor = minor; throw m; } @@ -354,7 +371,7 @@ public class MessageHeader } catch (IOException ex) { - MARSHAL t = new MARSHAL(); + MARSHAL t = new MARSHAL(ex.getMessage()); t.minor = Minor.Header; t.initCause(ex); throw t; diff --git a/gnu/CORBA/IorDelegate.java b/gnu/CORBA/IorDelegate.java index 27fb5de9a..8eb43aa7d 100644 --- a/gnu/CORBA/IorDelegate.java +++ b/gnu/CORBA/IorDelegate.java @@ -407,20 +407,7 @@ public class IorDelegate extends SimpleDelegate */ public void release(org.omg.CORBA.Object target) { - String key = ior.Internet.host + ":" + ior.Internet.port; - - Socket socket = SocketRepository.get_socket(key); - try - { - if (socket != null) - { - socket.close(); - } - } - catch (IOException ex) - { - // do nothing, then. - } + // Do nothing here. } /** diff --git a/gnu/CORBA/NamingService/NameParser.java b/gnu/CORBA/NamingService/NameParser.java index 422db1c58..c750b2eb4 100644 --- a/gnu/CORBA/NamingService/NameParser.java +++ b/gnu/CORBA/NamingService/NameParser.java @@ -1,5 +1,5 @@ /* NameParser.java -- - Copyright (C) 2005 Free Software Foundation, Inc. + Copyright (C) 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -425,7 +425,8 @@ public class NameParser else { Delegate delegate = ((ObjectImpl) object)._get_delegate(); - ns = new _NamingContextStub(delegate); + ns = new _NamingContextStub(); + ((_NamingContextStub) ns)._set_delegate(delegate); } } catch (Exception ex) diff --git a/gnu/CORBA/OrbRestricted.java b/gnu/CORBA/OrbRestricted.java index c0401800a..c34584995 100644 --- a/gnu/CORBA/OrbRestricted.java +++ b/gnu/CORBA/OrbRestricted.java @@ -41,11 +41,13 @@ package gnu.CORBA; import gnu.CORBA.CDR.BufferedCdrOutput; import gnu.CORBA.typecodes.AliasTypeCode; import gnu.CORBA.typecodes.ArrayTypeCode; +import gnu.CORBA.typecodes.PrimitiveTypeCode; import gnu.CORBA.typecodes.RecordTypeCode; import gnu.CORBA.typecodes.StringTypeCode; import org.omg.CORBA.Any; import org.omg.CORBA.BAD_PARAM; +import org.omg.CORBA.Context; import org.omg.CORBA.ContextList; import org.omg.CORBA.Environment; import org.omg.CORBA.ExceptionList; @@ -526,4 +528,57 @@ public class OrbRestricted extends org.omg.CORBA_2_3.ORB super.destroy(); } + + /** + * Create a typecode, representing a tree-like structure. + * This structure contains a member that is a sequence of the same type, + * as the structure itself. You can imagine as if the folder definition + * contains a variable-length array of the enclosed (nested) folder + * definitions. In this way, it is possible to have a tree like + * structure that can be transferred via CORBA CDR stream. + * + * @deprecated It is easier and clearler to use a combination of + * create_recursive_tc and create_sequence_tc instead. + * + * @param bound the maximal expected number of the nested components + * on each node; 0 if not limited. + * + * @param offset the position of the field in the returned structure + * that contains the sequence of the structures of the same field. + * The members before this field are intialised using parameterless + * StructMember constructor. + * + * @return a typecode, defining a stucture, where a member at the + * <code>offset</code> position defines an array of the identical + * structures. + * + * @see #create_recursive_tc(String) + * @see #create_sequence_tc(int, TypeCode) + */ + public TypeCode create_recursive_sequence_tc(int bound, int offset) + { + RecordTypeCode r = new RecordTypeCode(TCKind.tk_struct); + for (int i = 0; i < offset; i++) + r.add(new StructMember()); + + TypeCode recurs = new PrimitiveTypeCode(TCKind.tk_sequence); + + r.add(new StructMember("", recurs, null)); + return r; + } + + /** + * Get the default context of this ORB. This is an initial root of all + * contexts. + * + * The default method returns a new context with the empty name and + * no parent context. + * + * @return the default context of this ORB. + */ + public Context get_default_context() + { + return new gnuContext("", null); + } + }
\ No newline at end of file diff --git a/gnu/CORBA/SocketRepository.java b/gnu/CORBA/SocketRepository.java index e48a9a5da..5d4a5099c 100644 --- a/gnu/CORBA/SocketRepository.java +++ b/gnu/CORBA/SocketRepository.java @@ -116,9 +116,6 @@ public class SocketRepository */ public static Socket get_socket(Object key) { - if (true) - return null; - synchronized (sockets) { Socket s = (Socket) sockets.get(key); diff --git a/gnu/CORBA/gnuRequest.java b/gnu/CORBA/gnuRequest.java index 5adf74129..0b3338d34 100644 --- a/gnu/CORBA/gnuRequest.java +++ b/gnu/CORBA/gnuRequest.java @@ -83,6 +83,7 @@ import org.omg.PortableInterceptor.ClientRequestInterceptorOperations; import org.omg.PortableInterceptor.ForwardRequest; import org.omg.PortableInterceptor.InvalidSlot; +import java.io.EOFException; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -593,7 +594,7 @@ public class gnuRequest extends Request implements Cloneable { final gnuRequest cloned = Clone(); cloned.oneWay = true; - + new Thread() { public void run() @@ -717,12 +718,11 @@ public class gnuRequest extends Request implements Cloneable * property ({@link #setIOR(IOR)} before calling this method. * * @throws BAD_INV_ORDER, minor code 0, if the IOR has not been previously set - * or if the direct argument addition is mixed with the direct argument - * writing into the output stream. - * + * or if the direct argument addition is mixed with the direct + * argument writing into the output stream. * @return the server response in binary form. */ - public synchronized RawReply submit() +public synchronized RawReply submit() throws ForwardRequest { gnu.CORBA.GIOP.MessageHeader header = new gnu.CORBA.GIOP.MessageHeader(); @@ -788,20 +788,21 @@ public class gnuRequest extends Request implements Cloneable if (socket == null) { - // The BindException may be thrown under very heavy parallel + // The IOException may be thrown under very heavy parallel // load. For some time, just wait, exceptiong the socket to free. Open: for (int i = 0; i < PAUSE_STEPS; i++) { try { if (orb instanceof OrbFunctional) - socket = ((OrbFunctional) orb).socketFactory.createClientSocket( - ior.Internet.host, ior.Internet.port); + socket = ((OrbFunctional) orb).socketFactory. + createClientSocket( + ior.Internet.host, ior.Internet.port); else socket = new Socket(ior.Internet.host, ior.Internet.port); break Open; } - catch (BindException ex) + catch (IOException ex) { try { @@ -833,7 +834,7 @@ public class gnuRequest extends Request implements Cloneable request_part.buffer.writeTo(socketOutput); socketOutput.flush(); - if (!socket.isClosed()) + if (!socket.isClosed() && !oneWay) { MessageHeader response_header = new MessageHeader(); InputStream socketInput = socket.getInputStream(); @@ -937,6 +938,10 @@ public class gnuRequest extends Request implements Cloneable throws SystemException, ForwardRequest { RawReply response = submit(); + + // If this is a one way message, do not care about the response. + if (oneWay && response == EMPTY) + return; if (m_rph == null) m_rph = response.header.create_reply_header(); diff --git a/gnu/classpath/SystemProperties.java b/gnu/classpath/SystemProperties.java index 0c2d0e8de..d091f1ed0 100644 --- a/gnu/classpath/SystemProperties.java +++ b/gnu/classpath/SystemProperties.java @@ -111,6 +111,13 @@ public class SystemProperties defaultProperties.put("java.io.tmpdir", defaultProperties.get("java.tmpdir")); + // FIXME: we need a better way to handle this. + // For instance, having a single VM class for each OS might help. + if (defaultProperties.get("gnu.classpath.mime.types.file") == null + && "Linux".equals(defaultProperties.get("os.name"))) + defaultProperties.put("gnu.classpath.mime.types.file", + "/etc/mime.types"); + VMSystemProperties.postInit(defaultProperties); // Note that we use clone here and not new. Some programs assume diff --git a/gnu/java/awt/peer/gtk/GdkGraphics.java b/gnu/java/awt/peer/gtk/GdkGraphics.java index c45892800..3c3cbdf32 100644 --- a/gnu/java/awt/peer/gtk/GdkGraphics.java +++ b/gnu/java/awt/peer/gtk/GdkGraphics.java @@ -219,8 +219,10 @@ public class GdkGraphics extends Graphics public boolean drawImage (Image img, int x, int y, Color bgcolor, ImageObserver observer) { - return drawImage(img, x, y, img.getWidth(null), img.getHeight(null), - bgcolor, observer); + if (img != null) + return drawImage(img, x, y, img.getWidth(null), img.getHeight(null), + bgcolor, observer); + return false; } public boolean drawImage (Image img, int x, int y, ImageObserver observer) @@ -228,16 +230,19 @@ public class GdkGraphics extends Graphics return drawImage (img, x, y, null, observer); } - public boolean drawImage (Image img, int x, int y, int width, int height, - Color bgcolor, ImageObserver observer) + public boolean drawImage(Image img, int x, int y, int width, int height, + Color bgcolor, ImageObserver observer) { - if (img instanceof GtkImage) - return ((GtkImage)img).drawImage (this, x, y, width, height, - bgcolor, observer); - else - return (new GtkImage(img.getSource())).drawImage (this, x, y, - width, height, - bgcolor, observer); + if (img != null) + { + if (img instanceof GtkImage) + return ((GtkImage) img).drawImage(this, x, y, width, height, bgcolor, + observer); + return (new GtkImage(img.getSource())).drawImage(this, x, y, width, + height, bgcolor, + observer); + } + return false; } public boolean drawImage (Image img, int x, int y, int width, int height, @@ -250,14 +255,16 @@ public class GdkGraphics extends Graphics int sx1, int sy1, int sx2, int sy2, Color bgcolor, ImageObserver observer) { - if (img instanceof GtkImage) - return ((GtkImage)img).drawImage(this, dx1, dy1, dx2, dy2, - sx1, sy1, sx2, sy2, bgcolor, observer); - else - return (new GtkImage(img.getSource())).drawImage(this, dx1, dy1, - dx2, dy2, - sx1, sy1, sx2, sy2, - bgcolor, observer); + if (img != null) + { + if (img instanceof GtkImage) + return ((GtkImage) img).drawImage(this, dx1, dy1, dx2, dy2, sx1, sy1, + sx2, sy2, bgcolor, observer); + return (new GtkImage(img.getSource())).drawImage(this, dx1, dy1, dx2, + dy2, sx1, sy1, sx2, + sy2, bgcolor, observer); + } + return false; } public boolean drawImage (Image img, int dx1, int dy1, int dx2, int dy2, diff --git a/gnu/java/awt/peer/gtk/GtkCanvasPeer.java b/gnu/java/awt/peer/gtk/GtkCanvasPeer.java index 16166afa4..797d653d2 100644 --- a/gnu/java/awt/peer/gtk/GtkCanvasPeer.java +++ b/gnu/java/awt/peer/gtk/GtkCanvasPeer.java @@ -38,16 +38,14 @@ exception statement from your version. */ package gnu.java.awt.peer.gtk; -import java.awt.AWTEvent; import java.awt.Canvas; import java.awt.Dimension; -import java.awt.Graphics; -import java.awt.event.PaintEvent; import java.awt.peer.CanvasPeer; public class GtkCanvasPeer extends GtkComponentPeer implements CanvasPeer { native void create (); + native void realize (); public GtkCanvasPeer (Canvas c) { diff --git a/gnu/java/awt/peer/gtk/GtkClipboard.java b/gnu/java/awt/peer/gtk/GtkClipboard.java index ceb42599b..f520fe224 100644 --- a/gnu/java/awt/peer/gtk/GtkClipboard.java +++ b/gnu/java/awt/peer/gtk/GtkClipboard.java @@ -172,15 +172,12 @@ public class GtkClipboard extends Clipboard || flavor.isRepresentationClassReader()) text = true; - // XXX - We only support automatic image conversion for - // GtkImages at the moment. So explicitly check that we have - // one. if (! images && flavors[i].equals(DataFlavor.imageFlavor)) { try { Object o = contents.getTransferData(DataFlavor.imageFlavor); - if (o instanceof GtkImage) + if (o instanceof Image) images = true; } catch (UnsupportedFlavorException ufe) @@ -291,7 +288,11 @@ public class GtkClipboard extends Clipboard try { - return (GtkImage) contents.getTransferData(DataFlavor.imageFlavor); + Object o = contents.getTransferData(DataFlavor.imageFlavor); + if( o instanceof GtkImage ) + return (GtkImage) o; + else + return new GtkImage(((Image)o).getSource()); } catch (UnsupportedFlavorException ufe) { diff --git a/gnu/java/awt/peer/gtk/GtkComponentPeer.java b/gnu/java/awt/peer/gtk/GtkComponentPeer.java index 1a4aa0afb..1a85de5fe 100644 --- a/gnu/java/awt/peer/gtk/GtkComponentPeer.java +++ b/gnu/java/awt/peer/gtk/GtkComponentPeer.java @@ -567,7 +567,7 @@ public class GtkComponentPeer extends GtkGenericPeer public void setVisible (boolean b) { // Only really set visible when component is bigger than zero pixels. - if (b) + if (b && ! (awtComponent instanceof Window)) { Rectangle bounds = awtComponent.getBounds(); b = (bounds.width > 0) && (bounds.height > 0); diff --git a/gnu/java/awt/peer/gtk/GtkFramePeer.java b/gnu/java/awt/peer/gtk/GtkFramePeer.java index c8cc9423b..6ec0b7298 100644 --- a/gnu/java/awt/peer/gtk/GtkFramePeer.java +++ b/gnu/java/awt/peer/gtk/GtkFramePeer.java @@ -1,5 +1,5 @@ /* GtkFramePeer.java -- Implements FramePeer with GTK - Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2004, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -122,25 +122,11 @@ public class GtkFramePeer extends GtkWindowPeer public void setBounds (int x, int y, int width, int height) { - // prevent window_configure_cb -> awtComponent.setSize -> - // peer.setBounds -> nativeSetBounds self-deadlock on GDK lock. - if (Thread.currentThread() == GtkToolkit.mainThread) - { - int menuBarWidth = width - insets.left - insets.right; - if (menuBar != null && menuBarWidth > 0) - setMenuBarWidthUnlocked (menuBar, menuBarWidth); - - return; - } - int menuBarWidth = width - insets.left - insets.right; if (menuBar != null && menuBarWidth > 0) setMenuBarWidth (menuBar, menuBarWidth); - nativeSetBounds (x, y, - width - insets.left - insets.right, - height - insets.top - insets.bottom - + menuBarHeight); + super.setBounds(x, y, width, height + menuBarHeight); } public void setResizable (boolean resizable) @@ -198,26 +184,19 @@ public class GtkFramePeer extends GtkWindowPeer protected void postConfigureEvent (int x, int y, int width, int height) { - int frame_width = width + insets.left + insets.right; + if (menuBar != null && width > 0) + setMenuBarWidthUnlocked (menuBar, width); + // Since insets.top already includes the MenuBar's height, we need // to subtract the MenuBar's height from the top inset. - int frame_height = height + insets.top + insets.bottom - menuBarHeight; - - if (frame_width != awtComponent.getWidth() - || frame_height != awtComponent.getHeight()) - awtComponent.setSize(frame_width, frame_height); + int frame_height = height - menuBarHeight; - int frame_x = x - insets.left; // Likewise, since insets.top includes the MenuBar height, we need // to add back the MenuBar height to the frame's y position. If // no MenuBar exists in this frame, the MenuBar height will be 0. - int frame_y = y - insets.top + menuBarHeight; + int frame_y = y + menuBarHeight; - if (frame_x != awtComponent.getX() - || frame_y != awtComponent.getY()) - { - // awtComponent.setLocation(frame_x, frame_y); - } + super.postConfigureEvent(x, frame_y, width, frame_height); } public int getState () diff --git a/gnu/java/awt/peer/gtk/GtkPanelPeer.java b/gnu/java/awt/peer/gtk/GtkPanelPeer.java index 16eb8c8fb..51fe2bc8e 100644 --- a/gnu/java/awt/peer/gtk/GtkPanelPeer.java +++ b/gnu/java/awt/peer/gtk/GtkPanelPeer.java @@ -39,9 +39,7 @@ exception statement from your version. */ package gnu.java.awt.peer.gtk; import java.awt.AWTEvent; -import java.awt.Graphics; import java.awt.Panel; -import java.awt.event.ComponentEvent; import java.awt.event.MouseEvent; import java.awt.event.PaintEvent; import java.awt.peer.PanelPeer; @@ -62,16 +60,9 @@ public class GtkPanelPeer extends GtkContainerPeer if (id == MouseEvent.MOUSE_PRESSED) awtComponent.requestFocusInWindow(); - + super.handleEvent(event); } - protected void updateComponent (PaintEvent event) - { - // Do not want to clear anything before painting. Sun never - // calls Panel.update, only Panel.paint. - paintComponent(event); - } - native void connectSignals (); } diff --git a/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/gnu/java/awt/peer/gtk/GtkWindowPeer.java index 70c6615fa..d15beacb4 100644 --- a/gnu/java/awt/peer/gtk/GtkWindowPeer.java +++ b/gnu/java/awt/peer/gtk/GtkWindowPeer.java @@ -1,5 +1,5 @@ /* GtkWindowPeer.java -- Implements WindowPeer with GTK - Copyright (C) 1998, 1999, 2002, 2005 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2002, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,6 +44,7 @@ import java.awt.Frame; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.Window; +import java.awt.event.ComponentEvent; import java.awt.event.PaintEvent; import java.awt.event.WindowEvent; import java.awt.peer.WindowPeer; @@ -63,20 +64,37 @@ public class GtkWindowPeer extends GtkContainerPeer private boolean hasBeenShown = false; private int oldState = Frame.NORMAL; + // Cached awt window component location, width and height. + private int x, y, width, height; + native void gtkWindowSetTitle (String title); native void gtkWindowSetResizable (boolean resizable); native void gtkWindowSetModal (boolean modal); native void realize (); + /** Returns the cached width of the AWT window component. */ + int getX () + { + return x; + } + + /** Returns the cached width of the AWT window component. */ + int getY () + { + return y; + } + + /** Returns the cached width of the AWT window component. */ int getWidth () { - return awtComponent.getWidth(); + return width; } + /** Returns the cached height of the AWT window component. */ int getHeight () { - return awtComponent.getHeight(); + return height; } native void create (int type, boolean decorated, GtkWindowPeer parent); @@ -86,6 +104,10 @@ public class GtkWindowPeer extends GtkContainerPeer Window window = (Window) awtComponent; GtkWindowPeer parent_peer = null; Component parent = awtComponent.getParent(); + x = awtComponent.getX(); + y = awtComponent.getY(); + height = awtComponent.getHeight(); + width = awtComponent.getWidth(); if (!window.isFocusableWindow()) type = GDK_WINDOW_TYPE_HINT_MENU; @@ -130,37 +152,28 @@ public class GtkWindowPeer extends GtkContainerPeer native void nativeSetLocation (int x, int y); native void nativeSetLocationUnlocked (int x, int y); - public void setLocation (int x, int y) + // Called from show. + protected void setLocation (int x, int y) { - // prevent window_configure_cb -> awtComponent.setSize -> - // peer.setBounds -> nativeSetBounds self-deadlock on GDK lock. - if (Thread.currentThread() == GtkToolkit.mainThread) - return; nativeSetLocation (x, y); } - public void setLocationUnlocked (int x, int y) - { - nativeSetLocationUnlocked (x, y); - } - public void setBounds (int x, int y, int width, int height) { - // prevent window_configure_cb -> awtComponent.setSize -> - // peer.setBounds -> nativeSetBounds self-deadlock on GDK lock. - if (Thread.currentThread() == GtkToolkit.mainThread) - return; - - nativeSetBounds (x, y, - width - insets.left - insets.right, - height - insets.top - insets.bottom); - } - - public void setBoundsUnlocked (int x, int y, int width, int height) - { - nativeSetBoundsUnlocked (x, y, - width - insets.left - insets.right, - height - insets.top - insets.bottom); + if (x != getX() + || y != getY() + || width != getWidth() + || height != getHeight()) + { + this.x = x; + this.y = y; + this.width = width; + this.height = height; + + nativeSetBounds (x, y, + width - insets.left - insets.right, + height - insets.top - insets.bottom); + } } public void setTitle (String title) @@ -168,15 +181,25 @@ public class GtkWindowPeer extends GtkContainerPeer gtkWindowSetTitle (title); } - native void setSize (int width, int height); - + // Called from setResizable + protected native void setSize (int width, int height); + + /** + * Needed by both GtkFramePeer and GtkDialogPeer subclasses, so + * implemented here. But never actually called on a GtkWindowPeer + * itself. + */ public void setResizable (boolean resizable) { // Call setSize; otherwise when resizable is changed from true to // false the window will shrink to the dimensions it had before it // was resizable. - setSize (awtComponent.getWidth() - insets.left - insets.right, - awtComponent.getHeight() - insets.top - insets.bottom); + x = awtComponent.getX(); + y = awtComponent.getY(); + width = awtComponent.getWidth(); + height = awtComponent.getHeight(); + setSize (width - insets.left - insets.right, + height - insets.top - insets.bottom); gtkWindowSetResizable (resizable); } @@ -196,23 +219,35 @@ public class GtkWindowPeer extends GtkContainerPeer int frame_width = width + insets.left + insets.right; int frame_height = height + insets.top + insets.bottom; - if (frame_width != awtComponent.getWidth() - || frame_height != awtComponent.getHeight()) - awtComponent.setSize(frame_width, frame_height); + if (frame_width != getWidth() + || frame_height != getHeight()) + { + this.width = frame_width; + this.height = frame_height; + q().postEvent(new ComponentEvent(awtComponent, + ComponentEvent.COMPONENT_RESIZED)); + } int frame_x = x - insets.left; int frame_y = y - insets.top; - if (frame_x != awtComponent.getX() - || frame_y != awtComponent.getY()) + if (frame_x != getX() + || frame_y != getY()) { - // awtComponent.setLocation(frame_x, frame_y); + this.x = frame_x; + this.y = frame_y; + q().postEvent(new ComponentEvent(awtComponent, + ComponentEvent.COMPONENT_MOVED)); } } public void show () { - setLocation(awtComponent.getX(), awtComponent.getY()); + x = awtComponent.getX(); + y = awtComponent.getY(); + width = awtComponent.getWidth(); + height = awtComponent.getHeight(); + setLocation(x, y); setVisible (true); } @@ -296,4 +331,11 @@ public class GtkWindowPeer extends GtkContainerPeer x + insets.left, y + insets.top, clickCount, popupTrigger); } + + // We override this to keep it in sync with our internal + // representation. + public Rectangle getBounds() + { + return new Rectangle(x, y, width, height); + } } diff --git a/gnu/java/lang/reflect/GenericSignatureParser.java b/gnu/java/lang/reflect/GenericSignatureParser.java index b3ee3662c..10d7537b4 100644 --- a/gnu/java/lang/reflect/GenericSignatureParser.java +++ b/gnu/java/lang/reflect/GenericSignatureParser.java @@ -42,28 +42,6 @@ import java.lang.reflect.*; import java.util.ArrayList; import java.util.Arrays; -abstract class TypeImpl implements Type -{ - abstract Type resolve(); - - static void resolve(Type[] types) - { - for (int i = 0; i < types.length; i++) - { - types[i] = resolve(types[i]); - } - } - - static Type resolve(Type type) - { - if (type instanceof TypeImpl) - { - type = ((TypeImpl) type).resolve(); - } - return type; - } -} - final class TypeVariableImpl extends TypeImpl implements TypeVariable { private GenericDeclaration decl; diff --git a/gnu/java/lang/reflect/TypeImpl.java b/gnu/java/lang/reflect/TypeImpl.java new file mode 100644 index 000000000..30906f629 --- /dev/null +++ b/gnu/java/lang/reflect/TypeImpl.java @@ -0,0 +1,63 @@ +/* TypeImpl.java + Copyright (C) 2005 + Free Software Foundation + +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 gnu.java.lang.reflect; + +import java.lang.reflect.Type; + +abstract class TypeImpl implements Type +{ + abstract Type resolve(); + + static void resolve(Type[] types) + { + for (int i = 0; i < types.length; i++) + { + types[i] = resolve(types[i]); + } + } + + static Type resolve(Type type) + { + if (type instanceof TypeImpl) + { + type = ((TypeImpl) type).resolve(); + } + return type; + } +} diff --git a/gnu/java/net/DefaultContentHandlerFactory.java b/gnu/java/net/DefaultContentHandlerFactory.java new file mode 100644 index 000000000..bb0a7ce5d --- /dev/null +++ b/gnu/java/net/DefaultContentHandlerFactory.java @@ -0,0 +1,94 @@ +/* DefaultContentHandlerFactory.java + Copyright (C) 2004 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 gnu.java.net; + +import java.io.IOException; +import java.net.ContentHandler; +import java.net.ContentHandlerFactory; +import java.net.URLConnection; +import java.util.Arrays; +import java.util.HashSet; + +/** Content Handler for Image types, using the AWT Toolkit's image decoder. */ +class ImageHandler extends ContentHandler +{ + static ImageHandler instance = new ImageHandler(); + + public Object getContent(URLConnection urlc) throws IOException + { + // FIXME: implement using ImageIO + // ClasspathToolkit tk = (ClasspathToolkit) Toolkit.getDefaultToolkit(); + // java.awt.image.ImageProducer ip = tk.createImageProducer(urlc.getURL()); + // return ip; + return null; + } +} + +/** + */ +public class DefaultContentHandlerFactory implements ContentHandlerFactory +{ + /** For now, hard code the list of types that we assume should + * be supported by the Toolkit. ClasspathToolkit should perhaps provide + * an API to express what Image MIME types the Toolkit understands. + */ + private static String[] known_image_types = + { + "image/bmp", + "image/gif", + "image/jpeg", + "image/png", + "image/tiff", + "image/x-portable-anymap", + "image/x-cmu-raster", + "image/x-xbitmap", + "image/x-xpixmap" + }; + + private static HashSet imageTypes + = new HashSet(Arrays.asList(known_image_types)); + + public ContentHandler createContentHandler(String mimeType) + { + if (imageTypes.contains(mimeType)) + return ImageHandler.instance; + // Currently, only image types are handled. + return null; + } +} diff --git a/gnu/java/rmi/activation/ActivationSystemTransient.java b/gnu/java/rmi/activation/ActivationSystemTransient.java index ea31e4bdf..1557220e1 100644 --- a/gnu/java/rmi/activation/ActivationSystemTransient.java +++ b/gnu/java/rmi/activation/ActivationSystemTransient.java @@ -1,4 +1,4 @@ -/* DefaultActivationSystem.java -- FIXME: briefly describe file purpose +/* ActivationSystemTransient.java -- The transient RMI object activation system. Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -69,23 +69,23 @@ public class ActivationSystemTransient /** * Maps group identifiers into group descriptions. */ - BidiTable groupDescs = new BidiTable(); + protected final BidiTable groupDescs; /** * Maps object identifiers into object activation descriptions */ - BidiTable descriptions = new BidiTable(); + protected final BidiTable descriptions; /** - * Maps group descriptions into group object instantiators. + * Maps group identifiers into already activated groups. */ - Map groupInstantiators = new Hashtable(); + protected transient final Map groupInstantiators = new Hashtable(); /** * The cache of the activated objects, maps activation ids to remote * object stubs. */ - Map activatedObjects = new HashMap(); + protected transient final Map activatedObjects = new HashMap(); /** * The object incarnation counter. @@ -102,11 +102,23 @@ public class ActivationSystemTransient */ public static boolean debug = false; + + /** + * Creates the group which uses the given maps to store the data. + */ + protected ActivationSystemTransient(BidiTable objectDescriptions, + BidiTable groupDescriptiopns) + { + descriptions = objectDescriptions; + groupDescs = groupDescriptiopns; + } + /** - * This group should not be instantiated outside the group code. + * Creates the group with transient maps. */ protected ActivationSystemTransient() { + this (new BidiTable(), new BidiTable()); } public static ActivationSystem getInstance() @@ -282,11 +294,13 @@ public class ActivationSystemTransient } /** - * No action. + * Calls .shutdown on all bidirectional tables (has no effect if these + * table are not persistent). */ public void shutdown() throws RemoteException { - // Nothing to do. + descriptions.shutdown(); + groupDescs.shutdown(); } /** diff --git a/gnu/java/rmi/activation/BidiTable.java b/gnu/java/rmi/activation/BidiTable.java index 0a8d895f3..5e421fe8d 100644 --- a/gnu/java/rmi/activation/BidiTable.java +++ b/gnu/java/rmi/activation/BidiTable.java @@ -38,7 +38,10 @@ exception statement from your version. */ package gnu.java.rmi.activation; -import java.util.Hashtable; +import java.util.Collection; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; /** * The bidirectional hash table, maps both a to b and b to a. @@ -55,17 +58,36 @@ public class BidiTable /** * Maps keys to values */ - Hashtable k2v = new Hashtable(); + protected Map k2v; /** * Maps values to keys (in reverse) */ - Hashtable v2k = new Hashtable(); + protected Map v2k; + + /** + * Create a new table that is ready to use. + */ + public BidiTable() + { + k2v = new HashMap(); + v2k = new HashMap(); + } + + /** + * Create a new instance where the hashtable fields are not initialised + * (called from derivatives that intialise hashtables in they own way. + * + * @param flags currently used to mark the different constructor only. + */ + protected BidiTable(int flags) + { + } /** * Get key by value */ - Object getKey(Object value) + public synchronized Object getKey(Object value) { return v2k.get(value); } @@ -73,7 +95,7 @@ public class BidiTable /** * Put key-value pair. */ - public void put(Object key, Object value) + public synchronized void put(Object key, Object value) { k2v.put(key, value); v2k.put(value, key); @@ -82,7 +104,7 @@ public class BidiTable /** * Get value from key */ - public Object get(Object key) + public synchronized Object get(Object key) { return k2v.get(key); } @@ -90,7 +112,7 @@ public class BidiTable /** * Remove the key-value pair by key */ - public void removeKey(Object key) + public synchronized void removeKey(Object key) { Object value = k2v.get(key); if (value!=null) @@ -103,9 +125,39 @@ public class BidiTable /** * Check if the table contains this key. */ - public boolean containsKey(Object key) + public synchronized boolean containsKey(Object key) { return k2v.containsKey(key); } + /** + * This method is called before exit and may be used to write the database + * to the disk. The default method does nothing. + */ + public synchronized void shutdown() + { + } + + /** + * Get the size. + */ + public synchronized int size() + { + return k2v.size(); + } + + /** + * Get the key collection. + */ + public synchronized Object[] keys() + { + Collection keys = k2v.keySet(); + Object[] k = new Object[keys.size()]; + + Iterator iter = keys.iterator(); + for (int i = 0; i < k.length; i++) + k[i] = iter.next(); + + return k; + } } diff --git a/gnu/java/rmi/dgc/LeaseRenewingTask.java b/gnu/java/rmi/dgc/LeaseRenewingTask.java index 7e3bb258b..ffb5560af 100644 --- a/gnu/java/rmi/dgc/LeaseRenewingTask.java +++ b/gnu/java/rmi/dgc/LeaseRenewingTask.java @@ -110,9 +110,12 @@ public class LeaseRenewingTask */ public LeaseRenewingTask(UnicastRef renewIt) { - ref.add(new WeakReference(renewIt)); lease = notifyDGC(renewIt); - schedule(lease); + if (lease != null) + { + schedule(lease); + ref.add(new WeakReference(renewIt)); + } } /** @@ -122,6 +125,9 @@ public class LeaseRenewingTask */ public static void scheduleLeases(UnicastRef renewIt) { + // No need to schedule leases for null. + if (renewIt == null) + return; try { synchronized (existingTasks) { @@ -144,7 +150,9 @@ public class LeaseRenewingTask } catch (Exception ex) { - ex.printStackTrace(); + InternalError ierr = new InternalError("Lease for "+renewIt); + ierr.initCause(ex); + throw ierr; } } diff --git a/gnu/java/rmi/server/ActivatableRef.java b/gnu/java/rmi/server/ActivatableRef.java new file mode 100644 index 000000000..d191c0c17 --- /dev/null +++ b/gnu/java/rmi/server/ActivatableRef.java @@ -0,0 +1,175 @@ +/* ActivatableRef.java -- Activatable server reference + 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 gnu.java.rmi.server; + +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.activation.ActivationException; +import java.rmi.activation.ActivationID; +import java.rmi.server.ObjID; +import java.rmi.server.RMIClientSocketFactory; +import java.rmi.server.RemoteObject; +import java.rmi.server.RemoteObjectInvocationHandler; +import java.rmi.server.RemoteRef; + +/** + * The activatable reference works like UnicastRef, but if the remote object + * appears to be not accessible, it tries to reactivate it before reporting + * any errors. Apart the fields of the UnicastRef, the activatable reference + * contains the ActivationID that is used for this activation. + * + * @author Audrius Meskauskas (Audriusa@Bioinformatics.org) + */ +public class ActivatableRef extends UnicastRef +{ + /** + * Use serial version UID for iteroperability + */ + private static final long serialVersionUID = 1; + + /** + * The activation id. + */ + ActivationID actId; + + /** + * Delegate call to the superclass. + */ + public ActivatableRef() + { + super(); + } + + /** + * Delegate call to the superclass. + */ + public ActivatableRef(ObjID objid, String host, int port, + RMIClientSocketFactory csf) + { + super(objid, host, port, csf); + } + + /** + * Delegate call to the superclass. + */ + public ActivatableRef(ObjID objid) + { + super(objid); + } + + /** + * Get the referencing class. + */ + public String getRefClass(ObjectOutput out) + { + return "ActivatableRef"; + } + + /** + * Read the content from the input stream. + */ + public void readExternal(ObjectInput in) throws IOException, + ClassNotFoundException + { + super.readExternal(in); + actId = (ActivationID) in.readObject(); + } + + /** + * Write the content to the output stream. + */ + public void writeExternal(ObjectOutput out) throws IOException + { + super.writeExternal(out); + out.writeObject(actId); + } + + /** + * Invoke the remote method on the given object and try to activate the object + * if it is not reacheable with the current manager. + */ + protected Object invokeCommon(Remote obj, Method method, Object[] params, + int opnum, long hash) throws Exception + { + UnicastConnection conn; + try + { + conn = manager.getConnection(); + } + catch (IOException e1) + { + // Connection failed: try to activate. + Remote reactivated = actId.activate(false); + + if (reactivated instanceof RemoteObject) + { + RemoteRef ref = ((RemoteObject) reactivated).getRef(); + manager = ((UnicastRef) ref).manager; + } + else if (Proxy.isProxyClass(reactivated.getClass())) + { + RemoteObjectInvocationHandler hander = + (RemoteObjectInvocationHandler) + Proxy.getInvocationHandler(reactivated); + + RemoteRef ref = hander.getRef(); + manager = ((UnicastRef) ref).manager; + } + else + throw new ActivationException("Activating into unsupported class " + + reactivated.getClass()); + + try + { + conn = manager.getConnection(); + } + catch (IOException e2) + { + throw new RemoteException("connection failed to host: " + + manager.serverName, e1); + } + } + return invokeCommon(conn, obj, method, params, opnum, hash); + } +} diff --git a/gnu/java/rmi/server/ActivatableServerRef.java b/gnu/java/rmi/server/ActivatableServerRef.java index d89e351d3..09595ec5f 100644 --- a/gnu/java/rmi/server/ActivatableServerRef.java +++ b/gnu/java/rmi/server/ActivatableServerRef.java @@ -38,6 +38,9 @@ exception statement from your version. */ package gnu.java.rmi.server; +import java.io.IOException; +import java.io.ObjectInput; +import java.io.ObjectOutput; import java.rmi.Remote; import java.rmi.RemoteException; import java.rmi.activation.ActivationID; @@ -194,5 +197,31 @@ public class ActivatableServerRef extends UnicastServerRef UnicastServer.registerActivatable(this); return stub; } + + /** + * Get the referencing class. + */ + public String getRefClass(ObjectOutput out) + { + return "ActivatableRef"; + } + + /** + * Read the content from the input stream. + */ + public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException + { + super.readExternal(in); + actId = (ActivationID) in.readObject(); + } + + /** + * Write the content to the output stream. + */ + public void writeExternal(ObjectOutput out) throws IOException + { + super.writeExternal(out); + out.writeObject(actId); + } } diff --git a/gnu/java/rmi/server/UnicastRef.java b/gnu/java/rmi/server/UnicastRef.java index ef3c5f91b..def1acdcf 100644 --- a/gnu/java/rmi/server/UnicastRef.java +++ b/gnu/java/rmi/server/UnicastRef.java @@ -251,21 +251,34 @@ public class UnicastRef return (Lease) returnval; } - - private Object invokeCommon(Remote obj, Method method, Object[] params, - int opnum, long hash) throws Exception + /** + * Invoke the remote method on the given object. This part is overridden by + * the activatable objects. + */ + protected Object invokeCommon(Remote obj, Method method, Object[] params, + int opnum, long hash) throws Exception { UnicastConnection conn; try { conn = manager.getConnection(); + return invokeCommon(conn, obj, method, params, opnum, hash); } catch (IOException e1) { throw new RemoteException("connection failed to host: " + manager.serverName, e1); } + } + /** + * Invoke the remote method on the given object when connection is already + * established. + */ + protected Object invokeCommon(UnicastConnection conn, Remote obj, + Method method, Object[] params, int opnum, + long hash) throws Exception + { ObjectOutputStream out; DataOutputStream dout; try @@ -326,7 +339,7 @@ public class UnicastRef else { returnval = ((RMIObjectInputStream) in).readValue(cls); // get - // returnvalue + // returnvalue } } catch (IOException e3) diff --git a/gnu/java/security/hash/Whirlpool.java b/gnu/java/security/hash/Whirlpool.java index 8c5d9f360..95a4515d9 100644 --- a/gnu/java/security/hash/Whirlpool.java +++ b/gnu/java/security/hash/Whirlpool.java @@ -42,25 +42,25 @@ import gnu.java.security.Registry; import gnu.java.security.util.Util; /** - * <p>Whirlpool, a new 512-bit hashing function operating on messages less than + * Whirlpool, a new 512-bit hashing function operating on messages less than * 2 ** 256 bits in length. The function structure is designed according to the * Wide Trail strategy and permits a wide variety of implementation trade-offs. - * </p> - * - * <p><b>IMPORTANT</b>: This implementation is not thread-safe.</p> - * - * <p>References:</p> - * + * <p> + * This implementation is of Whirlpool Version 3, described in [1] last revised + * on May 24th, 2003. + * <p> + * <b>IMPORTANT</b>: This implementation is not thread-safe. + * <p> + * References: * <ol> * <li><a href="http://planeta.terra.com.br/informatica/paulobarreto/WhirlpoolPage.html"> * The WHIRLPOOL Hashing Function</a>.<br> * <a href="mailto:paulo.barreto@terra.com.br">Paulo S.L.M. Barreto</a> and - * <a href="mailto:vincent.rijmen@esat.kuleuven.ac.be">Vincent Rijmen</a>.</li> + * <a href="mailto:vincent.rijmen@iaik.tugraz.at">Vincent Rijmen</a>.</li> * </ol> */ public final class Whirlpool extends BaseHash { - // Debugging methods and variables // ------------------------------------------------------------------------- @@ -74,45 +74,43 @@ public final class Whirlpool extends BaseHash private static final int BLOCK_SIZE = 64; // inner block size in bytes /** The digest of the 0-bit long message. */ - private static final String DIGEST0 = "470F0409ABAA446E49667D4EBE12A14387CEDBD10DD17B8243CAD550A089DC0F" - + "EEA7AA40F6C2AAAB71C6EBD076E43C7CFCA0AD32567897DCB5969861049A0F5A"; - - private static final int R = 10; // default number of rounds - - private static final String Sd = // p. 19 [WHIRLPOOL] - "\u1823\uc6E8\u87B8\u014F\u36A6\ud2F5\u796F\u9152" - + "\u60Bc\u9B8E\uA30c\u7B35\u1dE0\ud7c2\u2E4B\uFE57" - + "\u1577\u37E5\u9FF0\u4AdA\u58c9\u290A\uB1A0\u6B85" - + "\uBd5d\u10F4\ucB3E\u0567\uE427\u418B\uA77d\u95d8" - + "\uFBEE\u7c66\udd17\u479E\ucA2d\uBF07\uAd5A\u8333" - + "\u6302\uAA71\uc819\u49d9\uF2E3\u5B88\u9A26\u32B0" - + "\uE90F\ud580\uBEcd\u3448\uFF7A\u905F\u2068\u1AAE" - + "\uB454\u9322\u64F1\u7312\u4008\uc3Ec\udBA1\u8d3d" - + "\u9700\ucF2B\u7682\ud61B\uB5AF\u6A50\u45F3\u30EF" - + "\u3F55\uA2EA\u65BA\u2Fc0\udE1c\uFd4d\u9275\u068A" - + "\uB2E6\u0E1F\u62d4\uA896\uF9c5\u2559\u8472\u394c" - + "\u5E78\u388c\ud1A5\uE261\uB321\u9c1E\u43c7\uFc04" - + "\u5199\u6d0d\uFAdF\u7E24\u3BAB\ucE11\u8F4E\uB7EB" - + "\u3c81\u94F7\uB913\u2cd3\uE76E\uc403\u5644\u7FA9" - + "\u2ABB\uc153\udc0B\u9d6c\u3174\uF646\uAc89\u14E1" - + "\u163A\u6909\u70B6\ud0Ed\ucc42\u98A4\u285c\uF886"; - + private static final String DIGEST0 = + "19FA61D75522A4669B44E39C1D2E1726C530232130D407F89AFEE0964997F7A7" + + "3E83BE698B288FEBCF88E3E03C4F0757EA8964E59B63D93708B138CC42A66EB3"; + + /** Default number of rounds. */ + private static final int R = 10; + + /** Whirlpool S-box; p. 19. */ + private static final String S_box = // p. 19 [WHIRLPOOL] + "\u1823\uc6E8\u87B8\u014F\u36A6\ud2F5\u796F\u9152" + + "\u60Bc\u9B8E\uA30c\u7B35\u1dE0\ud7c2\u2E4B\uFE57" + + "\u1577\u37E5\u9FF0\u4AdA\u58c9\u290A\uB1A0\u6B85" + + "\uBd5d\u10F4\ucB3E\u0567\uE427\u418B\uA77d\u95d8" + + "\uFBEE\u7c66\udd17\u479E\ucA2d\uBF07\uAd5A\u8333" + + "\u6302\uAA71\uc819\u49d9\uF2E3\u5B88\u9A26\u32B0" + + "\uE90F\ud580\uBEcd\u3448\uFF7A\u905F\u2068\u1AAE" + + "\uB454\u9322\u64F1\u7312\u4008\uc3Ec\udBA1\u8d3d" + + "\u9700\ucF2B\u7682\ud61B\uB5AF\u6A50\u45F3\u30EF" + + "\u3F55\uA2EA\u65BA\u2Fc0\udE1c\uFd4d\u9275\u068A" + + "\uB2E6\u0E1F\u62d4\uA896\uF9c5\u2559\u8472\u394c" + + "\u5E78\u388c\ud1A5\uE261\uB321\u9c1E\u43c7\uFc04" + + "\u5199\u6d0d\uFAdF\u7E24\u3BAB\ucE11\u8F4E\uB7EB" + + "\u3c81\u94F7\uB913\u2cd3\uE76E\uc403\u5644\u7FA9" + + "\u2ABB\uc153\udc0B\u9d6c\u3174\uF646\uAc89\u14E1" + + "\u163A\u6909\u70B6\ud0Ed\ucc42\u98A4\u285c\uF886"; + + /** The 64-bit lookup tables; section 7.1 p. 13. */ private static final long[] T0 = new long[256]; - private static final long[] T1 = new long[256]; - private static final long[] T2 = new long[256]; - private static final long[] T3 = new long[256]; - private static final long[] T4 = new long[256]; - private static final long[] T5 = new long[256]; - private static final long[] T6 = new long[256]; - private static final long[] T7 = new long[256]; + /** The round constants. */ private static final long[] rc = new long[R]; /** caches the result of the correctness test, once executed. */ @@ -123,12 +121,10 @@ public final class Whirlpool extends BaseHash /** Work area for computing the round key schedule. */ private long k00, k01, k02, k03, k04, k05, k06, k07; - private long Kr0, Kr1, Kr2, Kr3, Kr4, Kr5, Kr6, Kr7; /** work area for transforming the 512-bit buffer. */ private long n0, n1, n2, n3, n4, n5, n6, n7; - private long nn0, nn1, nn2, nn3, nn4, nn5, nn6, nn7; /** work area for holding block cipher's intermediate values. */ @@ -140,72 +136,67 @@ public final class Whirlpool extends BaseHash { long time = System.currentTimeMillis(); - int ROOT = 0x11d; // para. 2.1 [WHIRLPOOL] + int ROOT = 0x11D; // para. 2.1 [WHIRLPOOL] int i, r, j; - long s, s2, s3, s4, s5, s8, s9, t; + long s1, s2, s4, s5, s8, s9, t; char c; final byte[] S = new byte[256]; for (i = 0; i < 256; i++) { - c = Sd.charAt(i >>> 1); + c = S_box.charAt(i >>> 1); - s = ((i & 1) == 0 ? c >>> 8 : c) & 0xFFL; - s2 = s << 1; + s1 = ((i & 1) == 0 ? c >>> 8 : c) & 0xFFL; + s2 = s1 << 1; if (s2 > 0xFFL) - { - s2 ^= ROOT; - } - s3 = s2 ^ s; + s2 ^= ROOT; + s4 = s2 << 1; if (s4 > 0xFFL) - { - s4 ^= ROOT; - } - s5 = s4 ^ s; + s4 ^= ROOT; + + s5 = s4 ^ s1; s8 = s4 << 1; if (s8 > 0xFFL) - { - s8 ^= ROOT; - } - s9 = s8 ^ s; + s8 ^= ROOT; - S[i] = (byte) s; - T0[i] = t = s << 56 | s << 48 | s3 << 40 | s << 32 | s5 << 24 - | s8 << 16 | s9 << 8 | s5; - T1[i] = t >>> 8 | t << 56; + s9 = s8 ^ s1; + + T0[i] = t = s1 << 56 | s1 << 48 | s4 << 40 | s1 << 32 + | s8 << 24 | s5 << 16 | s2 << 8 | s9; + T1[i] = t >>> 8 | t << 56; T2[i] = t >>> 16 | t << 48; T3[i] = t >>> 24 | t << 40; T4[i] = t >>> 32 | t << 32; T5[i] = t >>> 40 | t << 24; T6[i] = t >>> 48 | t << 16; - T7[i] = t >>> 56 | t << 8; + T7[i] = t >>> 56 | t << 8; } - for (r = 1, i = 0, j = 0; r < R + 1; r++) - { - rc[i++] = (S[j++] & 0xFFL) << 56 | (S[j++] & 0xFFL) << 48 - | (S[j++] & 0xFFL) << 40 | (S[j++] & 0xFFL) << 32 - | (S[j++] & 0xFFL) << 24 | (S[j++] & 0xFFL) << 16 - | (S[j++] & 0xFFL) << 8 | (S[j++] & 0xFFL); - } + for (r = 0, i = 0; r < R; ) + rc[r++] = (T0[i++] & 0xFF00000000000000L) + ^ (T1[i++] & 0x00FF000000000000L) + ^ (T2[i++] & 0x0000FF0000000000L) + ^ (T3[i++] & 0x000000FF00000000L) + ^ (T4[i++] & 0x00000000FF000000L) + ^ (T5[i++] & 0x0000000000FF0000L) + ^ (T6[i++] & 0x000000000000FF00L) + ^ (T7[i++] & 0x00000000000000FFL); time = System.currentTimeMillis() - time; - if (DEBUG && debuglevel > 8) { System.out.println("=========="); System.out.println(); System.out.println("Static data"); System.out.println(); - + System.out.println(); System.out.println("T0[]:"); for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T0[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T0[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); @@ -213,9 +204,8 @@ public final class Whirlpool extends BaseHash for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T1[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T1[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); @@ -223,9 +213,8 @@ public final class Whirlpool extends BaseHash for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T2[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T2[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); @@ -233,9 +222,8 @@ public final class Whirlpool extends BaseHash for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T3[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T3[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); @@ -243,9 +231,8 @@ public final class Whirlpool extends BaseHash for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T4[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T4[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); @@ -253,9 +240,8 @@ public final class Whirlpool extends BaseHash for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); @@ -263,9 +249,8 @@ public final class Whirlpool extends BaseHash for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); @@ -273,17 +258,15 @@ public final class Whirlpool extends BaseHash for (i = 0; i < 64; i++) { for (j = 0; j < 4; j++) - { - System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", "); - } + System.out.print("0x" + Util.toString(T5[i * 4 + j]) + ", "); + System.out.println(); } System.out.println(); System.out.println("rc[]:"); for (i = 0; i < R; i++) - { - System.out.println("0x" + Util.toString(rc[i])); - } + System.out.println("0x" + Util.toString(rc[i])); + System.out.println(); System.out.println(); @@ -340,38 +323,70 @@ public final class Whirlpool extends BaseHash protected void transform(byte[] in, int offset) { // apply mu to the input - n0 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); - n1 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); - n2 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); - n3 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); - n4 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); - n5 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); - n6 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); - n7 = (in[offset++] & 0xFFL) << 56 | (in[offset++] & 0xFFL) << 48 - | (in[offset++] & 0xFFL) << 40 | (in[offset++] & 0xFFL) << 32 - | (in[offset++] & 0xFFL) << 24 | (in[offset++] & 0xFFL) << 16 - | (in[offset++] & 0xFFL) << 8 | (in[offset++] & 0xFFL); + n0 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); + n1 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); + n2 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); + n3 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); + n4 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); + n5 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); + n6 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); + n7 = (in[offset++] & 0xFFL) << 56 + | (in[offset++] & 0xFFL) << 48 + | (in[offset++] & 0xFFL) << 40 + | (in[offset++] & 0xFFL) << 32 + | (in[offset++] & 0xFFL) << 24 + | (in[offset++] & 0xFFL) << 16 + | (in[offset++] & 0xFFL) << 8 + | (in[offset++] & 0xFFL); // transform K into the key schedule Kr; 0 <= r <= R k00 = H0; @@ -399,62 +414,70 @@ public final class Whirlpool extends BaseHash { // 1. compute intermediate round key schedule by applying ro[rc] // to the previous round key schedule --rc being the round constant - Kr0 = T0[(int) ((k00 >> 56) & 0xFFL)] ^ T1[(int) ((k07 >> 48) & 0xFFL)] - ^ T2[(int) ((k06 >> 40) & 0xFFL)] - ^ T3[(int) ((k05 >> 32) & 0xFFL)] - ^ T4[(int) ((k04 >> 24) & 0xFFL)] - ^ T5[(int) ((k03 >> 16) & 0xFFL)] - ^ T6[(int) ((k02 >> 8) & 0xFFL)] ^ T7[(int) (k01 & 0xFFL)] - ^ rc[r]; - - Kr1 = T0[(int) ((k01 >> 56) & 0xFFL)] ^ T1[(int) ((k00 >> 48) & 0xFFL)] - ^ T2[(int) ((k07 >> 40) & 0xFFL)] - ^ T3[(int) ((k06 >> 32) & 0xFFL)] - ^ T4[(int) ((k05 >> 24) & 0xFFL)] - ^ T5[(int) ((k04 >> 16) & 0xFFL)] - ^ T6[(int) ((k03 >> 8) & 0xFFL)] ^ T7[(int) (k02 & 0xFFL)]; - - Kr2 = T0[(int) ((k02 >> 56) & 0xFFL)] ^ T1[(int) ((k01 >> 48) & 0xFFL)] - ^ T2[(int) ((k00 >> 40) & 0xFFL)] - ^ T3[(int) ((k07 >> 32) & 0xFFL)] - ^ T4[(int) ((k06 >> 24) & 0xFFL)] - ^ T5[(int) ((k05 >> 16) & 0xFFL)] - ^ T6[(int) ((k04 >> 8) & 0xFFL)] ^ T7[(int) (k03 & 0xFFL)]; - - Kr3 = T0[(int) ((k03 >> 56) & 0xFFL)] ^ T1[(int) ((k02 >> 48) & 0xFFL)] - ^ T2[(int) ((k01 >> 40) & 0xFFL)] - ^ T3[(int) ((k00 >> 32) & 0xFFL)] - ^ T4[(int) ((k07 >> 24) & 0xFFL)] - ^ T5[(int) ((k06 >> 16) & 0xFFL)] - ^ T6[(int) ((k05 >> 8) & 0xFFL)] ^ T7[(int) (k04 & 0xFFL)]; - - Kr4 = T0[(int) ((k04 >> 56) & 0xFFL)] ^ T1[(int) ((k03 >> 48) & 0xFFL)] - ^ T2[(int) ((k02 >> 40) & 0xFFL)] - ^ T3[(int) ((k01 >> 32) & 0xFFL)] - ^ T4[(int) ((k00 >> 24) & 0xFFL)] - ^ T5[(int) ((k07 >> 16) & 0xFFL)] - ^ T6[(int) ((k06 >> 8) & 0xFFL)] ^ T7[(int) (k05 & 0xFFL)]; - - Kr5 = T0[(int) ((k05 >> 56) & 0xFFL)] ^ T1[(int) ((k04 >> 48) & 0xFFL)] - ^ T2[(int) ((k03 >> 40) & 0xFFL)] - ^ T3[(int) ((k02 >> 32) & 0xFFL)] - ^ T4[(int) ((k01 >> 24) & 0xFFL)] - ^ T5[(int) ((k00 >> 16) & 0xFFL)] - ^ T6[(int) ((k07 >> 8) & 0xFFL)] ^ T7[(int) (k06 & 0xFFL)]; - - Kr6 = T0[(int) ((k06 >> 56) & 0xFFL)] ^ T1[(int) ((k05 >> 48) & 0xFFL)] - ^ T2[(int) ((k04 >> 40) & 0xFFL)] - ^ T3[(int) ((k03 >> 32) & 0xFFL)] - ^ T4[(int) ((k02 >> 24) & 0xFFL)] - ^ T5[(int) ((k01 >> 16) & 0xFFL)] - ^ T6[(int) ((k00 >> 8) & 0xFFL)] ^ T7[(int) (k07 & 0xFFL)]; - - Kr7 = T0[(int) ((k07 >> 56) & 0xFFL)] ^ T1[(int) ((k06 >> 48) & 0xFFL)] - ^ T2[(int) ((k05 >> 40) & 0xFFL)] - ^ T3[(int) ((k04 >> 32) & 0xFFL)] - ^ T4[(int) ((k03 >> 24) & 0xFFL)] - ^ T5[(int) ((k02 >> 16) & 0xFFL)] - ^ T6[(int) ((k01 >> 8) & 0xFFL)] ^ T7[(int) (k00 & 0xFFL)]; + Kr0 = T0[(int)((k00 >> 56) & 0xFFL)] + ^ T1[(int)((k07 >> 48) & 0xFFL)] + ^ T2[(int)((k06 >> 40) & 0xFFL)] + ^ T3[(int)((k05 >> 32) & 0xFFL)] + ^ T4[(int)((k04 >> 24) & 0xFFL)] + ^ T5[(int)((k03 >> 16) & 0xFFL)] + ^ T6[(int)((k02 >> 8) & 0xFFL)] + ^ T7[(int)( k01 & 0xFFL)] ^ rc[r]; + Kr1 = T0[(int)((k01 >> 56) & 0xFFL)] + ^ T1[(int)((k00 >> 48) & 0xFFL)] + ^ T2[(int)((k07 >> 40) & 0xFFL)] + ^ T3[(int)((k06 >> 32) & 0xFFL)] + ^ T4[(int)((k05 >> 24) & 0xFFL)] + ^ T5[(int)((k04 >> 16) & 0xFFL)] + ^ T6[(int)((k03 >> 8) & 0xFFL)] + ^ T7[(int)( k02 & 0xFFL)]; + Kr2 = T0[(int)((k02 >> 56) & 0xFFL)] + ^ T1[(int)((k01 >> 48) & 0xFFL)] + ^ T2[(int)((k00 >> 40) & 0xFFL)] + ^ T3[(int)((k07 >> 32) & 0xFFL)] + ^ T4[(int)((k06 >> 24) & 0xFFL)] + ^ T5[(int)((k05 >> 16) & 0xFFL)] + ^ T6[(int)((k04 >> 8) & 0xFFL)] + ^ T7[(int)( k03 & 0xFFL)]; + Kr3 = T0[(int)((k03 >> 56) & 0xFFL)] + ^ T1[(int)((k02 >> 48) & 0xFFL)] + ^ T2[(int)((k01 >> 40) & 0xFFL)] + ^ T3[(int)((k00 >> 32) & 0xFFL)] + ^ T4[(int)((k07 >> 24) & 0xFFL)] + ^ T5[(int)((k06 >> 16) & 0xFFL)] + ^ T6[(int)((k05 >> 8) & 0xFFL)] + ^ T7[(int)( k04 & 0xFFL)]; + Kr4 = T0[(int)((k04 >> 56) & 0xFFL)] + ^ T1[(int)((k03 >> 48) & 0xFFL)] + ^ T2[(int)((k02 >> 40) & 0xFFL)] + ^ T3[(int)((k01 >> 32) & 0xFFL)] + ^ T4[(int)((k00 >> 24) & 0xFFL)] + ^ T5[(int)((k07 >> 16) & 0xFFL)] + ^ T6[(int)((k06 >> 8) & 0xFFL)] + ^ T7[(int)( k05 & 0xFFL)]; + Kr5 = T0[(int)((k05 >> 56) & 0xFFL)] + ^ T1[(int)((k04 >> 48) & 0xFFL)] + ^ T2[(int)((k03 >> 40) & 0xFFL)] + ^ T3[(int)((k02 >> 32) & 0xFFL)] + ^ T4[(int)((k01 >> 24) & 0xFFL)] + ^ T5[(int)((k00 >> 16) & 0xFFL)] + ^ T6[(int)((k07 >> 8) & 0xFFL)] + ^ T7[(int)( k06 & 0xFFL)]; + Kr6 = T0[(int)((k06 >> 56) & 0xFFL)] + ^ T1[(int)((k05 >> 48) & 0xFFL)] + ^ T2[(int)((k04 >> 40) & 0xFFL)] + ^ T3[(int)((k03 >> 32) & 0xFFL)] + ^ T4[(int)((k02 >> 24) & 0xFFL)] + ^ T5[(int)((k01 >> 16) & 0xFFL)] + ^ T6[(int)((k00 >> 8) & 0xFFL)] + ^ T7[(int)( k07 & 0xFFL)]; + Kr7 = T0[(int)((k07 >> 56) & 0xFFL)] + ^ T1[(int)((k06 >> 48) & 0xFFL)] + ^ T2[(int)((k05 >> 40) & 0xFFL)] + ^ T3[(int)((k04 >> 32) & 0xFFL)] + ^ T4[(int)((k03 >> 24) & 0xFFL)] + ^ T5[(int)((k02 >> 16) & 0xFFL)] + ^ T6[(int)((k01 >> 8) & 0xFFL)] + ^ T7[(int)( k00 & 0xFFL)]; k00 = Kr0; k01 = Kr1; @@ -466,54 +489,70 @@ public final class Whirlpool extends BaseHash k07 = Kr7; // 2. incrementally compute the cipher output - w0 = T0[(int) ((nn0 >> 56) & 0xFFL)] ^ T1[(int) ((nn7 >> 48) & 0xFFL)] - ^ T2[(int) ((nn6 >> 40) & 0xFFL)] - ^ T3[(int) ((nn5 >> 32) & 0xFFL)] - ^ T4[(int) ((nn4 >> 24) & 0xFFL)] - ^ T5[(int) ((nn3 >> 16) & 0xFFL)] ^ T6[(int) ((nn2 >> 8) & 0xFFL)] - ^ T7[(int) (nn1 & 0xFFL)] ^ Kr0; - w1 = T0[(int) ((nn1 >> 56) & 0xFFL)] ^ T1[(int) ((nn0 >> 48) & 0xFFL)] - ^ T2[(int) ((nn7 >> 40) & 0xFFL)] - ^ T3[(int) ((nn6 >> 32) & 0xFFL)] - ^ T4[(int) ((nn5 >> 24) & 0xFFL)] - ^ T5[(int) ((nn4 >> 16) & 0xFFL)] ^ T6[(int) ((nn3 >> 8) & 0xFFL)] - ^ T7[(int) (nn2 & 0xFFL)] ^ Kr1; - w2 = T0[(int) ((nn2 >> 56) & 0xFFL)] ^ T1[(int) ((nn1 >> 48) & 0xFFL)] - ^ T2[(int) ((nn0 >> 40) & 0xFFL)] - ^ T3[(int) ((nn7 >> 32) & 0xFFL)] - ^ T4[(int) ((nn6 >> 24) & 0xFFL)] - ^ T5[(int) ((nn5 >> 16) & 0xFFL)] ^ T6[(int) ((nn4 >> 8) & 0xFFL)] - ^ T7[(int) (nn3 & 0xFFL)] ^ Kr2; - w3 = T0[(int) ((nn3 >> 56) & 0xFFL)] ^ T1[(int) ((nn2 >> 48) & 0xFFL)] - ^ T2[(int) ((nn1 >> 40) & 0xFFL)] - ^ T3[(int) ((nn0 >> 32) & 0xFFL)] - ^ T4[(int) ((nn7 >> 24) & 0xFFL)] - ^ T5[(int) ((nn6 >> 16) & 0xFFL)] ^ T6[(int) ((nn5 >> 8) & 0xFFL)] - ^ T7[(int) (nn4 & 0xFFL)] ^ Kr3; - w4 = T0[(int) ((nn4 >> 56) & 0xFFL)] ^ T1[(int) ((nn3 >> 48) & 0xFFL)] - ^ T2[(int) ((nn2 >> 40) & 0xFFL)] - ^ T3[(int) ((nn1 >> 32) & 0xFFL)] - ^ T4[(int) ((nn0 >> 24) & 0xFFL)] - ^ T5[(int) ((nn7 >> 16) & 0xFFL)] ^ T6[(int) ((nn6 >> 8) & 0xFFL)] - ^ T7[(int) (nn5 & 0xFFL)] ^ Kr4; - w5 = T0[(int) ((nn5 >> 56) & 0xFFL)] ^ T1[(int) ((nn4 >> 48) & 0xFFL)] - ^ T2[(int) ((nn3 >> 40) & 0xFFL)] - ^ T3[(int) ((nn2 >> 32) & 0xFFL)] - ^ T4[(int) ((nn1 >> 24) & 0xFFL)] - ^ T5[(int) ((nn0 >> 16) & 0xFFL)] ^ T6[(int) ((nn7 >> 8) & 0xFFL)] - ^ T7[(int) (nn6 & 0xFFL)] ^ Kr5; - w6 = T0[(int) ((nn6 >> 56) & 0xFFL)] ^ T1[(int) ((nn5 >> 48) & 0xFFL)] - ^ T2[(int) ((nn4 >> 40) & 0xFFL)] - ^ T3[(int) ((nn3 >> 32) & 0xFFL)] - ^ T4[(int) ((nn2 >> 24) & 0xFFL)] - ^ T5[(int) ((nn1 >> 16) & 0xFFL)] ^ T6[(int) ((nn0 >> 8) & 0xFFL)] - ^ T7[(int) (nn7 & 0xFFL)] ^ Kr6; - w7 = T0[(int) ((nn7 >> 56) & 0xFFL)] ^ T1[(int) ((nn6 >> 48) & 0xFFL)] - ^ T2[(int) ((nn5 >> 40) & 0xFFL)] - ^ T3[(int) ((nn4 >> 32) & 0xFFL)] - ^ T4[(int) ((nn3 >> 24) & 0xFFL)] - ^ T5[(int) ((nn2 >> 16) & 0xFFL)] ^ T6[(int) ((nn1 >> 8) & 0xFFL)] - ^ T7[(int) (nn0 & 0xFFL)] ^ Kr7; + w0 = T0[(int)((nn0 >> 56) & 0xFFL)] + ^ T1[(int)((nn7 >> 48) & 0xFFL)] + ^ T2[(int)((nn6 >> 40) & 0xFFL)] + ^ T3[(int)((nn5 >> 32) & 0xFFL)] + ^ T4[(int)((nn4 >> 24) & 0xFFL)] + ^ T5[(int)((nn3 >> 16) & 0xFFL)] + ^ T6[(int)((nn2 >> 8) & 0xFFL)] + ^ T7[(int)( nn1 & 0xFFL)] ^ Kr0; + w1 = T0[(int)((nn1 >> 56) & 0xFFL)] + ^ T1[(int)((nn0 >> 48) & 0xFFL)] + ^ T2[(int)((nn7 >> 40) & 0xFFL)] + ^ T3[(int)((nn6 >> 32) & 0xFFL)] + ^ T4[(int)((nn5 >> 24) & 0xFFL)] + ^ T5[(int)((nn4 >> 16) & 0xFFL)] + ^ T6[(int)((nn3 >> 8) & 0xFFL)] + ^ T7[(int)( nn2 & 0xFFL)] ^ Kr1; + w2 = T0[(int)((nn2 >> 56) & 0xFFL)] + ^ T1[(int)((nn1 >> 48) & 0xFFL)] + ^ T2[(int)((nn0 >> 40) & 0xFFL)] + ^ T3[(int)((nn7 >> 32) & 0xFFL)] + ^ T4[(int)((nn6 >> 24) & 0xFFL)] + ^ T5[(int)((nn5 >> 16) & 0xFFL)] + ^ T6[(int)((nn4 >> 8) & 0xFFL)] + ^ T7[(int)( nn3 & 0xFFL)] ^ Kr2; + w3 = T0[(int)((nn3 >> 56) & 0xFFL)] + ^ T1[(int)((nn2 >> 48) & 0xFFL)] + ^ T2[(int)((nn1 >> 40) & 0xFFL)] + ^ T3[(int)((nn0 >> 32) & 0xFFL)] + ^ T4[(int)((nn7 >> 24) & 0xFFL)] + ^ T5[(int)((nn6 >> 16) & 0xFFL)] + ^ T6[(int)((nn5 >> 8) & 0xFFL)] + ^ T7[(int)( nn4 & 0xFFL)] ^ Kr3; + w4 = T0[(int)((nn4 >> 56) & 0xFFL)] + ^ T1[(int)((nn3 >> 48) & 0xFFL)] + ^ T2[(int)((nn2 >> 40) & 0xFFL)] + ^ T3[(int)((nn1 >> 32) & 0xFFL)] + ^ T4[(int)((nn0 >> 24) & 0xFFL)] + ^ T5[(int)((nn7 >> 16) & 0xFFL)] + ^ T6[(int)((nn6 >> 8) & 0xFFL)] + ^ T7[(int)( nn5 & 0xFFL)] ^ Kr4; + w5 = T0[(int)((nn5 >> 56) & 0xFFL)] + ^ T1[(int)((nn4 >> 48) & 0xFFL)] + ^ T2[(int)((nn3 >> 40) & 0xFFL)] + ^ T3[(int)((nn2 >> 32) & 0xFFL)] + ^ T4[(int)((nn1 >> 24) & 0xFFL)] + ^ T5[(int)((nn0 >> 16) & 0xFFL)] + ^ T6[(int)((nn7 >> 8) & 0xFFL)] + ^ T7[(int)( nn6 & 0xFFL)] ^ Kr5; + w6 = T0[(int)((nn6 >> 56) & 0xFFL)] + ^ T1[(int)((nn5 >> 48) & 0xFFL)] + ^ T2[(int)((nn4 >> 40) & 0xFFL)] + ^ T3[(int)((nn3 >> 32) & 0xFFL)] + ^ T4[(int)((nn2 >> 24) & 0xFFL)] + ^ T5[(int)((nn1 >> 16) & 0xFFL)] + ^ T6[(int)((nn0 >> 8) & 0xFFL)] + ^ T7[(int)( nn7 & 0xFFL)] ^ Kr6; + w7 = T0[(int)((nn7 >> 56) & 0xFFL)] + ^ T1[(int)((nn6 >> 48) & 0xFFL)] + ^ T2[(int)((nn5 >> 40) & 0xFFL)] + ^ T3[(int)((nn4 >> 32) & 0xFFL)] + ^ T4[(int)((nn3 >> 24) & 0xFFL)] + ^ T5[(int)((nn2 >> 16) & 0xFFL)] + ^ T6[(int)((nn1 >> 8) & 0xFFL)] + ^ T7[(int)( nn0 & 0xFFL)] ^ Kr7; nn0 = w0; nn1 = w1; @@ -547,7 +586,7 @@ public final class Whirlpool extends BaseHash // are 33 (1 for the 1-bit followed by the 0-bits and the encoding of // the count framed in a 256-bit block). our formula is then: // count + 33 + padding = 0 (mod BLOCK_SIZE) - int n = (int) ((count + 33) % BLOCK_SIZE); + int n = (int)((count + 33) % BLOCK_SIZE); int padding = n == 0 ? 33 : BLOCK_SIZE - n + 33; byte[] result = new byte[padding]; @@ -558,14 +597,14 @@ public final class Whirlpool extends BaseHash // save (right justified) the number of bits hashed long bits = count * 8; int i = padding - 8; - result[i++] = (byte) (bits >>> 56); - result[i++] = (byte) (bits >>> 48); - result[i++] = (byte) (bits >>> 40); - result[i++] = (byte) (bits >>> 32); - result[i++] = (byte) (bits >>> 24); - result[i++] = (byte) (bits >>> 16); - result[i++] = (byte) (bits >>> 8); - result[i] = (byte) bits; + result[i++] = (byte)(bits >>> 56); + result[i++] = (byte)(bits >>> 48); + result[i++] = (byte)(bits >>> 40); + result[i++] = (byte)(bits >>> 32); + result[i++] = (byte)(bits >>> 24); + result[i++] = (byte)(bits >>> 16); + result[i++] = (byte)(bits >>> 8); + result[i ] = (byte) bits; return result; } @@ -573,38 +612,24 @@ public final class Whirlpool extends BaseHash protected byte[] getResult() { // apply inverse mu to the context - byte[] result = new byte[] { (byte) (H0 >>> 56), (byte) (H0 >>> 48), - (byte) (H0 >>> 40), (byte) (H0 >>> 32), - (byte) (H0 >>> 24), (byte) (H0 >>> 16), - (byte) (H0 >>> 8), (byte) H0, - (byte) (H1 >>> 56), (byte) (H1 >>> 48), - (byte) (H1 >>> 40), (byte) (H1 >>> 32), - (byte) (H1 >>> 24), (byte) (H1 >>> 16), - (byte) (H1 >>> 8), (byte) H1, - (byte) (H2 >>> 56), (byte) (H2 >>> 48), - (byte) (H2 >>> 40), (byte) (H2 >>> 32), - (byte) (H2 >>> 24), (byte) (H2 >>> 16), - (byte) (H2 >>> 8), (byte) H2, - (byte) (H3 >>> 56), (byte) (H3 >>> 48), - (byte) (H3 >>> 40), (byte) (H3 >>> 32), - (byte) (H3 >>> 24), (byte) (H3 >>> 16), - (byte) (H3 >>> 8), (byte) H3, - (byte) (H4 >>> 56), (byte) (H4 >>> 48), - (byte) (H4 >>> 40), (byte) (H4 >>> 32), - (byte) (H4 >>> 24), (byte) (H4 >>> 16), - (byte) (H4 >>> 8), (byte) H4, - (byte) (H5 >>> 56), (byte) (H5 >>> 48), - (byte) (H5 >>> 40), (byte) (H5 >>> 32), - (byte) (H5 >>> 24), (byte) (H5 >>> 16), - (byte) (H5 >>> 8), (byte) H5, - (byte) (H6 >>> 56), (byte) (H6 >>> 48), - (byte) (H6 >>> 40), (byte) (H6 >>> 32), - (byte) (H6 >>> 24), (byte) (H6 >>> 16), - (byte) (H6 >>> 8), (byte) H6, - (byte) (H7 >>> 56), (byte) (H7 >>> 48), - (byte) (H7 >>> 40), (byte) (H7 >>> 32), - (byte) (H7 >>> 24), (byte) (H7 >>> 16), - (byte) (H7 >>> 8), (byte) H7 }; + byte[] result = new byte[] { + (byte)(H0 >>> 56), (byte)(H0 >>> 48), (byte)(H0 >>> 40), (byte)(H0 >>> 32), + (byte)(H0 >>> 24), (byte)(H0 >>> 16), (byte)(H0 >>> 8), (byte) H0, + (byte)(H1 >>> 56), (byte)(H1 >>> 48), (byte)(H1 >>> 40), (byte)(H1 >>> 32), + (byte)(H1 >>> 24), (byte)(H1 >>> 16), (byte)(H1 >>> 8), (byte) H1, + (byte)(H2 >>> 56), (byte)(H2 >>> 48), (byte)(H2 >>> 40), (byte)(H2 >>> 32), + (byte)(H2 >>> 24), (byte)(H2 >>> 16), (byte)(H2 >>> 8), (byte) H2, + (byte)(H3 >>> 56), (byte)(H3 >>> 48), (byte)(H3 >>> 40), (byte)(H3 >>> 32), + (byte)(H3 >>> 24), (byte)(H3 >>> 16), (byte)(H3 >>> 8), (byte) H3, + (byte)(H4 >>> 56), (byte)(H4 >>> 48), (byte)(H4 >>> 40), (byte)(H4 >>> 32), + (byte)(H4 >>> 24), (byte)(H4 >>> 16), (byte)(H4 >>> 8), (byte) H4, + (byte)(H5 >>> 56), (byte)(H5 >>> 48), (byte)(H5 >>> 40), (byte)(H5 >>> 32), + (byte)(H5 >>> 24), (byte)(H5 >>> 16), (byte)(H5 >>> 8), (byte) H5, + (byte)(H6 >>> 56), (byte)(H6 >>> 48), (byte)(H6 >>> 40), (byte)(H6 >>> 32), + (byte)(H6 >>> 24), (byte)(H6 >>> 16), (byte)(H6 >>> 8), (byte) H6, + (byte)(H7 >>> 56), (byte)(H7 >>> 48), (byte)(H7 >>> 40), (byte)(H7 >>> 32), + (byte)(H7 >>> 24), (byte)(H7 >>> 16), (byte)(H7 >>> 8), (byte) H7 + }; return result; } @@ -617,10 +642,8 @@ public final class Whirlpool extends BaseHash public boolean selfTest() { if (valid == null) - { - valid = new Boolean( - DIGEST0.equals(Util.toString(new Whirlpool().digest()))); - } + valid = new Boolean(DIGEST0.equals(Util.toString(new Whirlpool().digest()))); + return valid.booleanValue(); } } diff --git a/gnu/java/security/jce/hash/HavalSpi.java b/gnu/java/security/jce/hash/HavalSpi.java index e127779ef..05595edea 100644 --- a/gnu/java/security/jce/hash/HavalSpi.java +++ b/gnu/java/security/jce/hash/HavalSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the <code>HAVAL</code> <i>Service Provider Interface</i> * (<b>SPI</b>) Adapter.<p> - * - * @version Revision: $ */ public class HavalSpi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/MD2Spi.java b/gnu/java/security/jce/hash/MD2Spi.java index 3fc382138..001cbaf3c 100644 --- a/gnu/java/security/jce/hash/MD2Spi.java +++ b/gnu/java/security/jce/hash/MD2Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the MD2 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class MD2Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/MD4Spi.java b/gnu/java/security/jce/hash/MD4Spi.java index 52ad9ea74..41fef87bf 100644 --- a/gnu/java/security/jce/hash/MD4Spi.java +++ b/gnu/java/security/jce/hash/MD4Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the MD4 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class MD4Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/MD5Spi.java b/gnu/java/security/jce/hash/MD5Spi.java index 39aee85c7..aa1a8844e 100644 --- a/gnu/java/security/jce/hash/MD5Spi.java +++ b/gnu/java/security/jce/hash/MD5Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the MD5 <i>Service Provider Interface</i> (<b>SPI</b>) * adapter.<p> - * - * @version $Revision: 1.1.4.1 $ */ public class MD5Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/MessageDigestAdapter.java b/gnu/java/security/jce/hash/MessageDigestAdapter.java index c804f5f00..e30beca3d 100644 --- a/gnu/java/security/jce/hash/MessageDigestAdapter.java +++ b/gnu/java/security/jce/hash/MessageDigestAdapter.java @@ -59,8 +59,6 @@ import java.security.MessageDigestSpi; * * All the implementations which subclass this object, and which are serviced by * the GNU Crypto provider implement the {@link java.lang.Cloneable} interface.<p> - * - * @version $Revision: 1.1.4.1 $ */ class MessageDigestAdapter extends MessageDigestSpi implements Cloneable { diff --git a/gnu/java/security/jce/hash/RipeMD128Spi.java b/gnu/java/security/jce/hash/RipeMD128Spi.java index c5f45ea5b..404214d91 100644 --- a/gnu/java/security/jce/hash/RipeMD128Spi.java +++ b/gnu/java/security/jce/hash/RipeMD128Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the RIPEMD-128 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.<p> - * - * @version $Revision: 1.1.4.1 $ */ public class RipeMD128Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/RipeMD160Spi.java b/gnu/java/security/jce/hash/RipeMD160Spi.java index 408a9b54d..841f46b3b 100644 --- a/gnu/java/security/jce/hash/RipeMD160Spi.java +++ b/gnu/java/security/jce/hash/RipeMD160Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the RIPEMD-160 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.<p> - * - * @version $Revision: 1.1.4.1 $ */ public class RipeMD160Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/Sha160Spi.java b/gnu/java/security/jce/hash/Sha160Spi.java index 55075dee8..419884382 100644 --- a/gnu/java/security/jce/hash/Sha160Spi.java +++ b/gnu/java/security/jce/hash/Sha160Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the SHA-1 (160-bit) <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.<p> - * - * @version $Revision: 1.1.4.1 $ */ public class Sha160Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/Sha256Spi.java b/gnu/java/security/jce/hash/Sha256Spi.java index 7bb321cde..f07e18941 100644 --- a/gnu/java/security/jce/hash/Sha256Spi.java +++ b/gnu/java/security/jce/hash/Sha256Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the SHA-2-1 (256-bit) <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class Sha256Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/Sha384Spi.java b/gnu/java/security/jce/hash/Sha384Spi.java index 2fd7ff4a9..fc17077e8 100644 --- a/gnu/java/security/jce/hash/Sha384Spi.java +++ b/gnu/java/security/jce/hash/Sha384Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the SHA-2-2 (384-bit) <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class Sha384Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/Sha512Spi.java b/gnu/java/security/jce/hash/Sha512Spi.java index 8b38a442b..0b4c3d62c 100644 --- a/gnu/java/security/jce/hash/Sha512Spi.java +++ b/gnu/java/security/jce/hash/Sha512Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the SHA-2-3 (512-bit) <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class Sha512Spi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/TigerSpi.java b/gnu/java/security/jce/hash/TigerSpi.java index fe0f8d67a..599437410 100644 --- a/gnu/java/security/jce/hash/TigerSpi.java +++ b/gnu/java/security/jce/hash/TigerSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the Tiger <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class TigerSpi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/hash/WhirlpoolSpi.java b/gnu/java/security/jce/hash/WhirlpoolSpi.java index d37464ef0..d1864bc7c 100644 --- a/gnu/java/security/jce/hash/WhirlpoolSpi.java +++ b/gnu/java/security/jce/hash/WhirlpoolSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Whirlpool <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.<p> - * - * @version $Revision: 1.1.4.1 $ */ public class WhirlpoolSpi extends MessageDigestAdapter { diff --git a/gnu/java/security/jce/prng/SecureRandomAdapter.java b/gnu/java/security/jce/prng/SecureRandomAdapter.java index e7cb72091..70d30f153 100644 --- a/gnu/java/security/jce/prng/SecureRandomAdapter.java +++ b/gnu/java/security/jce/prng/SecureRandomAdapter.java @@ -42,7 +42,7 @@ import gnu.java.security.prng.LimitReachedException; import gnu.java.security.prng.MDGenerator; import java.security.SecureRandomSpi; -import java.util.HashMap; +import java.util.Collections; /** * <p>The implementation of a generic {@link java.security.SecureRandom} adapter @@ -80,6 +80,7 @@ abstract class SecureRandomAdapter extends SecureRandomSpi super(); this.mdName = mdName; + adaptee.init (Collections.singletonMap (MDGenerator.MD_NAME, mdName)); } // Class methods @@ -118,9 +119,6 @@ abstract class SecureRandomAdapter extends SecureRandomSpi public void engineSetSeed(byte[] seed) { - HashMap attributes = new HashMap(); - attributes.put(MDGenerator.MD_NAME, mdName); - attributes.put(MDGenerator.SEEED, seed); - adaptee.init(attributes); + adaptee.addRandomBytes (seed); } } diff --git a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java index 49a64afbd..44503b26b 100644 --- a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java +++ b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java @@ -57,8 +57,6 @@ import java.util.HashMap; * In case the client does not explicitly initialize the KeyPairGenerator (via * a call to an <code>initialize()</code> method), the GNU Crypto provider * uses a default <i>modulus</i> size (keysize) of 1024 bits.<p> - * - * @version $Revision: 1.3.2.1 $ */ public class DSSKeyPairGeneratorSpi extends KeyPairGeneratorAdapter implements DSAKeyPairGenerator diff --git a/gnu/java/security/jce/sig/DSSRawSignatureSpi.java b/gnu/java/security/jce/sig/DSSRawSignatureSpi.java index 5573b39f3..a63c51afa 100644 --- a/gnu/java/security/jce/sig/DSSRawSignatureSpi.java +++ b/gnu/java/security/jce/sig/DSSRawSignatureSpi.java @@ -45,8 +45,6 @@ import gnu.java.security.sig.dss.DSSSignatureRawCodec; * The implementation of <i>Service Provider Interface</i> (<b>SPI</b>) adapter * for the DSS (Digital Signature Standard) signature scheme, encoded and/or * decoded in RAW format.<p> - * - * @version $Revision: 1.1.4.1 $ */ public class DSSRawSignatureSpi extends SignatureAdapter { diff --git a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java index 29a10ecf9..edf19f627 100644 --- a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java +++ b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java @@ -63,8 +63,6 @@ import java.security.spec.AlgorithmParameterSpec; * supplies (and document) default values to be used. For example, the GNU * Crypto provider uses a default <i>modulus</i> size (keysize) of 1024 bits for * the DSS (Digital Signature Standard) a.k.a <i>DSA</i>.<p> - * - * @version $Revision: 1.3.2.1 $ */ public abstract class KeyPairGeneratorAdapter extends KeyPairGenerator { diff --git a/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java b/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java index d2e15f819..f3548d884 100644 --- a/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java +++ b/gnu/java/security/jce/sig/RSAPSSRawSignatureSpi.java @@ -44,8 +44,6 @@ import gnu.java.security.sig.rsa.RSAPSSSignatureRawCodec; /** * The implementation of <i>Service Provider Interface</i> (<b>SPI</b>) adapter * for the RSA-PSS signature scheme, encoded and/or decoded in RAW format.<p> - * - * @version $Revision: 1.1.4.1 $ */ public class RSAPSSRawSignatureSpi extends SignatureAdapter { diff --git a/gnu/java/security/key/IKeyPairCodec.java b/gnu/java/security/key/IKeyPairCodec.java index 4a234173f..965a317d4 100644 --- a/gnu/java/security/key/IKeyPairCodec.java +++ b/gnu/java/security/key/IKeyPairCodec.java @@ -48,8 +48,6 @@ import java.security.PublicKey; * cryptographic asymmetric keypairs. Codecs are useful for (a) externalising * public and private keys for storage and on-the-wire transmission, as well as * (b) re-creating their internal Java representation from external sources.</p> - * - * @version $Revision: 1.2.2.1 $ */ public interface IKeyPairCodec { diff --git a/gnu/java/security/key/IKeyPairGenerator.java b/gnu/java/security/key/IKeyPairGenerator.java index 8287ec607..2e0b29928 100644 --- a/gnu/java/security/key/IKeyPairGenerator.java +++ b/gnu/java/security/key/IKeyPairGenerator.java @@ -43,8 +43,6 @@ import java.util.Map; /** * The visible methods of every asymmetric keypair generator.<p> - * - * @version $Revision: 1.1.4.1 $ */ public interface IKeyPairGenerator { diff --git a/gnu/java/security/key/KeyPairGeneratorFactory.java b/gnu/java/security/key/KeyPairGeneratorFactory.java index 2121489ca..8c2f348c9 100644 --- a/gnu/java/security/key/KeyPairGeneratorFactory.java +++ b/gnu/java/security/key/KeyPairGeneratorFactory.java @@ -49,8 +49,6 @@ import java.util.Set; /** * <p>A Factory to instantiate asymmetric keypair generators.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class KeyPairGeneratorFactory { @@ -87,7 +85,7 @@ public class KeyPairGeneratorFactory name = name.trim(); IKeyPairGenerator result = null; if (name.equalsIgnoreCase(Registry.DSA_KPG) - || name.equals(Registry.DSS_KPG)) + || name.equalsIgnoreCase(Registry.DSS_KPG)) { result = new DSSKeyPairGenerator(); } @@ -118,6 +116,7 @@ public class KeyPairGeneratorFactory { HashSet hs = new HashSet(); hs.add(Registry.DSS_KPG); + hs.add(Registry.DSA_KPG); hs.add(Registry.RSA_KPG); hs.add(Registry.DH_KPG); hs.add(Registry.SRP_KPG); @@ -135,11 +134,9 @@ public class KeyPairGeneratorFactory } catch (Exception x) { - IllegalArgumentException iae = - new IllegalArgumentException ("strong crypto key pair generator not available: " - + clazz); - iae.initCause (x); - throw iae; + throw new IllegalArgumentException( + "strong crypto key pair generator not available: " + clazz, + x); } } diff --git a/gnu/java/security/key/dss/DSSKey.java b/gnu/java/security/key/dss/DSSKey.java index c406607d2..c4d3847a5 100644 --- a/gnu/java/security/key/dss/DSSKey.java +++ b/gnu/java/security/key/dss/DSSKey.java @@ -60,7 +60,6 @@ import java.security.spec.DSAParameterSpec; * the relevant <code>getEncoded()</code> methods of each of the private and * public keys.</p> * - * @version $Revision: 1.4.2.2 $ * @see DSSPrivateKey#getEncoded * @see DSSPublicKey#getEncoded */ diff --git a/gnu/java/security/key/dss/DSSKeyPairRawCodec.java b/gnu/java/security/key/dss/DSSKeyPairRawCodec.java index 1d4a0a7d7..7c5491d6f 100644 --- a/gnu/java/security/key/dss/DSSKeyPairRawCodec.java +++ b/gnu/java/security/key/dss/DSSKeyPairRawCodec.java @@ -49,8 +49,6 @@ import java.security.PublicKey; /** * <p>An object that implements the {@link IKeyPairCodec} operations for the * <i>Raw</i> format to use with DSS keypairs.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class DSSKeyPairRawCodec implements IKeyPairCodec { diff --git a/gnu/java/security/key/dss/DSSPrivateKey.java b/gnu/java/security/key/dss/DSSPrivateKey.java index 786fc47b9..fe59cb6d7 100644 --- a/gnu/java/security/key/dss/DSSPrivateKey.java +++ b/gnu/java/security/key/dss/DSSPrivateKey.java @@ -49,12 +49,10 @@ import java.security.interfaces.DSAPrivateKey; /** * <p>An object that embodies a DSS (Digital Signature Standard) private key.</p> * - * @version $Revision: 1.2.2.2 $ * @see #getEncoded */ public class DSSPrivateKey extends DSSKey implements PrivateKey, DSAPrivateKey { - // Constants and variables // ------------------------------------------------------------------------- diff --git a/gnu/java/security/key/dss/DSSPublicKey.java b/gnu/java/security/key/dss/DSSPublicKey.java index 34e726280..522921313 100644 --- a/gnu/java/security/key/dss/DSSPublicKey.java +++ b/gnu/java/security/key/dss/DSSPublicKey.java @@ -49,12 +49,10 @@ import java.security.interfaces.DSAPublicKey; /** * <p>An object that embodies a DSS (Digital Signature Standard) public key.</p> * - * @version $Revision: 1.2.2.2 $ * @see #getEncoded */ public class DSSPublicKey extends DSSKey implements PublicKey, DSAPublicKey { - // Constants and variables // ------------------------------------------------------------------------- diff --git a/gnu/java/security/key/dss/FIPS186.java b/gnu/java/security/key/dss/FIPS186.java index 6b351d229..5984bcc93 100644 --- a/gnu/java/security/key/dss/FIPS186.java +++ b/gnu/java/security/key/dss/FIPS186.java @@ -53,8 +53,6 @@ import java.security.SecureRandom; * <a href="http://www.itl.nist.gov/fipspubs/fip186.htm">Digital Signature * Standard (DSS)</a>, Federal Information Processing Standards Publication 186. * National Institute of Standards and Technology. - * - * @version $Revision: 1.2.2.1 $ */ public class FIPS186 { diff --git a/gnu/java/security/key/rsa/GnuRSAKey.java b/gnu/java/security/key/rsa/GnuRSAKey.java index 7846323f6..098d372dc 100644 --- a/gnu/java/security/key/rsa/GnuRSAKey.java +++ b/gnu/java/security/key/rsa/GnuRSAKey.java @@ -48,8 +48,6 @@ import java.security.interfaces.RSAKey; /** * <p>A base asbtract class for both public and private RSA keys.</p> - * - * @version $Revision: 1.3.2.1 $ */ public abstract class GnuRSAKey implements Key, RSAKey { diff --git a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java index b3b94d8e2..7d3144bcd 100644 --- a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java +++ b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java @@ -56,8 +56,6 @@ import java.security.interfaces.RSAPrivateKey; * Primitive specification and supporting documentation.<br> * Jakob Jonsson and Burt Kaliski.</li> * </ol> - * - * @version $Revision: 1.3.2.1 $ */ public class GnuRSAPrivateKey extends GnuRSAKey implements PrivateKey, RSAPrivateCrtKey diff --git a/gnu/java/security/key/rsa/GnuRSAPublicKey.java b/gnu/java/security/key/rsa/GnuRSAPublicKey.java index 4c8ca597d..bb5d0a49f 100644 --- a/gnu/java/security/key/rsa/GnuRSAPublicKey.java +++ b/gnu/java/security/key/rsa/GnuRSAPublicKey.java @@ -55,8 +55,6 @@ import java.security.interfaces.RSAPublicKey; * Primitive specification and supporting documentation.<br> * Jakob Jonsson and Burt Kaliski.</li> * </ol> - * - * @version $Revision: 1.2.2.1 $ */ public class GnuRSAPublicKey extends GnuRSAKey implements PublicKey, RSAPublicKey diff --git a/gnu/java/security/prng/MDGenerator.java b/gnu/java/security/prng/MDGenerator.java index 255647d1c..073c559ae 100644 --- a/gnu/java/security/prng/MDGenerator.java +++ b/gnu/java/security/prng/MDGenerator.java @@ -122,6 +122,20 @@ public class MDGenerator extends BasePRNG implements Cloneable md.update(buffer, 0, buffer.length); } + public void addRandomByte (final byte b) + { + if (md == null) + throw new IllegalStateException ("not initialized"); + md.update (b); + } + + public void addRandomBytes (final byte[] buf, final int off, final int len) + { + if (md == null) + throw new IllegalStateException ("not initialized"); + md.update (buf, off, len); + } + // Cloneable interface implementation --------------------------------------- public Object clone() throws CloneNotSupportedException diff --git a/gnu/java/security/sig/ISignature.java b/gnu/java/security/sig/ISignature.java index 118b7701a..e77f39d2c 100644 --- a/gnu/java/security/sig/ISignature.java +++ b/gnu/java/security/sig/ISignature.java @@ -56,8 +56,6 @@ import java.util.Map; * Cryptography</a>, Alfred J. Menezes, Paul C. van Oorschot and Scott A. * Vanstone. Section 11.2.2 Digital signature schemes with appendix.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public interface ISignature extends Cloneable { diff --git a/gnu/java/security/sig/ISignatureCodec.java b/gnu/java/security/sig/ISignatureCodec.java index 86d190944..b6ab0ba9b 100644 --- a/gnu/java/security/sig/ISignatureCodec.java +++ b/gnu/java/security/sig/ISignatureCodec.java @@ -45,8 +45,6 @@ import gnu.java.security.Registry; * cryptographic signatures. Codecs are useful for (a) externalising signature * output data for storage and on-the-wire transmission, as well as (b) re- * creating their internal Java representation from external sources.</p> - * - * @version $Revision: 1.1.4.1 $ */ public interface ISignatureCodec { diff --git a/gnu/java/security/sig/dss/DSSSignature.java b/gnu/java/security/sig/dss/DSSSignature.java index dd4087316..370a93854 100644 --- a/gnu/java/security/sig/dss/DSSSignature.java +++ b/gnu/java/security/sig/dss/DSSSignature.java @@ -111,8 +111,6 @@ import java.util.Random; * Signature Standard (DSS)</a>, Federal Information Processing Standards * Publication 186. National Institute of Standards and Technology.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public class DSSSignature extends BaseSignature { diff --git a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java index fa25c9201..b0590a573 100644 --- a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java +++ b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java @@ -47,8 +47,6 @@ import java.math.BigInteger; /** * <p>An object that implements the {@link ISignatureCodec} operations for the * <i>Raw</i> format to use with DSS signatures.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class DSSSignatureRawCodec implements ISignatureCodec { diff --git a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java index 27ab5d493..d155fc88f 100644 --- a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java +++ b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java @@ -57,8 +57,6 @@ import java.io.ByteArrayOutputStream; * RSA Cryptography Specifications Version 2.1.<br> * Jakob Jonsson and Burt Kaliski.</li> * </ol> - * - * @version $Revision: 1.2.2.1 $ */ public class EMSA_PKCS1_V1_5 implements Cloneable { diff --git a/gnu/java/security/sig/rsa/EMSA_PSS.java b/gnu/java/security/sig/rsa/EMSA_PSS.java index 845b6ab56..c1c9760ed 100644 --- a/gnu/java/security/sig/rsa/EMSA_PSS.java +++ b/gnu/java/security/sig/rsa/EMSA_PSS.java @@ -67,8 +67,6 @@ import java.util.Arrays; * Primitive specification and supporting documentation.<br> * Jakob Jonsson and Burt Kaliski.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public class EMSA_PSS implements Cloneable { diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java index 38cdf2934..e64d30b69 100644 --- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java +++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java @@ -67,8 +67,6 @@ import java.util.Arrays; * RSA Cryptography Specifications Version 2.1.<br> * Jakob Jonsson and Burt Kaliski.</li> * </ol> - * - * @version $Revision: 1.2.2.1 $ */ public class RSAPKCS1V1_5Signature extends BaseSignature { diff --git a/gnu/java/security/sig/rsa/RSAPSSSignature.java b/gnu/java/security/sig/rsa/RSAPSSSignature.java index cbf66c958..7ec62568a 100644 --- a/gnu/java/security/sig/rsa/RSAPSSSignature.java +++ b/gnu/java/security/sig/rsa/RSAPSSSignature.java @@ -70,8 +70,6 @@ import java.security.interfaces.RSAPublicKey; * Primitive specification and supporting documentation.<br> * Jakob Jonsson and Burt Kaliski.</li> * </ol> - * - * @version $Revision: 1.2.2.1 $ */ public class RSAPSSSignature extends BaseSignature { diff --git a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java index 16e70c69e..2be79165f 100644 --- a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java +++ b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java @@ -46,8 +46,6 @@ import java.io.ByteArrayOutputStream; /** * <p>An object that implements the {@link gnu.crypto.sig.ISignatureCodec} * operations for the <i>Raw</i> format to use with RSA-PSS signatures.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class RSAPSSSignatureRawCodec implements ISignatureCodec { diff --git a/gnu/java/security/util/Util.java b/gnu/java/security/util/Util.java index 7eb308e2d..f39afb931 100644 --- a/gnu/java/security/util/Util.java +++ b/gnu/java/security/util/Util.java @@ -42,8 +42,6 @@ import java.math.BigInteger; /** * <p>A collection of utility methods used throughout this project.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class Util { diff --git a/gnu/java/util/jar/JarUtils.java b/gnu/java/util/jar/JarUtils.java index bf40dbef6..c35daec55 100644 --- a/gnu/java/util/jar/JarUtils.java +++ b/gnu/java/util/jar/JarUtils.java @@ -67,6 +67,18 @@ public abstract class JarUtils public static final String DSA_SUFFIX = ".DSA"; public static final String SF_SUFFIX = ".SF"; public static final String NAME = "Name"; + + /** + * The original string representation of the manifest version attribute name. + */ + public static final String MANIFEST_VERSION = "Manifest-Version"; + + /** + * The original string representation of the signature version attribute + * name. + */ + public static final String SIGNATURE_VERSION = "Signature-Version"; + /** Platform-independent line-ending. */ public static final byte[] CRLF = new byte[] { 0x0D, 0x0A }; private static final String DEFAULT_MF_VERSION = "1.0"; @@ -99,7 +111,7 @@ public abstract class JarUtils try { String version = expectHeader(version_header, br); - attr.putValue(Name.SIGNATURE_VERSION, version); + attr.putValue(SIGNATURE_VERSION, version); if (! DEFAULT_SF_VERSION.equals(version)) log.warning("Unexpected version number: " + version + ". Continue (but may fail later)"); @@ -130,7 +142,7 @@ public abstract class JarUtils // attributes of Manifest. // XXX (rsn): why 0.0 and not 1.0? if (attr.getValue(Name.MANIFEST_VERSION) == null) - attr.putValue(Name.MANIFEST_VERSION, "0.0"); + attr.putValue(MANIFEST_VERSION, "0.0"); } private static void readIndividualSections(Map entries, BufferedReader br) @@ -157,7 +169,7 @@ public abstract class JarUtils try { String value = expectHeader(version_header, br); - attr.putValue(Name.MANIFEST_VERSION, value); + attr.putValue(MANIFEST_VERSION, value); } catch (IOException ioe) { diff --git a/gnu/javax/crypto/assembly/Assembly.java b/gnu/javax/crypto/assembly/Assembly.java index 56bc5003b..2d5bba364 100644 --- a/gnu/javax/crypto/assembly/Assembly.java +++ b/gnu/javax/crypto/assembly/Assembly.java @@ -51,7 +51,6 @@ import java.util.Map; * of the {@link Transformer} chain of the <code>Assembly</code>.</p> * * @see Transformer - * @version $Revision: 1.1.4.1 $ */ public class Assembly { diff --git a/gnu/javax/crypto/assembly/Cascade.java b/gnu/javax/crypto/assembly/Cascade.java index 313532d2e..678a7e730 100644 --- a/gnu/javax/crypto/assembly/Cascade.java +++ b/gnu/javax/crypto/assembly/Cascade.java @@ -72,8 +72,6 @@ import java.util.Set; * CRC Press, Inc. ISBN 0-8493-8523-7, 1997<br> * Menezes, A., van Oorschot, P. and S. Vanstone.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public class Cascade { diff --git a/gnu/javax/crypto/assembly/CascadeStage.java b/gnu/javax/crypto/assembly/CascadeStage.java index ba1123713..81629f5a8 100644 --- a/gnu/javax/crypto/assembly/CascadeStage.java +++ b/gnu/javax/crypto/assembly/CascadeStage.java @@ -45,8 +45,6 @@ import java.util.Set; /** * <p>A Cascade <i>Stage</i> in a Cascade Cipher.</p> - * - * @version $Revision: 1.1.4.1 $ */ class CascadeStage extends Stage { diff --git a/gnu/javax/crypto/assembly/CascadeTransformer.java b/gnu/javax/crypto/assembly/CascadeTransformer.java index 828bda343..dbbc7cd28 100644 --- a/gnu/javax/crypto/assembly/CascadeTransformer.java +++ b/gnu/javax/crypto/assembly/CascadeTransformer.java @@ -44,8 +44,6 @@ import java.util.Map; /** * An Adapter to use any {@link Cascade} as a {@link Transformer} in an * {@link Assembly}. - * - * @version $Revision: 1.1.4.1 $ */ class CascadeTransformer extends Transformer { diff --git a/gnu/javax/crypto/assembly/Direction.java b/gnu/javax/crypto/assembly/Direction.java index eea026d3e..58b59a630 100644 --- a/gnu/javax/crypto/assembly/Direction.java +++ b/gnu/javax/crypto/assembly/Direction.java @@ -49,8 +49,6 @@ package gnu.javax.crypto.assembly; * its inverse value</li> * <li>REVERSED: equivalent to {@link gnu.crypto.mode.IMode#DECRYPTION}.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public final class Direction { diff --git a/gnu/javax/crypto/assembly/LoopbackTransformer.java b/gnu/javax/crypto/assembly/LoopbackTransformer.java index 546b5f86f..3c0bdfab3 100644 --- a/gnu/javax/crypto/assembly/LoopbackTransformer.java +++ b/gnu/javax/crypto/assembly/LoopbackTransformer.java @@ -43,8 +43,6 @@ import java.util.Map; /** * A trivial {@link Transformer} to allow closing a chain in an {@link Assembly}. * This class is not visible outside this package. - * - * @version $Revision: 1.1.4.1 $ */ final class LoopbackTransformer extends Transformer { diff --git a/gnu/javax/crypto/assembly/ModeStage.java b/gnu/javax/crypto/assembly/ModeStage.java index 09029a8d8..1143348f6 100644 --- a/gnu/javax/crypto/assembly/ModeStage.java +++ b/gnu/javax/crypto/assembly/ModeStage.java @@ -53,8 +53,6 @@ import java.util.Set; * <p>Such a stage wraps an implementation of a Block Cipher Mode of Operation * ({@link IMode}) to allow inclusion of such an instance in a cascade of block * ciphers.</p> - * - * @version $Revision: 1.1.4.1 $ */ class ModeStage extends Stage { diff --git a/gnu/javax/crypto/assembly/Operation.java b/gnu/javax/crypto/assembly/Operation.java index 209a9786e..34cae52ea 100644 --- a/gnu/javax/crypto/assembly/Operation.java +++ b/gnu/javax/crypto/assembly/Operation.java @@ -51,8 +51,6 @@ package gnu.javax.crypto.assembly; * the chain, and the resulting bytes are then processed by the current * {@link Transformer}.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public final class Operation { diff --git a/gnu/javax/crypto/assembly/PaddingTransformer.java b/gnu/javax/crypto/assembly/PaddingTransformer.java index 5ac27548d..c63f92e87 100644 --- a/gnu/javax/crypto/assembly/PaddingTransformer.java +++ b/gnu/javax/crypto/assembly/PaddingTransformer.java @@ -50,8 +50,6 @@ import java.util.Map; * <p>When using such a {@link Transformer}, in an {@link Assembly}, there must * be at least one element behind this instance in the constructed chain; * otherwise, a {@link TransformerException} is thrown at initialisation time.</p> - * - * @version $Revision: 1.1.4.1 $ */ class PaddingTransformer extends Transformer { diff --git a/gnu/javax/crypto/assembly/Stage.java b/gnu/javax/crypto/assembly/Stage.java index 41fbb4f88..23d50bb82 100644 --- a/gnu/javax/crypto/assembly/Stage.java +++ b/gnu/javax/crypto/assembly/Stage.java @@ -82,7 +82,6 @@ import java.util.Set; * * @see ModeStage * @see CascadeStage - * @version $Revision: 1.1.4.1 $ */ public abstract class Stage { diff --git a/gnu/javax/crypto/assembly/Transformer.java b/gnu/javax/crypto/assembly/Transformer.java index 3e8bced31..80430dc19 100644 --- a/gnu/javax/crypto/assembly/Transformer.java +++ b/gnu/javax/crypto/assembly/Transformer.java @@ -77,7 +77,6 @@ import java.util.Map; * @see CascadeTransformer * @see PaddingTransformer * @see DeflateTransformer - * @version $Revision: 1.1.4.1 $ */ public abstract class Transformer { diff --git a/gnu/javax/crypto/cipher/Square.java b/gnu/javax/crypto/cipher/Square.java index 55e986526..97773e5ea 100644 --- a/gnu/javax/crypto/cipher/Square.java +++ b/gnu/javax/crypto/cipher/Square.java @@ -59,8 +59,6 @@ import java.util.Iterator; * <a href="mailto:lars.knudsen@esat.kuleuven.ac.be">Lars Knudsen</a> and * <a href="mailto:vincent.rijmen@esat.kuleuven.ac.be">Vincent Rijmen</a>.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public final class Square extends BaseCipher { @@ -517,4 +515,4 @@ public final class Square extends BaseCipher } return valid.booleanValue(); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/AESSpi.java b/gnu/javax/crypto/jce/cipher/AESSpi.java index 541868c50..33de68956 100644 --- a/gnu/javax/crypto/jce/cipher/AESSpi.java +++ b/gnu/javax/crypto/jce/cipher/AESSpi.java @@ -52,8 +52,6 @@ import java.security.spec.InvalidParameterSpecException; /** * The implementation of the AES <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class AESSpi extends CipherAdapter { @@ -101,4 +99,4 @@ public final class AESSpi extends CipherAdapter } engineInit(opmode, key, spec, random); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/ARCFourSpi.java b/gnu/javax/crypto/jce/cipher/ARCFourSpi.java index 7f2c9aeee..963fa1c00 100644 --- a/gnu/javax/crypto/jce/cipher/ARCFourSpi.java +++ b/gnu/javax/crypto/jce/cipher/ARCFourSpi.java @@ -64,8 +64,6 @@ import javax.crypto.ShortBufferException; /** * The <i>Service Provider Interface</i> (<b>SPI</b>) for the ARCFOUR * stream cipher. - * - * @version $Revision: 1.1.4.1 $ */ public class ARCFourSpi extends CipherSpi { @@ -205,4 +203,4 @@ public class ARCFourSpi extends CipherSpi { return engineUpdate(in, inOffset, length, out, outOffset); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/AnubisSpi.java b/gnu/javax/crypto/jce/cipher/AnubisSpi.java index 732993736..0fca3b491 100644 --- a/gnu/javax/crypto/jce/cipher/AnubisSpi.java +++ b/gnu/javax/crypto/jce/cipher/AnubisSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Anubis <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class AnubisSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class AnubisSpi extends CipherAdapter { super(Registry.ANUBIS_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/BlowfishSpi.java b/gnu/javax/crypto/jce/cipher/BlowfishSpi.java index 9c8ef0547..d31d7e193 100644 --- a/gnu/javax/crypto/jce/cipher/BlowfishSpi.java +++ b/gnu/javax/crypto/jce/cipher/BlowfishSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Blowfish <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class BlowfishSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class BlowfishSpi extends CipherAdapter { super(Registry.BLOWFISH_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/CipherAdapter.java b/gnu/javax/crypto/jce/cipher/CipherAdapter.java index 96d7741dd..5eaa31b77 100644 --- a/gnu/javax/crypto/jce/cipher/CipherAdapter.java +++ b/gnu/javax/crypto/jce/cipher/CipherAdapter.java @@ -82,8 +82,6 @@ import javax.crypto.spec.IvParameterSpec; * and the initialization vector, the subclass should override those methods. * Otherwise a subclass need only call the {@link #CipherAdapter(String)} * constructor with the name of the cipher.</p> - * - * @version $Revision: 1.1.4.1 $ */ class CipherAdapter extends CipherSpi { @@ -504,4 +502,4 @@ class CipherAdapter extends CipherSpi partBlock = new byte[blockLen]; partLen = 0; } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/DESSpi.java b/gnu/javax/crypto/jce/cipher/DESSpi.java index 801b2f138..ff86071c4 100644 --- a/gnu/javax/crypto/jce/cipher/DESSpi.java +++ b/gnu/javax/crypto/jce/cipher/DESSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the DES <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class DESSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class DESSpi extends CipherAdapter { super(Registry.DES_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/KhazadSpi.java b/gnu/javax/crypto/jce/cipher/KhazadSpi.java index 93c4ce37b..397c27d2e 100644 --- a/gnu/javax/crypto/jce/cipher/KhazadSpi.java +++ b/gnu/javax/crypto/jce/cipher/KhazadSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Khazad <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class KhazadSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class KhazadSpi extends CipherAdapter { super(Registry.KHAZAD_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/NullCipherSpi.java b/gnu/javax/crypto/jce/cipher/NullCipherSpi.java index 596edee63..e6d78ef39 100644 --- a/gnu/javax/crypto/jce/cipher/NullCipherSpi.java +++ b/gnu/javax/crypto/jce/cipher/NullCipherSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Null cipher <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class NullCipherSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class NullCipherSpi extends CipherAdapter { super(Registry.NULL_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/PBES2.java b/gnu/javax/crypto/jce/cipher/PBES2.java index 0efb61e45..9889ab9fc 100644 --- a/gnu/javax/crypto/jce/cipher/PBES2.java +++ b/gnu/javax/crypto/jce/cipher/PBES2.java @@ -56,8 +56,6 @@ import javax.crypto.spec.SecretKeySpec; /** * <p>.</p> - * - * @version $Revision: 1.1.4.1 $ */ public abstract class PBES2 extends CipherAdapter { @@ -1349,4 +1347,4 @@ public abstract class PBES2 extends CipherAdapter } } } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/RijndaelSpi.java b/gnu/javax/crypto/jce/cipher/RijndaelSpi.java index 0094b2a73..137db2c3f 100644 --- a/gnu/javax/crypto/jce/cipher/RijndaelSpi.java +++ b/gnu/javax/crypto/jce/cipher/RijndaelSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Rijndael <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class RijndaelSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class RijndaelSpi extends CipherAdapter { super(Registry.RIJNDAEL_CIPHER, 16); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/SerpentSpi.java b/gnu/javax/crypto/jce/cipher/SerpentSpi.java index ec2e591fe..9df9685cc 100644 --- a/gnu/javax/crypto/jce/cipher/SerpentSpi.java +++ b/gnu/javax/crypto/jce/cipher/SerpentSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Serpent <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class SerpentSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class SerpentSpi extends CipherAdapter { super(Registry.SERPENT_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/SquareSpi.java b/gnu/javax/crypto/jce/cipher/SquareSpi.java index c162d1616..96e5dee38 100644 --- a/gnu/javax/crypto/jce/cipher/SquareSpi.java +++ b/gnu/javax/crypto/jce/cipher/SquareSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Square <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class SquareSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class SquareSpi extends CipherAdapter { super(Registry.SQUARE_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/TripleDESSpi.java b/gnu/javax/crypto/jce/cipher/TripleDESSpi.java index 9ff9df97e..5c58ea551 100644 --- a/gnu/javax/crypto/jce/cipher/TripleDESSpi.java +++ b/gnu/javax/crypto/jce/cipher/TripleDESSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Triple-DES <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class TripleDESSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class TripleDESSpi extends CipherAdapter { super(Registry.TRIPLEDES_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/cipher/TwofishSpi.java b/gnu/javax/crypto/jce/cipher/TwofishSpi.java index 3a75a9858..31df5ea40 100644 --- a/gnu/javax/crypto/jce/cipher/TwofishSpi.java +++ b/gnu/javax/crypto/jce/cipher/TwofishSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Twofish <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class TwofishSpi extends CipherAdapter { @@ -56,4 +54,4 @@ public final class TwofishSpi extends CipherAdapter { super(Registry.TWOFISH_CIPHER); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacMD2Spi.java b/gnu/javax/crypto/jce/mac/HMacMD2Spi.java index 343556db4..dd489639f 100644 --- a/gnu/javax/crypto/jce/mac/HMacMD2Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacMD2Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the HMAC-MD2 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacMD2Spi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacMD2Spi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.MD2_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacMD4Spi.java b/gnu/javax/crypto/jce/mac/HMacMD4Spi.java index d00e257d4..6fadf0262 100644 --- a/gnu/javax/crypto/jce/mac/HMacMD4Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacMD4Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the HMAC-MD4 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacMD4Spi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacMD4Spi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.MD4_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacMD5Spi.java b/gnu/javax/crypto/jce/mac/HMacMD5Spi.java index fdf2ebf69..2ef43974f 100644 --- a/gnu/javax/crypto/jce/mac/HMacMD5Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacMD5Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the HMAC-MD5 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacMD5Spi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacMD5Spi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.MD5_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java b/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java index 1fcd0f2bc..ad7a2340e 100644 --- a/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the HMAC-RIPEMD-128 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacRipeMD128Spi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacRipeMD128Spi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD128_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java b/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java index 56854c214..c14e3b3bf 100644 --- a/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the HMAC-RIPEMD-160 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacRipeMD160Spi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacRipeMD160Spi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD160_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java index 8594e03f4..f102c9ebc 100644 --- a/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the HMAC-SHA-160 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacSHA160Spi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacSHA160Spi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.SHA160_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java index 4e147407d..cadad1cf5 100644 --- a/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java @@ -42,8 +42,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the HMAC-SHA-256 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacSHA256Spi extends MacAdapter { @@ -64,4 +62,4 @@ public final class HMacSHA256Spi extends MacAdapter // Instance methods // ------------------------------------------------------------------------- -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java index e909e9896..69ef38e50 100644 --- a/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java @@ -42,8 +42,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the HMAC-SHA-384 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class HMacSHA384Spi extends MacAdapter { @@ -64,4 +62,4 @@ public class HMacSHA384Spi extends MacAdapter // Instance methods // ------------------------------------------------------------------------- -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java index 8c4c041bb..abceb4a92 100644 --- a/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java +++ b/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java @@ -42,8 +42,6 @@ import gnu.java.security.Registry; /** * <p>The implementation of the HMAC-SHA-512 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class HMacSHA512Spi extends MacAdapter { @@ -64,4 +62,4 @@ public class HMacSHA512Spi extends MacAdapter // Instance methods // ------------------------------------------------------------------------- -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacTigerSpi.java b/gnu/javax/crypto/jce/mac/HMacTigerSpi.java index a42af05b7..511993ea4 100644 --- a/gnu/javax/crypto/jce/mac/HMacTigerSpi.java +++ b/gnu/javax/crypto/jce/mac/HMacTigerSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the Tiger <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacTigerSpi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacTigerSpi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.TIGER_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java b/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java index 06ca3445c..706e0cd5a 100644 --- a/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java +++ b/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the HMAC-Whirlpool <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class HMacWhirlpoolSpi extends MacAdapter { @@ -56,4 +54,4 @@ public final class HMacWhirlpoolSpi extends MacAdapter { super(Registry.HMAC_NAME_PREFIX + Registry.WHIRLPOOL_HASH); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/MacAdapter.java b/gnu/javax/crypto/jce/mac/MacAdapter.java index 073959a4e..dc019ca20 100644 --- a/gnu/javax/crypto/jce/mac/MacAdapter.java +++ b/gnu/javax/crypto/jce/mac/MacAdapter.java @@ -57,8 +57,6 @@ import javax.crypto.MacSpi; * the {@link javax.crypto.Mac} class, which provides the functionality of a * message authentication code algorithm, such as the <i>Hashed Message * Authentication Code</i> (<b>HMAC</b>) algorithms.</p> - * - * @version $Revision: 1.2.4.1 $ */ class MacAdapter extends MacSpi implements Cloneable { @@ -153,4 +151,4 @@ class MacAdapter extends MacSpi implements Cloneable { mac.update(in, off, len); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/TMMH16Spi.java b/gnu/javax/crypto/jce/mac/TMMH16Spi.java index defd70c67..1734e1e69 100644 --- a/gnu/javax/crypto/jce/mac/TMMH16Spi.java +++ b/gnu/javax/crypto/jce/mac/TMMH16Spi.java @@ -50,8 +50,6 @@ import java.security.spec.AlgorithmParameterSpec; /** * The implementation of the TMMH16 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class TMMH16Spi extends MacAdapter { @@ -88,4 +86,4 @@ public final class TMMH16Spi extends MacAdapter throw new InvalidAlgorithmParameterException(iae.getMessage()); } } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/UHash32Spi.java b/gnu/javax/crypto/jce/mac/UHash32Spi.java index bd68c5291..af678c0fa 100644 --- a/gnu/javax/crypto/jce/mac/UHash32Spi.java +++ b/gnu/javax/crypto/jce/mac/UHash32Spi.java @@ -43,8 +43,6 @@ import gnu.java.security.Registry; /** * The implementation of the UHash-32 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class UHash32Spi extends MacAdapter { @@ -56,4 +54,4 @@ public final class UHash32Spi extends MacAdapter { super(Registry.UHASH32); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/jce/mac/UMac32Spi.java b/gnu/javax/crypto/jce/mac/UMac32Spi.java index 77de29b9c..4e90468b1 100644 --- a/gnu/javax/crypto/jce/mac/UMac32Spi.java +++ b/gnu/javax/crypto/jce/mac/UMac32Spi.java @@ -50,8 +50,6 @@ import java.security.spec.AlgorithmParameterSpec; /** * The implementation of the UMAC-32 <i>Service Provider Interface</i> * (<b>SPI</b>) adapter. - * - * @version $Revision: 1.1.4.1 $ */ public final class UMac32Spi extends MacAdapter { @@ -88,4 +86,4 @@ public final class UMac32Spi extends MacAdapter throw new InvalidAlgorithmParameterException(iae.getMessage()); } } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/key/dh/DiffieHellmanSender.java b/gnu/javax/crypto/key/dh/DiffieHellmanSender.java index 71838fdac..0be82bfb4 100644 --- a/gnu/javax/crypto/key/dh/DiffieHellmanSender.java +++ b/gnu/javax/crypto/key/dh/DiffieHellmanSender.java @@ -55,7 +55,6 @@ import javax.crypto.interfaces.DHPrivateKey; * Diffie-Hellman key agreement exchange (A in [HAC]).</p> * * @see DiffieHellmanKeyAgreement - * @version $Revision: 1.1.4.1 $ */ public class DiffieHellmanSender extends DiffieHellmanKeyAgreement { diff --git a/gnu/javax/crypto/key/srp6/SRP6TLSServer.java b/gnu/javax/crypto/key/srp6/SRP6TLSServer.java index 718646012..ecbe36f62 100644 --- a/gnu/javax/crypto/key/srp6/SRP6TLSServer.java +++ b/gnu/javax/crypto/key/srp6/SRP6TLSServer.java @@ -61,8 +61,6 @@ import java.util.Map; * SRP for TLS Authentication</a>. The only difference between it and the SASL * variant is that the shared secret is the entity <code>S</code> and not * <code>H(S)</code>.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class SRP6TLSServer extends SRP6KeyAgreement { diff --git a/gnu/javax/crypto/keyring/PrivateKeyEntry.java b/gnu/javax/crypto/keyring/PrivateKeyEntry.java index c9c997da0..882495633 100644 --- a/gnu/javax/crypto/keyring/PrivateKeyEntry.java +++ b/gnu/javax/crypto/keyring/PrivateKeyEntry.java @@ -57,8 +57,6 @@ import java.util.Date; /** * <p>An immutable class representing a private or secret key entry.</p> - * - * @version $Revision: 1.1.4.1 $ */ public final class PrivateKeyEntry extends PrimitiveEntry { diff --git a/gnu/javax/crypto/mode/IAuthenticatedMode.java b/gnu/javax/crypto/mode/IAuthenticatedMode.java index 9ca23933c..989e3edbc 100644 --- a/gnu/javax/crypto/mode/IAuthenticatedMode.java +++ b/gnu/javax/crypto/mode/IAuthenticatedMode.java @@ -50,11 +50,9 @@ import gnu.javax.crypto.mac.IMac; * is done via the {@link IMac#digest()} method, and header updating * (if supported by the mode) is done via the {@link * IMac#update(byte[],int,int)} method. - * - * @version $Revision: 1.1.4.1 $ */ public interface IAuthenticatedMode extends IMode, IMac { // Trivial conjunction of IMode and IMac. -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/pad/WrongPaddingException.java b/gnu/javax/crypto/pad/WrongPaddingException.java index 4317a5c18..e477cf303 100644 --- a/gnu/javax/crypto/pad/WrongPaddingException.java +++ b/gnu/javax/crypto/pad/WrongPaddingException.java @@ -41,8 +41,6 @@ package gnu.javax.crypto.pad; /** * <p>A checked exception that indicates that a padding algorithm did not find the * expected padding bytes when unpadding some data.</p> - * - * @version $Revision: 1.1.4.1 $ */ public class WrongPaddingException extends Exception { @@ -60,4 +58,4 @@ public class WrongPaddingException extends Exception // Instant methods // ------------------------------------------------------------------------- -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/prng/Fortuna.java b/gnu/javax/crypto/prng/Fortuna.java index 6453a9d02..69ce860f4 100644 --- a/gnu/javax/crypto/prng/Fortuna.java +++ b/gnu/javax/crypto/prng/Fortuna.java @@ -142,6 +142,14 @@ public class Fortuna extends BasePRNG implements Serializable, pool = 0; pool0Count = 0; generator.init(attributes); + try + { + fillBlock (); + } + catch (LimitReachedException shouldNotHappen) + { + throw new RuntimeException (shouldNotHappen); + } } public void fillBlock() throws LimitReachedException @@ -324,6 +332,7 @@ public class Fortuna extends BasePRNG implements Serializable, byte[] seed = (byte[]) attributes.get(SEED); if (seed != null) addRandomBytes(seed); + fillBlock (); } /** diff --git a/gnu/javax/crypto/prng/ICMGenerator.java b/gnu/javax/crypto/prng/ICMGenerator.java index 541003a97..7d4f4c9a3 100644 --- a/gnu/javax/crypto/prng/ICMGenerator.java +++ b/gnu/javax/crypto/prng/ICMGenerator.java @@ -98,8 +98,6 @@ import java.util.Map; * <li><a href="http://www.ietf.org/internet-drafts/draft-mcgrew-saag-icm-00.txt"> * Integer Counter Mode</a>, David A. McGrew.</li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public class ICMGenerator extends BasePRNG implements Cloneable { @@ -376,4 +374,4 @@ public class ICMGenerator extends BasePRNG implements Cloneable cipher.encryptBlock(buffer, 0, buffer, 0); blockNdx = blockNdx.add(BigInteger.ONE); // increment blockNdx } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/prng/IPBE.java b/gnu/javax/crypto/prng/IPBE.java index 69ff493fb..ef0f3aa48 100644 --- a/gnu/javax/crypto/prng/IPBE.java +++ b/gnu/javax/crypto/prng/IPBE.java @@ -40,8 +40,6 @@ package gnu.javax.crypto.prng; /** * <p>Trivial interface to group Password-based encryption property names.</p> - * - * @version $Revision: 1.1.4.1 $ */ public interface IPBE { @@ -66,4 +64,4 @@ public interface IPBE * with this is expected to be a byte array. */ public static final String SALT = "gnu.crypto.pbe.salt"; -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/prng/PBKDF2.java b/gnu/javax/crypto/prng/PBKDF2.java index 87bbd1e89..78e4ae0da 100644 --- a/gnu/javax/crypto/prng/PBKDF2.java +++ b/gnu/javax/crypto/prng/PBKDF2.java @@ -62,8 +62,6 @@ import java.util.Map; * <li>B. Kaliski, <a href="http://www.ietf.org/rfc/rfc2898.txt">RFC 2898: * Password-Based Cryptography Specification, Version 2.0</a></li> * </ol> - * - * @version $Revision: 1.1.4.1 $ */ public class PBKDF2 extends BasePRNG implements Cloneable { @@ -213,4 +211,4 @@ public class PBKDF2 extends BasePRNG implements Cloneable } } } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/sasl/ConfidentialityException.java b/gnu/javax/crypto/sasl/ConfidentialityException.java index b77e4d110..adfc06593 100644 --- a/gnu/javax/crypto/sasl/ConfidentialityException.java +++ b/gnu/javax/crypto/sasl/ConfidentialityException.java @@ -44,8 +44,6 @@ import javax.security.sasl.SaslException; * Used by mechanisms that offer a security services layer, this checked * exception is thrown to indicate that a violation has occured during the * processing of a <i>confidentiality</i> protection filter. - * - * @version $Revision: 1.1.4.1 $ */ public class ConfidentialityException extends SaslException { @@ -81,4 +79,4 @@ public class ConfidentialityException extends SaslException { super(s, x); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/sasl/IllegalMechanismStateException.java b/gnu/javax/crypto/sasl/IllegalMechanismStateException.java index 00baceaa4..b46ad98e3 100644 --- a/gnu/javax/crypto/sasl/IllegalMechanismStateException.java +++ b/gnu/javax/crypto/sasl/IllegalMechanismStateException.java @@ -46,8 +46,6 @@ import javax.security.sasl.AuthenticationException; * that mechanism was not completed yet, or that an operation that should be * invoked on incomplete mechanisms was invoked but the authentication phase of * that mechanism was already completed. - * - * @version $Revision: 1.1.4.1 $ */ public class IllegalMechanismStateException extends AuthenticationException { @@ -83,4 +81,4 @@ public class IllegalMechanismStateException extends AuthenticationException { super(detail, ex); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/sasl/srp/IALG.java b/gnu/javax/crypto/sasl/srp/IALG.java index 2c65dfda1..51492f977 100644 --- a/gnu/javax/crypto/sasl/srp/IALG.java +++ b/gnu/javax/crypto/sasl/srp/IALG.java @@ -50,8 +50,6 @@ import javax.security.sasl.SaslException; /** * <p>A Factory class that returns IALG (Integrity Algorithm) instances that * operate as described in the draft-burdis-cat-sasl-srp-04 and later.</p> - * - * @version $Revision: 1.1.4.1 $ */ public final class IALG implements Cloneable { @@ -156,4 +154,4 @@ public final class IALG implements Cloneable { return hmac.macSize(); } -}
\ No newline at end of file +} diff --git a/gnu/javax/crypto/sasl/srp/SRPServer.java b/gnu/javax/crypto/sasl/srp/SRPServer.java index f4421c1e8..672660b26 100644 --- a/gnu/javax/crypto/sasl/srp/SRPServer.java +++ b/gnu/javax/crypto/sasl/srp/SRPServer.java @@ -72,8 +72,6 @@ import javax.security.sasl.SaslServer; /** * <p>The SASL-SRP server-side mechanism.</p> - * - * @version $Revision: 1.2.2.1 $ */ public class SRPServer extends ServerMechanism implements SaslServer { @@ -1153,4 +1151,4 @@ public class SRPServer extends ServerMechanism implements SaslServer return prng; } -}
\ No newline at end of file +} diff --git a/gnu/javax/swing/tree/GnuPath.java b/gnu/javax/swing/tree/GnuPath.java new file mode 100644 index 000000000..dd576e8d3 --- /dev/null +++ b/gnu/javax/swing/tree/GnuPath.java @@ -0,0 +1,65 @@ +/* GnuPath.java -- The extended version of TreePath + 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 gnu.javax.swing.tree; + +import javax.swing.tree.TreePath; + +/** + * The tree path with additional data. Needed for the optimized tree drawing. + * Returned by layout caches. + * + * @author Audrius Meskauskas + */ +public class GnuPath extends TreePath +{ + /** + * The flag, marking the last visible child. + */ + public boolean isLastChild; + + /** + * Create a new path, specifying flag if this path is the path to the + * last visible child (needed for optimized tree drawing). + */ + public GnuPath(Object[] path, boolean lastChild) + { + super(path); + isLastChild = lastChild; + } +} diff --git a/gnu/regexp/CharIndexed.java b/gnu/regexp/CharIndexed.java index df1d8930c..8aedc49f6 100644 --- a/gnu/regexp/CharIndexed.java +++ b/gnu/regexp/CharIndexed.java @@ -93,4 +93,24 @@ public interface CharIndexed { * Returns the effective length of this CharIndexed */ int length(); + + /** + * Sets the REMatch last found on this input. + */ + void setLastMatch(REMatch match); + + /** + * Returns the REMatch last found on this input. + */ + REMatch getLastMatch(); + + /** + * Returns the anchor. + */ + int getAnchor(); + + /** + * Sets the anchor. + */ + void setAnchor(int anchor); } diff --git a/gnu/regexp/CharIndexedCharArray.java b/gnu/regexp/CharIndexedCharArray.java index 1388d4729..96a609beb 100644 --- a/gnu/regexp/CharIndexedCharArray.java +++ b/gnu/regexp/CharIndexedCharArray.java @@ -1,5 +1,5 @@ /* gnu/regexp/CharIndexedCharArray.java - Copyright (C) 1998-2001, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -36,36 +36,11 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package gnu.regexp; -import java.io.Serializable; +import java.nio.CharBuffer; -class CharIndexedCharArray implements CharIndexed, Serializable { - private char[] s; - private int anchor; +class CharIndexedCharArray extends CharIndexedCharSequence { CharIndexedCharArray(char[] str, int index) { - s = str; - anchor = index; - } - - public char charAt(int index) { - int pos = anchor + index; - return ((pos < s.length) && (pos >= 0)) ? s[pos] : OUT_OF_BOUNDS; - } - - public boolean isValid() { - return (anchor < s.length); - } - - public boolean move(int index) { - return ((anchor += index) < s.length); - } - - public CharIndexed lookBehind(int index, int length) { - if (length > (anchor + index)) length = anchor + index; - return new CharIndexedCharArray(s, anchor + index - length); - } - - public int length() { - return s.length - anchor; + super(CharBuffer.wrap(str), index); } } diff --git a/gnu/regexp/CharIndexedCharSequence.java b/gnu/regexp/CharIndexedCharSequence.java new file mode 100644 index 000000000..5bbe4abfe --- /dev/null +++ b/gnu/regexp/CharIndexedCharSequence.java @@ -0,0 +1,82 @@ +/* gnu/regexp/CharIndexedCharSequence.java + 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 gnu.regexp; +import java.io.Serializable; + +class CharIndexedCharSequence implements CharIndexed, Serializable { + private CharSequence s; + private int anchor; + private int len; + + CharIndexedCharSequence(CharSequence s, int index) { + this.s = s; + len = s.length(); + anchor = index; + } + + public char charAt(int index) { + int pos = anchor + index; + return ((pos < len) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS; + } + + public boolean isValid() { + return (anchor < len); + } + + public boolean move(int index) { + return ((anchor += index) < len); + } + + public CharIndexed lookBehind(int index, int length) { + if (length > (anchor + index)) length = anchor + index; + return new CharIndexedCharSequence(s, anchor + index - length); + } + + public int length() { + return len - anchor; + } + + private REMatch lastMatch; + public void setLastMatch(REMatch match) { + lastMatch = (REMatch)match.clone(); + lastMatch.anchor = anchor; + } + public REMatch getLastMatch() { return lastMatch; } + public int getAnchor() { return anchor; } + public void setAnchor(int anchor) { this.anchor = anchor; } +} diff --git a/gnu/regexp/CharIndexedInputStream.java b/gnu/regexp/CharIndexedInputStream.java index d5225a793..290a94e7f 100644 --- a/gnu/regexp/CharIndexedInputStream.java +++ b/gnu/regexp/CharIndexedInputStream.java @@ -155,5 +155,27 @@ class CharIndexedInputStream implements CharIndexed { throw new UnsupportedOperationException( "difficult to tell the length for an input stream"); } + + public void setLastMatch(REMatch match) { + throw new UnsupportedOperationException( + "difficult to support setLastMatch for an input stream"); + } + + public REMatch getLastMatch() { + throw new UnsupportedOperationException( + "difficult to support getLastMatch for an input stream"); + } + + public int getAnchor() { + throw new UnsupportedOperationException( + "difficult to support getAnchor for an input stream"); + } + + public void setAnchor(int anchor) { + throw new UnsupportedOperationException( + "difficult to support setAnchor for an input stream"); + } + + } diff --git a/gnu/regexp/CharIndexedString.java b/gnu/regexp/CharIndexedString.java index fe4fa8f76..24982659b 100644 --- a/gnu/regexp/CharIndexedString.java +++ b/gnu/regexp/CharIndexedString.java @@ -1,5 +1,5 @@ /* gnu/regexp/CharIndexedString.java - Copyright (C) 1998-2001, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -36,38 +36,9 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package gnu.regexp; -import java.io.Serializable; -class CharIndexedString implements CharIndexed, Serializable { - private String s; - private int anchor; - private int len; - +class CharIndexedString extends CharIndexedCharSequence { CharIndexedString(String str, int index) { - s = str; - len = s.length(); - anchor = index; - } - - public char charAt(int index) { - int pos = anchor + index; - return ((pos < len) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS; - } - - public boolean isValid() { - return (anchor < len); - } - - public boolean move(int index) { - return ((anchor += index) < len); - } - - public CharIndexed lookBehind(int index, int length) { - if (length > (anchor + index)) length = anchor + index; - return new CharIndexedString(s, anchor + index - length); - } - - public int length() { - return len - anchor; + super(str, index); } } diff --git a/gnu/regexp/CharIndexedStringBuffer.java b/gnu/regexp/CharIndexedStringBuffer.java index 9c9118dfe..d6b03bba5 100644 --- a/gnu/regexp/CharIndexedStringBuffer.java +++ b/gnu/regexp/CharIndexedStringBuffer.java @@ -1,5 +1,5 @@ /* gnu/regexp/CharIndexedStringBuffer.java - Copyright (C) 1998-2001, 2004, 2006 Free Software Foundation, Inc. + Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -36,36 +36,10 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ package gnu.regexp; -import java.io.Serializable; -class CharIndexedStringBuffer implements CharIndexed, Serializable { - private StringBuffer s; - private int anchor; +class CharIndexedStringBuffer extends CharIndexedCharSequence { CharIndexedStringBuffer(StringBuffer str, int index) { - s = str; - anchor = index; + super(str, index); } - - public char charAt(int index) { - int pos = anchor + index; - return ((pos < s.length()) && (pos >= 0)) ? s.charAt(pos) : OUT_OF_BOUNDS; - } - - public boolean isValid() { - return (anchor < s.length()); - } - - public boolean move(int index) { - return ((anchor += index) < s.length()); - } - - public CharIndexed lookBehind(int index, int length) { - if (length > (anchor + index)) length = anchor + index; - return new CharIndexedStringBuffer(s, anchor + index - length); - } - - public int length() { - return s.length() - anchor; - } } diff --git a/gnu/regexp/RE.java b/gnu/regexp/RE.java index b78959a9d..e0665f097 100644 --- a/gnu/regexp/RE.java +++ b/gnu/regexp/RE.java @@ -79,13 +79,18 @@ import java.util.Vector; * <P> * * These methods all have similar argument lists. The input can be a - * String, a character array, a StringBuffer, or an + * CharIndexed, String, a character array, a StringBuffer, or an * InputStream of some sort. Note that when using an * InputStream, the stream read position cannot be guaranteed after * attempting a match (this is not a bug, but a consequence of the way * regular expressions work). Using an REMatchEnumeration can * eliminate most positioning problems. * + * Although the input object can be of various types, it is recommended + * that it should be a CharIndexed because {@link CharIndexed#getLastMatch()} + * can show the last match found on this input, which helps the expression + * \G work as the end of the previous match. + * * <P> * * The optional index argument specifies the offset from the beginning @@ -240,9 +245,13 @@ public class RE extends REToken { * Compilation flag. Allow whitespace and comments in pattern. * This is equivalent to the "/x" operator in Perl. */ - public static final int REG_X_COMMENTS = 0x0400; + /** + * Compilation flag. If set, REG_ICASE is effective only for US-ASCII. + */ + public static final int REG_ICASE_USASCII = 0x0800; + /** Returns a string representing the version of the gnu.regexp package. */ public static final String version() { return VERSION; @@ -342,6 +351,7 @@ public class RE extends REToken { // Precalculate these so we don't pay for the math every time we // need to access them. boolean insens = ((cflags & REG_ICASE) > 0); + boolean insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); // Parse pattern into tokens. Does anyone know if it's more efficient // to use char[] than a String.charAt()? I'm assuming so. @@ -453,6 +463,7 @@ public class RE extends REToken { else { addToken(currentToken); currentToken = new RETokenChar(subIndex,unit.ch,insens); + if (insensUSASCII) currentToken.unicodeAware = false; } } @@ -528,7 +539,7 @@ public class RE extends REToken { case 'd': case 'm': case 's': - // case 'u': not supported + case 'u': case 'x': case '-': if (!syntax.get(RESyntax.RE_EMBEDDED_FLAGS)) break; @@ -568,7 +579,13 @@ public class RE extends REToken { newCflags |= REG_DOT_NEWLINE; flagIndex++; break; - // case 'u': not supported + case 'u': + if (negate) + newCflags |= REG_ICASE_USASCII; + else + newCflags &= ~REG_ICASE_USASCII; + flagIndex++; + break; case 'x': if (negate) newCflags &= ~REG_X_COMMENTS; @@ -592,6 +609,7 @@ public class RE extends REToken { syntax = newSyntax; cflags = newCflags; insens = ((cflags & REG_ICASE) > 0); + insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); // This can be treated as though it were a comment. comment = true; index = flagIndex - 1; @@ -604,6 +622,7 @@ public class RE extends REToken { syntax = newSyntax; cflags = newCflags; insens = ((cflags & REG_ICASE) > 0); + insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); index = flagIndex -1; // Fall through to the next case. } @@ -712,6 +731,7 @@ public class RE extends REToken { syntax = savedSyntax; cflags = savedCflags; insens = ((cflags & REG_ICASE) > 0); + insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); flagsSaved = false; } } // not a comment @@ -824,6 +844,7 @@ public class RE extends REToken { index = index - 2 + ce.len; addToken(currentToken); currentToken = new RETokenChar(subIndex,ce.ch,insens); + if (insensUSASCII) currentToken.unicodeAware = false; } // BACKREFERENCE OPERATOR @@ -851,6 +872,7 @@ public class RE extends REToken { int num = parseInt(pattern, numBegin, numEnd-numBegin, 10); currentToken = new RETokenBackRef(subIndex,num,insens); + if (insensUSASCII) currentToken.unicodeAware = false; index = numEnd; } @@ -899,6 +921,7 @@ public class RE extends REToken { else if (unit.bk && (unit.ch == 'd') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) { addToken(currentToken); currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,false); + if (insensUSASCII) currentToken.unicodeAware = false; } // NON-DIGIT OPERATOR @@ -907,6 +930,7 @@ public class RE extends REToken { else if (unit.bk && (unit.ch == 'D') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) { addToken(currentToken); currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.DIGIT,insens,true); + if (insensUSASCII) currentToken.unicodeAware = false; } // NEWLINE ESCAPE @@ -931,6 +955,7 @@ public class RE extends REToken { else if (unit.bk && (unit.ch == 's') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) { addToken(currentToken); currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,false); + if (insensUSASCII) currentToken.unicodeAware = false; } // NON-WHITESPACE OPERATOR @@ -939,6 +964,7 @@ public class RE extends REToken { else if (unit.bk && (unit.ch == 'S') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) { addToken(currentToken); currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.SPACE,insens,true); + if (insensUSASCII) currentToken.unicodeAware = false; } // TAB ESCAPE @@ -955,6 +981,7 @@ public class RE extends REToken { else if (unit.bk && (unit.ch == 'w') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) { addToken(currentToken); currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,false); + if (insensUSASCII) currentToken.unicodeAware = false; } // NON-ALPHANUMERIC OPERATOR @@ -963,12 +990,19 @@ public class RE extends REToken { else if (unit.bk && (unit.ch == 'W') && syntax.get(RESyntax.RE_CHAR_CLASS_ESCAPES)) { addToken(currentToken); currentToken = new RETokenPOSIX(subIndex,RETokenPOSIX.ALNUM,insens,true); + if (insensUSASCII) currentToken.unicodeAware = false; } // END OF STRING OPERATOR - // \Z + // \Z, \z + + // FIXME: \Z and \z are different in that if the input string + // ends with a line terminator, \Z matches the position before + // the final terminator. This special behavior of \Z is yet + // to be implemented. - else if (unit.bk && (unit.ch == 'Z') && syntax.get(RESyntax.RE_STRING_ANCHORS)) { + else if (unit.bk && (unit.ch == 'Z' || unit.ch == 'z') && + syntax.get(RESyntax.RE_STRING_ANCHORS)) { addToken(currentToken); currentToken = new RETokenEnd(subIndex,null); } @@ -984,6 +1018,7 @@ public class RE extends REToken { index = index - 2 + ce.len; addToken(currentToken); currentToken = new RETokenChar(subIndex,ce.ch,insens); + if (insensUSASCII) currentToken.unicodeAware = false; } // NAMED PROPERTY @@ -997,6 +1032,16 @@ public class RE extends REToken { index = index - 2 + np.len; addToken(currentToken); currentToken = getRETokenNamedProperty(subIndex,np,insens,index); + if (insensUSASCII) currentToken.unicodeAware = false; + } + + // END OF PREVIOUS MATCH + // \G + + else if (unit.bk && (unit.ch == 'G') && + syntax.get(RESyntax.RE_STRING_ANCHORS)) { + addToken(currentToken); + currentToken = new RETokenEndOfPreviousMatch(subIndex); } // NON-SPECIAL CHARACTER (or escape to make literal) @@ -1005,6 +1050,7 @@ public class RE extends REToken { else { // not a special character addToken(currentToken); currentToken = new RETokenChar(subIndex,unit.ch,insens); + if (insensUSASCII) currentToken.unicodeAware = false; } } // end while @@ -1045,6 +1091,7 @@ public class RE extends REToken { throws REException { boolean insens = ((cflags & REG_ICASE) > 0); + boolean insensUSASCII = ((cflags & REG_ICASE_USASCII) > 0); Vector options = new Vector(); Vector addition = new Vector(); boolean additionAndAppeared = false; @@ -1074,7 +1121,9 @@ public class RE extends REToken { if ((ch == '-') && (lastCharIsSet)) { if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index); if ((ch = pattern[index]) == ']') { - options.addElement(new RETokenChar(subIndex,lastChar,insens)); + RETokenChar t = new RETokenChar(subIndex,lastChar,insens); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); lastChar = '-'; } else { if ((ch == '\\') && syntax.get(RESyntax.RE_BACKSLASH_ESCAPE_IN_LISTS)) { @@ -1084,7 +1133,9 @@ public class RE extends REToken { ch = ce.ch; index = index + ce.len - 1; } - options.addElement(new RETokenRange(subIndex,lastChar,ch,insens)); + RETokenRange t = new RETokenRange(subIndex,lastChar,ch,insens); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); lastChar = 0; lastCharIsSet = false; index++; } @@ -1127,12 +1178,20 @@ public class RE extends REToken { asciiEsc = ce.ch; asciiEscIsSet = true; index = index - 1 + ce.len - 1; } - if (lastCharIsSet) options.addElement(new RETokenChar(subIndex,lastChar,insens)); + if (lastCharIsSet) { + RETokenChar t = new RETokenChar(subIndex,lastChar,insens); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); + } if (posixID != -1) { - options.addElement(new RETokenPOSIX(subIndex,posixID,insens,negate)); + RETokenPOSIX t = new RETokenPOSIX(subIndex,posixID,insens,negate); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); } else if (np != null) { - options.addElement(getRETokenNamedProperty(subIndex,np,insens,index)); + RETokenNamedProperty t = getRETokenNamedProperty(subIndex,np,insens,index); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); } else if (asciiEscIsSet) { lastChar = asciiEsc; lastCharIsSet = true; } else { @@ -1143,8 +1202,11 @@ public class RE extends REToken { StringBuffer posixSet = new StringBuffer(); index = getPosixSet(pattern,index+1,posixSet); int posixId = RETokenPOSIX.intValue(posixSet.toString()); - if (posixId != -1) - options.addElement(new RETokenPOSIX(subIndex,posixId,insens,false)); + if (posixId != -1) { + RETokenPOSIX t = new RETokenPOSIX(subIndex,posixId,insens,false); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); + } } else if ((ch == '[') && (syntax.get(RESyntax.RE_NESTED_CHARCLASS))) { ParseCharClassResult result = parseCharClass( subIndex, pattern, index, pLength, cflags, syntax, 0); @@ -1197,14 +1259,22 @@ public class RE extends REToken { result.index: result.index - 1); } } else { - if (lastCharIsSet) options.addElement(new RETokenChar(subIndex,lastChar,insens)); + if (lastCharIsSet) { + RETokenChar t = new RETokenChar(subIndex,lastChar,insens); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); + } lastChar = ch; lastCharIsSet = true; } if (index == pLength) throw new REException(getLocalizedMessage("class.no.end"),REException.REG_EBRACK,index); } // while in list // Out of list, index is one past ']' - if (lastCharIsSet) options.addElement(new RETokenChar(subIndex,lastChar,insens)); + if (lastCharIsSet) { + RETokenChar t = new RETokenChar(subIndex,lastChar,insens); + if (insensUSASCII) t.unicodeAware = false; + options.addElement(t); + } ParseCharClassResult result = new ParseCharClassResult(); // Create a new RETokenOneOf @@ -1552,7 +1622,7 @@ public class RE extends REToken { } // Note the start of this subexpression - mymatch.start[subIndex] = mymatch.index; + mymatch.start1[subIndex] = mymatch.index; return firstToken.match(input, mymatch); } @@ -1562,8 +1632,6 @@ public class RE extends REToken { mymatch.backtrackStack = new BacktrackStack(); boolean b = match(input, mymatch); if (b) { - // mymatch.backtrackStack.push(new REMatch.Backtrack( - // this, input, mymatch, null)); return mymatch; } return null; @@ -1652,6 +1720,7 @@ public class RE extends REToken { */ best.end[0] = best.index; best.finish(input); + input.setLastMatch(best); return best; } } @@ -2003,10 +2072,23 @@ public class RE extends REToken { } // Cast input appropriately or throw exception - private static CharIndexed makeCharIndexed(Object input, int index) { - // We could let a String fall through to final input, but since - // it's the most likely input type, we check it first. - if (input instanceof String) + // This method was originally a private method, but has been made + // public because java.util.regex.Matcher uses this. + public static CharIndexed makeCharIndexed(Object input, int index) { + // The case where input is already a CharIndexed is supposed + // be the most likely because this is the case with + // java.util.regex.Matcher. + // We could let a String or a CharSequence fall through + // to final input, but since it'a very likely input type, + // we check it first. + if (input instanceof CharIndexed) { + CharIndexed ci = (CharIndexed) input; + ci.setAnchor(index); + return ci; + } + else if (input instanceof CharSequence) + return new CharIndexedCharSequence((CharSequence) input,index); + else if (input instanceof String) return new CharIndexedString((String) input,index); else if (input instanceof char[]) return new CharIndexedCharArray((char[]) input,index); @@ -2014,8 +2096,6 @@ public class RE extends REToken { return new CharIndexedStringBuffer((StringBuffer) input,index); else if (input instanceof InputStream) return new CharIndexedInputStream((InputStream) input,index); - else if (input instanceof CharIndexed) - return (CharIndexed) input; // do we lose index info? else return new CharIndexedString(input.toString(), index); } diff --git a/gnu/regexp/REMatch.java b/gnu/regexp/REMatch.java index 01a6455b6..140a9c43e 100644 --- a/gnu/regexp/REMatch.java +++ b/gnu/regexp/REMatch.java @@ -65,7 +65,12 @@ public final class REMatch implements Serializable, Cloneable { // Package scope; used by RE. int index; // used while matching to mark current match position in input + // start1[i] is set when the i-th subexp starts. And start1[i] is copied + // to start[i] when the i-th subexp ends. So start[i] keeps the previously + // assigned value while the i-th subexp is being processed. This makes + // backreference to the i-th subexp within the i-th subexp possible. int[] start; // start positions (relative to offset) for each (sub)exp. + int[] start1; // start positions (relative to offset) for each (sub)exp. int[] end; // end positions for the same // start[i] == -1 or end[i] == -1 means that the start/end position is void. // start[i] == p or end[i] == p where p < 0 and p != -1 means that @@ -81,6 +86,7 @@ public final class REMatch implements Serializable, Cloneable { REMatch copy = (REMatch) super.clone(); copy.start = (int[]) start.clone(); + copy.start1 = (int[]) start1.clone(); copy.end = (int[]) end.clone(); return copy; @@ -91,6 +97,7 @@ public final class REMatch implements Serializable, Cloneable { void assignFrom(REMatch other) { start = other.start; + start1 = other.start1; end = other.end; index = other.index; backtrackStack = other.backtrackStack; @@ -98,6 +105,7 @@ public final class REMatch implements Serializable, Cloneable { REMatch(int subs, int anchor, int eflags) { start = new int[subs+1]; + start1 = new int[subs+1]; end = new int[subs+1]; this.anchor = anchor; this.eflags = eflags; @@ -128,7 +136,7 @@ public final class REMatch implements Serializable, Cloneable { offset = index; this.index = 0; for (int i = 0; i < start.length; i++) { - start[i] = end[i] = -1; + start[i] = start1[i] = end[i] = -1; } backtrackStack = null; } diff --git a/gnu/regexp/REToken.java b/gnu/regexp/REToken.java index 87780bc7a..f2abc029f 100644 --- a/gnu/regexp/REToken.java +++ b/gnu/regexp/REToken.java @@ -43,6 +43,7 @@ abstract class REToken implements Serializable, Cloneable { protected REToken next = null; protected REToken uncle = null; protected int subIndex; + protected boolean unicodeAware = true; public Object clone() { try { @@ -157,4 +158,32 @@ abstract class REToken implements Serializable, Cloneable { return os.toString(); } + /** + * Converts the character argument to lowercase. + * @param ch the character to be converted. + * @param unicodeAware If true, use java.lang.Character#toLowerCase; + * otherwise, only US-ASCII charactes can be converted. + * @return the lowercase equivalent of the character, if any; + * otherwise, the character itself. + */ + public static char toLowerCase(char ch, boolean unicodeAware) { + if (unicodeAware) return Character.toLowerCase(ch); + if (ch >= 'A' && ch <= 'Z') return (char)(ch + 'a' - 'A'); + return ch; + } + + /** + * Converts the character argument to uppercase. + * @param ch the character to be converted. + * @param unicodeAware If true, use java.lang.Character#toUpperCase; + * otherwise, only US-ASCII charactes can be converted. + * @return the uppercase equivalent of the character, if any; + * otherwise, the character itself. + */ + public static char toUpperCase(char ch, boolean unicodeAware) { + if (unicodeAware) return Character.toUpperCase(ch); + if (ch >= 'a' && ch <= 'z') return (char)(ch + 'A' - 'a'); + return ch; + } + } diff --git a/gnu/regexp/RETokenBackRef.java b/gnu/regexp/RETokenBackRef.java index ea0ffbc5f..25ef9522e 100644 --- a/gnu/regexp/RETokenBackRef.java +++ b/gnu/regexp/RETokenBackRef.java @@ -64,8 +64,8 @@ final class RETokenBackRef extends REToken { char c2 = input.charAt(i); if (c1 != c2) { if (insens) { - if (c1 != Character.toLowerCase(c2) && - c1 != Character.toUpperCase(c2)) { + if (c1 != toLowerCase(c2, unicodeAware) && + c1 != toUpperCase(c2, unicodeAware)) { return null; } } diff --git a/gnu/regexp/RETokenChar.java b/gnu/regexp/RETokenChar.java index 1b29727f3..1b3a74855 100644 --- a/gnu/regexp/RETokenChar.java +++ b/gnu/regexp/RETokenChar.java @@ -44,8 +44,9 @@ final class RETokenChar extends REToken { RETokenChar(int subIndex, char c, boolean ins) { super(subIndex); + insens = ins; ch = new char [1]; - ch[0] = (insens = ins) ? Character.toLowerCase(c) : c; + ch[0] = c; } int getMinimumLength() { @@ -70,13 +71,21 @@ final class RETokenChar extends REToken { char c; for (int i=0; i<z; i++) { c = input.charAt(index+i); - if (( (insens) ? Character.toLowerCase(c) : c ) != ch[i]) { + if (! charEquals(c, ch[i])) { return false; } } return true; } + private boolean charEquals(char c1, char c2) { + if (c1 == c2) return true; + if (! insens) return false; + if (toLowerCase(c1, unicodeAware) == c2) return true; + if (toUpperCase(c1, unicodeAware) == c2) return true; + return false; + } + boolean returnsFixedLengthMatches() { return true; } int findFixedLengthMatches(CharIndexed input, REMatch mymatch, int max) { diff --git a/gnu/regexp/RETokenEndOfPreviousMatch.java b/gnu/regexp/RETokenEndOfPreviousMatch.java new file mode 100644 index 000000000..167d10b5f --- /dev/null +++ b/gnu/regexp/RETokenEndOfPreviousMatch.java @@ -0,0 +1,72 @@ +/* gnu/regexp/RETokenEndOfPreviousMatch.java + 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 gnu.regexp; + +class RETokenEndOfPreviousMatch extends RETokenStart { + + RETokenEndOfPreviousMatch(int subIndex) { + super(subIndex, null); + } + + int getMaximumLength() { + return 0; + } + + REMatch matchThis(CharIndexed input, REMatch mymatch) { + REMatch lastMatch = input.getLastMatch(); + if (lastMatch == null) return super.matchThis(input, mymatch); + if (input.getAnchor()+mymatch.index == + lastMatch.anchor+lastMatch.index) { + return mymatch; + } + else { + return null; + } + } + + boolean returnsFixedLengthmatches() { return true; } + + int findFixedLengthMatches(CharIndexed input, REMatch mymatch, int max) { + if (matchThis(input, mymatch) != null) return max; + else return 0; + } + + void dump(StringBuffer os) { + os.append("\\G"); + } +} diff --git a/gnu/regexp/RETokenEndSub.java b/gnu/regexp/RETokenEndSub.java index 6421c7f74..fca01c7f3 100644 --- a/gnu/regexp/RETokenEndSub.java +++ b/gnu/regexp/RETokenEndSub.java @@ -47,11 +47,13 @@ final class RETokenEndSub extends REToken { } REMatch matchThis(CharIndexed input, REMatch mymatch) { + mymatch.start[subIndex] = mymatch.start1[subIndex]; mymatch.end[subIndex] = mymatch.index; return mymatch; } REMatch findMatch(CharIndexed input, REMatch mymatch) { + mymatch.start[subIndex] = mymatch.start1[subIndex]; mymatch.end[subIndex] = mymatch.index; return super.findMatch(input, mymatch); } diff --git a/gnu/regexp/RETokenLookBehind.java b/gnu/regexp/RETokenLookBehind.java index 60058188d..8311d1a7a 100644 --- a/gnu/regexp/RETokenLookBehind.java +++ b/gnu/regexp/RETokenLookBehind.java @@ -65,6 +65,7 @@ final class RETokenLookBehind extends REToken int diff = behind.length() - input.length(); int curIndex = trymatch.index + diff; trymatch.index = 0; + trymatch.offset = 0; RETokenMatchHereOnly stopper = new RETokenMatchHereOnly(curIndex); REToken re1 = (REToken) re.clone(); re1.chain(stopper); @@ -79,6 +80,7 @@ final class RETokenLookBehind extends REToken } } trymatch.index = mymatch.index; + trymatch.offset = mymatch.offset; return trymatch; } else { diff --git a/gnu/regexp/RETokenNamedProperty.java b/gnu/regexp/RETokenNamedProperty.java index e9ae00428..6147e87dc 100644 --- a/gnu/regexp/RETokenNamedProperty.java +++ b/gnu/regexp/RETokenNamedProperty.java @@ -122,8 +122,8 @@ final class RETokenNamedProperty extends REToken { boolean retval = handler.includes(ch); if (insens) { retval = retval || - handler.includes(Character.toUpperCase(ch)) || - handler.includes(Character.toLowerCase(ch)); + handler.includes(toUpperCase(ch, unicodeAware)) || + handler.includes(toLowerCase(ch, unicodeAware)); } if (negate) retval = !retval; diff --git a/gnu/regexp/RETokenRange.java b/gnu/regexp/RETokenRange.java index 94a775dc0..9d3da324e 100644 --- a/gnu/regexp/RETokenRange.java +++ b/gnu/regexp/RETokenRange.java @@ -69,10 +69,10 @@ final class RETokenRange extends REToken { if (c == CharIndexed.OUT_OF_BOUNDS) return false; boolean matches = (c >= lo) && (c <= hi); if (! matches && insens) { - char c1 = Character.toLowerCase(c); + char c1 = toLowerCase(c, unicodeAware); matches = (c1 >= lo) && (c1 <= hi); if (!matches) { - c1 = Character.toUpperCase(c); + c1 = toUpperCase(c, unicodeAware); matches = (c1 >= lo) && (c1 <= hi); } } diff --git a/gnu/xml/dom/DomDocument.java b/gnu/xml/dom/DomDocument.java index 900d03ac3..0d52a23ff 100644 --- a/gnu/xml/dom/DomDocument.java +++ b/gnu/xml/dom/DomDocument.java @@ -535,8 +535,7 @@ public class DomDocument int index = name.indexOf(':'); if (index != -1) { - if (index == 0 || index == (len - 1) || - name.lastIndexOf(':') != index) + if (index == 0 || name.lastIndexOf(':') != index) { throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); diff --git a/gnu/xml/dom/DomNode.java b/gnu/xml/dom/DomNode.java index 93f7c6f64..c06a4c1f1 100644 --- a/gnu/xml/dom/DomNode.java +++ b/gnu/xml/dom/DomNode.java @@ -1120,7 +1120,6 @@ public abstract class DomNode node.appendChild(newChild); } } - if (nodeType == ENTITY_REFERENCE_NODE) { node.makeReadonly(); @@ -1556,23 +1555,30 @@ public abstract class DomNode ancestorLen = ancestors.length; } - // XXX autogrow ancestors ... based on statistics - // Climb to the top of this subtree and handle capture, letting // each node (from the top down) capture until one stops it or // until we get to this one. - - for (index = 0, current = parent; - current != null && index < ancestorLen; - index++, current = current.parent) + current = parent; + if (current.depth >= ANCESTORS_INIT) { + DomNode[] newants = new DomNode[current.depth + 1]; + System.arraycopy(ancestors, 0, newants, 0, ancestors.length); + ancestors = newants; + ancestorLen = ancestors.length; + } + for (index = 0; index < ancestorLen; index++) + { + if (current == null || current.depth == 0) + break; + if (current.nListeners != 0) { haveAncestorRegistrations = true; } ancestors [index] = current; + current = current.parent; } - if (current != null) + if (current.depth > 0) { throw new RuntimeException("dispatchEvent capture stack size"); } diff --git a/gnu/xml/dom/DomNodeIterator.java b/gnu/xml/dom/DomNodeIterator.java index 6079f7a12..8001556e5 100644 --- a/gnu/xml/dom/DomNodeIterator.java +++ b/gnu/xml/dom/DomNodeIterator.java @@ -137,9 +137,10 @@ public class DomNodeIterator { ret = current.getNextSibling(); } + current = (ret == null) ? current : ret; } while (!accept(ret)); - current = (ret == null) ? current : ret; + return ret; } diff --git a/gnu/xml/dom/html2/DomHTMLAppletElement.java b/gnu/xml/dom/html2/DomHTMLAppletElement.java index 8ec4d3c83..918cf0d92 100644 --- a/gnu/xml/dom/html2/DomHTMLAppletElement.java +++ b/gnu/xml/dom/html2/DomHTMLAppletElement.java @@ -65,6 +65,26 @@ public class DomHTMLAppletElement setHTMLAttribute("align", align); } + public String getCls() + { + return getHTMLAttribute("class"); + } + + public void setCls(String cls) + { + setHTMLAttribute("class", cls); + } + + public String getSrc() + { + return getHTMLAttribute("src"); + } + + public void setSrc(String src) + { + setHTMLAttribute("src", src); + } + public String getAlt() { return getHTMLAttribute("alt"); @@ -164,6 +184,5 @@ public class DomHTMLAppletElement { setHTMLAttribute("width", width); } - } diff --git a/gnu/xml/dom/html2/DomHTMLDocument.java b/gnu/xml/dom/html2/DomHTMLDocument.java index 10ee9e747..d45c1b223 100644 --- a/gnu/xml/dom/html2/DomHTMLDocument.java +++ b/gnu/xml/dom/html2/DomHTMLDocument.java @@ -87,6 +87,7 @@ public class DomHTMLDocument map.put("dir", DomHTMLDirectoryElement.class); map.put("div", DomHTMLDivElement.class); map.put("dlist", DomHTMLDListElement.class); + map.put("embed", DomHTMLEmbedElement.class); map.put("fieldset", DomHTMLFieldSetElement.class); map.put("font", DomHTMLFontElement.class); map.put("form", DomHTMLFormElement.class); @@ -311,6 +312,7 @@ public class DomHTMLDocument public HTMLCollection getApplets() { DomHTMLCollection ret = new DomHTMLCollection(this, this); + ret.addNodeName("embed"); ret.addNodeName("object"); ret.addNodeName("applet"); ret.evaluate(); diff --git a/gnu/xml/dom/html2/DomHTMLEmbedElement.java b/gnu/xml/dom/html2/DomHTMLEmbedElement.java new file mode 100644 index 000000000..1ae081c28 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLEmbedElement.java @@ -0,0 +1,129 @@ +/* DomHTMLEmbedElement.java -- + 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 gnu.xml.dom.html2; + +public class DomHTMLEmbedElement + extends DomHTMLAppletElement +{ + protected DomHTMLEmbedElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getJavaObject() + { + return getHTMLAttribute("java_object"); + } + + public void setJavaObject(String object) + { + setHTMLAttribute("java_object", object); + } + + public String getJavaCodeBase() + { + return getHTMLAttribute("java_codebase"); + } + + public void setJavaCodeBase(String codeBase) + { + setHTMLAttribute("java_codebase", codeBase); + } + + public String getJavaArchive() + { + return getHTMLAttribute("java_archive"); + } + + public void setJavaArchive(String archive) + { + setHTMLAttribute("java_archive", archive); + } + + public void setJavaCode(String code) + { + setHTMLAttribute("java_code", code); + } + + public String getJavaCode() + { + return getHTMLAttribute("java_code"); + } + + public void setJavaType(String type) + { + setHTMLAttribute("java_type", type); + } + + public String getJavaType() + { + return getHTMLAttribute("java_type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public String getPluginsPage() + { + return getHTMLAttribute("pluginspage"); + } + + public void setPluginsPage(String pluginspage) + { + setHTMLAttribute("pluginspage", pluginspage); + } + + public String getMayscript() + { + return getHTMLAttribute("mayscript"); + } + + public void setMayscript(String mayscript) + { + setHTMLAttribute("mayscript", mayscript); + } +} diff --git a/gnu/xml/dom/html2/DomHTMLObjectElement.java b/gnu/xml/dom/html2/DomHTMLObjectElement.java index fdea9b153..9bb621122 100644 --- a/gnu/xml/dom/html2/DomHTMLObjectElement.java +++ b/gnu/xml/dom/html2/DomHTMLObjectElement.java @@ -72,6 +72,36 @@ public class DomHTMLObjectElement setHTMLAttribute("code", code); } + public String getJavaCode() + { + return getHTMLAttribute("java_code"); + } + + public void setJavaCode(String code) + { + setHTMLAttribute("java_code", code); + } + + public String getObject() + { + return getHTMLAttribute("object"); + } + + public void setObject(String obj) + { + setHTMLAttribute("object", obj); + } + + public String getJavaObject() + { + return getHTMLAttribute("java_object"); + } + + public void setJavaObject(String obj) + { + setHTMLAttribute("java_object", obj); + } + public String getAlign() { return getHTMLAttribute("align"); @@ -92,6 +122,16 @@ public class DomHTMLObjectElement setHTMLAttribute("archive", archive); } + public String getJavaArchive() + { + return getHTMLAttribute("java_archive"); + } + + public void setJavaArchive(String archive) + { + setHTMLAttribute("java_archive", archive); + } + public String getBorder() { return getHTMLAttribute("border"); @@ -112,6 +152,16 @@ public class DomHTMLObjectElement setHTMLAttribute("codebase", codeBase); } + public String getJavaCodeBase() + { + return getHTMLAttribute("java_codebase"); + } + + public void setJavaCodeBase(String codeBase) + { + setHTMLAttribute("java_codebase", codeBase); + } + public String getCodeType() { return getHTMLAttribute("codetype"); @@ -202,6 +252,16 @@ public class DomHTMLObjectElement setHTMLAttribute("type", type); } + public String getJavaType() + { + return getHTMLAttribute("java_type"); + } + + public void setJavaType(String type) + { + setHTMLAttribute("java_type", type); + } + public String getUseMap() { return getHTMLAttribute("usemap"); @@ -238,5 +298,24 @@ public class DomHTMLObjectElement return null; } + public void setMayscript(String may) + { + setHTMLAttribute("mayscript", may); + } + + public String getMayscript() + { + return getHTMLAttribute("mayscript"); + } + + public void setScriptable(String scr) + { + setHTMLAttribute("scriptable", scr); + } + + public String getScriptable() + { + return getHTMLAttribute("scriptable"); + } } diff --git a/gnu/xml/dom/html2/DomHTMLParser.java b/gnu/xml/dom/html2/DomHTMLParser.java index 7b4456225..2164e052c 100644 --- a/gnu/xml/dom/html2/DomHTMLParser.java +++ b/gnu/xml/dom/html2/DomHTMLParser.java @@ -124,9 +124,10 @@ public class DomHTMLParser try { document = new DomHTMLDocument(); - + document.setCheckWellformedness(false); + cursor = document; - + parse(input); DomHTMLDocument h = document; @@ -224,7 +225,6 @@ public class DomHTMLParser open.addFirst(close); close = close.getParentNode(); } - if (close == null) cursor = document; else @@ -235,9 +235,8 @@ public class DomHTMLParser while (iter.hasNext()) { Node item = (Node) iter.next(); - Node copy = item.cloneNode(true); - cursor.appendChild(copy); - cursor = copy; + cursor.appendChild(item); + cursor = item; } } } diff --git a/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java b/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java index e1eb758ea..890ca8eeb 100644 --- a/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java +++ b/gnu/xml/validation/relaxng/RELAXNGSchemaFactory.java @@ -51,6 +51,7 @@ import javax.xml.validation.SchemaFactory; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.ls.LSResourceResolver; +import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -64,6 +65,7 @@ public class RELAXNGSchemaFactory { LSResourceResolver resourceResolver; + ErrorHandler errorHandler; public LSResourceResolver getResourceResolver() { @@ -73,6 +75,16 @@ public class RELAXNGSchemaFactory public void setResourceResolver(LSResourceResolver resourceResolver) { this.resourceResolver = resourceResolver; + } + + public ErrorHandler getErrorHandler() + { + return this.errorHandler; + } + + public void setErrorHandler(ErrorHandler errorHandler) + { + this.errorHandler = errorHandler; } public boolean isSchemaLanguageSupported(String schemaLanguage) diff --git a/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java b/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java index b37ae5431..2b985a28c 100644 --- a/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java +++ b/gnu/xml/validation/xmlschema/XMLSchemaSchemaFactory.java @@ -52,6 +52,7 @@ import org.relaxng.datatype.DatatypeException; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.ls.LSResourceResolver; +import org.xml.sax.ErrorHandler; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -65,6 +66,7 @@ public class XMLSchemaSchemaFactory { LSResourceResolver resourceResolver; + ErrorHandler errorHandler; public LSResourceResolver getResourceResolver() { @@ -75,6 +77,17 @@ public class XMLSchemaSchemaFactory { this.resourceResolver = resourceResolver; } + + public ErrorHandler getErrorHandler() + { + return this.errorHandler; + } + + public void setErrorHandler(ErrorHandler errorHandler) + { + this.errorHandler = errorHandler; + } + public boolean isSchemaLanguageSupported(String schemaLanguage) { |