comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* Pausing a Swing Worker Thread? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5da19ea5521b080
* struts & restarting Tomcat - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5bee53f53da7265c
* Thread for doFilter and service - is it the same ? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4d3c0ecd8f126018
* PropertyEditorManager limitation - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/125ec183df3a0ef7
* Java native interface problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fe91dc0e44d16b9a
* Tomcat and classloaders - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d1677b8e903332e
* newbie RMI User - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/af49b3bdfce876e4
* xerces and xalan - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6f2ec969c996f8b1
* writing and reading objects - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42024eb362a85850
* Java trick - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad
* How to populate a ArrayList FormBean attribute? - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b0f599eae252fb0
* Struts Tomcat 5 Taglib issue - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fac0a6b8d986f8f
* How to incremet IndetAddress / IP numbers - 6 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94897e32234ceaaf
* what u program? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410
* simpleDateFormat and April month - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/383df9c88dcb10ba
* Problem with IE and Applets. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/85712e86df721a37
  
==========================================================================
TOPIC: Pausing a Swing Worker Thread?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d5da19ea5521b080
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 1:19 pm
From: "Ann" <[EMAIL PROTECTED]> 


"xarax" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "C-man" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > Does anybody out there know how to pause/resume a Swing Worker thread. I
> > have implemented my program to be able to cancel the thread by checking
if
> > it has been interrupted() in my code. but how do I pause the thread. If
I
> > were to use wait() and notify() how to I implement that? Do I have to
add a
> > new Function to SwingWorker.java?
>
> ISTR SwingWorker is an abstract class. You must extend
> it with your own methods anyway. You'll have to decide
> what it means to pause the thread, since SwingWorker
> is supposed to finish its task and then post a Runnable
> to the AWT Event Dispatch Thread (using
> SwingUtilities.invokeLater(Runnable)) to notify completion.
>
> --
> ----------------------------
> Jeffrey D. Smith
> Farsight Systems Corporation
> 24 BURLINGTON DRIVE
> LONGMONT, CO 80501-6906
> http://www.farsight-systems.com
> z/Debug debugs your Systems/C programs running on IBM z/OS for FREE!
>
>
 You could use a flag in your run method. (I did not
try to compile this.)

loop:
if(flag)
  {
  try
    {
      Thread.sleep(500);  // half a second
      continue loop;
    }
  catch(InterruptedException e)
    {}
  }






==========================================================================
TOPIC: struts & restarting Tomcat
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5bee53f53da7265c
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 1:05 pm
From: "William Brogden" <[EMAIL PROTECTED]> 

On Sat, 18 Sep 2004 16:40:23 GMT, Mike <[EMAIL PROTECTED]> wrote:

>
>
> I'm developing a struts application and the only way I've found for a
> change in the action class to be recognized is to restart Tomcat.
>
> Is there an easier way?
>

Using the Management Application to restart the application
is pretty convenient. Documentation was installed with your
copy of Tomcat.

Bill



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/




==========================================================================
TOPIC: Thread for doFilter and service - is it the same ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4d3c0ecd8f126018
==========================================================================

== 1 of 2 ==
Date:   Sat,   Sep 18 2004 2:16 pm
From: [EMAIL PROTECTED] (Ken Carroll) 

Can anyone tell me if the doFilter method is called on the same thread
as the servlet's service method ?



== 2 of 2 ==
Date:   Sat,   Sep 18 2004 3:37 pm
From: Sudsy <[EMAIL PROTECTED]> 

Ken Carroll wrote:
> Can anyone tell me if the doFilter method is called on the same thread
> as the servlet's service method ?

I can't. But I have to ask a question in return: does it matter? I
would presume (but have no way of knowing without digging into the
source) that it wouldn't. A filter merely processes the request or
response. According to the javadocs it can choose to:
"4. a) Either invoke the next entity in the chain using the FilterChain 
object (chain.doFilter()),
4. b) or not pass on the request/response pair to the next entity in the 
filter chain to block the request processing"

There's no obligation on the part of the servlet container to run
filters in the same thread as the requested servlet. Obviously, if
a request filter opts to discontinue processing then the servlet
service method will never be invoked in the first place!
So why would you care?





