修复已知问题

This commit is contained in:
Jered Ye 2024-05-09 22:02:18 +08:00
parent 9cc5d58731
commit f515ccd590
17 changed files with 294 additions and 247 deletions

1
.gitignore vendored
View File

@ -27,3 +27,4 @@ client/nbproject/private/private.properties
*.class *.class
*.jar *.jar
*.class *.class
*.class

View File

@ -872,7 +872,7 @@
</wsdl:binding> </wsdl:binding>
<wsdl:service name="OJWS"> <wsdl:service name="OJWS">
<wsdl:port binding="tns:OJWSSoapBinding" name="OJWSImplPort"> <wsdl:port binding="tns:OJWSSoapBinding" name="OJWSImplPort">
<soap:address location="http://106.15.36.190/oj/webservice/OJWS" /> <soap:address location="https://219.228.76.122:8080/oj/webservice/OJWS" />
</wsdl:port> </wsdl:port>
</wsdl:service> </wsdl:service>
</wsdl:definitions> </wsdl:definitions>

View File

@ -3,4 +3,6 @@
<system systemId="http://47.95.22.126:8080/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/47.95.22.126_8080/oj/webservice/OJWS.wsdl"/> <system systemId="http://47.95.22.126:8080/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/47.95.22.126_8080/oj/webservice/OJWS.wsdl"/>
<system systemId="http://127.0.0.1:8080/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/127.0.0.1_8080/oj/webservice/OJWS.wsdl"/> <system systemId="http://127.0.0.1:8080/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/127.0.0.1_8080/oj/webservice/OJWS.wsdl"/>
<system systemId="http://106.15.36.190:80/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/106.15.36.190_80/oj/webservice/OJWS.wsdl"/> <system systemId="http://106.15.36.190:80/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/106.15.36.190_80/oj/webservice/OJWS.wsdl"/>
<system systemId="https://219.228.76.122:443/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/219.228.76.122_443/oj/webservice/OJWS.wsdl"/>
<system systemId="https://219.228.76.122:8080/oj/webservice/OJWS?wsdl" uri="xml-resources/web-service-references/OJWS/wsdl/219.228.76.122_8080/oj/webservice/OJWS.wsdl"/>
</catalog> </catalog>

View File

@ -1,63 +1,43 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<languages> <languages>
<language id="C++" alias="c++,c,cpp,CPP,C"> <language id="C++" alias="c++,c,cpp,CPP,C">
<compiler name="MSVC">
<path>K:\msvc\MSVC</path>
<compileCmd>$compilerPath$/bin/cl.exe /O2 /Fo"$objFile$" /Fe"$exeFile$" /I $compilerPath$\include /EHsc "$sourceFile$" /link /LIBPATH:"$compilerPath$\lib" </compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd></linkCmd>
<!-- <linkCmd>$compilerPath$/bin/link.exe /OUT:"$exeFile$" "$objFile$" /LIBPATH:"$compilerPath$\lib"</linkCmd> -->
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>$exeFile$</runCmd>
</compiler>
<compiler name="MinGW"> <compiler name="MinGW">
<path>K:\Dev-Cpp\MinGW64\bin</path> <path>K:\Dev-Cpp\MinGW64\bin</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd> <compileCmd>"$compilerPath$\g++" -Wall -g -c -std=c++1y "$sourceFile$" -o "$objFile$"</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o--> <!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd> <linkCmd>$compilerPath$\g++ "$objFile$" "$exeFile$" -o -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1--> <!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>"$exeFile$"</runCmd> <runCmd>$exeFile$</runCmd>
</compiler>
<compiler name="MSVC">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>msvc</runCmd>
</compiler> </compiler>
</language> </language>
<language id="Java" alias="java,JAVA"> <language id="Java" alias="java,JAVA">
<compiler name="JDK8"> <compiler name="JDK8">
<path>C:/JDK8/bin</path> <path>C:\Program Files\Java\jdk1.8.0_121\bin</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd> <compileCmd>"$compilerPath$/javac" $sourceFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>"$compilerPath$ java -cp $sourceFile$\output\$exeFile$"</runCmd>
</compiler>
<compiler name="JDK9">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>
</runCmd>
</compiler>
</language>
<language id="Python" alias="python,PYTHON">
<compiler name="Python2">
<path>C:/MinGW/bin/</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o-->
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd> <linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1--> <!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>$exeFile$</runCmd> <runCmd>$exeFile$</runCmd>
</compiler> </compiler>
</language>
<language id="Python" alias="python,PYTHON,py,PY">
<compiler name="Python3"> <compiler name="Python3">
<path>C:/MinGW/bin/</path> <path>F:\裁判机\python3.12</path>
<compileCmd>g++.exe -Wall -g -std=c++14 -c $sourceFile$ -o $objFile$</compileCmd> <compileCmd> </compileCmd>
<!-- g++.exe -Wall -g -std=c++14 -c D:\prog_old\test\main.cpp -o obj\Debug\main.o--> <linkCmd> </linkCmd>
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd> <runCmd>$compilerPath$/python "$sourceFile$"</runCmd>
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
<runCmd>
</runCmd>
</compiler> </compiler>
</language> </language>
<!-- sourceFile-->
<!-- objFile-->
<!-- exeFile-->
<language id="VB" />
</languages> </languages>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -157,22 +157,43 @@ public class JudgeFromQueue extends Thread {
String problem = (String) problemsCachManager String problem = (String) problemsCachManager
.getObject("problemId" + problemId); .getObject("problemId" + problemId);
if (problem == null) { if (problem == null) {
problem = Control.getWebService().getProblem(Integer.parseInt(problemId)); try{
problemsCachManager.putObject("problemId" + problemId, problem = Control.getWebService().getProblem(Integer.parseInt(problemId));
problemsCachManager.putObject("problemId" + problemId,
problem); problem);
}catch(Exception e){
Result.status = Const.SE;
CompileInfo.remark = "获取题目信息失败!请联系管理人员。错误信息:"+e.getMessage();
e.printStackTrace();
EventQueue.invokeLater(() -> {
Control.addExceptionInfo(threadNo, e.toString());
});
}
} }
if(problem.isEmpty()){ if(problem.isEmpty()){
Result.status = Const.CE; Result.status = Const.CE;
CompileInfo.remark = "»ñÈ¡ÌâÄ¿ÐÅϢʧ°Ü£¡"; CompileInfo.remark = "»ñÈ¡ÌâÄ¿ÐÅϢʧ°Ü£¡";
return; return;
} }
// System.out.println(Integer.parseInt(problemId)); // System.out.println(Integer.parseInt(problemId));
// System.out.println(xml); // System.out.println(xml);
xtp.readXmlString(problem); try{
problemBean = xtp.convertXML(); xtp.readXmlString(problem);
Control.addJudgeInfo(threadNo, "get problemId: " + problemId); problemBean = xtp.convertXML();
problemBeanMap.put(problemId, problemBean); Control.addJudgeInfo(threadNo, "get problemId: " + problemId);
problemBeanMap.put(problemId, problemBean);
}catch(Exception e){
Result.status = Const.SE;
CompileInfo.remark = "解析题目信息失败!请联系管理人员。错误信息:"+"problemId:"+problemId+e.getMessage();
e.printStackTrace();
EventQueue.invokeLater(() -> {
Control.addExceptionInfo(threadNo, e.toString());
});
}
} }
// //
@ -219,6 +240,9 @@ public class JudgeFromQueue extends Thread {
Control.addJudgeInfo(threadNo, "server result:" + req.getRspMsg()); Control.addJudgeInfo(threadNo, "server result:" + req.getRspMsg());
// Control.addJudgeInfo("ok"); // Control.addJudgeInfo("ok");
} catch (Exception e) { } catch (Exception e) {
EventQueue.invokeLater(() -> {
Control.addExceptionInfo(threadNo, e.toString());
});
e.printStackTrace(); e.printStackTrace();
} }

