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

Today's topics:

* Displaying blank JLabel Icon. - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8787f391c42b6a42
* Grep - 4 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/578f6f129d74dc98
* Error while getting Result Set Data from SQL 2000 - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5796c291f001ce28
* 'A'++ == 'B': Always True? - 5 messages, 4 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb79b41e32f311b2
* Is "String s = "abc";" equal to "String s = new String("abc");"? - 3 
messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57b8aacdcf136f3f
* JSP Beginner - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/92c9e31fd2ca8594
* Unpicking Nested Exceptions - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b21808dcd9820e17
* I managed to pass SCJP with a 95% grade - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5f54134155d6828e
* HttpUrlConnection => reading all packets - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5cae854ec3a36001
* loading a class whose bytecode comes in a byte[] - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4e991c30dd027000
* clarification about login logic in a Webapp using Struts - 1 messages, 1 
author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6107ee79d477edec
* Getting HTML links to work in a jar file - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b84879ed294a1b5
* SAX parser ignores part of XML document - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5f90c18abffc3c4
* How can I "force" an upcast? Convert subclass into superclass? - 3 messages, 
3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ad4bc9f7ae03de71
* JBoss to go closed source? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a8dda54906ca8df
* Tomcat startup problem - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb62e38707d64ca1
  
==========================================================================
TOPIC: Displaying blank JLabel Icon.
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/8787f391c42b6a42
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 5:27 am
From: "Andrei Kouznetsov" <[EMAIL PROTECTED]> 

> How do you go about displaying a blank(invisible) JLabel Icon. Basically I
> have a JLabel that represents a playing card, and when the player isin't
> playing I want to set his Icon to be clear, I need to actually set an Icon
> because I don't want the panel it's in to be resized. Any suggestions. I
> suppose I got probably just setVisible(false) then true when I need it
again
> but I would prefer another way. Thanks

what you really need is implementation of Icon with possibility to switch
paint image or not:
e.g. setImagePainted(boolean)

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities






==========================================================================
TOPIC: Grep
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/578f6f129d74dc98
==========================================================================

== 1 of 4 ==
Date:   Fri,   Nov 19 2004 5:26 am
From: "Niels Dybdahl" <[EMAIL PROTECTED]> 

> Some time ago I was used to a very great tool, called Grep. This was a
> dos-based utility to search for word(s) inside files.
> What is nowadays the best tool for this?

The best tool is still grep.
If you use Netbeans, then there is a "find" function.
JBuilder has "Find in path"

Niels Dybdahl





== 2 of 4 ==
Date:   Fri,   Nov 19 2004 6:09 am
From: Collin VanDyck <[EMAIL PROTECTED]> 

Niels Dybdahl wrote:
>>Some time ago I was used to a very great tool, called Grep. This was a
>>dos-based utility to search for word(s) inside files.
>>What is nowadays the best tool for this?
> 
> 
> The best tool is still grep.
> If you use Netbeans, then there is a "find" function.
> JBuilder has "Find in path"
> 
> Niels Dybdahl
> 
> 
Eclipse will also let you do this, searching your workspace for matches 
against either plain text or a regular expression.  In fact, I think 
most IDEs will give you this functionality.




== 3 of 4 ==
Date:   Fri,   Nov 19 2004 6:55 am
From: Tim Slattery <[EMAIL PROTECTED]> 

"Hans Bijvoet" <[EMAIL PROTECTED]> wrote:

>Some time ago I was used to a very great tool, called Grep. This was a 
>dos-based utility to search for word(s) inside files.
>What is nowadays the best tool for this?

"grep" is a Unix utility. It's been ported to many systems, and Google
will doubtlessly find many ports of it. Windows XP has "findstr" which
does nearly all of the same things. It also can recurse throught
multiple directory levels (which is handled by the command shell in
Unix systems).

--
Tim Slattery
[EMAIL PROTECTED]



== 4 of 4 ==
Date:   Fri,   Nov 19 2004 7:27 am
From: "Ann" <[EMAIL PROTECTED]> 