==========================================================================
TOPIC: PropertyEditorManager limitation
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/125ec183df3a0ef7
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 2:35 pm
From: "Adam P. Jenkins" <[EMAIL PROTECTED]> 

The few times I've thought of using PropertyEditors, I've run into what
seems like a serious limitation of PropertyEditorManager.  I'm curious if
other people find this to be a serious limitation or not.

PropertyEditorManager allows PropertyEditors to be associated with
particular property types.  However it does not allow a PropertyEditor to be
associated with a specific property of a bean class.  That is, I can
register a PropertyEditor to be used for all properties of type
java.lang.String, but I can't register a PropertyEditor to be used for a
specific property of a specific bean class, which happens to be of type
String.

Suppose I have a Professor bean class which has a "department" property of
type java.lang.String, which must be set to one of a list of department
names.  I'd like the PropertyEditor for this property to return an array of
allowable department names from its getTags() method.  However
PropertyEditorManager gives me no way to implement this, other than changing
the PropertyEditor for all java.lang.String properties, or using a special
Department class as the property type so that I can register a
PropertyEditor for it.

I'm sure you can come up with other scenarios where you'd want to specify a
specialized customComponent or paintValue method for a specific bean
property, but not have it apply to all properties of that type in any bean.
Basically I'd like PropertyEditorManager to have these methods:

    void registerEditor(Class beanType, String propertyName, Class
editorClass);
    PropertyEditor findEditor(Class beanType, String propertyName);

To me this pretty much makes PropertyEditorManager useless for any real
application.  Maybe for a toy application or something for internal use only
I'd be willing to use the same editor type for all bean properties of type
String or int or whatever, but normally I want to be able to specify a tags
list or custom component for at least some bean properties.

Just wondering how useful others find PropertyEditorManager to be in its
present form.  Thanks for any comments.

Adam






==========================================================================
TOPIC: Java native interface problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fe91dc0e44d16b9a
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 2:36 pm
From: [EMAIL PROTECTED] (Kristian Karl) 

Hi,

Why does not the code below work...
I'm running int with j2re1.4.2_05, on a Windows 2000 box.

The output is:
Library loaded
java.lang.UnsatisfiedLinkError: MessageBoxA



public class ShowMsgBox extends Object {
  
  static {
    System.load("C:/WINNT/system32/USER32.DLL");
  }
  
  public static void main(String[] args) {
    try
    {
      ShowMsgBox msg = new ShowMsgBox();
      System.out.println( "Library loaded" );
      msg.MessageBoxA( 0,
                    "Created by the MessageBox() Win32 func",
                    "Thinking in Java", 0);
    }
    catch (UnsatisfiedLinkError e)
    {
      System.out.println( e );
    }
  }
  private native int MessageBoxA(int hwndOwner, String text,
      String title, int fuStyle);
}

/Regards Kristian




==========================================================================
TOPIC: Tomcat and classloaders
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d1677b8e903332e
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 2:48 pm
From: [EMAIL PROTECTED] (Albretch) 

I think there are a number of issues that relate to your architecture
in general, other than the 'Time zones' and 'virtual hosts'
(relatively innocuous) issues you had

 1._ Time zones in a server: I wondered what would be the technical or
cultural meaning of it in an open-to-the-Net server running 24/7
anyway. All servers should use the same time zone preferably, UGT. I
think, even internally, OSs spend time doing these translations, and
everyone should hit your server from different time zones anyway,
right?
 Not only that, but you should be glad you had a clear 'error' you
could notice right away. There are a number of relatively subtle
issues that relate to your flawed architecture, too. The next
‘natural/consequent' step to using ‘Time zones' in a server would be
using ‘day light savings' (I am not bush-it-ting you I have seen this
out there), and say you use versioning or an application that
internally/silently uses it (like Hibernate) or some kind of
'optimistic'-concurrency one.
 When these applications compare time differences they might go crazy
with their negative values they get (many of them just care about time
differences) and even throw errors and/or Exceptions that would be
hard to debug/understand without the right mindset.
 Java gets its System.currentTimeMillis and java.util.Date data right
off the OS . . . so by now you could see my point
 
 2._ Classloaders: and their relationship with the CATALINA_BASE
