Help needed to read exception

Hello,
I am having problems reading an exception stack and help would be appreciated.
Following is the exception I get:
Apr 15, 2004 5:18:36 PM com.sun.faces.lifecycle.InvokeApplicationPhase execute
SEVERE: #{OPCAdvancedQueryManagedBean.beanAction}: javax.faces.el.EvaluationException: java.lang.NullPointerException
javax.faces.FacesException: #{OPCAdvancedQueryManagedBean.beanAction}: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:78)
at javax.faces.component.UICommand.broadcast(UICommand.java:312)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:266)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:380)
at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:284)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:204)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:257)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:245)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:199)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:509)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:184)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:164)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:567)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:206)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:833)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:732)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:619)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:688)
at java.lang.Thread.run(Thread.java:536)
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:130)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
... 33 more
Caused by: java.lang.NullPointerException
at com.sun.faces.context.SessionMap.put(ExternalContextImpl.java:555)
at com.softwareag.estela.opc.util.OPCSessionUtil.putTResponseIntoSession(OPCSessionUtil.java:35)
at com.softwareag.estela.opc.engine.OPCSearch.execute(OPCSearch.java:47)
at com.softwareag.estela.opc.jsf.OPCAbstractQueryManagedBean.beanAction(OPCAbstractQueryManagedBean.java:71)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
... 34 more
Apr 15, 2004 5:19:25 PM org.apache.catalina.core.StandardContext reload
Julien.