"Tim Slattery" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> "Hans Bijvoet" <[EMAIL PROTECTED]> wrote:
>
> >Some time ago I was used to a very great tool, called Grep. This was a
> >dos-based utility to search for word(s) inside files.
> >What is nowadays the best tool for this?
>
> "grep" is a Unix utility. It's been ported to many systems, and Google
> will doubtlessly find many ports of it. Windows XP has "findstr" which
> does nearly all of the same things. It also can recurse throught
> multiple directory levels (which is handled by the command shell in
> Unix systems).
>
> --
> Tim Slattery
> [EMAIL PROTECTED]

If you have the DOS exe file, it might run on WIN XP also. Many
DOS programs do.






==========================================================================
TOPIC: Error while getting Result Set Data from SQL 2000
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5796c291f001ce28
==========================================================================

== 1 of 2 ==
Date:   Fri,   Nov 19 2004 5:43 am
From: Sudsy <[EMAIL PROTECTED]> 

Murray wrote:
<snip>
> Microsoft's JDBC drivers are notoriously buggy, well some versions anyway. 
> Perhaps you can't call getString() twice on the same column. Your second 
> piece of code is better anyway in my opinion. It's generally best practice 
> to get values from the ResultSet only once, for performance and code 
> readability reasons.

 From the javadocs for ResultSet:

"For maximum portability, result set columns within each row should be read
  in left-to-right order, and each column should be read only once."

I believe that Murray is spot-on in this case.

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.




== 2 of 2 ==
Date:   Fri,   Nov 19 2004 6:20 am
From: "Murray" <[EMAIL PROTECTED]> 


"Sudsy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Murray wrote:
> <snip>
> > Microsoft's JDBC drivers are notoriously buggy, well some versions
anyway.
> > Perhaps you can't call getString() twice on the same column. Your second
> > piece of code is better anyway in my opinion. It's generally best
practice
> > to get values from the ResultSet only once, for performance and code
> > readability reasons.
>
>  From the javadocs for ResultSet:
>
> "For maximum portability, result set columns within each row should be
read
>   in left-to-right order, and each column should be read only once."
>
> I believe that Murray is spot-on in this case.

Aha! I thought it sounded familiar, thanks for confirming. I wasn't aware of
the issue of column order though, I'll have to keep that in mind from now
on.







==========================================================================
TOPIC: 'A'++ == 'B': Always True?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb79b41e32f311b2
==========================================================================

== 1 of 5 ==
Date:   Fri,   Nov 19 2004 5:46 am
From: "Gary Labowitz" <[EMAIL PROTECTED]> 

"Chris Smith" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Gary Labowitz <[EMAIL PROTECTED]> wrote:
> > Not true. EBCDIC does not guarantee that the alphabetic characters are
> > contiguous. I believe 'R' is not followed by 'S'. There may also be
other
> > "breaks" in the sequence.
>
> That doesn't matter.  The point is that the literal 'A' is a unicode
> code point.  Incrementing it will always give the code point for 'B'.
> The translation to EBCDIC is only performed during the output phase.
> The resulting output may not contain consecutive EBCDIC values (I don't
> know enough about EBCDIC to say whether it will or not), but it WILL be
> A followed by B -- not because A and B are consecutive in EBCDIC, but
> because A and B are consecutive in Unicode.

You are getting me confused. EBCDIC is not Unicode. Are you saying that on
an EBCDIC machine it uses Unicode for internal storage of data?
Unicode: 'A' = \u0041
EBCDIC: 'A' = 0xF0
-- 
Gary






== 2 of 5 ==
Date:   Fri,   Nov 19 2004 5:55 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Michael Borgwardt wrote:

> Doug Pardee wrote:
> 
>> If you can't generally trust the compiler to implement the Java
>> Language Specification correctly, you're doomed. And specifically, if
>> the compiler can't look at an 'A' in your source code and get it as
>> \u0041, then you'll never be able to catch an
>> ArrayIndexOutOfBoundsException thrown by the JVM.
> 
> 
> You really didn't get the point. The Java Language Specification isn't
> even relevant at this point. The source code is originally composed of
> bytes, not characters. And the compiler has to use some sort of encoding
> to convert these bytes into characters. It's not the fault of the compiler
> than it may use a wrong one.

And here again voice my dissent.  The source code is composed of 
characters.  JLS says so.  The _representation_ of the source code in 
most media consists of bytes, but that's not what we said we were 
talking about, and it's not a generally useful thing to bring up in 
discussion of language issues.  As you say, the compiler must decode the 
source code representation correctly in order to produce classes the 
properly correspond to that source, but that's not a language issue, 
it's a tools issue.  Am I splitting hairs?  Certainly!  But so is all 
the rest of this subthread.


