    public Result onError( Http.RequestHeader requestHeader, Throwable throwable )
    {
        logger.error( String.format( "experienced error {}", Utils.requestToString( requestHeader ) ), throwable );
        Results.Status status = JavaResults.InternalServerError();
        SimpleResult result;
        if ( throwable.getCause() != null && throwable.getCause() instanceof  ExceptionResponse ){ 
            ExceptionResponseDetails res = ( ( ExceptionResponse) throwable.getCause() ).getResponseDetails();
            Tuple2<String, String> ac = new Tuple2<String, String>( res.getHeaderKey(), res.toJson());
                    ArrayList<Tuple2<String, String>> list = new ArrayList<Tuple2<String, String>>();
                    list.add(ac);
                    scala.collection.immutable.List<Tuple2<String, String>> headers =
                      JavaConversions.asBuffer( list ).toList();
            status.header().headers().$plus(  ac );
           result = status.withHeaders( headers );
        }else{
            return null;
        }
        final SimpleResult finalResult = result;
        return new Result() {
            @Override
            public play.api.mvc.Result getWrappedResult()
            {
                return finalResult;
            }
        };
    }

    public Result onError( Http.RequestHeader requestHeader, Throwable throwable )
    {
        logger.error( String.format( "experienced error {}", Utils.requestToString( requestHeader ) ), throwable );
        Results.Status status = JavaResults.InternalServerError();
        SimpleResult result;
        if ( throwable.getCause() != null && throwable.getCause() instanceof  ExceptionResponse ){ 
            ExceptionResponseDetails res = ( ( ExceptionResponse) throwable.getCause() ).getResponseDetails();
            Tuple2<String, String> ac = new Tuple2<String, String>( res.getHeaderKey(), res.toJson());
                    ArrayList<Tuple2<String, String>> list = new ArrayList<Tuple2<String, String>>();
                    list.add(ac);
                    scala.collection.immutable.List<Tuple2<String, String>> headers =
                      JavaConversions.asScalaBuffer( list ).toList();
            status.header().headers().$plus(  ac );
           result = status.withHeaders( headers );
        }else{
            return null;
        }
        final SimpleResult finalResult = result;
        return new Result() {
            @Override
            public play.api.mvc.Result getWrappedResult()
            {
                return finalResult;
            }
        };
    }
