READ_IMAGE_FILE bug?

The simplest way to load image in an image item on forms is on WHEN-BUTTON-PRESSED trigger:
read_image_file('/schite/test4.jpg', 'ANY', 'bl_Ctrl.image_item1');
where 'schite/test4.jpg' is an existing file on my Application Server 10g , a file with appropriate permissions. The form contains only one button and one image item, and the only pl/sql code is read_image_file above;
If the file exists in the Application Server path specified, form become unresponsive (hourglass, as is executing a long code). The code is not working for any file path existing in Application Server.
When i tested the code with a wrong path (ex: '/schite/nonexistingfile') the forms respond correct with message: FRM-47109 'Cannot locate file /schite/nonexistingfile'. If the path is correct form is showing the hourglass and becoming unresponsive.
It's a bug? It's something wrong with my application server? (evrething else is working ok).

Hi,
Copy your all image files into directory where your
HTML files directory ( Oracle search these image files in
local directory ( directory of HTML file ))
Best Regards,
Darshan Desai
Mumbai, India.
Bart (guest) wrote:
: Hi,
: I use the read_image_file procedure to load a local image
file
: in my form. I use also images store in my database (blob
format).
: When I launch my form in my web browser (Netscape 4.7 and
IE5),
: read_image_file procedure not work. And images from local and
: database where replaced by an broken link picture.
: How can I resolve this ???
: Thanks for your help,
: Bart
null

Similar Messages

  • Simple oracle application?

    I hope I posted this at the good section.
    I have a table with:
    NR - Number - PK
    ID - Number
    PHOTO - BLOB
    on my oracle application, i want to make a page with a form, and at the photo column, i want to have "browse..." item, so that i select a photo from the hard drive, it inserts it into my table, and if I go to my table, at the photo column, I should have something like "DOWNLOAD" but instead of this i have "datatype".
    I guess, what im trying to do, is to have a form that inserts a photo into the specific column of a table, and if i go to that exact table, i should have something like "download"...
    Hope you can help me as soon as possible.

    OK, it is a good idea to try getting an account on MetaLink. It has tons of good articles that helps you in your day-to-day usage of Oracle products.
    For now, I am cutting and pasting the contents of the note here:
    Title: How to Load Images from a Hard-disk into a Database
    Purpose
    =======
    This article describes how to load images from a local hard disk into the
    database in Forms.
    Scope and Application
    =====================
    This article is intended for novice and experienced users.
    This application works best in client-server-mode (in a GUI-environment
    such as windows or Motif). When run from the web, it is only possible to
    find and upload files found on the application-server (the machine where
    Forms runtime is running). But beware of Bug 1705928; the GET_FILE_NAME
    built-in can not be used in Webforms.
    How to Load Images From a Hard-disk Into a Database
    ===================================================
    To store images in the database, you must first create a table that can
    contain an image. The column-type can be 'Long Raw' or 'Blob' (binary
    large object). For example:
    create table StoredImages
    ( imageid number
    , imagecontainer blob
    Next, create a form, and use the data block wizard to create a default block
    on this table. Make sure that the item created on this column is of type
    'Image'.
    To load an image into this image-item, use the built-in READ_IMAGE_FILE.
    You can invoke this from a button or a trigger (for example, a
    when-mouse-click-trigger) on the item. To locate the image to be loaded,
    use the forms built-in GET_FILE_NAME (available in Forms 6.0 and higher).
    The plsql to do this will appear similar to the following:
    READ_IMAGE_FILE (
    GET_FILE_NAME( File_Filter=> 'GIF Files (*.gif)|*.gif|'),
    'GIF',
    'imagecontainer');
    When you need to load other image-types, you must change the file filter
    for GET_FILE_NAME. You also need to determine the extension and pass it
    as a second parameter to READ_IMAGE_FILE.
    References
    ==========
    Note 1029681.6 READ_IMAGE_FILE DOESN'T LOAD GIF IMAGES
    Note 1003678.6 FRM-47100 USING READ_IMAGE_FILE
    Bug 1705928 PLEASE ADD RESTRICTION FOR GET_FILE_NAME BUILT-IN IN ON-LINE HELP
    Additional
    In Forms 9.0.4 and higher you can also use Webutil to work with files on the
    client side or to upload the files from the client to the server machine and
    then to add the information of this note

  • READ_IMAGE_FILE

    The simplest way to load image in an image item on forms is on WHEN-BUTTON-PRESSED trigger:
    read_image_file('/schite/test4.jpg', 'ANY', 'bl_Ctrl.image_item1');
    where 'schite/test4.jpg' is an existing file on my Application Server 10g , a file with appropriate permissions. The form contains only one button and one image item, and the only pl/sql code is read_image_file above;
    If the file exists in the Application Server path specified, form become unresponsive (hourglass, as is executing a long code). The code is not working for any file path existing in Application Server.
    When i tested the code with a wrong path (ex: '/schite/nonexistingfile') the forms respond correct with message: FRM-47109 'Cannot locate file /schite/nonexistingfile'. If the path is correct form is showing the hourglass and becoming unresponsive.
    It's a bug? It's something wrong with my application server? (evrething else is working ok).

    The "imageNamed" method is only for images in specific locations. If you need to create an image from an arbitrary location, use "initWithContentsOfFile".
    Also, development questions like this should probably go in the Developer forum: https://discussions.apple.com/community/developer_forums

  • READ_IMAGE_FILE question

    Hi,
    I am wandering if anyone is aware of a bug or else with READ_IMAGE_FILE within Forms 6i, its just that I have been successfully storing away images to the DB by the hundreds without any problems but have just a handfull of cases that refuse, infact as soon as I capture the image the application just hangs forcing a CTRL+ALT+DEL.
    Please throw any suggestions at me.
    Cheers

    Hi Grant,
    The equipment used to capture all images is exactly the same and all is hard coded within the form. I have included the code line if it helps.
    Read_Image_File(:GLOBAL.image_filename,'ANY','table_images.image');
    (Have I interpreted your comments correctly ?)

  • READ_IMAGE_FILE built in on Forms 6i

    Hi all,
    I have learned there was a bug in Forms 6i (Win2000) using READ_IMAGE_FILE built-in. It was not possible to load JPG images without converting them in JFIF.
    Is this bug fixed? And is it a way to use an URL instead of a filesystem path to locate the image wanted?
    Thanks, Marco.

    Marco,
    If you can provide me with a bug number, then I can look it up and tell you if its fixed. Actually the read_image_from_file is supposed to read an image from the filesystem. Read image from a URL is not supported in Forms.
    Frank

  • Don't more work client_image.read_image_file if i use WEBUTIL_CLIENTINFO

    After a long time of debug of a form (it work very well for some months) i have foun d this strange thing :
    if i use in the startup form the function WEBUTIL_CLIENTINFO.GET_HOST_NAME then a form where i try to read a image from a directory with the function : client_image.read_image_file the function dos not work with the error message "PL/SQL ERROR".
    if i remove the function WEBUTIL_CLIENTINFO.GET_HOST_NAME the form became good and work very well.
    It is a BUGS ??
    JInitiator: Version 1.3.1.18
    Application server =10G
    Forms = 10G
    i may don't user the WEBUTIL_CLIENTINFO.GET_HOST_NAME but i know if there is a logic solution.
    Thank's again.

    client_image.read_image_file(vfilename,v_ending,'SR_SCREEN_SHOTS.SCREEN_SHOT'); ---- error occurs during call here
    Above code will try to:
    1. read file from client using full file name including path as user selected. (like D:/temp/...
    2. transfer it to transfer.appsrv.workAreaRoot on server. like /tmp/
    3. Read it from transfer.appsrv.workAreaRoot and load into Image item
    client_image.write_image_file(vwritefile,v_ending,'SR_SCREEN_SHOTS.SCREEN_SHOT',maximize_compression,ORIGINAL_DEPTH);
    This will try to write image from the Image Item to the path on client!.
    All values in webutil.cfg should reffer to AS folders
    transfer.appsrv.read
    transfer.appsrv.write
    transfer.appsrv.transfer.appsrv.workAreaRoot

  • Problems with WEBUTIL_CORE on OAS 10.1.2 (CLIENT_IMAGE.READ_IMAGE_FILE)

    Hello,
    I get a problem with webutil 106 on Application Server 10.1.2.0.2 (RedHat 4)
    Some functions raise errors as :
    oracle.forms.net.ConnectionException: Abandon de la session Forms <839> : communication avec le processus runtime impossible.
    at oracle.forms.net.ConnectionException.createConnectionException(Unknown Source)
    at oracle.forms.net.HTTPNStream.getResponse(Unknown Source)
    at oracle.forms.net.HTTPNStream.doFlush(Unknown Source)
    at oracle.forms.net.HTTPNStream.flush(Unknown Source)
    at java.io.DataOutputStream.flush(Unknown Source)
    at oracle.forms.net.StreamMessageWriter.run(Unknown Source)
    For testing, I use the demo form WU_TEST_106 and I encounter this problem with :
    CLIENT_IMAGE.READ_IMAGE_FILE
    I get another problem with SHOWBEANS(FALSE) that doesn't terminate (showbeans(true) works fine)
    I've tried others Webutil functions that works fine
    I've another platform with same release of Webutil / OAS 10.1.2 / Redhat4 which works fine (the major difference is that OAS was installed with portal in this last platform).
    I've made those test with same client and same database (10g)
    Any ideas ?

    Seems to be a bug. That was the response from Oracle support (Metalink)
    Response:
    Your issue seems to be related to bug 5594702 - Abstract: EJB30 ENTITY BEAN WITH @ID AND @COLUMN ANNOTATION FAILS TO DEPLOY ON AIX.
    There is an issue with the IBM JDK/JRE 1.5's processing of annotations.
    Links:
    http://www.theserverside.com/discussions/thread.tss?thread_id=37764
    http://www-128.ibm.com/developerworks/forums/dw_thread.jsp?forum=367&thread=112543&cat=10
    When processing annotations it returns boolean values as false.
    Work-around:
    Fully specify the @Column annotation's boolean values. If insertable and updatable are set to false (which will happen due to this bug) then TopLink sets the PK
    mapping to read-only and the exception seen is expected.
    Note: nullable attribute of the @Colmun is not used in the EJB3/JPA preview of 10.1.3.0 If the customer MUST override the default column name then they should use:
    @Column(name="column-name", insertable=true, updatable=true)
    If they do not wish to override the default column name then simply do not use an @Column annotation.
    It can be deleted or commented out in the JDev generated code.
    There are two reported annotation processing issues with the AIX JVM. One was fixed in SR1 and the other is fixed
    in SR3 (due out Oc 11 - today). Upgrading to these more recent JVM releases may also address this issue.
    RECOMMENDED SOLUTIONS:
    1. Upgrade the IBM AIX JVM to SR3.
    OR
    2. Fix all generated @Column annotations as described above

  • Index with "or" clause (BUG still exists?)

    The change log for 2.3.10 mentions "Fixed a bug that caused incorrect query plans to be generated for predicates that used the "or" operator in conjunction with indexes [#15328]."
    But looks like the Bug still exists.
    I am listing the steps to-repro. Let me know if i have missed something (or if the bug needs to be fixed)
    DATA
    dbxml> openContainer test.dbxml
    dbxml> getDocuments
    2 documents found
    dbxml> print
    <node><value>a</value></node>
    <node><value>b</value></node>
    INDEX (just one string equality index on node "value")
    dbxml> listIndexes
    Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
    Index: node-element-equality-string for node {}:value
    2 indexes found.
    QUERY
    setVerbose 2 2
    preload test.dbxml
    query 'let $temp := fn:compare("test", "test") = 0
    let $results := for $i in collection("test.dbxml")
    where ($temp or $i/node[value = ("a")])
    return $i
    return <out>{$temp}{$results}</out>'
    When $temp is true i expected the result set to contain both the records, but that was not the case with the index. It works well when there is no index!
    Result WITH INDEX
    dbxml> print
    <out>true<node><value>a</value></node></out>
    Result WITHOUT INDEX
    dbxml> print
    <out>true<node><value>a</value></node><node><value>b</value></node></out>

    Hi Vijay,
    This is a completely different bug, relating to predicate expressions that do not examine nodes. Please try the following patch, to see if it fixes this bug for you:
    --- dbxml-2.3.10-original/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-04-18 10:05:24.000000000 +0100
    +++ dbxml-2.3.10/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-08-08 11:32:10.000000000 +0100
    @@ -1566,11 +1572,12 @@
         else if(name == Or::name) {
              UnionQP *unionOp = new (&memMgr_) UnionQP(&memMgr_);
    +          result.operation = unionOp;
              for(VectorOfASTNodes::iterator i = args.begin(); i != args.end(); ++i) {
                   PathResult ret = generate(*i, ids);
                   unionOp->addArg(ret.operation);
    +               if(ret.operation == 0) result.operation = 0;
    -          result.operation = unionOp;
         // These operators use the presence of the node arguments, not their valueJohn

  • Bug report follow-up

    is there a way to follow-up on a bug report that i submitted?  i have the bug number, but would like to see if the report was understood, filled out properly and determine the status of the bug report.
    thanks,
    doug

    They comment on bugs if actions were taken. Otherwise - don't expect any feedback.

  • Solaris8 and 9 (possibly 7) /dev/poll driver bug report.

    Hello,
    I'd like to report a bug in the solaris 8 and 9 /dev/poll driver (poll(7d)).
    As i do not have a support account with sun or anything like that, there
    seems to be no other way to do that here (which is of course a very sad
    thing).
    Bug details:
    The /dev/poll device provides an ioctl-request (DP_ISPOLLED) for checking
    if a particular filedescriptor is currently in the set of monitored
    filedescriptors for that particular /dev/poll fd set (open /dev/poll fd).
    A quote from the documentation of the poll(7d) manual page taken from
    Solaris9:
    "DP_ISPOLLED ioctl allows you to query if a file descriptor is already in
    the monitored set represented by fd. The fd field of the pollfd structure
    indicates the file descriptor of interest. The DP_ISPOLLED ioctl returns 1
    if the file descriptor is in the set. The events field contains the
    currently polled events. The revents field contains 0. The ioctl returns 0
    if the file descriptor is not in the set. The pollfd structure pointed by
    pfd is not modified. The ioctl returns a -1 if the call fails."
    It says that when you query for an filedescriptor which is currently being
    monitored in the set, that it would return 1, and change the events field of
    the pollfd structure to the events it's currently monitoring that fd for.
    The revents field would be set to zero.
    However the only thing which actually happens here, is that FD_ISPOLLED
    returns 1 when the fd is in the set and 0 if not. When the fd is in the
    set, when FD_ISPOLLED returns 1, the events field remains unmodified, but
    the revents field gets changed.
    A small sample code to illustrate:
    #include <stdio.h>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <sys/devpoll.h>
    main() {
    struct pollfd a;
    int dp_fd = open("/dev/poll", O_WRONLY);
    a.fd = 0; /* stdin */
    a.events = POLLIN; /* we monitor for readability, POLLIN=1 */
    a.revents = 0;
    write(dp_fd, &a, sizeof(a));
    a.fd = 0;
    a.events = 34; /* filled in with bogus number to show malfunctioning */
    a.revents = 0;
    printf("DP_ISPOLLED returns: %d\n", ioctl(dp_fd, DP_ISPOLLED, &a));
    printf("a.fd=%d, a.events=%hd, a.revents=%hd\n", a.fd, a.events,
    a.revents);
    According to the documentation of /dev/poll and namely DP_ISPOLLED this
    program is supposed to print the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=1, a.revents=0
    However it prints the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=34, a.revents=1
    You can take any number instead of '34' and it will simply remain untouched
    after the DP_ISPOLLED ioctl-request.
    I hope it's clear now that the solaris8 and solaris9 (and probably solaris7
    with /dev/poll patch too) DP_ISPOLLED implementation is broken.
    This bug is also easily illustrated by looking at the solaris8 kernel sourcecode:
    <snippet osnet_volume/usr/src/uts/common/io/devpoll.c:dpioctl()>
    case DP_ISPOLLED:
    pollfd_t pollfd;
    polldat_t *pdp;
    if (pollfd.fd < 0) {
    mutex_exit(&pcp->pc_lock);
    break;
    pdp = pcache_lookup_fd(pcp, pollfd.fd);
    if ((pdp != NULL) && (pdp->pd_fd == pollfd.fd) &&
    (pdp->pd_fp != NULL)) {
    pollfd.revents = pdp->pd_events;
    if (copyout(&pollfd, (caddr_t)arg,
    sizeof(pollfd_t))) {
    mutex_exit(&pcp->pc_lock);
    DP_REFRELE(dpep);
    return (set_errno(EFAULT));
    *rvalp = 1;
    </snippet>
    its' clearly visible that the code writes the current monitored events to
    the revents field:
    'pollfd.revents = pdp->pd_events;'
    and that it doesnt set revents to zero.
    It's funny to see that this has been like this since Solaris8 (possibly 7). That means nobody ever used DP_ISPOLLED that way or people were simply to lazy to file a bug report.
    Another funny thing related to this. is that Hewlett-Packard did seem to know about this. Since HP-UX11i version 1.6 they also support /dev/poll. From their manual page i ll quote some sentences from their WARNING session:
    "The ioctl(DP_ISPOLLED) system call also returns its result in the revents member of the pollfd structure, in order to be compatible with the implementation of the /dev/poll driver by some other vendors."
    Hopefully this will get fixed.
    I also like to reexpress my very negative feelings towards the fact that you're not able to file bug reports when you do not have a support contract. Ridiculous.
    Thanks,
    bighawk

    Have I mentioned how much i love my playbook now Great job on os 2.0

  • Problem in using client_image.read_image_file

    Hi all
    I want to load a picture file into a forms item at Develeoper Forms 10g Rel.2 with the following procedure, but it doesnt work and i also get no error.
    PROCEDURE import_image
    IS
    vFileName VARCHAR2(512);
    BEGIN
    -- Transfer Picture from File Directory to Forms Item.
    GO_BLOCK('FOTO');
    SET_BLOCK_PROPERTY(FIND_BLOCK('FOTO'), DEFAULT_WHERE,
    'natpers_oid = 55664');
    EXECUTE_QUERY;
    SET_BLOCK_PROPERTY(FIND_BLOCK('FOTO'), INSERT_ALLOWED,
    PROPERTY_TRUE);
    SET_BLOCK_PROPERTY(FIND_BLOCK('FOTO'), UPDATE_ALLOWED,
    PROPERTY_TRUE);
    SET_ITEM_PROPERTY(FIND_ITEM('FOTO.FOTO'), INSERT_ALLOWED,
    PROPERTY_TRUE);
    SET_ITEM_PROPERTY(FIND_ITEM('FOTO.FOTO'), UPDATE_ALLOWED,
    PROPERTY_TRUE);
    BEGIN
    vFileName := NULL;
    vFileName := webutil_file.file_selection_dialog('C:\Temp\', '*',
    '|Foto Dateien(*.bmp)|*.bmp|', 'Foto');
    END;
    IF vFileName IS NOT NULL THEN
    client_image.read_image_file(vFileName, 'BMP', FIND_ITEM('FOTO.FOTO'));
    client_host('cmd DEL ' || vFileName);
    END IF;
    END import_image;
    I think the WebUtil 1.0.6 works properly because the 'webutil_file.file_selection_dialog' (see above) works fine.
    Now can somebody give me a tip?
    Best regards
    Martin

    I found the problem :-)
    When i change the following parameter in the file webutil.cfg it works fine.
    transfer.appsrv.enabled=TRUE (old: FALSE)
    Martin

  • [bdb bug]repeatly open and close db may cause memory leak

    my test code is very simple :
    char *filename = "xxx.db";
    char *dbname = "xxx";
    for( ; ;)
    DB *dbp;
    DB_TXN *txnp;
    db_create(&dbp,dbenvp, 0);
    dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
    ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
    if(ret != 0)
    printf("failed to open db:%s\n",db_strerror(ret));
    return 0;
    txnp->commit(txnp, 0);
    dbp->close(dbp, DB_NOSYNC);
    I try to run my test program for a long time opening and closing db repeatly, then use the PS command and find the RSS is increasing slowly:
    ps -va
    PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
    1986 pts/0 S 0:00 466 588 4999 980 0.3 -bash
    2615 pts/0 R 0:01 588 2 5141 2500 0.9 ./test
    after a few minutes:
    ps -va
    PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
    1986 pts/0 S 0:00 473 588 4999 976 0.3 -bash
    2615 pts/0 R 30:02 689 2 156561 117892 46.2 ./test
    I had read bdb's source code before, so i tried to debug it for about a week and found something like a bug:
    If open a db with both filename and dbname, bdb will open a db handle for master db and a db handle for subdb,
    both of the two handle will get an fileid by a internal api called __dbreg_get_id, however, just the subdb's id will be
    return to bdb's log region by calling __dbreg_pop_id. It leads to a id leak if I tried to open and close the db
    repeatly, as a result, __dbreg_add_dbentry will call realloc repeatly to enlarge the dbentry area, this seens to be
    the reason for RSS increasing.
    Is it not a BUG?
    sorry for my pool english :)
    Edited by: user9222236 on 2010-2-25 下午10:38

    I have tested my program using Oracle Berkeley DB release 4.8.26 and 4.7.25 in redhat 9.0 (Kernel 2.4.20-8smp on an i686) and AIX Version 5.
    The problem is easy to be reproduced by calling the open method of db handle with both filename and dbname being specified and calling the close method.
    My program is very simple:
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/time.h>
    #include "db.h"
    int main(int argc, char * argv[])
    int ret, count;
    DB_ENV *dbenvp;
    char * filename = "test.dbf";
    char * dbname = "test";
    db_env_create(&dbenvp, 0);
    dbenvp->open(dbenvp, "/home/bdb/code/test/env",DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_INIT_MPOOL, 0);
    for(count = 0 ; count < 10000000 ; count++)
    DB *dbp;
    DB_TXN *txnp;
    db_create(&dbp,dbenvp, 0);
    dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
    ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
    if(ret != 0)
    printf("failed to open db:%s\n",db_strerror(ret));
    return 0;
    txnp->commit(txnp, 0);
    dbp->close(dbp, DB_NOSYNC);
    dbenvp->close(dbenvp, 0);
    return 0;
    DB_CONFIG is like below:
    set_cachesize 0 20000 0
    set_flags db_auto_commit
    set_flags db_txn_nosync
    set_flags db_log_inmemory
    set_lk_detect db_lock_minlocks
    Edited by: user9222236 on 2010-2-28 下午5:42
    Edited by: user9222236 on 2010-2-28 下午5:45

  • Multiple return values (Bug-ID 4222792)

    I had exactly the same request for the same 3 reasons: strong type safety and code correctness verification at compile-time, code readability and ease of mantenance, performance.
    Here is what Sun replied to me:
    Autoboxing and varargs are provided as part of
    JSRs 14 and 201
    http://jcp.org/en/jsr/detail?id=14
    http://jcp.org/en/jsr/detail?id=201
    See also:
    http://forum.java.sun.com/forum.jsp?forum=316
    http://developer.java.sun.com/developer/earlyAccess/adding_generics/index.html
    Multiple return values is covered by Bug-ID 4222792
    Typically this is done by returning an array.
    http://developer.java.sun.com/developer/bugParade/bugs/4222792.html
    That's exactly the problem: we dynamically create instances of array objects that would better fit well within the operand stack without stressing the garbage collector with temporary Array object instances (and with their backing store: 2 separate allocations that need to be recycled when it is clearly a pollution that the operand stack would clean up more efficiently)
    If you would like to engage in a discussion with the Java Language developers, the Generics forum would be a better place:
    http://forum.java.sun.com/forum.jsp?forum=316
    I know that (my report was already refering to the JSR for language extension) Generics is not what I was refering to (even if a generic could handle multiple return values, it would still be an allocated Object
    instance to pack them, i.e. just less convenient than using a static class for type safety.
    The most common case of multiple return values involve values that have known static datatypes and that should be checked with strong typesafety.
    The simple case that involves returning two ints then will require at least two object instances and will not solve the garbage collection overhead.
    Using a array of variable objects is exactly similar, except that it requires two instances for the components and one instance for the generic array container. Using extra method parameters with Integer, Byte, ... boxing objects is more efficient, but for now the only practical solution (which causes the least pollution in the VM allocator and garbage collector) is to use a custom class to store the return values in a single instance.
    This is not natural, and needlessly complexifies many interfaces.
    So to avoid this pollution, some solutions are used such as packing two ints into a long and returning a long, depacking the long after return (not quite clean but still much faster at run-time for methods that need to be used with high frequencies within the application. In some case, the only way to cut down the overhead is to inline methods within the caller code, and this does not help code maintenance by splitting the implementation into small methods (something that C++ can do very easily, both because it supports native types parameters by reference, and because it also supports inline methods).
    Finally, suppose we don't want to use tricky code, difficult to maintain, then we'll have to use boxing Object types to allow passing arguments by reference. Shamely boxed native types cannot be allocated on the operand stack as local variables, so we need to instanciate these local variables before call, and we loose the capacity to track the cases where these local variables are not really initialized by an effective call to the method that will assign them. This does not help debugging, and is against the concept of a strongly typed language like Java should be:
    Java makes lots of efforts to track uninitialized variables, but has no way to determine if an already instanciated Object instance refered in a local variable has effectively received an effective assignment because only the instanciation is kept. A typical code will then need to be written like this:
    Integer a = null;
    Integer b = null;
    if (some condition) {
    //call.method(a, b, 0, 1, "dummy input arg");
    // the method is supposed to have assigned a value to a and b,
    // but can't if a and b have not been instanciated, so we perform:
    call.method(a = new Integer(), b = new Integer(), 0, 1, "dummy input
    arg");
    // we must suppose that the method has modified (not initialized!)
    the value
    // of a and b instances.
    now.use(a.value(), b.value())
    // are we sure here that a and b have received a value????
    // the code may be detected at run-time (a null exception)
    // or completely undetected (the method() above was called but it
    // forgot to assign a value to its referenced objects a and b, in which
    // case we are calling in fact: now.use(0, 0); with the default values
    // or a and b, assigned when they were instanciated)
    Very tricky... Hard to debug. It would be much simpler if we just used:
    int a;
    int b;
    if (some condition) {
    (a, b) = call.method(0, 1, "dummy input arg");
    now.use(a, b);
    The compiler would immediately detect the case where a and b are in fact not always initialized (possible use bere initialization), and the first invoked call.method() would not have to check if its arguments are not null, it would not compile if it forgets to return two values in some code path...
    There's no need to provide extra boxing objects in the source as well as at run-time, and there's no stress added to the VM allocator or garbage collector simply because return values are only allocated on the perand stack by the caller, directly instanciated within the callee which MUST (checked at compile-time) create such instances by using the return statement to instanciate them, and the caller now just needs to use directly the variables which were referenced before call (here a and b). Clean and mean. And it allows strong typechecking as well (so this is a real help for programmers.
    Note that the signature of the method() above is:
    class call {
    (int, int) method(int, int, String) { ... }
    id est:
    class "call", member name "method", member type "(IILjava.lang.string;)II"
    This last signature means that the method can only be called by returning the value into a pair of variables of type int, or using the return value as a pair of actual arguments for another method call such as:
    call.method(call.method("dummy input arg"), "other dummy input arg")
    This is strongly typed and convenient to write and debug and very efficient at run-time...

    Can anyone give me some real-world examples where
    multiple return values aren't better captured in a
    class that logically groups those values? I can of
    course give hundreds of examples for why it's better
    to capture method arguments as multiple values instead
    of as one "logical object", but whenever I've hankered
    for multiple return values, I end up rethinking my
    strategy and rewriting my code to be better Object
    Oriented.I'd personally say you're usually right. There's almost always a O-O way of avoiding the situation.
    Sometimes though, you really do just want to return "two ints" from a function. There's no logical object you can think of to put them in. So you end up polluting the namespace:
    public class MyUsefulClass {
    public TwoInts calculateSomething(int a, int b, int c) {
    public static class TwoInts {
        //now, do I use two public int fields here, making it
        //in essence a struct?
       //or do I make my two ints private & final, which
       //requires a constructor & two getters?
      //and while I'm at it, is it worth implementing
      //equals(), how about hashCode()? clone()?
      //readResolve() ?
    }The answer to most of the questions for something as simple as "TwoInts" is usually "no: its not worth implementing those methods", but I still have to think about them.
    More to the point, the TwoInts class looks so ugly polluting the top level namespace like that, MyUsefulClass.TwoInts is public, that I don't think I've ever actually created that class. I always find some way to avoid it, even if the workaround is just as ugly.
    For myself, I'd like to see some simple pass-by-value "Tuple" type. My fear is it'd be abused as a way for lazy programmers to avoid creating objects when they should have a logical type for readability & maintainability.
    Anyone who has maintained code where someone has passed in all their arguments as (mutable!) Maps, Collections and/or Arrays and "returned" values by mutating those structures knows what a nightmare it can be. Which I suppose is an argument that cuts both ways: on the one hand you can say: "why add Tuples which would be another easy thing to abuse", on the other: "why not add Tuples, given Arrays and the Collections framework already allow bad programmers to produce unmainable mush. One more feature isn't going to make a difference either way".
    Ho hum.

  • Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Remove the extensions, redownload Safari, reload the extensions.
    http://www.apple.com/safari/download/
    And if you really want a better experience, use Firefox, tons more choices and possibilities there.
    Firefox's "NoScript" will block the Trojan going around on websites. Best web security you can get.
    https://addons.mozilla.org/en-US/firefox/addon/noscript/
    Ghostery, Ad Block Plus and thousands of add-ons more have originated on Firefox.

  • Bug? My events on the iPad iCal app aren't shown in the year view if they are more than two years in the future.

    My events on the iPad iCal app aren't shown in the year view if they are more than two years in the future even though I can see them on the month, week and day view. Any suggestions on how to fix it? I've tried it all. I called the apple support and they checked on their iPads. They all did the same and they couldn't help me. They suggested trying this way. I'd like to be able to plan a few years ahead and the year view would make thing so easy!
    Is this a bug?

    Go to the Home screen and double click the Home button. That will reveal the row of recently used apps at the bottom of the screen. Tap and hold on the app in question until it wiggles and displays a minus sign. Tap the minus sign to actually quit the app. Then tap anywhere on the screen above that bottom row to return the screen to normal. Then restart the app and see if it works normally.
    Then reboot your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.

Maybe you are looking for

  • Sub total column in MM pricing and Base value for tax

    Hi,   In MM pricing in M/08 for the condition we can use subtotal filed for multiple conditions if we use same subtotal fileds the value of all condition will be added in the define subtotal filed,  so this is only effect of subtotal  or it has also

  • Is there a way to combine projects in Imovie

    I am trying to make a dvr of both class pictures and a small video, is there a way to combine them so it will just run from one to the other

  • DMS-KM connector and active version in DMS

    I was wondering if it possible to bring back only the active version of a document using the DMS connector?? We created a varient but do not see anywhere to specify that we only want to Active version to be returned... so for each document we get eve

  • MBD message ordering

              Hi All,           I have a problem with sequencing of messages redelivered to MDBs on WL8.1. I have           looked through the solutions posted to the same problem on this newsgroup but           they seem to have made no difference.     

  • What fits better to this scenario? ESB or BPEL? (SOA suite 10.1.3.1)

    Hi, Below is a sample situation which needs to be built as a set of processes/flow in ESB. Could anybody pls tell us if we are on the right track here? a. A partner system needs to invoke one of our web services to perform an operation supported by t