PreparedStatement use, null check

I'm using PreparedStatements in a number of queries that probably don't benefit from it and wondering if the problems I'm having are worth the extra I/O efficiency and security benefits. Thoughts?
Additionally, I'm having trouble knowing for sure if my resultsets from a PS are empty. Here's some sample code:
string sql = "SELECT * FROM atable WHERE id = ?";
PreparedStatement ps = c.prepareStatement(sql);
ps.setString(1, ID);
ResultSet rs = ps.executeQuery();
if(rs == null)
rs.next();
x = rs.getString("acolumn");
I know rs.next() executes because of some debug statements I've worked into the real code, but at getString("acolumn") I get "Exhausted Resultset." When I run the query by hand, it's an empty result. So what should I be using to check for null or 0 row count?

I'm using PreparedStatements in a number of queries
that probably don't benefit from it and wondering if
the problems I'm having are worth the extra I/O
efficiency and security benefits. Thoughts?
Additionally, I'm having trouble knowing for sure if
my resultsets from a PS are empty. Here's some
sample code:
string sql = "SELECT * FROM atable WHERE id = ?";
PreparedStatement ps = c.prepareStatement(sql);
ps.setString(1, ID);
ResultSet rs = ps.executeQuery();
if(rs == null)
rs.next();
x = rs.getString("acolumn");
I know rs.next() executes because of some debug
statements I've worked into the real code, but at
getString("acolumn") I get "Exhausted Resultset."
When I run the query by hand, it's an empty result.
. So what should I be using to check for null or 0
row count?Hi,
Your code should read:
ResultSet rs = ps.executeQuery();
if (rs.next()) {
    // do whatever
}next returns a boolean that says if there was a next or not.
/Kaj

