Skip to content

Commit

Permalink
minor code-style changes
Browse files Browse the repository at this point in the history
  • Loading branch information
dj3500 committed Aug 20, 2014
1 parent 37bcb16 commit 3c1c090
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 23 deletions.
13 changes: 6 additions & 7 deletions Hightail/src/org/hightail/SupportedSites.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import javax.xml.ws.ProtocolException;
import static org.hightail.SupportedSites.values;
import org.hightail.parsers.contest.*;
import org.hightail.parsers.task.*;
import org.hightail.util.XTrustProvider;
Expand All @@ -23,8 +20,7 @@ public enum SupportedSites {
Jutge (
"jutge",
new JutgeTaskParser(),
new JutgeContestParser()
)
new JutgeContestParser())
;

private TaskParser taskParser;
Expand All @@ -43,8 +39,11 @@ public String getDirectory() {

private static void verifyURL(String url) throws ParserException {
try {
if(url.contains("jutge."))
if (url.contains("jutge.")) {
// workaround to cope with the SSL cerificate problem on Jutge
// this is needed also for the task parser itself to work (this method gets called before the task parser)
XTrustProvider.install();
}
URL u = new URL(url);
HttpURLConnection conn = (HttpURLConnection) u.openConnection();
conn.setRequestMethod("GET");
Expand All @@ -53,7 +52,7 @@ private static void verifyURL(String url) throws ParserException {
if (code != 200) {
throw new ParserException("Incorrect URL.");
}
}catch (IOException ex) {
} catch (IOException ex) {
throw new ParserException("Malformed URL.");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
package org.hightail.parsers.contest;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.hightail.Problem;
import org.hightail.parsers.task.JutgeTaskParser;
import org.hightail.parsers.task.TaskParser;
import org.htmlparser.Node;
import org.htmlparser.Parser;
import org.htmlparser.filters.LinkRegexFilter;
import org.htmlparser.tags.LinkTag;
import org.htmlparser.util.ParserException;
import org.htmlparser.visitors.TagFindingVisitor;

/**
* Jutge (UPC local online judge) contest parser.
Expand All @@ -27,7 +17,7 @@ Problem lists (which can be interpreted as contests) are only available if you a
Also, it doesn't make much sense here since most problems are public and they are usually solved
one by one in pratice.
*/
throw new ParserException("Parsing failed.");
throw new ParserException("Contest parser for Jutge is not implemented.");
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion Hightail/src/org/hightail/parsers/task/JutgeTaskParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ private ArrayList<String> extractInputsOrOutputs (FilterBean fb, boolean isInput
as output. I hope that there is no problem which has "/pre" as output.
*/
for(int i=0; i<inputs.size(); ++i) {
if(inputs.get(i).equals("/pre"))
if(inputs.get(i).equals("/pre")) {
inputs.set(i,"");
}
}
return inputs;
}
Expand Down
2 changes: 1 addition & 1 deletion Hightail/src/org/hightail/ui/ProblemJPanel.form
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@
<Component id="saveTestsButton" alignment="3" max="32767" attributes="0"/>
<Component id="copyInputButton" alignment="3" max="32767" attributes="0"/>
</Group>
<Component id="deleteTestcaseButton" alignment="0" max="32767" attributes="0"/>
<Component id="editTestcaseButton" alignment="0" max="32767" attributes="0"/>
<Component id="newTestcaseButton" alignment="0" max="32767" attributes="0"/>
<Component id="abortCurrentTestButton" alignment="0" max="32767" attributes="0"/>
<Component id="runTestsButton" alignment="0" max="32767" attributes="0"/>
<Component id="abortAllTestsButton" alignment="0" max="32767" attributes="0"/>
<Component id="deleteTestcaseButton" alignment="1" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
Expand Down
4 changes: 2 additions & 2 deletions Hightail/src/org/hightail/ui/ProblemJPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) {
.addGroup(testcasePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(saveTestsButton)
.addComponent(copyInputButton))
.addComponent(deleteTestcaseButton)
.addComponent(editTestcaseButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(newTestcaseButton)
.addComponent(abortCurrentTestButton)
.addComponent(runTestsButton)
.addComponent(abortAllTestsButton)))
.addComponent(abortAllTestsButton)
.addComponent(deleteTestcaseButton, javax.swing.GroupLayout.Alignment.TRAILING)))
);

openContainingDirectoryButton.setText("Browse...");
Expand Down
1 change: 0 additions & 1 deletion Hightail/src/org/hightail/util/XTrustProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import java.security.PrivilegedAction;
import java.security.Security;
import java.security.cert.X509Certificate;

import javax.net.ssl.ManagerFactoryParameters;
import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactorySpi;
Expand Down

0 comments on commit 3c1c090

Please sign in to comment.