Shankar Ganesh

Ranch Hand
+ Follow
since Oct 01, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Shankar Ganesh

Casting at assignment statement would generate ClassCastException if you try to cast a parent into one of its sub-class or if you try to cast 2 unrelated classes.
Always remember that the Parent class can hold it's children while the children (derived classes) cannot hold a parent.
In your code, you are trying to cast the parent object into a derivedOne and assign it to d1. Hence the ClassCastException.
Hope this helps.
- Shankar.
Umm... Came across a lot of threads on String Literals & objects...
Here's what JLS ( http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#101083 ) says -- hope it helps in clearing the confusion over the String Literals:


[I]
3.10.5 String Literals
A string literal is always of type String. A string literal always refers to the same instance of class String.
Each string literal is a reference (�4.3) to an instance (�4.3.1, �12.5) of class String (�4.3.3). String objects have a constant value. String literals-or, more generally, strings that are the values of constant expressions (�15.28)-are "interned" so as to share unique instances, using the method String.intern.
Thus, the test program consisting of the compilation unit (�7.3):

and the compilation unit:

produces the output:

This example illustrates six points:


  • 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.
  • Strings computed by constant expressions (�15.28) are computed at compile time and then treated as if they were literals.
  • Strings computed at run time are newly created and therefore distinct.
  • The result of explicitly interning a computed string is the same string as any pre-existing literal string with the same contents.
  • [/I]


- Shankar.
[This message has been edited by Shankar Ganesh (edited August 10, 2001).]
What are the differences between various JSP specifications (versions) -- How to select a particular version for a project (if we don't want to just select the latest but find out whether the other versions can fit in)...
23 years ago

Originally posted by Michael Ernest:
I got inspired, and pulled out GoF to explain this pattern is more detail. Here's a really quick and dirty example:



Thanks Michael! Hope to c u inspired more often
Thanks Bill... It is now fixed.
- Shankar.
24 years ago
I too have a similar need -- I need to add a link to a page, (normally accessible after a login) in a mail and the user should be able to access the page if he is currently logged in. Else he should first be directed to the login screen and upon successful login, should be lead to the concerned page. How can this be achieved?
24 years ago
I'm getting the below error in my JSP resulting in a short message as "500: NO DETAILED MESSAGE". Could someone please tell how this can be fixed... Thanks in advance.

[This message has been edited by Shankar Ganesh (edited February 08, 2001).]
24 years ago
Oops! At first glance, didn't realize it's just a page directive. Ignore the previous message.
Thanks for the response... Adding the bigger buffer size did fix the problem.
- Shankar.

Originally posted by Shankar Ganesh:
Should this be placed in any specific part of the JSP?


24 years ago
Should this be placed in any specific part of the JSP?
24 years ago
I have a JSP which access a big collection (it has about 250 objects, containing 2 Strings attributes each). After this collection, the JSP accesses few other collections (very small ones).
I get the below Buffer error while trying to access these small collections at the end of the page.
Can someone please suggest how to fix this?
<h1>Error: 500</h1>
<b>Internal Servlet Error:</b><br>
<pre>
javax.servlet.ServletException: Error: Attempt to clear a buffer that's already been flushed
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.java, Compiled Code)
at com.ge.appl.tsf.shells.web.TSFUrlHandler.forward(TSFUrlHandler.java, Compiled Code)
at com.ge.appl.tsf.shells.web.TSFWebPresentationManager.render(TSFWebPresentationManager.java, Compiled Code)
at com.ge.appl.tsf.shells.web.TSFDispatcher.service(TSFDispatcher.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.Context.handleRequest(Context.java, Compiled Code)
at org.enhydra.servlet.servletManager.ServletManager.service(ServletManager.java, Compiled Code)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.doARequest(HttpHandler.java, Compiled Code)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.processRequests(HttpHandler.java, Compiled Code)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.run(HttpHandler.java, Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
</pre>
<b>Root cause:</b>
<pre>
java.io.IOException: Error: Attempt to clear a buffer that's already been flushed
at org.apache.jasper.runtime.JspWriterImpl.clear(JspWriterImpl.java, Compiled Code)
at jsp.temp._0002fjsp_0002ftemp_0002fadmin_0002ejspadmin_jsp_1._jspService(_0002fjsp_0002ftemp_0002fadmin_0002ejspadmin_jsp_1.java, Compiled Code)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java, Compiled Code)
at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java, Compiled Code)
at org.apache.jasper.runtime.JspServlet.service(JspServlet.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.RequestDispatcherImpl.forward(RequestDispatcherImpl.java, Compiled Code)
at com.ge.appl.tsf.shells.web.TSFUrlHandler.forward(TSFUrlHandler.java, Compiled Code)
at com.ge.appl.tsf.shells.web.TSFWebPresentationManager.render(TSFWebPresentationManager.java, Compiled Code)
at com.ge.appl.tsf.shells.web.TSFDispatcher.service(TSFDispatcher.java, Compiled Code)
at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
at org.apache.tomcat.core.ServiceInvocationHandler.method(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleInvocation(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java, Compiled Code)
at org.apache.tomcat.core.Context.handleRequest(Context.java, Compiled Code)
at org.enhydra.servlet.servletManager.ServletManager.service(ServletManager.java, Compiled Code)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.doARequest(HttpHandler.java, Compiled Code)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.processRequests(HttpHandler.java, Compiled Code)
at org.enhydra.servlet.connectionMethods.http.HttpHandler.run(HttpHandler.java, Compiled Code)
at java.lang.Thread.run(Thread.java, Compiled Code)
</pre>
24 years ago
Got it... I too found the format by tring an example. Thanks anyway, Rajesh, for the response.
24 years ago
If multiple entries in a list box are selected, how can these selected values be accessed from the Servlet Request? Would the selection come as an array?
24 years ago
Sanjib,
I'm using Rational Rose 2000e.
I have added all these directories (Java & Common under Rational's Home directory, JDK's directories containing JARs, directory containing my code / class, etc.) but is still getting the same error.
Even if I use a simple class, for testing, with just one String attribute in it, the error message is generated (same as pasted in my original message).
Is there any other better tool to reverse engineer from java classes to class diagrams?
Thanks in advance,
Shankar.
Yes... For the specified requirement, Map or a specific method within the ArrayList is required. I think instead of writing a specific method, a Map can be used if that would provide the required functionality.
24 years ago
How to set up the class path in Rational Rose? I added the jdk jar directories to the specification classpath but sill Iam not able to reverse engineer Java code.
Error message received is: [b]15:18:28| Error Resolving qualified name String occurred in File C:\Rational\Files.java
[b]