Copying an unknown Object

I have an Object that I pull from a Hashtable. I don't know what type of Object it is, nor do I care. But I need to make a copy of it and .clone() is protected on Object.
eg.
Object obj1 = hashtable.get(key);
Object obj2 = obj1.clone(); // WILL NOT COMPILE (even in a try block)
Any ideas?

If these objects were created by your code, then they each need to implement Cloneable and also implement a public clone() method. If you call the clone() method of Object via super.clone(), then it is a shallow copy and you'll need to copy any embedded objects yourself.
Assuming that all the classes in your Hashtable implement a public clone() method, then you'll need to either cast the reference to the appropriate class , or else use reflection to invoke the clone method.
e.gimport java.lang.reflect.*;
Object obj = yourHashtable.get("key");
try {
    Method meth = obj.getClass().getMethod("clone", null);
    try {
        Object x = meth.invoke(obj, null);
        ...do something with cloned object x...
    } catch (Exception ex) {
        System.out.println("cannot call clone method: " + ex);
} catch (NoSuchMethodException nsmex) {
    System.out.println("No public clone method exists: " + nsmex);
}

Similar Messages

  • Powershell Script to Copy an Unknown number of Files in a Directory

    I need to be able to copy an unknown number of files in a folder to an FTP site.  I have the FTP components figured out and working, but am running into a problem when there is only 1 file for upload.  The folder is a queue that users manually
    copy files to, so i do not have control of how many files may be pending.  And the file names are always different.
    My script performs the following steps.
    1. Get a list of files in the directory with the a attribute.  (this prevents subfolders from being processed)
    2. Loop thru the list, copying each file.
    Here is my problem.
    no files. nothing happens. normal and expected
    2 or more files. all files upload correctly.  EXPECTED
    Filename returned from variable = "True".  File does not exist and upload fails.  ERROR
    This is what the script looks like. (There are several Write-Output statements for debugging purposes.
    $ftpUploadPath = "$ftpServer/claims/"
    $localUploadPath = "$localDir\claims\"
    $localSentPath = "$localUploadPath`Sent\"
    $listFile = "$localDir\uplist.txt"
    Write-Output "Uploading Claim files to $ftpUploadPath ..."
    #1 get list of claim files to upload
    $list = Get-ChildItem -Name $localUploadPath -Attributes a   
    Write-Output $list
    Write-Output " "
    #2 loop thru list and upload files
    if($list.Length -ne 0){
        #Write-Output "  Getting files from list"
        # download each file in the list
        foreach ($file in $list -cne "") {
            Write-Output $file
        } # end foreach file
    } #end if($list.Length)
    else {
        Write-Output "  No files for upload"
    } #end else($list.Length)
    Thanks in advance,
    Greg

    You are writing way too many lines for such a simple task. Try this:
    Get-ChildItem -Name $localUploadPath -Attributes a |
    ForEach-Object{
    Write-Host $_ -fore green
    $_
    \_(ツ)_/

  • Unknown Object Classes

    Hi All,
    I am new to DS.I am getting this below error when importing LDIF file to newly created DS instance.It seems that some custom defined objectClasses is missing.
    +[21/May/2009:09:40:41 +0800] - ERROR<5894> - Schema - conn=-1 op=-1 msgId=-1 - User error: Entry "uid=1000462550,ou=rapids,o=PBG, dc=apac,dc=nsroot,dc=net" has unknown object class "custominetOrgPerson"+

    Please make sure you migrate your schema as well beforehand. The schema is in the <instance>/config/schema directory. 99user.ldif is what has all customisations. Copy that over to the new instance and see how you go. If not, search the old instance for your missing objectclass and copy that over.
    OR
    If both instances are online already, you could do an online initialization which replica schema and data.

  • Getting error in DB02 after checking Consistency check Unknown objects in A

    Dear All,
    I have getting error in DB02 after checking Consistency check.
    Please find the details.
    I have queries.
    How to correct the Unknown objects in ABAP Dictionary and Optional index is also we have to create please suggest step by step process.    
    Missing in R/3 DDIC      1              11
    Consistency check of 07.04.2009 10:14:24                   
    -- Objects missing in the database          
    Primary indexes                  0
    Secondary indexes                0
    Tables                           0
    Views                            0
    -- Unknown objects in ABAP Dictionary       
      |   |-- DB tables                        1
          |-- DB indexes                      11
         |-- DB views                        12
    -- DB tables without unique index   1
    -- Optional indexes                         
    Too many indexes created         0
    -- Indexes not created            145
    Regards,

    Hi
    Check this may help you
    http://help.sap.com/saphelp_nwmobile71/helpdata/en/45/e4ff3e65b66976e10000000a1553f6/content.htm
    Regards
    Uday

  • DB02 = Missing Tables and Indexes = Unknown objects in ABAP Dictionary = DB views

    Hi SAP Gurus,
    on our SAP NetWeaver 7.x BW (based on AIX/Oracle) I find via transaction DB02 (path = Diagnostics => Missing Tables and Indexes) under "Unknown objects in ABAP Dictionary" under DB views a BW object /BI0/.....
    When I make a double click on the object, I am getting the popup window "Display not possible for this object":
    How can I identify the object and clarify with the BW application expert, if needed, how to resolve this object?
    I searched already via RSA1 for the object, but I wasn't able to find anything so far ...
    Thanks for your help and ideas.
    Best regards
    Carlos

    Hello Carlos
    The database view in question is a temporary database object created during a query execution.
    Please read this SAP note 449891 - Temporary database objects in BW 3.x to understand what that view is all about and impact if those views are removed.
    The SAP notes 449891 and 1139396 suggests to run the report SAP_DROP_TMPTABLES to drop these temporary objects. Whether the objects are still required or not is a question to be put across to the BW team. If the temporary objects are removed when they are used by a query, then the query will fail.
    Have a nice day
    RB

  • Unknown Objects in ABAP Dictionary

    Hello Everyone,
    I am getting a few objects that come up when running the Missing tables and Indexes command in the DBCOCKPIT. Under Unknown Objects in ABAP Dictionary I have the following objects appear:
    sap_tabstats
    V_MSSDWDLLS
    sap_tabstats_V_newest
    sap_tabstats_V_oldest
    I cannot find anything referencing how to correct this issue. Can anyone be of any assistance? I would greatly appreciate it. Thanks!

    Hi:
    for  sap_tabstats, sap_tabstats_V_oldest and sap_tabstats_V_newest you can find in note 1027512 :
    4.  IMPORTANT CHANGES IN DATA COLLECTION AND HISTORY                                                                               
    o  Applying SP12 on a SQL Server system will introduce a new method
            for collecting database and table size histories.  This new    
            methode relies on t-sql objects sap_tabstats,                  
            sap_tabstats_V_newest, and sap_tabstats_V_oldest.  These items 
            aren't in the data dictionary and should be ignored in any     
            discrepancy reports.  They are added to an exception table for 
            SP13.                                                          
    For V_MSSDWDLLS you should read note 1020865. The view can be ignored.
    Regards
      Clas

  • Unknown object in ABAP Dictionary

    Hello
    In st04 in  "Missing tables and indexes" are many  indexes have reported unknown "Unknown object in ABAP Dictionary".
    This is because indexex are created directly in DB. Is there a way to solve this problem?
    We have db : oracle 10.2.04 and sap SAP ECC 6.0 (Pkg. lvl. 254).

    Hi,
    In ST04, If you click Missing tables and indexes then next to "Unknown object in ABAP Dictionary"  there is a information button which says as below, kindly go through it which could help you.
    " Here objects which were found on the database but which are not defined
    in the ABAP Dictionary are displayed. These objects are displayed for
    information only, since they generally do not belong to the SAP System.
    These objects normally do not cause problems.
    The objects are generally created directly with database means. If the
    author is unknown, the purpose of the table can sometimes be determined
    using the display function. Any data can only be displayed with database
    means since the SAP tools for displaying data are based on the
    definition in the ABAP Dictionary.
    In some cases, such objects were already overlooked by SAP at delivery
    or occurred during upgrading. To check this, search in OSS using the
    keyword DB02 and the Release level for a corresponding Note.
    Customer tables, views and indexes should always be created with the
    ABAP Dictionary. This is the only way to ensure that the objects are
    recognized by the SAP System and that for example collisions can be
    avoided during an upgrade."
    Regards,
    Sharath

  • BW - Unknown objects in ABAP Dictionary - DB Tables

    Hello gurus,
    As a result of the consistency check in DB02 transaction, our BW System is showing a high number of "DB Tables" and "DB Tables withouth unique index" as unknown objects in the ABAP dictionary.
    Is there any way to solve these consistency issues detected in DB02?
    Thanks
    Regards

    Hi Dibya,
    I checked the SAP note 33814 and it tooke me to the SAP note 449891 - Temporary database objects in BW 3.X
    According to the recommendations, I executed the report SAP_UPDATE_DBDIFF, and I got as result 579 secondary indexes missing in the DB from the and still the 5 DB Tables unknown in the ABAP dictionary and 2 DB Tables withouth unique index,
    I executed the report SAP_INFOCUBE_INDEXES_REPAIR in order to try to repair the secondary missing indexes that were shwon but withouth getting any results.
    Do you have any recommendation to solve this situation?  In the original scenario the DB02 transaction wasn't reporting any missing index.
    Thanks and regards,

  • Unknown object in ABAP dictionary- TADIR^SRCDEP

    Hi,
    I found an entry in unknown object in ABAP dictionary while monitoring the system.
    This this the location I found this entry DBACOCKPIT-> Diagnostics-> missing table and indexes-> unknown object in ABAP dictionary.
    Could you please help to figure out how to solve this?
    Thanks in advance.
    Regards,
    Pradeep

    Hello,
    You can ignore the index TADIR^SRCDEP in transaction DB2.
    The installation creates the index TADIR^SRCDEP to avoid hanging
    situations on the database while executing reports. When the
    installation is finished you can delete this index.
    Drop the index TADIR^SRCDEP on the database:
        o  start SQL Server Management Studio
        o  connect to your SQL Server
        o  open a query window and execute the following command (replace
           SID by the uppercase system name, sid by the lowercase system
           name):
           drop index [TADIR^SRCDEP] on SID.sid.TADIR
    Best regards
      Clas

  • Error "No status object is available for Unknown Object " in Shopping Cart

    Hi all,
    We are getting error "No status object is available for <Unknown Object>" while creating shopping carts of any type .
    Please suggest if any configuration setting needs to be done.
    Thanks and Regards,
    Navdeep Malik

    Dear Navdeep
    The error is likely caused by one or more entries in table BBP_DOCUMENT_TAB that are without objkey or guid.
    did you delete some entries from SRM transaction tables?
    Check table BBP_DOCUMENT_TAB entries to see any GUID which is not present in the system.
    You can verify this by checking whether there is an entry in CRMD_ORDERADM_H (header) table
    with GUID = <guid stored in bbp_document_tab>
    Regards
    Lauren

  • How to Copy and Paste object in InDesignServer CS3.

    Hi All:
    Is there a method to copy and paste object in InDesignServer CS3?
    Thanks in advanced.

    search forum - workaround - export snippet
    robin
    www.adobescripts.com

  • "Unknown Object :unexpected AST node" prompt error when translating T-SQL

    Hi,All
    We are using Oracle SQL Developer 2.1 to do a migration from Sybase ASE to Oracle.
    When we use Scratch Editor to translate one of Sybase T-SQL stored procedures,it failed.
    In the migration log ,we just get the following error:
    "Unknown Object :unexpected AST node: PROCEDURE: Line -1 Column -1 "
    But other T-SQL SPs can be translated smoothly Scratch Editor.
    Anyone has met this error before?
    Hope for your advice.

    Hi Mary,
    what is your version of Sybase ASE? Only versions 12 and 15 can be migrated using SQL Developer.
    I found no source that reported the same issue. To be able to find the cause of the problem it would be helpful if you post here a T-SQL SP that shows up the error.
    I suppose you have read the "Oracle® Database SQL Developer Supplementary Information for Microsoft SQL Server and Sybase Adaptive Server Migrations" manual, available at http://download.oracle.com/docs/cd/E12151_01/doc.150/e12156.pdf ?
    Best regards
    Wolfgang

  • Problem with copy of the object

    Hi,
    trying to copy (clone) my object:
    var a:TestObj = new TestObj()
    var a2:TestObj = ObjectUtil.copy( a ) as TestObj;
    but i recieve nothing. So the ObjectUtil.copy can return me
    only the Object type, but i want a concrete type!!!
    Is it possible?

    It seems your dealing with request scoped object(s). So you should be safe with respect to the multiple threads.

  • Is it possible to create a "virtual" copy of an object in illustrator?

    In other words, lets say that I've got an object (that might be a simple object like a square, or a complicated group, or anything).
    I can select the object, copy it and then paste it at some other location, but now it is a separate object.
    What I'd like to do is make a "virtual" copy of the object, so that if any modifications are done to one of the copies, they are also done to the other copy. I.e., if I change the color of one sub-object in one of the virtual copies, the color also changes in the corresponding sub-object of the other virtual copy.
    Note that this is similar to lightrooms virtual copy feature of images, but in that case, the modifications are separate even though the underlying image stayes the same. What I'm asking about here is for the ability to "link" objects together.
    BTW, the basic reason I want this is for the following reason: I want to have an object occur in more than one artboard, but if I modify the object in one artboard, I'd like it to also be modified in the second artboard. It is not feasible to have the artboards overlap over *just* the object that I need (as that would in some sense solve the problem, and in fact does solve the problem in some limited circumstances, but not all of them, namely those where the two arboards need to have other also objects along with the common object that do not overlap).
    thanks!

    Just an addition, jb (unless this has changed in the latest version(s)):
    If you want the option to position/align them by anything but the centre of the appearance (including effetcs), you may add a nostroke/nofill rectange/circle centred over the centre of the artwork and extending past its appearance in all directions.

  • Evaluation Copy of Business Object Enterprise XI R2 can be used in the prod

    Hi,
    I have installed the evaluation copy of Business Object XI R2 in my test environment.
    Can i use the same instance for my production environment?
    What need to be done for using the eval copy in the production environment.
    Thanks & Regards
    Anil

    Hi
    tecnically it is possible to use an evaluation key on an BOBJ system independent from the purpose you are using the system for. Still evaluation keys expired and are there in order to check the functionality of the BOBJ software. I would recommend to discuss this with your local SAP representative.
    Regards,
    STratos

Maybe you are looking for

  • Re-ordering of SQL-script when exporting/importing a BA

    Our Discoverer environment is divided up in multiple business areas (development, test and live). To move reports and business areas between these areas, we've been using import/export business areas. Recently, I made a business area in development w

  • Vk13 report to convert into excel sheet based

    Hi VK13 is a SD transaction,if we execute this we get the sales prices, MY client is in requirement of above VK13 output result data  in excel sheet, there is no option available in settings for this screen to convert in to excel sheet. Plz throw som

  • How do i turn on advanced editing in adobe acrobat pro 9

    my icons are dimmed out

  • Dynamic Header(TOP-OF-PAGE) In HIERSEQ ALV

    Hi Experts, My Requirment is to develop a customer ledger in which the top of page is the detailed customer address follwed by list doc no... please suggest me how to get the Dynamic top-of page in HIERSEQ ALV ... Thanks in advance, With regards, Pra

  • Event triggering from a class to parent

    Hi,              I am trying to write a custom class for image loading. public function imageLoader(url:String, mc:MovieClip):void {                               loader = new Loader();                               loader.load(new URLRequest(url));