on 06-19-2014 11:53 AM
Hi Experts,
I am trying load the image from KM using the webdynpro java application . when i am running my webdynpro application i am getting the follwoing error.
Initially the screen loaded ok, after doing some changes when i redeploy the application i am getting the error.
In NWA i am getting error message like this.
Can any help me how fix this ??? i am using nwds 7.3 and portal 7.4
Hi, Check below code. //Reading the image file...... BufferedInputStream bufIn = new BufferedInputStream(resourceimg.getContent().getInputStream()); byte[] imagebyte = new byte[bufIn.available()]; bufIn.read(imagebyte); IWDCachedWebResource cachedWebResource = null; cachedWebResource = WDWebResource.getWebResource(bufIn, WDWebResourceType.JPG_IMAGE); ele.setImagepath(cachedWebResource.getURL());
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Check this code.. //Reading the image file...... BufferedInputStream bufIn = new BufferedInputStream(resourceimg.getContent().getInputStream()); IWDCachedWebResource cachedWebResource = null; cachedWebResource = WDWebResource.getWebResource(bufIn, WDWebResourceType.JPG_IMAGE); cachedWebResource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal()) ; wdContext.currentContextElement().setDownload(cachedWebResource); download attribute map to lnk
Hi Experts,
Any inputs...??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Dear Anil,
Can you pleaseb try to read the file like this & don't forget to close the BufferedInputStream ?
BufferedInputStream bufIn = new BufferedInputStream(resourceimg.getContent().getInputStream());
while( bufIn .available() > 0 ){
wdComponentAPI.getMessageManager().reportSuccess(" bufIn" +(char)bufIn .read());
}
}
catch(FileNotFoundException e)
{
System.out.println("File not found" + e);
}
catch(IOException ioe)
{
System.out.println("Exception while reading the file " + ioe);
}
finally
{
//close the BufferedInputStream using close method
try{
if(bufIn != null)
bufIn .close();
}catch(IOException ioe)
{
System.out.println("Error while closing the stream : " + ioe);
}
}
Thanks & Regards,
Patralekha
Hi Patraleka,
Thanks for giving reply. I have your code but no luck i am getting the same error. When ever i use the method bufIn .available() i am getting the error.
I am able to print the bufIn value using below code, but i don't know where i made mistake
BufferedInputStream bufIn = new ufferedInputStream(resource.getContent().getInputStream());
I have undeployed and deployed the application, but still same error.
Hi Anil ,
what changes you made in UI ? and at which point you are getting the above error ?
Regards
Govardan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Initially i have created one image UI element and i have binded the image to the UI element.
when deploy it was working fine. and then i added one linktoURL element and then try to deploy
then i am getting the following above error.
BufferedInputStream bufIn = new BufferedInputStream(resourceimg.getContent().getInputStream());
In the above code i am getting error while reading the getContent.
I have checked this thread where facing the same issue
where it saying to upgrade KMC-WPC upgrade with latest patch, i have requested my basis team upgrade the patch level.
Yes Govardhan. No problem while building the dc's.
Upto here code is running fine without any runtime errors.
try {
IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
IUser sapUser = wdClientUser.getSAPUser();
com.sapportals.portal.security.usermanagement.IUser ep5User = WPUMFactory.getUserFactory().getEP5User(sapUser);
//Getting the Resource.........
IResourceContext resourseContext = new ResourceContext(ep5User);
IResourceFactory resourseFactory = ResourceFactory.getInstance();
//path to the KM Folder ("/documents/Alice In Wonderland/alice.gif")
RID pathRIDimg = RID.getRID(path);
com.sapportals.wcm.repository.IResource resourceimg =resourseFactory.getResource(pathRIDimg, resourseContext);
wdComponentAPI.getMessageManager().reportSuccess("resourceimg"+resourceimg);
When i try add the resource content to the BufferReader i am getting the error .
BufferedInputStream bufIn = new BufferedInputStream(resourceimg.getContent().getInputStream());
byte[] imagebyte = new byte[bufIn.available()];
bufIn.read(imagebyte);
wdComponentAPI.getMessageManager().reportSuccess(" bufIn" +imagebyte.length);
if i execute the above code, i am not getting any build errors but runtime i am getting the error.
pls help me.....
Hi Anil,
Here in this code
BufferedInputStream bufIn = new BufferedInputStream(resourceimg.getContent().getInputStream());
byte[] imagebyte = new byte[bufIn.available()];
bufIn.read(imagebyte);
wdComponentAPI.getMessageManager().reportSuccess(" bufIn" +imagebyte.length);
in which line you are getting the error ?
Regards
Govardan
Hi Govardhan,
Upto here its ok , i am able to print the bufin also.
BufferedInputStream bufIn = new BufferedInputStream(resourceimg.getContent().getInputStream());
But when i execute byte[] imagebyte = new byte[bufIn.available()]; i am getting error . Issue is due to bufin.available(),
When i try to print bufin.available() i am getting the error.
User | Count |
---|---|
81 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.