Re: ClassCastException
Re: ClassCastException
- Subject: Re: ClassCastException
- From: Chuck Hill <email@hidden>
- Date: Mon, 17 Feb 2003 11:37:12 -0800
- Organization: Global Village Consulting, Inc.
What are the WOFileUpload bindings in the WOD file?
Jonathan Fleming wrote:
I've had this problem once before and somehow found a solution from a
suggestion posted in response to my plea, however, usually I add any
replies that are a solution to a problem in my error list, but somehow
this one escaped me, so I have to ask once again.
What is happening is that I have a fileUpload component that is bound to
a NSData object and a String object for its path, key value coding is
then used to get he item into the database but something is not working.
Even if I try to bind the fileupload component/element directly to my
EOCustom class I still get a ClassCastException, but it I take out the
fileUpload component/element the application is able to conduct a save
as normal.
Any suggestions as to what I might be missing here.
Thanks
Jonathan
This is the key value code i use:
protected String sFileNameThumb1 = null;
protected NSData dtaThumbImage1;
// Thumb File Upload Of File Path Thumb 1
public void setSFileNameThumb1(String aFilePath) {
if (aFilePath == null || aFilePath.equals("")) {
sFileNameThumb1 = null;
} else {
sFileNameThumb1 = NSPathUtilities.lastPathComponent(aFilePath);
}
}
public String getSFileNameThumb1() {
return sFileNameThumb1;
}
// Thumb File Upload of Data Thumb 1
public void setDtaThumbImage1(NSData aPicture) {
dtaThumbImage1 = aPicture;
}
public NSData getDtaThumbImage1() {
return dtaThumbImage1;
}
This is the code I use to get it into the database:
public WOComponent dbSaveChanges(){
EOEditingContext ec = session().defaultEditingContext();
// this checks if data was entered into the fileUpload component
if (session.getSFileNameThumb1() != null)
{
// Something was uploaded, update the EO
tbClientData.setFileNameThumb1(session.getSFileNameThumb1());
tbClientData.setThumbImage1(session.getDtaThumbImage1());
}
// save changes made in editing context to object store
ec.saveChanges();
}
This is the error i'm getting:
Error: java.lang.ClassCastException
Reason: java.lang.String
Stack trace: File Line# Method Package
--------------------------------------------------------------------------------
WOFileUpload.java 56 takeValuesFromRequest
com.webobjects.appserver._private
WODynamicGroup.java 81 takeChildrenValuesFromRequest
com.webobjects.appserver._private
WODynamicGroup.java 89 takeValuesFromRequest
com.webobjects.appserver._private
_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today!
http://messenger.msn.co.uk
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.