Win a copy of Terraform in Action this week in the Cloud forum!

Bruce Evans

+ Follow
since Nov 28, 2004
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bruce Evans

I'm trying to find out if it is possible to find out the EUID (Effective
User ID) of a webappl client, from the other side of a socket connection.

On the same system, a 'C' program is running as a socket server, waiting for
client connections.

On the same system, is a webcontainer (tomcat, SUN application server, etc).
A client (either on the same system or a remote system) uses a browser to
access a login page for a webappl served by the webcontainer.

The loginModule uses PAM to authenticate the user, and the user starts
interacting with the webappl. The backend code for the webappl creates a
socket and connects to the 'C' socket server.

Now, the socket server wants to obtain the user credentials (EUID) of the
connecting client. It does so using a couple library functions and gets
back an EUID for the client on the other end of the socket.

However, the EUID coming back is for the user that the webcontainer is
running as. For instance, 0 for 'root' or 60002 for 'noaccess'. What the
socket server really wants is the EUID for the client user who was
authenticated, Joe Bar (EUID 12345).

It there anything that can be done on the webappl side so that when the
socket connection is made, it appears to the 'C' socket server that it
is Joe Bar instead of 'root' or 'noaccess'.

I have tested this with tomcat and Sun Java webserver and do not get
the client user EUID, but instead root or noaccess.

I'm just starting to learn JSF (I have the SCWCD Cert) and am trying to get
my first webapp to run using the 'f' and 'h' tags. I'm using Tomcat 5.latest

I believe I have the .tld's and .jar's in the correct places:
jsf_core.tld & html_basic.tld in WEB-INF
All the jar's in WEB-INF/lib plus some in Tomact 'common/lib'

Thanks in advance for the help. If you feel this topic should be taken
outside of JR, you can contact me at

The request page is simple:

The error result of accessing http://localhost:8080/test/jsfgui.jsp

15 years ago
What are the best book recommendations for the
Java 1.4 SCWCD cetification 310-081 NOT 310-080.

Some of the book references I have seen here were
published in 2002 or a couple years ago, which
would not cover java 1.4.


Bruce Evans SCJP Jan 2005
I have sent an email to Bert, so hopefully he can
respond when this warrants his time.

We can't mix apples and bananas here. I am preparing
for the SCJP 1.4 cert, not 5.0

Just an FYI, 'rable' is short for runnable... Make sense now??

I have read in S&B Chap 9 page 508 that when a thread is
Dead, then calling start() on that thread will throw a
Runtime Exception (RTE).

I wanted to see this and wrote to programs, but no RTE is
thrown. The only way I get a RTE is if I call start() again
while the thread is alive.

Has anyone ran across this before where they get a RTE by calling
start() on a dead thread?



My precedence rules state that the ternary operator has
left associativity. Working through these problems, however,
produce the same results that you obtained.

The following is an example of something I have feared would be on the
SCJP exam and marked incorrect, even though an incorrect answer actually
is the correct one.

SCJP Study Guide by Kathy & Bert, Chap 8 Self Test (Inner Classes) problem 9.

The answer choices are:
A: An exception occurs at runtime
B: true
C: fred
D: Compilation fails because of an error on line 3
E: Compilation fails because of an error on line 4
F: Compilation fails because of an error on line 8
G: Compilation fails because of an error on a line other than 3,4 or 8

The answer given is G, but I believe the correct answer is F:

If you compile this code and run it, the compiler complains about line
8, expecting a ';'.

This is correct!! Just because line 7 closes out the anonymous class with
the '}', doesn't mean the ';' has to be on the same line, or even the
next line. All that needs to happen is that the ';' is the next token that
the compiler sees, even if there are a 100 blank lines after '}' and before
';'. I agree with good programming principles, that the ';' should be
after the '}' on line 7, but the compiler doesn't give a hoot about those

Thus, by choosing F instead of G, the answer would have been marked wrong
on the exam. And since you don't get to see what questions you missed,
you would not have thought that this answer was marked wrong.

Kathy & Bert, Please either prove me wrong here (Whew!) or what can
be done about this?


OK, here is the answer to the StackOverflowError example.

The anonymous classes are just a distraction.
First, you need to know the order of initialization
when a new object is created. Since there are no
static entries, we'll skip past the static rules.

Instance variables are inited before the ctor ever
executes. So, in main(), when the first Overflow obj
is created, instance vars 'Foo p' gets inited, then
'Overflow O' gets created. Whoa!! Look what happens
here... a new Overflow obj is being created, so then
for that new obj, 'Foo p' gets inited, then 'Overflow O'
gets inited, thus begins the vicious cycle until JVM says
'Your Stack is blown!'

I'll be posting a doozy of an Init example in a couple days.
This one will really take some thinking, so bone up on your
init rules in the meantime.

Here is a good one. Try and figure out why a StackOverflowError
is produced. Please give reasoning. If you figure this one out,
you've got initializtion down pretty good.

A word of advice if you're going to take the SCJP exam.

MEMORIZE the precedence rules! Just like you have to know the keywords,
all 49 of them, know these rules too.

Originally posted by Mathangi Shankar:
class EBH020 {
public static void main (String[] args) {
int a = 1 | 2 ^ 3 & 5;
int b = ((1 | 2) ^ 3) & 5;
int c = 1 | (2 ^ (3 & 5));
System.out.print(a + "," + b + "," + c);

Please explain me the output of the above code.

Start with the premise that two Objects are equal as determined
by the equals() method. Given this, the hashCode() method MUST
return the same value for each Object.

Then, from the answer options given, you can see why option 2 is correct.

Originally posted by Netty poestel:
would you be saying that 6 is not okay, since it'a also a multiple of 3 ?
and it says that their #code will be different (2 and 0) , how is this # code getting calculated ? ,
similiarly how is it being said that #code for all multiples of 3 is 0 ?
I asume I am missing something basic here.

By just looking at the code and not copying it and compiling it, the
answer is not what you have listed as correct. This is because the
visual code shows the ';' before the '}' in the array declare and init


Originally posted by Krishna Srinivasan:
SCJP - Question Of The day

Sorry for the earlier non-reply (hit submit accidentally)

native, synchronized and strictfp describe part of the
implementation of the method.

An abstract method can't say anything about its implementation.



Originally posted by Brian Nguyen:
This is something that I read from one of Study book:
Class Modifiers:
- You are free to use strictfp in combination with abstract or final...
Abstract Methods:
- Abstract methods cannot be marked as synchronized, strictfp or native...

So my question here is that why we can have a combination of abstract class and strictfp but not the combination of abstract method and strictfp?

Thanks for your answer in advance.


In the Sun Certified Programmer & Developer for Java 2 Study guide on page
316 square bullet 2 under Rules for Constructors, it states: "You can access static variables and methods, although you can used them only as part of the call to super() or this(). (Example: super(Animal.DoThings())).

I have included a sample program that seems to contradict this statement.
Can someone verify which is correct, and of course, explain why.
Thanks in advance.

****************** program *********************

(code tags added)
[ November 29, 2004: Message edited by: Barry Gaunt ]