View File

@ -97,11 +97,29 @@ public class MainForNet extends Thread {
private List<Solution> getWebServiceSolutions() throws Exception { private List<Solution> getWebServiceSolutions() throws Exception {
Control.setWebService(new Webservice(new URL(Control.getUrl()), Control.getQname())); Control.setWebService(new Webservice(new URL(Control.getUrl()), Control.getQname()));
String xml = Control.getWebService().getSolutions(5); String xml = null;
try{
xml=Control.getWebService().getSolutions(5);
}
catch(Exception ex){
ex.printStackTrace();
EventQueue.invokeLater(() -> {
Control.addExceptionInfo(0, ex.getStackTrace().toString());
});
}
XmlToSolution xts = new XmlToSolution(); XmlToSolution xts = new XmlToSolution();
xts.readXmlString(xml); xts.readXmlString(xml);
this.solutions = xts.convertXML();
try{
this.solutions = xts.convertXML();
}
catch(Exception ex){
ex.printStackTrace();
EventQueue.invokeLater(() -> {
Control.addExceptionInfo(0, ex.getStackTrace().toString());
});
}
// Control.addJudgeInfo(" get "+solutions.getSolution().size()+" solutioins "); // Control.addJudgeInfo(" get "+solutions.getSolution().size()+" solutioins ");
if (solutions.getSolution().size() != 0) { if (solutions.getSolution().size() != 0) {
//System.out.println("get " + solutions.getSolution().size() + " solution"); //System.out.println("get " + solutions.getSolution().size() + " solution");

View File

@ -79,7 +79,7 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jSeparator2" alignment="0" max="32767" attributes="0"/> <Component id="jSeparator2" alignment="0" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
@ -103,20 +103,11 @@
<Component id="jLabel7" min="-2" max="-2" attributes="0"/> <Component id="jLabel7" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jComboBox1" min="-2" pref="32" max="-2" attributes="0"/> <Component id="jComboBox1" min="-2" pref="32" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="button_StartThread" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="jButton2" min="-2" max="-2" attributes="0"/> <Component id="jButton2" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace min="-2" pref="353" max="-2" attributes="0"/>
<Component id="jLabel8" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="comboCppCompiler" min="-2" pref="110" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="9" max="-2" attributes="0"/>
<Component id="jLabel10" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="comboJavaCompiler" min="-2" pref="110" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="jLabel3" min="-2" max="-2" attributes="0"/> <Component id="jLabel3" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/> <EmptySpace max="32767" attributes="0"/>
<Component id="distributorIP" min="-2" pref="173" max="-2" attributes="0"/> <Component id="distributorIP" min="-2" pref="173" max="-2" attributes="0"/>
@ -126,17 +117,24 @@
<Component id="distributorPort" min="-2" pref="106" max="-2" attributes="0"/> <Component id="distributorPort" min="-2" pref="106" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="jCheckBox2" min="-2" pref="66" max="-2" attributes="0"/> <Component id="jCheckBox2" min="-2" pref="66" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="comboCppCompiler" min="-2" pref="0" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="comboJavaCompiler" min="-2" pref="0" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="83" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="threadManagerTabb" min="-2" pref="955" max="-2" attributes="0"/> <Group type="103" groupAlignment="1" attributes="0">
<EmptySpace min="-2" pref="28" max="-2" attributes="0"/> <Component id="button_StartThread" min="-2" max="-2" attributes="0"/>
<Component id="threadManagerTabb" min="-2" pref="945" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/> <Component id="jSeparator1" pref="1" max="32767" attributes="0"/>
<Component id="jSeparator1" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -144,21 +142,15 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Group type="103" groupAlignment="3" attributes="0"> <Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="comboCppCompiler" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="comboJavaCompiler" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboCppCompiler" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="distributorPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="comboJavaCompiler" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="distributorIP" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="1" groupAlignment="3" attributes="0"> <Component id="jCheckBox2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel4" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="distributorPort" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="distributorIP" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="jCheckBox2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
</Group> </Group>
<EmptySpace min="-2" max="-2" attributes="0"/> <EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jSeparator2" min="-2" pref="2" max="-2" attributes="0"/> <Component id="jSeparator2" min="-2" pref="2" max="-2" attributes="0"/>
@ -300,22 +292,19 @@
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Component id="jScrollPane7" alignment="0" min="-2" pref="379" max="-2" attributes="0"/> <Group type="102" attributes="0">
<Component id="jLabel15" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="jScrollPane11" pref="545" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jLabel15" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="0" attributes="0"> <Component id="jScrollPane7" min="-2" pref="389" max="-2" attributes="0"/>
<Component id="jLabel16" min="-2" max="-2" attributes="0"/>
<EmptySpace min="35" pref="501" max="32767" attributes="0"/>
</Group>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="jLabel16" min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane11" min="-2" pref="542" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -404,7 +393,7 @@
<Component id="jLabel9" min="-2" max="-2" attributes="0"/> <Component id="jLabel9" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/> <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group> </Group>
<Component id="jScrollPane12" pref="545" max="32767" attributes="0"/> <Component id="jScrollPane12" pref="535" max="32767" attributes="0"/>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -529,14 +518,6 @@
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/> <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues> </AuxValues>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel8">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x9ed8;&#x8ba4;C/C++&#x7f16;&#x8bd1;&#x5668;:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboCppCompiler"> <Component class="javax.swing.JComboBox" name="comboCppCompiler">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
@ -553,14 +534,6 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboCppCompilerActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="comboCppCompilerActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="jLabel10">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
<Font name="&#x5b8b;&#x4f53;" size="10" style="0"/>
</Property>
<Property name="text" type="java.lang.String" value="&#x9ed8;&#x8ba4;Java&#x7f16;&#x8bd1;&#x5668;:"/>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="comboJavaCompiler"> <Component class="javax.swing.JComboBox" name="comboJavaCompiler">
<Properties> <Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor"> <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">

View File

@ -127,9 +127,7 @@ public class MainFrame extends javax.swing.JFrame {
jLabel17 = new javax.swing.JLabel(); jLabel17 = new javax.swing.JLabel();
jButton1 = new javax.swing.JButton(); jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
comboCppCompiler = new javax.swing.JComboBox(); comboCppCompiler = new javax.swing.JComboBox();
jLabel10 = new javax.swing.JLabel();
comboJavaCompiler = new javax.swing.JComboBox(); comboJavaCompiler = new javax.swing.JComboBox();
jCheckBox2 = new javax.swing.JCheckBox(); jCheckBox2 = new javax.swing.JCheckBox();
@ -176,18 +174,16 @@ public class MainFrame extends javax.swing.JFrame {
jPanel7Layout.setHorizontalGroup( jPanel7Layout.setHorizontalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup() .addGroup(jPanel7Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 379, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabel15)) .addContainerGap()
.addComponent(jLabel15))
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel7Layout.createSequentialGroup() .addComponent(jLabel16)
.addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE) .addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 542, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap()) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel7Layout.createSequentialGroup()
.addComponent(jLabel16)
.addGap(35, 501, Short.MAX_VALUE))))
); );
jPanel7Layout.setVerticalGroup( jPanel7Layout.setVerticalGroup(
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -226,7 +222,7 @@ public class MainFrame extends javax.swing.JFrame {
.addGroup(jPanel6Layout.createSequentialGroup() .addGroup(jPanel6Layout.createSequentialGroup()
.addComponent(jLabel9) .addComponent(jLabel9)
.addGap(0, 0, Short.MAX_VALUE)) .addGap(0, 0, Short.MAX_VALUE))
.addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE)) .addComponent(jScrollPane12, javax.swing.GroupLayout.DEFAULT_SIZE, 535, Short.MAX_VALUE))
.addContainerGap()) .addContainerGap())
); );
jPanel6Layout.setVerticalGroup( jPanel6Layout.setVerticalGroup(
@ -283,9 +279,6 @@ public class MainFrame extends javax.swing.JFrame {
} }
}); });
jLabel8.setFont(new java.awt.Font("宋体", 0, 10)); // NOI18N
jLabel8.setText("默认C/C++编译器:");
comboCppCompiler.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); comboCppCompiler.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
comboCppCompiler.addItemListener(new java.awt.event.ItemListener() { comboCppCompiler.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) { public void itemStateChanged(java.awt.event.ItemEvent evt) {
@ -298,9 +291,6 @@ public class MainFrame extends javax.swing.JFrame {
} }
}); });
jLabel10.setFont(new java.awt.Font("宋体", 0, 10)); // NOI18N
jLabel10.setText("默认Java编译器:");
comboJavaCompiler.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); comboJavaCompiler.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
comboJavaCompiler.addItemListener(new java.awt.event.ItemListener() { comboJavaCompiler.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) { public void itemStateChanged(java.awt.event.ItemEvent evt) {
@ -330,7 +320,7 @@ public class MainFrame extends javax.swing.JFrame {
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jSeparator2) .addComponent(jSeparator2)
.addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -354,19 +344,10 @@ public class MainFrame extends javax.swing.JFrame {
.addComponent(jLabel7) .addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 0, Short.MAX_VALUE))
.addComponent(button_StartThread))
.addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(jButton2) .addComponent(jButton2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGap(353, 353, 353)
.addComponent(jLabel8)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(comboCppCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(9, 9, 9)
.addComponent(jLabel10)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(comboJavaCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3) .addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(distributorIP, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(distributorIP, javax.swing.GroupLayout.PREFERRED_SIZE, 173, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -376,30 +357,32 @@ public class MainFrame extends javax.swing.JFrame {
.addComponent(distributorPort, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(distributorPort, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jCheckBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(36, 36, 36)))) .addGap(18, 18, 18)
.addComponent(comboCppCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(comboJavaCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(83, 83, 83)))
.addGap(21, 21, 21))
.addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(threadManagerTabb, javax.swing.GroupLayout.PREFERRED_SIZE, 955, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGap(28, 28, 28))) .addComponent(button_StartThread)
.addGap(21, 21, 21) .addComponent(threadManagerTabb, javax.swing.GroupLayout.PREFERRED_SIZE, 945, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jSeparator1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
.addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 1, Short.MAX_VALUE))
); );
jPanel2Layout.setVerticalGroup( jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup() .addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap() .addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton2)
.addComponent(jButton2) .addComponent(comboCppCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8) .addComponent(comboJavaCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboCppCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)
.addComponent(jLabel10) .addComponent(distributorPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(comboJavaCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(distributorIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3)
.addComponent(jLabel4) .addComponent(jCheckBox2))
.addComponent(distributorPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(distributorIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel3)
.addComponent(jCheckBox2)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
@ -512,25 +495,25 @@ public class MainFrame extends javax.swing.JFrame {
} }
}//GEN-LAST:event_jLabel17MouseClicked }//GEN-LAST:event_jLabel17MouseClicked
private boolean checkForCompile() { private boolean checkForCompile() {
String tmp = null; //String tmp = null;
tmp = Config.getCompilerDir("c",comboCppCompiler.getSelectedItem().toString()); //tmp = Config.getCompilerDir("c",comboCppCompiler.getSelectedItem().toString());
if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "gcc.exe")&&!FileFinder.isExistFile(tmp + File.separator + "g++.exe")&&!FileFinder.isExistFile(tmp + File.separator + "/bin/cl.exe")) { //if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "gcc.exe")&&!FileFinder.isExistFile(tmp + File.separator + "g++.exe")&&!FileFinder.isExistFile(tmp + File.separator + "/bin/cl.exe")) {
//µ¯´°ÉèÖñ£´æ //µ¯´°ÉèÖñ£´æ
JOptionPane.showMessageDialog(this, "请先配置C/C++编译器"); // JOptionPane.showMessageDialog(this, "请先配置C/C++编译器");
// NewCompileSetting window = new NewCompileSetting("c", this, true); // NewCompileSetting window = new NewCompileSetting("c", this, true);
// window.setVisible(true); // window.setVisible(true);
return false; // return false;
} //}
tmp = Config.getCompilerDir("java",comboJavaCompiler.getSelectedItem().toString()); // tmp = Config.getCompilerDir("java",comboJavaCompiler.getSelectedItem().toString());
if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "javac.exe")) { //if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "javac.exe")) {
JOptionPane.showMessageDialog(this, "请先配置Java编译器"); // JOptionPane.showMessageDialog(this, "请先配置Java编译器");
// NewCompileSetting window = new NewCompileSetting("java", this, true); // NewCompileSetting window = new NewCompileSetting("java", this, true);
// window.setVisible(true); // window.setVisible(true);
return false; // return false;
} //}
return true; return true;
} }
public String getSelectedCppCompilerName(){ public String getSelectedCppCompilerName(){
@ -684,7 +667,6 @@ public class MainFrame extends javax.swing.JFrame {
private javax.swing.JCheckBox jCheckBox1; private javax.swing.JCheckBox jCheckBox1;
private javax.swing.JCheckBox jCheckBox2; private javax.swing.JCheckBox jCheckBox2;
javax.swing.JComboBox<String> jComboBox1; javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel10;
javax.swing.JLabel jLabel14; javax.swing.JLabel jLabel14;
private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel15;
private javax.swing.JLabel jLabel16; private javax.swing.JLabel jLabel16;
@ -695,7 +677,6 @@ public class MainFrame extends javax.swing.JFrame {
private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JLabel jLabel9; private javax.swing.JLabel jLabel9;
private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel1;
public javax.swing.JPanel jPanel2; public javax.swing.JPanel jPanel2;

View File

@ -5,6 +5,9 @@
*/ */
package swingworker; package swingworker;
import common.Const;
import gui.Control;
import java.awt.EventQueue;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.function.Consumer; import java.util.function.Consumer;
@ -12,6 +15,8 @@ import javax.swing.SwingWorker;
import main.Answer; import main.Answer;
import main.Process; import main.Process;
import persistence.oj_beans.ProblemTestCaseBean; import persistence.oj_beans.ProblemTestCaseBean;
import resultData.CompileInfo;
import resultData.Result;
/** /**
* *
@ -44,7 +49,9 @@ public class MySwingWorker extends SwingWorker<Answer,String>{
@Override @Override
protected Answer doInBackground() throws Exception { protected Answer doInBackground() throws Exception {
return new Process().Judge(getSolutionId(),getProblemId(),getLanguage(),getCompiler(), getSourceCode(), timeOut, getTestCaseList(),this::writeToGui);
return new Process().Judge(getSolutionId(),getProblemId(),getLanguage(),getCompiler(), getSourceCode(), timeOut, getTestCaseList(),this::writeToGui);
} }
public void writeToGui(String s){ public void writeToGui(String s){

View File

@ -13,6 +13,7 @@ import edu.dhu.ws.OJWS;
import edu.dhu.ws.OJWS_Service; import edu.dhu.ws.OJWS_Service;
import static gui.Control.getDistributorField; import static gui.Control.getDistributorField;
import static gui.Control.getJudgeInfoEditorPane; import static gui.Control.getJudgeInfoEditorPane;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException; import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.rmi.RemoteException; import java.rmi.RemoteException;
@ -26,6 +27,7 @@ import javax.swing.JTextField;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService; import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.boot.logging.LogLevel;
/** /**
* *
* @author ytxlo * @author ytxlo
@ -34,7 +36,7 @@ import org.apache.dubbo.config.annotation.DubboService;
public class Webservice implements java.rmi.Remote{ public class Webservice implements java.rmi.Remote{
private OJWS_Service webs; private OJWS_Service webs;
private OJWS servicePort; private OJWS servicePort;
public static boolean ENABLE_DUBBO=false; public static boolean ENABLE_DUBBO=true;
public static boolean existDubbo=false; public static boolean existDubbo=false;
//@DubboReference(url = "http://106.15.36.190:3000/edu.dhu.ws.OJWS") //@DubboReference(url = "http://106.15.36.190:3000/edu.dhu.ws.OJWS")
//http://106.15.36.190:3000/edu.dhu.ws.OJWS //http://106.15.36.190:3000/edu.dhu.ws.OJWS
@ -45,6 +47,7 @@ public class Webservice implements java.rmi.Remote{
//@DubboReference(url = "dubbo://10.10.10.1:20880/edu.dhu.ws.OJWS") //@DubboReference(url = "dubbo://10.10.10.1:20880/edu.dhu.ws.OJWS")
//@Resource //@Resource
public OJWS dubboPort; public OJWS dubboPort;
common.Logger logger;
public static OJWS initDubboPort(String url) { public static OJWS initDubboPort(String url) {
// 应用配置 // 应用配置
ApplicationConfig application = new ApplicationConfig(); ApplicationConfig application = new ApplicationConfig();
@ -60,7 +63,7 @@ public class Webservice implements java.rmi.Remote{
return reference.get(); return reference.get();
} }
private void setDubbo(){ private void setDubbo(){
logger = common.Logger.getInstance();
String url = "dubbo://localhost:8080/edu.dhu.ws.OJWS"; String url = "dubbo://localhost:8080/edu.dhu.ws.OJWS";
JTextField ip=getDistributorField(0); JTextField ip=getDistributorField(0);
JTextField port=getDistributorField(1); JTextField port=getDistributorField(1);
@ -69,16 +72,17 @@ public class Webservice implements java.rmi.Remote{
try try
{ {
JEditorPane infoPane=getJudgeInfoEditorPane(0); JEditorPane infoPane=getJudgeInfoEditorPane(0);
if(!existDubbo&&infoPane!=null) if(!existDubbo&&infoPane!=null){
infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"正在请求Dubbo服务...\n"); infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"正在请求Dubbo服务...\n");
logger.log("ÇëÇódubbo·þÎñ", common.LogLevel.INFO);
}
dubboPort = initDubboPort(url); dubboPort = initDubboPort(url);
//infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"测试test请求..."+dubboPort.test("aa")+"\n"); //infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"测试test请求..."+dubboPort.test("aa")+"\n");
} }
catch(Exception e){ catch(Exception e){
JEditorPane infoPane=getJudgeInfoEditorPane(1); JEditorPane infoPane=getJudgeInfoEditorPane(1);
infoPane.setText(infoPane.getText()+LocalTime.now().toString()+e.getMessage()+"\n"); infoPane.setText(infoPane.getText()+"\n"+LocalTime.now().toString()+e.getMessage()+"\n");
e.printStackTrace(); e.printStackTrace();
} }
if(dubboPort!=null){ if(dubboPort!=null){
@ -90,6 +94,7 @@ public class Webservice implements java.rmi.Remote{
}else{ }else{
existDubbo=false; existDubbo=false;
JEditorPane infoPane=getJudgeInfoEditorPane(1); JEditorPane infoPane=getJudgeInfoEditorPane(1);
logger.log("ÇëÇódubbo·þÎñʧ°Ü", common.LogLevel.ERROR);
infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"\nDubbo服务连接失败URL:"+url+"\n"); infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"\nDubbo服务连接失败URL:"+url+"\n");
} }
@ -110,6 +115,7 @@ public class Webservice implements java.rmi.Remote{
servicePort = webs.getOJWSImplPort(); servicePort = webs.getOJWSImplPort();
} }
catch(Exception e){ catch(Exception e){
logger.log(e.getMessage(), common.LogLevel.ERROR);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -138,20 +144,56 @@ public class Webservice implements java.rmi.Remote{
setDubbo(); setDubbo();
} }
public String getSolutions(int arg0)throws java.rmi.RemoteException{ public String getSolutions(int arg0)throws java.rmi.RemoteException{
String s =this.servicePort.wsGetSolutions("judge","judge123",arg0); try{
String s =this.servicePort.wsGetSolutions("judge","judge123",arg0);
return s; return s;
}
catch(Exception e){
logger.log(e.getMessage(), common.LogLevel.ERROR);
JEditorPane infoPane=getJudgeInfoEditorPane(1);
infoPane.setText(infoPane.getText()+LocalTime.now().toString()+e.getMessage()+"\n");
return "";
}
} }
public String getProblem(int arg)throws java.rmi.RemoteException{ public String getProblem(int arg)throws java.rmi.RemoteException{
// servicePort.wsGetProblem(arg0, arg1, arg, arg) // servicePort.wsGetProblem(arg0, arg1, arg, arg)
byte[] soucre = this.servicePort.wsGetProblem4Judge("felix", "felix", arg); try{
String result = Decrypt.decrypt("felix10000", soucre); byte[] soucre = this.servicePort.wsGetProblem4Judge("felix", "felix", arg);
//String prob = result.replaceFirst("GBK", "UTF-8"); String result = Decrypt.decrypt("felix10000", soucre);
return result; //String prob = result.replaceFirst("GBK", "UTF-8");
return result;
}
catch(Exception e){
logger.log(e.getMessage(), common.LogLevel.ERROR);
JEditorPane infoPane=getJudgeInfoEditorPane(1);
infoPane.setText(infoPane.getText()+LocalTime.now().toString()+e.getMessage()+"\n");
return "";
}
} }
public String updateResult(String arg)throws java.rmi.RemoteException{ public String updateResult(String arg)throws java.rmi.RemoteException{
try{
byte[] data=Decrypt.encrypt("judge123", arg); byte[] data=Decrypt.encrypt("judge123", arg);
String s = servicePort.wsUpdateResult("judge","judge123",data); String s = servicePort.wsUpdateResult("judge","judge123",data);
return s; return s;
}
catch(Exception e){
logger.log(e.getMessage(), common.LogLevel.ERROR);
JEditorPane infoPane=getJudgeInfoEditorPane(1);
infoPane.setText(infoPane.getText()+LocalTime.now().toString()+e.getMessage()+"\n");
return "";
}
}
private static String getGbkString(String string) {
try {
// Convert the string to byte array using GBK encoding
byte[] gbkBytes = string.getBytes("GBK");
// Create a new string from the byte array using GBK encoding
return new String(gbkBytes, "GBK");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
return string;
}
} }
public static void main(String[] args) { public static void main(String[] args) {
Webservice ws=new Webservice(); Webservice ws=new Webservice();
@ -160,6 +202,7 @@ public class Webservice implements java.rmi.Remote{
System.out.println(ws.getProblem(75)); System.out.println(ws.getProblem(75));
} catch (RemoteException ex) { } catch (RemoteException ex) {
Logger.getLogger(Webservice.class.getName()).log(Level.SEVERE, null, ex); Logger.getLogger(Webservice.class.getName()).log(Level.SEVERE, null, ex);
} }
} }
} }

View File

@ -18,6 +18,7 @@ import resultData.Result;
import tool.ThreadTool; import tool.ThreadTool;
import com.sun.jna.Library; import com.sun.jna.Library;
import com.sun.jna.Native; import com.sun.jna.Native;
import java.awt.EventQueue;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import resultData.JudgerInfo; import resultData.JudgerInfo;
@ -152,14 +153,14 @@ public class ExeCommand {
RunInfo.remark = JudgerInfo.remark; RunInfo.remark = JudgerInfo.remark;
} }
else if (flag) { else if (flag) {
RunInfo.remark = "运行时错误" + RunInfo.errorInfo; RunInfo.remark = "运行时错误";
Result.status = Const.RE; Result.status = Const.RE;
} else if (RunInfo.isKilled == 1) { } else if (RunInfo.isKilled == 1) {
Result.status = Const.TLE; Result.status = Const.TLE;
RunInfo.remark = "ÔËÐг¬Ê±" + RunInfo.errorInfo; RunInfo.remark = "ÔËÐг¬Ê±" + RunInfo.errorInfo;
} else if (result != 0) { } else if (result != 0) {
Result.status = Const.RE; Result.status = Const.RE;
RunInfo.remark = "运行时错误:出口值不为零" + RunInfo.errorInfo; RunInfo.remark = "运行时错误:出口值不为零";
} }
if (result == 0) { if (result == 0) {
RunInfo.remark = ""; RunInfo.remark = "";
@ -229,7 +230,7 @@ public class ExeCommand {
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
Result.status = Const.SE; Result.status = Const.SE;
JudgerInfo.remark = "系统出错,请重试"; JudgerInfo.remark = "系统出错,请重试"+ex.getMessage();
Log.writeExceptionLog("compileCommand line:3:" + ex.getMessage() + "\n" + ex.getStackTrace()); Log.writeExceptionLog("compileCommand line:3:" + ex.getMessage() + "\n" + ex.getStackTrace());
return -1; return -1;
} finally { } finally {

View File

@ -56,6 +56,7 @@ public class Judger {
// if (!file1.exists() || !file2.exists()) { // if (!file1.exists() || !file2.exists()) {
// System.out.println("±àÒëÆ÷δÕÒµ½"); // System.out.println("±àÒëÆ÷δÕÒµ½");
// isFound = false; // isFound = false;
// } // }
// } // }
@ -121,7 +122,7 @@ public class Judger {
else else
map.put(LangSelector.PlaceHolder.ObjFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.obj"); map.put(LangSelector.PlaceHolder.ObjFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.obj");
map.put(LangSelector.PlaceHolder.ExeFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.exe"); map.put(LangSelector.PlaceHolder.ExeFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.exe");
String linkCommand = LangSelector.matchPlaceHolder(LangSelector.getCompileCommand("C++",compiler), map); String linkCommand = LangSelector.matchPlaceHolder(LangSelector.getCompileCommand(language,compiler), map);
//String linkCommand = Config.getCompilerDir(language) + File.separator + "g++ " +"\""+ Config.getTargetPath() +File.separator+"output"+File.separator+ "Main"+".o"+"\"" + " -o " +"\""+ Config.getTargetPath()+File.separator+"output"+File.separator + "Main"+".exe"+"\"\n"; //String linkCommand = Config.getCompilerDir(language) + File.separator + "g++ " +"\""+ Config.getTargetPath() +File.separator+"output"+File.separator+ "Main"+".o"+"\"" + " -o " +"\""+ Config.getTargetPath()+File.separator+"output"+File.separator + "Main"+".exe"+"\"\n";
return linkCommand; return linkCommand;
} }
@ -134,13 +135,6 @@ public class Judger {
compiler=LangSelector.getDefaultCompilerName(language); compiler=LangSelector.getDefaultCompilerName(language);
} }
language = language.toLowerCase();//todo language = language.toLowerCase();//todo
if (language.equals("c")) {
compileCommand += "\"" + Config.getCompilerDir(language,compiler) + File.separator + "gcc\" -c " + "\""+sourceFile +"\""+ " -o " +"\""+Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main"+".o"+"\"\n";
} else if (language.equals("java")) {
compileCommand += "\"" + Config.getCompilerDir(language,compiler) + File.separator + "javac\" " + sourceFile; //todo文件路径
} else if (language.equals("cpp")||language.equals("c++")) {
//compileCommand +=Config.getCompilerDir(language) + File.separator +LangSelector.getCompileCommand("C++",null);
HashMap<String,String>map=new HashMap<>(); HashMap<String,String>map=new HashMap<>();
map.put(LangSelector.PlaceHolder.CompilerPath.getStr(),Config.getCompilerDir(language,compiler)); map.put(LangSelector.PlaceHolder.CompilerPath.getStr(),Config.getCompilerDir(language,compiler));
@ -150,41 +144,38 @@ public class Judger {
else else
map.put(LangSelector.PlaceHolder.ObjFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.obj"); map.put(LangSelector.PlaceHolder.ObjFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.obj");
map.put(LangSelector.PlaceHolder.ExeFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.exe"); map.put(LangSelector.PlaceHolder.ExeFile.getStr(),Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main.exe");
compileCommand = LangSelector.matchPlaceHolder(LangSelector.getCompileCommand("C++",compiler), map); compileCommand = LangSelector.matchPlaceHolder(LangSelector.getCompileCommand(language,compiler), map);
//compileCommand += "\"" + Config.getCompilerDir(language) + File.separator + "g++\" -Wall -g -c -std=c++1y "//todo:C++14
// + "\""+sourceFile+"\"" + " -o " + "\""+Config.getTargetPath()+ File.separator+"output"+ File.separator + "Main"+".o"+"\"\n";
} else {
CompileInfo.info = "this programing language is not support!!!";
}
return compileCommand; return compileCommand;
} }
private String runCommand(String language,String compiler) { private String runCommand(String language,String compiler) {
String runCommand = ""; String runCommand = "";
if (language.equals("c")) { runCommand+=LangSelector.getRunCommand(language, compiler);//ÆäËûÓïÑÔ£¬ÈçPython
runCommand +="\""+ Config.getTargetPath()+ File.separator+"output"+File.separator + "Main"+"\""; HashMap<String,String>map=new HashMap<>();
if (language.equals("java")) {
String rawCmd= Config.getCompilerDir(language,compiler) + File.separator + "java"+ " -cp " + Config.getSourcePath()+ File.separator+"output"+File.separator+ " "+mainClassName; // TODO ÎļşÂ·¾ start
map.put(LangSelector.PlaceHolder.ExeFile.getStr(),rawCmd);
//System.err.println(runCommand);
} else if (language.equals("cpp")||language.equals("c++")||language.equals("c")) {
String rawCmd="\""+ Config.getTargetPath()+ File.separator+"output"+File.separator + "Main"+"\"";
map.put(LangSelector.PlaceHolder.ExeFile.getStr(),rawCmd);
}
else{
} else if (language.equals("java")) {
runCommand += Config.getCompilerDir(language,compiler) + File.separator + "java"+ " -cp " + Config.getSourcePath()+ File.separator+"output"+File.separator+ " "+mainClassName; // TODO 文件路径 start
//System.err.println(runCommand);
} else if (language.equals("cpp")||language.equals("c++")) {
runCommand += "\""+ Config.getTargetPath()+ File.separator+"output"+File.separator + "Main"+"\"";
} }
// System.out.println(runCommand); // System.out.println(runCommand);
map.put(LangSelector.PlaceHolder.CompilerPath.getStr(),Config.getCompilerDir(language,compiler));
map.put(LangSelector.PlaceHolder.SourceFile.getStr(),sourceFile);
runCommand=LangSelector.matchPlaceHolder(runCommand, map);
return runCommand; return runCommand;
} }
public int compile(String sourceCode, String language,String compiler) { public int compile(String sourceCode, String language,String compiler) {
int result = -1; int result = -1;
//检查语言是否在范围内
language = language.toLowerCase(); language = language.toLowerCase();
if (language.equals("c") || language.equals("cpp")|| language.equals("c++") || language.equals("java")) {
//ok
} else {
Result.status = Const.CE;
// CompileInfo.remark = "语言种类不符合要求";
return result;
}
try { try {
if (Shared.PID!=-1&&ThreadTool.findProcess(Shared.PID)) { //tore0 if (Shared.PID!=-1&&ThreadTool.findProcess(Shared.PID)) { //tore0
Runtime.getRuntime().exec("taskkill /f /t /PID "+Shared.PID).waitFor(); Runtime.getRuntime().exec("taskkill /f /t /PID "+Shared.PID).waitFor();
@ -199,7 +190,12 @@ public class Judger {
int repeatTime = 3; int repeatTime = 3;
String compileCom = compileCommand(language,compiler); String compileCom = compileCommand(language,compiler);
if(compileCom==null){
result=0;
return result;
}
for (int i = 0; i < repeatTime; i++) { for (int i = 0; i < repeatTime; i++) {
result = exe.exeCompile(compileCom,"Path="+Config.getCompilerDir(language,compiler)); result = exe.exeCompile(compileCom,"Path="+Config.getCompilerDir(language,compiler));
if (result == 0) { if (result == 0) {
if (language.equals("c") || language.equals("cpp")||language.equals("c++")) { if (language.equals("c") || language.equals("cpp")||language.equals("c++")) {

View File

@ -373,33 +373,53 @@ public class Process {
} }
solutionBean.setStatus(Const.STATUS[maxLevelStatus]); solutionBean.setStatus(Const.STATUS[maxLevelStatus]);
//最高等级错误相应的信息 //最高等级错误相应的信息
if (maxLevelStatus == Const.CE) {
solutionBean.setRemark(remarks[index]);
} else if (result[index] == Const.WA || result[index] == Const.PE) {
// solutionBean.setRemark(""); String message="";
String message = new String(); for (int i = 0; i < remarks.length; i++) {
for (int i = 0; i < remarks.length; i++) { message += "测试用例 " + testCaseBeans.get(i).getId() + "结果为 " + Const.STATUS[result[i]] + ":";
message += "测试用例 " + testCaseBeans.get(i).getId() + "结果为 " + Const.STATUS[result[i]] + ":"; message += remarks[i] + "\n";
message += remarks[i] + "\n";
}
solutionBean.setRemark(message);
} else {//RE,TLE
String wrongCaseIds = "";
for (int j = 0; j < sumTestcaseNum; j++) {
if (result[j] == result[index]) {
wrongCaseIds += ((ProblemTestCaseBean) testCaseBeans.get(j)).getId() + ",";
}
}
solutionBean.setRemark("测试用例ID为" + wrongCaseIds + remarks[index]);
String message = new String();
for (int i = 0; i < remarks.length; i++) {
message += "\n";
message += remarks[i];
}
solutionBean.setRemark(solutionBean.getRemark() + message);
} }
solutionBean.setRemark(message);
//old
// if (maxLevelStatus == Const.CE) {
// solutionBean.setRemark(remarks[index]);
// } else if (result[index] == Const.WA || result[index] == Const.PE) {
//// solutionBean.setRemark("");
// String message = new String();
// for (int i = 0; i < remarks.length; i++) {
// message += "测试用例 " + testCaseBeans.get(i).getId() + "结果为 " + Const.STATUS[result[i]] + ":";
// message += remarks[i] + "\n";
// }
// solutionBean.setRemark(message);
// } else {//RE,TLE
// String wrongCaseIds = "";
// for (int j = 0; j < sumTestcaseNum; j++) {
// if (result[j] == result[index]) {
// wrongCaseIds += ((ProblemTestCaseBean) testCaseBeans.get(j)).getId() + ",";
// }
// }
// solutionBean.setRemark("测试用例ID为" + wrongCaseIds + remarks[index]);
// String message = new String();
// for (int i = 0; i < remarks.length; i++) {
// message += "\n";
// message += remarks[i];
// }
// solutionBean.setRemark(solutionBean.getRemark() + message);
// }
} }
solutionBean.setCorrectCaseIds(correctCaseIds); solutionBean.setCorrectCaseIds(correctCaseIds);
//remark转为GBK字符串
String originalRemark=solutionBean.getRemark();
try{
solutionBean.setRemark(new String(solutionBean.getRemark().getBytes("GBK"),"GBK"));
}catch(Exception e){
solutionBean.setRemark(originalRemark);
}
//Jared
//SolutionDAO.update(solutionBean); //SolutionDAO.update(solutionBean);
} }
} }

1
config.xml Normal file
View File

@ -0,0 +1 @@
<?xml version="1.0" encoding="utf-8"?><languages/>