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

Fixed bugs when dealing with primitives and multiple matching constructors #12

Merged
merged 5 commits into from
Feb 20, 2016
Merged

Fixed bugs when dealing with primitives and multiple matching constructors #12

merged 5 commits into from
Feb 20, 2016

Conversation

JanMosigItemis
Copy link
Contributor

Hi there,

i noticed the following issues the other day and fixed them:

  • If a result row column contains primitives, the findConstructor algorithm fails to find a matching constructor if the constructors do use box types or vice versa, e. g. the column contains an int but the constructor of the corresponding POJO takes an Integer.
  • If a result row column contains a null reference, an InvocationTargetException having an NPE set as cause might be thrown (depending on the behavior of the POJO's constructor when null arguments are passed). I straightened out the exception handling a bit so that debugging via stack trace gets easier in such situations.

I did also fix a couple of minor issues in the JpaResultMapper unit test cases.

Unfortunately my IDE seems to have a slightly different tab/spaces policy than yours resulting in rather large diffs. If that bothers you, I could try to change the settings and replay my changes.

Regards

count matching the result row column count would confuse the
findConstructor algorithm of JpaResultMapper.
- Added NPE related tests for JpaResultMapper
- Fixed some issues related to tests with native queries
@simasch
Copy link
Collaborator

simasch commented Feb 20, 2016

Hi Jan,
Thank you very much!

@simasch simasch closed this Feb 20, 2016
@simasch simasch reopened this Feb 20, 2016
simasch pushed a commit that referenced this pull request Feb 20, 2016
Fixed bugs when dealing with primitives and multiple matching constructors
@simasch simasch merged commit 731cdd1 into martinellich:master Feb 20, 2016
@simasch
Copy link
Collaborator

simasch commented Feb 20, 2016

Hi Jan,

Ich denke wir können uns auch auf Deutsch unterhalten ☺

Vielen Dank für Deinen grossen Beitrag.
Es freut mich sehr, dass Du QLRM weiterbringst.

Ich werde noch heute eine neue Version erstellen.

Viele Grüsse aus der Schweiz
Simon Martinelli

Von: Jan Mosig [mailto:[email protected]]
Gesendet: Donnerstag, 18. Februar 2016 15:50
An: simasch/qlrm [email protected]
Betreff: [qlrm] Fixed bugs when dealing with primitives and multiple matching constructors (#12)

Hi there,

i noticed the following issues the other day and fixed them:

· If a result row column contains primitives, the findConstructor algorithm fails to find a matching constructor if the constructors do use box types or vice versa, e. g. the column contains an int but the constructor of the corresponding POJO takes an Integer.

· If a result row column contains a null reference, an InvocationTargetException having an NPE set as cause might be thrown (depending on the behavior of the POJO's constructor when null arguments are passed). I straightened out the exception handling a bit so that debugging via stack trace gets easier in such situations.

I did also fix a couple of minor issues in the JpaResultMapper unit test cases.

Unfortunately my IDE seems to have a slightly different tab/spaces policy than yours resulting in rather large diffs. If that bothers you, I could try to change the settings and replay my changes.

Regards


You can view, comment on, or merge this pull request online at:

#12

Commit Summary

  • Removed unused imports and member variables -> reduced warning count.
  • Fixed bug where target types with multiple constructors with argument
  • Improved error handling in case a null is passed to a non null tolerant
  • Fixed potential NPE if result row column contains null reference.
  • Improved unit tests

File Changes

Patch Links:


Reply to this email directly or view it on GitHubhttps://github.com//pull/12.

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

Successfully merging this pull request may close these issues.

2 participants