Help, nullpointer exceptions...

Heres my source code I cant figure it out!
import java.awt.*;
import java.applet.Applet;
public class BubbleSort extends Applet{
int[] sortArray;
int m=0;
     public void init(){
          m=1;
          for (int i=0;i<100;i++){
               sortArray=(int)(Math.random()*100);
     sort();
     public void paint(Graphics g){
          if (m==1){
               //g.drawRect(1,i,sortArray[i],i+1);
               g.drawString(""+sortArray[50],50,50);
               sort();
     public void sort(){
          if(m==1){
               for (int i=1;i<98;i++){
                    if (sortArray[i]>sortArray[i+1]){
                         int tempInt=sortArray[i];
                         sortArray[i]=sortArray[i+1];
                         sortArray[i+1]=tempInt;
          repaint();

I am sorry i forgot the code brackets...
import java.awt.*;
import java.applet.Applet;
public class BubbleSort extends Applet{
int[] sortArray;
int m=0;
     public void init(){
          m=1;
          for (int i=0;i<100;i++){
               sortArray=(int)(Math.random()*100);
     sort();
     public void paint(Graphics g){
          if (m==1){
               //g.drawRect(1,i,sortArray[i],i+1);
               g.drawString(""+sortArray[50],50,50);
               sort();
     public void sort(){
          if(m==1){
               for (int i=1;i<98;i++){
                    if (sortArray[i]>sortArray[i+1]){
                         int tempInt=sortArray[i];
                         sortArray[i]=sortArray[i+1];
                         sortArray[i+1]=tempInt;
          repaint();

Similar Messages

  • Nullpointer exception... any help would be appreciated

    In advance, I apologize for any ignorance which I may obviously have... I'm in the process of learning Java, and am used to C/C++... In any case, I'm running into a nullpointer exception while 'compiling', which I'm having trouble figuring out... I'll list everything below, but this message will be rather long, as I will try to include everything I can. For this reason, I will ask my questions here, at the top:
    1) A null pointer exception, I believe, is generated when something is being referenced which is currently null, for example "a=null; a.b;" yields a null pointer exception. However, is there any other way that one is generated?
    2) Are there methods to figure out what/why something is null other than simply looking at it? As shown below, it seems that just looking at it runs you in a circle from line to line, file to file, which leads you back to the beginning where nothing is actually null... (I'm probably just not seeing it, but that seems to be what's happening to me)
    So now, on to the actual code:
    The following is a printout of the debugging info:
    ~/bin/jdk*/bin/java -classpath classes jamie.Main
    java.lang.NullPointerException
    at jamie.Main.Sys_Log(Main.java:110)
    at jamie.Main.Setup(Main.java:142)
    at jamie.Main.main(Main.java:54)
    Exception in thread "main" java.lang.NullPointerException
    at jamie.Main.Sys_Log(Main.java:110)
    at jamie.Main.Shutdown(Main.java:182)
    at jamie.Main.main(Main.java:92)And a short excerpt of each. (*) indicates line which error originates:
    20    )   private static Log                sys_log;
    108  )   static void Sys_Log(String msg)
    109  )   {
    110*)        sys_log.Log(msg);
    111  )   }
    142*)   Sys_Log("Server warming up...");
    182*)   Sys_Log("Server shutting down...");
    50  )     public static void main(String[] args)
    51  )     {
    52  )          try
    53  )          {
    54*)                Setup();
    85  )     catch(Exception e)
    86  )     {
    87  )          e.printStackTrace(System.out);
    88  )          err_log.Log(e.toString());
    89  )     }
    90  )     finally
    91  )     {
    92*)            Shutdown();
    93  )      }Now, various things that I have tried, and their result (you can probably skip this section, as these were mostly futile efforts):
    What seems odd to me is that the initial error is on line 110, which is the logging function Sys_Log. Since it's a null pointer exception, I would assume that sys_log is null? and thus in calling Log we're generating that error... I'm not entirely sure that that makes sense, though. Additionally, and what I find odd, is that if I change it to what I will list below, I get a slew of other seemingly unrelated problems:
    20    )   private static Log                sys_log;
    108  )   static void Sys_Log(String msg)
    109  )   {
    110#)        if (sys_log!=null)
    111  )        sys_log.Log(msg);
    112  )   }This results in a problem with function Err_Log, which I change the same way, resulting in the following:
    java.lang.NullPointerException
            at jamie.Area_LUL.Load(Area_LUL.java:23)
            at jamie.Main.Setup(Main.java:161)
            at jamie.Main.main(Main.java:55)
    Exception in thread "main" java.lang.NullPointerException
            at jamie.Main.Shutdown(Main.java:186)
            at jamie.Main.main(Main.java:93)In Main.java the following lines are generating the error:
    160  )   lul = new Area_LUL();
    161*)   lul.Load();And in Area_LUL.java I also have the following:
    14  )class Area_LUL implements LoaderUnloader
    15  ){
    16  )    public void Load()
    17  )    {
    18  )        try
    19  )        {
    20  )            areadir = new File("./areas/");
    21  )            SAXParser p = SAXParserFactory.newInstance().newSAXParser();
    22  )
    23*)            for(File curr : areadir.listFiles(new Area_Filter()))
    24  )            {
    25  )                p.parse(curr, new XMLParser());
    26  )            }
    27  )        }Where in the above, the for statement is generating the null pointer exception... which would tell me that areadir is null, however it is defined as new File("./areas/"); Also, lul (defined as new Area_LUL(); is generating the same error, though it is clearly defined in Area_LUL.java at the top of the last excerpt.
    Also, LoaderUnloader is defined in another file as follows:
    interface LoaderUnloader
        void Load();
        void Unload();
    }which are defined in Area_LUL in Area_LUL.java .
    A major theory which I currently have is that the compiler is beginning with my main.java file, and not seeing the class definition in another file, and thus attributing the class obj I create as null, which is causing the error, but I also am not sure if this is possible...
    My imports for Main.java are as follows:
    package jamie;
    import java.io.*;
    import java.util.*;I'm not entirely sure what the package is including, however I do have a jamie.jar file in another directory (../../dist) (could be referencing that?). Also, to compile the source I am using the following command:
    ~/bin/jdk*/bin/java -classpath classes jamie.MainHowever my classpath (I believe) isn't set to include all my files in the given directory. I wouldn't believe that this would be an issue, however if it could possibly be causing this, I can figure out how to set it properly. Also, this should mean I'm starting with Main.java, and perhaps I am right in concluding that it isn't referencing Area_LUL in another file properly, which is setting it as null?
    In any case... Any help would be greatly appreciated. This has been a bit of a struggle for about a month now, trying various resources, moving things around, etc... Thanks so much for your time in reading,
    -Jess

    I'm not able to follow the program flow from your post. Please create a small standalone program that exhibits the problem and post that back here.
    Your assumption re a NPE is correct, that's the only way they're generated.
    There are no "canned" methods to resolve NPEs. The best solution is to put System.out.println statements for all of the involved objects and variables immediately preceeding the error line (in this case, 110) and something will show null. Usually that's enough info to backtrace to the real cause.

  • Help with nullPointer exception

    Hi,
    I would like some help identifying and error in the code below. Im getting a nullPointer exception at the location specified in the code. Im adding elements to a tableModel. What puzzles me is that the strings I add to the model does contain values. And it does not complain about adding them. Perhaps this is just a simple error, and you more experinced programmars are probably loughing at me ;)
    void getTests() {
          String[] idNummer = getDirectory(); //gets filenames from a directory
          for (int i = 0; i < idNummer.length; i++) {
             idNummer[i] = idNummer.substring(idNummer[i].lastIndexOf(dataSeparetor) + 1, idNummer[i].length());
    // just sorts out specific parts of the filenames
    for (int i = 0; i < idNummer.length; i ++) {
    System.out.println(idNummer[i]); //I print the sorted filenames and they not null
    testModel.addElement(idNummer[i]); //I add them to the table model
    testNr.setModel(testModel); //and gets a nullPoint exception here??

    I'm sorry, you mean testNr. Don't pay any attention to the above post. it is also declared directly in the class:
    public class GUI extends JFrame implements EventListener  {
      JList testModel;
    }and creates an instance here:
    public GUI {
    testModel = new DefaultListModel();
    getTests();
    testNr = new JList(testModel);
          testNr.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
          testNr.setLayoutOrientation(JList.VERTICAL);
          testNr.setPreferredSize(new Dimension(80, 80));
          testNr.addListSelectionListener(new ListSelectionListener() {
             public void valueChanged(ListSelectionEvent event) {
          leftPanel.add(testNr, BorderLayout.EAST);
    }

  • Java.lang.NullPointer Exception in File-RFC-File wtihout BPM scenario

    Hi All,
    I have implemented scenario File - RFC - File without BPM in PI7.1 according to below link by bhavesh
    [File - RFC - File without a BPM - Possible from SP 19.;
    but I am getting error java.lang.NullPointer Exception  in Audit log of sender communication channel when it enters in ResponseOnewayBean.
    I had implemented the same in PI 7.0 but there it was working fine.
    Is there any limitations on the use of the above beans in PI7.1 as I could see two more threads on the same unanswered yet.
    Please help me in resolving as it is priority task for me
    Thanks,
    Amit

    Sometime back I saved this SAP Note 1261159 for this error. Not sure if it is still valid. Try to get it implemented.
    Regards,
    Prateek

  • 1 View linked to 2 CompCont: NullPointer Exception

    Hi,
    Here is the architecture of my app :
    MainView --> CompContA --> ModelA (RFC function A)
    ........|
    ........|---> IntCompB --> CompContB --> Model B (RFC function B)
    And here is the content of the MainView :
    AdviceNumber : [
    Z2_I_Rechercher_Avis_Input.AdviceNumber) | RefreshButton1
    UserId : [Z2_I_Rechercher_Bottin_Input.UserId) | RefreshButton2
    Name : [Z2_I_Rechercher_Avis_Input.Output.It_Infos_Bottin.Name) 
    Now, my application works when I populate an AdviceNumber and press the RefreshButton1.  At the return, the name field is refreshed and I use some Java code to move the UserId that my function returned to the UserId of the screen. This works well.
    Then if I change the value of the UserId in the screen and press the RefreshButton2, the second function returns me another name, and I use some Java code to move this name into the Name field of the screen. This works well too.
    The problem is that I can't use the refreshButton2 first!  I get a NullPointer exception.
    And I know why, it's because the « Output » structure of my Z2_I_Rechercher_Avis_Input is not initialized (since the refreshButton1 has not been used yet).
    But I can't find the right way to code it.
    Can you help me, thanks!
    Message was edited by:
            Emanuel Champagne

    I want the user to click on the button he wants.
    I just need to know how to initialize the Output.Struc1 when the user decides to click on the RefreshButton2 First.
    It's the line in bold that give me the error (but that line works well when the RefreshButton1 is used first!)
      public void onActionRafraichirAvis(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionRafraichirAvis(ServerEvent)
         //$$begin ActionButton(-775562010)
         wdThis.wdGetAvisCompController().executeZ2_I_Rechercher_Avis_Input();
         //$$end
         // At the return, we need to refresh the values of the screen with the ones returned by the function.
         // Access to the structure showed on the screen
    IIt_Infos_BottinElement AvisInfosBottinEl = wdContext
                                                                  .nodeIt_Infos_Bottin()
                                                                  .currentIt_Infos_BottinElement();
        // Access to the structure received by the RFC function
        IIt_Z2I053TElement BottinEl = wdContext
                                                             .nodeIt_Z2I053T()
                                                             .currentIt_Z2I053TElement();
         <b>AvisInfosBottinEl.setName(BottinEl.getName());</b>
    Message was edited by:
            Emanuel Champagne

  • NullPointer Exception in  SetCharacterEncodingFilter

    Hi All..!
    Can any one help me out in Fixing the Nullpointer Exception raised from SetCharacterEncodingFilter class which was taken by me from the Tomact ServletExamples. What should be the reason for this exception ? and how to fix this problem. Thanks in Advance to all the Gurus..!
    Please find the Stacktrace of the generated Exception
    java.lang.NullPointerException
    at org.apache.jsp.welcome_jsp._jspService(welcome_jsp.java:65)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at MalikJspPackages.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
    at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
    at java.lang.Thread.run(Thread.java:595)
    NotifyUtil::java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
    at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:606)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:554)
    at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:571)
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:928)
    at org.netbeans.modules.web.monitor.server.NotifyUtil$RecordSender.run(NotifyUtil.java:248)

    Look up the createImage(int width, int height) method in the Component api abd follow the link to its description in the Method Detail section. Note that this method will return null if the component is not displayable. Try placing your inspection code after the call to setVisible.

  • Whatz java.lang. NullPointer Exception.(Unknown Source)??

    Hi All,
    In my application, i am getting java.lang. NullPointer Exception.
    Is it thatthe application not finding the above Action Class at Runtime??
    Any help would be highly appreciated..
    Thanks in Advance..
    Shridhar..

    Read the fucking API.
    Thrown when an application attempts to use null in a case where an object is required. These include:
    - Calling the instance method of a null object.
    - Accessing or modifying the field of a null object.
    - Taking the length of null as if it were an array.
    - Accessing or modifying the slots of null as if it were an array.
    - Throwing null as if it were a Throwable value.
    Applications should throw instances of this class to indicate other illegal uses of the null object.

  • JTable crashes with NullPointer exception

    Hi
    I use a JTable with a selfmade TableModel.
    On first display I get an Nullpointer exception
    in the JTable, when it calls prepareRenderer.
    I'm not using the DefaultRenderer ... that is I'm not specifying it explicitly.
    Has anybody seen this behaviour before?
    Thanx a lot
    Spieler

    In your TableModel do you use a custom Renderer as well? You said you're not using the DefaultRenderer, so I assume you're calling the setDefaultRenderer() method?
    Check to make sure you have the proper class given as the class of the renderer. I had this problem once because I had accidentally given a different class than what the renderer really was.
    Example:
    // my custom renderer
    MyRenderer1 renderer = new MyRenderer1();
    // wrong class
    setDefaultRenderer(MyRenderer.class, renderer);
    // right class
    setDefaultRenderer(MyRenderer1.class, renderer);Hope this helps!
    - Brion Swanson

  • Nullpointer exception when calling Task.getPayloadAsElement()

    Hi all,
    I have deployed an simple bpel in my 10.1.3.1 bpel engine. The proces contains a simpel human tasks, which I want to complete using the human workflow 10.1.3 api. This is the task message which includes my payload:
    initiateTask_ApproveLoanRequestTask
    [2006/12/04 20:59:48]
    Invoked 2-way operation "initiateTask" on partner "TaskService".
    - <messages>
    - <initiateTaskInput>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    - <initiateTask xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">
    - <task xmlns="http://xmlns.oracle.com/bpel/workflow/task">
    <title>
    Aprove Loan Request task
    </title>
    - <payload>
    - <approveLoanRequestPayload xmlns="http://xmlns.oracle.com/approveLoanRequest">
    <nameRequester>
    Tom
    </nameRequester>
    <loanRequest>
    1000
    </loanRequest>
    <currency/>
    <isApproved/>
    </approveLoanRequestPayload>
    </payload>
    <taskDefinitionURI>
    http://xesoa1.iteye.local:8894/orabpel/default/approveLoanRequest/1.0/ApproveLoanRequestTask/ApproveLoanRequestTask.task
    </taskDefinitionURI>
    <creator>
    Tom
    </creator>
    <ownerUser>
    bpeladmin
    </ownerUser>
    <ownerGroup/>
    <priority>
    3
    </priority>
    <identityContext/>
    <userComment/>
    <attachment/>
    - <processInfo>
    <domainId>
    default
    </domainId>
    <instanceId>
    100008
    </instanceId>
    <processId>
    approveLoanRequest
    </processId>
    <processName>
    approveLoanRequest
    </processName>
    <processType>
    BPEL
    </processType>
    <processVersion>
    1.0
    </processVersion>
    </processInfo>
    <systemAttributes/>
    <systemMessageAttributes/>
    <titleResourceKey/>
    <callback/>
    <identificationKey/>
    </task>
    </initiateTask>
    </part>
    </initiateTaskInput>
    - <initiateTaskResponseMessage>
    - <part xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="payload">
    - <initiateTaskResponse xmlns="http://xmlns.oracle.com/bpel/workflow/taskService">
    - <workflowContext xmlns="http://xmlns.oracle.com/bpel/workflow/common">
    - <credential>
    <login>
    bpeladmin
    </login>
    <identityContext>
    jazn.com
    </identityContext>
    </credential>
    <token>
    13PdID5l3hQSt5QrDDwIyW0GK01koYzxtTLKFTV8e75uWJsSEkJuTRpE7+PJfcK3VL1koQYczeHlUE3fl4yvA9GAsezTFonLuQtb84khaEJpaOUFsBflwg1c5n7J/JE37eJW6HeqoT2utGTwWCfWP3Pm9InF5TUTQkqsguXpd29z+qEllTtnbJAbSRtyeUu5TtQGzcQcBWedYko8rql7XGSFba/O5DJriVW/nrgH7oC5c4diUencB0aVZzWTW2jrOogcTxbQfk8=
    </token>
    </workflowContext>
    - <task xmlns="http://xmlns.oracle.com/bpel/workflow/task">
    <title>
    Aprove Loan Request task
    </title>
    - <payload>
    - <approveLoanRequestPayload xmlns="http://xmlns.oracle.com/approveLoanRequest">
    <nameRequester>
    Tom
    </nameRequester>
    <loanRequest>
    1000
    </loanRequest>
    <currency/>
    <isApproved/>
    </approveLoanRequestPayload>
    - <approveLoanRequestPayload xmlns="http://xmlns.oracle.com/approveLoanRequest">
    <nameRequester>
    Tom
    </nameRequester>
    <loanRequest>
    1000
    </loanRequest>
    <currency/>
    <isApproved/>
    </approveLoanRequestPayload>
    </payload>
    <taskDefinitionURI>
    http://xesoa1.iteye.local:8894/orabpel/default/approveLoanRequest/1.0/ApproveLoanRequestTask/ApproveLoanRequestTask.task
    </taskDefinitionURI>
    <creator>
    Tom
    </creator>
    <ownerUser>
    bpeladmin
    </ownerUser>
    <ownerGroup/>
    <priority>
    3
    </priority>
    <identityContext>
    jazn.com
    </identityContext>
    <userComment/>
    <attachment/>
    - <processInfo>
    <domainId>
    default
    </domainId>
    <instanceId>
    100008
    </instanceId>
    <processId>
    approveLoanRequest
    </processId>
    <processName>
    approveLoanRequest
    </processName>
    <processType>
    BPEL
    </processType>
    <processVersion>
    1.0
    </processVersion>
    </processInfo>
    - <systemAttributes>
    <approvalDuration>
    0
    </approvalDuration>
    <assignedDate>
    2006-12-04T20:59:47.547+01:00
    </assignedDate>
    - <assigneeGroups>
    <id>
    Supervisor
    </id>
    </assigneeGroups>
    <createdDate>
    2006-12-04T20:59:47.555+01:00
    </createdDate>
    <digitalSignatureRequired>
    false
    </digitalSignatureRequired>
    <expirationDate/>
    <inShortHistory>
    true
    </inShortHistory>
    <isGroup>
    true
    </isGroup>
    <numberOfTimesModified>
    1
    </numberOfTimesModified>
    <passwordRequiredOnUpdate>
    false
    </passwordRequiredOnUpdate>
    <pushbackSequence>
    -1
    </pushbackSequence>
    <secureNotifications>
    false
    </secureNotifications>
    <state>
    ASSIGNED
    </state>
    <taskId>
    2043f79925decda1:559dec6a:10f4e2a1a3b:-7ac9
    </taskId>
    <taskNumber>
    10063
    </taskNumber>
    - <updatedBy>
    <id>
    Tom
    </id>
    </updatedBy>
    <updatedDate>
    2006-12-04T20:59:47.555+01:00
    </updatedDate>
    <version>
    1
    </version>
    <versionReason>
    TASK_VERSION_REASON_INITIATED
    </versionReason>
    <taskDefinitionId>
    default_approveLoanRequest_1.0_ApproveLoanRequestTask
    </taskDefinitionId>
    <taskDefinitionName>
    ApproveLoanRequestTask
    </taskDefinitionName>
    </systemAttributes>
    <systemMessageAttributes/>
    <titleResourceKey/>
    <callback/>
    <identificationKey/>
    </task>
    </initiateTaskResponse>
    </part>
    </initiateTaskResponseMessage>
    </messages>
    When I want to parse the payload to binding objects the method task.getPayloadAsElement returns a nullpointer exception. I'm using the Remote client variant of the API.
    I hope some one can help me on this issue.
    Thanks in advance!
    -Tom

    The task payload is not populated when fetching a list of tasks using the queryTasks() method. You need to explicitly call getTaskDetailsById() or getTaskDetailsByNumber() to retrieve the complete task with the payload. Then the method task.getPayloadAsElement() should return you the payload as expected.

  • Strange nullpointer exception

    When i excute the following the code, a nullpointer exception is thrown, however, the code (System.out.println ("qi guai" + price);) after the line (String title = ...) which causes the exception is still excuted..... Anyone can help me figure it out, thanks in advance! ( is it possible that it's due to the parsing of the xml in the first place?? I run the code in redhat, while the zip, xml files are created in windows using editplus)
    // getting the xml file from a zip file
    ZipInputStream bulk = new ZipInputStream(some InputStream);
    ZipEntry contentEntry = bulk.getNextEntry();
    byte[] temp = new byte[(new Long(contentEntry.getSize())).intValue()];
    bulk.read(temp);
    // Parsing the xml file...
    Document contentxml = null;
    InputStream is = new ByteArrayInputStream(temp);
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    try {
    DocumentBuilder builder = factory.newDocumentBuilder();
    contentxml = builder.parse (is);
    } catch (some Exception) {
    NodeList contentlist = contentxml.getDocumentElement().getElementsByTagName("content");
    // for each content
    for (int i=0; i<contentlist.getLength(); i++) {
    Element content = (Element) contentlist.item(i);
    String title = (content.getElementsByTagName("title")).item(0).getFirstChild().getNodeValue();
    String price = (content.getElementsByTagName("price")).item(0).getFirstChild().getNodeValue();
    System.out.println ("qi guai" + price);
    ps: the xml file:
    <root>
    <content>
    <title>bulktest</title>
    <price>Default</price>
    </content>
    </root>

    now solved

  • Nullpoint exception when population HtmlPanelGrid

    Hello All.
    I Have battled with this problem for two solid days now, I realy need you guys help on this one. The following code workes in another part of my program but on this part, I just can't get it right and end up with a nullpoint exception.
    Here are some code:
    test.jsp
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <f:view>
    <html>
    <head>
    <title>Test</title>
    </head>
    <body bgcolor="#ffffff">
    <h:form id="testform">
    <h:panelGrid id="listData" binding="#{TestBean.listData}" />
    </h:form>
    </body>
    </html>
    </f:view>
    TestBean.class (modified to sute forum posting)
    package beans.backingBeans;
    import beans.BeanFactory;
    //do relevant imports
    public class TestBean {
    private HtmlPanelGrid listData; //panelgrid that holds data
    public CreateSurveyBean() {
    populateData();
    public HtmlPanelGrid getListData() {
    return listData;
    public void setListData(HtmlPanelGrid listData) {
    this.listData = listData;
    * fetch data to HtmlPanelGrid
    * @param
    * @return void
    public void populateData() {
    Application application = FacesContext.getCurrentInstance().getApplication(); //getApplication context
    List children = getListData().getChildren(); //get children of component
    children.clear(); //clear children
    List dataSet = BeanFactory.geInstance().getData(); //get populationData from factoryBean
    for(int i=0; i<questionSet.size(); i++) {
         //irrelevant code that create som content for HtmlPanelGrid
    children.add(item);
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config xmlns="http://java.sun.com/JSF/Configuration">
    <managed-bean>
    <description>SurveyBean</description>
    <display-name>SurveyBean</display-name>
    <managed-bean-name>SurveyBean</managed-bean-name>
    <managed-bean-class>beans.backingBeans.SurveyBean</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
    </managed-bean>
    </faces-config>
    Nullpoint exception (from the webserver logfile)
    java.lang.NullPointerException     at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206)     at com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)     at com.sun.faces.application.ApplicationImpl.createComponent(ApplicationImpl.java:386)     at javax.faces.webapp.UIComponentTag.createComponent(UIComponentTag.java:999)     at javax.faces.webapp.UIComponentTag.createChild(UIComponentTag.java:1026)     at javax.faces.webapp.UIComponentTag.findComponent(UIComponentTag.java:739)     at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:429)     
    The exception seems to come from the row:
    List children = getListData().getChildren(); //get children of component
    in the testBean.class file. As I said before. This has worked in other parts of the program but now it doesn't. After some debugging runs I have found out that the getListData -method indead returns null, But I can't figure out why.

    Well, Sometimes the question is more complex than the answer ;-)
    Thanks for the help.
    It still puzzels me that I don't have to instanciate the HtmlPanelGrid at the other jsf page in my app. It seems as it gets instanciated by some pagical means because I don't have a
    HtmlPanelGrid data = new HtmlPanelGrid();
    or
    data = foo;
    Anywhere.
    The only thing that separates the two jsf pages from eachother is that in the case that workes, the page reloads several times before I present the HtmlPanelGrid. Can this be the answer somehow?
    Well... Anyhwo. It workes!

  • NullPointer exception in request.getParameter().indexof(.....) only in 6.1

    Hi
    I have one full working application (containing WAR + JAR) files.
    Right now this application is working absolutely fine in weblogic 6.0 sp1 on
    WINNT & Solaris.
    In this application, we accept events to save data from external
    applications like excel files.
    Now code in JSP is -->
    Line 1: String Data = request.getParameter("data");
    Line 2: Data.indexof(........);
    Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
    but I am NOT getting any exception in case of weblogic 6.0sp1.
    To my surprise, I am also printing request obj parameters values, whenever
    jsp get called from external source, there it is printing value of "data".
    I am totally clueless!!
    Any idea plz?
    Ashish Jain

    Looking very closely at request object contents..
    Wht i am sending (posting) from excel file-->
    xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet bu="SHKXXX"
    report="PBrandContr" sheet=
    "PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId="PIC"
    opt="P" ></reportSheet>
    But 6.1 interprets like this ---->
    key is --------> xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet
    bu="SHKXXX" report="PBrandContr" sheet=
    "PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId
    And Value is -------> "PIC" opt="P" ></reportSheet>
    This thing is causing all problems.
    I am not observing this kinda behaviour in 6.0sp1.
    Thanks
    Ashish Jain
    "Ashish Jain" <[email protected]> wrote in message
    news:[email protected]..
    Hi
    I have one full working application (containing WAR + JAR) files.
    Right now this application is working absolutely fine in weblogic 6.0 sp1on
    WINNT & Solaris.
    In this application, we accept events to save data from external
    applications like excel files.
    Now code in JSP is -->
    Line 1: String Data = request.getParameter("data");
    Line 2: Data.indexof(........);
    Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
    but I am NOT getting any exception in case of weblogic 6.0sp1.
    To my surprise, I am also printing request obj parameters values,whenever
    jsp get called from external source, there it is printing value of "data".
    I am totally clueless!!
    Any idea plz?
    Ashish Jain

  • ArrayList nullpointer exception

    I'm creating a game called bubblebreaker in Java, with the principle off model, view and controller classes.
    In my model class I create a list of bubble objects. In the view I make these bubbles visible and in the controller class I react on external events (mouseclicks, ...)
    My design is almost finished but I'm having some troubles removing my selected bubbles.
    When I have selected my bubbles I want to remove them with another click on that bubble.
    In the method deleteBub(Bubble delete) I will use the "set" method from the arraylist and make the bubble object "null":
    protected void deleteBub(Bubble delete) {
            bubbleList.set(delete.getNumber(), null);
    }This is the error:
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    +     at Model.deleteBub(Model.java:69)+
    It also points to this method:
    In the view class I check if the object is null:
    protected void drawBub(Bubble bubb, Graphics g) {
                if(bubb!=null) {
                    g.setColor(bubb.getColor());
                    g.fillOval(20*bubb.getX(), 20*bubb.getY(), 20*model.getRadius(), 20*model.getRadius());
                else System.out.println(bubb.getNumber() + " is null");
    }There are no compilation errors. I just get a nullpointer exception when I click the second time on a bubble, so when it should be made null.
    Edited by: Lektroluv on May 5, 2009 2:22 AM

    I think I'm not on the same level as you.
    The set command replaces the original bubble object with null, wright?
    So for example the list changes from this:
    new Bubble(.....)
    new Bubble(.....)
    new Bubble(.....)
    new Bubble(.....)
    ...to this:
    new Bubble(.....)
    null
    new Bubble(.....)
    null
    new Bubble(.....)
    new Bubble(.....)
    ...The second list isn't good, because it has "nulls" in it?!?!? --> nullpointer exception?
    What I've done next is in stead off replacing it with null, replacing it with new Bubble(BLACK ...)
    new Bubble(.....)
    new Bubble(BLACK ...)
    new Bubble(.....)
    new Bubble(BLACK ...)
    new Bubble(.....)
    new Bubble(.....)
    ...Edited by: Lektroluv on May 5, 2009 8:37 AM
    Edited by: Lektroluv on May 5, 2009 8:37 AM

  • JUTreeNodeBinding question (nullpointer exception in getAttribute)

    Hi,
    I've got a question about a piece of code. I've used a JTree which displays a recursive tree, which is working fine. I want to do something when a node is selected. I have the following piece of code:
    jTree1.addTreeSelectionListener(
       new TreeSelectionListener()
         public void valueChanged(TreeSelectionEvent e)
           DefaultMutableTreeNode node = (DefaultMutableTreeNode)jTree1.getLastSelectedPathComponent();
           if (node != null)
             JUTreeNodeBinding tnb = (JUTreeNodeBinding)(node.getUserObject());
             if (tnb!=null)
       });this code is taken from some example I've read on this forum and slightly modified (I can't find the original posting).
    Now, according to the sourcecompletion feature, tnb has methods like getAttribute, getAttributeDef. But when I call one of these methods on tnb (where the '...' is in the example above), I always get a nullpointer exception , somewhere inside the getAttribute call. (the variable 'tnb' itself is not null)
    Why wouldn't this work? Shouldn't the getAttribute calls give me access to the attributes of the row from the view that corresponds the selected element?
    The logwindow shows this for the nullpointer exception:
    Exception occurred during event dispatching:
    java.lang.NullPointerException
         oracle.jbo.AttributeDef[] oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeDefs()
              JUCtrlValueBinding.java:173
         oracle.jbo.AttributeDef oracle.jbo.uicli.binding.JUCtrlValueBinding.getAttributeDef(int)
              JUCtrlValueBinding.java:239
         void mypackage.PMyData$1.valueChanged(javax.swing.event.TreeSelectionEvent)
              PMyData.java:332
         void javax.swing.JTree.fireValueChanged(javax.swing.event.TreeSelectionEvent)
              JTree.java:2269
         void javax.swing.JTree$TreeSelectionRedirector.valueChanged(javax.swing.event.TreeSelectionEvent)
              JTree.java:2575
         void javax.swing.tree.DefaultTreeSelectionModel.fireValueChanged(javax.swing.event.TreeSelectionEvent)
              DefaultTreeSelectionModel.java:612
         void javax.swing.tree.DefaultTreeSelectionModel.notifyPathChange(java.util.Vector, javax.swing.tree.TreePath)
              DefaultTreeSelectionModel.java:1006
         void javax.swing.tree.DefaultTreeSelectionModel.setSelectionPaths(javax.swing.tree.TreePath[])
              DefaultTreeSelectionModel.java:288
         void javax.swing.tree.DefaultTreeSelectionModel.setSelectionPath(javax.swing.tree.TreePath)
              DefaultTreeSelectionModel.java:171
         void javax.swing.JTree.setSelectionPath(javax.swing.tree.TreePath)
              JTree.java:1088
         void javax.swing.plaf.basic.BasicTreeUI.selectPathForEvent(javax.swing.tree.TreePath, java.awt.event.MouseEvent)
              BasicTreeUI.java:2117
         void javax.swing.plaf.basic.BasicTreeUI$MouseHandler.mousePressed(java.awt.event.MouseEvent)
              BasicTreeUI.java:2683
         void java.awt.Component.processMouseEvent(java.awt.event.MouseEvent)
              Component.java:3712
         void java.awt.Component.processEvent(java.awt.AWTEvent)
              Component.java:3544
         void java.awt.Container.processEvent(java.awt.AWTEvent)
              Container.java:1164
         void java.awt.Component.dispatchEventImpl(java.awt.AWTEvent)
              Component.java:2593
         void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
              Container.java:1213
         void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
              Component.java:2497
         void java.awt.LightweightDispatcher.retargetMouseEvent(java.awt.Component, int, java.awt.event.MouseEvent)
              Container.java:2451
         boolean java.awt.LightweightDispatcher.processMouseEvent(java.awt.event.MouseEvent)
              Container.java:2210
         boolean java.awt.LightweightDispatcher.dispatchEvent(java.awt.AWTEvent)
              Container.java:2125
         void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
              Container.java:1200
         void java.awt.Window.dispatchEventImpl(java.awt.AWTEvent)
              Window.java:926
         void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
              Component.java:2497
         void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)
              EventQueue.java:339
         boolean java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component)
              EventDispatchThread.java:131
         void java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional, java.awt.Component)
              EventDispatchThread.java:98
         void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)
              EventDispatchThread.java:93
         void java.awt.EventDispatchThread.run()
              EventDispatchThread.java:85

    Bit of a coincidence.. I was just running into the same problem. But if you check getAttributeDefs(), you'll see that there only is one attribute available, namely the one that is being displayed in the tree. (the 'description'-attribute)
    Or at least, that's the case with my sitation.
    I would love to be able to address all available attributes, eg. foreign key fields, but that doesn't seem possible.
    At the moment, I'm using the following work-around, which of course is far from ideal:
    Key key = tnb.getRowKey();
    ViewObject vo = panelBinding.getApplicationModule().findViewObject("SomeVO");
    Row[] rows = vo.findByKey(key);
    if (rows == null || rows.length != 1)
      System.out.println("Notice: not 1 rows");
      return;
    Row row = rows[0];
    // now you can fetch all the attributes                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Getting nullpointer exception in Tomcap using getRealPath()

    Hi,
    I have the following code snippet, but getting nullpoint exception when I try to read a file in jsp.
    String realPath = this.getServletConfig().getServletContext().getRealPath("//AUDIT_TRAIL.xml");
    File fileDef = new File(realPath);
    Can someone tell me what I am doing wrong, or how i can read a file in jsp that works in tomcat 5

    why the double slash? / is not a special character ( b]backslash is, and so you would need \\)
    The file is sitting in the root of your web app?
    String realPath = this.getServletConfig().getServletContext().getRealPath("/AUDIT_TRAIL.xml");
    // and if it doesn't work, try this to see what it IS looking up
    String realPath1 = this.getServletConfig().getServletContext().getRealPath("/");
    System.out.println(realPath1);If you ware loading a file, you might consider using the getResourceAsStream() method.
    Cheers,
    evnafets

Maybe you are looking for

  • Firefox takes 4 minutes to start since the recent upgrade. Can you help?

    Since Firefox was upgraded to the latest version about 5 days ago, it has become extremely slow to start. It is taking just about 4 minutes. As soon as I experienced this problem, I removed it completely from my computer. I subsequently reinstalled i

  • Attempting to install Lightroom 5 on Mac with OSX ver 10.9.5, keep getting Exit Code 7 error

    I've tried three times to install Lightroom 5 on Mac with OSX ver 10.9.5, keep receiving an error. Exit Code:7. Anyone know a solution to this? I haven't been able to find anything in the forums. I appreciate the assistance.

  • Airport Utility Won't Open

    When I try to open Airport Utility, I get a message "You can't open the application Airport Utility because it is not supported on this architecture". Ive browsed this forum and haven't found a fix for this so I downloaded the newest version of Airpo

  • Securing Private Information

    Like a lot of companies we need to 'hide' certain columns of data - such as social security number - from most of our Discoverer community. I know that I can address this by creating two custom folders - one with the social security number column def

  • Black Catridge Printing Slightly

    I'm using deskjet 1510 series for about a year, but recently there's a problem on the black catridge. When I set the quality on plain paper from normal to best quality, the output paper always prints the words slightly. I try to use special paper but