This looks convoluted ... instead do

 String uriString;
 if (uri != null) {
     operationResult.addOperationResult(uri, userMessage);
     uriString = uri.toString();
 } else
     uriString = "retrieving URI failed"; //$NON-NLS-1$