Similar Messages

  • Using null value of item

    Hi All,
    I use this part-of-code in pl/sql statement in a 'where' clause in order to filter records to those that took place between some hours range:
    ..... and to_char(STARTDATE,'HH24:MI:SS') between NVL(:P3_HOURS_FROM,'00:00:00') and NVL(:P3_HOURS_TO,'23:59:59')
    P3_HOURS_FROM & P3_HOURS_TO are combo box items with LOV (0:00,0:30,1:00 ....etc that returns 00:00:00,00:30:00,1:00:00 respectively). I use a null value which is displayed as '--:--'.
    when i choose some hour range the rsults are correct. the problem is when i choose null values. there is no results to the report, probably (i guess) because it somehow translate the (null) time value to the same value (and it's obvious that between same time values there isn't any result).
    so i guess i use 'null' value in an inappropriate way.
    Can u tell me what do i do wrong???

    Are you sure you are returning NULL and just displaying '--:--' in your LOV?
    If the state of your LOV is becoming '--:--' then this does not equal null in PL/SQL land.
    I presume you are also submitting after changing your LOVs?
    You can check the state of your items by clicking the session state in the developers toolbar at the bottom. See what your items are being set and report back!
    Ben

  • Null check for "ora:readFile()" function

    Hi,
    I want to check whether a particular file is present in a given folder in our local server.In case of success scenario the "ora:readFile()" function is working fine but if the file is not present in the same folder then,this function is getting failed with system exception ,reason:-message can't be null.
    Can't we add a null check for this and continue the flow further?
    Regards,
    N.Das

    Hi,
    You should first try list operation in file adapter to check for the file then use the readfile() conditionally if file is found.
    Try the function to mention the path as
    ora:readFile(concat('file:',bpws:getVariableData('Invoke1_FileListing_OutputVariable','filelist','/ns1:filelist/ns1:file/ns1:directory'),'/',bpws:getVariableData('Invoke1_FileListing_OutputVariable','filelist','/ns1:filelist/ns1:file[1]/ns1:filename'))).
    This will get you the content in base64encoded format. You can then decode it to get the text format data.
    Thanks,
    Durga
    - It is considered good etiquette to reward answerers with points (as "helpful" - 5 pts - or "correct" - 10pts).*

  • Table joins, templates, null-checks, layer confusion and localization

    Hello everyone, this is my first post on this network.
    I am designing a website that does several things, one of which is to display latest news items on the home page.
    The news items are stored in the database as a table with a basic structure: id, poster_id, postDate, subject, body
    where id is the primary key, poster_id is a foreign key to the users table, postDate is the date at which posted and the rest is obvious.
    I want to display these items with a basic template:
    subject by author at postDate
    body
    <hr />
    When a user changes his/her username, the updated username will be shown on the news listing. This is the reason why I'm using a foreign key.
    I've defined poster_id such that it can be set as NULL, meaning it was not created by a registered user, but a guest. Don't ask me why I'd want a guest to post a news item :P
    When it comes to getting the news posts from the database and resolving the poster_id to a username i just use a join. However, when poster_id is NULL i obviously don't get a username for that post but a NULL. The word "Guest" has to come in when the poster_id is null. So in my template you'd think i could just put a null check as I can't do it in sql (as far as i know anyway).
    Now, I'm using localization on the site and the word "Guest" is different depending on the locale. So you'd think i could just use a null check and a locale->get('guest_username') and that will return the word "Guest" in the right language.
    If I want to view news on different pages, and more importantly, in different forms such as just author: subject, I come across a problem. I want to avoid having to repeat that null check code on every template that views news posts. Complicating things, I want anywhere that display a username to do the null check and return the locale'd guest username if it is a null.
    Where do I put this null check? The locale object is part of the model layer, because other model objects use it.
    Is this the presentation or the model layer's responsibility? I am relatively new to this design patterns thing, but I'm getting there :) I've thought about using wrapping classes but I'm just not sure at this point and I need smart people's opinion :)
    I hope I was able to explain my problem properly and I thank anyone in advance for taking the time to read and give their insight on such a problem. Thank you :)

    antirealm wrote:
    Hello everyone, this is my first post on this network.
    I am designing a website that does several things, one of which is to display latest news items on the home page.
    The news items are stored in the database as a table with a basic structure: id, poster_id, postDate, subject, body
    where id is the primary key, poster_id is a foreign key to the users table, postDate is the date at which posted and the rest is obvious.
    I want to display these items with a basic template:
    subject by author at postDate
    body
    <hr />
    When a user changes his/her username, the updated username will be shown on the news listing. This is the reason why I'm using a foreign key.
    I've defined poster_id such that it can be set as NULL, meaning it was not created by a registered user, but a guest. Don't ask me why I'd want a guest to post a news item :PI think this is a fundamental mistake. A better design, IMO, would be to have an explicit GUEST or anonymous poster ID, but not null.
    When it comes to getting the news posts from the database and resolving the poster_id to a username i just use a join. However, when poster_id is NULL i obviously don't get a username for that post but a NULL. The word "Guest" has to come in when the poster_id is null. So in my template you'd think i could just put a null check as I can't do it in sql (as far as i know anyway).See above.
    Now, I'm using localization on the site and the word "Guest" is different depending on the locale. So you'd think i could just use a null check and a locale->get('guest_username') and that will return the word "Guest" in the right language.Localization should be a UI issue. It should be all sorted out by the time you get to the persistence layer.
    If I want to view news on different pages, and more importantly, in different forms such as just author: subject, I come across a problem. I want to avoid having to repeat that null check code on every template that views news posts. Complicating things, I want anywhere that display a username to do the null check and return the locale'd guest username if it is a null.If it's hard to do, it's worth re-thinking. Don't use null when there are sensible non-null alternatives.
    Where do I put this null check? The locale object is part of the model layer, because other model objects use it.
    Is this the presentation or the model layer's responsibility? I am relatively new to this design patterns thing, but I'm getting there :) I've thought about using wrapping classes but I'm just not sure at this point and I need smart people's opinion :)L10N and I18N issues should be the responsibility of the presentation layer, IMO.
    %

  • Error : Access not possible using "null" objects reference

    Hello.
    i am working with a zbapi.
    i called a external email program in this bapi,everything is working fine over here.
    In webdynpro java they mapped my bapi and starting working from there.
    every functionality is working fine but regarding this email stuff it is showing an error as access not possible using null objects reference.
    where could be the possible error.
    is it in webdynpro or in abap side.

    Raghu,
    You are right. When it comes from the WD Java, may be you are not passing any value at all. You can trace it by these ways.
    1. Check it using SE37, make sure everyhting is fine.
    2. Print all the values that you are passing to the RFC in the execute RFC method().
    3. using ST05 transaction in R/3, enable RFC and SQL trace, check what is passing in between web dynpro and R/3.
    Moreover paste your error message here.
    Thanks,
    Raj.

  • Java Thread run some day then death ,use jstack check it,it  run again, is

    hi all;
    I write a java program run as linux daemon,
    command line is >nohup java myclass &>/dev/null
    it run some day ,then death, ,look like death lock ,but thread not exit
    if i use jstack checke it ,it run again!
    my env is
    Linux version 2.4.20 ,redhat linux
    jstack 14616
    Attaching to process ID 14616, please wait...
    Debugger attached successfully.
    Client compiler detected.
    JVM version is 1.5.0_02-b09
    my program like
    commandline nohuo java StartUp >/dev/null &
    public Class StartUp{
    public static void main(String[] argv){
       Connection con = getDBConnection
         Thread t1 = new Thread(new MyRun(con));
      t1.start();
         Thread t2 = new Thread(new MyRun(con));
      t2.start();
      for(;;){
      Thread.sleep(100);
    public class MyRun implements Runnable{
    Connection con;
    public MyRun(Connection c){con = c;}
    public void run(){
         for(;;){
         object = readData(con);
         process(object);
         log.info("watch info ....");
         Thread.sleep(500);
    }

    Today i found my program hang, i use kill -SIGQUIT to print thead trace
    but i can't find the bug,after send singal ,the thread run again!
    another question
    how to detect a thread is hang?and use another thread restart it?
    thread dump
    Full thread dump Java HotSpot(TM) Client VM (1.5.0_02-b09 mixed mode, sharing):
    "pool-1-thread-2" prio=1 tid=0x08447858 nid=0x5aa6 waiting on condition [0x4680f000..0x4681021c]
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1772)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
    at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:470)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:674)
    at java.lang.Thread.run(Thread.java:595)
    "pool-1-thread-1" prio=1 tid=0x08392740 nid=0x5aa5 waiting on condition [0x4678f000..0x4678ff1c]
    at sun.misc.Unsafe.park(Native Method)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:118)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1772)
    at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:359)
    at com.ejet.mms.MmsSend.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
    "Low Memory Detector" daemon prio=1 tid=0x080a18b0 nid=0x5a9f runnable [0x00000000..0x00000000]
    "CompilerThread0" daemon prio=1 tid=0x080a0360 nid=0x5a9e waiting on condition [0x00000000..0x417e2c04]
    "Signal Dispatcher" daemon prio=1 tid=0x0809f478 nid=0x5a9d waiting on condition [0x00000000..0x00000000]
    "Finalizer" daemon prio=1 tid=0x080989e8 nid=0x5a9c in Object.wait() [0x413e4000..0x413e441c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x66c18420> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
    - locked <0x66c18420> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
    at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=1 tid=0x08097cf8 nid=0x5a9b in Object.wait() [0x41364000..0x4136451c]
    at java.lang.Object.wait(Native Method)
    - waiting on <0x66c184a0> (a java.lang.ref.Reference$Lock)
    at java.lang.Object.wait(Object.java:474)
    at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
    - locked <0x66c184a0> (a java.lang.ref.Reference$Lock)
    "main" prio=1 tid=0x0805ae68 nid=0x5a98 waiting on condition [0xbfffc000..0xbfffc4f8]
    at java.lang.Thread.sleep(Native Method)
    at com.ejet.mms.MmsStartup.main(Unknown Source)
    "VM Thread" prio=1 tid=0x08095218 nid=0x5a9a runnable
    "VM Periodic Task Thread" prio=1 tid=0x080a2d40 nid=0x5aa0 waiting on condition

  • Using a CHECK constraint to check for minimum age

    Is it possible to use a check constraint in a table to check whether a person meets a minimum age? For example, if a person is registering as a member, I want to make sure the person is at least 18 years old (contract age), so that a minor doesn't try to register as an adult.
    From what I understand, I can't use SYSDATE in a check statement. Is there another way? What about using CURRENT_DATE and FLOOR to form a statement for this check?
    Here's the DDL for the table (table is not fully decomposed to keep it simple; "dob" represents "Date of Birth" and "zipcode" is a FK to this table):
    CREATE TABLE member     (
    member_id     VARCHAR2(10)     NOT NULL,
    fname          VARCHAR2(30)     NOT NULL,
    lname          VARCHAR2(30)     NOT NULL,
    address1     VARCHAR2(50),
    address2     VARCHAR2(25),
    zipcode     NUMBER(5)     NOT NULL,
    phone          VARCHAR2(15)     NOT NULL,
    dob          DATE          NOT NULL,
    gender     CHAR(1)          NOT NULL,
    CONSTRAINT ck_gender     gender IN ('M','F'),
    CONSTRAINT pk_member     PRIMARY KEY (member_id),
    CONSTRAINT fk_member_zipcode (zipcode) REFERENCES zipcode)
    Thanks for your help.

    Like SYSDATE, CURRENT_DATE is a non-deterministic function and so cannot be used in this context.
    From the manual:
    Restrictions on Check Constraints
    You cannot specify a check constraint for a view. However, you can define the view using the WITH CHECK OPTION clause, which is equivalent to specifying a check constraint for the view.
    The condition of a check constraint can refer to any column in the table, but it cannot refer to columns of other tables.
    Conditions of check constraints cannot contain the following constructs:
    Subqueries and scalar subquery expressions
    Calls to the functions that are not deterministic (CURRENT_DATE, CURRENT_TIMESTAMP, DBTIMEZONE, LOCALTIMESTAMP, SESSIONTIMEZONE, SYSDATE, SYSTIMESTAMP, UID, USER, and USERENV)
    Calls to user-defined functions
    Dereferencing of REF columns (for example, using the DEREF function)
    Nested table columns or attributes
    The pseudocolumns CURRVAL, NEXTVAL, LEVEL, or ROWNUM
    Date constants that are not fully specified
    To achieve this sort of checking you will need to use a trigger

  • Null check

    I have a basic question on good programming practice.
    If i have a method that returns an object which will be used
    by the callee method.
    Is it better to check for the null return value in the called method or putting the check in the callee method.Please let me know if both are same or if in some process we can optimize the performance.

    It would depend on the situation. What's your situation like?
    For some methods, it's legitimate to return null. For such a method, the caller will need to accept a null return value. Very often, this is not a problem a no null check is needed. If the caller wants to call a method in the returned object -- this is considered poor practice, talking to a stranger or breaking the Law of Demeter -- but if, then it needs to do a null check first.
    Other methods are specified not to return null. For such methods, you may place an assert statement either inside the method before returning, or in the caller after the call, or both. Then, once your program is debugged and running fine, you optimize performance by disabling assertions. If the method is called from many locations, you may prefer to have the assert statement inside the method. On the other hand, now you will understand why some people frown on having multiple return statements in a method. :-)
    This is definitely not all there is to say. I hope it helped a bit anyway.

  • Using NULL and NOT NULL in prompted filters

    Dear all,
    While trying to grap the concept of prompted filters in sap bo web intelligence, I had a question whether why we cannot use NULL and NOT NULL while creating a prompted filters in our report.

    HI,
    'Is Null' and 'Not Null' are the predefined functions in webi which only eliminate the null values or considering only null values.
    'Is Null' and 'Not Null' are itself predefined functions that why you are not getting  prompts.
    Null values are standard across the databases so this is defined  as a function in webi to specific eliminate the null values.
    If something is not standard then there is option in the webi to use different operator with static values or with prompts.
    More more information on Null see the Null wiki page.
    Null (SQL) - Wikipedia, the free encyclopedia
    Amit

  • Primary key and relevant not null check constraints....

    Hi ,
    There are some constraints of primary key type and not null check constraints on columns which constitute each primary key....
    Should I/Do I have to drop them....????
    Do they burden the db at the time of data validation....????
    Thanks...
    Sim

    Hi,
    >>There are some constraints of primary key type and not null check constraints on columns which constitute each primary key..
    In fact, a column that constitutes a primary key, by default cannot accept NULL values. In this case, defines a PK column as NOT NULL would not be necessary.
    LEGATTI@ORACLE10> create table x (id number constraint pk_x primary key);
    Table created.
    LEGATTI@ORACLE10> desc x
    Name                  Null?    Type
    ID                    NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='X';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION                
    PK_X                           P X
    LEGATTI@ORACLE10> create table y (id number not null constraint pk_y primary key);
    Table created.
    LEGATTI@ORACLE10> desc y
    Name                  Null?    Type
    ID                   NOT NULL NUMBER
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Y';
    CONSTRAINT_NAME                C TABLE_NAME      SEARCH_CONDITION
    SYS_C006327381 C Y "ID" IS NOT NULL 
    PK_Y                           P Y
    LEGATTI@ORACLE10> alter table y drop constraint SYS_C006327381;
    Table altered.
    LEGATTI@ORACLE10> desc y
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> insert into y values (NULL);
    insert into y values (NULL)
    ERROR at line 1:
    ORA-01400: cannot insert NULL into ("LEGATTI"."Y"."ID")
    LEGATTI@ORACLE10> insert into y values (1);
    1 row created.
    LEGATTI@ORACLE10> insert into y values (1);
    insert into y values (1)
    ERROR at line 1:
    ORA-00001: unique constraint (LEGATTI.PK_Y) violated
    >>Should I/Do I have to drop them....????
    I don't see any problem, otherwise, drop the NOT NULL constraint is the same with alter the column table like below:
    LEGATTI@ORACLE10> create table z (id number not null constraint pk_z primary key);
    Table created.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    SYS_C006328420 C Z "ID" IS NOT NULL
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBER
    LEGATTI@ORACLE10> alter table z modify id NULL;
    Table altered.
    LEGATTI@ORACLE10> select constraint_name,constraint_type,table_name,search_condition from user_constraints where table_name='Z';
    CONSTRAINT_NAME                C TABLE_NAME                     SEARCH_CONDITION
    PK_Z                           P Z
    LEGATTI@ORACLE10> desc z
    Name                                      Null?    Type
    ID                                        NOT NULL NUMBERCheers
    Legatti

  • Using null to replace values

    I'm a newbie! Can you tell me how can replace existing values in a variable. My plot in the program is to have the price of products in my right hand then transfer that to the cart and then to cashier lady. I have to make sure and know that when I transfer the price from my right hand to the value cart the right hand should no value, then when from cart to the cashier the cart should have no value. The code below is not yet finish. I'm just testing it on one product. I just to know the transferring concept. Can I use null?
    This my are codes:
    the customer class
    public class customer{
         String fullName,walletName;
         double wallet,money;
         public void sayName(){
              System.out.println(fullName + " is inside the grocery");
         public String giveFullName(){
              return fullName;
         public void sayWalletBrand(){
              System.out.println("Let me see how much money I got from my " + walletName + " wallet\n");
         public void contentWallet(double money){
              wallet = money;
         public void lookWallet(){
              System.out.println("Show that wallet has the value " + wallet);
              System.out.println();
    the product class:
    public class product{
         String description;
         double price,rightHand;
         public double containRightHand(){
              rightHand = price;
              System.out.println(rightHand);
              System.out.println();
              return rightHand;
         public void showDescription(){
              System.out.println("Show product description " + description);
         public void showPrice(){
              System.out.println("Show the product price value " + price);
              System.out.println();
    the cart class:
    public class cart extends product{
         double contents[] = new double[2];
         product doritos,apple;
         //Movement method from rightHand to cart
         public double getProduct1(product doritos){
              contents[0] = doritos.containRightHand();
              return contents[0];
         public double getProduct2(product apple){
              contents[1] = apple.containRightHand();
              return contents[1];
         public void showProduct1(){
              System.out.println("Show that contents[0] has the value "+ contents[0]);
         public void showProduct2(){
              System.out.println("Show that contents[1] has the value "+ contents[1]);
    the cashier class:
    public class cashier{
         customer cashierLady;
         public void tellNameCashier(customer cashierLady){
              System.out.println("Shows the name of the cashier lady named " + cashierLady.giveFullName());
    the main:
    public class grocery{
         public static void main(String []arg){
              customer Peter, Lady;
              Peter = new customer();
              Peter.fullName = "Raymond Malicdem";
              Peter.walletName = "Seiko";
              Peter.wallet = 1000.0;
              Peter.sayName();
              Peter.sayWalletBrand();
              Peter.contentWallet(1000.0);
              Peter.lookWallet();
              product Doritos = new product();
              Doritos.description = "Junk Food";
              Doritos.price = 60.0;
              Doritos.showDescription();
              Doritos.showPrice();
              Doritos.containRightHand();
              cart product1 = new cart();
              product1.getProduct1(Doritos);
              product1.showProduct1();
              Lady = new customer();
              Lady.fullName = "Christine";
              cashier lady = new cashier();
              lady.tellNameCashier(Lady);

    Variables of object (class) types may be set to null, meaning they point to no object.
    Variables of fundamental types (int, byte, char, long, double, float, boolean, etc.) can not be set to null. Maybe you can set your numeric types to 0 and boolean to false, to indicate nothingness.

  • Using null for parameterized "newInstance(Object [])" method in Object[].

    I have a really serious problem. I am creating instances of specific classes by using reflection techniques. I am reading a flat file, finding class from its name and creating it by using its parameterized constructor. Example:
    line 1: Dummy("A",Dummy2("B"),12,,"C");
    I create an instance of Dummy with parameters "A", an instance of Dummy2 object with value "B", 12 (I use here Integer as wrapper), null (There is no wrapper for null :( ) and "C".
    I find constructor by using findConstructors() and looking their parameter counts, creating an object array with given values and calling:
    constructorIFoundBefore.newInstance(objectArrayIPrepared);
    But!!!
    Because I use null directly, I got this message:
    java.lang.IllegalArgumentException: argument type mismatch
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         at reader.parser.ObjectCreator.createObjectFromObjectItem(ObjectCreator.java:192)
         at reader.parser.ObjectCreator.createObjectFromParseItem(ObjectCreator.java:112)
         at reader.parser.ObjectCreator.createObject(ObjectCreator.java:78)
         at reader.analyzer.FileAnalyzer.analyzeAndCreateObjects(FileAnalyzer.java:95)
         at reader.ReverseReader.main(ReverseReader.java:43)
    I will be very glad if you help me.
    Thanks a lot!
    Gokcer

    I said something wrong. Sorry. While invoking a method (or a constructor) we need an object array which are equivalent to parameters. For example to call a method or constructor for class A;
    class A {
    int age;
    String name;
    public A(int age, String name){
    this.age = age;
    this.name = name;
    public set(int age, String name){
    this.age = age;
    this.name = name;
    we use in any place
    A a1 = new A(12,"Gokcer");
    A a2 = new A(15,null);
    To achieve this by using reflection techniques, we must find constructor with two parameters of class A. At this point "BetterMethodFinder" will give great help.
    After finding right constructor, we must create an object array to tell the constructor parameters (age and name). At this point we need an object array which stores our parameters. Code must be like this.
    Object []params = new Object[2]; // we have two parameters.
    params[0] = new Integer(12); // we can't use params[0]=12
    // because 12 is not an object. (It is a
    // primitive type)
    params[1] = "Gokcer";
    Now create the new object.
    A a1;
    a1 = constructorWeFound.newInstance(params);
    While creating param[], we could also use:
    Object []params = new Object[2] {new Integer(12),"Gokcer"};
    While creating a2, we can use "null" directly for second parameter.
    params = new Object[2] = {new Integer(15), null};
    or
    Object []params = new Object[2];
    params[0] = new Integer(15);params[1] = null;
    Thanks again everyone who replied me.
    My sincerely...

  • High memory use when checking downloads folder through browser

    High memory use when checking downloads folder through browser.
    I have a total of 3 DDR2 Gbytes of ram. Pentium(R) Dual-Core CPU T4500 @ 2.30GHz Win 7 home pr. 64bit. Firefox 27.0 beta
    I right click on a file to "open containing folder" from the drop down menu in downloads.
    When the folder has been opened, explorer is trying to index the folder (which it never does completely or well after 5 minutes I close the folder and shut down the dllhost process cause laptop is blazing hot) and memory keeps increasing till no more is available.
    I checked task manager and see that dllhost is the particular process that is causing the spike in memory usage even after closing the folder I right click and stop the process and memory is restored after awhile.

    Hello,
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Thank you.

  • Dump - Access using NULL object reference is not possible!!!

    Hi,
    I'm using the BCS class for sending HTM format email so i use the below code for that its working,
    DATA: gr_document      TYPE REF TO cl_document_bcs,
    gr_document = cl_document_bcs=>create_document(
                          i_type    = 'HTM'
                           i_text    = t_html
                           i_importance = '5'
                           i_subject = gc_subject ).
    Next task is to send the image so i'm creating an another object to the same class, below code
    *Image from MIME
    DATA: o_mr_api         TYPE REF TO if_mr_api.
    DATA is_folder TYPE boole_d.
    DATA l_img1 TYPE xstring.
    DATA l_img2 TYPE xstring.
    DATA l_loio TYPE skwf_io.
    DATA: lo_document   TYPE REF TO cl_document_bcs.
    IF o_mr_api IS INITIAL.
       o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).
    ENDIF.
    CALL METHOD o_mr_api->get
       EXPORTING
         i_url              = '/SAP/PUBLIC/ZDEMO/tick.png'
       IMPORTING
         e_is_folder        = is_folder
         e_content          = l_img1
         e_loio             = l_loio
       EXCEPTIONS
         parameter_missing  = 1
         error_occured      = 2
         not_found          = 3
         permission_failure = 4
         OTHERS             = 5.
    CALL METHOD o_mr_api->get
       EXPORTING
         i_url              = '/SAP/PUBLIC/ZDEMO/Delete.png'
       IMPORTING
         e_is_folder        = is_folder
         e_content          = l_img2
         e_loio             = l_loio
       EXCEPTIONS
         parameter_missing  = 1
         error_occured      = 2
         not_found          = 3
         permission_failure = 4
         OTHERS             = 5.
    *Convert XSTRING to ITAB
    DATA :lt_hex1 TYPE solix_tab,
           lt_hex2 TYPE solix_tab,
           ls_hex LIKE LINE OF lt_hex1,
           lv_img1_size TYPE sood-objlen,
           lv_img2_size TYPE sood-objlen.
    CLEAR : lt_hex1, lt_hex2, ls_hex, lv_img1_size, lv_img2_size.
    WHILE l_img1 IS NOT INITIAL.
       ls_hex-line = l_img1.
       APPEND ls_hex TO lt_hex1.
       SHIFT l_img1 LEFT BY 255 PLACES IN BYTE MODE.
    ENDWHILE.
    WHILE l_img2 IS NOT INITIAL.
       ls_hex-line = l_img2.
       APPEND ls_hex TO lt_hex2.
       SHIFT l_img2 LEFT BY 255 PLACES IN BYTE MODE.
    ENDWHILE.
    *Findthe Size of the image
    DESCRIBE TABLE lt_hex1 LINES lv_img1_size.
    DESCRIBE TABLE lt_hex2 LINES lv_img2_size.
    lv_img1_size = lv_img1_size * 255.
    lv_img2_size = lv_img2_size * 255.
    *Attach Images
    clear: lo_document.
    lo_document->add_attachment(
       EXPORTING
         i_attachment_type     =  'png'                  " Document Class for Attachment
         i_attachment_subject  =  'img1'                " Attachment Title
         i_attachment_size     =  lv_img1_size           " Size of Document Content
         i_att_content_hex     =  lt_hex1  " Content (Binary)
    lo_document->add_attachment(
       EXPORTING
         i_attachment_type     =  'png'                  " Document Class for Attachment
         i_attachment_subject  =  'img2'                " Attachment Title
         i_attachment_size     =  lv_img2_size           " Size of Document Content
         i_att_content_hex     =  lt_hex2  " Content (Binary)
    but it throws the dump " Access using NULL object reference is not possible"  when i tries to access for method add_attachment...
    Thanks,
    Siva

    Yes there is commit work after that, Below code
          gr_document = cl_document_bcs=>create_document(
                           i_type    = 'HTM'
                            i_text    = t_html
                            i_importance = '5'
                            i_subject = gc_subject ).
    *Image from MIME
    DATA: o_mr_api         TYPE REF TO if_mr_api.
    DATA is_folder TYPE boole_d.
    DATA l_img1 TYPE xstring.
    DATA l_img2 TYPE xstring.
    DATA l_loio TYPE skwf_io.
    DATA: lo_document   TYPE REF TO cl_document_bcs.
    IF o_mr_api IS INITIAL.
       o_mr_api = cl_mime_repository_api=>if_mr_api~get_api( ).
    ENDIF.
    CALL METHOD o_mr_api->get
       EXPORTING
         i_url              = '/SAP/PUBLIC/ZDEMO/tick.png'
       IMPORTING
         e_is_folder        = is_folder
         e_content          = l_img1
         e_loio             = l_loio
       EXCEPTIONS
         parameter_missing  = 1
         error_occured      = 2
         not_found          = 3
         permission_failure = 4
         OTHERS             = 5.
    CALL METHOD o_mr_api->get
       EXPORTING
         i_url              = '/SAP/PUBLIC/ZDEMO/Delete.png'
       IMPORTING
         e_is_folder        = is_folder
         e_content          = l_img2
         e_loio             = l_loio
       EXCEPTIONS
         parameter_missing  = 1
         error_occured      = 2
         not_found          = 3
         permission_failure = 4
         OTHERS             = 5.
    *Convert XSTRING to ITAB
    DATA :lt_hex1 TYPE solix_tab,
           lt_hex2 TYPE solix_tab,
           ls_hex LIKE LINE OF lt_hex1,
           lv_img1_size TYPE sood-objlen,
           lv_img2_size TYPE sood-objlen.
    CLEAR : lt_hex1, lt_hex2, ls_hex, lv_img1_size, lv_img2_size.
    WHILE l_img1 IS NOT INITIAL.
       ls_hex-line = l_img1.
       APPEND ls_hex TO lt_hex1.
       SHIFT l_img1 LEFT BY 255 PLACES IN BYTE MODE.
    ENDWHILE.
    WHILE l_img2 IS NOT INITIAL.
       ls_hex-line = l_img2.
       APPEND ls_hex TO lt_hex2.
       SHIFT l_img2 LEFT BY 255 PLACES IN BYTE MODE.
    ENDWHILE.
    *Findthe Size of the image
    DESCRIBE TABLE lt_hex1 LINES lv_img1_size.
    DESCRIBE TABLE lt_hex2 LINES lv_img2_size.
    lv_img1_size = lv_img1_size * 255.
    lv_img2_size = lv_img2_size * 255.
    *Attach Images
    create object lo_document type cl_document_bcs.
    lo_document->add_attachment(
       EXPORTING
         i_attachment_type     =  'png'                  " Document Class for Attachment
         i_attachment_subject  =  'img1'                " Attachment Title
         i_attachment_size     =  lv_img1_size           " Size of Document Content
         i_att_content_hex     =  lt_hex1  " Content (Binary)
    lo_document->add_attachment(
       EXPORTING
         i_attachment_type     =  'png'                  " Document Class for Attachment
         i_attachment_subject  =  'img2'                " Attachment Title
         i_attachment_size     =  lv_img2_size           " Size of Document Content
         i_att_content_hex     =  lt_hex2  " Content (Binary)
           "Add document to send request
           CALL METHOD gr_send_request->set_document( gr_document ).
           TRY.
             CALL METHOD gr_send_request->SET_SEND_IMMEDIATELY
               EXPORTING
                 I_SEND_IMMEDIATELY = 'X'.
    *    CATCH CX_SEND_REQ_BCS INTO BCS_EXCEPTION .
    **Catch exception here
           ENDTRY.
           DATA: LO_SENDER TYPE REF TO IF_SENDER_BCS VALUE IS INITIAL.
           TRY.
             LO_SENDER = CL_SAPUSER_BCS=>CREATE( SY-UNAME ). "sender is the logged in user
    * Set sender to send request
             gr_send_request->SET_SENDER(
             EXPORTING
             I_SENDER = LO_SENDER ).
    *    CATCH CX_ADDRESS_BCS.
    ****Catch exception here
           ENDTRY.
           "Send email
           CALL METHOD gr_send_request->send(
             EXPORTING
               i_with_error_screen = 'X'
             RECEIVING
               result              = gv_sent_to_all ).
           IF gv_sent_to_all = 'X'.
             WRITE 'Email sent!'.
           ENDIF.
           "Commit to send email
           COMMIT WORK.
           "Exception handling
         CATCH cx_bcs INTO gr_bcs_exception.
           WRITE:
             'Error!',
             'Error type:',
             gr_bcs_exception->error_type.
       ENDTRY.

  • System error message while using maps check in

    today i got a lot of system error messages while using maps check in feature, and i tried everything from factory default to reinstalling mobile software and formating everything and yet nothing changed idk what to do and i use   the maps application a lot of times so i need this problem fixed please
    am using Nokia 500 btw

    today i got a lot of system error messages while using maps check in feature, and i tried everything from factory default to reinstalling mobile software and formating everything and yet nothing changed idk what to do and i use   the maps application a lot of times so i need this problem fixed please
    am using Nokia 500 btw

Maybe you are looking for

  • How can i read a stored picture in oracle Long Raw datatype? blob or clob?

    How can i read a stored picture in oracle Long Raw datatype? Like a blob or clob?....i am using jdk 1.3 This is because...i tried to read it like a blob but i obtain a exception...about Type of column no valid......but the column exist....and it cont

  • Help with simple program

    I am trying to get a program in my CS1 course and am having a hard time, help.. this is what the prof wants>>> Your employer is developing encryption software and wants you to write a Java program that will display all the prime numbers less than N,

  • No ocijdbc9 in java.library.path

    I am running an app against Oracle 8.17 with an OCI connection using ocijdbc8.dll. The web server is Tomcat 3.2.3. The app has no problem connecting to the database. If I run against Tomcat 4 I get the error java.lang.UnsatisfiedLinkError: no ocijdbc

  • Problems Installing creative suite 4 web premium

    Hi, I have windows XP service pack 3. 2.2ghz processor (64) 2gig ram 6600gt grafix card Problem is: Put disc in drive, click on install, starts initializing & stops on 90%! Left it running while i went out for approx 2hrs & still no progress. Just st

  • WM material staging screen in CO02

    Dear all, When I goes to the CO02u2019s menu -> Goto -> WM Pick List, there shown two tabs (Only PickParts, & All Parts). There are 10 material items in the Only PickPart tab having staging indicator as "1"; while they are more than 30 material items