"sendError" method as compared to "setStatus"; weired results; Help !

I am using weblogic server 8.1 sp5.
I have a servlet that generates an error code and returns a "message" as a text.
The problem is that iam not getting the "message" returned on my http protocol layer.
BUT when i use "setStatus" method instead of "sendError" method, everything works fine. setStatus is deprecated and we are told not to use it.
NOTE: When i run the servlet with sendError method, it works fine on the browser BUT it is not returned in my http (at the protocol layer).
Can somebody shed some light on the difference of this behavior?
Attached is the code.
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class MyWebServlet extends HttpServlet {
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        response.setContentType("text/html;charset=UTF-8");
        PrintWriter out = response.getWriter();
        out.println("This is MyWebServlet");
        String message= "Testing custom message of a 592 Error"
        response.sendError(592,message);
        out.close();
    protected void doGet(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
        processRequest(request, response);
}

i mean at the URL level.
We ran some sniffer N/W traces on the difference between the error code of 500 and 592(as on the servlet).
We see difference like ....the sniffer traces are little out of order but if you read carefully...you may see the diff.
I get "Unknown" for 592 error code whileas i get the whole string message with 500 error code.
Output with 592 error code:
0000  48 54 54 50 2f 31 2e 31 20 35 39 32 20 55 6e 6b   HTTP/1.1 592 Unk
0010  6e 6f 77 6e 0d 0a 43 6f 6e 6e 65 63 74 69 6f 6e   nown..Connection
0020  3a 20 63 6c 6f 73 65 0d 0a 44 61 74 65 3a 20 57   : close..Date: W
0030  65 64 2c 20 31 33 20 4a 75 6e 20 32 30 30 37 20   ed, 13 Jun 2007
0040  31 33 3a 31 32 3a 30 34 20 47 4d 54 0d 0a 43 6f   13:12:04 GMT..Co
0050  6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 32 34   ntent-Length: 24
0060  0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20   ..Content-Type:
0070  74 65 78 74 2f 68 74 6d 6c 0d 0a 58 2d 50 6f 77   text/html..X-Pow
0080  65 72 65 64 2d 42 79 3a 20 53 65 72 76 6c 65 74   ered-By: Servlet
0090  2f 32 2e 34 20 4a 53 50 2f 32 2e 30 0d 0a 0d 0a   /2.4 JSP/2.0....Output with 500 error code:
0000  48 54 54 50 2f 31 2e 31 20 35 30 30 20 54 65 73   HTTP/1.1 500 Tes
0010  74 69 6e 67 20 63 75 73 74 6f 6d 20 6d 65 73 73   ting custom mess
0020  61 67 65 20 6f 66 20 61 20 35 30 30 20 49 6e 74   age of a 500 Int
0030  65 72 6e 61 6c 20 53 65 72 76 65 72 20 45 72 72   ernal Server Err
0040  6f 72 0d 0a 43 6f 6e 74 65 6e 74 2d 54 79 70 65   or..Content-Type
0050  3a 20 74 65 78 74 2f 68 74 6d 6c 3b 63 68 61 72   : text/html;char
0060  73 65 74 3d 55 54 46 2d 38 0d 0a 43 6f 6e 74 65   set=UTF-8..Conte
0070  6e 74 2d 4c 61 6e 67 75 61 67 65 3a 20 65 6e 2d   nt-Language: en-
0080  55 53 0d 0a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67   US..Content-Leng
0090  74 68 3a 20 31 31 33 39 0d 0a 44 61 74 65 3a 20   th: 1139..Date:
00a0  57 65 64 2c 20 31 33 20 4a 75 6e 20 32 30 30 37   Wed, 13 Jun 2007
00b0  20 31 33 3a 32 34 3a 34 33 20 47 4d 54 0d 0a 53    13:24:43 GMT..S
00c0  65 72 76 65 72 3a 20 41 70 61 63 68 65 2d 43 6f   erver: Apache-Co
00d0  79 6f 74 65 2f 31 2e 31 0d 0a 43 6f 6e 6e 65 63   yote/1.1..Connec
00e0  74 69 6f 6e 3a 20 63 6c 6f 73 65 0d 0a 0d 0a      tion: close....null

Similar Messages

  • I purchased gems from a game and didnt get them because my method was declined i want to remove the order so i dont pay for it and so i can update my other apps and i want to remove the method i will be thankfull if someone help me

    i purchased gems from a game and didnt get them because my method was declined i want to remove the order so i dont pay for it and so i can update my other apps and i want to remove the method i will be thankfull if someone help me without updating the payment method i cant update my apps in my iphone i want to remove the method and remove the order i dont want it

    Click here and ask the iTunes Store staff for assistance.
    (125742)

  • When I try to access iTunes or safari, I get the following message:The procedure entry point QTCF_CFHTTP message set header field value could not be located in the dynamic link library QTCF.dll  I uninstalled and reinstalled.same result HELP!

    When I try to access iTunes or safari, I get the following message:The procedure entry point QTCF_CFHTTP message set header field value could not be located in the dynamic link library QTCF.dll  I uninstalled and reinstalled.same result HELP!

    Taken at face value, you're having trouble with a QuickTime program file there.
    Let's try something relatively simple first. Restart the PC. Now head into your Uninstall a program control panel, select "QuickTime" and then click "Repair".
    Does the repair go through okay? If so, are you able to launch iTunes and/or Safari now?

  • Need help in compare method of Comparator class

    I am writing a program that will display elements of a TreeMap in an order in which I want. By default the order is ascending. To change the order I need to override the compare method of the Comparator class.
    I've done this in my code below.
    I want to display keys with lower-case 1st and then those with upper-case.
    Please help.
    import java.util.*;
    public class MyComparator implements Comparator {
      public int compare(Object o1, Object o2) {
        String s1 = o1.toString();
        String s2 = o2.toString();
        return s1.compareTo(s2);
      public static void main(String[] args) {
        Map names = new TreeMap(new MyComparator());
        names.put("a", new Integer(1435)); 
        names.put("b", new Integer(1110));
        names.put("A", new Integer(1425));
        names.put("B", new Integer(987));
        names.put("C", new Integer(1323));   
        Set namesSet = names.keySet();
        Iterator iter = namesSet.iterator();
        while(iter.hasNext()) {
          String who = (String)iter.next();
          System.out.println(who + " => " +     names.get(who));
    }

    public int compare(Object o1, Object o2) {
        String s1 = o1.toString();
        String s2 = o2.toString();
        String ss1 = beginsWithLowerLetter(s1)? s1.toUpperCase() : s1.toLowerCase();
        String ss2 = beginsWithLowerLetter(s2)? s2.toUpperCase() : s2.toLowerCase();
        return ss1.compareTo(ss2);
    }

  • CompareTo method to compare files

    I have to compare each line from two files and say whether the lines are different or not. I don't exactly understand how to use the compareTo method in this type of situation. I'd appreciate any help.
    import java.util.*;
    import java.io.*;
    import java.net.*;
    import java.util.StringTokenizer;
    public class FileComparer
    public static void main (String[] args)
    String line, file="http://condor.depaul.edu/~jpetlick/extra/224/display.txt";
    String line2, file2="http://condor.depaul.edu/~jpetlick/extra/224/display2.txt";
    int lineCount = 0, wordCount = 0, lineCounter = 0;
    try
    URL URLfile = new URL (file);
    InputStream input = URLfile.openStream();
    BufferedReader buffer = new BufferedReader(new InputStreamReader(input));
    line = buffer.readLine();
    URL URLfile2 = new URL (file2);
    InputStream input2 = URLfile2.openStream();
    BufferedReader buffer2 = new BufferedReader(new InputStreamReader(input2));
    line2 = buffer2.readLine();
    while (line != null)
    if (line != line2)
    System.out.println("at Line " + lineCounter);
    System.out.println("DISPLAY.TXT " + line);
    System.out.println("DISPLAY2.TXT " + line2);
    lineCounter++;
    StringTokenizer st = new StringTokenizer(line);
    wordCount += st.countTokens();
    lineCount++;
    line = buffer.readLine();
    line2 = buffer2.readLine();
    System.out.println("\nA total of " + lineCounter + " were different between DISPLAY.TXT and DISPLAY2.TXT");
    System.out.println("DISPLAY.TXT contains:");
    System.out.println("\nTotal number of lines: " + lineCount);
    System.out.println("Total number of words: " + wordCount);
    catch (FileNotFoundException exception)
    System.out.println("The file " + file + " was not found.");
    catch (IOException exception)
    System.out.println(exception);
    }

    Change the lineif (line != line2)to if (!line.equals( line2))since strings are immutable in java "line != line2" will alwais evaluate to false in your case.
    equals actually compares the contents of the string.
    Kurt.

  • LinkedList, sort method with Comparable class

    I have created my own LinkedList class; named Linked (empty list) and LinkedNode. One of the method is sort() that use Comparable class. My problem is when I use my Linked class in my Library class (that uses Linked<Book> list = new Linked<Book>();) I face problem and the methods throw excpetion, and I discovered that this excpetion is from Comparable class.
    The sort() method in Linked class:
    public Linked<E> sort(){
              Linked<E> newList = new Linked<E>();
              System.out.println("Here is your prob");
              Comparable h = (Comparable)head;// head +compareTo
              System.out.println("Here is your prob");
              Linked<E> less = new Linked<E>();
              Linked<E> more = new Linked<E>();
              for(Linked<E> l = tail; !l.empty(); l=l.tail() ){
                   if(h.compareTo(l.head())>0)
                        less=less.add(l.head());
                   else
                        more=more.add(l.head());
              less=less.sort();
              more=more.sort();
              newList=less.join(more.add(head));
              return newList;
         }The sortCollection method in Library class:
    public void sortCollection()throws NullPointerException{
    list.sort();  } Also, I want to do my own Comparable class that switch between different sort modes.
    Hope my question is clear.
    Regards,

    The exception is
    java.lang.ClassCastException: Library.Book
         at Library.LinkedNode.sort(LinkedNode.java:58)
         at Library.BookLibrary.sortCollection(BookLibrary.java:145)
         at GUI.Projecc.actionPerformed(Projecc.java:351)
         at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
         at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
         at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
         at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
         at java.awt.Component.processMouseEvent(Unknown Source)
         at javax.swing.JComponent.processMouseEvent(Unknown Source)
         at java.awt.Component.processEvent(Unknown Source)
         at java.awt.Container.processEvent(Unknown Source)
         at java.awt.Component.dispatchEventImpl(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
         at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
         at java.awt.Container.dispatchEventImpl(Unknown Source)
         at java.awt.Window.dispatchEventImpl(Unknown Source)
         at java.awt.Component.dispatchEvent(Unknown Source)
         at java.awt.EventQueue.dispatchEvent(Unknown Source)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
         at java.awt.EventDispatchThread.run(Unknown Source)

  • Method from Random class yields unexpected results

    Hi,
    I understand that the following code should generate a random integer within the range of 0 - 3, but the range is actually 0 - 4. Can someone tell me why it doesn't behave as expected? Could it be the version of Java I'm using?
    Random rand = new Random(47);
    int a = rand.nextInt(4);Thanks!

    gluedtothecomputer wrote:
    You're right! It seemed to be producing unexpected results because I had incorporated a switch statement without breaks (part of my assignment). So, .nextInt() works as expected.
    Thanks!Since you didn't post that code or even allude to it, it would have been hard for use to guess that's what you did, right?
    That's why the best way to ask for help is for you to write and post a SSCCE .
    Keep that in mind for your next post.

  • Is there a method of reporting Adobe Captivate quiz results to a Google form or spread sheet?

    I found a widget for this but it has been discontinued. The guide published by Rod Ward lists this capability as "Don't even bother". What is that about?

    What do you mean by '...at the end'?
    Question Question Slides in Captivate - Captivate blog
    Question Question Slides - Part 2 - Captivate blog
    Through twitter I learned that you use CP6 and that you want that message on each question slides during ReviewMode.
    In CP6 system variable cpInReviewMode is not yet there. Create a user variable v_review, with a default value of 0. You'll have to toggle it to 1 when in Review Mode. That can be done using the system variable cpQuizInfoAttempts. When comparing its value to the total number of attempts, you know if you'll be getting in Review mode when getting back at the Score slide:
    use the On Enter event of the score slide
    create this conditional action:IF cpQuizInfoAttempts is equal to n       (where n is the number of attempts you allow in the Quiz Preferences on Quiz Level)
       Assign v_review with 1
    Create the text caption or shape with text for each slide and make that text container invisible in output (Properties panel). I will label the text container: Tx_quest1, Tx_quest2.....
    Use the On Enter event of each Question slide to trigger this conditional action
    IF v_review is equal to 1
        Show Tx_quest1

  • How 2 use URI.relativize method? (Unable to get expected results.)

    Example: 1) "C:/bla/na/bua/file1.xml"
    2) "c:/bla/na/file2.xml"
    expected result: "../file2.xml"
    or Example: 1) "C:/bla/file1.xml"
    2) "c:/bla/na/na/na/file2.xml"
    expected result: "na/na/na/file2.xml"
    Have someone elegant ideas(maybe other than in example)? All possible solutions will be welcomed :)
    Thank u all :)
    There is my code that doesn't works:
    File cFile = new File("C:/bla/file1.xml");
    File rFile = new File("c:/bla/na/na/na");
    URI cURI = cFile.toURI();
    URI rU = rFile.toURI();
    URI newU = cURI.relativize(rU);
    System.out.println("After relativization: " + cURI.toString() + " ,\n" + newU.toString() + " \n" + runU.toString());
    File newCFile = new File(cURI);
    File newF = new File(rU);
    System.out.println("NEW FILE: " + newF.toString());
    System.out.println("cFILE: " + newCFile.toString());What's the problem?
    Edited by: Nico_Gold on Feb 16, 2009 2:15 AM

    Nico, please post the code to your existing thread. There's no need to start a new one. I'm locking.

  • How to make find methods return a subset of the result?

    Take the multipage apps for instance,
    it is a common idea to return only a subset(No. 10~No. 30) of the full-list especially when there are millions item in the full-list.
    Please help me:)

    Maybe you're looking for something like a "Value List Handler"
    http://developer.java.sun.com/developer/restricted/patterns/ValueListHandler.html

  • Comparing Strings with "If" statements : help please. :-)

    I have an assignment for class... and having lots of trouble trying to figure out what I did wrong. I cannot find a solution.. if anyone can help me with this, it'd be much appreciated.
    Assignment Write a program to allow the user to calculate the area and perimeter of a square, or the area and circumference of a circle, or the area of a triangle.
    To do this, the user will enter one of the following characters: S, C, or T. The program should then ask the user for the appropriate information in order to make the calculation, and should display the results of the calculation. See the example program execution shown in class.
    The program should use dialog boxes.
    When expecting an S, C, or T, the program should reject other characters with an appropriate message.
    Get extra points for allowing both the uppercase and lowercase versions of a valid character to work. Name the program ShapesCalc.java.My error codes are
    incomparable types: java.lang.String and Char
    cannot find symbol variable output
    incomparable types: java.lang.String and Char
    incomparable types: java.lang.String and CharI've asked a friend and they said something about Strings cannot be compared in "If" statements... if that is the case.. how is this supposed to be arranged? If you can point me in the right direction, I will be very grateful! :-)
    What I have created so far
    import javax.swing.JOptionPane;
    public class ShapesCalc {
        public static void main(String[] args) {
          //Enter S,C, or T
          String input = JOptionPane.showInputDialog("Enter S,C, or T");
          //If Statements
          //Square
          if (input == 'S'){
               String lengthu = JOptionPane.showInputDialog("Enter length of a square");
               double length = Double.parseDouble(lengthu);
               double area = length * length;
               double perimeter = length * 4;
               String ouput = "The area is " + area + " and the perimeter is " + perimeter;
               JOptionPane.showMessageDialog(null, output);}
          //Circle
          else if (input == 'C'){
               String radiusu = JOptionPane.showInputDialog("Enter the radius of a circle");
               double radius = Double.parseDouble(radiusu);
               double area = 3.14159 * radius * radius;
               double circumference = 2 * 3.14159 * radius;
               String output = "The area is " + area + " and the circumference is " + circumference;
               JOptionPane.showMessageDialog(null, output);}
          //Triangle
          else if (input == 'T'){
               String baseu = JOptionPane.showInputDialog("Enter the base of a triangle");
               double base = Double.parseDouble(baseu);
               String heightu = JOptionPane.showInputDialog("Enter the height of a triangle");
               double height = Double.parseDouble(heightu);
               String output = "The area is " + (base * height) / 2;
               JOptionPane.showMessageDialog(null,output);}
          //Error Message
          else {
               String error = "Incorrect variable please enter S,C, or T only.";
               JOptionPane.showMessageDialog(null,error);}
          //Signature
          String signature = "Rodriguez, Markos has compiled a Java program.";
          JOptionPane.showMessageDialog(null,signature);
    }Edited by: ZambonieDrivor on Feb 22, 2009 6:52 PM

    ZambonieDrivor wrote:
    How would I go about on the extration of a single char from a String to make it comparable, I don't quite understand this part.Read the [Java API|http://java.sun.com/javase/6/docs/api/] for the String class and see what methods it has.
    I will convert the == to equals() method.If you want to compare primitives (ints, chars etc) then using == is fine. Only when comparing objects do you use the equals method.

  • PS4 rendering very "hot" compared to Bridge and LR2- HELP I am stuck

    Have done all kinds of tests and still get a difference nearly equal to setting the vibrance to +50 and the saturation to +6 in LR2 to somewhat equal the look of the imported image in PS2.
    Here are the facts:
    I have used Bridge to convert the NEFs  into DNGs using Camera Standard for the D700 with no other changes;
    Lightroom 2 and Bridge give the same rederings  in terms of colors and relationships of color to each other.  PS4 however, adds lots of yelow, brightens reds and blows highlights.  I have opened the file three ways in PS4, three attempts through Bridge with Save and convert, another time with Save and option click, another time with Open.  All three methods look equally bad.  I have opened the file directly through PS4, not using Bridge.  Just as bad.
    Now here is the interesting part:  when I take spot readings for the image in Bridge and the image in PS4, I get the same numbers.
    For example:  R,G,B for Bridge:  232,205,162   PS4:  232,205,163.
    Should look the same, right?
    PS4 Color Settings: Prophoto RGB, Gray gamma 2.2,Dot gain 10%,Convert to working profile, ask for mismatch, Engine: Adobe ACE, all other options not checked.
    If I desturate monitor colors by about 15% the image looks closer to Bridge and LR2, but is still more yellow. This is not a good solution for printing reasons, however.
    PS4 version 11.0.1     Mac OS/X version: 10.5.8  (not using the latest which is SnowLeopard.)
    I have sent the query to Adobe Support, but suspect they'll tell me I don't have support and then there is a time lag, also.
    Camera Raw: 5.5.097, PS4 11.01,  LR2: 2.5 with Camera Raw 5.5 in the dialog box
    WHAT VARIABLE HAS NOT BEEN CHANGED?

    Yes, sorry, you did mention that the Zoom has replaced the Netgear. Regardless, if the Zoom is providing the NAT & DHCP services ... which I would assume that it is by default, the AEBSn should be reconfigured as a bridge.
    With AEBSn still configured as a bridge, please try the following:
    o Power-down the Zoom, AEBSn, and computer(s); wait at least 10-15 minutes.
    o While the equipment is powered-down, connect one of your computers directly to any available LAN port on the AEBSn using an Ethernet cable.
    o Power-up the Zoom; wait at least 10-15 minutes.
    o Power-up (plug-into power) the AEBSn; wait at least 5-10 minutes.
    o Power-up the computer connected by Ethernet.
    The computer should now be able to gain Internet access. Please post back your results.

  • SortByTime method complains trying to figure out why help please

    public void sortByTime()
    // check out the bubble sort code in Module 11 for an
    // example of what to do in this method
    // your code here (please remove this line)
    double fastRat = -1;
    int last = this.getSize() - 1;
    boolean didSwap = true;
    Time ratDifference = null;
    //MazeResult topRat = null;
    MazeResult tmpRat = null;
    double totalSeconds = 0;
    //int j = 0;
    while (didSwap)
    last--;
    didSwap = false;
    for (int i = 0; i < last; i++)
    ratDifference = tmpRat.getStartTime() // java.lang.NullPointPointerException
    .getDiff(tmpRat.getEndTime());
    totalSeconds = totalSeconds + ratDifference.getHour() * 3600;
    totalSeconds = totalSeconds + ratDifference.getMinutes() * 60;
    totalSeconds = totalSeconds + ratDifference.getSeconds();
    if (fastRat < 0)
    //didSwap = true;
    //int temp = ; x[i] = x[i+1]; x[i+1] = temp;
    didSwap = true;
    --last;
    }java.lang.NullPointPointerException keep geting this
    test classpublic void testSortByTime()
    // Presort results
    MazeResult mazeResultObj = collection1.getMazeResult(0);
    assertNotNull(mazeResultObj.getRat());
    assertNotNull(mazeResultObj.getStartTime());
    assertEquals("01:15:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(1);
    assertEquals("01:10:15", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(2);
    assertEquals("01:01:45", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(3);
    assertEquals("00:50:00", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(4);
    assertEquals("00:57:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(5);
    assertEquals("01:20:45", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(6);
    assertEquals("01:00:05", mazeResultObj.getMazeTime());
    collection1.sortByTime();// Post sort results
    mazeResultObj = collection1.getMazeResult(0);
    assertEquals("00:50:00", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(1);
    assertEquals("00:57:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(2);
    assertEquals("01:00:05", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(3);
    assertEquals("01:01:45", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(4);
    assertEquals("01:10:15", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(5);
    assertEquals("01:15:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(6);
    assertEquals("01:20:45", mazeResultObj.getMazeTime());
    }I keep getting this java.lang.NullPointPointerException                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    public void sortByTime()
    // check out the bubble sort code in Module 11 for an
    // example of what to do in this method
    // your code here (please remove this line)
    double fastRat = -1;
    int last = this.getSize() - 1;
    boolean didSwap = true;
    Time ratDifference = null;
    //MazeResult topRat = null;
    MazeResult tmpRat = null;
    double totalSeconds = 0;
    //int j = 0;
    while (didSwap)
    last--;
    didSwap = false;
    for (int i = 0; i < last; i++)
    ratDifference = tmpRat.getStartTime() // java.lang.NullPointPointerException.getDiff(tmpRat.getEndTime());
    totalSeconds = totalSeconds ratDifference.getHour() 3600;
    totalSeconds = totalSeconds ratDifference.getMinutes() 60;
    totalSeconds = totalSeconds + ratDifference.getSeconds();
    if (fastRat < 0)
    //didSwap = true;
    //int temp = ; x[i] = x[i+1]; x[i+1] = temp;
    didSwap = true;
    --last;
    java.lang.NullPointPointerException keep geting this
    test class
    public void testSortByTime()
    // Presort results
    MazeResult mazeResultObj = collection1.getMazeResult(0);
    assertNotNull(mazeResultObj.getRat());
    assertNotNull(mazeResultObj.getStartTime());
    assertEquals("01:15:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(1);
    assertEquals("01:10:15", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(2);
    assertEquals("01:01:45", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(3);
    assertEquals("00:50:00", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(4);
    assertEquals("00:57:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(5);
    assertEquals("01:20:45", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(6);
    assertEquals("01:00:05", mazeResultObj.getMazeTime());
    collection1.sortByTime(); \\keep getting this java.lang.NullPointPointerException // Post sort results
    mazeResultObj = collection1.getMazeResult(0);
    assertEquals("00:50:00", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(1);
    assertEquals("00:57:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(2);
    assertEquals("01:00:05", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(3);
    assertEquals("01:01:45", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(4);
    assertEquals("01:10:15", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(5);
    assertEquals("01:15:30", mazeResultObj.getMazeTime());
    mazeResultObj = collection1.getMazeResult(6);
    assertEquals("01:20:45", mazeResultObj.getMazeTime());
    }I keep getting this java.lang.NullPointPointerException                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How can I implement a get method that lets me divide two values, Help plz

    I need to implement a method that divides the values return by two other methods but I keep getting an error message, I think its divide by zero error ( I am not too sure on the exact error msg as I do not have java installed on this pc as yet), here is my example,
    I have two get methods that take an int value so say
    getValueOne() as method one
    getValueTwo() as method two
    Now I have a third method that does the following,
    Public int getValueThree() {
    int value =0;
    value = (getValueOne() / getValueTwo())
    return value;
    I am not two sure on the exact code but it does something like this and I get an error. Could someone please guide me how I can successfully implement a get method that divides two values that are returned by two methods.
    Thanks,
    Zub

    Hi, thanks for your reply. Right, how can I go about to throw an exception? I can definitely give the exact code and error message tomorrow when I can access my home pc.
    And you are right there are some values that are zero! I am not very sure what throwing an exception means to be honest. Could you please give an example?
    Thanks...

  • Issue with Overall Result - Help

    Hello,
    I have a query with two restricted keyfigures (0amount used) as actual and forecast. While drilldown by fiscal period, the overall result shows totals for actual and plan separately. Business point of view, they want to have total of both (actual + remaining months of forecast). Is that possible?. If yes, anybody help me on this.  We don't want to create CKF to sum both the key figures.
    Thanks
    Viswa

    Appreciate your response Arun. Did the initial work of getting both actual and plan. Everything works and report is live now knowing that the problem of  overall result when we drill across by fiscal period. The report is very flexible/dynamic columns and users can enter multiple periods and any versions to use for various purposes. Looking for a solution without making changes to the query, somehow we can achieve/fix the overall result summation. Want to keep creating a CKF as last option.
    Thanks
    Viswa

Maybe you are looking for

  • Windows 8.1 Mobile Device Management and SCCM 2012 R2 - 'Turn on' option missing

    I am trying to test a virtual desktop with SCCM 2012 R2 integrated with Intune. There is no Configuration Manager client on the workstation, the Intune subscription is configured and enabled for Windows enrolment, AD is synchronizing with Intune, DNS

  • Order field on the requisition

    Hi Gurus, The moment we select account assignment category as F, the order number field appears on the purchase requsition. But right now the system is allowing to save the req eventhough we dont enter a order number. The doc is happy as long as i en

  • Sony .arw Photos

    I am trying to import photos into PP CC as part of my video timeline. PP throws a 'file format not supported'.  File format is sony raw .arw on a Mac (10.9.3).  As I just converted to a new macbook pro I have no adobe legacy programs installed   .arw

  • Saving PDF documents from websites

    Previously with Windows XP and Adobe Reader 7, every time when I download a PDF document from the web, the window opened to the last directory I saved into. Since I have acquired a new notebook which runs on Vista (with SP1), I have downloaded Adobe

  • My Premiere Elements 11 will not longer burn regular DVDs, but will burn Bue Ray

    I have reinstalled the program and still get the same erro messages when I try to burn a regular DVD.  Any ideas on how to fix this?  ( I have been burning regular DVDs for the last 4 months and have burned al leasr 15.