@@ -232,34 +232,31 @@ public String getHeaderData() {
232232 }
233233
234234 /**
235- * Extract file path and revision strings from the URL.
236- * @param data DiffData object
235+ * Extract file path and revision strings from the URI. Basically the request URI looks like this:
236+ * {@code http://$site/$webapp/diff/$resourceFile?r1=$fileA@$revA&r2=$fileB@$revB}
237+ * The code extracts file path and revision from the URI.
238+ * @param data DiffData object (output parameter)
237239 * @param context context path
238240 * @param filepath file path array (output parameter)
239241 * @return true if the extraction was successful, false otherwise
240242 * (in which case {@link DiffData#errorMsg} will be set)
241243 */
242244 private boolean getFileRevision (DiffData data , String context , String [] filepath ) {
243- /*
244- * Basically the request URI looks like this:
245- * http://$site/$webapp/diff/$resourceFile?r1=$fileA@$revA&r2=$fileB@$revB
246- * The code below extracts file path and revision from the URI.
247- */
248245 for (int i = 1 ; i <= 2 ; i ++) {
249- String p = Laundromat . launderRevision ( req .getParameter (QueryParameters .REVISION_PARAM + i ) );
246+ String p = req .getParameter (QueryParameters .REVISION_PARAM + i );
250247 if (p != null ) {
251248 int j = p .lastIndexOf ("@" );
252249 if (j != -1 ) {
253- filepath [i - 1 ] = p .substring (0 , j );
254- data .rev [i - 1 ] = p .substring (j + 1 );
250+ filepath [i - 1 ] = Laundromat . launderPath ( p .substring (0 , j ) );
251+ data .rev [i - 1 ] = Laundromat . launderRevision ( p .substring (j + 1 ) );
255252 }
256253 }
257254 }
258255
259256 if (data .rev [0 ] == null || data .rev [1 ] == null
260257 || data .rev [0 ].isEmpty () || data .rev [1 ].isEmpty ()
261258 || data .rev [0 ].equals (data .rev [1 ])) {
262- data .errorMsg = "Please pick two revisions to compare the changed "
259+ data .errorMsg = "Please pick two revisions to compare the changes "
263260 + "from the <a href=\" " + context + Prefix .HIST_L
264261 + getUriEncodedPath () + "\" >history</a>" ;
265262 return false ;
0 commit comments