Skip to content

Commit

Permalink
Fixes #591 Intermittent failure in testTemplateJsonArrayResolverError
Browse files Browse the repository at this point in the history
The AtomicReference should be set early so that it's never null after testRequest exits.
  • Loading branch information
tsegismont committed Apr 5, 2017
1 parent d7a897f commit c1ed333
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@

package io.vertx.ext.web.templ;

import java.util.Set;
import java.util.Collections;
import java.util.Map.Entry;
import java.util.concurrent.atomic.AtomicReference;
import com.github.jknack.handlebars.HandlebarsException;
import com.github.jknack.handlebars.ValueResolver;

import io.vertx.core.Handler;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.json.JsonArray;
Expand All @@ -32,6 +27,11 @@
import io.vertx.ext.web.handler.TemplateHandler;
import org.junit.Test;

import java.util.Collections;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.atomic.AtomicReference;

/**
* @author <a href="http://tfox.org">Tim Fox</a>
*/
Expand Down Expand Up @@ -102,9 +102,9 @@ public void testTemplateJsonArrayResolverError() throws Exception {

AtomicReference<RoutingContext> contextRef = new AtomicReference<>();
router.route().handler(context -> {
contextRef.set(context);
context.put("foo", jsonArray);
context.next();
contextRef.set(context);
});
router.route().handler(TemplateHandler.create(engine, "src/test/filesystemtemplates", "text/plain"));
testRequest(HttpMethod.GET, "/" + "test-handlebars-template6.hbs", 500, "Internal Server Error");
Expand Down

0 comments on commit c1ed333

Please sign in to comment.