Arrays are passed by reference or value ?

Hi peoples,
I have something interesting here which I need to know. Look into the following classes :
     public class example1 {
     int i[] = {0};
     public static void main(String args[]) {
     int i[] = {1};
     change_i(i);
     System.out.println(i[0]);
     public static void change_i(int i[]) {
     i[0] = 2;
     i[0] *= 2;
     public class example2 {
     int i[] = {0};
     public static void main(String args[]) {
     int i[] = {1};
     change_i(i);
     System.out.println(i[0]);
     public static void change_i(int i[]) {
     int j[] = {2};
     i = j;
Among the above classes, the class named 'example1' returns the value 4 whereas, the class named 'example2' returns the value 1.
Any explanations to this one please....
Cheers,
Rasmeet

minglu, you are not doing right.
i just don't get it why you have i[] as instance variable but never use it ( i[] is declared in every method so each i you refer to in the method is a local varable not member variable that can be shared for the object ).
your first solution work. but that i = j line is not needed because it has no effect you still cannot change the referrence of i to other int[]. your first soultion just need to be
public static int[] change_i(int i[]) {
int j[] = {2};
return j;
}anyway, using this solution, the method name will be misleading because the method didnot change i in anyway. i is changed because you assign the return array (j) to i.
for that second solution also, you didn't use your member variable i at all. what you change is the content of i you pass so the result is correct. but then how is this method different from the first method the original poster posted?
moreover, java never pass argument to the method by reference it ALWAYS pass by copy.i suppose you define passing by reference in the same way C++ does. all object variable in java is a refernce to Object so passing the variable to method is surely passing the reference to the method but that's not passing by reference. it's passing by copy because what is passed is the copy of the reference to the object, not the reference to the reference to Object. if it is really passing by refernce, then you will be able to change your reference to object to point anywhere because you have the access the address of the reference. but since you don't (you only know where the passed reference is pointing to (you have the COPY of value of reference) but you don't know where the refernce store its value) you can only change the content of the pointed object but not changing the pointed object.
let me restate this, java always pass by reference.

Similar Messages

  • How BAPI Tables parameters are passed by reference

    Hi Gurus,
                     I have a genuine doubt regarding BAPI parameters. I would like to point out the genreal rules of bapi like,
    1. BAPI parameters should be passed by value. (Because they are rfc fm's. So both systems will be in different servers. This is the normal scenario.)
    2. But the tables parameters in BAPI can't be passed by value. Instead they are passed by reference.
    3. I know they use some kind of delta mechanism to transfer tables parameters to remote servers.
    So gurus I would like to know what exactly happens when a tables parameter is passed. And also I didn't understand the delta mechanism. Kindly guide me.
    Thanks in advance,
    Jerry Jerome

    You'll see in [SAP Library - RFC - Parameter Handling in Remote Calls|http://help.sap.com/saphelp_nw04s/helpdata/en/22/042551488911d189490000e829fbbd/frameset.htm] that tables are not passed by reference when you use RFC. It also explains the delta.
    When you make a remote function call, the system handles parameter transfer differently than it does with local calls.
    TABLES parameters
    The actual table is transferred, but not the table header. If a table parameter is not specified, an empty table is used in the called function.
    The RFC uses a delta managing mechanism to minimize network load during parameter and result passing. Internal ABAP tables can be used as parameters for function module calls. When a function module is called locally, a parameter tables is transferred u201Cby reference". This means that you do not have to create a new local copy. RFC does not support transfer u201Cby referenceu201D. Therefore, the entire table must be transferred back and forth between the RFC client and the RFC server. When the RFC server receives the table entries, it creates a local copy of the internal table. Then only delta information is returned to the RFC client. This information is not returned to the RFC client every time a table operation occurs, however; instead, all collected delta information is passed on at once when the function returns to the client.
    The first time a table is passed, it is given an object-ID and registered as a "virtual global table" in the calling system. This registration is kept alive as long as call-backs are possible between calling and called systems. Thus, if multiple call-backs occur, the change-log can be passed back and forth to update the local copy, but the table itself need only be copied once (the first time).

  • Strings are passed by Reference

    Since strings are objects, they are passed by reference. I tested this out:
    1.in main(): String str="in main"; creates a new string "in main" and has str point to it.
    2.Passed str into changeStr(String str2)
    3.in changeStr: str2="in changeStr", since str2 is a reference, it should redirect str to point to the new string "changeStr".
    4.Back in main I print out str and get "in main".
    Why?

    (When you post source code, please put it in CODE tags; there's a button for that above the textarea.)
    Don't think of references as memory addresses; that makes them sound like C pointers, when in fact they're fundamentally different: a pointer points to a memory location, while a reference points to an Object. C lets you dereference a pointer and replace the data at that memory location with something else. Afterward, any existing variable that referred to the data in that section of memory, will see the new value.
    A Java reference lets you access the object to call its methods, examine its variables, and so on. If the object is mutable, you can change itss contents, and all existing variables that refer to that object will see those changes. But you can't replace the whole object with something else. Reassigning the variable that was passed into the method has no effect on the original object or on any other variables that pointed to it.
    So stop thinking of references as memory addresses. In fact, stop thinking about memory addresses, period. You never need that information in Java, and for that you should be eternally grateful. The absence of C pointers was one of Java's biggest selling points, way back when.
    Edited by: uncle_alice on Feb 27, 2008 7:55 AM
    Oh well. :-/ At least I may have done some good by asking the OP to use CODE tags.

  • Is String passed by reference or value?

    as subject

    The last four answers all say the same thing.
    Unfortunately, there's a certain amount of argument
    about the exact terminology.LOL! Yeah, there's also a certain amount of argument about whether the earth is flat or not, and whether we actually landed on the moon or if the Apollo missions were faked. There's always going to be "a certain amount of argument" by a clueless few.
    The only people who don't agree that Java has only pass by value don't understand the correct use of the terminology.

  • 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

  • Pass by reference and String

    public class Test {
        static void method(String str) {
            str = "String Changed";
        public static void main(String[] args) {
            String str = new String("My String");
            System.out.println(str);
            method(str);
            System.out.println(str);
    }The output is
    My String
    My String
    How this is possible when objects are passed by reference ?

    > How this is possible when objects are passed by reference ?
    All parameters to methods are passed "by value." In other words, values of parameter variables in a method are copies of the values the invoker specified as arguments. If you pass a double to a method, its parameter is a copy of whatever value was being passed as an argument, and the method can change its parameter's value without affecting values in the code that invoked the method. For example:
    class PassByValue {
        public static void main(String[] args) {
            double one = 1.0;
            System.out.println("before: one = " + one);
            halveIt(one);
            System.out.println("after: one = " + one);
        public static void halveIt(double arg) {
            arg /= 2.0;     // divide arg by two
            System.out.println("halved: arg = " + arg);
    }The following output illustrates that the value of arg inside halveIt is divided by two without affecting the value of the variable one in main:before: one = 1.0
    halved: arg = 0.5
    after: one = 1.0You should note that when the parameter is an object reference, the object reference -- not the object itself -- is what is passed "by value." Thus, you can change which object a parameter refers to inside the method without affecting the reference that was passed. But if you change any fields of the object or invoke methods that change the object's state, the object is changed for every part of the program that holds a reference to it. Here is an example to show the distinction:
    class PassRef {
        public static void main(String[] args) {
            Body sirius = new Body("Sirius", null);
            System.out.println("before: " + sirius);
            commonName(sirius);
            System.out.println("after:  " + sirius);
        public static void commonName(Body bodyRef) {
            bodyRef.name = "Dog Star";
            bodyRef = null;
    }This program produces the following output: before: 0 (Sirius)
    after:  0 (Dog Star)Notice that the contents of the object have been modified with a name change, while the variable sirius still refers to the Body object even though the method commonName changed the value of its bodyRef parameter variable to null. This requires some explanation.
    The following diagram shows the state of the variables just after main invokes commonName:
    main()            |              |
        sirius------->| idNum: 0     |
                      | name --------+------>"Sirius"       
    commonName()----->| orbits: null |
        bodyRef       |______________|At this point, the two variables sirius (in main) and bodyRef (in commonName) both refer to the same underlying object. When commonName changes the field bodyRef.name, the name is changed in the underlying object that the two variables share. When commonName changes the value of bodyRef to null, only the value of the bodyRef variable is changed; the value of sirius remains unchanged because the parameter bodyRef is a pass-by-value copy of sirius. Inside the method commonName, all you are changing is the value in the parameter variable bodyRef, just as all you changed in halveIt was the value in the parameter variable arg. If changing bodyRef affected the value of sirius in main, the "after" line would say "null". However, the variable bodyRef in commonName and the variable sirius in main both refer to the same underlying object, so the change made inside commonName is visible through the reference sirius.
    Some people will say incorrectly that objects are passed "by reference." In programming language design, the term pass by reference properly means that when an argument is passed to a function, the invoked function gets a reference to the original value, not a copy of its value. If the function modifies its parameter, the value in the calling code will be changed because the argument and parameter use the same slot in memory. If the Java programming language actually had pass-by-reference parameters, there would be a way to declare halveIt so that the preceding code would modify the value of one, or so that commonName could change the variable sirius to null. This is not possible. The Java programming language does not pass objects by reference; it passes object references by value. Because two copies of the same reference refer to the same actual object, changes made through one reference variable are visible through the other. There is exactly one parameter passing mode -- pass by value -- and that helps keep things simple.
    -- Arnold, K., Gosling J., Holmes D. (2006). The Java� Programming Language Fourth Edition. Boston: Addison-Wesley.
    ~

  • Pass-by-reference?

    Please tell me if I am wrong and explain how it actually works!
    But i think there is pass-by-reference..
    Part of Frame.java
    SplashPanel splashpanel = new SplashPanel(this);Part of SplashPanel.java
    public class SplashPanel extends JPanel{
         private Frame frame;
         public SplashPanel(final Frame frame) {
              this.frame = frame;I am newbie in Java and programming at all, so sorry if i am wrong.

    That's not pass by reference. That's passing a reference by value.
    Primitives are passed by value.
    References are passed by value.
    Objects are not passed at all--not by reference, not by value.
    Java is always pass-by-value. Always.
    Always. Always. Always.
    http://javadude.com/articles/passbyvalue.htm
    http://java.sun.com/developer/JDCTechTips/2001/tt1009.html#tip1
    http://www.javaranch.com/campfire/StoryPassBy.jsp
    http://www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html
    http://www-106.ibm.com/developerworks/library/j-praxis/pr1.html
    http://www.cs.toronto.edu/~dianeh/tutorials/params/
    http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#38698
    http://radio.javaranch.com/channel/val/2004/05/21/1085125887000.html
    There is exactly one parameter passing mode in Java -- pass by value -- and that helps keep things simple.
    -- James Gosling, "The Java Programming Language, Second Edition"
    (James Gosling being the father of Java)

  • Recursive Function, Pass by "reference"

    I need to create a function and build an Arraylist.
    public void buildList (String s, Arraylist list) {
    ....//code specific to application
    list.add(something);
    buildList(somestring, list);
    public void anotherFunction(){
    buildList(str, myList);
    Will myList contain the values that are added? Is this only a copy of the list?

    Java always passes by value.
    (Now it gets confusing)
    In this case it passes a reference by value.
    The method gets its own variable for storing the reference to the list in.
    ie it is the equivalent of saying
    Arraylist list = myList;
    It doesn't copy the entire list, it just gets a reference to it.
    If you change the contents of the list by calling list.add() then original looks like it was updated, as they point to the same thing.
    If you execute
    list = new ArrayList();
    Then list becomes distinct and seperate from the myList variable in the calling procedure.
    If java was pass by reference, when you execute list = new ArrayList it would also change the value of the variable in the calling procedure. That doesn't happen.
    Hope that clears things up,
    evnafets

  • Calrification on Pass by reference

    Hi All,
    In java, if we are passing an object to a function actually we are passing the reference. So, if the function is doing any manipulation on the Object reference, it will affect the passing object.
    For example,
    class Ob1
         int i=0;
    public class Ref
         public static void main(String a[])
              Ob1 o=new Ob1();
              System.out.println("Before calling :"+o.i);
              call(o);
              System.out.println("After calling :"+o.i);
         static void call(Ob1 o)
              o.i++;
    Is it possible to get the original value of i(object Ob1) after calling call()?
    Thanks in advance
    +Sha                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    > In java, if we are passing an object to a function
    actually we are[b] passing the reference.
    By value.
    Is it possible to get the original value of i(object
    Ob1) after calling call()?
    Store the original value in a local variable.
    And please note the following:
    All parameters to methods are passed "by value." In other words, values of parameter variables in a method are copies of the values the invoker specified as arguments. If you pass a double to a method, its parameter is a copy of whatever value was being passed as an argument, and the method can change its parameter's value without affecting values in the code that invoked the method. For example:
    class PassByValue {
        public static void main(String[] args) {
            double one = 1.0;
            System.out.println("before: one = " + one);
            halveIt(one);
            System.out.println("after: one = " + one);
        public static void halveIt(double arg) {
            arg /= 2.0;     // divide arg by two
            System.out.println("halved: arg = " + arg);
    }The following output illustrates that the value of arg inside halveIt is divided by two without affecting the value of the variable one in main:before: one = 1.0
    halved: arg = 0.5
    after: one = 1.0You should note that when the parameter is an object reference, the object reference -- not the object itself -- is what is passed "by value." Thus, you can change which object a parameter refers to inside the method without affecting the reference that was passed. But if you change any fields of the object or invoke methods that change the object's state, the object is changed for every part of the program that holds a reference to it. Here is an example to show the distinction:
    class PassRef {
        public static void main(String[] args) {
            Body sirius = new Body("Sirius", null);
            System.out.println("before: " + sirius);
            commonName(sirius);
            System.out.println("after:  " + sirius);
        public static void commonName(Body bodyRef) {
            bodyRef.name = "Dog Star";
            bodyRef = null;
    }This program produces the following output: before: 0 (Sirius)
    after:  0 (Dog Star)Notice that the contents of the object have been modified with a name change, while the variable sirius still refers to the Body object even though the method commonName changed the value of its bodyRef parameter variable to null. This requires some explanation.
    The following diagram shows the state of the variables just after main invokes commonName:
    main()            |              |
        sirius------->| idNum: 0     |
                      | name --------+------>"Sirius"       
    commonName()----->| orbits: null |
        bodyRef       |______________|At this point, the two variables sirius (in main) and bodyRef (in commonName) both refer to the same underlying object. When commonName changes the field bodyRef.name, the name is changed in the underlying object that the two variables share. When commonName changes the value of bodyRef to null, only the value of the bodyRef variable is changed; the value of sirius remains unchanged because the parameter bodyRef is a pass-by-value copy of sirius. Inside the method commonName, all you are changing is the value in the parameter variable bodyRef, just as all you changed in halveIt was the value in the parameter variable arg. If changing bodyRef affected the value of sirius in main, the "after" line would say "null". However, the variable bodyRef in commonName and the variable sirius in main both refer to the same underlying object, so the change made inside commonName is visible through the reference sirius.
    Some people will say incorrectly that objects are passed "by reference." In programming language design, the term pass by reference properly means that when an argument is passed to a function, the invoked function gets a reference to the original value, not a copy of its value. If the function modifies its parameter, the value in the calling code will be changed because the argument and parameter use the same slot in memory. If the Java programming language actually had pass-by-reference parameters, there would be a way to declare halveIt so that the preceding code would modify the value of one, or so that commonName could change the variable sirius to null. This is not possible. The Java programming language does not pass objects by reference; it passes object references by value. Because two copies of the same reference refer to the same actual object, changes made through one reference variable are visible through the other. There is exactly one parameter passing mode -- pass by value -- and that helps keep things simple.
    -- Arnold, K., Gosling J., Holmes D. (2006). The Java� Programming Language Fourth Edition. Boston: Addison-Wesley.

  • JCS operation arguments, pass by reference or copy?

    Can I assume that objects passed from JPF into JCS, or between JCS arguments are passed by reference?
    [email protected] (replace MASK with '_')

    I'm asking this because the JCS may be in its own project independent of the web project, I wonder if it will still be pass by reference vs copy.
    If it is pass by copy, I'll need to return beans passed into JCS operations as follows:
    formBean = myControl.actionA(formBean);
    [email protected] (replace MASK with '_')

  • Arrays pass by reference?

    Hi,
    Just wondering in Java when you send a method an array, does it send a copy of the array, or a reference to the original array?

    please
    don't start that holy war up again!Oh come on, let's! It'll pass the time untilFriday
    quicker. ;)<devils-advocate>
    but surely if I'm not passing an object itself,but
    a
    reference to the object, then that's
    pass-by-reference
    Oh, do shutup. :-P
    Pass a reference != pass
    by reference.don't give me semantics. the mechanism by which I'm
    passing the object is as a reference ergo,
    it's passed, by it's reference. if it was
    pass-by-value, the object itself would be copied and
    passed, but we know it's not, so it's
    pass-by-referencePlease tell me you're kidding. And if you are, pleaes stop, lest the OP gets confused.

  • Import and export parameters of an FM are passed by value---why?

    Q]      By default the import and export parameters of an FM are passed by value---what is  the advantage of this system?

    Hi,
    Import and export parameters are, by default, passed by value. However, they can also be passed by reference. Tables parameters can only be passed by reference.
    Pass by reference means, passing the address itself rather than passing the value.
    I guess passing by value is easier and advantageous

  • Subroutine Pass by Value, Pass by Reference using xstring

    Hi,
      I am trying to check the difference between pass by value, pass by reference, pass by return value to a subroutine. When I tried integers as parameters the following functionality worked. When I am using xstring as parameters I am not getting desired results.
      Some one please explain me how the xstring's are passed to a subroutine.
    Here I am giving the code and output of the code.
    data : s_passbyref    type xstring,
           s_passbyval    type xstring,
           s_passbyretval type xstring.
    * Pass by Value, Pass by Reference, Pass by return value - STRINGS
    s_passbyref     = 'ABCD'.
    s_passbyval     = 'ABCD'.
    s_passbyretval  = 'ABCD'.
    write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', s_passbyretval.
    perform call_str_sub using s_passbyref s_passbyval changing s_passbyretval.
    write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', s_passbyretval.
    form call_str_sub using ps_passbyref value(ps_passbyval) changing value(ps_passbyretval).
      ps_passbyretval = 'XYZ'.
      ps_passbyref    = 'XYZ'.
      ps_passbyval    = 'XYZ'.
    endform.
    OUTPUT
    ByRef  :  ABCD    By Val : ABCD    By Return Value : ABCD
    ByRef  :               By Val : ABCD    By Return Value :
    Thanks in advance
    Naveen

    try this
    write : / 'ByRef :', s_passbyref, 20 'By Val :', s_passbyval, 40 'By Return Value : ', ps_passbyretval.

  • Dynamic sql reurns no data when multiple values are passed.

    (Dynamic sql returns no data when multiple values are passed.)
    Hi,
    While executing the below dynamic sql in the procedure no data is returned when it has multiple input values.
    When the input is EMPID := '1'; the procedure works fine and returns data.Any suggestion why the procedure doen't works when input as EMPID := '1'',''2'; is passed as parameter?
    =======================================================
    create or replace PROCEDURE TEST(EMPID IN VARCHAR2, rc OUT sys_refcursor)
    IS
    stmt VARCHAR2(9272);
    V_EMPID VARCHAR2(100);
    BEGIN
    V_EMPID :=EMPID;
    stmt := 'select * from TEST123 where Empid is NOT NULL';
    IF V_EMPID <> '-1' THEN
    stmt := stmt || ' and Empid in (:1)';
    ELSE
    stmt := stmt || ' and -1 = :1';
    END IF;
    OPEN rc FOR stmt USING V_EMPID;
    END Z_TEST;
    ============================================================
    Script for create table
    ==================================================================
    CREATE TABLE TEST123 (
    EMPID VARCHAR2(10 BYTE),
    DEPT NUMBER(3,0)
    ===========================================
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('1',20);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('3',30);
    Insert into PDEVUSER.TEST123 (EMPID,DEPT) values ('2',10);
    =============================================
    Select * from TEST123 where Empid in (1,2,3)
    EMPID DEPT
    1     20
    2     10
    3     30
    3     30
    2     10
    ===================================================================
    Any suggestion why the procedure doen't works when input EMPID := '1'',''2';?
    Thank you,

    The whole scenario is a little strange. When I tried to compile your procedure it couldn't compile, but I added the missing info and was able to get it compiled.
    create or replace PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
    IS
      stmt        VARCHAR2 (9272);
      V_EMPID     VARCHAR2 (100);
    BEGIN
      V_EMPID := EMPID;
      stmt := 'select * from TEST123 where Empid is NOT NULL';
      IF V_EMPID = '-1' THEN
        stmt := stmt || ' and Empid in (:1)';
      ELSE
        stmt := stmt || ' and -1 = :1';
      END IF;
      OPEN rc FOR stmt USING V_EMPID;
    END;If you pass in 1 as a parameter, it is going to execute because the statement that it is building is:
    select * from TEST123 where Empid is NOT NULL and -1 = 1Although the syntax is valid -1 will never equal 1 so you will never get any data.
    If you pass in 1,2 as a parameter then it is basically building the following:
    select * from TEST123 where Empid is NOT NULL and -1 = 1,2This will cause an invalid number because it is trying to check where -1 = 1,2
    You could always change your code to:
    PROCEDURE TEST (EMPID IN VARCHAR2, rc OUT sys_refcursor)
    IS
      stmt        VARCHAR2 (9272);
      V_EMPID     VARCHAR2 (100);
    BEGIN
      V_EMPID := EMPID;
      stmt := 'select * from TEST123 where Empid is NOT NULL';
      stmt := stmt || ' and Empid in (:1)';
      OPEN rc FOR stmt USING V_EMPID;
    END;and forget the if v_empid = '-1' check. If you pass in a 1 it will work, if you pass in 1,2 is will work, but don't pass them in with any tick marks.

  • Commas not correctly processed when values are passed through the URL!!!!!!

    I think this is a bug. Any information about this will be greatly appreciated. Here's the scenario:
    There's a single page with 2 regions. The first region contains a simple SQL report. The second region is and HTML region that contains text and date form elements. The SQL report has a column link "Edit" that when pressed it populates form elements in the HTML region. The population of the form elements is done by passing the column values of the select row as variables along the URL. The problem is that commas within column value text are processed as delimiters in the URL. From my understanding and documentation, variables and their values are supposed to look like this:
    f?p=6000:6004:&APP_SESSION.::NO:6003:MY_ITEM1,MY_ITEM2,MY_ITEM3:1234,,5678
    where MY_ITEM1 will be set to 1234, MY_ITEM2 will be set to null and MY_ITEM3 will be set to 5678 (The URL was copied directly from the Apex 3.0 documentation without modification).
    However if the first value is text (lets say "some,thing") that contains a comma, then MY_ITEM1 will be set to the text preceding the comma in the first value (some), the MY_ITEM2 will be set to the text that comes after the comma in the first value (thing) NOT null and MY_ITEM3 will be set to null NOT 5678. Clearly, one would think that the comma in the first value should be escaped given that commas are used as delimiters of values in this URL scheme.
    The URL looks like this:
    f?p=6000:6004:&APP_SESSION.::NO:6003:MY_ITEM1,MY_ITEM2,MY_ITEM3:some%2Cthing%2C%2C5678
    However the URL should look like this:
    f?p=6000:6004:&APP_SESSION.::NO:6003:MY_ITEM1,MY_ITEM2,MY_ITEM3:some%2Cthing,,5678
    where MY_ITEM1 is set to "some,thing", MY_ITEM2 is null and MY_ITEM3 is set to 5678
    What does all this mean? This means that the escaped commas (%2C) are used as delimiters for the values. Additionally, any information that is passed that contains a comma will have it's comma escaped as well AND still considered as delimiters for values in the URL. Not to mention it's inconsistent with the official documentation.

    Never mind... problem solved.
    In the Apex docs says that you can embed commas if used within backslashes like: \123,45\.
    So in order to pass text that has a comma through the URL, one must force Apex to code the URL like this (assuming that the text is coming from a report):
    f?p=6000:6004:&APP_SESSION.::NO:6003:MY_ITEM1,MY_ITEM2,MY_ITEM3:\#A_COLUMN#\,,5678
    Sorry... no bug. :)

Maybe you are looking for

  • Bullets and Transparent text boxes

    hello, I've checked out the postings already for this issue and appreciate Ricks tip on fixing the font blur issue. However, I have another bug with bullets in transparent text boxes. Upon preview or publish of a project, I see a ghost color (a littl

  • How do I deal with these SQLExceptions!!! ?

    What do these SQLException mean?? I'm trying to transfer information from one table to another. I tried two ways, and i've had problems with them FIRST WAY (USING PREPARED STATEMENT): Connection conexion = null; Connection conexion2 = null; Statement

  • HT1657 I cannot find or play my rented movie

    I have been billed and downloaded the movie.  In the iTunes application on my pc, no movies can be found....its just blank. I searched my hard drive and found the movie under C;/*/*/*/iTunes Media/Movies.  Its there.....great!  When I right click and

  • How do I maintain a single iTunes library for two separate iMac user accounts?

    How do I maintain a single iTunes library for two separate iMac user accounts?...without having to manually do something every download?

  • Merging XML and XDP files

    Hello! I must build this POC for a client and the idea is merge XML and XPD files to feed a LiveCycle Output process and create PDF files. I've built the XDP files and the XML to start things, now I need to figure out how to create the process to mer