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

3.2.2 fix OPENJPA-2814 #111

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gjevardat
Copy link

I reopened OPENJPA-2814 because the proposed fix was causing some exceptions.

My initial fix is fixing properly the memory leak and is in production since few years already so I propose to use this one.

@ilgrosso ilgrosso changed the title 3.2.2 fix openjpa 2814 3.2.2 fix OPENJPA-2814 Jun 5, 2023
@@ -14,7 +14,7 @@
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe all trailing spaces should be removed

@@ -27,8 +27,10 @@
*
* @author Abe White
*/
public abstract class Constraint extends ReferenceCounter {
private static final long serialVersionUID = 1L;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this code

public abstract class Constraint extends ReferenceCounter {
    private static final long serialVersionUID = 1L;

should be restored

@@ -250,31 +241,48 @@ public String toString() {
return "<" + name.toLowerCase() + ">";
}

@Override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO previous version of hashcode+equals was more readable

also it not clear why to change the order :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used an auto generated eclipse equals and hashcode. I could mimic the style of the original one indeed. The important thing for me is the fields that are included in the equality and hashcode testing to avoid the mem leak !

@@ -40,8 +40,9 @@
*
* @author Abe White
*/
public class ForeignKey extends Constraint {
private static final long serialVersionUID = 1L;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMo this code:

public class ForeignKey extends Constraint {
    private static final long serialVersionUID = 1L;

need to be restored


Column[] cols = getPrimaryKeyColumns();
if (cols.length == 0) {
_autoAssign = Boolean.FALSE;
return false;
}

for (Column column : cols) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please clarify why for-in loops were replaced with plain-for loops in this PR?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes see my general comment, will update

@@ -187,7 +181,6 @@ public DBIdentifier getIdentifier() {
* constraint already belongs to a table.
* @deprecated
*/
@Deprecated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why @Deprecated were removed in this PR?

localtable.getColumn(locCols[j].getIdentifier()))) {
fkTemp.join(localtable.getColumn(locCols[j].getIdentifier()),
pkTable.getColumn(pkCols[j].getIdentifier()));
if( ! fkTemp.containsColumn(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (...) is used in the code

not if( ...)

could you please revert this change?

@@ -920,72 +905,60 @@ private static Column[] createKeyColumns(ForeignKey fk) {
return new Column[] { fkCol, pkCol };
}

@Override
public boolean equals(Object o) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment to hashcode/equals

@gjevardat
Copy link
Author

@solomax Ok as a general remark, indeed I think I took the patch from a local version dating back from openjpa 3.0.0, that would explain strange for loops changes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants