cancel
Showing results for 
Search instead for 
Did you mean: 

IllegalArgumentException when using FileDownload in a table

Former Member
0 Kudos

Hello,

I try to build a WebDynpro -Application, that allows to download files from a KM.

When I use the UI-Element FileDownload alone, everything works fine.

When I add the FileDownload-Element as column to a table, I get an [IllegalArgumentException|http://ubuntuusers.de/paste/182148/]

This is the code I use:

 
IWDAttributeInfo attributeInfo2 =wdContext.getNodeInfo() 
   .getAttribute(IPrivateResultView.IDownloadNodeElement.DOWNLOAD_FILE); 
IWDModifiableBinaryType binaryType2 =(IWDModifiableBinaryType) attributeInfo2 
   .getModifiableSimpleType(); 

... 

ByteArrayOutputStream out = new ByteArrayOutputStream(); 
int length; 
byte[] part = new byte[10 * 1024]; 
while ((length = in.read(part)) != -1) { 
   out.write(part, 0, length); 
} 
in.close(); 
byte[] myDLfile = out.toByteArray(); 
IPrivateResultView.IDownloadNodeElement DLNode =wdContext.nodeDownloadNode() 
   .createDownloadNodeElement(); 

DLNode.setDownloadFile(myDLfile); 
DLNode.setFileName(resource.getDisplayName(true)); 
wdContext.nodeDownloadNode().addElement(DLNode); 

binaryType2.setFileName(resource.getDisplayName(true)); 
binaryType2.setMimeType(WDWebResourceType.UNKNOWN); 

DownloadFile is of type binary.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello nikhiL,

thank you for the quick answer. I tried, what you told me, but the error (java.lang.IllegalArgumentException) is still the same...

Best regards,

Markus

nikhil_bose
Active Contributor
0 Kudos

It will be around the first few code snippets only. check you have put the same context element as attribute.

make sure that you are putting correct values to modifiable value type

regards,

nikhiL

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello nikhiL,

you were right, my mistake was not to use the nodeDownloadNode().

With this code, it worked:


IWDAttributeInfo attributeInfo2 =wdContext.nodeDownloadNode().getNodeInfo().
   getAttribute(IPrivateResultView.IDownloadNodeElement.DOWNLOAD_FILE);

Thanks alot!

Best regards,

Markus

nikhil_bose
Active Contributor
0 Kudos

replace


IWDAttributeInfo attributeInfo2 =wdContext.getNodeInfo() 
   .getAttribute(IPrivateResultView.IDownloadNodeElement.DOWNLOAD_FILE);

by


IWDAttributeInfo attributeInfo2 =wdContext.getNodeInfo() 
   .getAttribute("Download_file"); // case-sensitive  

nikhiL