Problem in casting a parametrized EJBObject
I'm using Command pattern to execute a "Service" classes.
The executer of the "Service" classes is an EJB,
and I need this EJB to be parametrized in properties file.
I'm using ConfigUtils to access the properties file.
The properties file:
COMMAND_CLASS=com.zninba.command.Command
COMMAND_HANDLER_JNDI_NAME=ejb/CommandHandler
COMMAND_HANDLER_HOME_CLASS=com.zninba.command.interfaces.CommandHandlerHome
COMMAND_HANDLER_INTERFACE_CLASS=com.zninba.command.interfaces.CommandHandler
This method get the EJBHome:
private EJBHome getHome() throws ServiceFactoryException {
EJBHome home = null;
try {
Context initialContext = ConfigUtils.getInstance().getInitialContext();
home = (EJBHome)PortableRemoteObject.narrow(
initialContext.lookup(
ConfigUtils.getInstance().getCommandHandlerJndiName()),
Class.forName(ConfigUtils.getInstance().getCommandHandlerHome()));
catch( NamingException ex ) {
throw new ServiceFactoryException(ex.getMessage());
catch( ConfigException ex ) {
throw new ServiceFactoryException(ex.getMessage());
catch( Exception ex ) {
throw new ServiceFactoryException(ex.getMessage());
return home;
//geting the EJBObject
EJBHome home = getHome() ;
EJBObject commandHandler=((?????)this.home).create();
the problem is that I don't know how to cast EJBObject to "CommandHandler" interface.
Hi,
normally you would create not an abstract reference to EJBHome to access the home interface but you would create something like
CommandHandlerHome home = (CommandHandlerHome)PortableRemoteObject.narrow(theBean,CommandHandlerHome.class);because then you do not have to cast when calling the create() method. But in your code I would suggest to put the home interface where the '?????' go:
EJBHome home = getHome() ;
CommandHandler commandHandler=((CommandHandlerHome)home).create();Stephan
Similar Messages
-
Problem in Casting the encoded string to XML
Hi all,
From dotnet code i have encoded the XML as string and passed this value as XML attribute value in below.
Am not sure if we can have XML as attribute value inside another XML.hence i did with below approach.
Now i have special character '<' in that please refer yellow highlighted.this was having problem in casting to XML.
Kindly assist me.
Thanks in advance.
DECLARE @XML
XML
SET @XML
= '<Utility><Actions><Action Category="ExecuteSp" SettingName="GetDMS" ComponentId="19">
<Parameters Param="SourceXML" Value="&lt;NewDataSet&gt;&lt;Table1&gt;&lt;DocumentName&gt;US OB
&amp;lt; 14 Weeks /Transvaginal&lt;/DocumentName&gt;&lt;/Table1&gt;&lt;/NewDataSet&gt;" /></Action></Actions></Utility>'
Declare @SourceDMSXML
as varchar(max)
SELECT
@SourceDMSXML = @XML.value('(/Utility/Actions/Action/Parameters[@Param = "SourceXML"]/@Value)[1]','varchar(max)')
SET @SourceDMSXML
= Replace(@SourceDMSXML
, '&lt;',
'<');
SET @SourceDMSXML
= Replace(@SourceDMSXML
, '&gt;',
'>');
SET @SourceDMSXML
= Replace(@SourceDMSXML
, '<',
'<');
SET @SourceDMSXML
= Replace(@SourceDMSXML
, '>',
'>');
DECLARE @SourceXML
XML
SET @SourceXML
= CAST(@SourceDMSXML
AS XML)
select
@SourceXMLHow are you generating this value? You need to use TYPE directive for avoiding this
see similar example here
http://visakhm.blogspot.in/2014/01/rowset-concatenation-with-special.html
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Having problem of cast with OrdDoc
hi all
i have some problem with cast of OrdDoc
it is running very well but now it creats some problem for me here is statement
doc = (OrdDoc)rset.getCustomDatum(6,OrdDoc.getFactory());
and the exception also given below
java.lang.ClassCastException: oracle.sql.CHAR
at oracle.ord.im.OrdDoc.create(OrdDoc.java:1288)
at oracle.jdbc.driver.OracleStatement.getCustomDatumValue(OracleStatement.java:5233)
at oracle.jdbc.driver.OracleResultSetImpl.getCustomDatum(OracleResultSetImpl.java:518)
at docSave.fetch(docSave.java:78)
at demo.sample._doc._jspService(_doc.java, Compiled Code)
at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java)
at oracle.jsp.app.JspApplication.dispatchRequest(JspApplication.java)
at oracle.jsp.JspServlet.doDispatch(JspServlet.java)
at oracle.jsp.JspServlet.internalService(JspServlet.java, Compiled Code)
at oracle.jsp.JspServlet.service(JspServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
at org.apache.jserv.JServConnection.processRequest(JServConnection.java:314)
at org.apache.jserv.JServConnection.run(JServConnection.java:188)
at java.lang.Thread.run(Thread.java:479)
plz read it and give me some suggestions
thanx in advanceWhat is your classpath?
-
Problem with Cast and table operator
Hi ,
Am using Table and cast opertor to fetch the data from a collection using a ref cursor as follows
OPEN test_cur for
SELECT first_name, Last_name from table(cast( V_Test_collection as Test_Array));
This works but when i tried to fetch the date using following query and ref cursor then i received ORA-00604 and ORA 01003.
I used string containg the query like follows
V_SQL:= ' SELECT first_name, Last_name from table(cast( V_Test_collection as Test_Array))';
OPEN test_cur for V_SQL;
I want to pass this V_SQL variable to another procedure that will use it to apply some business logic.Please help me how to resolve this problem.Hi, Current procedure is as follows but as per new requirement i have to pass the processed data from this procedure to a common procedure that accepts the string containing the query(Say IN_QUERY) and applies the business logic by fetching the data from this query(IN_QUERY)
CREATE OR REPLACE PROCEDURE GET_USER_INFO_PRC(USER_ID IN NUMBER,
TEST_CUR OUT COMMOM_PKG.OUT_REF_CUR,
O_ERROR_CODE OUT NUMBER,
O_ERROR_LOCATION OUT VARCHAR2,
O_ERROR_MESSAGE OUT VARCHAR2) IS
V_TEST_COLLECTION COMMOM_PKG.WI_INS_SEARCH_ARR_OBJ := WI_INS_SEARCH_ARR_OBJ();
BEGIN
Some buniess logic is applied on V_Test_collection to fetch the date in this block
OPEN TEST_CUR FOR
SELECT FIRST_NAME, LAST_NAME
FROM TABLE(CAST(V_TEST_COLLECTION AS TEST_ARRAY));
Exception handler
END; -
Type problem - Class Cast Exception - trying to understand
hello,
i get a Class cast exception in the following code.
interface Foo {}
class Alpha implements Foo {}
class Beta extends Alpha {}
class Delta extends Beta {
public static void main( String[] args ) {
Beta x = new Beta();
Beta b = (Beta)(Alpha)x; //fine
Foo f = (Delta)x; //CCE
Object ob = new Object();
String s = new String();
ob = s; //fine, no need of case
s = (String)ob; //needs a castI was just thinking, implicitly Delta and Beta both of them IS-A Foo, and assigning x to a type foo shouldnt be a problem(while making it refer to the Delta class) so, what could cause the CCE ?
I would appreciate if someone could please help me understand this.
RgdsHi.
Assigning your "x" to a variable typed Foo is not a problem. The problem is that you are trying to cast an instance of Beta ("x") into type Delta which is not possible. Every Delta is a Beta, but not every Beta will be a Delta!
Simple as that.
Bye. -
Dear all,
I have two classes PureABox and ABoxDL. ABoxDL is an extension of PureABox .
When I tried to call the clone() of ABoxDL, I get the following error message:
OntologyManager.PureABox cannot be cast to OntologyManager.ABoxDL
What's the problem? ABoxDL is a subclass of PureABox. It should be allowed to be cast, right?
How can I fixed this? Copy the code of PureABox .clone() to ABoxDL.clone()?
Thanks!
public class PureABox {
public PureABox clone(){
PureABox pureABoxCopy = new PureABox();
pureABoxCopy.setKB(this.kb);
pureABoxCopy.aboxAssertions = SetUtils.create(this.getAssertions());
pureABoxCopy.aboxConceptAssertions = SetUtils.create(this.getAboxConceptAssertions());
pureABoxCopy.aboxRoleAssertions = SetUtils.create(this.getaboxRoleAssertions());
pureABoxCopy.individuals = SetUtils.create(this.getIndividuals());
return pureABoxCopy;
public class ABoxDL extends PureABox{
public ABoxDL clone(){
return (ABoxDL)super.clone();
......spoon_ wrote:
Peihong wrote:
PureABox pureABoxCopy = (PureABox)super.clone();This will return an exception : CloneNotSupportedExceptionyes you need to implement CloneableYes, the exception has gone away with the following code. But it does not return what I want. So I need to customize it.
public PureABox clone() throws CloneNotSupportedException{
PureABox pureABoxCopy = (PureABox) super.clone();
return pureABoxCopy;
public class ABoxDL extends PureABox{
public ABoxDL clone() throws CloneNotSupportedException{
return (ABoxDL)super.clone();
......But if I want to customize the clone() like this
public PureABox clone() throws CloneNotSupportedException{
public PureABox clone(){
PureABox pureABoxCopy = new PureABox();
pureABoxCopy.setKB(this.kb);
pureABoxCopy.aboxAssertions = SetUtils.create(this.getAssertions());
pureABoxCopy.aboxConceptAssertions = SetUtils.create(this.getAboxConceptAssertions());
pureABoxCopy.aboxRoleAssertions = SetUtils.create(this.getaboxRoleAssertions());
pureABoxCopy.individuals = SetUtils.create(this.getIndividuals());
return pureABoxCopy;
public ABoxDL clone() throws CloneNotSupportedException{
public ABoxDL clone(){
return (ABoxDL)super.clone();
......I got an exception : PureABox cannot be cast to ABoxDL.
Why? The first code has no exception, but the second one has an exception? -
Having Problems with CAST Function
Hey Guys;
I need to write an SQL statement that does a cast or some type of conversion from a number to a string.
I have tried a number of things and can't get it to work.
Here's what i currently have:
SELECT *
FROM TABLE1
WHERE COLUMN1 = CAST(12345678 AS STRING)
I've tried using CHAR and VARCHAR2 instead of string and it still doesn't work. When i use VARCHAR2 it says i'm missing a left parenthesis and when i use CHAR it says data value out of range. That doesn't make sense to me, because if i put the same value in quotes, it runs fine.
Hope someone can help me out.
thanks in advanceYou should specify the size of varchar2, to which you like to cast.
Like
SELECT *
FROM TABLE1
WHERE COLUMN1 = CAST(12345678 AS varchar2(8))Best regards
Maxim -
Problem about casting in internal tables
Hello,
TYPES:
BEGIN OF ts_matnr,
matnr TYPE matnr,
objct TYPE cuobj,
END OF ts_matnr.
tables: mara.
DATA:
myStatus(20) type c,
mySTANDARDCLASS(20) type c,
gt_matnr TYPE STANDARD TABLE OF ts_matnr WITH DEFAULT KEY,
gs_matnr LIKE LINE OF gt_matnr,
gs_mara TYPE mara.
SELECT-OPTIONS:
pr_matnr FOR gs_mara-matnr.
START-OF-SELECTION.
SELECT matnr
matnr AS objct
FROM mara
INTO CORRESPONDING FIELDS OF TABLE gt_matnr WHERE matnr IN pr_matnr.
I want to write both the normal String and the value as object into the table. But there is a error at the select saying the fields can't be converted to target field.
I don't know what the problem is. Can you see it?
Edited by: Daniel Gerne on Apr 23, 2008 2:31 PMunfortunately, I just saw that I just walked around my problem instead of solving it. The reason I want to have this MATNR is that I need to use it as Objectkey for a BAPI call:
LOOP AT gt_matnr INTO gs_matnr.
CALL FUNCTION 'BAPI_OBJCL_GETDETAIL_KEY'
EXPORTING
* CLOBJECTKEY = gt_matnr-objct "nicht Tabelle, sondern Arbeitsbereich
CLOBJECTKEY = gs_matnr-objct "hat Typ OBJCT <=> BAPI1003_KEY-OBJECT_GUID
CLASSNUM = 'FARBIGE_UNTERLAGEN'
* KEYDATE = SY-DATUM
* LANGUAGE = SY-LANGU
IMPORTING
STATUS = myStatus
STANDARDCLASS = mySTANDARDCLASS.
* TABLES
* ALLOCVALUESNUM =
* ALLOCVALUESCHAR =
* ALLOCVALUESCURR =
* RETURN =.
ENDLOOP.
But with the type from Shiva's code the debugger says that the given parameter has a wrong type.I just can't get this BAPI to work. I want to use it to get the classification information about a material. -
MIDP 2.0 Sound Problems (class cast exception?)
I am running the following sniplet of code:
try
java.io.InputStream is=getClass().getResourceAsStream("/res/sounds/shuffle.wav");
Player player = Manager.createPlayer(is,"audio/x-wav");
player.realize();
player.start();
catch( Exception e )
System.out.println( e.getMessage() );
}With some very akward results!
Givens:
- All my wav files are 11,025 & 8bit mono
Problems:
1a. If the sound file is very short, I get no audio at all.
1b. Conversly if the sound is long it plays fine
2. No matter what kind of wav im loading I get this error the *first time I load it
java.lang.ClassCastException: com.sun.media.sound.RealTimeSequencer
at com.nokia.phone.sdk.concept.mirrors.mma.media.player.MidiPlayer.doRealize(MidiPlayer.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.player.TonePlayer.doRealize(TonePlayer.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.player.BasicPlayer.realize(BasicPlayer.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.MMAManager.init(MMAManager.java)
at com.nokia.phone.sdk.concept.mirrors.mma.media.MMAManager.createPlayer(MMAManager.java)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.nokia.phone.sdk.concept.gateway.e.a(e.java)
at com.nokia.phone.sdk.concept.gateway.e.run(e.java)
at java.lang.Thread.run(Thread.java:595)The MIDI message you're getting doesn't make any sense at all since you're specifying wav input. What's happening on the actual device? Same error? What encoding are you using for the wav (linear and adpcm are probably the only ones supported)?
-
C# AUTOCOMPLETE TEXTBOX PROBLEM SPECIFIED CAST NOT VALID
Whenever i use a function for autocomplete in textbox it works in other windows, but when i use that function in mdi child window it shows following error:-
Specified cast not valid.Hi
>>but when i use that function in mdi child window
What do you mean about "mdi child window"?
Best regards
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Problem in casting a database object to Java object
hi everyone,
Iam trying to execute following example which was provided in oracle documentation. iam planning to implement this concept in my project...But, i am not able to run...iam herewith enclosing the sample code and its error...Kindly help me out
import java.sql.*;
import java.io.*;
import java.util.*;
import java.math.BigDecimal;
import oracle.sql.*;
import oracle.jdbc.*;
public class PersonObject
public static void main (String args [])
throws Exception
// Register the Oracle JDBC driver
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
// Connect to the database
// You need to put your database name after the @ sign in
// the connection URL.
// The sample retrieves an object of type "STUDENT",
// materializes the object as an object of type ADT.
// The Object is then modified and inserted back into the database.
Connection conn =
DriverManager.getConnection ("jdbc:oracle:thin:@raman.monsanto.com:1521:ramdevl","multispec", "mspec");
// It's faster when auto commit is off
conn.setAutoCommit (false);
// Create a Statement
Statement stmt = conn.createStatement ();
try
stmt.execute ("drop table people");
stmt.execute ("drop type PERSON FORCE");
stmt.execute ("drop type ADDRESS FORCE");
catch (SQLException e)
System.out.println("Error during executing a statement: "+ e);
stmt.execute ("create type ADDRESS as object (street VARCHAR (30), num NUMBER)");
stmt.execute ("create type PERSON as object (name VARCHAR (30), home ADDRESS)");
stmt.execute ("create table people (empno NUMBER, empid PERSON)");
stmt.execute ("insert into people values(101, PERSON ('Greg', ADDRESS ('Van Ness', 345)))");
stmt.execute ("insert into people values(102, PERSON ('John', ADDRESS ('Geary', 229)))");
ResultSet rs = stmt.executeQuery ("select * from people");
System.out.println("This application works till extraction of data\n");
showResultSet (rs);
rs.close();
stmt.close();
conn.close();
public static void showResultSet (ResultSet rs)
throws SQLException
while (rs.next ())
ResultSetMetaData rsmd=rs.getMetaData();
System.out.println("the no of columns: "+rsmd.getColumnCount());
for(int i=0;i<rsmd.getColumnCount();i++)
System.out.println("The column no "+(i+1)+"is of type: "+rsmd.getColumnTypeName(i+1) );
int empno = rs.getInt (1);
// retrieve the STRUCT
(This line throws the error----->) STRUCT person_struct = (STRUCT)rs.getObject (2);
Object person_attrs[] = person_struct.getAttributes();
System.out.println ("person name: " + (String) person_attrs[0]);
STRUCT address = (STRUCT) person_attrs[1];
System.out.println ("person address: ");
Object address_attrs[] = address.getAttributes();
System.out.println ("street: " + (String) address_attrs[0]);
System.out.println ("number: " +
((BigDecimal) address_attrs[1]).intValue());
System.out.println ();
The error message is as follows:
sj -make -cdb newmodeltest.cdb -g -d D:\VisualCafe\Projects\ -classpath
D:\jdk1.3\jre\lib\classes12.zip;D:\VisualCafe\Projects\;D:\VISUALCAFE\JAVA\LIB\;D:\VISUALCAFE\JAVA\LIB\SYMCLASS.ZIP;D:\VISUALCAFE\JAVA\LIB\CLASSES.ZIP;D:\VISUALCAFE\JFC\SWINGALL.JAR;D:\VISUALCAFE\swing
-1.1\SWINGALL.JAR;D:\VISUALCAFE\JAVA\LIB\RT.JAR;D:\VISUALCAFE\BIN\COMPONENTS\SFC.JAR;D:\VISUALCAFE\BIN\COMPONENTS\SYMBEANS.JAR;D:\VISUALCAFE\JAVA\LIB\icebrowserbean.jar;D:\VISUALCAFE\JAVA\LIB\jsdk.jar;
D:\VISUALCAFE\JAVA\LIB\SYMTOOLS.JAR;D:\VISUALCAFE\BIN\COMPONENTS\TEMPLATES.JAR D:\VisualCafe\Projects\PersonObject.java
Build Successful
loading PersonObject.class for debugging...
PersonObject.class successfully loaded
This application works till extraction of data
the no of columns: 2
The column no 1is of type: NUMBER
The column no 2is of type: MULTISPEC.PERSON
java.lang.IncompatibleClassChangeError: class java.util.Hashtable does not implement interface java.util.Map
at oracle.sql.StructDescriptor.getClass(StructDescriptor.java:418)
at oracle.sql.STRUCT.toJdbc(STRUCT.java:365)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4195)
at oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4123)
at oracle.jdbc.driver.OracleResultSetImpl.getObject(OracleResultSetImpl.java:401)
at PersonObject.showResultSet(PersonObject.java:106)
at PersonObject.main(PersonObject.java:54)
at symantec.tools.debug.MainThread.run(Agent.java:48)
Thanks in advance
Sudarshan.KSince that implementation has existed since 1.2 and
the original post suggested that 1.3 was being used,I
don't see that a newer version would help any.That's not a good assumption. There could have been a
bug fix.
Could be. But for the particular error (IncompatibleClassChangeError) I would consider the chance almost non-existent until all other possibilities have been exhausted. -
Problem in casting a vector object
Hi friends,
I have stored dates in a vector. The date is as a string(10-08-2001). I have tried to store the vectore object into a variable. But it is displaying StringIndexOutOf BoundsException. the gist of the code is as follow. The vector object displaying its values.
code
a.addElement(rss.getString(1));
a.elementAt(i)
it is displaying value but
(String)a.elementAt(i));
it is displaying nothing
plese tell the reason if you knowAdd
System.out.println("Value="+rss.getString(1)); before the add
element - I am not onvinced the error is wth the Vector. -
Problem getting handle of the EJBObject
I'm getting org.omg.CORBA.SystemException: "error reading serialized object" exception each time I call getHandle() method on the bean instance. I tried different beans including the helloWorld example with the same result. I'm using Oracle 8.1.5 and 8.1.6 on Solaris. Any ideas? Except that everything seems to be working just fine. I can intstantiate it and call the bean methods.
Thanks,
Andrei FilimonovI guess as awt uses windows graphical components it can be found out easily
but swing is independent of the OS.Read the first sentence of my response at #2. No software is "independent" of the OS. Lightweight components are painted in the window of the heavyweight ancestor, hence have no window of their own.
The nearest advice I can give for your requirement is to research the methods of SwingUtilities particularly convertPointFromScreen(Point p, Component c) and getDeepestComponentAt(Component parent, int x, int y).
db -
Hi, I test the follow Jguru tutorial code for getting atacchements
Multipart multipart = (Multipart)message.getContent();
for (int i=0, n=multipart.getCount(); i<n; i++) {
Part part = multipart.getBodyPart(i));
String disposition = part.getDisposition();
if ((disposition != null) &&
((disposition.equals(Part.ATTACHMENT) ||
(disposition.equals(Part.INLINE))) {
saveFile(part.getFileName(), part.getInputStream());
But i have a problem of cast in this line
Multipart mp = (Multipart)message.getContent();
the error of CastClass is:
java.lang.String cannot be cast to javax.mail.Multipart
why????? Please help me
ThanksMost likely you don't have a multipart message. See the msgshow.java
demo program that comes with JavaMail. -
Class casting, creating an image and decompiling...
Hi, I've got a couple of questions:
1)
How can I fully decompile classes, so with the implementation of the methods? Is it always possible to fully decompile a class file? When is it and when not?
2)
I aks this questions before, but I still haven't got it working, so sorry, but I ask it again :) :
I want to create my own class, for example cMyClass which extends the java.awt.Image class, which has abstract methods. How do these methods(for example getGraphics etc) have to be implemented?
3)
I can't cast a Image to cMyClass... why not?
Someone told me he did the following:
Canvas c = new Canvas()
cMyClass oImage = (cMyClass) c.createImage (100, 100);
and that this worked... I tried to do this too, and it seemed to work, but it actually didn't!!
I found out that c.createImage returns a null reference!!! That's why Java was able to cast it to my own cMyClass (not a problem to cast a null to something else), but when I created a Image (by doing a lot of unnessacary difficult stuff), and then tried to cast this Image to cMyClass it throw a ClassCastException or something like that...
How can I cast the java.awt.Image class to my class anyway?
3)
Why can't you create a image like i've done above or even like below:
Canvas c = new Canvas()
Image oImage = c.createImage (100, 100);
Why does this return a null reference?
Isn't there a better way to create an image?
4)
The getWidth and getHeight need a I thought observer...? Why is this? I just want the width and height and don't have an observer or something like that. Is there a way around this?
I tried getWidth(null) but this returns -1
Please help! :)Hi, I've got a couple of questions:
1)
How can I fully decompile classes, so with the
implementation of the methods? Is it always possible
to fully decompile a class file? When is it and when
not?You can always get a dump of the bytecode with 'javap -c'. If you don't want to figure things out yourself, try searching google for a class file decompiler, possibly a de-obfuscator.
De-compilation is completely possible if the original author wanted that, by including debugging information. Depending on the degree of such information and the amount of code obfuscation, the decompiled code may lack variable names, line numbers, field and method names, class names, and even code structure. Names and line numbers are usually not re-creatable automatically, since the information is simply lost, but you can replace them with your own strings when analyzing an unknown class file (using the correct tools). Re-creating the original code structure may work in some cases, but to me the general case looks rather close to the halt problem (i.e. not solvable).
Use a de-obfuscator, hope you've got good luck, and analyze the bytecode manually if that doesn't work.
2)
I aks this questions before, but I still haven't got
it working, so sorry, but I ask it again :) :
I want to create my own class, for example cMyClass
which extends the java.awt.Image class, which has
abstract methods. How do these methods(for example
getGraphics etc) have to be implemented?I don't really understand the problem. 'abstract' means on the language level that your subclass must provide an implementation, i.e. a method body. What that method is expected to do is explained in the javadocs for Image. But in fact you're free to do anything. You could play a sound in the getWidth() method (replace with any method name if you want). Just consider the fact that a lot of code calls getWidth in the hope of getting the width of the image, not playing a sound. So much about the language level.
On a higher level, a subclass of Image should implement a certain way to describe an image. AFAIK this means that your code must know the size of the image and know how to produce the pixels of the image. I can't tell you in general how you must do this, because it depends on your special case. This boils down to the question, why do you want to write a subclass of 'Image'? What new way of describing and image have you come up with?
3)
I can't cast a Image to cMyClass... why not?Simple, and that's certainly not an ALT. Because that specific Image is not a cMyClass. It's probably a BufferedImage or similar that was produced by AWT.
Please read the specs carefully what casting is about.
Someone told me he did the following:
Canvas c = new Canvas()
cMyClass oImage = (cMyClass) c.createImage (100,
100);
and that this worked... I tried to do this too, and it
seemed to work, but it actually didn't!!
I found out that c.createImage returns a null
reference!!! That's why Java was able to cast it to my
own cMyClass (not a problem to cast a null to
something else), but when I created a Image (by doing
a lot of unnessacary difficult stuff), and then tried
to cast this Image to cMyClass it throw a
ClassCastException or something like that...
How can I cast the java.awt.Image class to my class
anyway?You can't, and if you understood casting then you'd understand that it wouldn't make sense.
3, 4(don't know)
Maybe stupid question, but for example the BufferedImage, is this
completly written in Java?
How is the link made between the OS+hardware and the Java code? I
mean, displaying images etc. is very platform dependend not?Look for JNI (Java Native Interface). It's a way to link native (e.g. C) code with Java code.
Maybe you are looking for
-
Trying to connect Excel 2010 to Oracle
Hello, I am trying to connect Excel 2010 directly to the Oracle database at work. I was hoping to combine VBA and SQL to automate queries without having to use SQL Developer or the bespoke enterprise software to then export the data into a spreadshee
-
How do I tell which version of bootcamp is installed?
Installed Win7 using bootcamp on my early 2009 macbook pro with my leopard disk and everything worked fine except for the magic mouse. Searching the forums say to use the latest bootcamp 3.1. How do I find out which version i'm running now and how do
-
Hello All, I am facing two issues. One is sometimes when I login to Portal with admin id, it prevents me from displaying contents under the content administration. The reason being a Javascript error at the left bottom of the browser page access deni
-
How to Run Reports Demo on IAS Rel.2
I have successfully installed 9ias Release 2, infrastructure and Business Intelligence and Forms on one Solaris server. I am now trying to run the demos. Forms demo runs fine, but the Reports Demo is confusing. I am presented with a screen that says
-
Javascript error : 'xfa.sourceSet.nodes' is null or not an object.
Has anyone seen this error when rendering a form in HTML while trying to make an ODBC connection with that form? Thanks!