[Design of POJO Server] - No Security Context regression
by scott.stark@jboss.org
Tests that were working this morning before updating trunk are now failing with the following exception. There is not security setup to check so there should be no such assertion in the client side interceptor.
| java.lang.RuntimeException: No Security Context
| at org.jboss.aspects.security.SecurityActions$2.run(SecurityActions.java:131)
| at org.jboss.aspects.security.SecurityActions$2.run(SecurityActions.java:127)
| at java.security.AccessController.doPrivileged(Native Method)
| at org.jboss.aspects.security.SecurityActions.getPrincipal(SecurityActions.java:125)
| at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:49)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:102)
| at AOPProxy$0.getViewManager(AOPProxy$0.java)
| at org.jboss.test.profileservice.test.AbstractProfileServiceTest.getManagementView(AbstractProfileServiceTest.java:147)
| at org.jboss.test.profileservice.test.ProfileServiceUnitTestCase.testSarDeploymentType(ProfileServiceUnitTestCase.java:244)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:585)
| at junit.framework.TestCase.runTest(TestCase.java:154)
| at junit.framework.TestCase.runBare(TestCase.java:127)
| at junit.framework.TestResult$1.protect(TestResult.java:106)
| at junit.framework.TestResult.runProtected(TestResult.java:124)
| at junit.framework.TestResult.run(TestResult.java:109)
| at junit.framework.TestCase.run(TestCase.java:118)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157496#4157496
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157496
16 years, 3 months
[Design of JBoss jBPM] - Variables in Mail Templates
by magro1202
Hi everyone
I have tuned up a little the usage of variables in Mail Templates.
usually when you want to use a variable like that
| <mail-templates>
|
| <variable name="defaultSubject" value="Mail" />
|
| <mail-template name='default'>
| <actors>#{taskInstance.actorId}</actors>
| <subject>#{defaultSubject}</subject>
| <text><![CDATA[Mail von Geppi:
| #{mailMessage}]]>
| </text>
| </mail-template>
|
the variable is evaluated correctly and the value of Subject is set to "Mail"
but if you want to use variable references within the variables like this
| <mail-templates>
|
| <variable name="defaultSubject" value="[#{processDefinition.name} #{processInstance.id}] generated Mail" />
|
| <mail-template name='default'>
| <actors>#{taskInstance.actorId}</actors>
| <subject>#{defaultSubject}</subject>
| <text><![CDATA[Mail von Geppi:
| #{mailMessage}]]>
| </text>
| </mail-template>
|
the value within the variable is not evaluated.
So i added a loop which evaluates the variable value until all references are solved.
In class org.jbpm.mail.Mail:
| public String getSubject() {
| if (subject==null) return null;
| Object parsedValue = null;
| String ret = subject;
| do {
| ret = evaluate(ret);
| ret = JbpmExpressionEvaluator.translateExpressionToDollars(ret);
| parsedValue = new ExpressionEvaluatorImpl().parseExpressionString(ret);
| } while (!(parsedValue instanceof String));
|
| return ret;
| }
|
| public String getText() {
| if (text==null) return null;
| Object parsedValue = null;
| String ret = text;
| do {
| ret = evaluate(ret);
| ret = JbpmExpressionEvaluator.translateExpressionToDollars(ret);
| parsedValue = new ExpressionEvaluatorImpl().parseExpressionString(ret);
| } while (!(parsedValue instanceof String));
|
| return ret;
| }
|
i will post a Jira Patch for this too
regards
Matthias
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157398#4157398
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157398
16 years, 3 months
[Design the new POJO MicroContainer] - Re: Installing instance of wrong class gives weird error
by adrian@jboss.org
That's not correct. It's now doing the check twice.
Once when you do it and once inside the JDK reflection api.
That's horribly inefficient, since these reflection calls are used everywhere.
The whole point of ReflectionUtils is give more reasonable error messages
after reflection calls fail, because the JDK is usually hopeless.
e.g. you'll get something like
| java.lang.IllegalArgumentException: wrong type java.lang.String
|
Without it telling you what invocation is being attempted or which
parameter is wrong.
What's required is to fix "handleErrors" to also check whether IllegalArgumentException
is due to the wrong target object being passed for non-status invocations
and not just assuming that it is due to an invalid parameter being passed.
public static Throwable handleErrors(String context, Object target,
+ Class<?> clazz,
+ Object instance,
Class<?>[] parameters, Object[] arguments, Throwable t) throws Throwable
{
if (t instanceof IllegalArgumentException)
{
if (target == null)
throw new IllegalArgumentException("Null target for " + context);
+ if (clazz != null && instance != null && clazz.isAssignableFrom(instance) == false)
+ throw new IllegalArgumentException("Wrong target. " + instance.getClass().getName() + " is not a " + clazz.getName());
ArrayList expected = new ArrayList();
if (parameters != null)
{
for (int i = 0; i < parameters.length; ++i)
expected.add(parameters.getName());
}
ArrayList actual = new ArrayList();
if (arguments != null)
{
for (int i = 0; i < arguments.length; ++i)
{
if (arguments == null)
actual.add(null);
else
actual.add(arguments.getClass().getName());
}
}
throw new IllegalArgumentException("Wrong arguments. " + context + " for target " + target + " expected=" + expected + " actual=" + actual);
}
else if (t instanceof InvocationTargetException)
{
throw ((InvocationTargetException) t).getTargetException();
}
throw t;
}
and
| public static Object invoke(Method method, Object target, Object[] arguments) throws Throwable
| {
| if (method == null)
| throw new IllegalArgumentException("Null method");
| try
| {
| return method.invoke(target, arguments);
| }
| catch (Throwable t)
| {
| throw handleErrors(method.getName(), Strings.defaultToString(target),
| + method.getDeclaringClass(), target,
| method.getParameterTypes(), arguments, t);
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4157396#4157396
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4157396
16 years, 3 months