GetUploadedFile() return nullexception

Just trying to upload a file and I get NullPointer exception. Im missing something really stupid. Any help?
Added a fileUpload component and in the chooseLocalButton_action I get the Null exception. Thanks!
public String chooseLocalButton_action() {
UploadedFile uploadedFile = localfileUpload.getUploadedFile();
//This is where the exception occurs
String uploadedFileName = uploadedFile.getOriginalName();
if (uploadedFileName.equals("")){
error("No file was uploaded");
return null;
Stack trace.
Exception Details: java.lang.NullPointerException
null
Possible Source of Error:
Class Name: cytosolve.LocalSolver
File Name: LocalSolver.java
Method Name: chooseLocalButton_action
Line Number: 849
Source not available. Information regarding the location of the exception can be identified using the exception stack trace below.
Stack Trace begining
cytosolve.LocalSolver.chooseLocalButton_action(LocalSolver.java:849)
sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-2)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)....

Figure it out. Thanks

Similar Messages

  • NullPointerException while uploading wrong file in af:inputfile

    Hi All,
    I am uploading excel sheet data into jspx Page(database table) by using af:inputFile.After uploading file af:inputFile need to be refresh.It is getting refresh for right file(excel file),but it is not refreshing for wrong file upload.
    it showing following error.
    UIComponent is null
    ADF_FACES-60097:For more information, please see the server's error log for an entry beginning with: ADF_FACES-60096:Server Exception during PPR, #2
    i had refer frank's blog https://blogs.oracle.com/jdevotnharvest/entry/how_to_reset_adf_faces.
    Could any one help on this!!
    Thanks in advance!!

    here is my jspx source code.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich" xmlns:h="http://java.sun.com/jsf/html">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document title="ExcelToTable.jspx" id="d1">
    <af:messages id="m1"/>
    <af:form id="f1" usesUpload="true">
    <af:pageTemplate viewId="/oracle/templates/threeColumnTemplate.jspx" id="pt1">
    <f:facet name="center">
    <af:panelSplitter id="ps1" orientation="vertical" splitterPosition="146">
    <f:facet name="first">
    <af:panelFormLayout id="pfl2">
    <af:panelLabelAndMessage label="#{bindings.Deptno.hints.label}" id="plam1">
    <af:outputText value="#{bindings.Deptno.inputValue}" id="ot1">
    <af:convertNumber groupingUsed="false" pattern="#{bindings.Deptno.format}"/>
    </af:outputText>
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage label="#{bindings.Dname.hints.label}" id="plam2">
    <af:outputText value="#{bindings.Dname.inputValue}" id="ot2"/>
    </af:panelLabelAndMessage>
    <af:panelLabelAndMessage label="#{bindings.Loc.hints.label}" id="plam3">
    <af:outputText value="#{bindings.Loc.inputValue}" id="ot3"/>
    </af:panelLabelAndMessage>
    <f:facet name="footer">
    <af:panelGroupLayout layout="vertical" id="pgl2">
    <af:panelGroupLayout layout="horizontal" id="pgl3">
    <f:facet name="separator">
    <af:spacer width="10" height="1" id="s1"/>
    </f:facet>
    <af:commandButton actionListener="#{bindings.First.execute}"
    text="First" disabled="#{!bindings.First.enabled}"
    partialSubmit="true" id="cb1"/>
    <af:commandButton actionListener="#{bindings.Previous.execute}"
    text="Previous"
    disabled="#{!bindings.Previous.enabled}"
    partialSubmit="true" id="cb4"/>
    <af:commandButton actionListener="#{bindings.Next.execute}" text="Next"
    disabled="#{!bindings.Next.enabled}"
    partialSubmit="true" id="cb5"/>
    <af:commandButton actionListener="#{bindings.Last.execute}" text="Last"
    disabled="#{!bindings.Last.enabled}"
    partialSubmit="true" id="cb6"/>
    </af:panelGroupLayout>
    <af:commandButton text="Submit" id="cb7"/>
    </af:panelGroupLayout>
    </f:facet>
    </af:panelFormLayout>
    </f:facet>
    <f:facet name="second">
    <af:panelCollection id="pc1">
    <f:facet name="menus"/>
    <f:facet name="toolbar">
    <af:toolbar id="t2">
    <af:commandButton actionListener="#{bindings.CreateInsert.execute}"
    text="InsertRow"
    disabled="#{!bindings.CreateInsert.enabled}" id="cb2"
    immediate="true"/>
    <af:commandButton actionListener="#{bindings.Delete.execute}"
    text="DeleteRow"
    disabled="#{!bindings.Delete.enabled}" id="cb3"
    immediate="true"/>
    </af:toolbar>
    </f:facet>
    <f:facet name="statusbar"/>
    <af:table value="#{bindings.EmpView3.collectionModel}" var="row"
    rows="#{bindings.EmpView3.rangeSize}"
    emptyText="#{bindings.EmpView3.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.EmpView3.rangeSize}" rowBandingInterval="0"
    filterModel="#{bindings.EmpView3Query.queryDescriptor}"
    queryListener="#{bindings.EmpView3Query.processQuery}"
    filterVisible="true" varStatus="vs"
    selectedRowKeys="#{bindings.EmpView3.collectionModel.selectedRow}"
    selectionListener="#{bindings.EmpView3.collectionModel.makeCurrent}"
    rowSelection="single" id="t1" partialTriggers="::cb2 ::cb3">
    <af:column sortProperty="#{bindings.EmpView3.hints.Empno.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Empno.label}" id="c1">
    <af:inputText value="#{row.bindings.Empno.inputValue}"
    label="#{bindings.EmpView3.hints.Empno.label}"
    required="#{bindings.EmpView3.hints.Empno.mandatory}"
    columns="#{bindings.EmpView3.hints.Empno.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Empno.precision}"
    shortDesc="#{bindings.EmpView3.hints.Empno.tooltip}" id="it1">
    <f:validator binding="#{row.bindings.Empno.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.EmpView3.hints.Empno.format}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Ename.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Ename.label}" id="c2">
    <af:inputText value="#{row.bindings.Ename.inputValue}"
    label="#{bindings.EmpView3.hints.Ename.label}"
    required="#{bindings.EmpView3.hints.Ename.mandatory}"
    columns="#{bindings.EmpView3.hints.Ename.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Ename.precision}"
    shortDesc="#{bindings.EmpView3.hints.Ename.tooltip}" id="it2">
    <f:validator binding="#{row.bindings.Ename.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Job.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Job.label}"
    id="c3">
    <af:inputText value="#{row.bindings.Job.inputValue}"
    label="#{bindings.EmpView3.hints.Job.label}"
    required="#{bindings.EmpView3.hints.Job.mandatory}"
    columns="#{bindings.EmpView3.hints.Job.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Job.precision}"
    shortDesc="#{bindings.EmpView3.hints.Job.tooltip}" id="it3">
    <f:validator binding="#{row.bindings.Job.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Mgr.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Mgr.label}"
    id="c4">
    <af:inputText value="#{row.bindings.Mgr.inputValue}"
    label="#{bindings.EmpView3.hints.Mgr.label}"
    required="#{bindings.EmpView3.hints.Mgr.mandatory}"
    columns="#{bindings.EmpView3.hints.Mgr.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Mgr.precision}"
    shortDesc="#{bindings.EmpView3.hints.Mgr.tooltip}" id="it4">
    <f:validator binding="#{row.bindings.Mgr.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.EmpView3.hints.Mgr.format}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Hiredate.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Hiredate.label}" id="c5">
    <f:facet name="filter">
    <af:inputDate value="#{vs.filterCriteria.Hiredate}" id="id1">
    <af:convertDateTime pattern="#{bindings.EmpView3.hints.Hiredate.format}"/>
    </af:inputDate>
    </f:facet>
    <af:inputDate value="#{row.bindings.Hiredate.inputValue}"
    label="#{bindings.EmpView3.hints.Hiredate.label}"
    required="#{bindings.EmpView3.hints.Hiredate.mandatory}"
    columns="#{bindings.EmpView3.hints.Hiredate.displayWidth}"
    shortDesc="#{bindings.EmpView3.hints.Hiredate.tooltip}"
    id="id2">
    <f:validator binding="#{row.bindings.Hiredate.validator}"/>
    <af:convertDateTime pattern="#{bindings.EmpView3.hints.Hiredate.format}"/>
    </af:inputDate>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Sal.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Sal.label}"
    id="c6">
    <af:inputText value="#{row.bindings.Sal.inputValue}"
    label="#{bindings.EmpView3.hints.Sal.label}"
    required="#{bindings.EmpView3.hints.Sal.mandatory}"
    columns="#{bindings.EmpView3.hints.Sal.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Sal.precision}"
    shortDesc="#{bindings.EmpView3.hints.Sal.tooltip}" id="it5">
    <f:validator binding="#{row.bindings.Sal.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Comm.name}" filterable="true"
    sortable="true" headerText="#{bindings.EmpView3.hints.Comm.label}"
    id="c7">
    <af:inputText value="#{row.bindings.Comm.inputValue}"
    label="#{bindings.EmpView3.hints.Comm.label}"
    required="#{bindings.EmpView3.hints.Comm.mandatory}"
    columns="#{bindings.EmpView3.hints.Comm.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Comm.precision}"
    shortDesc="#{bindings.EmpView3.hints.Comm.tooltip}" id="it6">
    <f:validator binding="#{row.bindings.Comm.validator}"/>
    </af:inputText>
    </af:column>
    <af:column sortProperty="#{bindings.EmpView3.hints.Deptno.name}"
    filterable="true" sortable="true"
    headerText="#{bindings.EmpView3.hints.Deptno.label}" id="c8">
    <af:inputText value="#{row.bindings.Deptno.inputValue}"
    label="#{bindings.EmpView3.hints.Deptno.label}"
    required="#{bindings.EmpView3.hints.Deptno.mandatory}"
    columns="#{bindings.EmpView3.hints.Deptno.displayWidth}"
    maximumLength="#{bindings.EmpView3.hints.Deptno.precision}"
    shortDesc="#{bindings.EmpView3.hints.Deptno.tooltip}"
    id="it7">
    <f:validator binding="#{row.bindings.Deptno.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.EmpView3.hints.Deptno.format}"/>
    </af:inputText>
    </af:column>
    </af:table>
    </af:panelCollection>
    </f:facet>
    </af:panelSplitter>
    </f:facet>
    <f:facet name="header"/>
    <f:facet name="start">
    <af:panelGroupLayout id="pgl1">
    <af:panelFormLayout id="pfl1">
    <f:facet name="footer">
    <af:commandButton text="Upload" id="uploadButton"
    actionListener="#{FileProcessor.checkFile}" partialSubmit="true"/>
    </f:facet>
    <af:inputFile label="EmpFile" id="if1" value="#{FileProcessor.uploadedFile}"
    partialTriggers="uploadButton" binding="#{FileProcessor.inputFile}"/>
    <af:messages id="m2"/>
    </af:panelFormLayout>
    </af:panelGroupLayout>
    </f:facet>
    <f:facet name="branding"/>
    <f:facet name="copyright"/>
    <f:facet name="status"/>
    </af:pageTemplate>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    and bean class code is as follows.
    package xxorn.model.view;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import javax.faces.application.FacesMessage;
    import javax.faces.component.UIComponent;
    import javax.faces.component.UIViewRoot;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    import oracle.adf.view.rich.component.rich.input.RichInputFile;
    import oracle.adf.view.rich.component.rich.output.RichMessages;
    import oracle.adf.view.rich.context.AdfFacesContext;
    import org.apache.myfaces.trinidad.model.UploadedFile;
    import org.apache.myfaces.trinidad.util.ComponentUtils;
    public class FileProcessor {
    private CSVtoADFTableProcessor tablecreator;
    private UploadedFile uploadedFile;
    private String filename;
    private long filesize;
    private String filecontents;
    private String filetype;
    private RichMessages errorMsg;
    private RichInputFile inputFile;
    public FileProcessor() {
    public void setUploadedFile(UploadedFile uploadedFile) {
    this.uploadedFile = uploadedFile;
    this.filename = uploadedFile.getFilename();
    this.filesize = uploadedFile.getLength();
    this.filetype = uploadedFile.getContentType();
    try {
    if (filename.endsWith(".csv"))
    tablecreator.processCSV(uploadedFile.getInputStream());
    else if(filename.endsWith(".xls")){
    System.out.println("uploaded file is ********"+uploadedFile);
    tablecreator.fileSubmit(uploadedFile.getInputStream());
    //tablecreator.WriteXLS(uploadedFile.getInputStream());
    else if (filename.endsWith(".xlsx")){
    tablecreator.fileSubmitXSSF(uploadedFile.getInputStream());
    //wrong file upload
    else{
    String msg="this is a global message.";
    FacesContext ctx =FacesContext.getCurrentInstance();
    FacesMessage fm = new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, "Please Upload proper file");
    ctx.addMessage(null,fm);
    } catch (IOException e) {
    e.printStackTrace();
    public void convertStreamToString(InputStream is) throws IOException {
    StringBuilder sb = new StringBuilder();
    String line;
    BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
    while ((line = reader.readLine()) != null) {
    sb.append(line).append("\n");
    System.out.println(sb.toString());
    public UploadedFile getUploadedFile() {
    return uploadedFile;
    public void setFilename(String filename) {
    this.filename = filename;
    public String getFilename() {
    return filename;
    public void setFilesize(long filesize) {
    this.filesize = filesize;
    public long getFilesize() {
    return filesize;
    public void setFilecontents(String filecontents) {
    this.filecontents = filecontents;
    public String getFilecontents() {
    return filecontents;
    public void setFiletype(String filetype) {
    this.filetype = filetype;
    public String getFiletype() {
    return filetype;
    public void setTablecreator(CSVtoADFTableProcessor tablecreator) {
    this.tablecreator = tablecreator;
    public CSVtoADFTableProcessor getTablecreator() {
    return tablecreator;
    public void setErrorMsg(RichMessages errorMsg) {
    this.errorMsg = errorMsg;
    public RichMessages getErrorMsg() {
    return errorMsg;
    public String checkFile(ActionEvent actionEvent) throws Exception {
    // Add event code here...
    System.out.println("in upload action event");
    /* RichInputFile vTheInputFileComponent = getInputFile();
    vTheInputFileComponent.resetValue();*/
    FacesContext vFacesContext = FacesContext.getCurrentInstance();
    UIViewRoot vUIViewRoot = vFacesContext.getViewRoot();
    RichInputFile vTheInputFileComponent =
    (RichInputFile)vUIViewRoot.findComponent("if1");
    vTheInputFileComponent.resetValue();
    AdfFacesContext adfFacesCtx = AdfFacesContext.getCurrentInstance();
    adfFacesCtx.addPartialTarget(inputFile);
    return null;
    public void setInputFile(RichInputFile inputFile) {
    this.inputFile = inputFile;
    inputFile=null;
    public RichInputFile getInputFile() {
    return inputFile;
    }

  • How to save uploaded file in the context

    Hi,
    I am trying to save an uploaded file in a folder in reference to the
    context. I can not get the path to the destination folder with reference to
    the context.
    The file gets uploaded fine as I can pull the info about the file, however,
    I am not able to save it in a folder under context. Any ideas?
    the code is pasted below;
    thanks
    Rauf
    public class MyBean {
        private UploadedFile uploadedFile;
        int BUFFER_SIZE = 20000;
        protected final Log logger = LogFactory.getLog(getClass());
        public UploadedFile getUploadedFile() {
            return uploadedFile;
        public void setUploadedFile(UploadedFile uf) {
            this.uploadedFile = uf;
        public String processMyFile() {
             String uploadedFileName = getUploadedFile().getName();
             logger.debug("The uploaded file name is: " + uploadedFileName);
            int index = uploadedFileName.lastIndexOf('/');
            String justFileName;
            if ( index >= 0) {
                justFileName = uploadedFileName.substring( index + 1 );
            } else {
                // Try backslash
                index = uploadedFileName.lastIndexOf('\\');
                if (index >= 0) {
                    justFileName = uploadedFileName.substring( index + 1 );
                } else {
                    // No forward or back slashes
                    justFileName = uploadedFileName;
            logger.debug("just file name: " + justFileName);
           String uploadedFileType = uploadedFile.getContentType();
           FacesContext facesContext = FacesContext.getCurrentInstance();
                try {
                     logger.debug("In the first try loop");
                    // get the path to the /img directory from the servlet context
                    ServletContext servletContext = (ServletContext)facesContext.getExternalContext();
                    String realPath = servletContext.getRealPath("/img");
                    logger.debug("The real path: " + realPath);
                    logger.debug("saved file name: " + realPath + justFileName);
                      InputStream in = new BufferedInputStream(getUploadedFile().getInputStream());
                    BufferedOutputStream outputStream = new BufferedOutputStream(new FileOutputStream(realPath + justFileName));
                         try {
                                byte[] data = new byte[BUFFER_SIZE];
                           int readSize;
                           while ((readSize = in.read(data, 0, BUFFER_SIZE)) != -1)
                                logger.debug("writing buffer: " );
                                outputStream.write(data, 0, readSize);
                           in.close();
                           outputStream.close();
                         catch (FileNotFoundException e) {
                              e.printStackTrace();
                       catch (IOException e) {
                            e.printStackTrace();
                       logger.debug("return OK");
                       return "OK";
                catch(Exception e){
                     e.printStackTrace();
                     return "Not OK";
    }

    What I am struggling with is how to get the path relative to the context. The file upload works fine, however, the code fails at the fillowing line:
    ServletContext servletContext = (ServletContext)facesContext.getExternalContext();producing the following error:
    The uploaded file name is: c:\myjava\downloads\b2b-project-0.1-07282004.zip
    2006-08-22 00:16:34,344 DEBUG [com.hunza.kcw.jsfupload.MyBean] - just file name: b2b-project-0.1-07282004.zip
    2006-08-22 00:16:34,344 DEBUG [com.hunza.kcw.jsfupload.MyBean] - In the first try loop
    2006-08-22 00:16:34,344 DEBUG [com.sun.faces.lifecycle.InvokeApplicationPhase] - Exiting InvokeApplicationsPhase
    If I specify the absolute path like c:\temp, the file save is successfull. I am looking for a way to save the file in a folder in the context, without having to specify the full path of the folder.
    Rauf

  • Cant delete or add item to Jlist as nthing happens

    Hi all,
    regarding the first part where pass of string array into object array. I have done it (thanks again for the help). But regarding the add and remove elements from the Jlist cant be done.. below is my code for the delete button when press. I cast it into int for the ManualList.getSelectedIndex();(at part A) but cant display and keep having a error call
    java.lang.NullPointerException at ManualChange&ValueReporter.valueChanged
    code for value reporter is at part B
    Part A
    private void deleteMouseClicked(MouseEvent e)
    int n =(int)ManualList.getSelectedIndex();
    if (!(n < 0) || (n > listModel.size()))
    listModel.remove(n);
    delete.setEnabled(false);
    ManualList.repaint();
    ManualList.revalidate();
    Part B
    private class ValueReporter implements ListSelectionListener {
    public void valueChanged(ListSelectionEvent event) {
    // if (!event.getValueIsAdjusting())
    // gettext.setText(ManualList.getSelectedValue().toString());
    ManualList.repaint();
    ManualList.revalidate();
    Any help is greatly appreciated.
    alright, i redo part A the code is shown below but i still cant get the display out.
    Is there some problem in my code? or is the repaint and revalidate thing wrong usage here ? Need help regarding this. Thanks
    int n =ManualList.getSelectedIndex();
    if (!(n < 0) || (n > listModel.size()))
    listModel.removeElement(arrayObject[n]);
    delete.setEnabled(false);
    ManualList.repaint();
    ManualList.revalidate();

    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.event.MouseEvent.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.swing.DefaultListModel.*;
    import java.util.Properties;
    import java.util.ArrayList;
        public class smallProgram extends JFrame //implements ListSelectionListener
            JPanel p;
        private DefaultListModel listModel;
         JLabel ManualJob = new JLabel();
         JTextField gettext  = new JTextField();
         JScrollPane scrollPane1 = new JScrollPane();
         JButton okButton = new JButton();
         JButton cancelButton = new JButton();
         JButton add = new JButton();
         JButton delete = new JButton();
         JList ManualList;
         int tokenNo;
         String real,ss;
         String[] values;
         Object[] arrayObject;
         java.util.StringTokenizer tokenizer;
         BufferedReader in;
         ArrayList data;
         public static void main(String args[])
             new smallProgram();
          public smallProgram()
                setTitle("Small Program");
                p = (JPanel) this.getContentPane();
                p.setLayout(null);
                setSize(515, 585);
                setVisible(true);
               //---- ManualJob ----
               ManualJob.setText("Manual Jobs Classification");
               ManualJob.setFont(new Font("Times New Roman", Font.BOLD, 14));
               p.add(ManualJob);
               ManualJob.setBounds(10, 435, 190, 35);
               setVisible(true);
               //---- gettext ----
               gettext.setFont(new Font("Times New Roman", Font.PLAIN, 12));
               p.add(gettext);
               gettext.setBounds(365, 435, 115, 25);
               setVisible(true);
               //Buttons for add, del, ok and cancel
               //---- Add ----
               add.setText("Add");
               add.addMouseListener(new MouseAdapter() {
                   @Override
                   public void mouseClicked(MouseEvent e) {
                       addMouseClicked(e);
               p.add(add);
               add.setBounds(355, 485, 60, add.getPreferredSize().height);
              //---- delete ----
               delete.setText("Delete");
               delete.addMouseListener(new MouseAdapter() {
                   @Override
                   public void mouseClicked(MouseEvent e) {
                       deleteMouseClicked(e);
               p.add(delete);
               delete.setBounds(new Rectangle(new Point(430, 485), delete.getPreferredSize()));
               //---- okButton ----
               okButton.setText("OK");
               okButton.addMouseListener(new MouseAdapter() {
                   @Override
                   public void mouseClicked(MouseEvent e) {
                       okButtonMouseClicked(e);
               p.add(okButton);
               okButton.setBounds(335, 520, 75, okButton.getPreferredSize().height);
               //---- cancelButton ----
               cancelButton.setText("Cancel");
               cancelButton.addMouseListener(new MouseAdapter() {
                   @Override
                   public void mouseClicked(MouseEvent e) {
                       cancelButtonMouseClicked(e);
               p.add(cancelButton);
               cancelButton.setBounds(420, 520, 75, cancelButton.getPreferredSize().height);
               ss = ("test1,test2,test3,test4,test5"); //My string ss
               int length = ss.length();
               int asd = (ss.indexOf('_'))+1;
               real = ss.substring(asd, length);
               tokenizer = new java.util.StringTokenizer(real,",");
               tokenNo = tokenizer.countTokens();
               data = new ArrayList();
               values = new String [tokenNo];
    //           Object[] arrayObject = data.toArray();// this is my initial code where arraylist is pass to object
                   for(int i =0; i< tokenNo; i++)   // pass string-ss into arraylist individually
                    data.add((tokenizer.nextToken(",")));
                    //values[i] = tokenizer.nextToken(",");
                    data.trimToSize();
                    //System.out.println("tokenizer"  + values);
    int aaaa = data.size();
    System.out.println("size " + aaaa);
    System.out.println("tokenizer" + tokenNo);
    System.out.println("arraylist "+ i + data.get(i));
    //JLIST
    //======== scrollPane1 ========
    //---- ManualList ---- This is my Jlist // copy arraylist into Object[] then pass it into JList
    listModel = new DefaultListModel();
    /* listModel = new DefaultListModel(); Part A also continue from above
    * for (int i = 0; i< arrayObject.length;i ++)
    * listModel.addElement(objectArray[i].toString());
    * JList ManualList = new JList(listModel); //tried using listModel.method() to remove item in Jlist but return nullException
    arrayObject = data.toArray();
    JList ManualList=new JList(arrayObject);
    ManualList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    ManualList.setSelectedIndex(0);
    ManualList.setVisibleRowCount(5);
    ManualList.setFont(new Font("Times New Roman", Font.PLAIN,12));
    ManualList.setBorder(new MatteBorder(1, 1, 1, 1,Color.black));
    ManualList.setLayoutOrientation(JList.VERTICAL_WRAP);
    values = new String[tokenNo];
    ManualList.addListSelectionListener(new ValueReporter());
    // JScrollPane listPanel = new JScrollPane(ManualList);
    scrollPane1.setViewportView(ManualList);
    p.add(scrollPane1);
    scrollPane1.setBounds(210, 435, 130, 75);
    setVisible(true);
    { // compute preferred size
    Dimension preferredSize = new Dimension();
    for(int i = 0; i < p.getComponentCount(); i++) {
    Rectangle bounds = p.getComponent(i).getBounds();
    preferredSize.width = Math.max(bounds.x + bounds.width,preferredSize.width);
    preferredSize.height = Math.max(bounds.y +bounds.height, preferredSize.height);
    Insets insets = p.getInsets();
    preferredSize.width += insets.right;
    preferredSize.height += insets.bottom;
    p.setMinimumSize(preferredSize);
    p.setPreferredSize(preferredSize);
    private void addMouseClicked(MouseEvent e)
    private void deleteMouseClicked(MouseEvent e) //nthing happen here
    int n =ManualList.getSelectedIndex();
    if (!(n < 0) || (n > listModel.size()))
    listModel.removeElement(arrayObject[n]);
    delete.setEnabled(false);
    ManualList.repaint();
    ManualList.revalidate();
    /* int n =ManualList.getSelectedIndex(); //tried using this but failed
    if (!(n < 0) || (n > listModel.size()))
    listModel.remove(n);
    delete.setEnabled(false);
    ManualList.repaint();
    ManualList.revalidate();
    private void okButtonMouseClicked(MouseEvent e) {
    private void cancelButtonMouseClicked(MouseEvent e) {
    private class ValueReporter implements ListSelectionListener {
    public void valueChanged(ListSelectionEvent event) {
    // if (!event.getValueIsAdjusting())
    // gettext.setText(ManualList.getSelectedValue().toString());
    //String name=(String) ManualList.getSelectedValue();
    //System.out.println(name);
    private void ManualListMouseClicked(MouseEvent e) {
    // int n = (int)ManualList.getSelectedIndex();
    // if (!(n < 0) || (n > listModel.size()))
    // delete.setEnabled(true);
    ok this is a small complete program
    Thanks for the time to read this

  • Multiple form upload

    Hi everybody.
    I'm trying to use a form to upload several files, all at once.
    I use Struts and Commons facilities (that is the FormFile interface).
    Here's my action form:
    public class AttachmentForm
    extends ActionForm {
    /* Files to upload */
    private FormFile[] uploadedFiles;
    public FormFile[] getUploadedFiles() {
    return uploadedFiles;
    public void setUploadedFiles(FormFile[] uploadedFiles) {
    this.uploadedFiles = uploadedFiles;
    And this is the html code I use to populate the action form (I'm using Velocity, but I don't think this is really important):
    <html>
    <body>
    <form name="uploadForm" method="post" enctype="multipart/form-data" action="(...my action...)">
    Attachment 1: <input type="file" name="uploadedFiles"/>
    Attachment 2: <input type="file" name="uploadedFiles"/>
    Attachment 3: <input type="file" name="uploadedFiles"/>
    </form>
    </body>
    </html>
    Everytime I submit the form I obtain this exception:
    javax.servlet.ServletException: BeanUtils.populate
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)     
    java.lang.IllegalArgumentException: argument type mismatch
         sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         java.lang.reflect.Method.invoke(Method.java:324)
         org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
         org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
         org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
         org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
         org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
         org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
         org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
         org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
         org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
         org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    If I adjust the java source to manage one file only (ie. FileForm instead of FileForm[]) it works, but as I try to use an array I get the Exception.
    I use struts 1.1 on Windows XP platform and Tomcat 5.0.24.
    Have you got any ideas? Is it a bug of commons-beanutils?
    Thanks in advance,
    Paul

    Hi!
    Thks for your reply.
    If I define mutiple file inputs :
    <input type="file" name="uploadFile" ...
    <input type="file" name="uploadFile" ...
    and define a variable on the Struts form like;
         private FormFile[] uploadFile = null;
    Struts throws the exception below while trying to fill the array.
    I can fill arrays of Strings, ints,....but with the FormFile I am having this Exception. I would prefer to use Struts mechanism to upload files instead of doing things "manually". Any help would be appreciated.
    Thanks in advance,
    Victor Batista
    13:07:38,603 ERROR [Engine] StandardWrapperValve[struts]: Servlet.service() for
    servlet struts threw exception
    java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property
    Utils.java:1789)
    at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property
    Utils.java:1684)
    at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.
    java:1713)
    at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:101
    9)
    at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
    at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:495)
    at org.apache.struts.action.RequestProcessor.processPopulate(RequestProc
    essor.java:798)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.ja
    va:205)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:116
    4)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at pt.ptinovacao.dino.admin.servlet.filter.StrutsFilter.doFilter(StrutsF
    ilter.java:60)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at pt.ptinovacao.dino.admin.servlet.filter.DefaultFilter.doFilter(Defaul
    tFilter.java:55)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFi
    lter.java:75)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
    icationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
    ilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
    alve.java:214)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
    ContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
    alve.java:152)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrinc
    ipalValve.java:66)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Securit
    yAssociationValve.java:150)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
    torBase.java:462)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValv
    e.java:54)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
    ava:137)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
    ava:118)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
    535)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
    ve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
    eContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
    a:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:16
    0)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
    :799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
    ssConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
    :577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
    ool.java:683)
    at java.lang.Thread.run(Thread.java:534)

  • Re:How to save an uploaded file in specified folder

    Hi all,
    I am using Jdev 11.1.1.7.0
    i created one form in the page.i created attachments by using inputfile option in component palette.when i run the page it is working.the file is successfully uploaded.but my intension is i want to save the uploaded file in specified location for the particular person.so how can i save this file.can anyone help me out please.
    Thanks,
    G.Shilpa.

    Hi Timo,
    Thanks for the reply.my scenario is i have created one table and one form.i entered some data in it.i used inputfile and save button for attachments.it is working.bt it wont be saved.when i click the person and then upload a file then the file will be stored some particular location for the particular person.means when i reload this page again i click the person it want to show the person how many pages uploaded.i created one bean class in save button and inputfile.my code is
    public class FileUpload {
        private List<UploadedFile> uploadedFile;
        public FileUpload() {
            super();
        public void setUploadedFile(List<UploadedFile> uploadedFile) {
            this.uploadedFile = uploadedFile;
        public List<UploadedFile> getUploadedFile() {
            return uploadedFile;
        public void saveUploadedFiles(ActionEvent actionEvent) {
            // Add event code here...
            List<UploadedFile> files = this.getUploadedFile();
            if (files != null) {
                for (int i = 0; i < files.size(); i++) {
                    System.out.println(files.get(i).getFilename());
    if anything goes wrong can u please provide the code.
    Thanks,
    G.Shilpa.

  • NullException when setUI on JFileChooser

    I wrote a sub class of MetalFileChooserUI, and set it for my file chooser. but when i show the file chooser dialog, the icons for the files is disappeared. if i click the file list item, NullException occur. why?
    MY code:
    public class MyChooser extends JFileChooser {
    public MyChooser(String file) {
    super(file);
    setUI(new MyChooserUI());
    public class MyChooserUI extends MetalFileChooserUI {
    public MyChooserUI(JFileChooser fc) {
    super(fc);
    Error Message:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         at javax.swing.plaf.metal.MetalFileChooserUI$FileRenderer.getListCellRendererComponent(MetalFileChooserUI.java:536)
         at javax.swing.plaf.basic.BasicListUI.paintCell(BasicListUI.java:87)
         at com.incors.plaf.kunststoff.KunststoffListUI.paintCell(KunststoffListUI.java:91)
         at javax.swing.plaf.basic.BasicListUI.paint(BasicListUI.java:149)
         at com.incors.plaf.kunststoff.KunststoffListUI.update(KunststoffListUI.java:72)
         at javax.swing.JComponent.paintComponent(JComponent.java:395)
         at javax.swing.JComponent.paint(JComponent.java:687)
         at javax.swing.JComponent.paintChildren(JComponent.java:498)
         at javax.swing.JComponent.paint(JComponent.java:696)
         at javax.swing.JViewport.paint(JViewport.java:668)
         at javax.swing.JComponent.paintWithBuffer(JComponent.java:3878)
         at javax.swing.JComponent._paintImmediately(JComponent.java:3821)
         at javax.swing.JComponent.paintImmediately(JComponent.java:3672)
         at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:370)
         at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:124)
         at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:337)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
         at java.awt.Dialog.show(Dialog.java:380)
         at javax.swing.JFileChooser.showDialog(JFileChooser.java:614)
         at javax.swing.JFileChooser.showOpenDialog(JFileChooser.java:517)

    I think JFileChooser is a platform independent solution and Network Neighbourhood is a Windows implementation.
    You can use use a FileDialog, I think it uses the Window native open dialog.
    Use code something like this:
    File Dialog fileDialog = new FileDialog( parent frame );
    fileDialog.setMode(FileDialog.LOAD);
    fileDialog.show();
    if (fileDialog.getFile() == null)
    return;
    File file = new File( fileDialog.getDirectory(), fileDialog.getFile() );

  • Y is there a nullexception pointer

    dear all, in my program compiling does fine but when running it says that there is a nullexception pointer at the line "active = sp.getDataBits() ;"
    can anyone help me??
    thanx
    import java.io.* ;
    import java.lang.* ;
    import java.util.* ;
    import javax.comm.* ;
    public class Myport{
         /* My comms port is "COM1" */
         static Enumeration portList ;
         static CommPortIdentifier portId ;
         static SerialPort sp ;
         public static void main(String [] args){
              /* Get comms Id */
              portList = CommPortIdentifier.getPortIdentifiers();
              while(portList.hasMoreElements()){
                   portId = (CommPortIdentifier) portList.nextElement();
                   if (portId.getName().equals("COM1")){
                        System.out.println("COM 1 Found!") ;
                   else {
                        System.out.println("No COM 1!") ;
                        break ;
                   /* Setting up serial port */
                   try{
                        sp = (SerialPort)portId.open("FirstPort", 1000) ;
                   }catch (PortInUseException e) {
                        System.out.println("The Comm's Port Is Being Used!") ;
                   try{
                        sp.setSerialPortParams(9600,SerialPort.DATABITS_8,SerialPort.STOPBITS_1,SerialPort.PARITY_NONE) ;
                   }catch (Exception e) {
                        System.out.println("Error setting event notification");
                        System.out.println(e.toString());
                        System.exit(-1);
              int test = 0 ;
              while(test == 0){
                   int active = 0 ;
                   active = sp.getDataBits() ;
                   if(active != 0) {
                        /* Part to send out bluetooth commands */
                        System.out.println("active") ;
                   for(int n=0 ; n<10000 ; n++){
                        /* For waiting */
                   System.out.println("finish waiting") ;
                   test = 1 ;
         } //end main
    }

    It just means that sp is still null. It could be that your while loop is not getting executed, or portId.open() is returning a null.

  • Can I return my laptop

    I bought my laptop around the beginning of March 2011. I am very dissatisfied with it and was wondering if I could bring it in for a refund.The computer is a Dell Inspiron. 

    I'm sorry, but you only have 14 days to return a laptop. You could send it in for repair if there is an issue with the device.
    I am a Bestbuy employee who volunteers on these boards on my own time. I am not paid for posting here, and you should understand that my opinions are exactly that - opinions. I do not represent Bestbuy in any way.
    : Open Mailbox

  • Return of Free goods item - Problem in item category

    I am trying to create return order of Free sample billing
    (ZFDP). The return order type for the free sample is ZFDR.
    We have specified Item category for the ZFDR is RENN (Free good item) in IMG Activity -> Assign Item categories.
    When I create order and save it, it prompts me to enter G/L Account.
    This material is free. It should not prompt G/L Account for it. There is no revenue recognition specified for the item category. I tried changing item category to ZKLN i.e Free of charge item. This item category does not prompt for G/L Account while creating order. but I can not use this item category because it prompts me for Avialability. I can not remove the Avaialabilty check for it because the same item category is used in the Free sample order where availability check is required
    In ZFDP order type, we are issuing 100% discount by using R100
    discount condition.  Please let me know how can I solve this problem.
    I think there is some problem in my item category itself. .
    My setting for Item category in IMG - Define item category is
    same for both ZKLN and RENN. Only difference is RENN has returns
    tick and pricing field is blank. In ZKLN pricing is defined as B- 100%
    discount. I also tried changing the pricing option of RENN to B.
    But still it is asking for G/L Account.
    I can not use ZKLN instead of RENN because my ZKLN is used in the
    Free item Sales order.
    Please help.
    Regards
    Saurabh Gothivrekar

    Hi
    I got answer to my query. YOu need to specify the bill type while defining sales document type. This bill type should not have account assignment mentioned in it.
    I changed the bill type, which does not have Account assignment procedure attached to it.
    It has solved my problem

  • Query help: query to return column that represents multiple rows

    I have a table with a name and location column. The same name can occur multiple times with any arbitrary location, i.e. duplicates are allowed.
    I need a query to find all names that occur in both of two separate locations.
    For example,
    bob usa
    bob mexico
    dot mexico
    dot europe
    hal usa
    hal europe
    sal usa
    sal mexico
    The query in question, if given the locations usa and mexico, would return bob and sal.
    Thanks for any help or advice,
    -=beeky

    How about this?
    SELECT  NAME
    FROM    <LOCATIONS_TABLE>
    WHERE   LOCATION IN ('usa','mexico')
    GROUP BY NAME
    HAVING COUNT(DISTINCT LOCATION) >= 2Results:
    SQL> WITH person_locations AS
      2  (
      3          SELECT 'bob' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      4          SELECT 'bob' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      5          SELECT 'dot' AS NAME, 'Mexico' AS LOCATION FROM DUAL UNION ALL
      6          SELECT 'dot' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      7          SELECT 'hal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
      8          SELECT 'hal' AS NAME, 'Europe' AS LOCATION FROM DUAL UNION ALL
      9          SELECT 'sal' AS NAME, 'USA' AS LOCATION FROM DUAL UNION ALL
    10          SELECT 'sal' AS NAME, 'Mexico' AS LOCATION FROM DUAL
    11  )
    12  SELECT  NAME
    13  FROM    person_locations
    14  WHERE   LOCATION IN ('USA','Mexico')
    15  GROUP BY NAME
    16  HAVING COUNT(DISTINCT LOCATION) >= 2
    17  /
    NAM
    bob
    salHTH!
    Edited by: Centinul on Oct 15, 2009 2:25 PM
    Added sample results.

  • Unable to capture return values in web services api

    At the time of login to web services if my server is down ,
    it returns following error :
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
            at java.lang.String.substring(String.java:1438)
            at java.lang.String.substring(String.java:1411)
    I want to capture this error so that i can try another server to login. how do i capture this error
    Another place where i want to capture the return Value is when i look for a report on the server
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
                               "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if the report is not there on the server , it returns a null handler exception.
    but if i try catching it by checking my responsehandler is null  like rh == null  it does not catch it.
    Any help will be appreciated
    thanks
    Rakesh Gupta

    Ted : i have two cases
    1)   server = server_st.nextToken();
        providerURL = "http://"server"/dswsbobje/services";
        sessConnURL = new URL(providerURL + "/session");
       Connection boConnection = new Connection(sessConnURL);
       Session boSession = new Session(boConnection);
      EnterpriseCredential boEnterpriseCredential = new    EnterpriseCredential();
                  boEnterpriseCredential.setLogin(userid);
      boEnterpriseCredential.setPassword(pwd);
      boEnterpriseCredential.setAuthType(auth);
    SessionInfo boSI = boSession.login(boEnterpriseCredential);
    I have got a list of servers running web servcies stored in my tokens. when i pass the first server name say " test:8080" and that server is down , i want to catch somewhere in the code above that it did not get the connection so that i can loop back and try with the second server say test1:8080
    This is for failover purposes.
    at present when i was trying to capture return value of boSI it  breaks giving the error
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1438)
    at java.lang.String.substring(String.java:1411)
    2nd case :
    I am geeting reports from the server and scheduling them:
    i run the following code which works fine if reports is there
    rh = boBIPlatform.get("path://InfoObjects/Root Folder/"src_folder"/" + reportName +
    "@SI_SCHEDULEINFO,SI_PROCESSINFO" ,oGetOptions);
    oInfoObjects = rh.getInfoObjects();
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    Here if  the  report  is not there on the server  then i should be able to catch from the response handle rh that it has got a null value.
    but rh does not return a null value 
    the code ultimately throws a null handle at the following line
    CrystalReport = (CrystalReport)oInfoObjects.getInfoObject(0);
    i am not able to catch the null value there also.
    hope you got my issue.

  • Generate prov.xml for Creative Cloud. Return Code 27

    We're trying to follow this guide (Creative Cloud Help | Using Adobe Provisioning Toolkit Enterprise Edition) to serialize a package (or something). We're stuck on generating prov.xml. My best attempt at an entry is:
    C:\Program Files (x86)\Common Files\Adobe\OOBE\PDApp\CCP\utilities\APTEE>adobe_prtk.exe --tool=VolumeSerialize --generate --serial=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx --regsuppress=ss --eulasuppress --locales=en_US --provfilepath=C:\Program Fil
    es (x86)\Common Files\Adobe\OOBE\PDApp\CCP
    It says half of this is optional, but I'm skeptical.
    Anyway, I'm getting return code 27. This indicates that it is unable to edit the prov.xml file specified. I didn't specify a prov.xml file, I'm trying to make one. The syntax I'm using differs from what I found on the page I linked, as that was giving me syntax errors. I lifted this off someone else's code. I've tried just about every variation I can think of. Any help would be appreciated.
    This is on Windows

    One of these links may help
    http://helpx.adobe.com/creative-cloud/packager.html
    http://forums.adobe.com/community/download_install_setup/creative_suite_enterprise_deploym ent

  • Help Needed: Returning Back to Windows 8 after downgrading to Windows 7

    Hi guys, im just new here.
    I have a MSI GE40 gaming laptop which I bought 2 months back.
    Within those 2 months of usage, I always encounter my laptop to be very slow in shutting down. It always take, maybe up to 10 minutes to fully shut down. The screen goes black but the power button stays on orange color, & as I said, it takes a long time  for the power button to be completely unlit. But for start up, its blazing fast.
    Thinking that windows 8 itself is the culprit of super slow shutting down, I searched the net on how to downgrade to windows 7.
    Of course I did make a back up first on a 16gb usb flash drive using the pre-installed recovery software from MSI which was completed successfully.
    Then I made some tweaks on the bios (ie select legacy & disable secure boot) & boot using windows 7 installation DVD, deleted all partitions (since the notebook comes with GPT partition) to be able to install windows 7. I installed all the drivers which I downloaded from MSI website specific to my notebook.
    But the problem is not solved, it is still very slow in shutting down, & now even boot up becomes very slow too.
    So I downloaded & execute the firmware & bios for windows 7 from msi website (again, specific to my model). But still the same, the notebook is still very slow both in shutting down & start up.
    So I decided to go back again to windows 8, I tried to boot from the flash drive (I adjusted from the bios & make the flash drive to be the first priority) but it did not boot from it. I tried F11 on start up & selected to boot from usb flash drive but again, to no avail.
    So the last one I did was downloaded windows 8, make a bootable flash drive out of it, boot from it and luckily, I succeed - I have now again a windows 8 msi ge40 laptop.
    But I wanted my laptop to be reinstated to factory setting, i.e, all preinstalled softwares are there, the bios is default for windows 8. So I tried to update the bios to the one for windows 8 again (since I downgraded the bios to the one for windows 7 when I downgraded the OS to windows 7). But I could not update the bios, the laptop is not booting from usb flash drive containing the bios.
    I tried also to recover using F3 on start up but the system does not recognize the flash drive (with system back up). I tried also on PC settings but to no avail.
    Now guys, I need your help.
    How can I return back my laptop to default factory settings?
    Thank you.
    (sorry for my not so good English)

    Hello:
    I think it's not only about the OS version, you need to return this back to your shop to repair with the slow shot down issue, because the OS should be shot down in 30 seconds, far from your GE40 times.

  • Can I return my Lenovo S 205 ?

    Hi guys, I have had a multitude a problems since owning my Lenovo S 205 some 8 months ago.
    I got the laptop via Laptops Direct, an online laptop store.
    The first problem I experienced was when the laptop kept on shutting down on its own quite a few times. This I later discovered was because the laptop battery had a tendency to become loose sometimes.
    The second problem was when it began to freeze after I installed another version of MS Office.
    The third problem was when  it lost its bluetooth capabilities, although the bluetooth device had been detected as present.
    I managed to get the second and third problems fixed by a friend. However, after two weeks, the two problems have returned...TA-RAAA !
    I can only recommen other people to stay away from Lenovo right now !
    Does anyone know if I can return my Lenovo laptop and get a refund for it, so I can get something else like a Toshiba or an Asus ? Thanks very much !

    hi teresanazir,
    sorry to say that but refund is not possible at this point. have you tried to contact lenovo support line to ship it back to service for your issues?

Maybe you are looking for

  • Adding a new layout for DME for file download

    Hi All, How do i add a new layout for file download in DME? Thanks William Wilstroth

  • Daisy chaining W8960N routers

    Can someone please help me understand daisy chaining W8960N routers. Setup: Router 1 (R1 = 192.168.1.1) replaces HH3 without problem and an ethernet output from it goes from R1 to Router 2 (in this case R2 = 192.168.1.10). 1. Does R2 need a reboot af

  • Travel Advance

    Dear All I have a requirement. In SAP Travel Management, the standard setting for travel advance is that the amount is an offset to the receipts. For example lets assume that an employee takes an advance of 5000 before travelling. After travelling, w

  • RESTful Webservices for UNX Universe

    Dear Experts, Is Restful available for Changing connections for a UNX Universe (both single and multi source, more interested in multi source). Environment details: BI 4.0 SP601 MS SQL Server 2008, Oracle 11g Scenarios: 1. For a multi-source universe

  • Apple id problem for activate iphone after restored !!

    hi I bought an used iPhone . i restord iphone to ios 7.0.4 . but after , this want apple id for activate . I cant reach the former owner for id detiles Is there another way? please help me ...