setting for each  'virtually' hosted server.
 Web developers should –always- (do not trust different versions of
the same app server) test the priority of the loading sequences just
by placing the same class in different directories, with different
markers (like the actual directory it is loaded from) and asking the
class what its classloader was (check out java.lang.Class) you could
have seen what your prob was ‘clear and loud'

 3._ Your code: I could see you rolling up your sleeves :-) Why would
anyone conceive/code an open-to-the-world server application wired to
a 'time zone'? Specially if java's libraries are so dirt easy to
i18n'ed and l10n'ed?

 AM




==========================================================================
TOPIC: newbie RMI User
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/af49b3bdfce876e4
==========================================================================

== 1 of 2 ==
Date:   Sat,   Sep 18 2004 3:15 pm
From: "paul.foreman" <[EMAIL PROTECTED]> 

Andrew,
                I have trimmed my repy and changed my question a little, 
based on more information.

>>>> I have just got an applet I am developing to use the RMI method to get
>>>> information from a server.
>
> Can we see you applet? What is the URL?
> If it is on a restricted intranet, can you haul
> a failing example of it out onto a public URL?
The applet is not on the internet yet - I am not yet sure how I am going to 
do this. I hope we can progress without it being directly visible.

>>>> ..for each of the
>>>> methods that needed the remote information. So there were several 
>>>> methods
>>>> which invoked the RMI method Naming.lookup. All seemed well until I 
>>>> tried
>>>> to
>>>> use the applet in a browser. When I did this I got a 'notinited' 
>>>> message
The message in the Java Console was: "Problem with RMI URL 
java.rmi.UnmarshalException: error unmarshalling return; nested exception 
is:             java.lang.ClassNotFoundException: access to class loader 
denied"
The first few lines of the stack trace were:

Dump thread stack ...
----------------------------------------------------
Full thread dump Java HotSpot(TM) Client VM (1.4.1_02-b06 mixed mode):

"Java2D Disposer" daemon prio=10 tid=0x0B34FDB8 nid=0x8d4 in Object.wait() 
[b67f000..b67fd8c]
 at java.lang.Object.wait(Native Method)
 - waiting on <10843438> (a java.lang.ref.ReferenceQueue$Lock)
 at java.lang.ref.ReferenceQueue.remove(Unknown Source)
 - locked <10843438> (a java.lang.ref.ReferenceQueue$Lock)
 at java.lang.ref.ReferenceQueue.remove(Unknown Source)
 at sun.java2d.Disposer.run(Unknown Source)
 at java.lang.Thread.run(Unknown Source)

"AWT-EventQueue-0" prio=7 tid=0x0B2F31D8 nid=0xb58 in Object.wait() 
[b97f000..b97fd8c]
 at java.lang.Object.wait(Native Method)
 - waiting on <10801A18> (a java.awt.EventQueue)
 at java.lang.Object.wait(Unknown Source)
 at java.awt.EventQueue.getNextEvent(Unknown Source)
 - locked <10801A18> (a java.awt.EventQueue)
 at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)


When I ran the applet under JBuilder4 all worked fine. When I tried to run 
the applet from a browser I now obtain the message above. It would appear 
that the client is not finding the Class files in the Server application. 
Even though this does not appear to be a problem when running under 
JBuilder.

> I have not dabbled in RMI.  Hopefully an
> RMI guru (or at least somebody more exp.
> than myself) will jump right in.
>
>> Is there any way of getting more information from my PC on why the applet 
>> is
>> failing?
>
> Well.. You know about the Java console?
> Tools | Sun Java Console
> ..if you are printing stack traces, it should
> give you the exact line number the problem occurs.
>
> Now.. did you notice how I cleverly answered your
> questions by bombarding you with many more?
> Almost makes me seem like I have a
> clue what is going on here.  ;-)
>
Andrew I do appreciate your help - answering your questions has helped me to 
understand a bit more. Especially the existence of the Java console. 





== 2 of 2 ==
Date:   Sat,   Sep 18 2004 10:01 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Sat, 18 Sep 2004 22:15:15 +0000 (UTC), paul.foreman wrote:

>>>>> RMI method Naming.lookup. All seemed well until I tried to
>>>>> use the applet in a browser. When I did this I got a 'notinited' 
>>>>> message

> The message in the Java Console was: "Problem with RMI URL 
> java.rmi.UnmarshalException: error unmarshalling return; nested exception 
> is:             java.lang.ClassNotFoundException: access to class loader 
> denied"

Is you applet signed?

An applet running in JBuilder (or applet viewer)
has greater permission to access the local file-system
than one operating in a browser.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: xerces and xalan
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6f2ec969c996f8b1
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 3:34 pm
From: "Mike Schilling" <[EMAIL PROTECTED]> 

Xerces is an XML parser.  Xalan is an implementation of XPath and XSLT. 
Xalan can work with any JAXP-compliant XML parser. 






==========================================================================
TOPIC: writing and reading objects
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/42024eb362a85850
==========================================================================

== 1 of 3 ==
Date:   Sat,   Sep 18 2004 3:47 pm
From: "Mike Schilling" <[EMAIL PROTECTED]> 


"Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
>
> In think Paul is overstating the case, but you should be aware that
> you will run into problems reading the serialized data when you
> change the definitions of the classes you've serialized.

I agree with Paul.  Object graph serialization and deserialization, is, like 
synchronization, an area where Java makes a complex problem seem much 
simpler than it is.  Successfully persisting object graphs requires a level 
of commitment to

    understand how serialization works
    design persistent classes sensibly
    accept that persisting a class imposes large constraints on how that 
class can evolve
    plan for dealing with changes to persistent class definitions

Good Lord, how many times have we seen, right here on c.l.j.p, people 
complaining that their files have gone corrupt, and by the way, they changed 
their package names, that doesn't matter, does it?

Unless you're willing to really master the subject, stay away from 
serializing objects into files.  Just create data files, the old-fashioned 
way. 





== 2 of 3 ==
Date:   Sat,   Sep 18 2004 9:55 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Sun, 19 Sep 2004 01:11:49 +0530, Madhur Ahuja wrote:
> Andrew Thompson <[EMAIL PROTECTED]> wrote:
>> On Sat, 18 Sep 2004 16:59:44 +0530, Madhur Ahuja wrote:
>>
>>> The code that am using is:
>>
>> No it is *not* the code you are using!
>>
>> The code you provided does not compile.
..
> OK, I'll post the complete code. I trimmed the code for you
> so that you may be able to easily grasp what is done in the code.

Is this a joke Madhur?  Your second code
has compilation errors as well!

Try things like..
>  public static void main(String args[])
>
>
>    serial6 sr = new serial6(1);

If you need to pursue this further, please have
a close look over this document that describes
how to make examples for others..
<http://www.physci.org/codes/sscce.jsp>

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane



== 3 of 3 ==
Date:   Sat,   Sep 18 2004 10:31 pm
From: "Madhur Ahuja" <[EMAIL PROTECTED]> 

Andrew Thompson <[EMAIL PROTECTED]> wrote:
> On Sun, 19 Sep 2004 01:11:49 +0530, Madhur Ahuja wrote:
>> Andrew Thompson <[EMAIL PROTECTED]> wrote:
>>> On Sat, 18 Sep 2004 16:59:44 +0530, Madhur Ahuja wrote:
>>>
>>>> The code that am using is:
>>>
>>> No it is *not* the code you are using!
>>>
>>> The code you provided does not compile.
> ..
>> OK, I'll post the complete code. I trimmed the code for you
>> so that you may be able to easily grasp what is done in the code.
>
> Is this a joke Madhur?  Your second code
> has compilation errors as well!

I can't believe it has. I simple copy pasted from the actual
source file. I even verified compiling it before posting.

> Try things like..
>>  public static void main(String args[])
>>
>>
>>    serial6 sr = new serial6(1);
>
> If you need to pursue this further, please have
> a close look over this document that describes
> how to make examples for others..
> <http://www.physci.org/codes/sscce.jsp>

Anyway, I have solved the problem as indicated in other posts
and I'll take care in the future.



--
Madhur Ahuja [madhur<underscore>ahuja<at>yahoo<dot>com]

Homepage & other stuff
http://madhur.netfirms.com










==========================================================================
TOPIC: Java trick
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bfd25be52dc6a3ad
==========================================================================

