Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Handling AttrValException and throwing proper error message in UI

970108Jul 29 2013 — edited Jul 29 2013

Hi All,

I have a scenario where I need to validate each attribute of a row before I push it into the DB. Validation of the attribute is majorly checking if the value is null or not. If null I am raising a AttrValException. However because of the BundleException property, it doesn't throw the exception onto the UI directly/immediately but it gets bundled up into RowValException and then into a TxnValException.  After inserting the row, I have other data which is processed and validated in similar fashion. I am using OperationBinding to invoke the method which inserts the rows. However, when I use OpeationBinding.getErrors() post execute, it doesn't pick up the TxnValException and proceeds further and tries to commit the data(I am using EL {binding.commit.execute} for commit action).

Here are my doubts relating to this

     1) Why isn't OperationBinding.getErrors picking up the TxnValException?

     2) If OperationBinding.getErrors doesn't work, what is an alternative to handle this case and check if the exception was thrown or not?

     3).When commit runs and sees that the remaining data is exception free, then will it try to commit the valid data and ignore the invalid data or will it throw an exception as some data is corrupt?

     4) In case there are multiple attributes which fail the validation, though there is only 1 TxnValException, after iterating through it recursively we can get all AttrValExceptions. How can I throw all the AttrValExceptions simultaneously? Or rather how can I get the error message to display all the AttrValExceptions raised?

Comments

gimbal2
In stead of posting that "A" security exception occurs, post the exact security exception that occurs including the full stacktrace.
1006132
Here's the stacktrace:

Match: digest selected JREDesc: JREDesc[version 1.5+, heap=-1--1, args=null, href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
platform is: 1.7
product is: 1.7.0_21
location is: http://java.sun.com/products/autodl/j2se
args is:
native platform is: Windows, x86 [ x86, 32bit ]
JavaFX runtime is: JavaFX 2.2.21 found at C:\Program Files\Java\jre7\
enabled is: true
registered is: true
system is: true

Match: ignoring maxHeap: -1
Match: ignoring InitHeap: -1
Match: digesting vmargs: null
Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
Match: digest LaunchDesc: null
Match: digest properties: []
Match: JVM args: [JVMParameters: isSecure: true, args: ]
Match: endTraversal ..
Match: JVM args final:
Match: Running JREInfo Version match: 1.7.0.21 == 1.7.0.21
Match: Running JVM args match: have:<> satisfy want:<>
java.lang.reflect.InvocationTargetException
at java.awt.EventQueue.invokeAndWait(Unknown Source)
at java.awt.EventQueue.invokeAndWait(Unknown Source)
at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
at com.sun.deploy.uitoolkit.impl.awt.AWTAppletAdapter.init(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.InternalError: cannot create instance of org.bouncycastle.jce.provider.symmetric.AESMappings : java.security.AccessControlException: access denied ("java.security.SecurityPermission" "putProviderProperty.BC")
at org.bouncycastle.jce.provider.BouncyCastleProvider.loadAlgorithms(Unknown Source)
at org.bouncycastle.jce.provider.BouncyCastleProvider.<init>(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
472695
Fwiw, I'm experiencing the same problem since update 21 (same stack trace).
1006132
Answer

It seems that from update 21 of JRE 7 the following lines are necessary in jnlp file when adding a BC provider:

<security>

   <all-permissions/>

</security>

Anyway, it solves our problem...

Marked as Answer by 1006132 · Sep 27 2020
1 - 4
Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Aug 26 2013
Added on Jul 29 2013
3 comments
463 views