title: VelocityEngine template having empty content
body: <p>We have started using VelocityEngine and we have been seeing some wired behavior. For each data we have in our velocity template we make sure that it won't be null and if it is null at least we set it to empty string ("") so no data error would occur. We also have sendEmail() method we have using for years and we know it works fine. </p>
  
  <p>However, for every few emails sent out, we started receiving empty emails (No content at all). So I assume this is related to loading the template. This code block will be called frequently with thousands of our users. Below is the code block we use to initialize VE and set all data. Is there something wrong that would cause for the template to be empty ? Or threading issues ? Not quite sure. I appreciate your help</p>
  
  <pre><code> StringWriter writer = new StringWriter();  
  
  
  
  VelocityEngine ve = new VelocityEngine();
        ve.setProperty(RuntimeConstants.RESOURCE_LOADER, "classpath");
        ve.setProperty("classpath.resource.loader.class", ClasspathResourceLoader.class.getName());
        Template temp= ve.getTemplate("emailTemplate.xml");
  
    /**
     * Prepare context data
     */
    VelocityContext context = new VelocityContext();
  
    //Initializing all to empty 
  
  context.put("fullName", "");
      context.put("cFName","");
      context.put("cLName","");
      context.put("cPhone", "");
      context.put("cEmail", "");
      context.put("emailType",0);
  
  context.put("street","");
  context.put("city","");
  context.put("state","");
  context.put("zip","");
  
  context.put("hasCMessage", false);
  context.put("numBed", "");
  
  
    //Fill the context with the right data if the coming data is not null
  
  context.put("fullName", (client.getFullName()!=null? client.getFullName() :"" ));
  
   temp.merge(context, writer);
  </code></pre>