John Bollinger
[EMAIL PROTECTED]



== 3 of 5 ==
Date:   Fri,   Nov 19 2004 7:15 am
From: Chris Smith <[EMAIL PROTECTED]> 

Gary Labowitz <[EMAIL PROTECTED]> wrote:
> You are getting me confused. EBCDIC is not Unicode. Are you saying that on
> an EBCDIC machine it uses Unicode for internal storage of data?

Yes.  That's a quite fundamental concept of Java.  Java *always* uses 
Unicode to store internal character data.  If it's running on an EBCDIC 
machine, then it translates to EBCDIC during the output process.

-- 
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



== 4 of 5 ==
Date:   Fri,   Nov 19 2004 7:17 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

Gary Labowitz wrote:
>>That doesn't matter.  The point is that the literal 'A' is a unicode
>>code point.  Incrementing it will always give the code point for 'B'.
>>The translation to EBCDIC is only performed during the output phase.
>>The resulting output may not contain consecutive EBCDIC values (I don't
>>know enough about EBCDIC to say whether it will or not), but it WILL be
>>A followed by B -- not because A and B are consecutive in EBCDIC, but
>>because A and B are consecutive in Unicode.
> 
> 
> You are getting me confused. EBCDIC is not Unicode. Are you saying that on
> an EBCDIC machine it uses Unicode for internal storage of data?

As far as Java is concerned, the only thing that distinguishes an
"BCDIC machine" from, say, an "ASCII machine" is the platform default
encoding, which is used for Char/String <--> byte[]/file conversion
in cases where the encoding is not explicitly specified.

Java chars and Strings are Unicode, or at least must behave as if they
were. A JVM implementation is free to use EBCDIC for its internal storage
of chars, but to fulfill the JLS, char must behave in every aspect as if
it were a 16 bit unicode value, which means that 'A'+1 == 'B'. Since that
means that using EBCDIC for internal storage would make the JVM
implementation complex and inefficient without (IMO) any gains to show
for it, yes, JVMs on an "EBCDIC machine" are going to use Unicode for
internal storage of data.



== 5 of 5 ==
Date:   Fri,   Nov 19 2004 7:23 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

John C. Bollinger wrote:
>> You really didn't get the point. The Java Language Specification isn't
>> even relevant at this point. The source code is originally composed of
>> bytes, not characters. And the compiler has to use some sort of encoding
>> to convert these bytes into characters. It's not the fault of the 
>> compiler
>> than it may use a wrong one.
> 
> 
> And here again voice my dissent.  The source code is composed of 
> characters.  JLS says so.  The _representation_ of the source code in 
> most media consists of bytes, but that's not what we said we were 
> talking about,  and it's not a generally useful thing to bring up in
> discussion of language issues. 

Well, IMO we were talking about whether 'A'+1 == 'B' always.
In practice, this expression is entered in some kind of text editor and
saved as a file, which is then fed to a compiler. So in practice
it may end up being false in some circumstances. But only through faulty
assumptions about or misuage of the tools, not the language.

> As you say, the compiler must decode the 
> source code representation correctly in order to produce classes the 
> properly correspond to that source, but that's not a language issue, 
> it's a tools issue.  Am I splitting hairs?  Certainly!  But so is all 
> the rest of this subthread.

Certainly.




==========================================================================
TOPIC: Is "String s = "abc";" equal to "String s = new String("abc");"?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/57b8aacdcf136f3f
==========================================================================

== 1 of 3 ==
Date:   Fri,   Nov 19 2004 5:45 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Tony Morris wrote:
> "Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> Tony Morris wrote:
 >
>>In fact, two of the same String literals that are in different scopes may
>>create have separate objects created.
>>Here's the challenge for the reader: prove this beyond doubt (it can be
>>done).
> 
> 
> Actually, I can prove beyond doubt that it's incorrect. The JLS section
> 3.10.5 says:
> 
> -----------------------
> # Literal strings within the same class (§8) in the same package (§7)
>     represent references to the same String object (§4.3.1).
> # Literal strings within different classes in the same package represent
> references
>    to the same String object.
> # Literal strings within different classes in different packages likewise
>    represent references to the same String object.
> -----------------------
> 
> 
> 
> This is (yet another) an ambiguity in the JLS.
> The challenge remains - it can be proven, without a doubt.

The ambiguity, I suppose, being a question of time.  The JLS is 
ambiguous about whether those invariants are required to hold for any 
two strings chosen at any two points during program execution, or 
whether it only applies to program state any particular time.  The 
observable behavior of Sun's recent implementations of the String intern 
pool is that otherwise unreferenced Strings are eventually discarded. 
Thus if I write

public class StringTest {
     static void printHashOne() {
         // Print identity hash for locally-scoped "abc"
         System.out.print("Identity hashcode 1: ");
         System.out.println("abc".identityHashCode());
     }
     static void printHashTwo() {
         // Print identity hash for locally-scoped "abc"
         System.out.print("Identity hashcode 2: ");
         System.out.println("abc".identityHashCode());
     }
     static void doSomethingElse() {
         /* implementation left as an exercise to the reader */
     }
     public static void main(String[] args) {
         printHashOne();
         doSomethingElse();
         printHashTwo();
     }
}

then it is possible that the two identity hashes printed by one run of 
the program will be different. (It depends on how long doSomethingElse() 
runs, how many GC cycles take place, whether or not doSomethingElse 
references an equal String literal or other equal interned String, 
etc.).  The doSomethingElse() method can be implemented in a way that 
pretty reliably exhibits the different object identities for "abc" on 
Sun's 1.3 and 1.4 VMs.


John Bollinger
[EMAIL PROTECTED]



== 2 of 3 ==
Date:   Fri,   Nov 19 2004 6:18 am
From: "Mike Schilling" <[EMAIL PROTECTED]> 


"Michael Borgwardt" <[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> Mike Schilling wrote:
>>>Not really. Both declare a reference, and while the first doesn't
>>>explicitly *create* an object at runtime, there still *is* an Object.
>>>It's part of the constant pool of the class and created when the
>>>class is loaded.
>>
>>
>> The second creates two objects, since the constant String "abc" and the 
>> results of "new String()" must be distinct.
>
> But the literal isn't created when the line is executed, it's created when
> the class is loaded.

Quibble accepted.  But the second form does create a String that the first 
does not. 





== 3 of 3 ==
Date:   Fri,   Nov 19 2004 7:35 am
From: Michael Borgwardt <[EMAIL PROTECTED]> 

John C. Bollinger wrote:
>> -----------------------
>> # Literal strings within the same class (§8) in the same package (§7)
>>     represent references to the same String object (§4.3.1).
>> # Literal strings within different classes in the same package represent
>> references
>>    to the same String object.
>> # Literal strings within different classes in different packages likewise
>>    represent references to the same String object.
>> -----------------------
>>
>>
>>
>> This is (yet another) an ambiguity in the JLS.
>> The challenge remains - it can be proven, without a doubt.
> 
> 
> The ambiguity, I suppose, being a question of time.  The JLS is 
> ambiguous about whether those invariants are required to hold for any 
> two strings chosen at any two points during program execution, or 
> whether it only applies to program state any particular time.  The 

Ah, this issue:
http://www.javaworld.com/javaworld/javaqa/2003-12/01-qa-1212-intern.html


> observable behavior of Sun's recent implementations of the String intern 
> pool is that otherwise unreferenced Strings are eventually discarded. 
> Thus if I write
> 
> public class StringTest {
>     static void printHashOne() {
>         // Print identity hash for locally-scoped "abc"
>         System.out.print("Identity hashcode 1: ");
>         System.out.println("abc".identityHashCode());
>     }
>     static void printHashTwo() {
>         // Print identity hash for locally-scoped "abc"
>         System.out.print("Identity hashcode 2: ");
>         System.out.println("abc".identityHashCode());
>     }
>     static void doSomethingElse() {
>         /* implementation left as an exercise to the reader */
>     }
>     public static void main(String[] args) {
>         printHashOne();
>         doSomethingElse();
>         printHashTwo();
>     }
> }
> 
> then it is possible that the two identity hashes printed by one run of 
> the program will be different.

Only when the class has bean unloaded inbetween and loaded again. That's
rather more than the "different scopes" that Tony said were required.








==========================================================================
TOPIC: JSP Beginner
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/92c9e31fd2ca8594
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 5:53 am
From: Sudsy <[EMAIL PROTECTED]> 

Jens Körte wrote:
> Hi!
>  
> I have read some info and also the existing code. I found out that the
> catalogID is send via the URL.
> The URL looks like following:
> .../SearchResultContextMenu.jsp?recordView=name&catalogID=22
> 
> How do I get use of the number 22 (stored in value catalogID) in a
> jsp-site...

<%
request.getParameter( "catalogID" );
%>

Assign it/use it as you wish...

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.





==========================================================================
TOPIC: Unpicking Nested Exceptions
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b21808dcd9820e17
==========================================================================

== 1 of 2 ==
Date:   Fri,   Nov 19 2004 6:08 am
From: [EMAIL PROTECTED] (Roger) 

Hi

I'm using the JavaMail API to send e-mails via an Exchange Server.
Under certain circumstances the sending of the message fails and
JavaMail throws a SendFailedException in which are nested a
MessagingException and a ConnectException. In one particular instance
of the MessagingException I need to take a specific action and I need
to examine the text of the MessagingException to determine if I need
to execute my specific action.

Can someone point me to example code or a tutorial that shows how to
"unpick" the nested exceptions so I can determine if (a) a
MessagingException appears in the chain and (b) get at the text of the
MessagingException so I can determine if it's the one I'm looking for.

Regards
Roger



== 2 of 2 ==
Date:   Fri,   Nov 19 2004 6:17 am
From: Andrea Desole <[EMAIL PROTECTED]> 

 From what you are saying I assume you are using JDK 1.4 or later.
Just check out the documentation from Throwable. I think what you need 
is just:
a) the getCause method, and then use instanceof or getClass, depending 
on what you need
b) getMessage.
Still, I wouldn't rely on the message: I don't think it's guaranteed to 
stay as it is, and it's difficult to detect if it changes


Roger wrote:
> Hi
> 
> I'm using the JavaMail API to send e-mails via an Exchange Server.
> Under certain circumstances the sending of the message fails and
> JavaMail throws a SendFailedException in which are nested a
> MessagingException and a ConnectException. In one particular instance
> of the MessagingException I need to take a specific action and I need
> to examine the text of the MessagingException to determine if I need
> to execute my specific action.
> 
> Can someone point me to example code or a tutorial that shows how to
> "unpick" the nested exceptions so I can determine if (a) a
> MessagingException appears in the chain and (b) get at the text of the
> MessagingException so I can determine if it's the one I'm looking for.
> 
> Regards
> Roger




==========================================================================
TOPIC: I managed to pass SCJP with a 95% grade
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5f54134155d6828e
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 6:17 am
From: [EMAIL PROTECTED] (Razvan) 

Hi !




        I want to say 2 words to all the people in the group that have
answered my Java-related questions:

"Thank you !"

        On my web page I wrote some articles that might help with the
preparation for the exam:

http://www.mihaiu.name/2004/sun_java_scjp_310_035/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test1/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test2/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test3/index.html
http://www.mihaiu.name/2004/sun_java_scjp_310_035_test4/index.html


        When you have time please take a look. If you spot any mistakes or
incomplete explanations drop me a line so that I can improve the
content.




Regards,
Razvan




==========================================================================
TOPIC: HttpUrlConnection => reading all packets
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5cae854ec3a36001
==========================================================================

== 1 of 2 ==
Date:   Fri,   Nov 19 2004 6:23 am
From: [EMAIL PROTECTED] (Terrie) 

Dear all,

in my project I have to contact a server and read a big amount of byte
data. I am using HTTPUrlConnection and have to use POST. All works
fine but when the amount of data is bigger then one packet size (appr.
1450 Byte) then the rest of the data is omitted. Does anybody know how
to read ALL packets that are send vie HTTP Post??

Any ideas?

Thx,

Sabine



== 2 of 2 ==
Date:   Fri,   Nov 19 2004 6:28 am
From: "Murray" <[EMAIL PROTECTED]> 


"Terrie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Dear all,
>
> in my project I have to contact a server and read a big amount of byte
> data. I am using HTTPUrlConnection and have to use POST. All works
> fine but when the amount of data is bigger then one packet size (appr.
> 1450 Byte) then the rest of the data is omitted. Does anybody know how
> to read ALL packets that are send vie HTTP Post??
>
> Any ideas?
>
> Thx,
>
> Sabine

Why don't you post what you've done, then we can suggest what might be wrong
...






==========================================================================
TOPIC: loading a class whose bytecode comes in a byte[]
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4e991c30dd027000
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 6:24 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Luca Rosellini wrote:
>       public void readExternal(java.io.ObjectInput objectInput) 
>               throws java.io.IOException, java.lang.ClassNotFoundException {  
>               
>               ...
>               String className = (String)objectInput.readObject();            
>               evFilter = (byte[])objectInput.readObject();
> 
>               try {
>                       FilterClassLoader fcl = new FilterClassLoader( 
> this.getClass().getClassLoader(), evFilter);
>                       Class loadedFilter = fcl.loadClass( className );
> 
>                       /* the exception is raised here when trying to 
> deserialize the instance
>                        * of the class that should be already loaded
>                        */
> line83:                       filterInstance = 
> (Filter)objectInput.readObject();
>               }
>       }
>       
> }
> 
> This is the inherited ClassLoader:
> 
> //FilterClassLoader.java
> package filters;
> public class FilterClassLoader extends ClassLoader {
>     private byte[] classData;
>    
>     public FilterClassLoader(ClassLoader parent, byte[] data) {        
>       super(parent);
>         classData = data;
>     }
>        
>     public Class findClass(String className) {
>         return defineClass(className, classData, 0, classData.length);
>     }        
> }

That's a better ClassLoader implementation, but you're sure going to 
have a lot of ClassLoaders hanging around if you do that.


> and here is the stacktrace:
> 
> java.lang.ClassNotFoundException: filters.TempFilter
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:187)

[...]

Which is a different exception than you reported before, and also a 
different usage mode than you described before.

The problem here is in your readExternal method.  The strategy you have 
adopted cannot work.  You successfully load the class, yes, but classes 
are scoped to the ClassLoader that loads them.  When your 
ObjectInputStream tries to tries to deserialize the Externalizable, it 
asks its own ClassLoader for the object's class.  That ClassLoader does 
not know the class (even though it has a descendant that does), and none 
of its ancestors does either, thus you get a ClassNotFoundException.

To make a scheme like this work, you would need to insert a more 
flexible custom ClassLoader somewhere much deeper in the application's 
ClassLoader tree, perhaps [for the sake of convenience] as the 
ClassLoader for everything except an "application launcher" class.  You 
would obviously not be able to use a one-off ClassLoader for such a purpose.

Alternatively, do you realize that Java already has a built-in mechanism 
for this sort of thing?  Look into Java RMI; your problem falls squarely 
within its scope.


John Bollinger
[EMAIL PROTECTED]




==========================================================================
TOPIC: clarification about login logic in a Webapp using Struts
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6107ee79d477edec
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 6:36 am
From: [EMAIL PROTECTED] ([EMAIL PROTECTED]) 

Andrew Thompson <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> On 18 Nov 2004 10:05:44 -0800, Jean Lutrin wrote:
> 
> > Imagine a Web site where you have to login before
> > you access, say, the "forums".
> 
> NoooOOOOooooo!  Not *another* one.
> [ Sorry Jean, it's an in-joke about 'web forums' that has precious 
> little to do with your enquiry.  Hope you get an answer and that 
> you are not intending to use it for what I ..imagine. ;-) ]

:)

Don't worry, it made me laugh!

(btw, it's offtopic but I read many of your advices on both Java and
Javascript, including the notes about Javascript "worst" practices, keep
on the good work!     Yup, sadly (I would say), as I am sometimes
developing Webapp I need to use some Javascript, when possible, to
enhance the "end user experience" :(    )

And don't worry either, I won't use it to do "web forums" or whatever.

It's just that I need to know the correct vocabulary to discuss the 
method/techniques I use with other programmers !

See you soon here or on the Javascript newsgroups (or on
the "web forums" ;)

 Jean




==========================================================================
TOPIC: Getting HTML links to work in a jar file
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/b84879ed294a1b5
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 6:41 am
From: [EMAIL PROTECTED] (Michael J. Hudson) 

So, I had some HTML files in a jar file that my application was using
as help files.  In those HTML files, I had links to other internal
HTML files as well as links to JPGs and such.  In any case, certain
links were not working.  When I unzipped the jar, and ran my
application that way (outside of the jar) everything worked fine. 
What was going wrong?

The original HTML link looked something like this:

<a link href="my%20link.html">my link</a>

It took a little while, but I eventually figured out what was going
on.  The %20 was messing everything up.  For whatever reason, outside
of the JAR, the %20 was accurately being translated to mean a "space",
but inside the JAR it was using those characters literally, %, 2, 0.

In my case, these HTML files were created through a macro I was using
in Microsoft Word.  If I wasn't doing that, I could have probably just
directly replaced the "%20" with an actual space in those "href"
attributes.  When I experimented with this... this did work.  However,
in my case, these links were being automatically created.  So, I just
had to change the way I set things up so that all the files being
created had no spaces, e.g. I used an underline instead of a space. 
And once I did that, it worked... both inside and outside of the jar.
Woohoo!!!

Anyway... just passing this on into the ether in case someone else out
there ever has similar problems.

-Michael




==========================================================================
TOPIC: SAX parser ignores part of XML document
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e5f90c18abffc3c4
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 6:42 am
From: [EMAIL PROTECTED] (Per Magnus L?vold) 

Hi, all!
I have a XML Parsing based on oracle's SAX parser
(oracle.xml.parser.v2.SAXParser).
With some XML files, it works fine. However, a more simple XML file
will not be processed. The parser stops after processing a small part
of the document, and ignores the rest. Is there anything I can do to
make the parser "accept" this document? Changing the structure of the
XML file is not an alternative..
 
Here is an extract from my XML file:
<Products>
<Product>
<IM>Flamingo</IM>
<PDUK>19981231</PDUK>
<PRUKS>1.00</PRUKS>
<AVUK>IN</AVUK>
<DNUK>HarperCollins Distribution Services</DNUK>
</Product>
<Product>
<IM>McGraw-Hill Education</IM>
<BIC>UHD</BIC>
<RC>U</RC>
<RC>P</RC>
<RC>R</RC>
<PDUK>19871231</PDUK>
<AVUK>IN</AVUK>
<DNUK>McGraw-Hill Education - Europe</DNUK>
</Product>

The first startElement() event I get is for the "Product" element. It
seems as if the parser ignores the "Products" element. Then, after
endElement for the first "Product" element, the parser stops.

Seems as if it beleives that "Product" is the first element! Is there
anything I can do to make the parser continue to parse the rest of the
document?

Regards, PML




==========================================================================
TOPIC: How can I "force" an upcast? Convert subclass into superclass?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ad4bc9f7ae03de71
==========================================================================

== 1 of 3 ==
Date:   Fri,   Nov 19 2004 7:13 am
From: Chris Smith <[EMAIL PROTECTED]> 

Please don't top-post.

Andrea Desole <[EMAIL PROTECTED]> wrote:
> There has been a discussion already a while ago about the equal method, 
> and some people disagreed with the way I look at this issue.

I'm sure there have been any number of discussions of the equals method 
before.

> I personally think that the original method is correct, and since a 
> class B is a specialization of A it makes sense to think that it's more 
> restrictive than A. So a B class should use A's conditions and something 
> else. Otherwise there can be a class C that is also derived from A, but 
> it's different from B. Still, equals might return true.

Do you also apply this standard to the implementation of equals in 
java.lang.Object?

-- 
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation



== 2 of 3 ==
Date:   Fri,   Nov 19 2004 7:17 am
From: "John C. Bollinger" <[EMAIL PROTECTED]> 

Tony Morris wrote:

>>This is going the wrong direction.  Implementations of equals should
>>become more permissive toward the leaves of the inheritance hierarchy.
> 
> 
> Implementations of equals should generally return false if the class of the
> Object is not the same as the enclosing class - there are exceptions to this
> rule.
> This is because failure to do so, almost certainly violates the general
> contract of the equals method - specifically, symmetry.

Only when subclasses further override equals().  Chris Uppal and I may 
not completely agree about equals(), but in the recent thread about 
equals() he certainly did persuade me that equals() is fundamentally a 
very odd method, and certainly a Java wart from an OO point of view. 
Every nontrivial override of an equals() method at any point in the 
class hierarchy violates the Liskov substitution principle, for 
instance.[*]  More troubling, perhaps, a class must inherit or define 
exactly one equality policy for all contexts.  A generic equality test 
doesn't make much sense -- there is no special reason why it should even 
be possible to ask the question of whether an instance of random class A 
is equal to an instance of random class B.


[*] Demonstration of the violation of Liskov:

(a) Original formulation of the Liskov Substitution Principle: "If for 
each object o1 of type S there is an object o2 of type T such that for 
all programs P defined in terms of T, the behavior of P is unchanged 
when o1 is substituted for o2 then S is a subtype of T."

(b) Take type T as java.lang.Object

(c) Take type S as:
     public class S {
         int i;
         public S(int ii) {
             this.i = ii;
         }
         public boolean equals(Object o) {
             if (o.getClass() == this.getClass()) {
                 return (((S) o).i == this.i);
             } else {
                 return false;
             }
         }
     }

(d) Take the class of programs, P, characterized by integer 
PROGRAM_PARAMETER and the following Java source code:

public class EqualityTester {
     public boolean areObjectsEqual(Object a, Object b) {
         return a.equals(b);
     }
     public static void main(String[] args) {
         Object o2 = new Object();
         Object obj = new S(PROGRAM_PARAMETER);

         System.out.println(areObjectsEqual(o2, obj)
                            ? "Equal" : "Not Equal");
     }
}

All of those programs print "Not Equal".

(e) Choose, then, any instance, o1, of class S, and substitute it for o2 
in all the programs P.   There will be one of those programs that then 
prints "Equal" instead of "Not Equal" -- i.e. the behavior of one of the 
programs changes.  Note that this is independent of the choice of object 
o1, so long as that object's class is java.lang.Object.  If Liskov were 
obeyed then that would imply that S is not a subclass of Object, but 
that is incorrect, hence Liskov is not obeyed.

A similar demonstration could be provided for any alternative nontrivial 
override of equals() anywhere up and down the class hierarchy.  The 
demonstration could be formalized into a rigorous general proof, but I 
think that's unnecessary for this audience.



John Bollinger
[EMAIL PROTECTED]



== 3 of 3 ==
Date:   Fri,   Nov 19 2004 7:52 am
From: Andrea Desole <[EMAIL PROTECTED]> 


> 
>>I personally think that the original method is correct, and since a 
>>class B is a specialization of A it makes sense to think that it's more 
>>restrictive than A. So a B class should use A's conditions and something 
>>else. Otherwise there can be a class C that is also derived from A, but 
>>it's different from B. Still, equals might return true.
> 
> 
> Do you also apply this standard to the implementation of equals in 
> java.lang.Object?

no, you are right, this is a good point.
But, given one base class B and two derived classes D1 and D2, wouldn't 
you say that generally D1.equals(D2) if:
- their B part is equal
- some extra conditions, related to their D part, is true.




==========================================================================
TOPIC: JBoss to go closed source?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/4a8dda54906ca8df
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 7:48 am
From: [EMAIL PROTECTED] (James) 

This has absolutely nothing to do with intelligence. It does have to
do with stealing the intellectual property of those who have
contributed their own time that do not work for JBoss Group and having
it stolen if they go out of business. VCs are not stupid. The
developers who contribute to open source projects such as JBoss may
be...

Tim Tyler <[EMAIL PROTECTED]>  wrote in message news:<[EMAIL PROTECTED]>...
> In comp.lang.java.advocacy James <[EMAIL PROTECTED]> wrote or quoted:
> 
> > The question that has never been answered anywhere is do the venture
> > capitalists that contributed $10 million dollars believe they own the
> > intellectual property behind JBoss?
> 
> You mean: are they stupid?
> 
> People tend not to have $10 million dollars to throw around if they
> lack intelligence.




==========================================================================
TOPIC: Tomcat startup problem
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/bb62e38707d64ca1
==========================================================================

== 1 of 1 ==
Date:   Fri,   Nov 19 2004 7:47 am
From: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> 

You probably verified this, but does Tomcat start up fine without the
opennms Context tag in server.xml?

Is there a $TOMCAT_HOME/webapps/opennms directory (e.g.
/usr/local/tomcat/webapps/opennms)?

If both of those are true, have you tried making a bare-bones WEB-INF
directory for opennms (e.g. temporarily removing opennms's web.xml file
from WEB-INF, .jar files from WEB-INF/lib, etc.)?




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

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