== 1 of 2 ==
Date:   Sat,   Sep 18 2004 4:03 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Lee Fesperman coughed up:
> Thomas G. Marshall wrote:
>>
>> Lee Fesperman coughed up:
>>> Thomas G. Marshall wrote:
>>>>
>>>> Michael Borgwardt coughed up:
>>>>> Thomas G. Marshall wrote:
>>>>>> The reason it works is that a variable to a class object of any
>>>>>> value can still yield access to a static.
>>>>>
>>>>> Actually, there is no object involved at any point. The *compiler*
>>>>
>>>> [snip]
>>>>
>>>> You're right.  What I really should have said was a "variable of
>>>> reference of any value", not object.
>>>>
>>>> Basically, given the declaration & definition:
>>>>
>>>>         {Type} {Variable Name} = {reference};
>>>>
>>>> *Regardless* of the value of {reference},
>>>>
>>>>     {reference}.{static id}
>>>>
>>>> yields the same thing as
>>>>
>>>>     {Type}.{static id}
>>>
>>> It's simply a reference, you don't need a variable at all. It is any
>>> expression producing a reference. It could be a method returning a
>>> reference or even:
>>>
>>>   ((Type) null).{static id}
>>>
>>> The static can be a field or a method.
>>
>> Your example is good, and it's one I've used before, except that your
>> explanation is missing how the thing is declared, which is why it
>> isn't about the reference.
>>
>> The variable is declared with a type somewhere, or passed in as a
>> formal parameter of some type, etc.  It is that type that determines
>> the static used, not the actual polymorphised object underneath.
>
> You completely missed my point. It is about the reference. A variable
> is not necessary. There is no 'thing' declared. Try these:
>
>   new String().valueOf("*");
>
>   "".valueOf("*");
>
>   ((String) null).valueOf("*");
>
>   String.valueOf("").valueOf("*");
>
> There are no variables involved. These all use reference expressions.
> The compiler uses the type of the reference expression to call the
> appropriate static method -- String.valueOf().

To me, when someone says "it's about the reference", they are in effect
saying that it's about the object that that references points to, since
that's what a reference does.

Given a reference to an object instance of the class Sub, you still do not
know what static method is going to be called when you see this:

        sub.staticmethod()

It would be different if the variable had been declared as

        Super sub = new Sub();

than if it were

        Sub sub = new Sub();

So the reference is the same in both cases (a sub object), but it is the
class that it is declared as (or casted to as you point out) that matters.
The reference by itself isn't enough.  The compiler looks to see which class
is used.



-- 
"So I just, uh... I just cut them up like regular chickens?"
"Sure, just cut them up like regular chickens."





== 2 of 2 ==
Date:   Sat,   Sep 18 2004 10:46 pm
From: Joona I Palaste <[EMAIL PROTECTED]> 

Thomas G. Marshall <[EMAIL PROTECTED]> scribbled the following:
> Lee Fesperman coughed up:
>> You completely missed my point. It is about the reference. A variable
>> is not necessary. There is no 'thing' declared. Try these:
>>
>>   new String().valueOf("*");
>>
>>   "".valueOf("*");
>>
>>   ((String) null).valueOf("*");
>>
>>   String.valueOf("").valueOf("*");
>>
>> There are no variables involved. These all use reference expressions.
>> The compiler uses the type of the reference expression to call the
>> appropriate static method -- String.valueOf().

> To me, when someone says "it's about the reference", they are in effect
> saying that it's about the object that that references points to, since
> that's what a reference does.

> Given a reference to an object instance of the class Sub, you still do not
> know what static method is going to be called when you see this:

>         sub.staticmethod()

> It would be different if the variable had been declared as

>         Super sub = new Sub();

> than if it were

>         Sub sub = new Sub();

> So the reference is the same in both cases (a sub object), but it is the
> class that it is declared as (or casted to as you point out) that matters.
> The reference by itself isn't enough.  The compiler looks to see which class
> is used.

Yes, that's true. But look at this:

Super sub = new Sub();
sub.staticmethod(); /* calls Super.staticmethod() */
((Sub)sub).staticmethod(); /* calls Sub.staticmethod() */

The same would work if sub==null. (I don't know if it would work if
sub were a Super object.)

Notice that the type of the variable sub is Super, yet the second
line calls Sub.staticmethod(). This shows that it is the reference
value (Sub)sub, not the variable sub, that controls which class is
used.

-- 
/-- Joona Palaste ([EMAIL PROTECTED]) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"I said 'play as you've never played before', not 'play as IF you've never
played before'!"
   - Andy Capp




