3535
3636
3737import com .fasterxml .jackson .databind .ObjectMapper ;
38- import com .google .gson .Gson ;
39- import com .google .gson .GsonBuilder ;
4038import fr .paris .lutece .api .user .User ;
4139import fr .paris .lutece .plugins .wiki .business .*;
4240import fr .paris .lutece .plugins .wiki .service .ContentDeserializer ;
@@ -154,16 +152,18 @@ public static HttpServletResponse modifyPage( HttpServletRequest request, HttpSe
154152*/
155153 public static void updateLastModifyAttemptPage ( HttpServletRequest request ) throws IOException , UserNotSignedException
156154 {
157- StringBuilder sb = new StringBuilder ( );
158- BufferedReader reader = request .getReader ( );
155+ StringBuilder sb = new StringBuilder ();
156+ BufferedReader reader = request .getReader ();
159157 String line ;
160- while ( ( line = reader .readLine ( ) ) != null )
161- {
162- sb .append ( line );
158+ while ((line = reader .readLine ()) != null ) {
159+ sb .append (line );
163160 }
164- String requestBody = sb .toString ( );
165- final Gson gson = new GsonBuilder ( ).setPrettyPrinting ( ).create ( );
166- final int topicId = gson .fromJson ( requestBody , int .class );
161+ String requestBody = sb .toString ();
162+ // delete the first and last character of the string to parse an int
163+ requestBody = requestBody .substring (1 );
164+ requestBody = requestBody .substring (0 , requestBody .length () - 1 );
165+ final int topicId = Integer .parseInt (requestBody );
166+ // parse
167167 Topic topic = TopicHome .findByPrimaryKey ( topicId );
168168 try
169169 {
@@ -179,7 +179,7 @@ public static void updateLastModifyAttemptPage( HttpServletRequest request ) thr
179179 }
180180 catch ( Exception e )
181181 {
182- AppLogService .error ( "Error saving last user opening modify topic page" , e );
182+ AppLogService .error ( "Error saving last user editing topic page" , e );
183183
184184 }
185185 }
0 commit comments