// Path: src/main/java/Diadoc/Api/helpers/System7Emu.java
// public class System7Emu
// {
//     private static String lineSeparator = detectLineSeparator();
//     
//     public static String lineSeparator()
//     {
//         return lineSeparator;
//     }
//     
//     private static String detectLineSeparator()
//     {
//         try
//         {
//             Method lineSeparatorMethod = System.class.getMethod("lineSeparator", new Class[0]);
//             return (String)lineSeparatorMethod.invoke(null,  new Object[0]);
//         }
//         catch (Exception ignored)
//         {
//             // If JRE is of version below 7 then System.lineSeparator does not exist, 
//             // so we just have to ignore the error and to emulate logic
//         }
//         
//         try
//         {
//             String value = System.getProperty("line.separator");
//             if (value != null)
//                 return value;
//         }
//         catch (Exception ignored)
//         {
//             // It is unlikely but still possible to block access to properties through security settings of Java 
//             // In this case just ignore the problem and detect line separator based on file system properties 
//         }
//         
//         return (File.separatorChar == '\\') ? "\r\n" : "\n";
//     }
// }


import Diadoc.Api.helpers.System7Emu;
package Diadoc.Api.exceptions;


public class DiadocSdkException extends Exception {
    public DiadocSdkException(Exception ex) {
        super(ex);
    }

    public DiadocSdkException(String message) {
        super(message);
    }

    private String formatMessage(Throwable[] exceptions) {
        String text = super.toString();
        for (int i = 0; i < exceptions.length; i++){
// Path: src/main/java/Diadoc/Api/helpers/System7Emu.java
// public class System7Emu
// {
//     private static String lineSeparator = detectLineSeparator();
//     
//     public static String lineSeparator()
//     {
//         return lineSeparator;
//     }
//     
//     private static String detectLineSeparator()
//     {
//         try
//         {
//             Method lineSeparatorMethod = System.class.getMethod("lineSeparator", new Class[0]);
//             return (String)lineSeparatorMethod.invoke(null,  new Object[0]);
//         }
//         catch (Exception ignored)
//         {
//             // If JRE is of version below 7 then System.lineSeparator does not exist, 
//             // so we just have to ignore the error and to emulate logic
//         }
//         
//         try
//         {
//             String value = System.getProperty("line.separator");
//             if (value != null)
//                 return value;
//         }
//         catch (Exception ignored)
//         {
//             // It is unlikely but still possible to block access to properties through security settings of Java 
//             // In this case just ignore the problem and detect line separator based on file system properties 
//         }
//         
//         return (File.separatorChar == '\\') ? "\r\n" : "\n";
//     }
// }


// Path: src/main/java/Diadoc/Api/exceptions/DiadocSdkException.java
import Diadoc.Api.helpers.System7Emu;

package Diadoc.Api.exceptions;


public class DiadocSdkException extends Exception {
    public DiadocSdkException(Exception ex) {
        super(ex);
    }

    public DiadocSdkException(String message) {
        super(message);
    }

    private String formatMessage(Throwable[] exceptions) {
        String text = super.toString();
        for (int i = 0; i < exceptions.length; i++){
            text = String.format("%s%s---> (Inner Exception #%s) %s%s%s", text, System7Emu.lineSeparator(), i, exceptions[i].toString(), "<---", System7Emu.lineSeparator());