==========================================================================
TOPIC: How to populate a ArrayList FormBean attribute?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6b0f599eae252fb0
==========================================================================

== 1 of 3 ==
Date:   Sat,   Sep 18 2004 5:40 pm
From: [EMAIL PROTECTED] (John Raab) 

I had a problem using ArrayLists with Struts ActionForms as well.  I
was always getting ArrayIndexOutOfBounds exceptions because unlike
regular arrays, Struts does NOT set ArrayLists to the proper size to
accept the incoming indexed form parameters.

Here's my "hack".  I can now use ArrayLists in ActionForms without a
problem.  Obviously like the poster before me said, you must set the
proper index setters and getters in your ActionForm as well.  Instead
of ArrayList use ArrayListCustom (for lack of a better name) to ensure
the list is sized properly during Strut's auto-population process.

public class ArrayListCustom extends ArrayList {

        /**
         * Overrides parent's set method to ensure that ArrayList 
         * is always large enough to store the element index being set.
         * Did this to overcome issue with Struts Action form population 
         * mechanism which works fine with regular arrays but not with
ArrayLists.
         * 
         */
        public Object set(int index, Object element){
                if(index<this.size()){
                        return super.set(index,element);
                }else{
                        //add "" elements to ArrayList until it reaches proper size
                        int num2add= index+1-this.size();
                        for(int i=0;i<num2add;i++){
                                this.add("");
                        }
                        return super.set(index,element);
                }
        }

}




Sudsy <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Eduardo wrote:
> <snip>
> > The question is: How can I populate my actionForm from an HTML form?
> > How can I access the add method?
> 
> You can't. Seriously, Struts looks for setXXX methods only. You
> should be using indexed properties. Check the javadocs for details.
> Hint: For a field named phoneNumber, you should have a method with
> the signature setPhoneNumber( int index, Object o ). You also might
> wish to read an article I've written on the subject. It can be found
> here: <http://www.sudsy.net/technology/struts-advanced.html>



== 2 of 3 ==
Date:   Sat,   Sep 18 2004 6:33 pm
From: Sudsy <[EMAIL PROTECTED]> 

John Raab wrote:
> I had a problem using ArrayLists with Struts ActionForms as well.  I
> was always getting ArrayIndexOutOfBounds exceptions because unlike
> regular arrays, Struts does NOT set ArrayLists to the proper size to
> accept the incoming indexed form parameters.
> 
> Here's my "hack".
<snip>

Then you obviously didn't read the article I cited. It demonstrates
the same technique albeit in a while loop. You try to save others
some time and trouble by documenting your experiences and where does
it get you? (sigh)




== 3 of 3 ==
Date:   Sat,   Sep 18 2004 10:22 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Sat, 18 Sep 2004 21:33:03 -0400, Sudsy wrote:

> Then you obviously didn't read the article I cited. It demonstrates
> the same technique 

I have experienced that feeling..

> ..You try to save others
> some time and trouble by documenting your experiences and where does
> it get you? (sigh)

(chuckles) My 'success rate' for today's replies 
to my URL's is running about (waggles hand) 50/50.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: Struts Tomcat 5 Taglib issue
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fac0a6b8d986f8f
==========================================================================

== 1 of 3 ==
Date:   Sat,   Sep 18 2004 6:58 pm
From: "WJ" <[EMAIL PROTECTED]> 

I just installed tomcat 5 (5.0.27) and am deploying a simple app.  The jsp's
are erroring out saying it cannot find the tag libs defined.

Here is how I am including the tags at the top of the JSP's:

<%@ taglib uri="/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/tlds/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/tlds/struts-logic.tld" prefix="logic" %>

My entries in web.xml are thus:

  <taglib>
    <taglib-uri>/tags/struts-bean</taglib-uri>
    <taglib-location>WEB-INF/tlds/struts-bean.tld</taglib-location>
  </taglib>
    .
    .
    .

When I deploy the war file to the webapps dir, Tomcat expodes the war, just
as the docs say it would.  When I re-deploy, I'm stopping the
server, removing the old war and dir structure.
 However, when I load the jsp, I get the following error:

org.apache.jasper.JasperException: /home.jsp(1,1) File
"/tlds/struts-html.tld" not found


