Call when not null

Hi,
I have a system which works fine but one part is not working. The user has the option to enter text into a comments box and when the user clicks submit an email should be sent if the comments box is not null, but at the minute an email is sent whether it is null or not.
This is where the email method is triggered:
if (receiptBean.getComments() != "")  //also tried != null
                         try
                              commentsEmail(receiptBean, fsSecurity, ht, receivedDespatches);
                         catch (DLRAppException e)
                            e.printStackTrace();
                            log.debugPrint(e.toString(), 0);
                            redirectURL = errorJSP;
                    }and this is called (even if box is null, which it shouldn't do):
     public void commentsEmail (DataEntryReceiptBean receipt, SecurityBean userDetails, Hashtable ht, ArrayList receivedCases)
          throws dlr.common.DLRAppException {
               SENDTO_EMAIL_ADDRESS = cf.readConfigParam("email.EmailAddress_Receipt");
             String rtn = "<br>";
             StringBuffer message = new StringBuffer();
             message.append(rtn + "<b><u>" + ht.get("36068") + "</u></b>" + rtn);
             message.append(rtn + "<b>" + ht.get("36080") + ":" + "</b>" + "Order Number Here" + rtn);
             message.append(rtn + "<b>" + ht.get("36071") + ":" + "</b>" + " " + userDetails.getUserName() + rtn);
             message.append("<b>" + ht.get("36070") + ":" + "</b>" + " " + receipt.getDespatchNoteID() + rtn);
             message.append("<b>" + ht.get("36079") + ":" + "</b>" + " " + receipt.getDespatchDate() + rtn);
             message.append("<b>" + ht.get("36072") + ":" + "</b>" + " " + receipt.getReceiptID() + rtn);
             message.append("<b>" + ht.get("36073") + ":" + "</b>" + " " + DateFormatUtility.getFormattedDateTime(receipt.getRecievedDate()) + rtn);
             message.append(rtn + "<b><u>" + ht.get("36077") + ":" + "</u></b>" + rtn);
            for (int i = 0; i < receivedCases.size(); i++) {
                PackingNoteBean packingNote = (PackingNoteBean) receivedCases.get(i);
               message.append(rtn + "<b>" + ht.get("36074") + ":" + "</b>" + " " + packingNote.getCaseNumber() + rtn);
               message.append("<b>" + ht.get("36075") + ":" + "</b>" + " " + packingNote.getPartCodeDescription() + rtn);
               message.append("<b>" + ht.get("36076") + ":" + "</b>" + " " + packingNote.getCaseDescription() + rtn);
            message.append(rtn + "<b><u>" + ht.get("36078") + ":" + "</u></b>" + rtn);
            for (int i = 0; i < receivedCases.size(); i++) {
                PackingNoteBean packingNote = (PackingNoteBean) receivedCases.get(i);
               message.append(rtn + "<b>" + ht.get("36074") + ":" + "</b>" + " " + packingNote.getCaseNumber() + rtn);
               message.append("<b>" + ht.get("36075") + ":" + "</b>" + " " + packingNote.getPartCodeDescription() + rtn);
               message.append("<b>" + ht.get("36076") + ":" + "</b>" + " " + packingNote.getCaseDescription() + rtn);
             message.append(rtn + "<b><u>" + ht.get("36069") + "</u></b>" + rtn);
             message.append(rtn + receipt.getComments() + rtn);
             // send email.
             if (sendEmail(new String[] { SENDTO_EMAIL_ADDRESS},
                 null,
                 "Receipt Comments",
                 message.toString(),
                 true,ht)) {
                 log.debugPrint("Email successfully sent", 3);
             else {
                 log.debugPrint(
                     "FATAL ERROR: Failed to send a comments email", 0);
         }Thanks to anyone who can help.

You have to compare Strings using their equals() method:String comment= receiptBean.getComments();
if( !(comment == null || comment.equals("")) ) // non-empty commentkind regards,
Jos

Similar Messages

  • How to end a call when not in the phone app?

    OS: 10.2.1
    I like to multitask when on a call so after taking a call I might be inside another app or in the hub, basically anywhere except the phone app. 
    My trouble is.. how can I quickly end a call when I'm done?  
    Swiping up to exit the app I'm in, then pressing the button on the lower left to enter the phone app, then pressing the hang up button sometimes takes up to 5 seconds dependong on the speed of the phone at the time.  Those five seconds of silence at the end of a call can be a little awkward. 
    Any faster way to just hang up a call when NOT in the Phone app?

    You should see the phone icon on the bottom left with the call counter on it. Simply touch that to bring the phone app backup quickly and then hang up.
    1. Please thank those who help you by clicking the "Like" button at the bottom of the post that helped you.
    2. If your issue has been solved, please resolve it by marking the post "Solution?" which solved it for you!

  • My iPad is randomly placing FaceTime calls when not in use

    I got an iPad for my birthday and all is well except while I'm at work and my iPad is at home, my iPad will place calls to people.  I've been at my desk at work when my iPhone (which is sitting on the desk ... locked and nowhere near my hands) will show a FaceTime call coming from myself.  Since I didn't have this problem before I got the iPad, I am assuming it is my iPad placing the call.  Upon returning home, I can see the calls on the iPad and will get texts from friends and family saying I kept FaceTiming.  Aside from disabling FaceTime (I still want to use it ... only on my terms!), what the heck?

    iOS 7 defaulted a lot of stuff to on htat you may not need. Such as background app refresh, background app updates and tons of notifications. You might want to look  in the settings and check.

  • APEX 3.0 Displaying the URL link for a column value ( only when not null )

    Consider the example :
    I have the following table with a column that may have urls to documents
    Row Column ( url_column )
    1 http://xyx.com/doc/doc1.pdf
    2 http://xyx.com/doc/doc2.pdf
    3 (null)
    How do i display the column so that a the link shows up only if a value exists.
    Setting the URL to #URL_COLUMN# in the 'Column Attributes' screen creates a problem when the value is null ( for Row 3 in above eg.)
    Thanks for your help

    I would handle it in the query itself, something like
    select x, y, z,
           decode(url_column, null, null,
                    '<a href="'||url_column||'">'||
                     url_column||'</a>') as url_column
      from wherever

  • Not receiving video calls when not on Skype

    This Topic has been Moved for correct placement

    Hi and welcome to the community! Since you're new please be sure that you have checked out our Discussion guidelines.
    That sounds really strange. I would suggest that you first of all try to boot your phone into safe mode to see if the problem may be related to any 3rd party app that you have installed in your phone:
    http://talk.sonymobile.com/t5/FAQ/How-to-boot-your-phone-into-safe-mode/m-p/348008#U348008
    What are your thoughts about this forum? Let us know by doing this short survey.

  • Null Pointer exception returned when object is not null!

    I've isolated the problem and cut down the code to the minimum. Why do I get a null pointer exception when the start method is called, when the object objJTextField is not null at this point???? I'm really stuck here, HELP!
    (two small java files, save as BasePage.java and ExtendedPage.java and then run ExtendedPage)
    first file
    ~~~~~~~
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public abstract class BasePage extends JFrame implements ActionListener
    private JPanel objJPanel = null;
    public BasePage()
    setSize(300,200);
    Container objContentPane = getContentPane();
    objJPanel = new JPanel();
    createObjects();
    createPage();
    // Add panels to content pane
    objContentPane.add(objJPanel);
    public void addComponentToPage(JComponent objJComponent)
    objJPanel.add(objJComponent);
    public void addButtonToPage(JButton objJButton)
    objJButton.addActionListener(this);
    objJPanel.add(objJButton);
    public void actionPerformed(ActionEvent objActionEvent)
    System.out.println("Action performed");
    userDefinedButtonClicked(objActionEvent.getActionCommand());
    // overide
    public abstract void createObjects();
    public abstract void createPage();
    public abstract void userDefinedButtonClicked(String sActionCommand);
    file 2
    ~~~~
    import javax.swing.*;
    public class ExtendedPage extends BasePage
    private JTextField objJTextField = null;
    private JButton objJButtonBrowse = null;
    public ExtendedPage()
    super();
    public void createObjects()
    objJTextField = new JTextField(20);
    objJButtonBrowse = new JButton("Start");
    objJButtonBrowse.setActionCommand("START");
    public void createPage()
    addComponentToPage(objJTextField);
    addButtonToPage(objJButtonBrowse);
    public void userDefinedButtonClicked(String sActionCommand)
    if ((sActionCommand != null) && (sActionCommand.equals("START")) )
    start();
    private void start()
    objJTextField.setText("Doesn't work");
    public static void main(String[] args)
    ExtendedPage objEP = new ExtendedPage();
    objEP.show();

    Hello ppaulf,
    Your problem is in your ExtendedPage.java file. You can fix this by changing the line
    private JTextField objJTextField = null;to:
    private JTextField objJTextField = new JTextField();This creates a proper instance.
    Good luck,
    Ming
    Developer Technical Support
    http://www.sun.com/developers/support

  • Validator not called due to null value

    Hello everyone,
    I'm creating a custom component that holds children i.e. an HtmlSelectOneMenu and HtmlInputText.
    The custom component class is UICombo and I want to attach a Validator to this component that performs a check on the values of the children in this case the values of the select and input fields.
    public class ComboValidator implements Validator {
        static Logger log = Logger.getLogger(ComboValidator.class);
        public void validate(FacesContext context, UIComponent component, Object value) {
            log.debug("validate() - value:" + value);
    }Here's the hitch. ComboValidator is never called because the submitted value to the UICombo is of course null.
    Can you think of any workarounds? I'd rather not use a third idden component with an attached validator method binding since I'd rather keep the combo component and its validator self-contained.
    The assumption that validators should not be called when the input is null seems problematic imo.

    How about implementing validate() method for the custom component?

  • I've found two bugs in iOS 7. 1) declined calls does not appear as missed calls on the lock screen/notification centre. 2) when bluetooth is enabled from control center, it does not connect to an already paired bluetooth device

    I've found two bugs in iOS 7:
    1) declined calls does not appear as missed calls on the lock screen/notification centre - iOS 7.0.2.
    2) when bluetooth is enabled from control center, it does not connect to an already paired bluetooth device automatically - iOS 7.0.

    We are all users here, just like you, but you can tell Apple about it by using this link:
    Apple - iPhone - Feedback

  • Pop up message when a field is not null

    I am trying to have a message pop up if one or more text fields have had data entered when the user tries to submit the page. Is there any easy way to check if the field has been entered, and only showing the message when this is true.
    Thanks,
    Mike

    You could use a Validation it sounds like the perfect solution. Validations are used to check portions of the screen and deny SUBMIT until the validation checks pass.
    To create a validation, go to the basic edit screen for the page and look in the second column. You can create either a page-level validation or an item-level validation (my favorite). It has a few easy validations like NOT NULL already selected, or you can write your own code to check something complicated.
    Hope that helps.

  • Listeners keyDown are not being called when keyDown in an popup l

    For some reason the listeners titleWindow_keyDown are not being called when keyDown in an popup like so:
    <?xml version="1.0" encoding="utf-8"?>
    <s:SkinnablePopUpContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
                               xmlns:s="library://ns.adobe.com/flex/spark"
                               xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"  keyDown="titleWindow_keyDown(event);" >
        <s:TitleWindow title="Edit Complaint" close="close()">
    private function titleWindow_keyDown(evt:KeyboardEvent):void {
                        if (evt.charCode == Keyboard.ESCAPE) {
                            close();
    Any ideas friends??

    But in my code it is a child inside SkinnablePopUpContainer:
    <s:SkinnablePopUpContainer xmlns:fx="http://ns.adobe.com/mxml/2009"
                               xmlns:s="library://ns.adobe.com/flex/spark"
                               xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300"  keyDown="titleWindow_keyDown(event);" >
        <s:TitleWindow title="Edit Complaint" close="close()">

  • Region Monitoring iOS 7 : didEnterRegion method is not calling when app is killed by user or by OS in iOS 7 only. It is working fine when it is in background. and the same code is working fine with iOS 6 for both app in suspended mode and background mode.

    Region Monitoring iOS 7 : didEnterRegion method is not calling when app is killed by user or by OS in iOS 7 only. It is working fine when it is in background. and the same code is working fine with iOS 6 for both app in suspended mode and background mode. What changes I have to made to work great in iOS 7 also.

    I rewrote code for debugging purpose and tried to catch error using GetLastError();  method,
    but it only printed 0. Below is code snippet; I think Create() throw an exception
    and code goes to catch block. 
    LONG ConnectTS(CString strIP, UINT n_Port)
    try{
              ErrorLog(0,0,"ConnectTS is calling Create [is going to call]","");
              if(!Create())
    // Exception Line
    n_Err = GetLastError();
    return NET_INIT;
    catch(...)
                       DWORD errorCode = GetLastError();
                       CString errorMessage
                       errorMessage.Format("%lu",errorCode);
                       ErrorLog (0, 0, "Image
    System", (LPTSTR)(LPCTSTR)errorMessage);
                       return  IS_ERR_WINDOWS;
    Output: -
    ConnectTS is calling Create [is going to call]
    Image System
    0

  • Hello, I have bought an iphone two weeks ago. Now I have a big problem. Whenever I receive a phone call, the caller could not heare me only when I switch to the handsfree speakers phone. The same issue accurs, when I call somebody.

    I have an iphone and whenever I receive a phone call, the caller could not hear me only when I switch to the hansfree speakers phone. the same issue occurs whenever I call somebody. Could anybody help me?

    Hi
    You should ask your relative to physically take the iPhone to the store rather than shipping it because as diesel vdub has said:
    "No Apple store will accept an iPhone shipped to them"
    All you have to do is safely pack and ship your iPhone from the Philppines to your California-based relative.
    HTH?
    Tony

  • How to decline call when the phone is not in lock screen

    Why is there no option to decline a call when it rings like for the old iOS? I need an option to decline a call, not remind me later or send a message

    It does not solve the problem for me. I liked to decline people and instantly call them back (cause I have bonus calls) by simply sliding their name in the missed call that appeared right affter I declined.
    Now if I decline by double tapping the power button the missed call does now show up on the notification screen, so I have to unlock, go to my contacts and call back... Do I need to say this is terribly worst???

  • I am not able to answer talkatone phone call when iphone is in lockscreen, I am not able to answer talkatone phone call when iphone is in lockscreen

    I am not able to answer talkatone app phone call when iPhone is in lock-screen mode.  I miss all calls because by the time I unlock my phone the notification disappears and there is no way to accept the call.  What can I do to be able to answer calls via the talkatone phone app from the lock-screen mode? 

    Did you try what I suggested in the post you already made for this problem?

  • Add call button not present when in active call

    Hi all,
    I have a MacBook Pro (the latest one with Yosemite 10.10.2). I dont have an iPhone so no integration has been done. I was watching Modern Family - "Connection Lost" episode and I saw Claire adding another call when she was in a Facetime video call.
    But I dont have a green color "Add Call" button on the top right in my device. I searched online and found info similar to what she did like "End current call and answer" or "Accept call" options when another call comes in. But I cant find these in mine.
    Can someone help me out with this?

    Salim,
    In APEX 4.0 we moved the server-site add-row functionality to a client-site implementation, i.e. instead of having the page be reloaded every time you add a row, this is now done on the client without reload. Tabular forms that were created prior to 4.0, but then upgraded to 4.0 or later, keep the original server-site add row function, unless they are manually upgraded.
    Not sure why your tabular form might have stopped working, but if you could install your app on apex.oracle.com, I'd be happy to take a look. In general though, I would recommend manually updating your old tabular forms to use the client based add row feature. To do this, just edit the add-row button, and change the button action from "Submit Page" to "Redirect to URL" and as the URL Target, enter "javascript:addRow();". That's all. You could also delete the add row page procress, and the MRU process that was associated with the add row button, because they are no longer needed nor used.
    Regards,
    Marc

Maybe you are looking for