FULL PRODUCT VERSION :
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
WIndows & Enterprise Service Pack 1
A DESCRIPTION OF THE PROBLEM :
I cannot use to lambdas in the same call - each lambda works seperately but not together. The commented out version works fine. As does partial substitution of each Callback.
//Pointcut definition
@Pointcut("execution(* com.tda.amv.batch.tasklet..execute(..))")
public void retryable() {
log.debug("In retryable() Pointcut");
}
@Around("retryable()")
public Object aroundRetryableMethods(ProceedingJoinPoint joinPoint) {
try {
return retryTemplate.execute(retryContext -> (RepeatStatus)joinPoint.proceed(), retryContext -> RepeatStatus.FINISHED);
// return retryTemplate.execute(new RetryCallback<RepeatStatus, Throwable>(){
//
// @Override
// public RepeatStatus doWithRetry(RetryContext retryContext) throws Throwable
// {
// return (RepeatStatus) joinPoint.proceed();
// }
//
// }, new RecoveryCallback<RepeatStatus>(){
//
// @Override
// public RepeatStatus recover(RetryContext arg0) throws Exception
// {
// return RepeatStatus.FINISHED;
// }
//
// });
} catch (Throwable e) {
throw new RuntimeException(e);
}
}
// junit test method
@Test
public void test() throws Exception
{
log.debug("In test() method...");
server.expect(requestTo(url))
.andExpect(method(HttpMethod.GET))
.andRespond(withSuccess("{\"totalCount\":3,\"failedCount\":0,\"completionCount\":0,\"processingCount\":2}", MediaType.APPLICATION_JSON));
getIrebalStatusTasklet.beforeStep(stepExecution);
getIrebalStatusTasklet.execute(null, null);
server.verify();
}
//Tasklet class
public class XYZTasklet implements Tasklet
{
Integer id;
@Override
public RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception
{
log.debug("In execute() method...");
String url = UriComponentsBuilder.newInstance()
.scheme("http")
.host(host)
.port(port)
.path(getIrebalStatusPath)
.build(false)
.toString();
ResponseEntity<XYZ> response = restTemplate.getForEntity(url, XYZ.class,id);
return RepeatStatus.FINISHED;
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the junit test
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
test completes
ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.8.0_05). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include
your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.trackable(Flow.java:1476)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitVarDef(Flow.java:1801)
at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitVarDef(Flow.java:2516)
at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:846)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:389)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1367)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitLambda(Flow.java:2225)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1618)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:389)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1367)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExpr(Flow.java:1596)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExprs(Flow.java:1608)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitApply(Flow.java:2205)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1459)
at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:389)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1367)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.analyzeTree(Flow.java:2370)
at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.analyzeTree(Flow.java:2353)
at com.sun.tools.javac.comp.Flow.analyzeLambdaThrownTypes(Flow.java:242)
at com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2400)
at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1618)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.DeferredAttr$2.complete(DeferredAttr.java:270)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:231)
at com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:218)
at com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:976)
at com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:822)
at com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:733)
at com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:831)
at com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:162)
at com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:566)
at com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:603)
at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:3777)
at com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3583)
at com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3490)
at com.sun.tools.javac.comp.Attr.checkMethodId(Attr.java:3469)
at com.sun.tools.javac.comp.Attr.checkId(Attr.java:3456)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3338)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1891)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1828)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1459)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:1689)
at com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1378)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:665)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:681)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1127)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:903)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:665)
at com.sun.tools.javac.comp.Attr.visitTry(Attr.java:1357)
at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1167)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:665)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:681)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1127)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:903)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:665)
at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1020)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:772)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:596)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:665)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4305)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4215)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4149)
at com.sun.tools.javac.comp.Attr.attrib(Attr.java:4124)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1251)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:904)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:863)
at com.sun.tools.javac.main.Main.compile(Main.java:523)
at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:126)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:169)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:785)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:120)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:347)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:154)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:582)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
@Before
public void setUp()
{
log.debug("In setUp() method...");
url = UriComponentsBuilder.newInstance()
.scheme("http")
.host(host)
.port(port)
.path(path)
.build(false)
.toString();
url = Pattern.compile("\\{id\\}").matcher(url).replaceAll(ID.toString());
server = MockRestServiceServer.createServer(restTemplate);
stepExecution.setExecutionContext(new ExecutionContext());
stepExecution.getExecutionContext().put(SpringConfiguration.PACKAGE_ID_KEY, ID);
}
@Test
public void test() throws Exception
{
log.debug("In test() method...");
server.expect(requestTo(url))
.andExpect(method(HttpMethod.GET))
.andRespond(withSuccess("{\"totalCount\":3,\"failedCount\":0,\"completionCount\":0,\"processingCount\":2}", MediaType.APPLICATION_JSON));
getIrebalStatusTasklet.beforeStep(stepExecution);
getIrebalStatusTasklet.execute(null, null);
server.verify();
}
---------- END SOURCE ----------