Issue Details (XML | Word | Printable)

Key: NUCCORE-1193
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Marco Schulze
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Core

Bad code in JavaUtils.initialiseJREVersion() [in general] // fails on Android [in concrete]

Created: 23/Apr/14 09:38 PM   Updated: 24/Apr/14 10:48 AM   Resolved: 24/Apr/14 09:25 AM
Component/s: None
Affects Version/s: 4.0.0.m2
Fix Version/s: 4.0.0.m3

Forum Thread URL: http://www.datanucleus.org/servlet/forum/viewthread_thread,7274
Severity: Development


 Description  « Hide
Empty catch blocks are an error in most situations. In this situation, it leaves the version uninitialised (0) which causes *no* mapping to be loaded at all (all are ignored) - all of them require a higher version than 0 ;-)

These empty catch-blocks should be replaced by sth. meaningful. I recommend to fall back to the current default version (i.e. right now this should be "1.7"), if the system property value cannot be parsed.

Additionally, we should add code that supports Android's versioning. I'm pretty sure there is a way to get the API level - hopefully it's a system property (so we don't need ugly reflection code).

Sort Order: Ascending order - Click to sort in descending order
Marco Schulze added a comment - 23/Apr/14 09:43 PM
Forgot to mention: Most importantly, these catch-blocks should write some log! ;-)

Andy Jefferson added a comment - 24/Apr/14 08:52 AM
JavaUtils sets the min to 1.7 now (since that's what we document as min requirement). But as per the commit message that I just put in, the whole JavaUtils class is pretty pointless now. In the "old days" we used to add new types with these min requirement JRE against them if we wanted people to not try to load them. Now we just have baseline support in core, and add new types for later JREs in a separate plugin (datanucleus-java8) and if the user is daft enough to include a plugin for a later JRE then its their problem. The only other usage of the version is for logging (no value added there). Leave it to you to decide if you want to strip this out, or spend time on the Android version capability

Andy Jefferson added a comment - 24/Apr/14 09:25 AM
In fact I've now dumped JavaUtils. RIP. Any type that only exists in some JRE (whether Android, or standard Java) can be in its own plugin from now on.