Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete method does not work properly if "one-one" and "one-fixed" associations existed together #295

Open
Nava2 opened this Issue Aug 26, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@Nava2
Copy link
Member

commented Aug 26, 2015

Originally reported on Google Code with ID 396


What steps will reproduce the problem?

Generate Java code for the next model:
class MainClass {
1 -- 4 FixedObject;
1 -- 1 OneObject;
key{name}
}

class FixedObject {
}

class OneObject {
}

Then create a main function with the following code:
MainClass mc= new MainClass();
mc.addFixedObject();
mc.addFixedObject();
mc.addFixedObject();
mc.addFixedObject();
mc.delete();

What is the expected output? What do you see instead?
I expect the previous "mc.delete" call to work properly but instead, I get a Null Pointer
Exception.


Reported by @ahmedvc on 2013-06-06 17:10:00

@Nava2

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2015

See also issue 198


Reported by @umple on 2013-07-08 15:25:12

  • Owner removed
  • Labels added: Type-ProjectUG, Priority-High, Diffic-Med, Component-Metamodel
  • Labels removed: Type-Defect, Priority-Medium
  • cc added: +@ahmedvc
@Nava2

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2015

This error is being caused by an error in the removeFixedObject(FixedObject aFixedObject)
within the MainClass class:

//mainClass already at minimum (4)
if (numberOfFixedObjects() <= minimumNumberOfFixedObjects())
{
return wasRemoved;
}

is of course being called, and the removeMethod is not actually removing anything.
delete must either use another method besides this sort of general purpose method,
or there should be a flag for deleting, that overrides the minimum so that removal
can be performed while deleting an object. Or some other fancy solution. But I'm pretty
sure this is what is causing the error.


Reported by redeyedmars on 2013-09-12 01:46:23

@Nava2

This comment has been minimized.

Copy link
Member Author

commented Aug 26, 2015

Reported by @umple on 2013-09-12 14:37:28

  • Labels added: ucosp
@TimLethbridge

This comment has been minimized.

Copy link
Member

commented Sep 12, 2018

See also #126

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.