I've looked through the example code that came with Tomcat.  While their
web.xml has references to the tlds, they seem to reference
tag files instead of the uri in their example jsps.

This code *does* work in Weblogic 8.1.  I've done some google searches and
found others who have posted similar questions about this,
but none of the posts have replies that work.

Any ideas would be appreciated.






== 2 of 3 ==
Date:   Sat,   Sep 18 2004 8:39 pm
From: Sudsy <[EMAIL PROTECTED]> 

WJ wrote:
> I just installed tomcat 5 (5.0.27) and am deploying a simple app.  The jsp's
> are erroring out saying it cannot find the tag libs defined.
> 
> Here is how I am including the tags at the top of the JSP's:
> 
> <%@ taglib uri="/tlds/struts-html.tld" prefix="html" %>
> <%@ taglib uri="/tlds/struts-bean.tld" prefix="bean" %>
<snip>

This specifies the URI as "/tlds/struts-bean.tld"

> My entries in web.xml are thus:
> 
>   <taglib>
>     <taglib-uri>/tags/struts-bean</taglib-uri>
>     <taglib-location>WEB-INF/tlds/struts-bean.tld</taglib-location>
>   </taglib>

Here you define a URI of "/tags/struts-bean".
Did you not realize that they have to match?
Change one or the other.




== 3 of 3 ==
Date:   Sat,   Sep 18 2004 8:41 pm
From: "WJ" <[EMAIL PROTECTED]> 

I've also tried this with

<taglib>
     <taglib-uri>/tags/struts-bean</taglib-uri>
     <taglib-location>/WEB-INF/tlds/struts-bean.tld</taglib-location>
   </taglib>

adding the beginning slash.  Still no luck.










==========================================================================
TOPIC: How to incremet IndetAddress / IP numbers
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/94897e32234ceaaf
==========================================================================

== 1 of 6 ==
Date:   Sat,   Sep 18 2004 9:19 pm
From: "Markus Kern" <[EMAIL PROTECTED]> 

i now got another problem, 
what's a good way to compare two instances of InetAddress.
I want to check if one InetAddress is smaller that another.

Greetings
Markus



== 2 of 6 ==
Date:   Sat,   Sep 18 2004 10:21 pm
From: "Markus Kern" <[EMAIL PROTECTED]> 

btw, i solved the incrementing problem like this :

----
 public static InetAddress incIP(InetAddress address) {
  byte[] ip = address.getAddress();
  for (int i = ip.length - 1; i >= 0; i--) {
   if (ip[i] < Byte.MAX_VALUE) {
    ip[i]++;
    if (ip[i] != 0) {
     break;
    }
   } else { // ip[i] == Byte.MAX_VALUE
    ip[i] = Byte.MIN_VALUE;
    break;
   }
  }
  InetAddress inc = null;
  try {
   inc = InetAddress.getByAddress(ip);
  } catch (UnknownHostException e) {
   //sollte nicht passieren
   e.printStackTrace();
  }
  return inc;
 }
----

anyway, i am no working on a method that can compare
two InetAddress instances. I want to check if the the first
arument is smaller then the other (for syntax check of the
port scanner).

i implemented it like this, but really don't like the code at
all, i am sure you can solve it wy better...

----
public class smallerThan1 {

 public static boolean smallerThan (InetAddress x, InetAddress y){
  int count1 = 1;
  byte[] a = x.getAddress();
  for (int i = 0; i < a.length-1; i++){
   if (a[i] != 0) {
    count1 = count1 * a[i]; // * 255 wird zu groß
   }
   else if (i > 0){
    count1 = count1 * 1; // * 255 wird zu groß
   }
  }
  count1 += a[3];

  int count2 = 1;
  byte[] b = y.getAddress();
  for (int i = 0; i < b.length-1; i++){
   if (b[i] != 0) {
    count2 = count2 * b[i]; // * 255 wird zu groß
   }
   else if (i > 0){
    count2 = count2 * 1; // * 255 wird zu groß
   }
  }
  count2 += b[3];

  if (count1 - count2 <= 0) {
   return true;
  }
  else {
   return false;
  }
 }
----

any hints appreciated ! =)

