Re: [cp-patches] FYI: javanet.c fixes and improvements
Hi! Not sure if it's related to this commit, but mips-irix does not work anymore: cc-1020 cc: ERROR File = javanet.c, Line = 1062 The identifier "MSG_NOSIGNAL" is undefined. TARGET_NATIVE_NETWORK_SOCKET_SEND (fd, p + offset, len, bytes_sent); ^ cc-1020 cc: ERROR File = javanet.c, Line = 1067 The identifier "MSG_NOSIGNAL" is undefined. TARGET_NATIVE_NETWORK_SOCKET_SEND_WITH_ADDRESS_PORT (fd, p + offset, ^ This is on: $ uname -a IRIX64 fp98 6.5 07141529 IP27 TWISTI ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: java-nio adjustments for target/native
Hi Tromey, Am Mittwoch, den 18.01.2006, 14:29 -0700 schrieb Tom Tromey: > > "Roman" == Roman Kennke <[EMAIL PROTECTED]> writes: > > Roman> Then we can use shorter macro names or even better function > Roman> calls like cp_mem_alloc() or something similar. > > Can we use the standard names, and then require the more bizarre > ports to do things like "#define malloc BlahBlah"? That would most likely cause problems on these ports. The specific problem is that these ports actually have a malloc() syscall, only that it doesn't really do what you would expect, and the macro works around that by calling another (platform specific) syscall that does what's expected. The best thing I can offer is a shorter macro name. > The issue that came up here yesterday on irc is that, apparently, some > of these macros are only needed for ports that won't be in Classpath. I am aware of that problem. Still I don't know how to solve that problem. We simply cannot give away some of our ports, due to license and other restrictions. > Roman> - memcpy (_dst + dst_offset, src, dst_len); > Roman> + TARGET_NATIVE_MEMORY_FAST_COPY(src + index,_dst + > dst_offset,dst_len); > > There are still platforms without memcpy? What are they? > This seems like a great place for a target port to provide a > replacement function or macro. I can't quickly find a port that overrides this. Maybe this macro can be removed again. Let me investigate that. Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] Re: [commit-cp] classpath ChangeLog configure.ac
Hi Mark, Am Donnerstag, den 19.01.2006, 01:59 +0100 schrieb Mark Wielaard: > Hi Roman, > > On Wed, 2006-01-18 at 11:31 +, Roman Kennke wrote: > > CVSROOT:/cvsroot/classpath > > Module name:classpath > > Branch: > > Changes by: Roman Kennke <[EMAIL PROTECTED]>06/01/18 11:31:14 > > > > Modified files: > > . : ChangeLog configure.ac > > > > Log message: > > 2006-01-18 Roman Kennke < > > > > * configure.ac: Added --enable-posix-layer option to enable > > build of the posix target layer. > > I didn't see a patch with the rationale for this on classpath-patches, > can you please post one with a little explanation. Whoops, this was a kind of accident. The patch wasn't really complete and even worse, the posix layer also isn't (it does not compile yet). The intention was to add a switch to the configury which enables the posix layer instead of the generic thing, so that everybody can try it out and see if that is in any way better than the old target native layer stuff. Of course, this isn't helpful in any way if the posix layer does not compile... Sorry for that accident. Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: java-util adjustments for target/native
Hi Mark, Am Donnerstag, den 19.01.2006, 02:02 +0100 schrieb Mark Wielaard: > Hi Roman, > > On Wed, 2006-01-18 at 10:19 +, Roman Kennke wrote: > > I checked in this adjustment for VMTimeZone.c to make use of the target > > native portability layer. > > > > 2006-01-18 Roman Kennke <[EMAIL PROTECTED]> > > > > * native/jni/java-util/java_util_VMTimeZone.c: > > (Java_java_util_VMTimeZone_getSystemTimeZoneId): Rewritten > > to use target native layer. > > (jint_to_charbuf): Removed unneeded helper function. > > I don't really like this change. Why was this necessary? As with the other target stuff, this was intended to improve portability. However, I understand your point. Feel free to revert this change and we (aicas) will implement our own thing based on the VM interface. (The same goes for the remaining native code, if you don't like the target native code at all, which is understandable since you mostly deal with posix-like systems, then feel free to get rid of it, we can still implement our own thing on the VM interface level. However, this would mean that we could not exchange bugfixes for native code anymore...) /Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: Fixlet for target Makefile.am
In my last commit I made a little mistake. I added a conditional to the native/target/Makefile.am but didn't actually use it when putting together the SUBDIRS. This resulted in posix beeing build unconditionally which of course is wrong. This is fixed by the attached patch. 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * native/target/Makefile.am: Fixed so that posix stuff is really only built when requested. /Roman Index: native/target/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/target/Makefile.am,v retrieving revision 1.6 diff -u -r1.6 Makefile.am --- native/target/Makefile.am 19 Jan 2006 11:26:35 - 1.6 +++ native/target/Makefile.am 19 Jan 2006 13:11:44 - @@ -16,7 +16,7 @@ SUBDIRS = \ $(TARGET) \ generic \ - posix + $(POSIX) EXTRA_DIST = readme.txt ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: Implementing multiple editors for JTable (with example)
This patch add the multi-editor support for JTable. The table now supports the two editors: text and boolean. The boolean values are rendered and edited using JCheckBox. I add the more complicated table example to the Swing demo to show the table with header, multiple data types (text and boolean at the moment) and placed int the scroll window. The editing seems working as expected but the attempt to scroll transiently displays the old (unedited) values. As any forced repainting (resizing, temporary obstruction with other window) displays the updated values again, this may be the problem somewhere in the JScrollPane. 2006-01-19 Audrius Meskauskas <[EMAIL PROTECTED]> * javax/swing/JTable.java (editingStopped, editingCancelled): Repaint the edited cell. (setValueAt): Do not add the value object to this container. (editorTimer, rowBeingEdited, columnBeingEdited, oldCellValue): Removed. (editingStopped): Use editingRow, editingColumn and not rowBeingEdited, columnBeingEdited. (editValueAt): rewritten. (doLayout): Move the editor component, if present, into the new location and call repaint(). (moveToCellBeingEdited): new method. (TableTextField): new inner class. (getDefaultEditor): Instantiante TableTextField, not JTextField. (setValueAt): Repaint the changed segment. (createDefaultEditors): Implemented. (BooleanCellRenderer): Center the checkbox and use the default foreground and background colors. * javax/swing/plaf/basic/BasicTableUI.java (paintCell): Do not paint the caret here. Do not accept unused parameters. (paint): No need to allocate rectangle for each cell. * javax/swing/DefaultCellEditor.java: Rewritten. * examples/gnu/classpath/examples/swing/Demo.java (mkTable): Use TableDemo.java table example. * examples/gnu/classpath/examples/swing/TableDemo.java: New file. Index: javax/swing/DefaultCellEditor.java === RCS file: /cvsroot/classpath/classpath/javax/swing/DefaultCellEditor.java,v retrieving revision 1.17 diff -u -r1.17 DefaultCellEditor.java --- javax/swing/DefaultCellEditor.java 16 Jan 2006 12:36:50 - 1.17 +++ javax/swing/DefaultCellEditor.java 19 Jan 2006 12:13:08 - @@ -59,8 +59,7 @@ * some standard object types. * * @author Andrew Selkirk - * - * @status mostly unimplemented + * @author Audrius Meskauskas */ public class DefaultCellEditor extends AbstractCellEditor @@ -76,10 +75,13 @@ protected class EditorDelegate implements ActionListener, ItemListener, Serializable { +/** + * Use the serial version UID for interoperability. + */ private static final long serialVersionUID = -1420007406015481933L; /** - * value + * The object value (updated when getting and setting the value). */ protected Object value; @@ -90,28 +92,30 @@ { // Nothing to do here. } - + /** - * setValue + * Set the value for the editor component. This method is normally + * overridden to set the value in the way, specific for the text + * component, check box or combo box. * - * @param value TODO + * @param aValue the value to set (String, Boolean or Number). */ -public void setValue(Object value) +public void setValue(Object aValue) { - // TODO: should be setting the value in the editorComp - this.value = value; + value = aValue; } - /** - * getCellEditorValue - * - * @returns Object +/** + * Get the value for the editor component. This method is normally + * overridden to obtain the value in the way, specific for the text + * component, check box or combo box. + * + * @return value the value of the component (String, Boolean or Number). */ public Object getCellEditorValue() { - // TODO: should be getting the updated value from the editorComp return value; -} // getCellEditorValue() +} /** * isCellEditable @@ -208,16 +212,132 @@ listeners[index].editingCanceled(changeEvent); } } // EditorDelegate + + /** + * Provides getter and setter methods to work with the text component. + * + * @author Audrius Meskauskas ([EMAIL PROTECTED]) + */ + private class JTextFieldDelegate extends EditorDelegate + { +/** + * Use the serial version UID for interoperability. + */ +private static final long serialVersionUID = 1; + +/** + * Set the value for the editor component. + * + * @param aValue the value to set (toString() will be called). + */ +public void setValue(Object aValue) +{ + value = aValue; + JTextField f = (JTextField) editorComponent; + if (value == null) +f.setText(""); + else +f.setText(value.toString()); +} - /** +/** + * Get the value for the editor compone
[cp-patches] RFC: Rewritten java.net.SocketPermission
Hi all, I've been writing Mauve tests to try and figure out what the patch on PR classpath/24708 is all about and I figured it made things a little neater but didn't go nearly far enough. I gave up trying to rescue bits of it after a while and just wrote chunks of it from scratch. It's my first major patch so I thought I'd pass it for review before committing. The changes I made are as follows: * The current implementation does all its parsing in the implies method. This is inefficient for instances that are part of the security policy, and it means that any parse exceptions are thrown at the wrong time. My patch solves these two problems by moving all parsing into methods called by the constructor. * The parser for the constructor's hostport argument is completely new. Improvements over the current implementation are that it can handle IPv6 addresses and that it checks its arguments and throws IllegalArgumentExceptions where appropriate. This mitigates the risk of misconfigurations in security policy files becoming exploitable. * The actions handling stuff is also completely new, replacing the current string-based one with one based on bitmasks. It too checks its arguments. The new patch does not check the host part of the hostport argument very much, and the host checking in implies() has not been touched. That's my next project :) Questions I have: * Should I make things transient? * Is hashcode() ok? * What should I put in the ChangeLog? There's so many changes it's hard to see how I'd break them down per-method. I'll be committing the Mauve tests shortly. Cheers, Gary Index: java/net/SocketPermission.java === RCS file: /cvsroot/classpath/classpath/java/net/SocketPermission.java,v retrieving revision 1.17 diff -u -r1.17 SocketPermission.java --- java/net/SocketPermission.java 16 Jan 2006 10:28:35 - 1.17 +++ java/net/SocketPermission.java 19 Jan 2006 11:43:58 - @@ -1,5 +1,6 @@ /* SocketPermission.java -- Class modeling permissions for socket operations - Copyright (C) 1998, 2000, 2001, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 2000, 2001, 2002, 2004, 2006 Free Software + Foundation, Inc. This file is part of GNU Classpath. @@ -105,7 +106,8 @@ * * @since 1.2 * - * @author Aaron M. Renn ([EMAIL PROTECTED]) + * @author Written by Aaron M. Renn ([EMAIL PROTECTED]) + * @author Extensively modified by Gary Benson ([EMAIL PROTECTED]) */ public final class SocketPermission extends Permission implements Serializable { @@ -114,16 +116,37 @@ // FIXME: Needs serialization work, including readObject/writeObject methods. /** - * A hostname/port combination as described above + * A hostname (possibly wildcarded) or IP address (IPv4 or IPv6). */ - private transient String hostport; + private String host; /** - * A comma separated list of actions for which we have permission + * A range of ports. */ - private String actions; + private int minport; + private int maxport; /** + * Values used for minimum and maximum ports when one or both bounds + * are omitted. This class is essentially independent of the + * networking code it describes, so we do not limit ports to the + * usual network limits of 1 and 65535. + */ + private static final int MIN_PORT = 0; + private static final int MAX_PORT = Integer.MAX_VALUE; + + /** + * A bitmask representing the actions for which we have permission + */ + private int actions; + + /** + * The available actions, in the canonical order required for getActions(). + */ + private static final String[] ACTIONS = new String[] { +"connect", "listen", "accept", "resolve"}; + +/** * Initializes a new instance of SocketPermission with the * specified host/port combination and actions string. * @@ -134,8 +157,136 @@ { super(hostport); -this.hostport = hostport; -this.actions = actions; +setHostPort(hostport); +setActions(actions); + } + + /** + * Parse the hostport argument to the constructor. + */ + private void setHostPort(String hostport) + { +// Split into host and ports +String ports; +if (hostport.length() == 0) + { + host = ports = ""; + } +else if (hostport.charAt(0) == '[') + { + // host is a bracketed IPv6 address + int end = hostport.indexOf("]"); + if (end == -1) + throw new IllegalArgumentException("Unmatched '['"); + host = hostport.substring(1, end); + + if (end == hostport.length() - 1) + ports = ""; + else if (hostport.charAt(end + 1) == ':') + ports = hostport.substring(end + 2); + else + throw new IllegalArgumentException("Bad character after ']'"); + } +else + { + // host is a hostname or IPv4 address + int sep = hostport.indexOf(":"); +
Re: [cp-patches] Re: [commit-cp] classpath ChangeLog configure.ac
Hi Mark, Am Donnerstag, den 19.01.2006, 01:59 +0100 schrieb Mark Wielaard: > Hi Roman, > > On Wed, 2006-01-18 at 11:31 +, Roman Kennke wrote: > > CVSROOT:/cvsroot/classpath > > Module name:classpath > > Branch: > > Changes by: Roman Kennke <[EMAIL PROTECTED]>06/01/18 11:31:14 > > > > Modified files: > > . : ChangeLog configure.ac > > > > Log message: > > 2006-01-18 Roman Kennke < > > > > * configure.ac: Added --enable-posix-layer option to enable > > build of the posix target layer. > > I didn't see a patch with the rationale for this on classpath-patches, > can you please post one with a little explanation. I fixed the build machinery so that the posix layer can (in theory) be build by adding --enable-posix-layer to the configure call. However, the posix code seems to have bugs and is not buildable ATM. I'll try to fix that asap (and still commit this, mainly to answer you email :-) ) 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * configure.ac: Added/fixed --enable-posix-layer option to enable build of posix layer. * native/target/Makefile.am: Added build for posix layer. /Roman Index: configure.ac === RCS file: /cvsroot/classpath/classpath/configure.ac,v retrieving revision 1.129 diff -u -r1.129 configure.ac --- configure.ac 19 Jan 2006 10:32:20 - 1.129 +++ configure.ac 19 Jan 2006 10:57:54 - @@ -32,9 +32,6 @@ dnl get the target for the native layer case "$target_os" in -linux* ) -TARGET=Linux -;; * ) dnl XXX change me when transition to target native layer is done TARGET=Linux @@ -201,10 +198,11 @@ *) ENABLE_POSIX=yes ;; esac], [ENABLE_POSIX=no]) -AC_SUBST(CP_NEW) +AC_SUBST(NEW_CP) if test "x${ENABLE_POSIX}" = xyes; then - AC_DEFINE(CP_NEW, 1, [defined if the posix layer should be used]) + AC_DEFINE(NEW_CP, 1, [defined if the posix layer should be used]) fi +AM_CONDITIONAL(CREATE_POSIX, test "x${ENABLE_POSIX}" = xyes) dnl --- dnl Sets the native libraries installation dir Index: native/target/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/target/Makefile.am,v retrieving revision 1.5 diff -u -r1.5 Makefile.am --- native/target/Makefile.am 19 Jan 2006 10:32:20 - 1.5 +++ native/target/Makefile.am 19 Jan 2006 10:57:54 - @@ -1,5 +1,9 @@ ## Input file for automake to generate the Makefile.in used by configure +if CREATE_POSIX + POSIXDIR = posix +endif + DIST_SUBDIRS = \ Linux \ SunOS \ @@ -11,7 +15,8 @@ SUBDIRS = \ $(TARGET) \ - generic + generic \ + posix EXTRA_DIST = readme.txt signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: Remove (bogus) asserts in java-net.
Hi Mark, Am Donnerstag, den 19.01.2006, 02:12 +0100 schrieb Mark Wielaard: > Hi Roman, > > On Wed, 2006-01-18 at 12:20 +0100, Roman Kennke wrote: > > Am Donnerstag, den 12.01.2006, 10:36 +0100 schrieb Mark Wielaard: > > > Hi, > > > > > > The crashes we were seeing with the net code in Mauve were caused by the > > > following bogus asserts in VMPlainDatagramSocketImpl_nativeReceive(): > > > > > > assert((*env)->GetArrayLength(env, receivedFromAddress) > 4); > > > assert((*env)->GetArrayLength(env, receivedFromPort ) > 1); > > > assert((*env)->GetArrayLength(env, receivedLength ) > 1); > > > > > > Removing these makes most net tests work again. I am working on the > > > others. I also took the oppertunity to remove all other asserts() in > > > this code since they don't really add anything. Checking whether the > > > JNIEnv is not NULL isn't really that much help since if that is the case > > > lots of things will just break since it means the runtime is completely > > > broken. > > > > AFAICS, it is always helpful to assert parameters in function calls, > > even the env parameter. I spoke to Torsten about that and he put > > together a nice piece of example code that demonstrates the problem, > > even when the runtime is not broken. The assert statements are very > > helpful to find such errors early: > > [...] > > Without the asserts you would get a segfault in f2() in the line with > > the printf() statement and most likely don't immediately see what is > > wrong there. With the asserts on you would see that env is NULL in f2() > > but not in f1(). Obviously we have trashed the stack somewhere in > > f1() ;-) > > I find the example a bit contrived. You will get a crash anyway in f2() > since you trashed env and are using it. Whether the crash is because of > the assert (which only checks for null) or because of actual usage > (which will catch much more cases) doesn't really matter that much imho. Granted, the example is a little constructed. The point is not if you get the crash in f2() anyway. The point is that the asserts help you find the actual bug. In a real world environment you may trash the stack anywhere, not only one function call up. The asserts help you find out, 'Oh, there's something wrong in f2() but in f1() it was ok, so the error must be in f1()'. Imagine such a scenario when there are more function calls in between etc and you quickly see that the asserts actually make sense. OTOH, when you say the asserts don't make sense for argument checking, can you give a good example of a use case for asserts? Or are you opposed to using asserts in general? > > It is generally a good idea to check arguments with asserts. It doesn't > > hurt (except in the cases mentioned by you that made the Mauve tests > > fail, where we better look why the asserts fail, maybe they are wrong > > and need to be adjusted, and not remove the asserts) and makes the code > > safer (and more secure, think of buffer overflow attacks and stuff like > > that). > > > > I would vote for taking the asserts back in and investigating why the > > specific VMPlainDatagramSocketImpl_nativeReceive() asserts make the > > Mauve tests crash. > > The asserts failed because they were testing the wrong condition (they > test for > instead of ==). This code is so tightly bound to the private > VM method that I don't feel argument assert checking buys us anything. Indeed, that was the problem and IMO it should have been fixed that way. I don't really get why you feel that the asserts don't by us anything. Isn't it good to make sure that the arrays have the correct size before accessing them? Sure, if we don't check we crash anyway, as we would with the asserts in, but with the asserts enabled (which only happens in debug mode anyway AFAIK) you have a better chance to find the actual bug. In my experience the usage of asserts is extremely helpful and I feel that if anything, we should put more asserts in the code instead of removing them. Roman signature.asc Description: Dies ist ein digital signierter Nachrichtenteil ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
FYI: Re: [cp-patches] Re: JamVM stopped working today
Hi! The target native layer thing seems to be broken for non-linux architectures. This fixes the issue and defaults to TARGET=Linux, which is actually generic. This is commited. TWISTI 2006-01-19 Christian Thalinger <[EMAIL PROTECTED]> * configure.ac: Set TARGET to Linux per default. * native/target/Makefile.am (libtarget_la_LIBADD): Removed libtargetos.la. * native/target/Linux/Makefile.am: Don't build a libtargetos.la. * native/target/generic/Makefile.am (INCLUDES): Renamed to AM_CPPFLAGS. Index: configure.ac === RCS file: /cvsroot/classpath/classpath/configure.ac,v retrieving revision 1.128 diff -u -3 -p -r1.128 configure.ac --- configure.ac18 Jan 2006 11:31:14 - 1.128 +++ configure.ac19 Jan 2006 10:23:14 - @@ -36,7 +36,8 @@ case "$target_os" in TARGET=Linux ;; * ) -TARGET=generic +dnl XXX change me when transition to target native layer is done +TARGET=Linux ;; esac AC_SUBST(TARGET) Index: native/target/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/target/Makefile.am,v retrieving revision 1.4 diff -u -3 -p -r1.4 Makefile.am --- native/target/Makefile.am 17 Jan 2006 22:13:06 - 1.4 +++ native/target/Makefile.am 19 Jan 2006 10:23:14 - @@ -21,4 +21,3 @@ libtarget_la_SOURCES = libtarget_la_LIBADD = \ generic/libtargetgeneric.la - $(TARGET)/libtargetos.la Index: native/target/Linux/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/target/Linux/Makefile.am,v retrieving revision 1.4 diff -u -3 -p -r1.4 Makefile.am --- native/target/Linux/Makefile.am 17 Jan 2006 22:13:06 - 1.4 +++ native/target/Linux/Makefile.am 19 Jan 2006 10:23:14 - @@ -8,7 +8,3 @@ EXTRA_DIST = \ target_native_memory.h \ target_native_network.h \ target_native_file.h - -noinst_LTLIBRARIES = libtargetos.la - -libtargetos_la_SOURCES = Index: native/target/generic/Makefile.am === RCS file: /cvsroot/classpath/classpath/native/target/generic/Makefile.am,v retrieving revision 1.3 diff -u -3 -p -r1.3 Makefile.am --- native/target/generic/Makefile.am 17 Jan 2006 22:13:06 - 1.3 +++ native/target/generic/Makefile.am 19 Jan 2006 10:23:14 - @@ -1,6 +1,6 @@ ## Input file for automake to generate the Makefile.in used by configure -INCLUDES = -I$(top_srcdir)/native/target/$(TARGET) +AM_CPPFLAGS = -I$(top_srcdir)/native/target/$(TARGET) EXTRA_DIST = \ target_generic_math.h \ ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: java-nio adjustments for target/native
> "Roman" == Roman Kennke <[EMAIL PROTECTED]> writes: Roman> That would most likely cause problems on these ports. The specific Roman> problem is that these ports actually have a malloc() syscall, only that Roman> it doesn't really do what you would expect, and the macro works around Roman> that by calling another (platform specific) syscall that does what's Roman> expected. The best thing I can offer is a shorter macro name. You can always: #undef malloc #define malloc SomethingElse It is unlikely that this is going to break something. Roman> I am aware of that problem. Still I don't know how to solve that Roman> problem. We simply cannot give away some of our ports, due to license Roman> and other restrictions. The macro idea is one way... it puts the cost on the targets, not on Classpath. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] RFC: gnu.regexp: fixed bugs in RETokenRepeated
From: Ito Kazumitsu <[EMAIL PROTECTED]> Subject: Re: [cp-patches] RFC: gnu.regexp fix to avoid unwanted PatternSyntaxException Date: Thu, 19 Jan 2006 01:39:52 +0900 (JST) > From: Ito Kazumitsu <[EMAIL PROTECTED]> > Date: Thu, 05 Jan 2006 23:47:03 +0900 (JST) > > > + // doables.index == lastIndex means an empty string > > + // was the longest that matched this token. > > + // We break here, otherwise we will fall into an endless loop. > > Studying various cases, I have found that this comment is not > always true. And this is my fix. ChangeLog 2006-01-19 Ito Kazumitsu <[EMAIL PROTECTED]> * gnu/regexp/REMatch.java(empty): New boolean indicating an empty string matched. * gnu/regexp/RE.java(match): Sets empty flag when an empty string matched. * gnu/regexp/RETokenRepeated.java(match): Sets empty flag when an empty string matched. Fixed a bug of the case where an empty string matched. Index: classpath/gnu/regexp/RE.java === RCS file: /cvsroot/classpath/classpath/gnu/regexp/RE.java,v retrieving revision 1.11 diff -u -r1.11 RE.java --- classpath/gnu/regexp/RE.java19 Jan 2006 13:45:51 - 1.11 +++ classpath/gnu/regexp/RE.java19 Jan 2006 14:20:20 - @@ -1012,7 +1012,7 @@ * "a" : 'a' itself. * "\0123" : Octal char 0123 * "\x1b" : Hex char 0x1b - * "\u1234" : Unicode char \u1234 + * "\u1234 : Unicode char \u1234 */ private static class CharExpression { /** character represented by this expression */ @@ -1246,12 +1246,20 @@ /* Implements abstract method REToken.match() */ boolean match(CharIndexed input, REMatch mymatch) { - if (firstToken == null) return next(input, mymatch); + int origin = mymatch.index; + boolean b; + if (firstToken == null) { + b = next(input, mymatch); + if (b) mymatch.empty = (mymatch.index == origin); + return b; + } // Note the start of this subexpression mymatch.start[subIndex] = mymatch.index; - return firstToken.match(input, mymatch); + b = firstToken.match(input, mymatch); + if (b) mymatch.empty = (mymatch.index == origin); + return b; } /** Index: classpath/gnu/regexp/REMatch.java === RCS file: /cvsroot/classpath/classpath/gnu/regexp/REMatch.java,v retrieving revision 1.2 diff -u -r1.2 REMatch.java --- classpath/gnu/regexp/REMatch.java 2 Jul 2005 20:32:15 - 1.2 +++ classpath/gnu/regexp/REMatch.java 19 Jan 2006 14:20:20 - @@ -67,6 +67,7 @@ int[] start; // start positions (relative to offset) for each (sub)exp. int[] end; // end positions for the same REMatch next; // other possibility (to avoid having to use arrays) +boolean empty; // empty string matched public Object clone() { try { @@ -88,6 +89,7 @@ index = other.index; // need to deep clone? next = other.next; + empty = other.empty; } REMatch(int subs, int anchor, int eflags) { @@ -124,6 +126,7 @@ start[i] = end[i] = -1; } next = null; // cut off alternates + empty = false; } /** Index: classpath/gnu/regexp/RETokenRepeated.java === RCS file: /cvsroot/classpath/classpath/gnu/regexp/RETokenRepeated.java,v retrieving revision 1.5 diff -u -r1.5 RETokenRepeated.java --- classpath/gnu/regexp/RETokenRepeated.java 8 Jan 2006 23:06:43 - 1.5 +++ classpath/gnu/regexp/RETokenRepeated.java 19 Jan 2006 14:20:20 - @@ -91,6 +91,7 @@ // the subexpression back-reference operator allow that? boolean match(CharIndexed input, REMatch mymatch) { + int origin = mymatch.index; // number of times we've matched so far int numRepeats = 0; @@ -116,6 +117,7 @@ REMatch result = matchRest(input, newMatch); if (result != null) { mymatch.assignFrom(result); + mymatch.empty = (mymatch.index == origin); return true; } } @@ -153,12 +155,43 @@ positions.addElement(newMatch); - // doables.index == lastIndex means an empty string - // was the longest that matched this token. - // We break here, otherwise we will fall into an endless loop. + // doables.index == lastIndex occurs either + // (1) when an empty string was the longest + // that matched this token. + // And this case occurs either + // (1-1) when this token is always empty, + // for example "()" or "(())". + // (1-2) when this token is not always empty +
Re: [cp-patches] Re: [commit-cp] classpath ChangeLog configure.ac
> "Roman" == Roman Kennke <[EMAIL PROTECTED]> writes: Roman> Whoops, this was a kind of accident. The patch wasn't really complete Roman> and even worse, the posix layer also isn't (it does not compile yet). Roman> The intention was to add a switch to the configury which enables the Roman> posix layer instead of the generic thing, so that everybody can try it Roman> out and see if that is in any way better than the old target native Roman> layer stuff. After seeing this patch I noticed that we don't have a place where our configure options are documented in full. It seems like this would be nice... from the name it is unclear when I would want to use this. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: Remove (bogus) asserts in java-net.
> "Mark" == Mark Wielaard <[EMAIL PROTECTED]> writes: Mark> I find the example a bit contrived. You will get a crash anyway in f2() Mark> since you trashed env and are using it. Yes... let's not talk about asserts in the abstract. I don't think that sheds much light. >> > assert((*env)->GetArrayLength(env, receivedFromAddress) > 4); Mark> The asserts failed because they were testing the wrong condition (they Mark> test for > instead of ==). Oops. Mark> This code is so tightly bound to the private Mark> VM method that I don't feel argument assert checking buys us anything. If the code in question lives in a different file, then I think that having the assert does add something -- it ensures that a change in one place has a chance of being caught in the other. This can be very useful. In this case, fixing the assertion to be correct certainly wouldn't hurt anything, and would provide some mild protection against changes. Another question to ask is whether an assert is the appropriate self-checking mechanism at a given point. If it is purely classpath-internal stuff, then this is probably ok. That is especially true if our test suite actually runs this code path -- that way we can be reasonably sure that a Classpath release won't trigger the assertion. In some other situations a Java exception is probably more appropriate. Tom ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] RFC: configure fixlet
Mark Wielaard wrote: Hi Wolfgang, On Mon, 2006-01-16 at 09:46 +0100, Wolfgang Baer wrote: if only ecj is available currently configure breaks because we don't test for a found ecj in the error test. Tested on my local box. 2006-01-16 Wolfgang Baer <[EMAIL PROTECTED]> * m4/acinclude.m4: Test also for ecj found before exiting configure with no javac found error message. OK, to commit ? Yes thanks. Committed. Wolfgang ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] Re: [commit-cp] classpath ChangeLog configure.ac
Hi, On Thu, 2006-01-19 at 08:55 -0700, Tom Tromey wrote: > After seeing this patch I noticed that we don't have a place where our > configure options are documented in full. It seems like this would be > nice... from the name it is unclear when I would want to use this. We have a list in the INSTALL file, also configure --help should give you all the help strings associated with the options. Cheers, Mark signature.asc Description: This is a digitally signed message part ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
Re: [cp-patches] FYI: Remove (bogus) asserts in java-net.
Hi Roman, On Thu, 2006-01-19 at 11:18 +0100, Roman Kennke wrote: > Granted, the example is a little constructed. The point is not if you > get the crash in f2() anyway. The point is that the asserts help you > find the actual bug. In a real world environment you may trash the stack > anywhere, not only one function call up. The asserts help you find out, > 'Oh, there's something wrong in f2() but in f1() it was ok, so the error > must be in f1()'. Imagine such a scenario when there are more function > calls in between etc and you quickly see that the asserts actually make > sense. In general our JNI code is a small as possible without any deeply nested functions. Some of the assert code did more than the actual real code of the JNI method did. > OTOH, when you say the asserts don't make sense for argument checking, > can you give a good example of a use case for asserts? Or are you > opposed to using asserts in general? I'll try to be a bit more constructive. I admit to have been very irritated by the wrong asserts that made the network code just not work and me finding out late while I was making and testing the 0.20 release. For me there were two issues: - The clearly wrong asserts that just prevented the code working. Maybe correct ones could be added, but assert is just not that friendly. If we had something like in the gtk-peers where a gtk-error translates into a InternalError stacktrace it might be a bit more useful. But I still feel these obvious asserts are not that helpful since if they fail so would the code anyway when they weren't there. - The asserts for the JNIEnv being setup correctly. I think this is like checking that the Program Counter increased since the last instruction. If the JNIEnv really is trashed you are so deep in trouble that an assert won't help you anyway. It means the runtime is broken, or something seriously trashed memory. Cheers, Mark signature.asc Description: This is a digitally signed message part ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: Bugfix for target layer
Hi, I added the missing function targetGenericMisc_formatString() that somehow got lost. 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * native/target/generic/target_generic_misc.c: (targetGenericMisc_formatString): Added missing method. /Roman Index: native/target/generic/target_generic_misc.c === RCS file: /cvsroot/classpath/classpath/native/target/generic/target_generic_misc.c,v retrieving revision 1.2 diff -u -r1.2 target_generic_misc.c --- native/target/generic/target_generic_misc.c 17 Jan 2006 12:29:40 - 1.2 +++ native/target/generic/target_generic_misc.c 19 Jan 2006 20:05:32 - @@ -75,6 +75,39 @@ /* Functions ***/ +#ifdef TARGET_NATIVE_MISC_FORMAT_STRING_GENERIC +int targetGenericMisc_formatString(char *buffer, unsigned int bufferSize, const char *format,...) +{ + va_list arguments; + int n; + char*tmpBuffer; + + assert(buffer!=NULL); + assert(format!=NULL); + + va_start(arguments,format); + #ifdef HAVE_VSNPRINTF +n=vsnprintf(buffer,bufferSize,format,arguments); +if (n==-1) n=bufferSize; + #else +/* ToDo: how can we implement a safe format function without vsnprintf() + which does detect the number of characters formated? +*/ +TARGET_NATIVE_MEMORY_ALLOC(tmpBuffer,char*,4096); +n=vsprintf(tmpBuffer,format,arguments); +assert(n<=4096); +if (n___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: SwingFramePeer fix
This fixes the handling of mouse events for the SwingFramePeer. The previous implementation was mostly bogus and cause NPEs and whatnot. This is now checked correctly and the mouse event gets translated when there is a menu bar so that it gets dispatched with the correct coordinates. 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * gnu/java/awt/peer/swing/SwingFramePeer.java (handleMouseEvent): Fixed handling of mouse events. (handleMouseMotionEvent): Fixed handling of mouse events. /Roman Index: gnu/java/awt/peer/swing/SwingFramePeer.java === RCS file: /cvsroot/classpath/classpath/gnu/java/awt/peer/swing/SwingFramePeer.java,v retrieving revision 1.1 diff -u -r1.1 SwingFramePeer.java --- gnu/java/awt/peer/swing/SwingFramePeer.java 14 Jan 2006 00:26:26 - 1.1 +++ gnu/java/awt/peer/swing/SwingFramePeer.java 19 Jan 2006 20:17:29 - @@ -155,11 +155,19 @@ { Point p = ev.getPoint(); Insets i = super.getInsets(); -int menuHeight = menuBar.getHeight(); -if (p.y >= i.top && p.y <= i.top + menuHeight) - menuBar.handleMouseEvent(ev); -else - super.handleMouseEvent(ev); +if (menuBar != null) + { +int menuHeight = menuBar.getHeight(); +if (p.y >= i.top && p.y <= i.top + menuHeight) + menuBar.handleMouseEvent(ev); +else + { +ev.translatePoint(0, -menuHeight); +super.handleMouseMotionEvent(ev); + } + } + +super.handleMouseEvent(ev); } /** @@ -171,10 +179,18 @@ { Point p = ev.getPoint(); Insets i = super.getInsets(); -int menuHeight = menuBar.getHeight(); -if (p.y >= i.top && p.y <= i.top + menuHeight) - menuBar.handleMouseMotionEvent(ev); -else - super.handleMouseMotionEvent(ev); +if (menuBar != null) + { +int menuHeight = menuBar.getHeight(); +if (p.y >= i.top && p.y <= i.top + menuHeight) + menuBar.handleMouseMotionEvent(ev); +else + { +ev.translatePoint(0, -menuHeight); +super.handleMouseMotionEvent(ev); + } + } + +super.handleMouseMotionEvent(ev); } } ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: JOptionPane fixlet
In my last commit I forgot to adjust the JOptionPane to the new SwingUtilities.getOwnerFrame() signature. This is done by this patch. 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/JOptionPane.java Added cast to Frame for JDialog constructor. /Roman Index: javax/swing/JOptionPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JOptionPane.java,v retrieving revision 1.24 diff -u -r1.24 JOptionPane.java --- javax/swing/JOptionPane.java 19 Jan 2006 21:25:22 - 1.24 +++ javax/swing/JOptionPane.java 19 Jan 2006 22:28:36 - @@ -236,7 +236,7 @@ protected boolean wantsInput; /** The common frame used when no parent is provided. */ - private static Frame privFrame = SwingUtilities.getOwnerFrame(null); + private static Frame privFrame = (Frame) SwingUtilities.getOwnerFrame(null); /** * Creates a new JOptionPane object using a message of "JOptionPane ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: JWindow API docs
I added some API docs to the JWindow constructors. 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/JWindow.java: Added API docs to the constructors. /Roman Index: javax/swing/JWindow.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JWindow.java,v retrieving revision 1.23 diff -u -r1.23 JWindow.java --- javax/swing/JWindow.java 19 Jan 2006 21:25:22 - 1.23 +++ javax/swing/JWindow.java 19 Jan 2006 22:14:24 - @@ -86,30 +86,70 @@ protected AccessibleContext accessibleContext; + /** + * Creates a new JWindow that has a shared invisible owner frame + * as its parent. + */ public JWindow() { super(SwingUtilities.getOwnerFrame(null)); windowInit(); } + /** + * Creates a new JWindow that uses the specified graphics + * environment. This can be used to open a window on a different screen for + * example. + * + * @param gc the graphics environment to use + */ public JWindow(GraphicsConfiguration gc) { super(SwingUtilities.getOwnerFrame(null), gc); windowInit(); } - + + /** + * Creates a new JWindow that has the specified + * owner frame. If owner is null, then + * an invisible shared owner frame is installed as owner frame. + * + * @param owner the owner frame of this window; if null a shared + *invisible owner frame is used + */ public JWindow(Frame owner) { super(SwingUtilities.getOwnerFrame(owner)); windowInit(); } + /** + * Creates a new JWindow that has the specified + * owner window. If owner is null, + * then an invisible shared owner frame is installed as owner frame. + * + * @param owner the owner window of this window; if null a + *shared invisible owner frame is used + */ public JWindow(Window owner) { super(owner); windowInit(); } + /** + * Creates a new JWindow for the given graphics configuration + * and that has the specified owner window. If + * owner is null, then an invisible shared owner + * frame is installed as owner frame. + * + * The gc parameter can be used to open the window on a + * different screen for example. + * + * @param owner the owner window of this window; if null a + *shared invisible owner frame is used + * @param gc the graphics configuration to use + */ public JWindow(Window owner, GraphicsConfiguration gc) { super(owner, gc); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI: JTable cleanup.
This patch adds comments to the uncommented methods and removes the currently unused EditorUpdateTimer inner class. 2006-01-19 Audrius Meskauskas <[EMAIL PROTECTED]> * javax/swing/JTable.java: Commenting method headers. (EditorUpdateTimer): Removed. Index: JTable.java === RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v retrieving revision 1.66 diff -u -r1.66 JTable.java --- JTable.java 19 Jan 2006 12:40:52 - 1.66 +++ JTable.java 19 Jan 2006 21:38:26 - @@ -1561,7 +1561,8 @@ } /** - * Creates a new JTable instance. + * Creates a new JTable instance with the given number + * of rows and columns. * * @param numRows an int value * @param numColumns an int value @@ -1572,10 +1573,12 @@ } /** - * Creates a new JTable instance. + * Creates a new JTable instance, storing the given data + * array and heaving the given column names. To see the column names, + * you must place the JTable into the [EMAIL PROTECTED] JScrollPane}. * - * @param data an Object[][] value - * @param columnNames an Object[] value + * @param data an Object[][] the table data + * @param columnNames an Object[] the column headers */ public JTable(Object[][] data, Object[] columnNames) { @@ -1583,20 +1586,31 @@ } /** - * Creates a new JTable instance. - * - * @param dm a TableModel value + * Creates a new JTable instance, using the given data model + * object that provides information about the table content. The table model + * object is asked for the table size, other features and also receives + * notifications in the case when the table has been edited by the user. + * + * @param model + * the table model. */ - public JTable (TableModel dm) + public JTable (TableModel model) { -this(dm, null, null); +this(model, null, null); } /** - * Creates a new JTable instance. - * - * @param dm a TableModel value - * @param cm a TableColumnModel value + * Creates a new JTable instance, using the given model object + * that provides information about the table content. The table data model + * object is asked for the table size, other features and also receives + * notifications in the case when the table has been edited by the user. The + * table column model provides more detailed control on the table column + * related features. + * + * @param dm + * the table data mode + * @param cm + * the table column model */ public JTable (TableModel dm, TableColumnModel cm) { @@ -1604,11 +1618,13 @@ } /** - * Creates a new JTable instance. - * - * @param dm a TableModel value - * @param cm a TableColumnModel value - * @param sm a ListSelectionModel value + * Creates a new JTable instance, providing data model, + * column model and list selection model. The list selection model + * manages the selections. + * + * @param dm data model (manages table data) + * @param cm column model (manages table columns) + * @param sm list selection model (manages table selections) */ public JTable (TableModel dm, TableColumnModel cm, ListSelectionModel sm) { @@ -1636,8 +1652,23 @@ columnModel.getSelectionModel().setAnchorSelectionIndex(0); columnModel.getSelectionModel().setLeadSelectionIndex(0); updateUI(); - } - + } + + /** + * Creates a new JTable instance that uses data and column + * names, stored in [EMAIL PROTECTED] Vector}s. + * + * @param data the table data + * @param columnNames the table column names. + */ + public JTable(Vector data, Vector columnNames) + { +this(new DefaultTableModel(data, columnNames)); + } + + /** + * Initialize local variables to default values. + */ protected void initializeLocalVars() { setTableHeader(createDefaultTableHeader()); @@ -1666,63 +1697,15 @@ this.editingRow = -1; setIntercellSpacing(new Dimension(1,1)); } - - /** - * Creates a new JTable instance. - * - * @param data a Vector value - * @param columnNames a Vector value - */ - public JTable(Vector data, Vector columnNames) - { -this(new DefaultTableModel(data, columnNames)); - } - + /** - * The timer that updates the editor component. + * Add the new table column. The table column class allows to specify column + * features more precisely. You do not need the add columns to the table if + * the default column handling is sufficient. + * + * @param column + * the new column to add. */ - private class EditorUpdateTimer -extends Timer -implements ActionListener - { -/** - * Creates a new EditorUpdateTimer object with a default delay of 0.5 seconds. - */ -public EditorUpdateTimer() -{ - super(500, null); - addActionListener(this); -} - -/** - * Lets the caret blink and repaints the table. -
[cp-patches] FYI: Some swing fixes
Hi, this fixes an issue I had with JWindow. The constructor JWindow(Frame) is allowed to take a null parameter and in that case should install a shared owner frame (as returned by SwingUtilites.getOwnerFrame). However, the implementation of this is a little tricky, since the super class does not allow null parameters. So I changed the SwingUtilities.getOwnerFrame() method (this is not public) to take a parameter 'owner' which is returned when not null. Later it came to mind that I also could have solved this problem with a super(owner == null? SwingUtilities.getOwnerFrame():owner) construct, however I really don't like the ?: expression, I feel Sun really should have left this out of Java :-) I had to adjust a couple of other classes for the changed SwingUtilities.getOwnerFrame() method, one of which is JFileChooser. Unfortunately I had a fix for this class lying around on my HD, which is now also going in. This is to call pack() in the showXXXDialog() methods. I feel that this will break the JFileChooser a little, but I already know how to fix it (I only must find time to do it - basically we need a special subclass of JList that displays the files) 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/JDialog.java (JDialog()): Call SwingUtilities.getOwnerFrame() with null. (JDialog(Frame,String,boolean,GraphicsConfiguration)): Call SwingUtilities.getOwnerFrame() with the owner argument. * javax/swing/JFileChooser.java (showOpenDialog(Component)): Call pack() on the dialog instead of setting a fixed height. (showSaveDialog()): Likewise. (showDialog()): Likewise. (createDialog): Call SwingUtilities.getOwnerFrame() with null. * javax/swing/JOptionPane.java: Call SwingUtilities.getOwnerFrame() with null. * javax/swing/JWindow.java (JWindow()): Call SwingUtilities.getOwnerFrame() with null. (JWindow(Frame)): Call SwingUtilities.getOwnerFrame() with owner argument. * javax/swing/SwingUtilities.java (getOwnerFrame): Changed to take a owner parameter that is returned as owner frame when not null. /Roman Index: javax/swing/JDialog.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JDialog.java,v retrieving revision 1.19 diff -u -r1.19 JDialog.java --- javax/swing/JDialog.java 7 Nov 2005 22:05:10 - 1.19 +++ javax/swing/JDialog.java 19 Jan 2006 21:17:59 - @@ -107,7 +107,7 @@ */ public JDialog() { -this(SwingUtilities.getOwnerFrame(), "", false, null); +this(SwingUtilities.getOwnerFrame(null), "", false, null); } /** @@ -234,8 +234,7 @@ public JDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) { -super((owner == null) ? SwingUtilities.getOwnerFrame() : owner, - title, modal, gc); +super(SwingUtilities.getOwnerFrame(owner), title, modal, gc); dialogInit(); } Index: javax/swing/JFileChooser.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JFileChooser.java,v retrieving revision 1.25 diff -u -r1.25 JFileChooser.java --- javax/swing/JFileChooser.java 4 Jan 2006 23:22:01 - 1.25 +++ javax/swing/JFileChooser.java 19 Jan 2006 21:17:59 - @@ -40,7 +40,6 @@ import java.awt.Component; import java.awt.Frame; import java.awt.HeadlessException; -import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.beans.PropertyChangeEvent; @@ -658,8 +657,7 @@ retval = ERROR_OPTION; -Insets i = d.getInsets(); -d.setSize(500 + i.top + i.bottom, d.getPreferredSize().height); +d.pack(); d.show(); return retval; } @@ -683,8 +681,7 @@ retval = ERROR_OPTION; -Insets i = d.getInsets(); -d.setSize(500 + i.top + i.bottom, d.getPreferredSize().height); +d.pack(); d.show(); return retval; } @@ -710,8 +707,7 @@ retval = ERROR_OPTION; -Insets i = d.getInsets(); -d.setSize(500 + i.top + i.bottom, d.getPreferredSize().height); +d.pack(); d.show(); return retval; } @@ -729,7 +725,7 @@ { Frame toUse = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent); if (toUse == null) - toUse = SwingUtilities.getOwnerFrame(); + toUse = SwingUtilities.getOwnerFrame(null); JDialog dialog = new JDialog(toUse); setSelectedFile(null); Index: javax/swing/JOptionPane.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JOptionPane.java,v retrieving revision 1.23 diff -u -r1.23 JOptionPane.java --- javax/swing/JOptionPane.java 8 Nov 2005 20:59:05 - 1.23 +++ javax/swing/JOptionPane.java 19 Jan 2006 21:17:59 - @@ -236,7 +236,7 @@ protected boolean wantsInput; /** The common
[cp-patches] FYI: more JWindow constructor fixes
I fixed the remaining JWindow constructors to also accept null owner arguments. This involved modifying the SwingUtilities.getOwnerFrame() signature once more, and adding casts to the statements that call this method. 2006-01-19 Roman Kennke <[EMAIL PROTECTED]> * javax/swing/JWindow.java (JWindow(Window)): Fixed to accept null owner argument. (JWindow(Window,GraphicsConfiguration)): Fixed to accept null owner argument. * javax/swing/SwingUtilities.java (getOwnerFrame): Owner parameter and return value are fixed to be of type Window for compatibity with the above JWindow constructor. * javax/swing/JDialog.java (JDialog): Added cast to Frame to make sure the correct constructor is called. * javax/swing/JFileChooser.java (createDialog): Added cast to Frame for JDialog constructor. /Roman Index: javax/swing/JWindow.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JWindow.java,v retrieving revision 1.24 diff -u -r1.24 JWindow.java --- javax/swing/JWindow.java 19 Jan 2006 22:16:21 - 1.24 +++ javax/swing/JWindow.java 19 Jan 2006 22:21:50 - @@ -133,7 +133,7 @@ */ public JWindow(Window owner) { -super(owner); +super(SwingUtilities.getOwnerFrame(owner)); windowInit(); } @@ -152,7 +152,7 @@ */ public JWindow(Window owner, GraphicsConfiguration gc) { -super(owner, gc); +super(SwingUtilities.getOwnerFrame(owner), gc); windowInit(); } Index: javax/swing/SwingUtilities.java === RCS file: /cvsroot/classpath/classpath/javax/swing/SwingUtilities.java,v retrieving revision 1.41 diff -u -r1.41 SwingUtilities.java --- javax/swing/SwingUtilities.java 19 Jan 2006 21:25:22 - 1.41 +++ javax/swing/SwingUtilities.java 19 Jan 2006 22:21:51 - @@ -1021,9 +1021,9 @@ * * @return The common Frame */ - static Frame getOwnerFrame(Frame owner) + static Window getOwnerFrame(Window owner) { -Frame result = owner; +Window result = owner; if (result == null) { if (ownerFrame == null) Index: javax/swing/JDialog.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JDialog.java,v retrieving revision 1.20 diff -u -r1.20 JDialog.java --- javax/swing/JDialog.java 19 Jan 2006 21:25:22 - 1.20 +++ javax/swing/JDialog.java 19 Jan 2006 22:21:51 - @@ -107,7 +107,7 @@ */ public JDialog() { -this(SwingUtilities.getOwnerFrame(null), "", false, null); +this((Frame) SwingUtilities.getOwnerFrame(null), "", false, null); } /** @@ -234,7 +234,7 @@ public JDialog(Frame owner, String title, boolean modal, GraphicsConfiguration gc) { -super(SwingUtilities.getOwnerFrame(owner), title, modal, gc); +super((Frame) SwingUtilities.getOwnerFrame(owner), title, modal, gc); dialogInit(); } Index: javax/swing/JFileChooser.java === RCS file: /cvsroot/classpath/classpath/javax/swing/JFileChooser.java,v retrieving revision 1.26 diff -u -r1.26 JFileChooser.java --- javax/swing/JFileChooser.java 19 Jan 2006 21:25:22 - 1.26 +++ javax/swing/JFileChooser.java 19 Jan 2006 22:21:52 - @@ -725,7 +725,7 @@ { Frame toUse = (Frame) SwingUtilities.getAncestorOfClass(Frame.class, parent); if (toUse == null) - toUse = SwingUtilities.getOwnerFrame(null); + toUse = (Frame) SwingUtilities.getOwnerFrame(null); JDialog dialog = new JDialog(toUse); setSelectedFile(null); ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches
[cp-patches] FYI:Rewriting JTable.rowAtPoint
This rewrites the rowAtPoint method in JTable, replacing loop by division. The table may have 2 rows or about (only part visible in the scroll pane). Hence the loop delay may already be significant. 2006-01-19 Audrius Meskauskas <[EMAIL PROTECTED]> * javax/swing/JTable.java (rowAtPoint): Rewritten. Index: JTable.java === RCS file: /sources/classpath/classpath/javax/swing/JTable.java,v retrieving revision 1.67 diff -u -r1.67 JTable.java --- JTable.java 19 Jan 2006 21:46:25 - 1.67 +++ JTable.java 19 Jan 2006 22:11:48 - @@ -1940,12 +1940,13 @@ } /** - * Returns index of the row that contains specified point or - * -1 if this table doesn't contain this point. - * - * @param point point to identify the row - * @return index of the row that contains specified point or - * -1 if this table doesn't contain this point. + * Returns index of the row that contains specified point or -1 if this table + * doesn't contain this point. + * + * @param point + * point to identify the row + * @return index of the row that contains specified point or -1 if this table + * doesn't contain this point. */ public int rowAtPoint(Point point) { @@ -1955,14 +1956,14 @@ int height = getRowHeight() + getRowMargin(); int y = point.y; -for (int i = 0; i < nrows; ++i) - { -if (0 <= y && y < height) - return i; -y -= height; - } +int r = y / height; +if (r < 0 || r > nrows) + return -1; +else + return r; } -return -1; +else + return -1; } /** ___ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches