Ashish Chopra

Ranch Hand
+ Follow
since Nov 30, 2004
Merit badge: grant badges
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 Ashish Chopra

Hi Shashidhar

The first step would be to read the bug description from Bugzilla(or whichever defect management tool you use). Once you have read the bug description, you will know exactly what is misbehaving.

Once you know the feature that is misbehaving, there are two ways you can go ahead:

1. Try to reproduce the problem using the steps in Bugzilla. A good tester will mention the steps used to generate the problem. If it is easily reproducible, then tracking the defect can be done by either using a debugger or by code inspection.

2. If it is not possible to reproduce the problem, then code inspection will be your only way out. Typically, some problems like thread synchronization issues, deadlocks etc. are not very easy to reproduce. Only a very thorough code inspection will lead you to the problem.

Of course, the one basic thing you need to know is the code flow. You must know which classes and methods are being invoked for the functionality against which the bug is reported.

Happy Debugging!!
16 years ago
I need to handle a scenario in my code where the trigger is the selection of an already selected tree node. Now I have a TreeListener attached to the tree, but it only generates an event in case I select a node different from the one already selected.

Is there any other type of listener that I can attach with my tree that will allow me to catch the re-selection of an already selected node?
16 years ago

In my opinion, it is better to create an interface, then an abstract class implementing the interface, and then the individual classes that extend the abstract class. This will give you the benifit of flexibility & extensibility in your application.

If in the future, you need to add another abstract class providing a seperate implementation set, it will be easier to implement within your eisting framework. It will also provide the added flexibility of having classes that can provide their own implementations of interface methods if they do not need to extend the abstract class.

Directly using abstract classes will also serve your purpose. You just need to evaluate how much flexibility do you need, and then decide on using either abstract classes or interfaces.

Hope this helps.
16 years ago
The best way to decide is by stress-testing or load-testing your application...

Maybe you can leave it on for a long period of time, like a week, and then check on its performance. Typically if there is a memory leak, the application will become sluggish. If its a UI based application, it might have problems in refershing.

Alternately, the application will just crash with an out of memory exception.

A good idea would be to analyze the data that you have currently, and map it to your implementation. If the number of objects present in your data is more than the number supposed to be from the application, then you have a potential leak on your hands that needs to be fixed.
17 years ago
Well, as far as I know, RSA does not involve any time based computation(, so the reasoning given that the encryption algorithm could have a time-based function to provide randomness in the generated cipher-text is incorrect.

RSA encryption is a deterministic encryption algorithm-- i.e., has no random component-- an attacker can successfully launch a chosen plaintext attack against the cryptosystem, building a dictionary by encrypting likely plaintexts under the public key, and storing the resulting ciphertexts. When matching ciphertexts are observed on a communication channel, the attacker can use this dictionary in order to learn the content of the message.

This is practical RSA implementations typically embed some form of structured, randomized padding before encrypting. This padding ensures that the message does not fall into the range of insecure plaintexts, and that a given message, once padded, will encrypt to one of a large number of different possible ciphertexts. The latter property can increase the cost of a dictionary attack beyond the capabilities of a reasonable attacker.

I hope this clears up all queries you had.
17 years ago
Thanks a lot EFh, I have a few follow up questions:

The only possible way to fork a JVM is to do a runtime.exec of the jawav process?

another question, will this call create a child JVM, or will it create an independent JVM?
17 years ago
let me answer in steps..

i have one encrypted xml file which is encrypted using public key...
now i want to add some data in that encrypted xml file..

To add any data in an encrypted file, you need to decrypt it first. Now as you are talking of encryption with a public key, you need to have the private key for decryption.
and again i want to encrypt that using another public key...

Once you have decrypted the file, edit it, add the data and then encrypt it using your public key

Hope this helps!
17 years ago
Yes, it is very much possible that the encrypted text is slightly different each time..

though the important question is, are you getting the same data back after you have decrypted the file you just encrypted by using the private key ( i am assuming that you are using public-key encryption algorithms, like RSA )?
17 years ago

Is it possible to fork a JVM from a java program, without the use of any native code (JNIs) or using rt.exec?

In case it is, please let me know how?and if it is not, then is there a reason why it cannot be done?

17 years ago
When the application is idle, it is polling the hardware entity in the background after every 600ms.

Though I verified in the profiler that this polling creates some object and char arrays, they are being cleaned up and the object count remains stable in the profiler.

Is it possible that the VM is unable to free the memory properly when the application is displayed, but it promptly frees it when the application is minimized?

Another observation is that the GC is running at a decent frequency when the application is standing(verified using the -verbosegc option)
17 years ago
Thanx Peter. My query is a little different.

Well, the memory usage that is displayed by task manager is slightly different from the heap usage, but my query is when my application is not performing any action, why does this memory go up on its own?

And also, when I do a minimize-maximize cycle, the memory indication in this field of the task manager drops down!! So is there some VM/GC option that I can configure to avoid this memory rise?
17 years ago
I have a java application that is used to monitor an external hardware entity. When I run this application and leave it idle, on the Windows Task Manager, I can see the javaw.exe process memory usage goes steadily increasing(by 4kb)

I have used a memory profiler on my application, and there are no leaks in it. Neither are there any objects that are being created but not being freed.

However, when I minimize and maximize the application, the task manager shows a reduced amount of memory usage!! Is it possible that windows is not cleaning up the memory while my application is running, even though the garbage collector is performing clean-up regularly?

I am currently using java 1.4.2_08 with Windows Xp SP2.
17 years ago
well i forgot to mention the assumption that each of the method calls is made in seperate threads....

did this just to avoid writing more sample code

now, based on this assumption, is what I said OK?
Let me rephrase EFH's reply in case of non-static synchronized methods, please let me know if I am wrong :