the next thing would be, check how many host there are in an
ip-range. i want to use this to implement a progress meter of the
scan.
if the user would try the range 0.0.0.0-255.255.255.255 you
will get a really big number of hosts.
Anyone got a question how to code such a progress meter sohow
else?

Thanx in advace for all you answers!
greetings
Markus

p.s.may i perhaps open a new thread for these new questions ?




== 3 of 6 ==
Date:   Sat,   Sep 18 2004 10:24 pm
From: "Markus Kern" <[EMAIL PROTECTED]> 

shit! i am sorry the code of smallerThan doesn't seem to 
work correctly =/. 
i am lacking ideas now - i hope someone helps me out.

Markus



== 4 of 6 ==
Date:   Sat,   Sep 18 2004 10:36 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Markus Kern wrote:

> i now got another problem,
> what's a good way to compare two instances of InetAddress.
> I want to check if one InetAddress is smaller that another.

Compare the integers I had you create previously. You cannot apply a
criterion such as "smaller" to an InetAddress, but you can to an integer.

-- 
Paul Lutus
http://www.arachnoid.com




== 5 of 6 ==
Date:   Sat,   Sep 18 2004 10:39 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Markus Kern wrote:

> btw, i solved the incrementing problem like this :

This is not a solution. Create integers, convert the integers to bytes as I
showed you.

/ ...

> anyway, i am no working on a method that can compare
> two InetAddress instances. I want to check if the the first
> arument is smaller then the other (for syntax check of the
> port scanner).

Use the integers I showed you. You cannot compare two InetAddresses in the
sense of "smaller".

> 
> i implemented it like this, but really don't like the code at
> all, i am sure you can solve it wy better...

I already have. Go back to the code I already posted.

-- 
Paul Lutus
http://www.arachnoid.com




== 6 of 6 ==
Date:   Sat,   Sep 18 2004 10:41 pm
From: Paul Lutus <[EMAIL PROTECTED]> 

Markus Kern wrote:

> shit! i am sorry the code of smallerThan doesn't seem to
> work correctly =/.

I already solved this problem. Use the code that has already been posted.

> i am lacking ideas now - i hope someone helps me out.

What? Use the code that has been posted already.

Perhaps you can say what is wrong with the solution that has already been
offered.

-- 
Paul Lutus
http://www.arachnoid.com





==========================================================================
TOPIC: what u program?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ee20f99e67fd5410
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 10:09 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Sat, 18 Sep 2004 20:17:15 +0200, Michael Borgwardt wrote:

> Tor Iver Wilhelmsen wrote:
>>>It has been since 1993.
>> 
>> Yes, but all these recent newbie questions to cljp are the effect of
>> the "old" September principle.
> 
> A stronger version of it, in fact, since the group's topic is directly
> related to many students' curriculum.

Yes, but c.l.j.help is better suited to their
general level of experience.  

Not that I am *assuming* that expereince with 
Java and experience with Usenet is linked, but 
there is a high correlation for those that post 
to c.l.j.programmer.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: simpleDateFormat and April month
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/383df9c88dcb10ba
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 10:13 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Sat, 18 Sep 2004 07:23:32 -0700, P.Hill wrote:

>> I think there is a logical error. Because I create an calendar object 
>> with Y M D H M S, when I rerequest these values it gives different
>> values. It allowes data without any Timezone information and responses
>> with timezone data.
> 
> Can you show THIS as code since that is NOT what you are doing in the
> previous code you posted.

I agree with Paul.  I was about to write
that yesterday, but wanted to hear something
from the other posters to the thread (I have
not used date/time stuff much).

This problem is not done yet, Nurettin, I
suggest you let the more experienced people
test your current code on their machines.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: Problem with IE and Applets.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/85712e86df721a37
==========================================================================

== 1 of 1 ==
Date:   Sat,   Sep 18 2004 10:18 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 18 Sep 2004 07:16:25 -0700, Vardan wrote:

> And second: Yes I see the
> http://www.physci.org/pc/property.jsp?prop=java.version+java.vendor
> applet. It's system information..

...and the information is????

(I put that applet up, Vardan, just so that *we* 
could know what the value is, by giving *you*
the URL and asking *you* to report back..)

And as an aside. 

How might I have asked that question so it 
was clear to you?  Or to put that another way..  
If *you* were asking *me* the same question, 
what words would you write?

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane



=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 

Reply via email to