Skip to content

Commit

Permalink
Correct validation of numeric input when using a comma as a decimal s…
Browse files Browse the repository at this point in the history
…eparator (GitHub Issue #77)
  • Loading branch information
ccavanaugh committed Apr 1, 2019
1 parent 2582796 commit 759237a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
* Write and replace for bxds and xml files to protect against corruption if a crash occurs during a save.
== Release 3.0.3
* 04/01/2019 Enhanced error handling for relational database to make identification of errors easier.
* 04/01/2019 Correct validation of numeric input when using a comma as a decimal separator (GitHub Issue #77)

== Release 3.0.2
Expand Down
12 changes: 10 additions & 2 deletions jgnash-core/src/main/java/jgnash/engine/jpa/AbstractJpaDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceException;

import jgnash.engine.StoredObject;
import jgnash.engine.concurrent.PriorityThreadPoolExecutor;
Expand Down Expand Up @@ -111,6 +112,9 @@ <T extends StoredObject> T merge(final T object) {
em.getTransaction().commit();

return mergedObject;
} catch (final PersistenceException | IllegalStateException e1) {
logSevere(AbstractJpaDAO.class, e1);
return null;
} finally {
emLock.unlock();
}
Expand All @@ -128,6 +132,7 @@ <T extends StoredObject> T merge(final T object) {
* Persists an object.
*
* @param objects {@link Object} to persist
* @return {@code true} if successful, {@code false} otherwise
*/
boolean persist(final Object... objects) {
boolean result = false;
Expand All @@ -146,15 +151,18 @@ boolean persist(final Object... objects) {
em.getTransaction().commit();

return true;
} catch (final PersistenceException | IllegalStateException e1) {
logSevere(AbstractJpaDAO.class, e1);
return false;
} finally {
emLock.unlock();
}
});

result = future.get(); // block and return

} catch (final InterruptedException | ExecutionException e) {
logSevere(AbstractJpaDAO.class, e);
} catch (final InterruptedException | ExecutionException e2) {
logSevere(AbstractJpaDAO.class, e2);
Thread.currentThread().interrupt();
}

Expand Down

0 comments on commit 759237a

Please sign in to comment.