Ved Antani

Greenhorn
+ Follow
since Jan 05, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ved Antani


Output is:
first
second


How does this "get" method behave ? As both m1 and M2 have same values and I have not overridden hashcode(), will Object class's equals() method be called ?
I think the behaviour is like this:
1. There is no hashcode method so there is no way for the JVM to see if objects m1 and m2 contain different values
2. There is no equals method overridden so Object class's equals() is invoked and as both objects are different the code above works fine without m2 replacing m1's value.
12 years ago
In the code below, I dont see why the value of "foo" remains unchanged in the method - changeFoo().
Output of this program is : I am foo

public class q1{
public static void changeFoo(StringBuffer foo) {
foo = new StringBuffer("I am not foo");
}

public static void main(String args[])
{
StringBuffer foo = new StringBuffer("I am foo");
changeFoo(foo);
System.out.println(foo.toString());
}
}
What will be the output of the following code : and WHY ?
---------------------------------------------------------


[ Edited to include code tags - Paul Sturrock ]
[ November 08, 2006: Message edited by: Paul Sturrock ]
17 years ago
Yes Ben, I agree that its impractical to write upload handlers ourselves but
there are people like me...but I will surely check the code from
Commons Fileupload from Apache.

Thanks a lot.

-Ved
18 years ago
Hi,

There is nothing special about the container, its an ordinary servlet which first parses the request data. If the request is fine, I read the line into a buffer and finally create a blob out of it before committing to the db.

When the request size is large (mostly > 4MB), the JVM dies. The stack is too huge but the crux is : Error : java.io.IOException: Stream closed prematurely

This happens mostly when I try with files more than 4MB.

I appreciate your help...

Thanks
18 years ago
I have a strange problem. I have a File Upload servlet, whenever I try to
upload a file larger than 4MB, the JVM simply crashes.

Apache Server Service is still available but I can see that one of the
2 java.exe processes has died and I get 'INTERNAL SERVER ERROR' page.

What I can think of a workaround is not to parse the request if its larger than 4MB, but I just dont like doing that.

I wanna know if there is *ANY* restriction that kills the process ? IF so, what should I do to make my code handle larger requests...?

If I upgrade to a newer JDK will that help ?

I would appreciate any help from you guys...

Thanks.

-Ved

Browser : IE 5.0.x, IE 5.5.x, IE 6.0.x
JDK versions
-------------
Java Runtime Environment 1.3.1_01 (Sun Microsystems Inc.)
Java Virtual Machine specification Java Virtual Machine Specification - 1.0
(Sun Microsystems Inc.)
Java Virtual Machine implementation Java HotSpot(TM) Client VM - 1.3.1_01
(Sun Microsystems Inc.)
Java Runtime Environment specification Java Platform API Specification - 1.3
(Sun Microsystems Inc.)
18 years ago
Hi All,

I was wondering what is the difference between the geeky <b>"test".equals(testString)</b> and a more human <b>testString.equals("test")</b> ?

Thanks for help.

-Ved
18 years ago
Hey Gurus,

No replies from you so far...I am still stuck.

Help me

- Ved Antani
Hi Eric,

Can you please give more details on your last reply ? I dont think that WinXP SP1 has any security restrictions like SP2 flavour.

I would appreciate of you can give more details regarding your comment.

Thanks a lot.

--Ved
Hi All,

I get the 'Permission denied' error when I try to open this HTML attachment
from the mail notification. The HTML contains the following code :
---------------------------------------------------------------------------
<HTML>
<HEAD>
<TITLE>Notification</TITLE>
</HEAD>
<FRAMESET ROWS="*,160" TITLE="Details" LONGDESC="">
<FRAME NAME="top" MARGINHEIGHT=10 MARGINWIDTH=10 src="http://<domain>/DetailFrame?id=51385&key=2653382733" TITLE="Details" LONGDESC="">
<FRAME NAME="bottom" MARGINHEIGHT=10 MARGINWIDTH=10 src="http://<domain>/SubFrame?id=51385&key=2653382733" TITLE="SubDetails" LONGDESC="">
</FRAMESET>
</HTML>
---------------------------------------------------------------------------
the <domain> value is same for both the framesets.

Guide me

-Ved Antani
Hi Eric, Thanks a lot for your help.

The major code is like this

In the HTML file I have the following JS Functions
--------------------------------------------------
/* Initializes the 'allForms' arry */
function initialize(doc)
{
top.initDocument(doc);
}

function submitForm(){
top.submitRequest("aaa",
url,
action,
func,
"",
new Array(""),
"_top");

}
...
/* Later I have the following Form in the same HTML */
/* The Hidden input are null and haveing name as null too will this create any problems ? */

<form name="RESULT_FORM" method=POST>
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
<input type="hidden" name="" value="">
</form>
---------------------------------------------------------------------
The function 'initDocument()' creates the allForms array of forms and the 'submitRequest()' method submits the record. While submitting the
form, we get the error in IE5+MacOS 9
---------------------------------------------------------------------
Code of submitRequest() is something like :
---------------------------------------------------------------------
function submitRequest( url, //Url to submit to
generalData, //Some other data
formNames, //Forms to be submitted
target,
method) // request method for form.
{

//We get the form here

var result= allForms["RESULT_FORM"][0];

result.action= url;
result.target= target;
result.method= ((method=="GET" || target=="por_main") ? "GET" : "POST");
//we populate all the elements of the forms to be submitted to
//'result' object and then submit it
//Probably the point of error
result.submit();
}
---------------------------------------------------------------------
I think the problem is with the syntax of the last time 'result.submit();'
This works well in IE 5+ Win and fails saying
'RESULT_FORM.0 is not an object'


Please help.

--Ved Antani
Hi all.

I have a weired problem. I have a script that runs perfectly well on Win+IE5, but fails in MacOS9+IE5.

The following assignment is used in submitRequest() function :

var result= allForms["RESULT_FORM"][0];

This thing works fine in Win+IE5, but in MacOS9+IE 5 we get the following JS error : allForms.RESULT_FORM.0 is not an object.

I can not understand why this thing is happening.

I would appreciate if you can give some guidance.

--Ved
I get the following exception instead..
---------------------------------------
NotifyUtil::java.net.ConnectException: Connection refused: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:426)
at java.net.Socket.connect(Socket.java:376)
at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:386)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:602)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:303)
at sun.net.www.http.HttpClient.<init>(HttpClient.java:264)
at sun.net.www.http.HttpClient.New(HttpClient.java:336)
at sun.net.www.http.HttpClient.New(HttpClient.java:317)
at sun.net.www.http.HttpClient.New(HttpClient.java:312)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConne
ction.java:481)
at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection
.java:472)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLCo
nnection.java:528)
at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(N
otifyUtil.java:237)



I cant understand at all...
19 years ago
Hi,

I am using Tomcat 5. I am trying to redirect the flow of my application in case of an 404 or 500 error. My web.xml looks like :
<error-page>
<error-code>404</error-code>
<location>/pages/errorpage.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/pages/errorpage.jsp</location>
</error-page>

The page (errorpage.jsp) is in the directory <web-app>/pages/errorpage.jsp

I get the default message from tomcat on 404 error rather than my specified page.

Please guide me

19 years ago
Oh, I tried that but isWhitespace() does not recognize spaces which are multibyte( like in japanese langauge, Hiragana or Katakana characters are of 2 bytes and spaces are also of two bytes)

so it fails in telling me whether that character is a space or not...
19 years ago