Merge "Avoid error log from velocity if no custom e-mail template exists"
This commit is contained in:
		| @@ -374,13 +374,10 @@ public abstract class OutgoingEmail { | |||||||
|   protected String velocifyFile(String name) throws EmailException { |   protected String velocifyFile(String name) throws EmailException { | ||||||
|     try { |     try { | ||||||
|       RuntimeInstance runtime = args.velocityRuntime; |       RuntimeInstance runtime = args.velocityRuntime; | ||||||
|       Template template; |       if (runtime.getLoaderNameForResource(name) == null) { | ||||||
|       try { |  | ||||||
|         template = runtime.getTemplate(name, "UTF-8"); |  | ||||||
|       } catch (org.apache.velocity.exception.ResourceNotFoundException notFound) { |  | ||||||
|         name = "com/google/gerrit/server/mail/" + name; |         name = "com/google/gerrit/server/mail/" + name; | ||||||
|         template = runtime.getTemplate(name, "UTF-8"); |  | ||||||
|       } |       } | ||||||
|  |       Template template = runtime.getTemplate(name, "UTF-8"); | ||||||
|       StringWriter w = new StringWriter(); |       StringWriter w = new StringWriter(); | ||||||
|       template.merge(velocityContext, w); |       template.merge(velocityContext, w); | ||||||
|       return w.toString(); |       return w.toString(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Martin Fick
					Martin Fick