From: Luca M. (JIRA) <no...@at...> - 2006-05-11 07:47:12
|
Bug in reference documentation ------------------------------ Key: HHH-1741 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1741 Project: Hibernate3 Type: Bug Components: documentation Versions: 3.2.1, 3.1.4, 3.2.0, 3.0 alpha, 3.0 beta 1, 3.0 beta 2, 3.0 beta 3, 3.0 beta 4, 3.0 rc 1, 3.0 final, 3.0.1, 3.0.2, 3.0.3, 3.0.4, 3.0.5, 3.1 beta 1, 3.1 beta 2, 3.1 rc 1, 3.1 rc2, 3.1 rc3, 3.1, 3.1.1, 3.1.2, 3.2.0.alpha1 Reporter: Luca Masini From paragraph 1.4.1: "1.4.1. Writing the basic servlet Create a new class in your source directory, in the events package: package events; // Imports public class EventManagerServlet extends HttpServlet { private final SimpleDateFormat dateFormatter = new SimpleDateFormat("dd.MM.yyyy"); // Servlet code } The dateFormatter is a tool we'll need later to convert Date objects from and to strings. It makes sense to only have one formatter as a member of the servlet." but if you read the JDK 1.4 and later Javadocs there is a note at the bottom of the description of the SimpleDateFormat class: "Synchronization Date formats are not synchronized. It is recommended to create separate format instances for each thread. If multiple threads access a format concurrently, it must be synchronized externally. " This mean that the example is buggy and will not work if two thread use the same servlet at the same time. Please correct it putting the dateFormatter instantiation into the doGet method. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |