3
3
import java .io .IOException ;
4
4
import java .net .HttpURLConnection ;
5
5
import java .net .URL ;
6
- import javax .net .ssl .HttpsURLConnection ;
7
- import javax .xml .ws .ProtocolException ;
8
- import static org .hightail .SupportedSites .values ;
9
6
import org .hightail .parsers .contest .*;
10
7
import org .hightail .parsers .task .*;
11
8
import org .hightail .util .XTrustProvider ;
@@ -23,8 +20,7 @@ public enum SupportedSites {
23
20
Jutge (
24
21
"jutge" ,
25
22
new JutgeTaskParser (),
26
- new JutgeContestParser ()
27
- )
23
+ new JutgeContestParser ())
28
24
;
29
25
30
26
private TaskParser taskParser ;
@@ -43,8 +39,11 @@ public String getDirectory() {
43
39
44
40
private static void verifyURL (String url ) throws ParserException {
45
41
try {
46
- if (url .contains ("jutge." ))
42
+ if (url .contains ("jutge." )) {
43
+ // workaround to cope with the SSL cerificate problem on Jutge
44
+ // this is needed also for the task parser itself to work (this method gets called before the task parser)
47
45
XTrustProvider .install ();
46
+ }
48
47
URL u = new URL (url );
49
48
HttpURLConnection conn = (HttpURLConnection ) u .openConnection ();
50
49
conn .setRequestMethod ("GET" );
@@ -53,7 +52,7 @@ private static void verifyURL(String url) throws ParserException {
53
52
if (code != 200 ) {
54
53
throw new ParserException ("Incorrect URL." );
55
54
}
56
- }catch (IOException ex ) {
55
+ } catch (IOException ex ) {
57
56
throw new ParserException ("Malformed URL." );
58
57
}
59
58
}
0 commit comments