// Path: util/src/main/java/org/limmen/mystart/util/SSLContextProvider.java
// public class SSLContextProvider {
// 
//   private static SSLContext sslContext;
// 
//   public static SSLContext getSSLContext() {
//     if (sslContext == null) {
//       TrustManager[] certs = new TrustManager[]{
//         new X509TrustManager() {
//           @Override
//           public X509Certificate[] getAcceptedIssuers() {
//             return null;
//           }
// 
//           @Override
//           public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
//           }
// 
//           @Override
//           public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
//           }
//         }
//       };
//       try {
//         sslContext = SSLContext.getInstance("SSL");
//         sslContext.init(null, certs, new SecureRandom());
//       } catch (Exception e) {
//         // ignore exception
//       }
//     }
//     return sslContext;
//   }
// }


import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import static java.time.temporal.ChronoUnit.SECONDS;
import java.util.Enumeration;
import java.util.Optional;
import javax.net.ssl.SSLContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.limmen.mystart.util.SSLContextProvider;
        // opens input stream from the HTTP connection
        try (InputStream inputStream = response.body()) {
          return saveFile(inputStream, fileName);
        }
      } else if (responseCode >= 400 && responseCode <= 499) {
        log.warn("Not authorized/Rate limit exceeded");
        return null;
      }
    } catch (IOException | InterruptedException ex) {
      //
    }
    return null;
  }

  private File saveFile(InputStream inputStream, String fileName) throws IOException {
    File tmpFile = File.createTempFile("mystart", fileName);
    try (FileOutputStream outputStream = new FileOutputStream(tmpFile)) {
      IOUtils.copy(inputStream, outputStream);
    }
    inputStream.close();
    return tmpFile;
  }

  @Override
  public boolean hasMoreElements() {
    return this.pageIndex < this.lastPage;
  }

  @Override
  public File nextElement() {
// Path: util/src/main/java/org/limmen/mystart/util/SSLContextProvider.java
// public class SSLContextProvider {
// 
//   private static SSLContext sslContext;
// 
//   public static SSLContext getSSLContext() {
//     if (sslContext == null) {
//       TrustManager[] certs = new TrustManager[]{
//         new X509TrustManager() {
//           @Override
//           public X509Certificate[] getAcceptedIssuers() {
//             return null;
//           }
// 
//           @Override
//           public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
//           }
// 
//           @Override
//           public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
//           }
//         }
//       };
//       try {
//         sslContext = SSLContext.getInstance("SSL");
//         sslContext.init(null, certs, new SecureRandom());
//       } catch (Exception e) {
//         // ignore exception
//       }
//     }
//     return sslContext;
//   }
// }


// Path: bookmarkimporter/github/src/main/java/org/limmen/mystart/importer/GitHubPageLoader.java
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.time.Duration;
import static java.time.temporal.ChronoUnit.SECONDS;
import java.util.Enumeration;
import java.util.Optional;
import javax.net.ssl.SSLContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.limmen.mystart.util.SSLContextProvider;

        // opens input stream from the HTTP connection
        try (InputStream inputStream = response.body()) {
          return saveFile(inputStream, fileName);
        }
      } else if (responseCode >= 400 && responseCode <= 499) {
        log.warn("Not authorized/Rate limit exceeded");
        return null;
      }
    } catch (IOException | InterruptedException ex) {
      //
    }
    return null;
  }

  private File saveFile(InputStream inputStream, String fileName) throws IOException {
    File tmpFile = File.createTempFile("mystart", fileName);
    try (FileOutputStream outputStream = new FileOutputStream(tmpFile)) {
      IOUtils.copy(inputStream, outputStream);
    }
    inputStream.close();
    return tmpFile;
  }

  @Override
  public boolean hasMoreElements() {
    return this.pageIndex < this.lastPage;
  }

  @Override
  public File nextElement() {
    try {