Vectors: contains() inconsistency with Object equals()

Hi,
I have a problem with using Vector contains() on my own classes.
I have a class TermDetails, on which I have overloaded the equals() method:
     public boolean equals(Object other) {
          try {
               TermDetails otherTerm = (TermDetails) other;
               return (term.equals(otherTerm.term));
          catch (Exception e) {
               try {
                    String otherTermString = (String) other;
                    return (term.equals(otherTermString));
               catch (Exception f) {
                    System.out.println("Can't convert Object to TermDetails or String");
                    System.out.println(f.getMessage());
                    return(false);
     public boolean equals(String otherTermString) {
          return(term.equals(otherTermString));
The Vector.contains() should then use one of these equals methods to return correctly, but doesn't use either of them... any ideas why not?
(I've tried adding some console output in the equals methods, just to prove if they get called or not. They don't.)
Thanks in advance!
Ed

This won't work. It only tests whether the two objects are of the same class. In general, you need to test a number of things:
1) if obj == this, return true
2) if obj == null, return false
3) if obj.getClass() != this.getClass() return false
(Note: You don't need getClass().getName(). Also, there are times when the classes don't have to match, but it's sufficient that obj and this implement a particular interface--Map for instance).
4) if all relevant corresponding fields of obj and this are equal, return true, else false.
That's just a high level run-down, and you should definitely look at the book that schapel mentioned.
Also, this probably won't affect Vector.contains, but make sure that when you override equals, you also override hashCode. The rule is that if a.equals(b) returns true, then a.hashCode() must return the same value as b.hashCode(). Basically any field that is used in computing hashCode must also be used in equals.
Note that the converse is not true. That is two objects with the same hashCode don't have to be equal.
For instance, if you've got a class that represents contact info, the hashCode could use only the phoneNumber field. hashCode will then be fast to compute, will probably have a good distribution (some distinct people's contact info could have the same phone number, but there won't be a large overlap), and then you use phone number plus the rest of the fields (address, etc.) for equals.
Here's an example that shows that equals will work if
written correctly
import java.util.Vector;
public class testEquals {
public static void main(String args[]) {
Vector testVector = new Vector();
testVector.add(new A());
testVector.add(new B());
System.out.println("A == A? " +
+ testVector.contains(new A()));
System.out.println("B == B? " +
+ testVector.contains(new B()));
class A {
public boolean equals(Object object) {
if (getClass().getName() ==
= object.getClass().getName()) {
System.out.println("A == A");
return true;
} else {
return false;
class B {
public boolean equals(Object object) {
if (getClass().getName() ==
= object.getClass().getName()) {
System.out.println("B == B");
return true;
} else {
return false;

Similar Messages

  • Filling Worflow container with objects (OOAD)

    Hi Gurus,
               I have created a workflow,which has abap objects as container element. Can anyone let me know how can I fill the container element with object..I have tried with marcos as mentioned in the library..but not container is not filled ..plz advice....
    Create a variable for the object reference. Use the following command to do this:
    DATA <Object> TYPE SWC_OBJECT.
    Create the object reference. Use the following command to do this:
    SWC_CREATE_OBJECT <Object> <ObjectType> <ObjectKey>.
    Write the object reference into the container using the following macro instruction:
    SWC_SET_ELEMENT <Container> <ContainerElement> <Object>.
    Thank you
    - Senthil Bala

    BalusC -- The line that gives me my NullPointerException is when I call the "DisplayProduct()" method. Its a dumb question, but with NetBeans how do I find out which reference could be null? I'm not very familiar with how NetBeans works with finding out how to debug. Any help you can give me would be greatly appreciated.The IDE is com-plete-ly irrelevant. It's all about the source code.
    Do you understand anyway when and why a NullPointerException is been thrown? It is a subclass of RuntimeException and those kind of exceptions are very trival and generally indicate an design/logic/thinking fault in your code.
    SomeObject someObject = null; // The someObject reference is null.
    someObject.doSomething(); // Invoking a reference which is null would throw NPE.

  • Vector.contains()

    Hi,
    I have a question about Vector.contains(). The documentation for Vector.contains() says:
    Tests if the specified object is a component in this vector.
    Returns true if and only if the specified object is the same as a component in this vector, as determined by the equals method; false otherwise.
    Since Vector.contains() takes an Object as a parameter and Object.equals() takes and Object has a parameter I assumed that Vector.contains(a) would return true if at least one object in the Vector returned true for .equals(a). But it seems to me (after some pretty simple testing) that the two objects HAVE to be of the same class, yet it does not actually say this in the documentation.
    Can someone explain to me why this is the case, or tell me that I am somehow doing somthing wrong? I dont have somple simple test code but I dont want to post it here intitiall as I might scare people off :p. I spend hours debugging this simple problem.. grr :S.
    Anyway,
    Thanks in advance.

    Thanks for your quick replies!!
    Do you not think this is a given? How is it possible for two objects to be the same if they are different classes?I'm not saying that its not logical, its just that the documentation doest actually specify that the classes have to be of the same type to be found. You might, for example, want to search a list of 'Person' objects for a person with a particular name. In this case (where a is defined as Vector<Person>), you might want to call a.contains("Barry"). Based on the documentation I would have thought this to be possible, as long as the Person.equals() function handled it correctly.
    Here is my test code:
    import java.util.*;
    public class Test
            static class MyClass
                    String myValue;
                    public MyClass(String val)
                            myValue = val;
                    public boolean equals(Object o)
                            return o.toString().equals(myValue);
                    public String toString()
                            return myValue;
            public static void main(String[] args)
                    Vector<MyClass> v = new Vector<MyClass>();
                    v.add(new MyClass("TEST1"));
                    v.add(new MyClass("TEST2"));
                    if (v.contains("TEST2"))
                            System.out.println("Contains!");
                    else
                            System.out.println("Does not contain!");
    }In this case "Does not contain!" could be printed out. If i change the line
    if (v.contains("TEST2"))to
    if (v.contains(new MyClass("TEST2")))then "Contains!" is printed out. I would have thought both should work :S.
    Thanks again
    - Robert.

  • SortedVector with Objects???

    Can you use a SortedVector with objects? I have browsed the forums and every time someone uses this they insert a string or int. Here's my senario...
    I have a vector of objects (mailboxItems that contain header information for each entry) and I need to sort the information based on the messageDate.
    I'm fairly new to Java, so feel free to point out the obvious.
    Thanks!

    I am following, but I have two questions:
    1. If I implement the object as comparable then how do
    I determine which field to sort by?The choice is yours as the implementor
    >
    2. I understand the concept of overriding the equals
    and hashCode, but why am I doing this? Oh yeah, and
    could you point me in the right direction as to what I
    would change in there?So when you put them in sorted sets, they get fairly evenly distributed into hashbins - which will give you better performance than saying, setting the hashcode to 17 for all objects. The latter is valid, but leads to inefficient code.
    >
    BTW, thanks for the link, very helpful.
    Thanks for the fast responses everyone!

  • Reflecting updates to a ListCell that contains a mutable object

    Hi,
    I've seen many variants of this question, but unfortunately have not found the desired answer, so I thought to ask here. Apologies if missing something obvious!
    Objective:
    I start individual Tasks in batches. A ListCell reflects each Task, from initial request to eventual result. More batches can be submitted while one set is processing. When all processes of any batch is finished, they will eventually disappear from the ListView.
    As a result, I want a ListCell to reflect a Task, and reflect the transition from initial conception to eventual outcome.
    Predicament:
    I currently try this with an ObservableList of my own POJOs, each reflected using a custom ListCell extension.
    I have achieved this result, but it does not feel correct. First of all, I read that it is best practice not to change an ObservableList's objects under its feet. However, I have multiple threads working against the same list. With objects being added, removed and updated, it seemed safer to update the referenced object rather than try to manage synchronization to prevent concurrent modification issues. After all, I'm not really adding a new item, I'm wanting to update the representation of an item that is now in a finished state.
    Attempt details:
    I have achieved this by constructing an 'observableArrayList' with a Callback extractor. This Callback call method provides an Observable array containing an ObjectProperty, the property being a member variable of my POJO used in each ListCell. Each Task updates this object property with some result information at the end of its processing. This I believe ensure that change listeners are notified of updates to this POJO, via its ObjectProperty. (https://javafx-jira.kenai.com/browse/RT-15029)
    The ListCell constructed with this POJO is listening for updates, but I believe this is really to reflect additions and removals on the ObservableList that the ListView represents. However, in the case of updates, the private implementation of the ListCell updateItem method (javafx.scene.control.ListCell#updateItem) does not call the overridable updateItem method. This is because the object that caused the update is seen as equal to the object the ListCell currently holds (they're the same instance, so this is true). However, if the overridable updateItem method is never invoked, I can't get the custom ListCell to update its representation of the ListCell object that has changed since its last representation was rendered.
    If I make my custom POJO always return false in its overriden equals method, the overridable updateItem method is invoked and I get the opportunity to detect the change in the object and render a new representation. This works, but this feels wrong and like a hack.
    Can anyone help point me at the correct way of doing this please? Happy to provide more information if needed.
    Thanks,
    Louis

    If the changes in the ObservableList are to be reflected in the UI, you need to make these changes on the JavaFX Application Thread. Ensuring this happens (using Platform.runLater(...) if necessary) will also prevent any concurrent modification issues.
    I would approach this by binding the text property or graphic property (or both) of the custom ListCell to the appropriate properties of your POJO. Here's a simple example where I have a list view displaying a bunch of "counters" which count in a background thread. The cell display is updated when the state of the task changes. I introduced a counter property (which is a bit redundant; I could have used the progress property or message property) to demonstrate updating a property on the FX Application thread using Platform.runLater(...).
    Because ListCells can be reused, you need to account for the fact that the item (task) displayed may change during the lifecycle of the cell. You can do this using a listener to the itemProperty (which is what I did), or by overriding the updateItem(...) method.

  • Nested object equality - design pattern

    Looking to solve a problem in my own code, I wanted to see if and how the problem is solved in the java library.
    I would have liked this code to output "true", to see how it's done.
    Set set1 = new HashSet();
    set1.add("a value");
    set1.add(set1);
    Set set2 = new HashSet();
    set2.add("a value");
    set2.add(set2);
    System.out.println(set1.equals(set2));Well the code ends with a StackOverflowError on hashCode(). Just using a Set which implements hashCode to return a constant value would shift the problem to the equals-method.
    I think one possible solution would be to implement the hashCode method to set a instance variable (computingHash = true) while hashcodes of fields are computed. If the variable is set when hashcode is invoke a RecursiveHashRuntimeException is thrown which is is caught by the invoking hashcode method which would then return a constant value or ignore the corresponding field for hash-computation.
    Similarly the equals method would add the obj (passed to equals) to a set (instance variable) named assumeEqualTo, if the obj is in assumeEqualTo when the method is invoked it returns true. The value is removed from assumeEqualTo before the method that added it returns.
    This approach would require the equals and hashcode methods to be - at least partially - synchronized (if multithreading is an issue), an alternative would be to use ThreadLocal variables to detect and handle recursive invocations.
    I'm not sure how the two approaches compare in terms of performance, and I would welcome any other approach to solve the problem. Note that the class being compared should not be required to know details about the contained classes and the nesting may also be indirect as in:
    Set set1 = new HashSet();
    Set set2 = new HashSet();
    set1.add("a value");
    set1.add(set2);
    set2.add("a value");
    set2.add(set1);
    System.out.println(set1.equals(set2));Also it would be nice if the impact on performance could be kept minimal for all instance that happens not to be self-containg.
    cheers,
    reto

    should be slightly different as for sets the orderis
    irrelevant
    I don't follow. You would presumably only return
    true as a whole if every element in the Set also
    returned true. So, yes, order is irrelevant. just wanted to say that you must return true iff you find a mapping from set1 to set2 where all elements are equals
    No, I mean that if you add a Set to itself, and then
    iterate over it, you will implicitly be performing
    recursion, leading to a StackOverflowError
    eventually. That is why you need to store a
    collection (or array) with all the objects already
    analyzed. What do you mean by "already analyzed"? I mean how would you prevent recursion with this?
    You need to compare what is being
    currently being inspected along with checking what
    you already processed for object equality (==) so you
    do not get the stack overflow.I don't get it, in
    Set set1 = new HashSet();
    Set set2 = new HashSet();
    set1.add(set2);
    set2.add(set1);
    set1.equals(set2);The equals method returns true iff set2.equals(set1), which would - in the algorithm I proposed - return set1.add(set2) which is true as set2 is contained in the Set assumeEqualTo. I interpreted the contract specified by java.util.Set to return true on equals for indistinguishable object - not sure if this is correct for mutually referencing sets, but pretty convinced for non-refrencing self containing sets, as in my first example or for all sets returned by:
    createSet() {
      Set s1 = new HashSet();
      Set s2 = new HashSet();
      s2.add(s1);
      s1.add(s2);
    }Imho, it would break be against the specification in java.util.Set to return false on createSet().equals(createSet()).
    reto

  • Vectors/Arrays Mixed with Classes

    Here's my problem
    I'm have a for loop which collects integers, (i). What'd I'd like to do is make a list of all the numbers "i" comes up as, and then record how many times "i" comes up as a certain number.
    For example,
    say the for loop is retrieving the number 1,5,7,3,1,1,6,3,4,5,7
    I'd like to create some type of data structure that will do this:
    Numbers/Instances
    1/3
    3/2
    4/1
    5/2
    6/1
    7/2
    I do NOT need it to say that there are no instances of 2, for example, but if it did I could live with that.
    I thought of creating a Class containing a variable for instances, and then making an array, where the index value would be the number and the variable would be the instances... so... say:
    The class name is Numbers, with public static int times:
    Numbers [] myNum=new Numbers[10];
    The problem with an array is that you can't resize it. I also have no guarantee that the numbers will stay below any certain number. While I could simply define myNum as having a million slots to be sure, I don't think its the best way.
    On the other hand, I can't figure out how to create a vector from a class, as you can't simply:
    Vector Numbers myBum=new Vector();
    I figured vectors would work well as their size is extremely flexible, however if I can't somehow get it to keep track of instances, I'm not working well.
    I was thinking of using hash tables, but I don't completely understand them... while I could somehow tell it to treat each collision as an instance, and add them, wouldn't some hash keys be shared among different numbers (ie perhaps 7 and 43 share the same hash key?) Like I said, I don't completely understand them, so I'm not sure if I'm doing something wrong. I used a hash table to sort strings once and it threw a lot of completely different words in the same part of the has table.
    Any help you can offer would be extremely appreciated. This is a huge mental block thing more than anything, I think. I'm sure there's a practical way to do this in Java.
    Regards,
    Alessandro

    Whenever an Object in Java is created, its original type is remembered. Thus,
    Object a = new Vector();
    Vector my_vector = (Vector)(a);is a valid cast, since "a" was a Vector to start with. Therefore, supposing you have a mutable number-counting object NumberCount, you could simply do the following:
    NumberCount count = new NumberCount(my_number);
    Vector count_vector = new Vector();
    count_vector.add(count);
    NumberCount inc_count = (NumberCount)(count_vector.get(index));
    inc_count.increment();For this project, I would personally recommend a Hashtable. A Hashtable is a type of Map; a Map contains a set of keys, each of which is mapped to a value. Keys are guaranteed to be unique. The only problem, however, is that putting a value into a Hashtable with a key that already exists in the Hashtable destroys the Hashtable's record of the old value.
    Thus, you could have...
    Hashtable table = new Hashtable();
    table.put(new Integer(1),count_value);
    table.get(new Integer(1),count_value.increment());Be careful with this approach; creating new Integer objects like this can be very costly on the garbage collector and will slow your program down if you do it too intensively. But that's another issue. ;)

  • Vector can't give objects

    I have a program using a vector, I store BufferedImage objects in it. But when I try to access them later the compiler won't let me because the method in Vector defines that Object is the type of object being passed, and cannot convert it to a BufferedImage.
    I tried using an Object to store it which worked, but when I tried to use it to draw, it wasn't recognised as an Image, being an Object and still wouldn't compile.
    Is this because I have jdk 1.3? Is there anotherway Should I be using a vector? Should I edit Vector to pass BufferedImages rather than Objects?
    I am storing frames like this:
    Vector.addElement(java.awt.Robot.createScreenCapture(Rectangle)));
    and retrieving them like this:
    Graphics.drawImage(Vector.elementAt(index),0,0,this);
    The syntax is correct but Object is not compatible with BufferedImage!
    There must be another way...
    Rufus,

    Thanks for that. I thought you could only cast types
    and not Objects.The correct way to express that would be to say: I thought you could only cast primitive types and not class types. But you can cast both primitives and classes, even though the casting behaves a little differently.
    One additional complication is that Object (with a capital O) isn't an object but a class. All classes extend Object by default. That's why collections like Vector can store objects of any class.

  • FileUpload problem: InputStream does not contain a serialized object

    Hi All,
    I'm using the FileUpload component in a JSPDynPage and the htmlb component seems to work fine but I cannot read the file (InputStream). I get the following error(IOException): "InputStream does not contain a serialized object".
    Please let me know what is wrong with my code. This is a part of the code I used:
    public FileInputStream sourceFileInput;
    public ObjectInputStream input;
    FileUpload fu;
    fu = (FileUpload) this.getComponentByName("myFileUpload");
    IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
    File f       = fileParam.getFile();
    file         = fu.getFile().getFile();
    absolutepath = fu.getFile().getFile().getAbsolutePath();
    this.sourceFileInput = new FileInputStream(file);
    input = new ObjectInputStream(sourceFileInput);
    The last line of code seems to generate te error.

    Hi,
    I have found the answers, thank you both.
    (I included the examle code. Perhaps of some use to someone.)
    FileUpload fu;
    fu = null;
    fu = (FileUpload) this.getComponentByName("myFileUpload");
    //       this is the temporary file
    if (fu != null) {
         IFileParam fileParam = ((FileUpload) getComponentByName("myFileUpload")).getFile();
         if (fileParam != null) {
              // get info about this file and create a FileInputStream
              File f = fileParam.getFile();
              if (f != null) {
                   try {
                        fis = new FileInputStream(f);
                   // process exceptions opening files
                   catch (FileNotFoundException ex) {
                        myBean.setMessage(
                             "1" + f + ex.getLocalizedMessage());
                   isr = new InputStreamReader(fis);
                   br = new BufferedReader(isr);
    String textLine = "";
    do {
         try {
              textLine = (String) br.readLine();
         } catch (IOException e) {
              myBean.setMessage(
                   "1" + e.getLocalizedMessage());
         // Jco append table & put data into the record
         // (I_FILE is the table with txt data that is sent to the RFC)
         I_FILE.appendRow();     
         I_FILE.setValue(textLine, "REC");                              
    } while (textLine != null);

  • Indexes: Inconsistent with DDIC source

    Hi, i have an issue in the DB02, i have a message that missing some index, when i check the se14 i see the error
    Database object for /BI0/E0BPM_C01 is inconsistent: (Secondary indexes)
    and Indexes: Inconsistent with DDIC source
    on the database the index exist, but in Dictionary do not exist
    with the TX se14 I try to "activate and adjust database" with Save data but the issue still continue
    any idea or support is welcome
    regards

    when i try to create a index with the TX SE11 i can't
    i obtain the message "Index ID 0 is reserved for the primary index"
    regards

  • Problem with Object returning previously set values, not current vlaues

    Please help if you can. I can send the full code directly to people if they wish.
    My problem is I enter title details for a book via an AWT GUI. When the user clicks the OK button it should display a new screen with the values just entered by the user. I added debug lines and found that the newInstance method has the values I set and the setObject created an object that was not null.
    However the first time you submit the details when it tries to get the object to display them back to the user it is null. However when you try and enter the details for a second time it will display the details entered on your first entry. Likewise if you went to enter a third title and put blank details in it would display the second set of details back to the user when they click OK.
    I'm very confused as to how it when I fetch an object I've just set it is out of step and points to previous values or null when used for the first time.
    Right onto the code.
    ----Shop.class - contains
    public static Object
    getObject()
    if ( save_ == null)
    System.out.println("Return save_ but it is null");
    return save_;
    public static void
    setObject( Object save )
    save_ = save;
    if ( save == null)
    System.out.println("Just taken save but it is null");
    if ( save_ == null)
    System.out.println("Just set save_ but it is null");
    ----AddTitlePanel.class contains
    private void okButtonActionPerformed(ActionEvent evt)
    ConfirmAddTitlePanel confirmAddTitlePanel =
    new ConfirmAddTitlePanel();
    // Gets the textField values here
    model.Title mss = model.Title.newInstance( fullISBN,
    ISBN,
    title,
    author,
    copiesInStock,
    price );
    model.Shop.setObject( mss );
    // Fetch reference to Graphical so buttons can use it to
    // display panels
    graph = model.Shop.getGraphical();
    graph.display( confirmAddTitlePanel );
    This creates a newInstance of Title and creates a copy using setObject when the user clicks on "OK" button. It also calls the ConfirmAddTitlePanel.class to display the details back to the user.
    ----ConfirmAddTitlePanel.class contains:
    private void
    setValues() throws NullPointerException
    model.Title mss = (model.Title) model.Shop.getObject();
    if ( mss != null )
    model.Field[] titleDetails = mss.getFullDetails();
    //model.Field[] titleDetails = model.Title.getFullDetails();
    fullISBNTextField.setText( titleDetails[0].asString() );
    //ISBNTextField.setText( titleDetails[1].asString() );
    titleTextField.setText( titleDetails[2].asString() );
    authorTextField.setText( titleDetails[3].asString() );
    copiesInStockTextField.setText( titleDetails[4].asString() );
    priceTextField.setText( titleDetails[5].asString() );
    else
    System.out.println( "\nMSS = null" );
    This is getting the Object back that we just set and fetching its details to display to the user by populating the TextFields.
    As I say first time you enter the details and click OK it displays the above panel and outputs "MSS = null" and cannot populate the fields. When you enter the next set of title details and click "OK" getObject is no longer setting mss to null but the values fetched to set the TextFields is the data entered for the first title and not the details just entered.
    ----Title.class contains:
    public static Title
    newInstance( String fullISBN,
    String ISBN,
    String title,
    String author,
    int copiesInStock,
    int price )
    Title atitle = new Title( fullISBN,
    ISBN,
    title,
    author,
    copiesInStock,
    price );
    System.out.println("Created new object instance Title\n");
    System.out.println( "FullISBN = " + getFullISBN() );
    System.out.println( "ISBN = " + getISBN() );
    System.out.println( "Title = " + getTitle() );
    System.out.println( "Author = " + getAuthor() );
    System.out.println( "Copies = " + getCopiesInStock() );
    System.out.println( "Price = " + getPrice() );
    return atitle;
    I'm really stuck and if I solve this I should hopefully be able to make progress again. I've spent a day and a half on it and I really need some help. Thanks in advance.
    Mark.

    Hi Mark:
    Have a look of the method okButtonActionPerformed:
            private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
             // if you create the confirmAddTitlePanel here, the value of
             // Shop.save_ is null at this moment (first time), becaouse you
             // call the methode setValues() in the constructor, bevore you've
             // called the method Shop.setObject(..), which has to initialize
             // the variable Shop.save_!!!
             // I think, you have to create confirmAddTitlePanel after call of
             // method Shop.setObject(...)!
             // ConfirmAddTitlePanel confirmAddTitlePanel = new ConfirmAddTitlePanel();
            ConfirmAddTitlePanel confirmAddTitlePanel = null;
            String fullISBN            = fullISBNTextField.getText();
            String ISBN                = "Test String";
            String title               = titleTextField.getText();
            String author              = authorTextField.getText();
            String copiesInStockString = copiesInStockTextField.getText();
            String priceString         = priceTextField.getText();
            int copiesInStock          = 0;
            int price                  = 0;
            try
                copiesInStock = Integer.parseInt( copiesInStockString );
            catch ( NumberFormatException e )
                // replace with error output, place in status bar or pop-up dialog
                // move focus to copies field
            try
               price = Integer.parseInt( priceString );
            catch ( NumberFormatException e )
                // replace with error output, place in status bar or pop-up dialog
                // move focus to price field
            model.Title mss = model.Title.newInstance( fullISBN,
                                     ISBN,
                                     title,
                                     author,
                                     copiesInStock,
                                     price );
            model.Shop.setObject( mss );
            // ---------- now, the Shop.save_ has the value != null ----------        
            confirmAddTitlePanel = new ConfirmAddTitlePanel();     
            // Fetch reference to Graphical so buttons can use it to
            // display panels
            graph = model.Shop.getGraphical();
            graph.display( confirmAddTitlePanel );
        }//GEN-LAST:event_okButtonActionPerformedI hope, I have understund your program-logic corectly and it will help you.
    Best Regards.

  • After December 2014 update, Compile Error - calling Excel Objects Sub "Object library invalid or contains references to object definitions that could not be found"

    When try to call Sub in Excel Objects > SheetXX after the original xlsm is modified and saved by another user in diff machine, getting an error below and seems Excel cannot identify any subs exists in Sheet.
    Compile error:
    Object library invalid or contains references to object definitions that could not be found
    Note: it seems that this problem has been occurring After December 2014 update and still exists even after applying the fix:
    http://blogs.technet.com/b/the_microsoft_excel_support_team_blog/archive/2014/12/11/forms-controls-stop-working-after-december-2014-updates-.aspx)

    Hi Kwlee324,
    Thanks for sharing the workaround with us. It would be very helpful for others who have the same issue.
    Also I found a two useful links about the error message "Object library invalid or contains references to object definitions that could not be found":
    https://support.microsoft.com/kb/2703186
    http://blogs.msdn.com/b/vsod/archive/2009/06/05/visual-basic-6-controls-stop-working-after-security-advisory-960715.aspx
    Hope it is helpful.
    Regards & Fei
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Does making objects equal null help the gc handle memory leakage problems

    hi all,
    does making objects equal null help the gc handle memory leakage problems ?
    does that help out the gc to collect unwanted objects ??
    and how can I free memory avoid memory leakage problems on devices ??
    best regards,
    Message was edited by:
    happy_life

    Comments inlined:
    does making objects equal null help the gc handle
    memory leakage problems ?To an extent yes. During the mark phase it will be easier for the GC to identify the nullified objects on the heap while doing reference analysis.
    does that help out the gc to collect unwanted objects
    ??Same answer as earlier, Eventhough you nullify the object you cannot eliminate the reference analysis phase of GC which definitelely would take some time.
    and how can I free memory avoid memory leakage
    problems on devices ??There is nothing like soft/weak reference stuffs that you get in J2SE as far as J2ME is concerned with. Also, user is not allowed to control GC behavior. Even if you use System.gc() call you are never sure when it would trigger the GC thread. Kindly as far as possible do not create new object instances or try to reuse the instantiated objects.
    ~Mohan

  • Generate error list with object detail

    Dear All,
    I have two way (multimaster ) Replication but due to some reason it generated many errors during replicate data so to resolve errors, I want to generate error list (Report) with object details instead viewing them one by one. please guide
    Thanks

    What do you mean with generate error list (Report) with object details ?
    You can get all the errors from DEFERROR view.
    There are columns DEFERRED_TRAN_ID and CALLNO.
    You can join this columns with DEFCALL (DEFERRED_TRAN_ID and CALLNO).
    Joining this two views will provide information about the objects and transaction type involved in the call.
    DEFCALL.PACKAGENAME contains the reference to the table_name.
    DEFCALL.PROCNAME contains information about the transaction type.
    Example:
    select e.deferred_tran_id,
           e.callno,
           e.origin_tran_db,
           c.packagename,
           c.procname
    from deferror e, defcall c
    where e.deferred_tran_id=c.deferred_tran_id
    and e.callno=c.callno(below are the links to the 10gR2 docs containing information about DEFERROR and DEFCALL views. If your database is different version, than search http://tahiti.oracle.com for version specific documentation)
    DEFERROR
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14227/rardeftranviews.htm#sthref2599
    DEFCALL
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14227/rardeftranviews.htm#sthref2595
    Cheers!
    Message was edited by:
    tekicora

  • Difference between Object equals() method and ==

    Hi,
    Any one help me to clarify my confusion.
    stud s=new stud();
    stud s1=new stud();
    System.out.println("Equals======>"+s.equals(s1));
    System.out.println("== --------->"+(s==s1));
    Result:
    Equals ======> false
    == ------------> false
    Can you please explain what is the difference between equals method in Object class and == operator.
    In which situation we use Object equals() method and == operator.
    Regards,
    Saravanan.K

    corlettk wrote:
    I'm not sure, but I suspect that the later Java compilers might actually generate the same byte code for both versions, i.e. I suspect the compiler has gotten smart enough to devine that && other!=null is a no-op and ignore it... Please could could someone who understands bytecode confirm or repudiate my guess?Don't need deep understanding of bytecode
    Without !=null
    C:>javap -v SomeClass
    Compiled from "SomeClass.java"
    class SomeClass extends java.lang.Object
      SourceFile: "SomeClass.java"
      minor version: 0
      major version: 49
      Constant pool:
    const #1 = Method       #4.#15; //  java/lang/Object."<init>":()V
    const #2 = class        #16;    //  SomeClass
    const #3 = Field        #2.#17; //  SomeClass.field:Ljava/lang/Object;
    const #4 = class        #18;    //  java/lang/Object
    const #5 = Asciz        field;
    const #6 = Asciz        Ljava/lang/Object;;
    const #7 = Asciz        <init>;
    const #8 = Asciz        ()V;
    const #9 = Asciz        Code;
    const #10 = Asciz       LineNumberTable;
    const #11 = Asciz       equals;
    const #12 = Asciz       (Ljava/lang/Object;)Z;
    const #13 = Asciz       SourceFile;
    const #14 = Asciz       SomeClass.java;
    const #15 = NameAndType #7:#8;//  "<init>":()V
    const #16 = Asciz       SomeClass;
    const #17 = NameAndType #5:#6;//  field:Ljava/lang/Object;
    const #18 = Asciz       java/lang/Object;
    SomeClass();
      Code:
       Stack=1, Locals=1, Args_size=1
       0:   aload_0
       1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
       4:   return
      LineNumberTable:
       line 1: 0
    public boolean equals(java.lang.Object);
      Code:
       Stack=2, Locals=2, Args_size=2
       0:   aload_1
       1:   instanceof      #2; //class SomeClass
       4:   ifeq    25
       7:   aload_1
       8:   checkcast       #2; //class SomeClass
       11:  getfield        #3; //Field field:Ljava/lang/Object;
       14:  aload_0
       15:  getfield        #3; //Field field:Ljava/lang/Object;
       18:  if_acmpne       25
       21:  iconst_1
       22:  goto    26
       25:  iconst_0
       26:  ireturn
      LineNumberTable:
       line 6: 0
    }With !=null
    C:>javap -v SomeClass
    Compiled from "SomeClass.java"
    class SomeClass extends java.lang.Object
      SourceFile: "SomeClass.java"
      minor version: 0
      major version: 49
      Constant pool:
    const #1 = Method       #4.#15; //  java/lang/Object."<init>":()V
    const #2 = class        #16;    //  SomeClass
    const #3 = Field        #2.#17; //  SomeClass.field:Ljava/lang/Object;
    const #4 = class        #18;    //  java/lang/Object
    const #5 = Asciz        field;
    const #6 = Asciz        Ljava/lang/Object;;
    const #7 = Asciz        <init>;
    const #8 = Asciz        ()V;
    const #9 = Asciz        Code;
    const #10 = Asciz       LineNumberTable;
    const #11 = Asciz       equals;
    const #12 = Asciz       (Ljava/lang/Object;)Z;
    const #13 = Asciz       SourceFile;
    const #14 = Asciz       SomeClass.java;
    const #15 = NameAndType #7:#8;//  "<init>":()V
    const #16 = Asciz       SomeClass;
    const #17 = NameAndType #5:#6;//  field:Ljava/lang/Object;
    const #18 = Asciz       java/lang/Object;
    SomeClass();
      Code:
       Stack=1, Locals=1, Args_size=1
       0:   aload_0
       1:   invokespecial   #1; //Method java/lang/Object."<init>":()V
       4:   return
      LineNumberTable:
       line 1: 0
    public boolean equals(java.lang.Object);
      Code:
       Stack=2, Locals=2, Args_size=2
       0:   aload_1
       1:   instanceof      #2; //class SomeClass
       4:   ifeq    29
       7:   aload_1
       8:   ifnull  29
       11:  aload_1
       12:  checkcast       #2; //class SomeClass
       15:  getfield        #3; //Field field:Ljava/lang/Object;
       18:  aload_0
       19:  getfield        #3; //Field field:Ljava/lang/Object;
       22:  if_acmpne       29
       25:  iconst_1
       26:  goto    30
       29:  iconst_0
       30:  ireturn
      LineNumberTable:
       line 6: 0
    }

Maybe you are looking for

  • HT4914 I cannot get Itunes match to work on my iphone? All settings are correct.

    I cannont get Itunes match to work on my new iPhone. It works on my IPAD, IPOD and other devices.

  • Itunes on start up disc

    Morning, i hope some one can help me my son has moved my itunes onto my start up disc. This means that my Mac Book pro keeps saying that my start updisc is nearly full and is restricting my iphone back ups and various other functions. Can somebody pl

  • I want Queue status weather it is Active or inactive

    HI, please any one let me know information about the Issue i want Queue status weather it is Active or inactive from which file weblogic server will get information Reply me as early as Possible Regards, Srinivas

  • Pressing keys doesn't do anything

    When you press the keys it doesn't do anything. Except puts a box around the app. You can't enter the unlock passcode either

  • Execution of $ORACLE_HOME/root.sh

    Hi There, We are installing SAP portal on Oracle and solaris. I had a doubt for execution of $ORACLE_HOME/root.sh as root user. Do we need to execute $ORACLE_HOME/root.sh as root user only(what is process if root user access not provided to us) or ca