Problem in reading an object inside another obj in C thru JNI
Hi All,
I am passing a java class object from Jave to C thru JNI.
This object has many integer fields + one object of another class, which also has some fields.
I am able to read integer fields from C but not able to read fields inside another object.
Can anyone plz help me in reading the object inside another object from C.
I m pasting class here for better understanding :
public class ImageMergeInformation {
public ImageInformation outputImageInfo;
public ImageInformation[] inputImageInfo = new ImageInformation[8];
public int topMargin;
public int bottomMargin;
I wanna read ImageInformation obj.
Plz help me...
Thanks in Advance,
Regards,
Sneha
You have to get the field id (getFieldID) of the variable you want, e.g. outputImageInfo, then get the object (getObjectField) in that field. At this point, you can start over (get the class, get the field id, get the object).
Similar Messages
-
[ORA-22905] How to read a field of an object inside another object?
Greetings,
I'm a student and in a current exercise we have to work with the Object Oriented Programming functionality of Oracle.
In the database we defined an object type, which is then considered inside another object type. The thing is, that I cannot read an attribute of the inner object. I've read tens of websites but none of them have helped so far. I've read the PL/SQL User Guide and Reference document also.
The inner object is defined as follows:
create type address_t as object (
street varchar(50),
city varchar(50),
pcode number(5,0)
);The outer object has an object of type address_t inside it:
CREATE TYPE professor_t as OBJECT(
code number(2),
p_name varchar(50),
address address_t,
);Also, there is a table named PROFESSORS that stores objects of type professor_t
First of all, with a simple testing SQL statement I can see the data inside the object professor, even the object address_t:
SELECT * FROM PROFESSORS WHERE CODE = 13;returns the following:
CODE | NAME | ADDRESS
13 | JOHN | MYSCHEMA.ADDRESS_T('FIFTH AVENUE','NEW YORK',12345)The thing is, I want to read the field street of the object address (of type address_t) inside professor (of type professor_t).
I could see everywhere that the way to go is to use point notation, and I've seen examples about the command VALUE, but none of the following SQL statements work:
SELECT VALUE(ADDRESS.STREET) FROM(
SELECT CODE,P_NAME,ADDRESS FROM PROFESSORS WHERE CODE = 13);
SELECT ADDRESS.STREET FROM PROFESSORS WHERE CODE = 13;
SELECT PROFESSOR.ADDRESS.STREET FROM PROFESSORS WHERE CODE = 13;I'd really appreciate if someone could show me how to access the values of the field of the object inside an object.
Thanks in advance,
- David
Edited by: 858176 on May 11, 2011 6:53 PM FormattingGreat, this worked so far.
It is curious that you wrote 'profesores' but that is the actual name for the variable. I translated everything to english in order to post it here.
So, the statement is:
select value(t).DIRECCION.CIUDAD from profesores t;And It returned:
VALUE(T).DIRECCION.CIUDAD
Valencia
New York
TijuanaAnd, applying the VALUE command to the statement:
select codigo,
nombre,
value(t).DIRECCION.CALLE,
value(t).DIRECCION.CIUDAD,
value(t).DIRECCION.CP
from profesores T WHERE T.CODIGO = 13;Resulting in:
CODIGO NOMBRE VALUE(T).DIRECCION.CALLE VALUE(T).DIRECCION.CIUDAD VALUE(T).DIRECCION.CP
13 Pepito Pérez Calle de los Rosales 0 Valencia 46023 That is EXACTLY what I needed.
Thanks Thomas, It was really helpful !
Edited by: 858176 on May 11, 2011 7:46 PM -
Vector Smart Object inside another smart object losing quality after scale
Hi,
I have 6 icons created on Illustrator and imported as vector smart objects.
Then, I select all 6 and create another Smart Object from then.
If I scale this smart object now, it will loose it´s quality, as if the icons were raster in the first place.
This was not what happend in in PS CS5.
It´s a bug or new "feature"?
Rodrigo C.You need to realize that Photoshop renders pixels for the embedded object then when you scale the smart object layer it scale like and raster layer through interpolation not scaled with vector graphics. Its the way smart object layers work. Hers is a very old thread on the subject
smart objects pixelized | Adobe Community -
Problem when adding java objects in a vector and passing thru web service
Hi! I'm getting this error when I try to add a java object I created into a vector and passing it through a web service: java.lang.IllegalArgumentException: No Serializer found to serialize a 'testObj' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'
This does not happen when I simply add strings or Integer objects into the vector. What am I missing?
Thanks.just chek this
http://forum.java.sun.com/thread.jspa?threadID=501189&messageID=2370914
Edited by: garava on Jul 16, 2008 1:13 PM.
It would be great if you could paste the wsdl part for that vector and just have a look for the complex typr cntent
like for HashMap we have the following mapping
<complexType name="HashMap">
<sequence>
<element name="item" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="key" type="anyType" />
<element name="value" type="anyType" />
</sequence>
</complexType>
</element>
</sequence>
</complexType>Since in Value it should again contain a mapping for the Object which you are trying to pass then only an appropriate serializer and deserilaizer would get generated. Hope this answers your query. For refernece
http://www.theserverside.com/tt/articles/article.tss?l=Systinet-web-services-part-2
[http://www.theserverside.com/tt/articles/article.tss?l=Systinet-web-services-part-2|For refernce tutorial]
Thanks,
Avadhoot Sawant.
Edited by: garava on Jul 16, 2008 1:16 PM -
Problem with reading objects through ObjectInputStream
HI
Actually i have a problem of reading the objects from ObjectInputStream and getting StreamCorruptedException when i try to read as there is no limit to find the end of file i think iam getting the exception any suggestions please to overcome this problem..Of course I can, I have included two classes.
MyMap that I shall store values in and then save to disk.
Test Map that I stores one value in MyMap and then
serialize to disk and the I do the reverse and se if my value is still there. Check out for yourself and please dont hestate to ask if you have trouble using it.
import java.util.HashMap;
import java.io.Serializable;
* This class must implement Serializable to be stored in disk
* with write(Object)
public class MyMap implements Serializable
private HashMap map = new HashMap();
public void put(Serializable key, Serializable value)
map.put(key,value);
public Object get(Object key)
return map.get(key);
// Second class
import java.io.*;
public class TestMap
public TestMap()
try
showHowToUseSerialize();
catch(Throwable ignored)
ignored.printStackTrace();
private void showHowToUseSerialize()throws Throwable
// First store anything to the class MyMap
MyMap myMap = new MyMap();
// When yuo use put on it it only accept Serializable
// se how in the class
myMap.put("key1","This is the first object in MyMap");
// Then serialize it to disk.
serialize(myMap);
// Now you try to retreive from the file and see if you
// can get the value key1 stored inside it.
Object object = deserialize();
// Cast it to the kind of object you have stored there.
MyMap mapFromDisk = (MyMap)object;
// See if key1 is really there.
String value = (String)mapFromDisk.get("key1");
// Print it out just be sure...
System.out.println("key1 stored in MyMap in disk is: "+value);
private Object deserialize()throws Throwable
File f = new File("C:\\temp\\mymap.ser");
if(!f.exists())
{ // Check that there really is such serialized file.
throw new FileNotFoundException("Didnt find the serialized file: "+f);
FileInputStream in = new FileInputStream(f);
ObjectInputStream objIn = new ObjectInputStream(in);
// Read in the object from the file.
return objIn.readObject();
private void serialize(Object myMap) throws Throwable
File f = new File("C:\\temp\\mymap.ser");
if(!f.exists())
f.createNewFile();
FileOutputStream out = new FileOutputStream(f);
ObjectOutputStream objOut = new ObjectOutputStream(out);
objOut.writeObject(myMap);
objOut.close();
public static void main(String[] args)
new TestMap();
} -
How a collection embedded inside another collection can be read???
Is there anybody can provide me with a small exemple of how I can access the element inside a collection (set) embedded inside another collection itself embedded inside another collection. Each collection is declare in their own class.
i.e. Class 1
private Set col2 = new HashSet;
Class 2
private Set col3 = new HashSet;
Class 3
private Set col4 = new HashSet;
How can I read the element belong to col4 since the col4 is accessible through col3 and col3 through col2????
Hope I am clear enough. Could someone help???
Thankshi,
If set contains set0, set1, set2 at 0 ,1 ,2 index
and u want to get the element at index 3 of set1 then u should proceed as :-
Set set = new HashSet ();
Set set0 = new HashSet ();
Set set1 = new HashSet ();
Set set2 = new HashSet ();
set0.add("hello");
set.add(set0);
set1.add("how");
set1.add("are");
set1.add("you");
set.add(set1);
set2.add("i")
set.add(set2);
Iterator iter = set.iterator() ;
iter.next();
Set outSet = (HashSet)iter.next()
And now iterate through this set to get the required element
Gaurav -
How to register one MBean inside another MBean
Hi All,
When i try to register one MBean(DynMBean1) inside another(DynMBean2) by passing object name of this MBean as attribute to the other MBean,iam getting the following error:
Following shows the adapter interface
List of MBean attributes:
Name Type Access Value
DynBean2 java.lang.ObjectName RW Type Not Supported: [ [DynBean2:bean=sample]
name java.lang.String RW
if the above code works properly,in the ''value' column there should be ''view' button and only [DynBean2:bean=sample]' should be present in the value column.Also,if we click on Can any predict what the problem is......?
Regards
Ravi
Mail Me:[email protected]I don't understand what you mean by register a bean inside another bean.
-
Service objects inside libraries (WAS: Interfaces in Forte -has anyon
The following message is actually not about interfaces, but libraries:
> From: Jeanne Hesler <[email protected]>
> To: [email protected] <[email protected]>
> Date: Thursday, July 30, 1998 11:12 AM
> Subject: RE: Interfaces in Forte - has anyone used them?
>>
> Just to clarify a few things:
>>
1) Just to be 100% correct -- it is actually Libraries that areloaded and
not Interfaces. The distinction is important because a librarycould
potentially implement many interfaces (or provide manyimplementations for a
single interface).
2) The code in a Library may reference a service object, but itmay not
define a service object. Of course any SO's referenced by thelibrary
must already be known to the loading partition. It is OK to havecode like
this in a library:
MySO.doSomething();
The documentation is a little vague on this point, but I haveconfirmed that
this is true through Tech Support and by experimentation.
Actually you CAN define and use service objects inside libraries
(compiled or interpreted) with two restrictions:
1) You can not define two service objects inside library in different
projects and call one of them from another. If you need that, both
service objects must be in the same project.
2) If service object is defined and used only by library (if it never
referenced directly by application code), than in order to be able to
partition application, you will need to create dummy method inside
application, which will reference this service object (you do not need
to execute this method - just have in the code).
WBR,
Nickolay Sakharov.
To unsubscribe, email '[email protected]' with
'unsubscribe forte-users' as the body of the message.
Searchable thread archive <URL:http://pinehurst.sageit.com/listarchive/>The way stateful Web services are currently handled is through the use of cookies ... once your stub invokes a stateful Web service a cookie is created which routes subseqent requests back to the Web service.
In your scenario, the problem is given one client has creates Web service 1 and now Web service 2 would like to be able to use that state it really isn't possible unless you engineer a solution yourself ... you would need so somehow set the cookie on your Web service 2 client to that of the original client to Web service 1. State tends to be based around an individual client versus multiple clients for that state.
There are numerous ways around this but you would be engineering around the issue ... the easiest is to write the state out somewhere so that it can be shared.
This section of the doc gives a brief overview:
http://download-west.oracle.com/docs/cd/A97688_06/generic.903/b10004/javaservices.htm
Lastly be aware there is a bug with timeouts in stateful Web services in Oracle9iAS 9.0.3 that has been fixed in 9.0.4. I can't find the thread here that documents it but when I track it down I will post the link so you can see the workaround.
Mike. -
How to get the values of the objects inside an object??
Hi,
I am trying to write code to display name and memory usage of all session attributes, in a recursive way.
I suppose reflection is needed here, but I cant figure out how to get the values of the objects inside an object...
private void handleIt(String attributeName, Object attributeValue) {
boolean isPrimitiveOrNull = ((null == attributeValue) ||
(attributeValue.getClass().isPrimitive()));
if (isPrimitiveOrNull) {
sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
} else {
sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");
Field[] fields = attributeValue.getClass().getDeclaredFields();
int lim = fields.length;
String name;
Object value = null;
for (int i = 0; i < lim; i++) {
name = fields.getName();
//LOOK AT THIS LINE: !!!!!!!!!!!!!!!!!!!!!!!!!!!
value = fields[i].get(obj); //I don´t know what 'obj' should be??
handleIt(name, value);
sb.append("}");
Any suggestions will be greatly appreciated...I realized that massive int objects called MAX_VALUE, MIN_VALUE and SIZE where causing the StackOverflow, so I removed them from the analysis.
This is the resultant code. But I think it isnt accurate in calculating the real size of objects being got using reflexion.
Do you or somebody have any more suggestions?
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.lang.reflect.Field;
import java.util.Enumeration;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class SessionMeasurer extends HttpServlet {
private static final long serialVersionUID = 1470488362727841992L;
private StringBuilder sb = new StringBuilder();
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
performTask(request, response);
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
performTask(request, response);
public void performTask(HttpServletRequest request, HttpServletResponse response) {
HttpSession session = request.getSession(false);
String attributeName = "";
Object attributeValue = null;
for (Enumeration<?> attributeNames = session.getAttributeNames(); attributeNames.hasMoreElements();) {
attributeName = (String)attributeNames.nextElement();
attributeValue = session.getAttribute(attributeName);
handleIt(attributeName, attributeValue);
System.out.println(sb.toString());
private void handleIt(String attributeName, Object attributeValue) {
if (attributeValue != null) {
boolean isPrimitive = attributeValue.getClass().isPrimitive();
if (isPrimitive) {
sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
} else {
sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");
Field[] fields = attributeValue.getClass().getDeclaredFields();
String name;
Object value = null;
int lim = fields.length;
for (int i = 0; i < lim; i++) {
name = fields.getName();
if (!name.endsWith("_VALUE") && !name.equals("SIZE") && !name.equals("serialVersionUID")) {
try {
value = fields[i].get(attributeValue);
} catch(Exception e) {
//PENDIENTE: Tratamiento excepción
handleIt(name, value);
sb.append("}");
private int sizeOf(Object obj) {
//Valid only for Serializables
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = null;
byte[] bytes = null;
try {
oos = new ObjectOutputStream(baos);
oos.writeObject(obj);
bytes = baos.toByteArray();
} catch(Exception e) {
//PENDIENTE: Tratamiento excepción
} finally {
if (oos != null) {
try {
oos.close();
} catch(Exception e) {
//PENDIENTE: Tratamiento excepción
if (baos != null) {
try {
baos.close();
} catch(Exception e) {
//PENDIENTE: Tratamiento excepción
int size = -1;
if (bytes != null) {
size = bytes.length;
return size; -
How to use one hash table inside another hash table
Hi everyone,
Any example of hash table inside another hash table.
Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
Thanks,
kanty.Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
Edited by: sabre150 on Jul 2, 2010 10:11 PM
Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain. -
Writing and Reading serialized Objects
[code=java]
/*hey guys i'm new to java and i have been given an exercise to make a cd collection, write it into a file and read the data back to the program.
the program is suppose to show you a menu to select from where you can add, delete, view sort, CD's when you add a CD it must be written to a file as an Object and when you want to view CDs or search for a CD the program must read the CD objects from the file they have been written to and must return a cd nam, artist and release date. the code looks like it is writing the Cd to a file but when i try to read (view or search for a cd from the file it gives an error null). so i think i'm note reading the right way.
thank you for helping .
import java.io.Serializable;
public class cd implements Serializable {
//creating attributes
private String cdname = null;
private double price = 0.0;
private String artist =null;
private int ratings =0;
private String genre=null;
private String releaseDate =null;
// creating an Empty constructor
public cd(){
public cd (String cdname,double price, int ratings, String genre, String artist, String releaseDate){
this.cdname=cdname;
this.price=price;
this.artist=artist;
this.ratings=ratings;
this.genre=genre;
this.releaseDate=releaseDate;
public String getGenre(){
return genre;
public void setGenre(String genre){
this.genre =genre;
public String getArtist(){
return artist;
public void setArtist(String artist){
this.artist=artist;
public String getName(){
return cdname;
public void setName(String cdname){
this.cdname = cdname;
public Double getPrice(){
return price;
public void setPrice(double price){
this.price = price;
public String getReleaseDate(){
return releaseDate;
public void setReleaseDate(String releaseDate){
this.releaseDate = releaseDate;
public int getRatings(){
return ratings;
public void setRatings( int ratings){
this.ratings = ratings;
import java.util.*;
public class hipHopCollection {
ArrayList<cd> list = new ArrayList <cd> ();
EasyIn ei = new EasyIn();
private cd invoke;
private int b;
public void load()
System.out.println(" You Entered " + b + " To Add A CD ");
invoke = new cd();
System.out.println("Please Enter A CD Name ");
invoke.setName(ei.readString());
System.out.println("Please Enter A CD Price");
invoke.setPrice(ei.readDouble());
System.out.println("Please Give Ratings For The CD");
invoke.setRatings(ei.readInt());
System.out.println("Please Enter A CD release date ");
invoke.setReleaseDate(ei.readString());
System.out.println("Please Enter artist Name ");
invoke.setArtist(ei.readString());
System.out.println("Please Enter A CD Genre ");
invoke.setGenre(ei.readString());
list.add(invoke); // trying to add cd information to invoke.
}// end of load
// The following method should return the Object variable invoke that holds the cd INFO
public Object getInvoke()
return invoke;
public int getB()
return b;
public void setB()
b=ei.readInt();
public void menu(){
System.out.println("......................................................... ");
System.out.println("Hi There Please Enter A Number For Your Choice");
System.out.println(" Pess >>");
System.out.println("1 >> Add A CD");
System.out.println("2 >> View List Of CD's");
System.out.println("3 >> Sort CD's By Price");
System.out.println("4 >> Search CD By Name");
System.out.println("5 >> Remove CD(s) By Name");
System.out.println("0 >> Exit");
System.out.println(".........................................................");
System.out.print("Please Enter Chioce >> ");
}// end of menu
public void GoodBye()
System.out.println(" You Entered " + b + " To exit Good_bye" );
System.exit(0);
}//end of GoodBye
public void PriceSort()
System.out.println(" You Entered " + b + " To Sort CD(s) By price ");
Collections.sort(list, new SortByPrice());
for(cd s : list)
System.out.println(s.getName() + ": " + s.getPrice());
}// end of PriceSort
public void NameSearch()
System.out.println(" You Entered " + b + " To Search CD(s) By Name ");
System.out.println("Please Enter The Name Of The CD You Are Searching For " );
String search = ei.readString();
for(int i=0; i<list.size();i++){
if(search.equalsIgnoreCase(list.get(i).getName() )){
System.out.println(list.get(i).getName() + " " + list.get(i).getPrice() + " " + list.get(i).getRatings() + " " + list.get(i).getGenre() );
}//end of NameSearch
public void ViewList()
System.out.println(" You Entered " + b + " To view CD(s) By Name ");
for(int i=0; i<list.size();i++)
System.out.println(list.get(i).getName() + " " + list.get(i).getPrice() + " " + list.get(i).getRatings() + " " + list.get(i).getGenre() );
}// end of ViewList
public void DeleteCd()
System.out.println(" You Entered " + b + " To Delete CD(s) By Name ");
System.out.println("Please Enter The Name Of The CD You Want to Delete ");
String search = ei.readString();
for(int i=0; i<list.size();i++)
if(search.equalsIgnoreCase(list.get(i).getName() ))
System.out.println(list.get(i).getName());
list.remove(i);
}// end of DeleteCD
public static void main(String[] args) {
//creating an Instance of EasyIn by object ei. Easy in is a Scanner class for reading
EasyIn ei = new EasyIn();
ArrayList<cd> list = new ArrayList <cd> (); // creating an array cd list
hipHopCollection call = new hipHopCollection();
ReadWrite rw = new ReadWrite();
while (true){
call.menu();
call.setB();
//b = ei.readInt();
if(call.getB()==0)
call.GoodBye();
if(call.getB()==1)
call.load();
rw.doWriting();// trying to write the cd object to a file
if(call.getB()==2)
rw.doReading();// trying to read the cd object from a file
//call.ViewList();
if(call.getB()==3)
call.PriceSort();
if(call.getB()==4)
call.NameSearch();
if(call.getB()==5)
call.DeleteCd();
}// end of while
}// end of main
}// end of class
// importing all the packages that we will use
import java.io.ObjectInputStream;
import java.io.FileInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.io.Serializable;
public class ReadWrite {
// these are all the attributes
private String FileName ="CdCollections.dat";
private OutputStream output;
private ObjectOutputStream oos;
private FileOutputStream fos;
private File file;
private FileInputStream fis;
private ObjectInputStream ois;
//creating an empty constructor
public ReadWrite()
// we could initialise all the attributes inside this empty constructor
//creating a constructor with arguments of a file name.
public ReadWrite(File file)
this.file=file;
try
//Use a FileOutputStream to send data to a file called CdCollections.dat
fos = new FileOutputStream(file,true);
Use an ObjectOutputStream to send object data to the
FileOutputStream for writing to disk.
oos = new ObjectOutputStream (fos);
fis=new FileInputStream(file);
ois = new ObjectInputStream(fis);
catch(FileNotFoundException e)
System.out.println("File Not Found");
catch(IOException a)
System.out.println(a.getMessage());
System.out.println("Please check file permissions of if file is not corrupt");
}// end of the second constructor
//the following lines of code will be the accessors and mutators
* @return the output
public OutputStream getOutput() {
return output;
* @param output the output to set
public void setOutput(OutputStream output) {
this.output = output;
* @return the objStream
public ObjectOutputStream getOos() {
return oos;
* @param objStream the objStream to set
public void setObjStream(ObjectOutputStream objStream) {
this.oos = oos;
public File getFile() {
return file;
public void setFile(File file) {
this.file = file;
public FileInputStream getFis() {
return fis;
public void setFis(FileInputStream fis) {
this.fis = fis;
public ObjectInputStream getOis() {
return ois;
public void setOis(ObjectInputStream ois) {
this.ois = ois;
// the following lines of code will be the methods for reading and writing
the following method doWriting will write data from the hipHopCollections source code.
that will be all the cd information.
Pass our object to the ObjectOutputStream's
writeObject() method to cause it to be written out
to disk.
obj_out.writeObject (myObject);
public void doWriting()
hipHopCollection call = new hipHopCollection();
//creating an Object variable hold that will hold cd data from hipHopCollections invoke
Object hold = call.getInvoke();// THI COULD BE THE PART WHERE I MADE A MISTAKE
ReadWrite stream = new ReadWrite (new File(FileName));
try
Pass our object to the ObjectOutputStream's
writeObject() method to cause it to be written out to disk.
stream.getOos().writeObject(hold);
stream.getOos().writeObject(hold);
stream.getOos().close();
System.out.println("Done writing Object");
catch (IOException e)
System.out.println(e.getMessage());
System.out.println("Program Failed To Write To The File");
finally
System.out.println("The program Has come To An End GoodBye");
}// end of method DoWriting
The following method is for reading data from the file written by the above method named
DoWriting
// PLEASE NOT THIS IS THE METHOD THAT GIVES ME NULL EXCEPTION
public void doReading()
ReadWrite read = new ReadWrite(new File(FileName));
try{
//System.out.println("I AM NOW INSIDE THE TRY TO READ");
Object obj = read.getOis().readObject();
System.out.println("tried reading the object");
cd c = (cd)obj; // trying to cast the object back to cd type
System.out.println("I have typed cast the Object");
System.out.println(c.getName());
System.out.println(c.getGenre());
System.out.println(c.getArtist());
System.out.println(c.getPrice());
System.out.println(c.getRatings());
System.out.println(c.getReleaseDate());
read.getOis().close();
catch(ClassNotFoundException e)
System.out.println(e.getMessage());
System.out.println("THE CLASS COULD NOT BE FOUND");
catch(IOException e)
System.out.println(e.getMessage());// null
System.out.println("WE COULD NOT READ THE DATA INSIDE THE FILE");
}//end of method doReading
}// end of class ReadWriteCross posted
http://www.java-forums.org/new-java/59965-writing-reading-serialized-java-object.html
Moderator advice: Please read the announcement(s) at the top of the forum listings and the FAQ linked from every page. They are there for a purpose.
Then edit your post and format the code correctly.
db -
Retreiving the file names from directory inside another directory from application server
Hi,
I had a problem in retreiving the file names from a directory inside another directory.
I tried using the FM's SUBST_GET_FILE_LIST, RZL_READ_DIR_LOCAL and EPS_GET_DIRECTORY_LISTING
But here I am getting only one directory details.
Actually my file is located a directory inside one more directory and one more directory and inside the files are located.
i.e total 3 directories inside the 3rd one my files are there.
I need to read the latest file name in the directory.
So that i can do some manipulation after getting the file name.
Is there option like OPEN DATASET , READ DATASET and CLOSE DATASET?
Can anyone please let me know How can i acheive this one.
Regards
RamHi Ram,
Following thread can be helpful for you, were it shows in the tables structure rsfillst a field RSFILLST-TYPE whether its a directory or file..........
http://scn.sap.com/thread/865272
thanks and regards,
narayan -
Get the ID of a dynamically created symbol from library, INSIDE another symbol.
Hi everyone,
I'm trying to get the id from a dynamic created symbol from library.
When dynamically creating the symbol directly on the stage (or composition level), there's no problem.
But I just can't get it to work when creating the symbol inside another symbol.
Below some examples using both "getChildSymbols()" and "aSymbolInstances"
// USING "getChildSymbols()" /////////////////////////////////////////////////////////////////////////
// ON THE STAGE
var m_item = sym.createChildSymbol("m_item","Stage");
var symbolChildren = sym.getChildSymbols();
console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
// INSIDE ANOTHER SYMBOL
var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
var symbolChildren = sym.getSymbol("holder").getChildSymbols(); // Am i using this wrong maybe?
console.log(symbolChildren.length) // returns 0 so can't get no ID either
// USING "aSymbolInstances"" //////////////////////////////////////////////////////////////////////////
// ON THE STAGE
var m_item = sym.createChildSymbol("m_item","Stage");
console.log(sym.aSymbolInstances[0]); // ok (i guess) x.fn.x.init[1] 0: div#eid_1391854141436
// INSIDE ANOTHER SYMBOL
var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
console.log(sym.getSymbol("holder").aSymbolInstances[0]); // Javascript error in event handler! Event Type = element
In this post http://forums.adobe.com/message/5691824 is written: "mySym.aSymbolInstances will give you an array with all "names" when you create symbols"
Could it be this only works on the stage/ composition level only and not inside a symbol?
The following methods to achieve the same are indeed possible, but i simply DON'T want to use them in this case:
1) Storing a reference of the created symbol in an array and call it later by index.
2) Giving the items an ID manually on creation and use document.getElementById() afterwards.
I can't believe this isn't possible. I am probably missing something here.
Forgive me I am a newbie using Adobe Edge!
I really hope someone can help me out here.
Anyway, thnx in advance people!
Kind Regards,
Lester.Hi,
Thanks for the quick response!
True this is also a possibility. But this method is almost the same of "Giving the items an ID manually on creation and use document.getElementById() afterwards".
In this way (correct me if i'm wrong) you have to give it an unique ID yourself. In a (very) big project this isn't the most practical way.
Although I know it is possible.
Now when Edge creates a symbol dynamically on the Stage (or composition level) or inside another symbol it always gives the symbol an ID like "eid_1391853893203".
I want to reuse this (unique) ID given by Edge after creation.
If created on the stage directly you can get this ID very easy. Like this;
var m_item = sym.createChildSymbol("m_item","Stage");
var symbolChildren = sym.getChildSymbols();
console.log(symbolChildren[0].getSymbolElement().attr('id')); // ok eid_1391853893203
I want to do exactly the same when created INSIDE another symbol.
var m_item = sym.createChildSymbol("m_item", sym.getSymbol("holder").getSymbolElement());
Now how can I accomplish this? How can I get the Id of a dynamically created symbol INSIDE another symbol instead of created directly on the stage?
This is what i'm after.
Thnx in advance! -
GP - WD Java: Cannot read callable object description from component
Hi,
i use Guided Procedures and therefore i will generate a WebDynproJ Callable Object inside the GP.
When i try to intergate it into Design-Time i get follwoing error after i picked the WebDynpro Component:
Cannot read callable object description from component: type com.sap.caf.gp.quotcreate.model.bapi_quotation_createfromdata2.types.Vbeln_Va could not be loaded: com.sap.dictionary.runtime.DdException: TypeBroker failed to access SLD: Error while obtaining JCO connection.
Well because i could import the Model into the WD Component in NWDS with the given JCo i have no clue why this error is now popping up.
Does someone have some experience with this phenomenon?!
I also wanted to check the JCo's in Content Admin but even though i am an Admin (i am sure of this) i have no rights to enter this part. Also the SLD is properly configured!
brHi Fritz,
how did you resolve the problem? thanks a lot!
Nicola -
Problem using jsp:include from inside a custom tag
Hi, All !
I have a problem using <jsp:include> from inside a custom tag. Exception is:
"java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
could not do this. Is it a bug, since in the 1.1 spec is said: "The
BodyContent is a subclass of JspWriter that can be used to process body
evaluations so they can retrieved later on."
My code is:
<wfmklist:items>
<jsp:include page="item.jsp" flush="true"/>
</wfmklist:items>
This is an area of contention with WL. It is not so tolerant with regards to
the spec. I spent several days recently trying to convince it to accept the
specification in regards to bodies and includes and it appears to have
successfully rebuffed my efforts.
Frankly, this is very disappointing. It appears that some shortcuts were
taken on the way to JSP 1.1 support, and the result is a very hard-coded,
inflexible implementation. As I have not seen the implementation myself, I
hate to assume this, however one could posit that the term "interface" was a
foreign concept during the implementation, other than as some annoying
intermediary reference requiring an immediate cast to a specific Weblogic
class, which in turn is apparently required to be final or have many final
methods, as if being optimized for a JDK 1.02 JIT.
I am sorry that I don't have any positive suggestions other than to use a
URL object to come back in an execute the necessary "include" directly. You
lose all context (other than session) and that can cause its own problems.
However, you can generally get the URL approach to work, and you will
hopefully avoid further frustration.
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com
Tangosol: How Weblogic applications are customized
"Denis" <[email protected]> wrote in message
news:[email protected]...
> Hi, All !
> I have a problem using <jsp:include> from inside a custom tag. Exception
is:
> "java.lang.ClassCastException: weblogic.servlet.jsp.BodyContentImpl"
>
> Apparently, weblogic tries to cast BodyContentImpl to JspWriterImpl and
> could not do this. Is it a bug, since in the 1.1 spec is said: "The
> BodyContent is a subclass of JspWriter that can be used to process body
> evaluations so they can retrieved later on."
>
> My code is:
> ...
> <wfmklist:items>
> <jsp:include page="item.jsp" flush="true"/>
> </wfmklist:items>
> ...
Maybe you are looking for
-
So I got is iPad as a gift and the same issues I had with my iPhone 4S is also happening with my iPad. Will Apple cover the problem as it lies within there updates or something. All I know I have taken perfect care of both products and volume is dist
-
Hi, i try to implement test network with Office 365 and AD Domain on-premise. Have created federated trust, it seems works: PS C:\> Get-MsolFederationProperty -DomainName testdomain.maildomain.org Source : ADFS Server ActiveClientSignInUrl : https://
-
I'm having trouble figuring out how to drag pictures from iPhoto albums into Calender and cannot find anyting on the Apple site that explains how to do that. Can anyone help? Thanks, Walter
-
HT4061 how can i find the iphon 4s number
how can i find the phon number in iphon 4s
-
I have tried troubleshooting it with apple help and it is not working. Any suggestions? I am unable to use the ipod at the point and cannot download any apps as well.