Thread View: borland.public.jbuilder.java.api
9 messages
9 total messages
Started by Anon
Tue, 11 May 2004 12:31
What is this?
Author: Anon
Date: Tue, 11 May 2004 12:31
Date: Tue, 11 May 2004 12:31
20 lines
2009 bytes
2009 bytes
Exception in thread "main" java.lang.StackOverflowError at java.security.AccessController.doPrivileged(Native Method) at sun.io.Converters.getDefaultEncodingName(Converters.java:66) at java.lang.StringCoding.encode(StringCoding.java:376) at java.lang.String.getBytes(String.java:608) at java.io.UnixFileSystem.getBooleanAttributes0(Native Method) at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:125) at java.io.File.exists(File.java:679) at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:886) at sun.misc.URLClassPath.getResource(URLClassPath.java:156) at java.net.URLClassLoader$1.run(URLClassLoader.java:190) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:186) at java.lang.ClassLoader.loadClass(ClassLoader.java:299) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) at java.lang.ClassLoader.loadClass(ClassLoader.java:255) at java.security.Security.doGetImpl(Security.java:1122) at java.security.Security.doGetImpl(Security.java:1083) at java.security.Security.getImpl(Security.java:1044) at ...
Re: What is this?
Author: Kevin Dean
Date: Tue, 11 May 2004 12:42
Date: Tue, 11 May 2004 12:42
39 lines
2620 bytes
2620 bytes
First of all, we need more of the stack trace than that. Paste it all if possible. Second of all, when did this occur? Under what circumstances? Can you replicate it? Thanks. -- Check out our latest white papers at http://www.datadevelopment.com/papers/index.html BladeNET Scores With Borland Enterprise Tools Team Development with JBuilder and Borland Enterprise Server Dolphin Data Development Ltd. http://www.datadevelopment.com/ "@(none)" <""milan\"@(none)"> wrote in message news:40a0c784$1@newsgroups.borland.com... > > Exception in thread "main" java.lang.StackOverflowError > at java.security.AccessController.doPrivileged(Native Method) > at sun.io.Converters.getDefaultEncodingName(Converters.java:66) > at java.lang.StringCoding.encode(StringCoding.java:376) > at java.lang.String.getBytes(String.java:608) > at java.io.UnixFileSystem.getBooleanAttributes0(Native Method) > at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:125) > at java.io.File.exists(File.java:679) > at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:886) > at sun.misc.URLClassPath.getResource(URLClassPath.java:156) > at java.net.URLClassLoader$1.run(URLClassLoader.java:190) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:186) > at java.lang.ClassLoader.loadClass(ClassLoader.java:299) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) > at java.lang.ClassLoader.loadClass(ClassLoader.java:255) > at java.security.Security.doGetImpl(Security.java:1122) > at java.security.Security.doGetImpl(Security.java:1083) > at java.security.Security.getImpl(Security.java:1044) > at ...
Re: What is this?
Author: Ernesto Basc�n
Date: Mon, 19 Jul 2004 22:40
Date: Mon, 19 Jul 2004 22:40
56 lines
3111 bytes
3111 bytes
I got that error everytime I call recursively a method without give the right control to it. Same exception is raised when an event listener is called and the event listener trigges another event that raises the same event again. Doing an infinite loop method calling. Best regards Ernesto "Kevin Dean" <NkOdSePaAnM@datadevelopment.com> wrote in message news:40a0ca1b$1@newsgroups.borland.com... > First of all, we need more of the stack trace than that. Paste it all if > possible. Second of all, when did this occur? Under what circumstances? > Can you replicate it? > > Thanks. > > -- > Check out our latest white papers at > http://www.datadevelopment.com/papers/index.html > > BladeNET Scores With Borland Enterprise Tools > Team Development with JBuilder and Borland Enterprise Server > > Dolphin Data Development Ltd. > http://www.datadevelopment.com/ > > "@(none)" <""milan\"@(none)"> wrote in message > news:40a0c784$1@newsgroups.borland.com... > > > > Exception in thread "main" java.lang.StackOverflowError > > at java.security.AccessController.doPrivileged(Native Method) > > at sun.io.Converters.getDefaultEncodingName(Converters.java:66) > > at java.lang.StringCoding.encode(StringCoding.java:376) > > at java.lang.String.getBytes(String.java:608) > > at java.io.UnixFileSystem.getBooleanAttributes0(Native Method) > > at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:125) > > at java.io.File.exists(File.java:679) > > at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:886) > > at sun.misc.URLClassPath.getResource(URLClassPath.java:156) > > at java.net.URLClassLoader$1.run(URLClassLoader.java:190) > > at java.security.AccessController.doPrivileged(Native Method) > > at java.net.URLClassLoader.findClass(URLClassLoader.java:186) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:299) > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265) > > at java.lang.ClassLoader.loadClass(ClassLoader.java:255) > > at java.security.Security.doGetImpl(Security.java:1122) > > at java.security.Security.doGetImpl(Security.java:1083) > > at java.security.Security.getImpl(Security.java:1044) > > at ... > >
Re: What is this?
Author: Kevin Dean
Date: Tue, 20 Jul 2004 14:14
Date: Tue, 20 Jul 2004 14:14
91 lines
4216 bytes
4216 bytes
There are two ways to prevent recursive event triggering:
1) Don't write code that triggers the event you're currently handling (not
always possible).
2) Add a boolean flag that is turned on when you enter the event handler and
turned off when you exit. The event handler code would look something like
this:
if (!handlingEvent) {
handlingEvent = true;
try {
doSomethingToTriggerEvent();
}
finally {
handlingEvent = false;
}
}
--
Check out our latest white papers at
http://www.datadevelopment.com/papers/index.html
BladeNET Scores With Borland Enterprise Tools
Team Development with JBuilder and Borland Enterprise Server
Dolphin Data Development Ltd.
http://www.datadevelopment.com/
"Ernesto Basc�n" <ebascon@hotmail.com> wrote in message
news:40fc4c4c@newsgroups.borland.com...
> I got that error everytime I call recursively a method without give the
> right control to it.
>
> Same exception is raised when an event listener is called and the event
> listener trigges another event that raises the same event again. Doing an
> infinite loop method calling.
>
> Best regards
>
>
> Ernesto
>
>
> "Kevin Dean" <NkOdSePaAnM@datadevelopment.com> wrote in message
> news:40a0ca1b$1@newsgroups.borland.com...
> > First of all, we need more of the stack trace than that. Paste it all
if
> > possible. Second of all, when did this occur? Under what
circumstances?
> > Can you replicate it?
> >
> > Thanks.
> >
> > --
> > Check out our latest white papers at
> > http://www.datadevelopment.com/papers/index.html
> >
> > BladeNET Scores With Borland Enterprise Tools
> > Team Development with JBuilder and Borland Enterprise Server
> >
> > Dolphin Data Development Ltd.
> > http://www.datadevelopment.com/
> >
> > "@(none)" <""milan\"@(none)"> wrote in message
> > news:40a0c784$1@newsgroups.borland.com...
> > >
> > > Exception in thread "main" java.lang.StackOverflowError
> > > at java.security.AccessController.doPrivileged(Native Method)
> > > at sun.io.Converters.getDefaultEncodingName(Converters.java:66)
> > > at java.lang.StringCoding.encode(StringCoding.java:376)
> > > at java.lang.String.getBytes(String.java:608)
> > > at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
> > > at
java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:125)
> > > at java.io.File.exists(File.java:679)
> > > at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:886)
> > > at sun.misc.URLClassPath.getResource(URLClassPath.java:156)
> > > at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
> > > at java.security.AccessController.doPrivileged(Native Method)
> > > at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
> > > at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
> > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
> > > at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
> > > at java.security.Security.doGetImpl(Security.java:1122)
> > > at java.security.Security.doGetImpl(Security.java:1083)
> > > at java.security.Security.getImpl(Security.java:1044)
> > > at ...
> >
> >
>
>
Re: What is this?
Author: Ernesto Basc�n
Date: Tue, 20 Jul 2004 15:32
Date: Tue, 20 Jul 2004 15:32
106 lines
4565 bytes
4565 bytes
Yeap, you're right, but adding a flag is a very ugly patch, because you add
an unuseful attribute to your class.
"Kevin Dean" <NkOdSePaAnM@datadevelopment.com> wrote in message
news:40fd28e5$1@newsgroups.borland.com...
> There are two ways to prevent recursive event triggering:
>
> 1) Don't write code that triggers the event you're currently handling (not
> always possible).
> 2) Add a boolean flag that is turned on when you enter the event handler
and
> turned off when you exit. The event handler code would look something
like
> this:
>
> if (!handlingEvent) {
> handlingEvent = true;
> try {
> doSomethingToTriggerEvent();
> }
> finally {
> handlingEvent = false;
> }
> }
>
> --
> Check out our latest white papers at
> http://www.datadevelopment.com/papers/index.html
>
> BladeNET Scores With Borland Enterprise Tools
> Team Development with JBuilder and Borland Enterprise Server
>
> Dolphin Data Development Ltd.
> http://www.datadevelopment.com/
>
> "Ernesto Basc�n" <ebascon@hotmail.com> wrote in message
> news:40fc4c4c@newsgroups.borland.com...
> > I got that error everytime I call recursively a method without give the
> > right control to it.
> >
> > Same exception is raised when an event listener is called and the event
> > listener trigges another event that raises the same event again. Doing
an
> > infinite loop method calling.
> >
> > Best regards
> >
> >
> > Ernesto
> >
> >
> > "Kevin Dean" <NkOdSePaAnM@datadevelopment.com> wrote in message
> > news:40a0ca1b$1@newsgroups.borland.com...
> > > First of all, we need more of the stack trace than that. Paste it all
> if
> > > possible. Second of all, when did this occur? Under what
> circumstances?
> > > Can you replicate it?
> > >
> > > Thanks.
> > >
> > > --
> > > Check out our latest white papers at
> > > http://www.datadevelopment.com/papers/index.html
> > >
> > > BladeNET Scores With Borland Enterprise Tools
> > > Team Development with JBuilder and Borland Enterprise Server
> > >
> > > Dolphin Data Development Ltd.
> > > http://www.datadevelopment.com/
> > >
> > > "@(none)" <""milan\"@(none)"> wrote in message
> > > news:40a0c784$1@newsgroups.borland.com...
> > > >
> > > > Exception in thread "main" java.lang.StackOverflowError
> > > > at java.security.AccessController.doPrivileged(Native Method)
> > > > at sun.io.Converters.getDefaultEncodingName(Converters.java:66)
> > > > at java.lang.StringCoding.encode(StringCoding.java:376)
> > > > at java.lang.String.getBytes(String.java:608)
> > > > at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
> > > > at
> java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:125)
> > > > at java.io.File.exists(File.java:679)
> > > > at
sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:886)
> > > > at sun.misc.URLClassPath.getResource(URLClassPath.java:156)
> > > > at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
> > > > at java.security.AccessController.doPrivileged(Native Method)
> > > > at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
> > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
> > > > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
> > > > at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
> > > > at java.security.Security.doGetImpl(Security.java:1122)
> > > > at java.security.Security.doGetImpl(Security.java:1083)
> > > > at java.security.Security.getImpl(Security.java:1044)
> > > > at ...
> > >
> > >
> >
> >
>
>
Re: What is this?
Author: John McGrath [TeamB]
Date: Wed, 21 Jul 2004 04:36
Date: Wed, 21 Jul 2004 04:36
20 lines
1633 bytes
1633 bytes
On 7/20/2004 at 11:32:52 AM, Ernesto Basc�n wrote:
> Yeap, you're right, but adding a flag is a very ugly patch, because you
> add an unuseful attribute to your class.
True, but it is not as ugly as a stack overflow. :o)
What are the events that you are dealing with and why is each one
triggering the other? I suspect that there is either a major design
problem with the system, or that the implementation of the event
handling is wrong.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: What is this?
Author: Ernesto Basc�n
Date: Wed, 21 Jul 2004 20:18
Date: Wed, 21 Jul 2004 20:18
36 lines
2342 bytes
2342 bytes
By example, I have my own "color chooser dialog"; I want the red, green, blue text fields to show their respective values when the user clicks a color selection panel, and I want the color selection panel selector to move on automatically everytime the text fields value change. When the user clicks the color selection panel, an event tries to modify the text field values and that fact raises an event trying to modify the color selection panel that raises again the event to modify the text field values and so on..... "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message news:40fdf2d8@newsgroups.borland.com... > On 7/20/2004 at 11:32:52 AM, Ernesto Basc�n wrote: > > > Yeap, you're right, but adding a flag is a very ugly patch, because you > > add an unuseful attribute to your class. > > True, but it is not as ugly as a stack overflow. :o) > > What are the events that you are dealing with and why is each one > triggering the other? I suspect that there is either a major design > problem with the system, or that the implementation of the event > handling is wrong. > > -- > Regards, > > John McGrath [TeamB] > > --------------------------------------------------- > Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: What is this?
Author: John McGrath [TeamB]
Date: Thu, 22 Jul 2004 06:41
Date: Thu, 22 Jul 2004 06:41
81 lines
5123 bytes
5123 bytes
On 7/21/2004 at 4:18:27 PM, Ernesto Basc�n wrote:
> By example, I have my own "color chooser dialog"; I want the red, green,
> blue text fields to show their respective values when the user clicks a
> color selection panel, and I want the color selection panel selector to
> move on automatically everytime the text fields value change.
>
> When the user clicks the color selection panel, an event tries to modify
> the text field values and that fact raises an event trying to modify the
> color selection panel that raises again the event to modify the text
> field values and so on.....
Got it. There are two approaches to do this sort of thing.
Common Model
------------
Swing components use a Model-View-Controller (MVC) architecture. Ignoring
the controller part, which in Swing is kind of mixed in with the view, you
have two components: The model, which holds a value, and the view, which
shows the value.
Swing UI (view) components will automatically create an appropriate model,
so it is easy to use them without worrying much about the model, but it is
always there. When you get to the more complex components, being aware of
the separate model and view becomes more and more important.
In your case, you have 4 different view components that all show the same
value (or one aspect of that value). If you write your code with a single
model component, then everything will be updated automatically and you
will will not have to listen to events and update the other components.
I do not know what your color selection panel looks like, so it is hard to
say exactly how you would implement this. My guess is that the simplest
approach would be to create a model component composed of 3
PlainDocuments. These documents would serve as the model for the text
fields. This model component would listen to the documents and update the
color value when one of them changed. When the color value actually
changed, it would fire a stateChanged() event. The color selection panel
would listen for these stateChanged() events and update itself when that
occurred.
External Listeners
------------------
The second approach is what you have tried. This is definitely not as
clean as the above approach, but it is a workable solution. And in some
cases, the common model approach cannot be used because you cannot change
the model.
The biggest trap with using external listeners is the one you have fallen
into - recursive event firing. The critical thing is that you only change
the value of one component when the value of the other component actually
changes.
If you do that, the change happens like this: Both components start out
with the same value, say 1. The user changes the value of component A to
2. Component A notifies your listener that the value of A has changed,
and the listener sets the value of component B to 2. As a result of this
change, Component B notifies your listener that its value has changed, so
that listener sets the value of component A to 2. However, its value was
already 2, so no change has occurred and the component does not fire an
event. This chokes off the recursive event firing.
Two of the possible pitfalls with this approach are temporary change
events and value rounding. The first occurs when a component ends up
changing and then immediately changing back. Since the component's state
*does* change, the recursion does not get choked off. The rounding
pitfall occurs when a text field is used to display a value and then the
value is computed from the text field's string value. In this case, the
value actually changes, even though it does not appear to be, since the
text display remains the same. So again, the recursion is not choked off.
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Re: What is this?
Author: Ernesto Basc�n
Date: Thu, 22 Jul 2004 14:35
Date: Thu, 22 Jul 2004 14:35
102 lines
5837 bytes
5837 bytes
Excellent John! :) I like your "common model" approach; the way I was processing my events is very ugly and it seems more "patch" than well done code. The last months I was working in a UI application with C#. .NET Windows Forms is a very easy to use UI library, but it does not implement MVC and the "common model" approach you suggest cannot be implemented. The lack of this design pattern makes the Windows Forms components hard to customize and to scale. Thanks a lot Ernesto "John McGrath [TeamB]" <ng-b@JPMcGrath.net> wrote in message news:40ff6193$1@newsgroups.borland.com... > On 7/21/2004 at 4:18:27 PM, Ernesto Basc�n wrote: > > > By example, I have my own "color chooser dialog"; I want the red, green, > > blue text fields to show their respective values when the user clicks a > > color selection panel, and I want the color selection panel selector to > > move on automatically everytime the text fields value change. > > > > When the user clicks the color selection panel, an event tries to modify > > the text field values and that fact raises an event trying to modify the > > color selection panel that raises again the event to modify the text > > field values and so on..... > > Got it. There are two approaches to do this sort of thing. > > Common Model > ------------ > > Swing components use a Model-View-Controller (MVC) architecture. Ignoring > the controller part, which in Swing is kind of mixed in with the view, you > have two components: The model, which holds a value, and the view, which > shows the value. > > Swing UI (view) components will automatically create an appropriate model, > so it is easy to use them without worrying much about the model, but it is > always there. When you get to the more complex components, being aware of > the separate model and view becomes more and more important. > > In your case, you have 4 different view components that all show the same > value (or one aspect of that value). If you write your code with a single > model component, then everything will be updated automatically and you > will will not have to listen to events and update the other components. > > I do not know what your color selection panel looks like, so it is hard to > say exactly how you would implement this. My guess is that the simplest > approach would be to create a model component composed of 3 > PlainDocuments. These documents would serve as the model for the text > fields. This model component would listen to the documents and update the > color value when one of them changed. When the color value actually > changed, it would fire a stateChanged() event. The color selection panel > would listen for these stateChanged() events and update itself when that > occurred. > > External Listeners > ------------------ > > The second approach is what you have tried. This is definitely not as > clean as the above approach, but it is a workable solution. And in some > cases, the common model approach cannot be used because you cannot change > the model. > > The biggest trap with using external listeners is the one you have fallen > into - recursive event firing. The critical thing is that you only change > the value of one component when the value of the other component actually > changes. > > If you do that, the change happens like this: Both components start out > with the same value, say 1. The user changes the value of component A to > 2. Component A notifies your listener that the value of A has changed, > and the listener sets the value of component B to 2. As a result of this > change, Component B notifies your listener that its value has changed, so > that listener sets the value of component A to 2. However, its value was > already 2, so no change has occurred and the component does not fire an > event. This chokes off the recursive event firing. > > Two of the possible pitfalls with this approach are temporary change > events and value rounding. The first occurs when a component ends up > changing and then immediately changing back. Since the component's state > *does* change, the recursion does not get choked off. The rounding > pitfall occurs when a text field is used to display a value and then the > value is computed from the text field's string value. In this case, the > value actually changes, even though it does not appear to be, since the > text display remains the same. So again, the recursion is not choked off. > > -- > Regards, > > John McGrath [TeamB] > > --------------------------------------------------- > Before sending me e-mail, please read: > http://www.JPMcGrath.net/newsgroups/e-mail.html
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads