/** * Converts the specified AWS policy object to a JSON string, suitable for * passing to an AWS service. * * @param policy * The AWS policy object to convert to a JSON string. * * @return The JSON string representation of the specified policy object. * * @throws IllegalArgumentException * If the specified policy is null or invalid and cannot be * serialized to a JSON string. */ public String writePolicyToString(Policy policy) { if(!isNotNull(policy)) throw new IllegalArgumentException("Policy cannot be null"); try { return jsonStringOf(policy); } catch (Exception e) { String message = "Unable to serialize policy to JSON string: " + e.getMessage(); throw new IllegalArgumentException(message, e); } finally { try { writer.close(); } catch (Exception e) { } } }
/** * Converts the specified AWS policy object to a JSON string, suitable for * passing to an AWS service. * * @param policy * The AWS policy object to convert to a JSON string. * * @return The JSON string representation of the specified policy object. * * @throws IllegalArgumentException * If the specified policy is null or invalid and cannot be * serialized to a JSON string. */ public String writePolicyToString(Policy policy) { if(!isNotNull(policy)) throw new IllegalArgumentException("Policy cannot be null"); try { return jsonStringOf(policy); } catch (Exception e) { String message = "Unable to serialize policy to JSON string: " + e.getMessage(); throw new IllegalArgumentException(message, e); } finally { try { writer.close(); } catch (Exception e) { } } }
/** * Converts the specified AWS policy object to a JSON string, suitable for * passing to an AWS service. * * @param policy The AWS policy object to convert to a JSON string. * @return The JSON string representation of the specified policy object. * @throws IllegalArgumentException If the specified policy is null or * invalid and cannot be serialized to a JSON string. */ public String writePolicyToString(Policy policy) { if (!isNotNull(policy)) throw new IllegalArgumentException("Policy cannot be null"); try { return jsonStringOf(policy); } catch (Exception e) { String message = "Unable to serialize policy to JSON string: " + e.getMessage(); throw new IllegalArgumentException(message, e); } finally { try { writer.close(); } catch (Exception e) { } } }
/** * Converts the specified AWS policy object to a JSON string, suitable for * passing to an AWS service. * * @param policy The AWS policy object to convert to a JSON string. * @return The JSON string representation of the specified policy object. * @throws IllegalArgumentException If the specified policy is null or * invalid and cannot be serialized to a JSON string. */ public String writePolicyToString(Policy policy) { if (!isNotNull(policy)) throw new IllegalArgumentException("Policy cannot be null"); try { return jsonStringOf(policy); } catch (Exception e) { String message = "Unable to serialize policy to JSON string: " + e.getMessage(); throw new IllegalArgumentException(message, e); } finally { try { writer.close(); } catch (Exception e) { } } }
/** * Converts the specified AWS policy object to a JSON string, suitable for * passing to an AWS service. * * @param policy The AWS policy object to convert to a JSON string. * @return The JSON string representation of the specified policy object. * @throws IllegalArgumentException If the specified policy is null or * invalid and cannot be serialized to a JSON string. */ public String writePolicyToString(Policy policy) { if (!isNotNull(policy)) throw new IllegalArgumentException("Policy cannot be null"); try { return jsonStringOf(policy); } catch (Exception e) { String message = "Unable to serialize policy to JSON string: " + e.getMessage(); throw new IllegalArgumentException(message, e); } finally { try { writer.close(); } catch (Exception e) { } } }
/** * Converts the specified AWS policy object to a JSON string, suitable for * passing to an AWS service. * * @param policy * The AWS policy object to convert to a JSON string. * * @return The JSON string representation of the specified policy object. * * @throws IllegalArgumentException * If the specified policy is null or invalid and cannot be * serialized to a JSON string. */ public String writePolicyToString(Policy policy) { if(!isNotNull(policy)) throw new IllegalArgumentException("Policy cannot be null"); try { return jsonStringOf(policy); } catch (Exception e) { String message = "Unable to serialize policy to JSON string: " + e.getMessage(); throw new IllegalArgumentException(message, e); } finally { try { writer.close(); } catch (Exception e) { } } }