LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Upload file issue (https://www.linuxquestions.org/questions/programming-9/upload-file-issue-948977/)

Huamin 06-07-2012 03:07 AM

Upload file issue
 
Hi,
Does anyone have any ideas that the below errors are happening due to line 59 & 71, for my app by Jdev 11.1.1.5?

public String UploadImage() {

UploadedFile myfile = (UploadedFile)this.getFile();

BindingContext bindingctx = BindingContext.getCurrent();
BindingContainer bindings = bindingctx.getCurrentBindingsEntry();
DCBindingContainer bindingsImpl = (DCBindingContainer)bindings;
DCIteratorBinding iter =
bindingsImpl.findIteratorBinding("UserTabView1_1Iterator");

Row row = iter.getCurrentRow();
59 row.setAttribute("pict", createBlobDomain(myfile));
60
61 return null;
62 }
63
64 private BlobDomain createBlobDomain(UploadedFile file) {
65
66 InputStream in = null;
67 BlobDomain blobDomain = null;
68 OutputStream out = null;
69
70 try {
71 in = file.getInputStream();
72 ...

Caused by: java.lang.NullPointerException
at view.backing.UploadImageClass.createBlobDomain(UploadImageClass.java:71)
at view.backing.UploadImageClass.UploadImage(UploadImageClass.java:59)

Many Thanks & Best Regards,
HuaMin

Huamin 06-08-2012 03:11 AM

Any advice to this?

Many Thanks & Best Regards,
HuaMin

pan64 06-08-2012 03:13 AM

please try to use [code][/code] to keep formatting of your code.

NullPointerException means you tried to use the class file (line 71: file.getInputStream()), but probably it was null. You would need to check if this call UploadedFile myfile = (UploadedFile)this.getFile(); returned valid myfile.





_____________________________________
If someone helps you, or you approve of what's posted, click the "Add to Reputation" button, on the left of the post.
Happy with solution ... mark as SOLVED
(located in the "thread tools")


All times are GMT -5. The time now is 05:56 PM.