Reference confusion....

<sigh>......I thought I was being clever here, but apparently not. :)
I had two methods that, apart from the List result variable and the String SQL were exactly the same, so I thought I'd write a general method (getResultList) that would do both in one, so to speak and just pass the result object references as parameters to the method. The method works, but the reference variables are still null when I try and use them.....specifically I get a NullPointerException.
Here is the code.......my thinking must be faulty here, because the two Lists (listBasePatientDetails and listNormalPatientIDs) which hold the results are null when I try and use them after calling loadData().
private OracleDataConnection theConnection;
private List listNormalPatientIDs;
private List listBasePatientDetails;
private boolean loadData() {
        if (getNormalPatientIDs() == false || getBasePatientDetails() == false) {
            return false;
        } else {
            return true;
    private boolean getNormalPatientIDs() {
        String sqlString = "SELECT PATID_REFNO FROM PATIENT_IDS";
        if (!getResultList(sqlString, listNormalPatientIDs)) {
            ErrorList.addError(new ErrorItem(ErrorList.DATABASE_QUERY_FAILED, 0, "RPatientID::getNormalPatientIDs()", "Could not retrieve normal patient IDs. Database query failed"));
            return false;
        } else {
            return true;
    private boolean getBasePatientDetails() {
        String sqlString = "SELECT PATID_REFNO, PITYP_REFNO, PATNT_REFNO, IDENTIFIER FROM PATIENT_IDS";
        if (!getResultList(sqlString, listBasePatientDetails)) {
            ErrorList.addError(new ErrorItem(ErrorList.DATABASE_QUERY_FAILED, 0, "RPatientID::getBasePatientDetails()", "Could not retrieve base patient details. Database query failed"));
            return false;
        } else {
            return true;
    private boolean getResultList(String sSQL, List returnList) {
        List resultList;
        if (theConnection.hasConnection()) {
            resultList = (List)theConnection.executeSQL(sSQL);
            if (resultList == null) {
                return false;
            } else {
                returnList = resultList;
                return true;
        } else {
            // Lost database connection.
            ErrorList.addError(new ErrorItem(ErrorList.DATABASE_CONNECTION_FAILED, 0, "RPatientID::getResultList", "Could not retrieve query data. Database connection lost."));
            return false;
    }So whats going wrong here? Is the result List reference used as a parameter going out of scope or something after returning from getResultList? I must have some gap in my thinking, because I thought references were pretty similar to pointers......ie. they just point to the objects rather than hold the objects themselves.
Suggestions? Thanks all.

public class ReturnTest {
  private static String s = "hio";
  public static boolean stuff(String str) {
    str = "YAHOOOOoooOOO";
    return false;
  public static void main(String[] args) {
    System.out.println(s);
    stuff(s);
    System.out.println(s);
}Try compiling that. When you run it you will notice that s still prints out as "hio." This is basically what you are doing with your method.
The parameter "str" (or returnList in your case) has a different address (pointer) than the original s. This is because Java makes copies of all the objects you pass to methods as paramters. To make your method work, you're either going to have to modify your two private lists directly or do something along the lines of this:
public class ReturnTest {
  private static String s = "hio";
  public static boolean stuff(String str) {
    str = "YAHOOOOoooOOO";
    s = str;
    return false;
  public static void main(String[] args) {
    System.out.println(s);
    stuff(s);
    System.out.println(s);
}Note how I put "s = str;" in the stuff() method. If you were to run this, you would see the output:
hio
YAHOOOOoooOOO
Like I said, there's probably a better way to do this, but that's my solution to your predicament.

Similar Messages

  • "this" reference confusion

    Hi
    It is a basic doubt about the this.
    As I run the test program here I expect the out put to be :
    mainTESTMISC
    SUPERMISC
    TestMisc@19821f
    TESTMISC
    class SuperMisc {
         public String     SRC     = "SUPERMISC";
         public void log() {
              System.out.println(SRC);
              System.out.println(this);
              System.out.println(this.SRC);
    public class TestMisc extends SuperMisc {
         public String     SRC     = "TESTMISC";
         public static void main(String... args) {
              TestMisc t = new TestMisc();
              System.out.println("main" + t.SRC);
              t.log();
    but the output actually is
    mainTESTMISC
    SUPERMISC
    TestMisc@19821f
    SUPERMISC
    Not that there is something wrong happening here but only that I am not able to understand that why the this.SRC is still getting the value of SRC in the super class. while "this" is the TestMisc object and TestMisc has a variable SRC in it.
    Please help in making me understand the reason for this behavior.
    Sapan

    sapan wrote:
    Hi EJP,
    I do not want to get the output as I expect, But my question is about the reason why this is happening.
    I just want to understand what I am missing in the behavior of the "this".
    Sapan'this' always refer to the class variable (present class), and the reason the output is coming like you mentioned is because: you calling the super class method and in super class method the visible variable "SRC' value is SUPERMIC. And the super class method can never look /use the derived class variable.
    Edited by: 833545 on Jul 26, 2012 6:09 PM

  • OSB cluster networking

    We're attempting to implement OSB in a highly-available configuration. We're running WLS 10.3.4/OSB 11.1.1.4 on 64bit OEL 5.4/SunJava 1.6.0_23.
    We have OSB running standalone in a number of environments, but need a fault-tolerant design.
    Per the ["Whole Server Migration"|http://download.oracle.com/docs/cd/E11035_01/wls100/cluster/migration.html] document, we've setup SSH-based node manager as required. We use this same configuration on our standalone systems without issue - works great.
    We've installed two systems and set up a clustered domain using shared storage on NFS. The share stores a single middleware home as well as the domain directory. If we configure the VIPs manually on the machines, the admin managed servers will start, but we're obviously missing some key info here, as there is no mention we can find in any documentation that explains how to set up the NIC/VIP failover. [This section|http://download.oracle.com/docs/cd/E17904_01/core.1111/e10106/ha_soa.htm#CHDJHHFI] appears to address it, but it appears to be referring to the java-based node manager, not the script-based node manager. (This is a common thread we've noticed in the documentation on this subject - casual inter-mixing of referrences to both solutions without distinction when they appear to have nothing to do with one-another.)
    Attempting to follow the documentation results in circular references, confusion, paralysis, and TONS of wasted time and frustration.
    So...What are we missing?
    Edit: Oh wait - there's more - so [This iteration|http://download.oracle.com/docs/cd/E14571_01/core.1111/e12036/server_migration.htm#insertedID0] appears to follow many similar steps, yet once again seems to refer to the java-based node manager, (nodemanager.properties,) then proceeds to refer to the script-based node manager (wlscontrol.sh) just a few lines down. Seriously, guys.  What the hell is going on with this stuff!?
    Edited by: Scott555 on Jul 8, 2011 8:11 AM

    Some background information: The SSH node manager started out as a simplified version of the node manager to address the challenges
    of the Java node manager's requirement for using two-way SSL to communicate with the admin server. In WebLogic Server 9.x and 10.0,
    the SSH version was the only one that supported some more advanced features (for example, Automatic Whole Server Migration); however,
    this changed in WebLogic Server 10.3. The SSH version is only supported on Unix-based operating systems. Given that the Java node manager
    no longer uses two-way SSL, is feature comparable, and provides additional security.
    Some information on the SSH node manager can be found here: http://download.oracle.com/docs/cd/E12839_01/web.1111/e13740/script_nodemgr.htm
    the requirements for using whole server migration (WSM) are:
    - WSM uses a floating IP address, also known as a virtual IP address, for each migratable server. This means that the migratable server candidate machines have to be in the same subnet
    (because the virtual IP address must be valid on all candidate machines).
    - WSM requires the use of the node manager. You must make sure the node manager on each candidate machine is properly initialized with the security-related files it need to authenticate and
    accept commands from the admin server.
    - WSM uses the node manager to migrate the virtual IP address and assign it to the target machine. As such, the default configuration assumes that the machines are similar; specifically,
    it assumes the following:
    - The netmask associated with the virtual IP is the same on all machines.
    - The network device name (for example, eth0 on Linux) is the same on all machines.
    - The functional behavior of the platform-specific OS command used to add and remove the virtual IP (for example, ifconfig on Linux) is the same.
    - WSM only supports migration of a single virtual IP address for each migratable server. Therefore, a migratable server cannot define any network channels that use a Listen Address different
    from the virtual IP address associated with the server. If you need your servers to use multiple network channels associated with multiple IP addresses, you cannot use theWSM framework.
    - WSM assumes that any server-specific state is already shared through some highly available sharing mechanism. For example, the server’s default persistent store where it keeps its XA
    transaction logs must be accessible on all candidate machines using the exact same path.
    The steps required to set up automatic whole server migration are
    - Create your domain. Make sure that you set up each managed server’s to Listen Address to its virtual IP address and assign it to a machine.\
    - Set up the node manager for each candidate machine. For each machine, edit the nodemanager.properties file to set the NetMask property to the netmask associated with
    the virtual IP addresses being used and Interface to the network device name with which to associate the virtual IP address. Typically, the nodemanager.properties file is created
    the first time the node manager is started in the $NODEMGR_HOME directory (by default, $WL_HOME/common/nodemanager).
    - Verify the domain and node manager configuration. Before we proceed, start up the domain and each clustered managed server via its node manager. This not only ensures that the
    node managers and servers are properly configured but also initializes the node managers with the password files they need to accept commands from the admin server. Don’t forget
    to start managed servers on all candidate machines to ensure that the node manager and domain directory are properly initialized.
    - Choose and configure your leasing mechanism. Like automatic service migration, automatic whole server migration relies on leasing. Use the cluster’s Migration Configuration tab to
    select the appropriate Migration Basis.
    - If you choose database leasing, be sure to create and configure your nontransactional data source, create the leasing table, and use the cluster’s Migration Configuration tab to set the
    Data Source for Automatic Migration and Auto Migration Table Name appropriately.
    - Grant superuser privileges to the wlsifconfig script. Node managers use the $WL_HOME/common/bin/wlsifconfig.sh (onWindows, wlsifconfig.cmd) script to add and
    remove virtual IP addresses from the machines. By default, the file is set up to use sudo; sudo typically prompts you for your password the first time you run it and periodically after that.
    To do this without needing to input your password, you need to add the NOPASSWD option to the relevant entry in your /etc/sudoers file. Don’t forget to add the wlsifconfig script to
    your PATH so that the node managers can locate it. weblogic machine1 = NOPASSWD: /oracle/middleware/wlserver_10.3/common/bin/wlsifconfig.sh
    - Enable automatic server migration. The last step is to use each managed server’s Migration Configuration tab to select the Automatic Server Migration Enabled checkbox and restart the servers.
    At this point, automatic whole server migration configuration is complete and needs to be tested. Debugging problems with whole server migration can be tricky so you will probably want to add
    -Dweblogic.debug.DebugServerMigration=true to the Java command line used to start your servers.
    The document for WebLogic 10.3.4 whole server migration can be found here: http://download.oracle.com/docs/cd/E17904_01/web.1111/e13709/migration.htm#BABFEFEG
    Note the remark in the documentation: The Java version of Node Manager can be used for server migration on Windows or UNIX. The SSH version of Node Manager can be used for server migration on UNIX only.

  • Object casting: confusion in ABAP Objects: Complete Reference book

    Hi,
    During Object Assignments using casting, is a Type Test carried out during the syntax check or at runtime?
    A.5.2.2 (page 1008) of 'ABAP Objects: The Complete Reference' says about Widening Cast: "...you must check at runtime...". However on the next page under A.5.3.2 it says of Widening Cast in Data References: "The syntax check precludes...".
    A.5.4 (page 1010) concerns Assignments between Object Reference Variables, but makes no mention of whether checks are carried out by a syntax check or at runtime.
    Also nowhere does it mention when Type Tests for Narrow casting takes place. Can anyone clear my confusion please? Unfortunatly I don't know enough about this stuff to test by writing some code.
    Thanks.

    William,
    Your questions can be answered by the following rule for object references, which I found in the book "ABAP Objects" by Horst Keller and Sascha Krüger:
    "... that the static type of the target variable must be equal to or more general than the dynamic type of the source variable."
    Here "static type" means the type with which an object reference variable is declared. "Dynamic type" is the type that the object reference variable has at runtime. The dynamic type of an object reference is always more special than its static type, otherwise a runtime error occurs.
    With this rule all your questions can be answered:
    1. The Narrowing Cast is always checked during the syntax check. Example:
    DATA o_ref1 TYPE REF TO object.
    DATA o_ref2 TYPE REF TO class_1.
    o_ref1 = o_ref2.  
    Here the reference o_ref2 has a dynamic type "class_1" or a subclass of it, which is narrower than its static type "class_1", which is narrower than the static type "object" of the reference o_ref1. Therefore, the syntax check says that the assignment is OK.
    2. The Widening Cast is always checked at runtime and requires an assignment using the operator ?=. If you use the operator = in the assignment, a syntax error occurs. Therefore the following  example produces a syntax error (try it yourself):
    DATA o_ref1 TYPE REF TO object.
    DATA o_ref2 TYPE REF TO class_1.
    o_ref2 = o_ref1.  
    The correction for this syntax error is:
    DATA o_ref1 TYPE REF TO object.
    DATA o_ref2 TYPE REF TO class_1.
    o_ref2 ?= o_ref1.
    Now the syntax check is satified, and the correctness of the widening cast is checked at runtime.
    Kind regards,
    Michael Kraemer
    Message was edited by: Michael Kraemer

  • Confused about passing by reference and passing by valule

    Hi,
    I am confuse about passing by reference and passing by value. I though objects are always passed by reference. But I find out that its true for java.sql.PreparedStatement but not for java.lang.String. How come when both are objects?
    Thanks

    Hi,
    I am confuse about passing by reference and passing
    by value. I though objects are always passed by
    reference. But I find out that its true for
    java.sql.PreparedStatement but not for
    java.lang.String. How come when both are objects?
    ThanksPass by value implies that the actual parameter is copied and that copy is used as the formal parameter (that is, the method is operating on a copy of what was passed in)
    Pass by reference means that the actual parameter is the formal parameter (that is, the method is operating on the thing which is passed in).
    In Java, you never, ever deal with objects - only references to objects. And Java always, always makes a copy of the actual parameter and uses that as the formal parameter, so Java is always, always pass by value using the standard definition of the term. However, since manipulating an object's state via any reference that refers to that object produces the same effect, changes to the object's state via the copied reference are visible to the calling code, which is what leads some folk to think of java as passing objects by reference, even though a) java doesn't pass objects at all and b) java doesn't do pass by reference. It passes object references by value.
    I've no idea what you're talking about wrt PreparedStatement, but String is immutable, so you can't change its state at all, so maybe that's what's tripping you up?
    Good Luck
    Lee
    PS: I will venture a guess that this is the 3rd reply. Let's see...
    Ok, second. Close enough.
    Yeah, good on yer mlk, At least I beat Jos.
    Message was edited by:
    tsith

  • Confusion about reference variable

    Still, I am sometimes an incurable complete newbie. The code A works but I feel repeating same comparisons is somehow awkward. But, much simpler code B fails in inserting a new node in a tree. Could you explain what is happening here in Java backstage?
    //[code A]
    // code that works
    while (p != null) {
      prev = p;
      if (p.compareTo(newnode) < 0){
        p = p.right;
      else{
        p = p.left;
    if (prev.compareTo(newnode) < 0){
      prev.right = newnode;
    else{
      prev.left = newnode;
    //[code B]
    // code that fails
    while (p != null) {
      if (p.compareTo(newnode) < 0){
        p = p.right;
      else{
        p = p.left;
    p = newnode; // p is original p, p.right or p.left
                 // == prev, prev.right or prev.left on above code

    Case A:
    you hold the reference of the last node in "prev". so after completing the traversal ur "p" becomes null and "prev" hold the exact leaf position to add the new node.
    for which u used prev.right or prev.left to store the reference of the new node.
    Case B:
    U traverse correctly but do not hold the reference of the leaf , which will store the new node.
    In this case u will never be able to add a new node. as u had lost the reference which will store the new node.
    I think u are confused,bcoz u think that in case of b , "p" is the right position to store the new node and assighing new node to p will work.
    but think when u set new node reference to p that reference is not hold by any of the tree node (as reference are stored in <leaf>.right or <leaf>.left).
    I think this will make u understand the holding of reference in the tree.

  • Variables? References? Confused.

    I've looked through documents on the internet, but I still do not get the idea.
    When you parse a variable through a method, is that variable exactly same as the one parsed from?
    For example,
    EX1)
    we have a method like this following:
    public void methodEx(String a) {
    a = "good";
    now I have lines of codes here below:
    String c = "bad"
    methodEx(c);
    output(c);
    will this output "bad" or "good"?
    EX2)
    now I have lines of codes here below:
    String c = "bad", a = "good";
    c = a;
    a = "bad";
    output(c);
    will this output "bad" or "good"?
    The reason I'm asking is I'm confused how this 'parameter' actually works.
    I thought when you parse a variable into a method, a new variable is created, but I tried to parse a JButton object and noticed that I could still change its states such as setEnabled(boolean state);
    I'm very confused on how initializing a variable in a normal behavior and through parameter differs.
    How does these things work?

    Hackelt wrote:
    I've looked through documents on the internet, but I still do not get the idea.
    When you parse a variable through a method, is that variable exactly same as the one parsed from?Huh?
    (Oh, you mean pass a variable to a method.)
    will this output "bad" or "good"?Run it and see.
    The reason I'm asking is I'm confused how this 'parameter' actually works.
    I thought when you parse a variable into a method, a new variable is created, but I tried to parse a JButton object and noticed that I could still change its states such as setEnabled(boolean state);A copy of the reference is passed. Both references point to the same object. If you change the value of one reference--i.e., set it to null, or to point to a different object--the other reference is not affected. If you change the state of the one object that both references point to, then both references will see that change.

  • Confusion between references in recursion

    Hi all,
    I am trying to create B+ trees for a database. My algorithm for the insert function is:
    void insert(page_no, entry, newchildentry )
    if page_no is not a leaf ,say N
    find i such that Ki <= entry's key value < K i+1   //choose subtree
    insert(newPage(i), entry,newchildentry )
    if newchildentry is null, return;
    else
              if N has space, insert the newchildentry, set it to null and return
             else
             split the page in half, the newchildentry is set to a new value
             if N is the root , do some extra things return;
    if  page_no is a leaf, say L
    if  L has space, insert entry on to it, set newchildentry to null and return;
    else split L in half, populate the newchildentry to some new values
    return;
    }The problem that i am facing is that newchildentry is being populated by some values in the "if page_no is a leaf, say L" part and on collapsing the recursion, these values are being lost and I can't figure what the problem is. i'm new to java even though i have programmed in c/c++ before and i think this would work. is it because java is maintaining different placeholders for the newchildentry?
    thanks.
    ~dang_it

    Hi all,
    I am trying to create B+ trees for a database. My
    algorithm for the insert function is:
    void insert(page_no, entry, newchildentry )
    if page_no is not a leaf ,say N
    find i such that Ki <= entry's key value < K i+1
    //choose subtree
    insert(newPage(i), entry,newchildentry )
    if newchildentry is null, return;
    else
    if N has space, insert the newchildentry,
    hildentry, set it to null and return
    else
    split the page in half, the newchildentry is
    dentry is set to a new value
    if N is the root , do some extra things
    ra things return;
    if  page_no is a leaf, say L
    if  L has space, insert entry on to it, set
    newchildentry to null and return;
    else split L in half, populate the newchildentry to
    some new values
    return;
    }The problem that i am facing is that newchildentry is
    being populated by some values in the "if page_no is
    a leaf, say L" part and on collapsing the recursion,
    these values are being lost and I can't figure what
    the problem is. i'm new to java even though i have
    programmed in c/c++ before and i think this would
    work. is it because java is maintaining different
    placeholders for the newchildentry?
    thanks.
    ~dang_itIn the code that is failing, what type is newchildentry. You need to be aware that objects are not passed in the argument list. A copy of the object reference is passed. When the method finishes, even if the object contents have changed, the reference has not. So, to say that in some case you set newchildentry to null does not change the newchildentry object reference in the calling method.
    � {�                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Colour confusion in cross-reference format -- help!?

    (FrameMaker version 8.0p277)
    We recently applied revised templates to our documents and I am not having problems with my cross-reference formats.
    When setting an xref to a heading/table/figure on another page, I want it to say (for example) "Figure 2-3 on page 17", where "Figure 2-1" is blue, and "on page 17" is the default text colour (for these docs, that would be black).
    When I insert an xref and choose a display format as described above, the text appears properly (blue, then black).
    However, when I update the book, many of the xrefs (but not all) change to all blue text. (For example, Figure 2-1, 2-2, 2-5 are okay, but 2-3 and 2-4 appear all in blue.)
    Here is the xref format definition for figures:
    <bluetext>Figure\ <$paranumonly><Default ¶ Font> on page\ <$pagenum>
    where <bluetext> is a character format (all 'as-is', except Color is set to Blue).
    So far, I am the only one who has had this problem (three other writers using Frame 8 as well), but I'm the only one working on this particular set of documents.
    Anybody have any hints as to how to resolve this? I have found limited success with copying/pasting the encompassing content (for example, if xrefing to a heading in a cell of a given table row, copy and paste the entire row, then delete the original row fixes the problem. *Sometimes*. Same for table xref (replace entire table), figure xref (replace figure and caption and some surrounding body text), heading (replace heading plus some surrounding body text).
    I'm at a loss.
    Thanks

    And... I think I have it (sorry to have dragged you all along for the ride :-)
    With the Character Designer displayed, moved cursor through text. Found that the Character Tag field changed to <Blue> after the last character of the offending x-refs. <Blue> was an old tag used in the previous template. It does *not* appear in the character font catalog (and does not appear in the drop-down character tag list either).
    Solution (it seems):Select the text section and apply the DefaultFont format (everything goes black). Then update the book. Most of the xrefs display correctly. Some, however, remain all black. Double-click the xref and then click Replace, and it now has the proper format.
    Will go through doc and do updates -- if more problems arise, will let you know!
    (As an aside... if somebody can explain what is actually happening in a clear way, that would be great :-)
    Thanks again.

  • Confusion in the reference document in QM03

    Hello,
    I have a Quality Notification the status is NOCO complete and deletion flag is set, with this QN in the reference document. the user had indicated a Purchase order with material document in place. and also they also add Inspection Lot. when i check the inspection lot it has no UD code as of far but reviewing its material document it is different with the same reference purchase order material document in this QN. with two different material document inclosed as reference with this QN can this be a factor why i cannot post the stock amount in this QN which is in QI stock in MMBE to Unrestricted use? how can i will resolve this?
    Guys any solution for this? need help badly.
    I must rephrase my problem, have question what is the function of the Reference document portion in QM01?
    please.
    Thank you
    Ryan
    Edited by: Ryan Lazaro on Jul 31, 2008 8:23 AM
    Edited by: Ryan Lazaro on Jul 31, 2008 10:02 AM
    Edited by: Ryan Lazaro on Aug 1, 2008 5:17 AM

    Dear Ryan lazaro,
    Go to QM02
    1] In the Menu Notification>Function>Deletion Flag>Deslect and save
    Then you see the status Notification in Process.
    2] Reference Notification is only for your reference while creating notification.
    Ex: If youwant to create Q2 Notification, you can put the same type of notification number and you can copy the fields where you can save the time.
    If Inspection Lot is mentioned in the notification with reference notification means it has not created automatically.
    If RR carried means, you have to process the Notification.
    then do the UD.
    Regards
    Hanamanta

  • Confused !HashMap stores an object or reference ?

    HashMap<Integer,Temp> m = new HashMap<Integer, Temp>();
    Temp t1 = new Temp(1); /* pass the id in the constructor */
    m.put(1, t1);
    System.out.println(m.get(1).id); /* This prints out "1" */
    t1.id = 100;
    System.out.println(m.get(1).id); /* This prints out "100" */
    t1 = null;
    System.out.println(m.get(1).id); /* This prints out "100" */
    Since externally modifying the id value of an object of temp class, which has already been inserted in the map, updates the id value of the object stored in the map, I thought that HashMap actually stores a reference and not the entire object. However if I assign a null pointer to t1 externally , still the object in HashMap is not null which means that hashMap has its own copy ??
    Or does java play a smart trick and check whether a non-null object reference is being modified, and if it is, then all of its copies in any of the collections would be updated ?
    Or I am missing something really simple ?

    Remember that t1 is also a reference to the same object as the map. When changing the object through t1's reference the accessing the object through the map will show this change as you specify.
    But, when you set the t1 to reference null (point at nothing) it does not mean the actual object is deleted, lost or changed. It still exists, but now only referenced by the map.
    Consider this:
    Integer a = new Integer(1); // a points to the Integer object
    Integer b = a; // b points to this same object. (not pointing to a, but the same object as a)
    System.out.println( b );
    b = null; // Now b point to null, but the Integer object is still referenced by a
    System.out.println( b );
    System.out.println( a );- Roy

  • Confusion about call-by -value and call - by reference

    class A{
    public boolean check(String source, ArrayList arr){
    //pROCESS ON ARRAYLIST
    class B {
    A con = new A();
    String source="this is string ";
    ArrayList arr = new ArrayList();
    // suppose Arraylist has some elements
    boolean  error= false;
    error = A.check(source,arr);
    }Is it call by value or call by ref .
    Please help
    }

    Object references are also passed by value. ???Yes, as demonstrated byclass Foo {
        public int bar = 0;
        public static void main(String[] args) {
                Foo foo = new Foo();
                foo.bar = 1;
                System.out.println(foo.bar);
                baz(foo);
                // if this was pass by reference the following line would print 3
                // but it doesn't, it prints 2
                System.out.println(foo.bar);
        private static void baz(Foo foo) {
            foo.bar = 2;
            foo = new Foo();
            foo.bar = 3;
    }

  • Cross Reference Source text options

    Creating a Cross Reference linking to a Paragraph. In the paragraph where the cross-reference source is inserted, may the cross-reference link be applied to existing text in that paragraph so that the cross-reference destination text does not appear? Text anchors can be created to accomplish this, but that is an extra step (I can create a cross reference linking to a paragraph all in one dialog box). Thanks in advance for any suggestions.

    Hi, Seir:
    I agree that it's confusing. Here's how I do it:
    To create a text anchor at the insertion point location:
    * Open the Hyperlinks/Cross-References panel's menu (also called "flyout menu." It's the small icon at the upper-right of the panel, below the double-arrow (>>) icon that collapses the panel.
    * Choose New Hyperlink Destination. THIS SHOULD BE NAMED NEW TEXT ANCHOR!!!
    * Choose Type: Text Anchor
    * Name the anchor as you like Click OK.
    To create a cross-reference to a text anchor:
    * Place the insertion point where you want it.
    * Click the Create new Cross-Reference button on the bottom of the Hyperlinks/Cross-Reference panel.
    * Choose Link To: Text Anchor
    * Choose the target document
    * Choose the text anchor
    * Choose the Cross-Reference format
    * Choose Appearance properties
    * Click OK
    I'm not sure what could cause the straight/curly quotes problem other than perhaps the font doesn't have curly quotes. Have you tried other fonts?
    HTH
    Regards,
    Peter Gold
    KnowHow ProServices

  • Open VI Reference Error in the executable version only

    Hello folks! I am having a strange issue since I updated to Labview 2014: I have a vi that uses "Open VI Reference" in order to programmatically open the desired vi. It worked flawless also in the compiled version (.exe) of the program until yesterday, when i compiled it again for the first time since my update to Labview 2014. It compiles with no problem, but when i start the exe and load the first vi it already gives me an error "Built Application or Shared Library (DLL): Missing".
    The point is that all the VIs that i want to open are inside an LLB that is supposed to be compiled inside the .exe: infact the path that i use to open is:
    D:\LabVIEW Data\builds\Sequenzer\Sequenzer2.0.exe\com_lv_sequenzer\trunk\Sequenzer_Functions.llb\Seq_Connect_to_Database.vi
    And i get error number 7:
    Open VI Reference in Seq_Function_Interface.vi->Sequenzer_Main_2.0.vi<APPEND>
    VI Path: <b>D:\LabVIEW Data\builds\Sequenzer\Sequenzer2.0.exe\com_lv_sequenzer\trunk\Sequenzer_Functions.llb\Seq_Connect_to_Database.vi</b>
    Built Application or Shared Library (DLL): Make sure all dynamically loaded VIs were properly included in the build specification for the application or shared library.
    LabVIEW Real-Time: VIs built into executables cannot be accessed through VI Server calls. Use Source Distributions to dynamically call VIs on Real-Time targets.
    The vi Seq_Connect_to_Database.vi is included in my built (as you can see in the attached screenshot and as it has always been).
    Do you have an idea of why it is not working anymore?
    Thanks a lot in advance!
    Dario Cassaniti
    Solved!
    Go to Solution.
    Attachments:
    sequenzer.png ‏86 KB

    OK, here is where I am confused. You talk about including the llb in the build, but in the screen shot you show a bunch of individual VIs being included. Next, in source file settings where are you telling the app builder to store all those individual VIs? Because they are VIs LabVIEW will, by default, want to put them in the executable somewhere.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

  • Any idea what this errorr means? the data type of the reference does not match the data type of the variable

    I am using Veristand 2014, Scan Engine and EtherCat Custom Device.  I have not had this error before, but I was trying to deploy my System Definition File (run) to the Target (cRio 9024 with 6 modules) and it failed. It wouldn't even try to communicate with the target. I get the 'connection refused' error.  
    I created a new Veristand project
    I added the Scan Engine and EtherCat custom device.
    I changed the IP address and auto-detected my modules
    i noticed tat Veristand didn't find one of my modules that was there earlier. (this week)
     So, i went to NiMax to make sure software was installed and even reinstalled Scan Engine and Veristand just to make sure.
    Now, it finds the module, but when i go to deploy it getsto the last step of deploying the code to the target, and then it fails.
    Any thoughts?
    Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Preparing to synchronize with targets...
    • Querying the active System Definition file from the targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.
    • Start Date: 4/10/2015 11:48 AM
    • Loading System Definition file: C:\Users\Public\Documents\National Instruments\NI VeriStand 2014\Projects\testChassis\testChassis.nivssdf
    • Preparing to deploy the System Definition to the targets...
    • Compiling the System Definition file...
    • Initializing TCP subsystem...
    • Starting TCP Loops...
    • Connection established with target Controller.
    • Sending reset command to all targets...
    • Preparing to deploy files to the targets...
    • Starting download for target Controller...
    • Opening FTP session to IP 10.12.0.48...
    • Processing Action on Deploy VIs...
    • Setting target scan rate to 10000 (uSec)... Done.
    • Gathering target dependency files...
    • Downloading testChassis.nivssdf [92 kB] (file 1 of 4)
    • Downloading testChassis_Controller.nivsdat [204 kB] (file 2 of 4)
    • Downloading CalibrationData.nivscal [0 kB] (file 3 of 4)
    • Downloading testChassis_Controller.nivsparam [0 kB] (file 4 of 4)
    • Closing FTP session...
    • Files successfully deployed to the targets.
    • Starting deployment group 1...
    The VeriStand Gateway encountered an error while deploying the System Definition file.
    Details:
    Error -66212 occurred at Project Window.lvlibroject Window.vi >> Project Window.lvlib:Command Loop.vi >> NI_VS Workspace ExecutionAPI.lvlib:NI VeriStand - Connect to System.vi
    Possible reason(s):
    LabVIEW: The data type of the reference does not match the data type of the variable.
    =========================
    NI VeriStand: NI VeriStand Engine.lvlib:VeriStand Engine Wrapper (RT).vi >> NI VeriStand Engine.lvlib:VeriStand Engine.vi >> NI VeriStand Engine.lvlib:VeriStand Engine State Machine.vi >> NI VeriStand Engine.lvlib:Initialize Inline Custom Devices.vi >> Custom Devices Storage.lvlib:Initialize Device (HW Interface).vi
    • Sending reset command to all targets...
    • Stopping TCP loops.
    Waiting for TCP loops to shut down...
    • TCP loops shut down successfully.
    • Unloading System Definition file...
    • Connection with target Controller has been lost.

    Can you deploy if you only have the two 9401 modules in the chassis (no other modules) and in the sysdef?  I meant to ask if you could attach your system definition file to the forum post so we can see it as well (sorry for the confusion).  
    Are you using any of the specialty configurations for the 9401 modules? (ex: counter, PWM, quadrature, etc)
    You will probably want to post this on the support page for the Scan Engine/EtherCAT Custom Device: https://decibel.ni.com/content/thread/8671  
    Custom devices aren't officially supported by NI, so technical questions and issues are handled on the above page.
    Kevin W.
    Applications Engineer
    National Instruments

Maybe you are looking for