How to check for null int/null Date

Heres the situation, there is an interface accepting an int value and a time/date that are not required(and are not set to anything automatically, i have no control over that part unfortunately), but I need to set up some sort of null/has value type of check to execute the setter when it does have a value, and ignore it when it doesnt. I am currently getting null pointers. here is my current set up:
//throws null pointer as set up below, I am assuming I might want to eliminate the "getDate" off of the end and that might clear it up.
if(data.getDate().getTime() != null)
          tempData.setDate(data.getDate().getTime());
//Not sure on this one yet, the value doesn't get set to anything so I am assuming it automatically gets assigned something like -1.
if(data.getId() >= 0){
          tempData.setId(data.getId());
          }

tsdobbi wrote:
I know data isnt null because it goes through a bunch of other tempData.set(data.get) items prior to hitting a snag on the above date I mentioned, when there is no value input for the date. and that particular null check I do there, does not work because it throws a null pointer in the if statement itself.
i.e. it traces the null pointer to
(if data.getDate().getTime != null) //this is the line the null pointer traces to.{color:#3D2B1F}if data is not null, then it must be the case that data.getDate() is null. Now that's what I call logic. W00t!{color}

Similar Messages

  • Want to know how to check for new line character in text file

    Hi All,
    I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
    Thanks
    static int readandwriteFile(Logger logger,String filepath){
              BufferedWriter out = null;
              BufferedReader in = null;
              File fr = null;
              int get_count = 0;
              try     {
              if(new File(filepath).exists())
              fr= new File(filepath);
                        System.out.println("FileName: "+fr);
                   if(fr != null){
    in = new BufferedReader(new FileReader(fr));
                             String text = in.readLine();
                             if(text != null){
                             get_count = Integer.parseInt(text);
                             in.close();
                             else{
                                  get_count = 0;
         else{                    
    out = new BufferedWriter(new FileWriter(filepath));
         out.write("0");
                out.close();
                   }          //Reading of the row count file ended.
              catch(Exception e) {
                   e.printStackTrace();
              finally {
                   try{               if (in != null) {
                             in.close();
              if (out != null) {
                             out.close();
              catch(Exception e) {
                        e.printStackTrace();
              return get_count;
         }

    You are calling the readline() only once which means you are reading only the first line from the file...
    Use a loop (Do-While preferably)
    do{
    //your code
    }while(text == "")

  • How to check for a function module with its description and functionality

    Hi all,
    How to check for a function module,with its description and its functionality,in detail how can I know the purpose of a particular function module,how to search for a function module which suits my requirement .

    Hi,
    You can search a FM of your requirement by putting in the Key words and searching for a FM. Like * KEYWORD * and then pressing F4.
    Say for example you need to search something regarding converstion.
    Search for * CONVERT * and press F4.
    If there is something specfic like converting date to something you can give
    DATE * CONVERT *
    OR
    CONVERT * DATE *  and press F4.
    Once you narrow down your search you will have a Function module documentation inside the Function module. Please note that all the FMs willl not have documentation.
    Regards,
    Pramod

  • How to check for the sub folder in the document library Is already Exist using CSOM?

    Hi,
    My requirement is to create the  folder and sub folder in SharePoint document library. If already exist leave it or create the new folder and the subfolder in the Document library using client side object model
    I able to check for the parent folder.
    But cant able to check the subfolder in the document library.
    How to check for  the sub folder in the document library?
    Here is the code for the folder
    IsFolder alredy Exist.
    private
    string IsFolderExist(string InputFolderName)
    string retStatus = false.ToString();
    try
    ClientContext context =
    new ClientContext(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryLink"]));
                context.Credentials =
    CredentialCache.DefaultCredentials;
    List list = context.Web.Lists.GetByTitle(Convert.ToString(ConfigurationManager.AppSettings["DocumentLibraryName"]));
    FieldCollection fields = list.Fields;
    CamlQuery camlQueryForItem =
    new CamlQuery();
                camlQueryForItem.ViewXml =
    string.Format(@"<View  Scope='RecursiveAll'>
    <Query>
                                            <Where>
    <Eq>
    <FieldRef Name='FileDirRef'/>
    <Value Type='Text'>{0}</Value>
                                                </Eq>
    </Where>
    </Query>
                                </View>",
    @"/sites/test/hcl/"
    + InputFolderName);
                Microsoft.SharePoint.Client.ListItemCollection listItems = list.GetItems(camlQueryForItem);
                context.Load(listItems);
                context.ExecuteQuery();
    if (listItems.Count > 0)
                    retStatus =
    true.ToString();
    else
                    retStatus =
    false.ToString();
    catch (Exception ex)
                retStatus =
    "X02";
    return retStatus;
    thanks
    Sundhar 

    Hi Sundhar,
    According to your description, you might want to check the existence of sub folder in a folder of a library using Client Object Model.
    Please take the code demo below for a try, it will check whether there is sub folder in a given folder:
    public static void createSubFolder(string siteUrl, string libName, string folderServerRelativeUrl)
    ClientContext clientContext = new ClientContext(siteUrl);
    List list = clientContext.Web.Lists.GetByTitle(libName);
    CamlQuery camlQuery = new CamlQuery();
    camlQuery.ViewXml =
    @"<View Scope='RecursiveAll'>
    <Query>
    <Where>
    <Eq>
    <FieldRef Name='FSObjType' />
    <Value Type='Integer'>1</Value>
    </Eq>
    </Where>
    </Query>
    </View>";
    //camlQuery.FolderServerRelativeUrl = "/Lib1/folder1";
    camlQuery.FolderServerRelativeUrl = folderServerRelativeUrl;
    ListItemCollection items = list.GetItems(camlQuery);
    clientContext.Load(items);
    clientContext.ExecuteQuery();
    Console.WriteLine(items.Count);
    if (0 == items.Count)
    //create sub folder here
    Best regards
    Patrick Liang
    TechNet Community Support

  • How to check the records in Master Data Table?

    Hi,
       I am trying to load the Master Data Table using the Flat File.Now how to check the records in Master Data Table?
    I done the following way:
    Info Provider->Info Object->Right Click->Display Data or Maintain Master Data
    But it's not showing the records.It's asking like CID from......To......
                                                                        CID(SID)from.............To.......
                                                                         here CID means customer id(characteristic).
    and showing some settings.
    Please guide me.
    Thanks & Regards

    Hi Sri,
    Go to T- code RSD1 and type your info object name and open the P- table in the infoobject then select execute symbol to see the updated  data in to master data info object.
    regards
    sap

  • How to check for locks on a table inside a program?

    Hi Gurus,
    Kindly let me know how to check for a lock on a particular table inside a program.I know that we can see locks on table held by a user from transaction SM12 but my requirement is to check for lock on MARA/MARC/MARV if lock exist then bypass my code else do the code.
    Kindly suggest or give code to check for a lock on a particular table.
    Thanks in advance
    Sudipto

    FAQ.  Locked.

  • How to check for updates on SCM packages?

    Hey guys,
    I wondered for some time now how to check for updates on SCM packages, i.e. -git
    or -svn ones. Updates for binary packages are automatically updated by pacman,
    no problem there. Checking for updates on non-SCM packages from the AUR is
    easily done with one of the various helper tools available (personally, I use
    slurpy).
    However, SCM packages can change without their PKGBUILD changing, so I'm not
    notified that I should recompile and update them.
    Is there a "proper" way of doing this? Am I missing something?
    Thanks in advance!

    If your system is booting then u can say that your bootblks are installed.Usually BootBlks are present in 0 & 1 slice of UFS Filesystem
    /usr/platform/platform-name/lib/fs/ufs
    directory where ufs boot objects reside.
    An x86 FDISK partition for the Solaris software begins with a one-cylinder boot slice, which contains the partition boot program (pboot) in the first sector, the standard Solaris disk label and volume table of contents (VTOC) in the second and third sectors, and the bootblk program in the fourth and subsequent sectors. When the FDISK partition for the Solaris software is the active partition, the master boot program (mboot) reads the partition boot program in the first sector into memory and jumps to it. It in turn reads the bootblk program into memory and jumps to it. Regardless of the type of the active partition, if the drive contains multiple FDISK partitions, the user is given the opportunity to reboot another partition.

  • How to check for impacts due to upgrade

    We are plannining to upgrade from 4.7 to ECC6..How to check for impacts on FTP'S,shell scripts and RFC's etc due to the assesment..Please suggest

    Hi,
    FTP's and Shell scripts are OS dependant not SAP or Database dependant so there will be no change at all unless you upgrade OS too. RFC's are not afected as per guides, notes and my experience.
    I´m doing an upgrade from 4.6C to 6.0 with connections with at least 10 systems and none of them had an issue during tests
    Good luck

  • How to check for bootblk on Disk

    Does someone know how to check for bootblk on solaris disk.

    If your system is booting then u can say that your bootblks are installed.Usually BootBlks are present in 0 & 1 slice of UFS Filesystem
    /usr/platform/platform-name/lib/fs/ufs
    directory where ufs boot objects reside.
    An x86 FDISK partition for the Solaris software begins with a one-cylinder boot slice, which contains the partition boot program (pboot) in the first sector, the standard Solaris disk label and volume table of contents (VTOC) in the second and third sectors, and the bootblk program in the fourth and subsequent sectors. When the FDISK partition for the Solaris software is the active partition, the master boot program (mboot) reads the partition boot program in the first sector into memory and jumps to it. It in turn reads the bootblk program into memory and jumps to it. Regardless of the type of the active partition, if the drive contains multiple FDISK partitions, the user is given the opportunity to reboot another partition.

  • Could someone please explain how to check for flashback, to a beginner?

    Could someone please explain how to check for flashback, to a beginner?  Thanks.

    Install all of the available software updates.  If you have flashback it will be automatically removed.

  • How to check for null values in bpel?? Please Help! very urgent!!!

    Hello Guys,
    I have a problem. I have an external webservice to which I have to post my request. My task is to create an Webservice and Service Assembly to which others would post request and get response. I have to create SA to deploy onto the bus.
    The problem is that there are optional elements in the request and response xsd's. In the Response sometimes certain feilds may come or they may not. for Example:- my response could contain a tag like this <firstName></firstName>
    I have to copy these feilds in my bpel process from one variable to another.(like in the mapper).
    My Question is , Is there any way in BPEL process or BPEL mapper where I could Check for null values in the request or response???
    Your inputs would be very helpful.
    Thanks
    Rajesh

    Thanks for replying man :)
    Ok I will be more clear.
    Here is a snippet of one of the xsd's that I am using.
    <xs:element name="returnUrl" nillable="false" minOccurs="0">
                        <xs:annotation>
                             <xs:documentation>Partner specifies the return URL to which responses need to be sent to, in case of
    Async message model.
    </xs:documentation>
                        </xs:annotation>
                        <xs:simpleType>
                             <xs:restriction base="xs:anyURI">
                                  <xs:maxLength value="300"/>
                                  <xs:whiteSpace value="collapse"/>
                             </xs:restriction>
                        </xs:simpleType>
                   </xs:element>
    This means that the return URL field can be there or it may not be there. But if it is there it cant be null because nillable=false. But the whole <returnURL> </returnURL> can be there or it may not be there because minOccurs=0.
    My requirement is , if returnURL is there in the response with a value, then in my BPEL mapper I should map it else I should not map it.
    Thats the issue.
    and Yes kiran, the node be non-existant.
    So can you please help me with this.
    Thanks
    Rajesh

  • How to check empty string and null? Assign same value to multiple variables

    Hi,
    1.
    How do I check for empty string and null?
    in_value IN VARCHAR2
    2. Also how do I assign same value to multiple variables?
    var_one NUMBER := 0;
    var_two NUMBER := 0;
    var_one := var_two := 0; --- Gives an error
    Thanks

    MichaelS wrote:
    Not always: Beware of CHAR's:
    Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is NOT null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How can I enforce automatic spell checking for selected fields of data entered by form users?

    I'd like to be able to enforce spell checking of selected fields in the forms that I've created using LiveCycle Designer 8.2 at run time, as opposed to design time.  I understand the version LCD 8 has a nifty new spell checker for form designers.  But I want to spell check the data entered by users using Acrobat Reader.  And I want to enforce the spell checking automatically on selected fields only.
    Presently it seems that users filling in my forms, must know how to manually right-click on each field and select "Spell Check" from the resulting dialog box in order to check for spelling errors in the data the user has entered in the form.
    I would like to discover a way to enforce spell checking in selected fields, just as I am able to do in forms created using Acrobat Pro.  In Acrobat Pro, I can set a property for each field to require spell checking.  but that feature seems to be missing in Livecycle Designer.
    I've check the Object model for XFA forms hoping that I might find a method I can call with a Javascript, to check spelling based on an event such as onBlur.  But I haven't found a spell check method.
    Am I missing something simple?  Is there a way to set each field to be spell checked when a user is filling in the form using the free Acrobat Reader?
    Our users are not sophisticated and requiring them to spell check each field separately just won't cut it...
    Any help on this will be greatly appreciated.
    Thanks!
    -David Bartholomew

    Hi David,
    Two things...
    At design time set the locale of the form to one that Acrobat spell checks. For example English (US) and English (UK) locales have spell checkers; however English (Ireland) does not. Check the Warnings tab to see if spell checking is supported for your locale.
    If your form locale supports spell checking then you can go to the button script below.
    If you form locale does NOT support spell checking then Stephanie has a great work around to force spell checking (http://forums.adobe.com/message/2233945#2233945).
    Bring a regular button onto the form and in the click event have the following:
    app.execMenuItem("Spelling:Check Spelling");
    Which will open the spell checker for all fields.  Thanks to Paul for extracting all of the accessible menu items (http://forums.adobe.com/message/1912914#1912914).
    Good luck,
    Niall

  • How to check for archivelog backup on a particular date or time?

    Dear All,
    We have RMAN full database, cumulative and archivelog backup(eg location: Diskgroup A) scheduled on a regular period basis. Assume archivelog location is Diskgroup B. The diskgroup B became full and unable to archive further, since no space. Unable to connect to database, connect internal only until freed error. alert log also shows that archiver error. So the solution for this to clear some space in diskgroup B by removing some old archive logs. In our environment, everyday the archive logs are stored in a separated folder arranged in date wise.  I can do that . But before clearing some space, i need to make sure that the folder( or any date folder what im going to delete) is backed up or not. How to check that? Any idea please?
    eg: i have archivelogs like this in folders
    01_11_2013/
    02_11_2013/
    03_11_2013/
    04_11_2013/
    05_11_2013/
    06_11_2013/
    If i want to remove the folder 01_11_2013/( and its contents ie archivelogs) , how to check whether the archivelogs in this folder 01_11_2013/ is backed up or not?
    Regards,

    Pradeepcmst wrote:
    Dear All,
    We have RMAN full database, cumulative and archivelog backup(eg location: Diskgroup A) scheduled on a regular period basis. Assume archivelog location is Diskgroup B. The diskgroup B became full and unable to archive further, since no space. Unable to connect to database, connect internal only until freed error. alert log also shows that archiver error. So the solution for this to clear some space in diskgroup B by removing some old archive logs. In our environment, everyday the archive logs are stored in a separated folder arranged in date wise.  I can do that . But before clearing some space, i need to make sure that the folder( or any date folder what im going to delete) is backed up or not. How to check that? Any idea please?
    eg: i have archivelogs like this in folders
    01_11_2013/
    02_11_2013/
    03_11_2013/
    04_11_2013/
    05_11_2013/
    06_11_2013/
    If i want to remove the folder 01_11_2013/( and its contents ie archivelogs) , how to check whether the archivelogs in this folder 01_11_2013/ is backed up or not?
    Regards,
    rman> list backup;
    Which begs the question .. why is the FRA getting filled in the first place?  Is it seriously undersized?  Are you not doing regular housekeeping with rman 'delete obsolete' and 'backup archivelog delete input'

  • How to check for sql errors

    if an sql statement is coded
    how to check whether the sql has executed without errors
    exception is one thing
    is there any other way or means for this
    if so, can any one help in this regard

    For Checking the SQL error you can trap the error number and error message and log into any table by following way
    CREATE OR REPLACE PROCEDURE FOR_ERROR_LOG as
    v_err_num NUMBER (20) := 0;
    v_err_msg VARCHAR2 (100) := NULL;
    BEGIN
    SQL statements like select, insert, update.
    EXCEPTION
    WHEN OTHERS THEN
    v_err_num := SQLCODE;
    v_err_msg := SUBSTR (SQLERRM, 1, 100);
    INSERT INTO error_table VALUES ('FOR_ERROR_LOG',NULL, v_err_num, v_err_msg, SYSDATE);
    COMMIT;
    END ;
    /

Maybe you are looking for

  • [solved] Xorg 1.8.1 + FGLRX Mouse and keyboard don't work...

    Beginning this week i installed Arch linux for the first time (several times infact) and i followed the installtion guide to get gnome working on my machine... pacman -Sy pacman -S xorg pacman -S gnome gnome-system-tools gnome-extra gdm gksu I also a

  • Reminders will not sync from iphone 4s to iPad 2 .. ???

    EVerything else in iCloud seems to work, but I don't see reminders on my iMac, or on the non-originating device. I have an iMac, iPad 2 and iphone 4s ... Please help!!!

  • IMac to external HDTV

    Hi, I am trying to connect my VIZIO HDTV to my new iMac so that I have some extra screen space. I bought a this cable... http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&ssPageName=STRK:MEWNX:IT&item=3701 40299754 I connected the mini-DVI cable to my iM

  • HELP - Export Transparent Image in CS3

    There used to be a very useful function in CS2 under Help which was Export Transparent Image. What happened to that function in CS3 and how the hell do I export transparent image now in CS3? Please help, this is quite urgent. Thanks.

  • Sales order error - Only 0 EA of material 24 is available

    Hi friends, I got this message during sales order creation 'Only 0 EA of material 24 is available'. I checked for solutions for similar problem in this forum by search button. Could get hold of two unanswered question. I tried possibilities listed th