Hello all,
I am definitely stuck with this annoying NullPointerException.
I know for a fact that my response object is not null as I can print it out and a !=null test returns true. However I still get this npe exception. Some member variable of the response object must be null.
What's more, from the exception stack, can't we say the problem comes from the managed bean?
Can anyone help?
Here is my code:
public boolean execute() {
OPCServiceLocator service_locator = OPCServiceLocator.getInstance();
//TODO: externalize those two strings
TXMLObjectAccessor xmlObjectAccessor = service_locator.getTXMLObjectAccessor("http://localhost/tamino/prueba_2", "ibermarcreferencec");
TXQuery xquery = TXQuery.newInstance(opcquery.getXQuery() + footer);
try {
TResponse response = xmlObjectAccessor.xquery(xquery);
List list = OPCConvertUtil.convertResponseIntoDisplayableList(response);
if (response.hasQueryContent() && response != null) {
System.out.println("<--within block B-->");
OPCSessionUtil.putTResponseIntoSession(response);//error occurs here
OPCSessionUtil.putSearchResultsIntoSession(list);
System.out.println("<--within block E-->");
return response.hasQueryContent();
} catch (TXQueryException e) {
e.printStackTrace();
return false;
}Julien.

Similar Messages

  • Search help - Need to read dynpro of the calling program

    Hello all,
    We have a requirement where we need to read the dynpro of the calling program of a search help.
    Say I have a screen (selection screen, module pool or ALV grid etc) where I have a field PARTNER with whom a custom search help is attached. But on this same screen there is another field RLTYP. What we want is that when an F4 is taken on PARTNER, the value of RLTYP should also be passed as value to the Search help exit.
    In short, we need to read the screen fields of the calling screen of a search help.
    Any ideas are appreciated.
    Regards
    Priyanka

    Check the sample code:
    FUNCTION F4IF_SHLP_EXIT_OFFRCONT.
    ""Local interface:
    *"  TABLES
    *"      SHLP_TAB TYPE  SHLP_DESCT
    *"      RECORD_TAB STRUCTURE  SEAHLPRES
    *"  CHANGING
    *"     VALUE(SHLP) TYPE  SHLP_DESCR
    *"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
      DATA : ws_flag(1) TYPE c,
             ws_rec(1)  TYPE c.
      DATA : i_dynpfields TYPE dynpread OCCURS 0 WITH HEADER LINE.
      DATA : ws_data TYPE ddshiface,
             i_data TYPE ddshifaces.
      ws_flag = 'X'.
      ws_rec = 'X'.
      IF ws_flag = 'X'.
        i_dynpfields-fieldname = 'P_CUST'.
        APPEND i_dynpfields.
        CALL FUNCTION 'DYNP_VALUES_READ'
          EXPORTING
            dyname               = sy-cprog
            dynumb               = '1000'
          TABLES
            dynpfields           = i_dynpfields
          EXCEPTIONS
            invalid_abapworkarea = 1
            invalid_dynprofield  = 2
            invalid_dynproname   = 3
            invalid_dynpronummer = 4
            invalid_request      = 5
            no_fielddescription  = 6
            invalid_parameter    = 7
            undefind_error       = 8
            double_conversion    = 9
            stepl_not_found      = 10
            OTHERS               = 11.
        READ TABLE i_dynpfields WITH KEY fieldname = 'P_CUST'.
        ws_data-shlpfield = 'ZCUSTOMER'.
        ws_data-valfield = 'G_SIMFIELDS-FIELDNAME'.
        ws_data-value = i_dynpfields-fieldvalue.
        APPEND ws_data TO i_data.
        ws_data-shlpfield = 'ZOFFRCONT'.
        ws_data-valfield = 'P_CONT'.
        ws_data-f4field =     'X'.
        APPEND ws_data TO i_data.
        LOOP AT shlp_tab.
          IF ws_rec = 'X'.
            shlp_tab-interface[] = i_data[].
            APPEND shlp_tab.
            ws_rec = ' '.
          ENDIF.
        ENDLOOP.
        DELETE shlp_tab INDEX 1.
        ws_flag = ' '.
      ENDIF.
    ENDFUNCTION.
    Regards,
    Prakash.

  • Help needed with Reader Integrated Key

    Hi,
    I have develop a plug-in and apply for Reader Integrated Key License. This plug-in have been tested with acrobat and reader professional and it is working.
    I follow the advice from the above website and use RIKLATools.zip to created the pair.
    i have just receive the Reader Integrated Key from Adobe,I tried all method but the key  does not work with the plug-in. What is the fool proof way to integrate my Reader Integrated Key with the plug-in to get a digtally signed plug-in?
    Urgent help needed as we are submitting the plug-in to client.
    many Thanks in advance
    Regards
    Jia hao

    Thank you lrosenth, i will email them

  • Need help- need to read a customer table from the payroll schema

    Hi gurus,
    I need to read an amonunt from a customer table in the payroll schema. Is it possible to input TABLE XXXX in the schema, or is impossible to read from a customer table?Do I need to create a report to upload the amount in an infotype?
    Thanks in advanced for for support!

    You should create your own custom operation (based on operation TABLE) to read your custom table from a Payroll PCR.
    If your custom table's name is longer than 5 characters, you may be required to use operations VAOFF and/or VALEN prior to your custom operation in the PCR.

  • Help needed in using exceptions

    can anyone please correct the code for me.
    i am posting the code after doing all my homework , i tried the best of me
    not able to solve the error. thanks in advance
    i would prefer a clue how to solve the error even after the clue if im not able to solve i would expect the answer and explanation.
    thanks in advance
    import java.util.*;
    public class TestExceptions
         public static void main(String[] args)
              String test = "no";
              try
                   System.out.println("Start try");
                   doRisky(test);
                   System.out.println("end try");
              catch ( ScaryException se )
                   System.out.println("Scary Exception");
              finally
                   System.out.println("end of main");
         static void doRisky(String test) throws ScaryException
              System.out.println("start risky");
              if("yes".equals(test))
                   throw new ScaryException();
              System.out.println("end risky");
              return;
    the error i use to get is as follows
    abrar-sheiks-macbook-pro:java abrarsheik$ javac TestExceptions.java
    TestExceptions.java:25: cannot resolve symbol
    symbol : class ScaryException
    location: class TestExceptions
         static void doRisky(String test) throws ScaryException
    ^
    TestExceptions.java:15: cannot resolve symbol
    symbol : class ScaryException
    location: class TestExceptions
              catch ( ScaryException se )
    ^
    TestExceptions.java:31: cannot resolve symbol
    symbol : class ScaryException
    location: class TestExceptions
                   throw new ScaryException();
    the erroe i use to get is

    An Exception is basically a class just like any other, except that it extends java.lang.Exception.
    So you either use existing ones, such as IllegalArgumentException, IllegalStateException, NullPointerException and so on, or you define your own. It seems that you wanted to define your own exception here, called ScaryException.
    Defining your own exception isn't to different from writing any other class. Just write this:
    public class ScaryException extends Exception {
    }For the most basic part that's all you need. Later on, you might want to add some more constructors, where you can pass a message and/or a cause (which will just be passed to the super constructor). And that's usually it, most exceptions don't contain any more code than that.

  • Help needed in reading file

    Hi all,
    I am designing a web system that takes paragraph from a user and store it into database so that we can use those later to create a document using different paras from the database so that the user don't have to type anything.
    Now i want to approach this as the following:
    1. I am taking user input using HTML TEXTAREA because we don't know how long is the para is gonna be.
    2. How can receive that TEXTAREA in the next page when the user submit that to the database. Can i use
    String para=request.getParameter("astring"); the problem is para size could be anything i don't know what size of data can a string take. So can anyone suggest me what should i use
    3. Next. When i receive the para i want to create a TEXT file and store the para AND i will save the name and location of the para in the database rather than the whole para in database.
    4. Next when the query made system can show those para by taking the address from the database and then opening the file and copying those data in HTML TEXT area again to show to the user.
    Can anyone please help me how can do that.
    I really need your help.
    Thanks

    Hi,
    Sounds like its really big inputs you are expecting. String are objects and have no such restrictions as seen at simple types. To my knowledge Strings have no limits in length.
    So use the request.getParameter("string");
    Make sure though that your form method id POST.
    I think you should make a field in your database to where you can post your text directly. They can be made to contain quite big amount of data. Reading and writing to files are expensive. I'm using Postre and mssql having fields containing up to 15 MB data. Should be suficient in many cases.
    Good luck to you

  • Plesae help- needing to read a blob from db into bytes[]

    Hi all,
    I am having a requirement to read a blob stored in the oracle table and convert it into bytes. I am loading this table (wwv_flow_files) with APEX.
    The code under page 1 is as follows:
    DECLARE
    z number;
    y varchar2(4000);
    x varchar2(400);
    b blob;
    BEGIN
    select filename,blob_content into x ,b from APEX_APPLICATION_files where name =:P1_FILE_NAME;
    select length(convertBlobToBytes(b)) into z from dual;
    :P1_RESULT := z;
    end;
    Java code is as follows:
    import java.io.*;
    import java.sql.Blob;
    public class convertBlob {
    * @param blob
    * @return
    public static byte[] convertBlobToBytes(Blob blob) {
         if (blob==null) return null;
         try {
         InputStream in = blob.getBinaryStream();
         int len = (int) blob.length(); //read as long     
    long pos = 1; //indexing starts from 1
         byte[] bytes = blob.getBytes(pos, len);           
    in.close();
         return bytes;     
    catch (Exception e) {
         System.out.println(e.getMessage());
         return null;
    PL/SQL wrapper is as follows:
    CREATE OR REPLACE FUNCTION convertBlobToBytes(p1 IN BLOB) RETURN LONG RAW AUTHID CURRENT_USER AS LANGUAGE JAVA NAME 'convertBlob.convertBlobToBytes(java.sql.Blob) return byte[]';
    I loaded this java class and pl/sql wrapper into the database using JDEVELOPER.
    But I am getting the length of the file, as twice the size.
    For example, When I run the program which reads the file returns the length of the file as a byte array, the length is 819.
    When I pass the same file as a blob from apex, to the java program that converts blob to bytes, the length of the file is 1638.
    And hence I am getting wrong results, further in the process.
    Can you please help me? Any help is appreciated.
    rgds,
    Suma.

    Hi all,
    Can any of you please help me out?
    rgds,
    Suma.

  • Help Needed, problem reading a configuration file in XML form

    Hello,
    I am using NetBeans 6.5.1 with Apache Tomcat 6.0.18.
    I am trying to develop a web application and in my source files I have a thread that loops every second and reads the contents of a configuration file which is in XML form using java.util.Properties.
    As soon as I call props.loadFromXML(new FileInputStream(file)); I get several exceptions that I don't know what they mean nor I know how to resolve them.
    I would apreciate any help you guys can provide.
    Here is what I get in NetBeans:_
    Apr 30, 2009 8:56:53 PM com.sun.xml.ws.transport.http.servlet.WSServletDelegate destroy
    INFO: WSSERVLET15: JAX-WS servlet destroyed
    Apr 30, 2009 8:56:53 PM com.sun.xml.ws.transport.http.servlet.WSServletContextListener contextDestroyed
    INFO: WSSERVLET13: JAX-WS context listener destroyed
    Apr 30, 2009 8:56:53 PM org.apache.catalina.loader.WebappClassLoader findResourceInternal
    INFO: Illegal access: this web application instance has been stopped already. Could not load META-INF/services/javax.xml.parsers.DocumentBuilderFactory. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
    Apr 30, 2009 8:56:53 PM org.apache.catalina.loader.WebappClassLoader loadClass
    INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
    java.lang.IllegalStateException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:111)
    at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:146)
    at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:233)
    at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)
    at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)
    at java.util.XMLUtils.load(XMLUtils.java:57)
    at java.util.Properties.loadFromXML(Properties.java:852)
    And following the above I get:_
    Apr 30, 2009 8:56:53 PM org.apache.catalina.loader.WebappClassLoader loadClass
    INFO: Illegal access: this web application instance has been stopped already. Could not load com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl. The eventual following stack trace is caused by an error thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access, and has no functional impact.
    java.lang.IllegalStateException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1273)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
    at javax.xml.parsers.FactoryFinder.getProviderClass(FactoryFinder.java:111)
    at javax.xml.parsers.FactoryFinder.newInstance(FactoryFinder.java:146)
    at javax.xml.parsers.FactoryFinder.find(FactoryFinder.java:233)
    at javax.xml.parsers.DocumentBuilderFactory.newInstance(DocumentBuilderFactory.java:123)
    at java.util.XMLUtils.getLoadingDoc(XMLUtils.java:75)
    at java.util.XMLUtils.load(XMLUtils.java:57)
    at java.util.Properties.loadFromXML(Properties.java:852)
    Thanks in advanced.

    kimskams wrote:
    Very Sorry Problem Remains... I checked Scanner on a Smaller file (to give u fast feedback) but I think the spaces in Small file were normal.. that is why it worked..
    In fact I can feel some word on the blank line (hidden words).. its cursor who evidence their presence so Its not working..
    Its a big program which is accessing a lexical resource so I think what I copied was Ok..
    If u still have some solutions then please tell me otherwise I have to remove these blank lines manually for the time being but its not solution.
    I m trying alsoI don't think anyone can give you an answer: people here don't know how your file looks like. Obviously those lines (when the Scanner instance stops reading) are not just empty lines.

  • Urgent help needed with reading data from Cube

    Hi Gurus,
    Can anyone tell me how to read a value from a record in the CUBE with a key (combination of fields).
    Please provide if you have any custome Function Module or piece of code.
    Any ideas are highly appreciated.
    Thanks,
    Regards,
    aarthi

    Due to the nature of the cube design, that would be difficult, that's why there are API's, FMs, and MDX capabilities - to eliminate the need to navigate the physical structure.  Otherwise you would have to concern yourself with:
    - that there are two fact tables E and F that would need to be read.  The Factview could take of this one.
    - you would want to be able to read aggregates if they were available.
    - the fact table only as DIM IDs or SIDs (for line item dims) to identify the data, not characteristic values.  A Dim ID represents a specific combination of characteristic values.

  • Help needed in reading data from a Crystal Report

    I am trying to read data values from a saved crystal report. (groovy code snippet below)
    I open a new ReportClientDocument and set the RAS using the inprocConnectionString property.
    Then I get the rowsetController and set defaultNumOfBrowsingRecords, rowsetBatchSize and maxNumOfRecords all to 1000000
    Using the browseFieldValues method after that returns only 100 records. I want to get all.
               ReportClientDocument clientDocSaved;
           def pathout=rc.pathToSavedReports+rr.path;
         //****** BEGIN OPEN SAVED SNAPSHOT ************
         clientDocSaved = new ReportClientDocument();
         clientDocSaved.setReportAppServer(ReportClientDocument.inprocConnectionString);       
            // Open report
         println("Reading file in.")
         clientDocSaved.open(pathout, OpenReportOptions._openAsReadOnly);
           def rowsetController = clientDocSaved.getRowsetController()
         rowsetController.setDefaultNumOfBrowsingRecords(1000000)
         rowsetController.setRowsetBatchSize(1000000)
         rowsetController.setMaxNumOfRecords(1000000)
         //setup metadata
         IRowsetMetaData rowsetMetaData = new RowsetMetaData()
         Fields fields =  clientDocSaved.getDataDefController().getDataDefinition().getResultFields()
         rowsetMetaData.setDataFields(fields)
         def values = rowsetController.browseFieldValues(fields.get(0), 1000000)
         values.each{value->
            println(value.displayText(new Locale("ENGLISH")))
    Before using the browseFieldValues method I was trying to use a rowsetCursor
                //get the rowset cursor to navigate through the results
                RowsetCursor rowsetCursor = clientDoc.getRowsetController().createCursor(null, rowsetMetaData)
                //navigate through the rowset and log the name and value
                rowsetCursor.moveTo(0)
                while(!rowsetCursor.isEOF()){
                     Record currentRecord = rowsetCursor.getCurrentRecord()
                     //println("current record number: " + rowsetCursor.getCurrentRecordNumber())
                     for(int i=0;i<fields.size();i++){
                          //println("Column - "+fields.get(i).getName())
                          if (currentRecord.size()>0){
                              println(currentRecord.getValue(i))
                     rowsetCursor.moveNext()
    the currentRecord was always an empty list and I did not get any data values at all.
    Am I missing something in using these approaches?
    I'm fairly new to using the Java SDK for CR. Any help will be greatly appreciated.
    Thanks

    hi, I am trying this second method to read the values from report. but all the records comming as null. Kindly help me to resolve this issue.

  • Urgent Help Needed regd reading a file in apex

    Hi all,
    I need to know how can we store content of a file in a variable or any item(like text box).
    i have a os user name in the file.
    when i use apex_util.get_file it is opening in new page.
    instead i want it to stored in a text box or any variable.
    cany any one help me on this.
    Thanks in advance,
    Srini
    Message was edited by:
    user650963

    Hi Srini,
    You can use the normal file upload functionality to do this.
    1 - Create a page region and add in a File Browse item - I'll call it P1_FILE_NAME
    2 - Create a button in that region, I'll call it P1_UPLOAD_BUTTON, and set it to branch back to the same page
    3 - Create a TextArea item - I'll call it P1_FILE_CONTENTS
    4 - Create a page process, called P1_UPLOAD_FILE, and triggered by the P1_UPLOAD_BUTTON
    5 - Use the follownig code for the process:
    declare
    v_clob clob;
    v_blob blob;
    v_varchar2 varchar2(30000);
    BEGIN
    SELECT blob_content into v_blob FROM APEX_APPLICATION_FILES where name = :P1_FILE_NAME;
    v_clob := wwv_flow_utilities.blob_to_clob(v_blob,'utf-8');
    :P1_FILE_CONTENTS := wwv_flow_utilities.clob_to_varchar2(v_clob);
    :P1_FILE_NAME := '';
    delete from APEX_APPLICATION_FILES WHERE NAME = :P1_FILE_NAME;
    END;When you select the file and click the Upload button, the file is uploaded into the APEX_APPLICATION_FILES table. The contents of the file is put into a BLOB field. The above code, converts that BLOB into a CLOB and then into a VARCHAR2 value - you can then change P1_FILE_CONTENTS to that value. Finally, the code removes the file from the table and resets the File Browse field.
    Note that this assumes that the file contains nothing but text and is no more than 30,000 characters in length.
    Andy

  • Urgent help needed - writing/ reading to/from file

    hi all..
    can anyone help me with this problem:
    The problem dioscussed in www.javaworld.com forum
    any clues what the problem is??

    hi all...
    i managed to get the gui set up, and the JList is finally loading the data,
    yet, i am having problems with displaying relevant data of each item in the list...
    could you please help??
    // required imports
       import javax.swing.*;
       import java.awt.*;
       import java.awt.event.*;
       import javax.swing.event.*;
       import java.io.*;
       import java.util.*;
    // ViewPanel class: the panel for the view pane. handles its own events.
       public class ViewPanel extends JPanel implements ListSelectionListener
          private JList list;
          private DefaultListModel listModel;
          private JButton deleteButton;
          private TicketStorage data;
       // add pane items
          private JLabel seat, seatData;
          private JLabel name, nameData;
          private JLabel duration, durationData;
          private JLabel price, priceData;
          private JCheckBox waiterService;
       // creating panels
          JPanel p1 = new JPanel();
          JPanel p2 = new JPanel();
          public ViewPanel(TicketStorage data)
          // store data structure reference
             this.data = data;
             TrainTicket[] summary = data.summary();         
             listModel = new DefaultListModel();
             for (int i = 0; i < summary.length; i++)
                listModel.addElement(summary.getSeat());
    list = new JList(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.setSelectedIndex(0);
    list.setVisibleRowCount(5);
    JScrollPane listScroller = new JScrollPane(list);
    listScroller.setPreferredSize(new Dimension(100, 150));
    seat = new JLabel("Seat No:");
    seatData = new JLabel();
    name = new JLabel("Name:");
    nameData = new JLabel();
    duration = new JLabel("Duration:");
    durationData = new JLabel();
    price = new JLabel("Price:");
    priceData = new JLabel();
    // create add pane items
    waiterService = new JCheckBox("Waiter Srevice");
    waiterService.setEnabled(false);
    // waiterService.addActionListener(boxListener);
    JButton deleteButton = new JButton("Delete");
    // deleteButton.addActionListener(buttonListener);
    // adding listeners to the components
    //deleteButton.addActionListener(this);
    //waiterService.addActionListener(this);
    list.addListSelectionListener(this);
    // adding the components to their coreesponding panels
    p1.setLayout(new GridLayout(5,1));
    p1.add(seat);
    p1.add(name);
    p1.add(duration);     
    p1.add(price);
    p1.add(waiterService);
    p2.setLayout(new GridLayout(5,1));
    p2.add(seatData);
    p2.add(nameData);
    p2.add(durationData);     
    p2.add(priceData);
    p2.add(deleteButton);
    this.setLayout(new GridLayout(1,3,3,0));
    this.add(listScroller);
    this.add(p1);     
    this.add(p2);
    public void valueChanged(ListSelectionEvent e)
    if (e.getValueIsAdjusting() == true)
    // enable the delete button when an item is selected
    deleteButton.setEnabled(true);
    // retrieve the sellected seat number value
    String itemSellected = listModel.getElementAt(list.getSelectedIndex()).toString();
    // retrieve the ticket with the sellected seat number
    TrainTicket tk = data.retrieve(itemSellected);
    // load the relevant data of a sellected ticket
    seatData.setText(tk.getSeat());
    nameData.setText(tk.getName());
    durationData.setText(Integer.toString(tk.getDuration()));
    priceData.setText(Double.toString(tk.getPrice()));
    /*/ if the selected ticket of type first class
    if(tk instanceof FirstClassTicket)
    if(((FirstClassTicket)tk).getWaiter()==true)
    waiterService.setSelected(true);
    waiterService.setEnabled(true);
    else
    waiterService.setSelected(false);
    waiterService.setEnabled(true);
    else
    waiterService.setSelected(false);
    waiterService.setEnabled(false);
    the application runs, it loads the data available in the linked list,
    yet, on switching from an item to another in the list, it keeps generating errors!!!
    in addition to the fact that it does not display the data!!
    for more info refer to the url in my first post!
    any clues??

  • Help Needed on Read/Modify Line Statement

    Hi,
    I am writing a report which is having a check box as first column, followed by sales data. I am giving F4 Key to user to Select ALL the check box. I have used Modify Line to do this, but it is not working for me.
    Here is the pseudo code which i am using.
    Report <report name>.
    data cb1 value SPACE.
    Write :/ cb1 as CHECKBOX, 'X'.
    Write :/ cb1 as CHECKBOX, 'Y'.
    Write :/ cb1 as CHECKBOX, 'Z'.
    AT PF04.
       DO 3 times.
          MODIFY LINE sy-index field value cb1 from 'X'.
       ENDDO.
    This is not working and giving weird results.
    I tried the following things too.
    Trial a:
    cb1 = 'X'.
    modify line sy-index field value cb1.
    Trial b:
    modify line sy-index of current page value cb1 from 'X'.
    Trial c:
    read line sy-index....
    modify line sy-index..
    But none of them were working.
    Please let me know if my approach to select all check box is correct. Is there any alternate way to select all the checkbox in the list?..What is wrong with my modify line statement.
    Regards
    Mitesh

    Hi Anand,
    Thanks for throwing a light on the "Read Statement". This cleared up my concept of modify line too.
    When I dont use Read Line, the output will be:
    Checked X
    Checked X
    Checked X
    Let me try to answer the question as "Why it is happening".Correct me if i am wrong as i am only 15 days Old for ABAP ;-((.
    Here is how I will now defining modify line statement. Modify Line Statement modify the current line or line number n with the value of sy-lisel. With Field Addition in Modify line, you change the content of sy-lisel.
    So in our case, the sy-lisel value is (Checked,'X').
    So if we dont use read line, only first column will get updated , whereas second field will remain in the sy-lisel.
    So to get the value of other lines, we use read line. This will fill up the sy-lisel with the the line content of sy-index and so modify will work.
    So, if we are using AT LINE-SELECTION event to select line, in that case, there is no need to do a read line as sy-lisel is already in the buffer.
    Please correct me if i am wrong.
    Regards
    Mitesh

  • Help needed regarding reading in a text file and tokenizing strings.

    Hello, I require help with a task I've been set, which asks me to read in a text file, and check the contents for errors. The text file contains lines as follows.
    surname:forename:1234:01-02-06
    I can read in the file, but dont know how to split the strings so each token can be tested (ie numbers in the name tokens)
    However, I am not allowed to use regex functions, only those found in java.io.*
    I think i should be putting the tokens into an array, but have had no luck so far in doing so. Any help would be appreciated.

    public class Validator {
         public static void main(String args[]) {
              String string = "Suname:Forename:1234:01_02-06";
              String stringArray[] = string.split(":");
              System.out.println (validateLetters(stringArray[0]));//returns true
              System.out.println (validateNumbers(stringArray[3]));//returns false
         static boolean validateLetters(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z')) {
                         return false; //return false if one of characters is other than a-z A-Z
                 }//end if
                 }//end for
                 return true;
         }//end validateLetters
         static boolean validateNumbers(String s) {
                 for(int i = 0; i < s.length(); i++) {
                 char c = s.charAt(i);
                 if ((c < '0' || c > '9') && (c != '-')) {
                         return false; //return false if one of characters is other than 0-9 or -
                 }//end if
                 }//end for
                 return true;
         }//end validateNumbers
    }

  • Help needed finding uncaught exception in amended SQLBooks sample

    Hi all
    I've been playing with the SQLBooks example and now I've got a an uncaught exception error coming up when I try press the + (add) button on the main screen.
    I've changed the DB that I'm using and have created my own equivalent classes for the book object.
    The app compiles with no errors or warnings and the main screen loads up (no data showing as my DB is empty).
    I hit the + button to add a new 'book' and the cellForRowAtIndexPath method runs no problem (I've stepped through that) but after this there isn't anything else for me to step into and the simulator returns to the code with something about an UNCAUGHT EXCEPTION. I'm new to xcode and mac development so don't have the knowledge to debug past what I've done.
    Any suggestions on where I can start?
    Regards
    Wayne

    If you haven't noticed it, the other person who responded to your message is correct. However, the log is a little confusing and it can be difficult to sort the messages in the log into categories. You may want to type the name of your application into the search box to narrow things down a bit. Do that and then run your application and you'll see only the messages sent by it (and not by Xcode).
    If you notice the stack trace in your code (it's a couple of lines long so it's tough to miss), you'll probably find the more informative message a few lines above.
    Hope that helps.
    D

Maybe you are looking for

  • BI Content  Process Chain

    Hi Experts, I installed NW 7.0 sr3 ABAP system, and then installed BI_CONT release 703 as add-on. But our BI consultant not able to find all the objects when he is trying to activate process chain from the bi content. Can anyone please tell me which

  • Buying Items from the US store while I am in Canada

    Hi all, I tried to use the search function..but was unable to find the info. I got my new Ipod video on Friday.. and much to my disgust.. I found out that the TV shows and ALOT of videos I can't get in Canada. Is there away around this? I can put a f

  • How can i get rid of "save keep"ads on macbookAir

         ads labelled "save Keep" appear on my screen.I can close them but they come when I am opening web sites.

  • Help! iTunes library file is locked!

    iTunes crashed while syncing w my iPod.  Now when I launch iTunes, i get the 'locked' error message!  I am running iTunes 10.4 on a MacBook with Lion OS.  Thanks

  • When I click on Firefox it does not open nor run

    When I click on Firefox the little circle swirling shows up as if it is going to open but then the circle goes away and Firefox does not start. There are no messages shown for why this is happening. I have also right clicked on Firefox and then click