Commit 0b3e73fd authored by Arild Trygve Aae's avatar Arild Trygve Aae

tmp versjon

parent 7c431a48
Pipeline #24024 skipped with stages
......@@ -28,6 +28,8 @@ import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestTemplate;
......@@ -156,26 +158,49 @@ import org.springframework.web.client.RestTemplate;
}
}
} catch (HttpStatusCodeException exp) {
// TODO Auto-generated catch block
skrivFilException(writerFeilLogg, soek, fileNameFeil,exp);
// e.printStackTrace();
} catch (HttpClientErrorException ce) {
appendToFile(ce,fileNameFeil,soek);
System.out.println(" Exception failce1: " + soek + " " + ce.getMessage());
// e.printStackTrace();
}catch (HttpServerErrorException se) {
appendToFile(se,fileNameFeil,soek);
System.out.println(" Exception failse1: " + soek + " " + se.getMessage());
}catch (Exception e) {
appendToFile(e,fileNameFeil,soek);
System.out.println(" Exception faile1: " + soek + " " + e.getMessage());
}
// System.out.println ("Resultat av søk: " + result);
} catch (Exception e) {
skrivFilException(writerFeilLogg, soek, fileNameFeil,e);
System.out.println(" Exception feil2: " + soek + " " + e.getMessage());
} catch (HttpClientErrorException ce) {
appendToFile(ce,fileNameFeil,soek);
// skrivFilException(writerFeilLogg, soek, fileNameFeil,e);
System.out.println(" Exception feilce2: " + soek + " " + ce.getMessage());
// e.printStackTrace();
}catch (HttpServerErrorException se) {
appendToFile(se,fileNameFeil,soek);
// skrivFilException(writerFeilLogg, soek, fileNameFeil,e);
System.out.println(" Exception feilse2: " + soek + " " + se.getMessage());
// e.printStackTrace();
}catch (Exception e) {
appendToFile(e,fileNameFeil,soek);
// e.printStackTrace();
}
}
}
public static void appendToFile(Exception e,String filename,String soek) {
try {
FileWriter fstream = new FileWriter(filename, true);
BufferedWriter out = new BufferedWriter(fstream);
PrintWriter pWriter = new PrintWriter(out, true);
e.printStackTrace( pWriter);
}
catch (Exception ie) {
throw new RuntimeException("Could not write Exception to file", ie);
}
}
void skrivFil(BufferedWriter writer,JSONObject jsonObject, String filename) {
......@@ -196,7 +221,7 @@ import org.springframework.web.client.RestTemplate;
System.out.println ("Hei 1 " + streng);
// writer2.append(streng);
// writer2.newLine();
FileWriter fstream = new FileWriter(filename,);
FileWriter fstream = new FileWriter(filename);
BufferedWriter out = new BufferedWriter(fstream);
PrintWriter pWriter = new PrintWriter(out, true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment