@@ -221,22 +221,21 @@ public byte[] getBinaryData() throws IOException, InterruptedException, EMFUserE
221221 LOGGER .debug ("Encoded User Id: " + encodedUserId );
222222
223223 String transformedParams ;
224+ String base64Params = "" ;
224225 try {
225226 JSONArray params = new JSONArray (this .params );
226227 for (int i = 0 ; i < params .length (); i ++) {
227228 params .getJSONObject (i ).remove ("type" );
228229 params .getJSONObject (i ).remove ("name" );
229230 }
230231 transformedParams = params .toString ();
232+ if (!transformedParams .isEmpty ()) {
233+ base64Params = Base64 .encodeBase64String (transformedParams .getBytes (UTF_8 ));
234+ }
231235 } catch (JSONException e ) {
232- throw new SpagoBIRuntimeException ( "Invalid params for document with id [" + documentId + "] " , e );
236+ LOGGER . warn ( "Error parsing params " , e );
233237 }
234238
235-
236- String base64Params = "" ;
237- if (transformedParams != null && !transformedParams .isEmpty ()) {
238- base64Params = Base64 .encodeBase64String (transformedParams .getBytes (UTF_8 ));
239- }
240239 // @formatter:off
241240 URI url = UriBuilder .fromUri (requestUrl )
242241 .replaceQueryParam ("outputType_description" , "HTML" )
@@ -245,8 +244,13 @@ public byte[] getBinaryData() throws IOException, InterruptedException, EMFUserE
245244 .replaceQueryParam ("export" )
246245 .replaceQueryParam ("role" , role )
247246 .replaceQueryParam ("organization" , organization )
248- .replaceQueryParam ("params" , base64Params )
249247 .build ();
248+
249+ if (!base64Params .isEmpty ()) {
250+ url = UriBuilder .fromUri (url )
251+ .replaceQueryParam ("params" , base64Params )
252+ .build ();
253+ }
250254 // @formatter:on
251255 LOGGER .debug ("URL: " + url );
252256
0 commit comments