修复已知问题
This commit is contained in:
parent
9cc5d58731
commit
f515ccd590
|
|
@ -27,3 +27,4 @@ client/nbproject/private/private.properties
|
|||
*.class
|
||||
*.jar
|
||||
*.class
|
||||
*.class
|
||||
|
|
|
|||
|
|
@ -872,7 +872,7 @@
|
|||
</wsdl:binding>
|
||||
<wsdl:service name="OJWS">
|
||||
<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:service>
|
||||
</wsdl:definitions>
|
||||
|
|
@ -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://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="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>
|
||||
|
|
@ -1,63 +1,43 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<languages>
|
||||
<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">
|
||||
<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-->
|
||||
<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-->
|
||||
<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>
|
||||
<runCmd>$exeFile$</runCmd>
|
||||
</compiler>
|
||||
|
||||
|
||||
|
||||
</language>
|
||||
<language id="Java" alias="java,JAVA">
|
||||
<compiler name="JDK8">
|
||||
<path>C:/JDK8/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>"$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-->
|
||||
<path>C:\Program Files\Java\jdk1.8.0_121\bin</path>
|
||||
<compileCmd>"$compilerPath$/javac" $sourceFile$</compileCmd>
|
||||
|
||||
<linkCmd>g++.exe -o $exeFile$ $objFile$ -O1</linkCmd>
|
||||
<!-- g++.exe -o bin\Debug\test.exe obj\Debug\main.o -O1-->
|
||||
<runCmd>$exeFile$</runCmd>
|
||||
</compiler>
|
||||
</language>
|
||||
<language id="Python" alias="python,PYTHON,py,PY">
|
||||
<compiler name="Python3">
|
||||
<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>
|
||||
<path>F:\裁判机\python3.12</path>
|
||||
<compileCmd> </compileCmd>
|
||||
<linkCmd> </linkCmd>
|
||||
<runCmd>$compilerPath$/python "$sourceFile$"</runCmd>
|
||||
</compiler>
|
||||
</language>
|
||||
<!-- sourceFile-->
|
||||
<!-- objFile-->
|
||||
<!-- exeFile-->
|
||||
<language id="VB" />
|
||||
</languages>
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -157,22 +157,43 @@ public class JudgeFromQueue extends Thread {
|
|||
String problem = (String) problemsCachManager
|
||||
.getObject("problemId" + problemId);
|
||||
if (problem == null) {
|
||||
try{
|
||||
problem = Control.getWebService().getProblem(Integer.parseInt(problemId));
|
||||
problemsCachManager.putObject("problemId" + problemId,
|
||||
problem);
|
||||
}catch(Exception e){
|
||||
Result.status = Const.SE;
|
||||
CompileInfo.remark = "获取题目信息失败!请联系管理人员。错误信息:"+e.getMessage();
|
||||
e.printStackTrace();
|
||||
EventQueue.invokeLater(() -> {
|
||||
Control.addExceptionInfo(threadNo, e.toString());
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
if(problem.isEmpty()){
|
||||
Result.status = Const.CE;
|
||||
CompileInfo.remark = "»ñÈ¡ÌâÄ¿ÐÅϢʧ°Ü£¡";
|
||||
|
||||
return;
|
||||
}
|
||||
// System.out.println(Integer.parseInt(problemId));
|
||||
|
||||
// System.out.println(xml);
|
||||
try{
|
||||
xtp.readXmlString(problem);
|
||||
problemBean = xtp.convertXML();
|
||||
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("ok");
|
||||
} catch (Exception e) {
|
||||
EventQueue.invokeLater(() -> {
|
||||
Control.addExceptionInfo(threadNo, e.toString());
|
||||
});
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -97,11 +97,29 @@ public class MainForNet extends Thread {
|
|||
private List<Solution> getWebServiceSolutions() throws Exception {
|
||||
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();
|
||||
xts.readXmlString(xml);
|
||||
|
||||
|
||||
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 ");
|
||||
if (solutions.getSolution().size() != 0) {
|
||||
//System.out.println("get " + solutions.getSolution().size() + " solution");
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@
|
|||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jSeparator2" alignment="0" max="32767" 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">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
|
|
@ -103,20 +103,11 @@
|
|||
<Component id="jLabel7" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jComboBox1" min="-2" pref="32" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<Component id="button_StartThread" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jButton2" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" 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"/>
|
||||
<EmptySpace min="-2" pref="353" max="-2" attributes="0"/>
|
||||
<Component id="jLabel3" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" 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"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
<Component id="jCheckBox2" min="-2" pref="66" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="36" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
<Group type="102" attributes="0">
|
||||
<Component id="threadManagerTabb" min="-2" pref="955" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="28" 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>
|
||||
<EmptySpace min="-2" pref="21" max="-2" attributes="0"/>
|
||||
<Component id="jSeparator1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="1" 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>
|
||||
<Component id="jSeparator1" pref="1" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -144,22 +142,16 @@
|
|||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="103" groupAlignment="3" attributes="0">
|
||||
<Component id="jButton2" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel8" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboCppCompiler" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jLabel10" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
<Component id="comboJavaCompiler" alignment="3" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" alignment="1" groupAlignment="3" 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>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="jSeparator2" min="-2" pref="2" max="-2" attributes="0"/>
|
||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||
|
|
@ -300,22 +292,19 @@
|
|||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane7" alignment="0" min="-2" pref="379" max="-2" attributes="0"/>
|
||||
<Component id="jLabel15" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||
<Group type="102" attributes="0">
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="jLabel15" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane7" min="-2" pref="389" 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"/>
|
||||
</Group>
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="jLabel16" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="35" pref="501" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane11" min="-2" pref="542" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
|
|
@ -404,7 +393,7 @@
|
|||
<Component id="jLabel9" min="-2" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="jScrollPane12" pref="545" max="32767" attributes="0"/>
|
||||
<Component id="jScrollPane12" pref="535" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
</Group>
|
||||
|
|
@ -529,14 +518,6 @@
|
|||
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
|
||||
</AuxValues>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel8">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="宋体" size="10" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="默认C/C++编译器:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="comboCppCompiler">
|
||||
<Properties>
|
||||
<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"/>
|
||||
</Events>
|
||||
</Component>
|
||||
<Component class="javax.swing.JLabel" name="jLabel10">
|
||||
<Properties>
|
||||
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
|
||||
<Font name="宋体" size="10" style="0"/>
|
||||
</Property>
|
||||
<Property name="text" type="java.lang.String" value="默认Java编译器:"/>
|
||||
</Properties>
|
||||
</Component>
|
||||
<Component class="javax.swing.JComboBox" name="comboJavaCompiler">
|
||||
<Properties>
|
||||
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
|
||||
|
|
|
|||
|
|
@ -127,9 +127,7 @@ public class MainFrame extends javax.swing.JFrame {
|
|||
jLabel17 = new javax.swing.JLabel();
|
||||
jButton1 = new javax.swing.JButton();
|
||||
jButton2 = new javax.swing.JButton();
|
||||
jLabel8 = new javax.swing.JLabel();
|
||||
comboCppCompiler = new javax.swing.JComboBox();
|
||||
jLabel10 = new javax.swing.JLabel();
|
||||
comboJavaCompiler = new javax.swing.JComboBox();
|
||||
jCheckBox2 = new javax.swing.JCheckBox();
|
||||
|
||||
|
|
@ -176,18 +174,16 @@ public class MainFrame extends javax.swing.JFrame {
|
|||
jPanel7Layout.setHorizontalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 379, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jLabel15))
|
||||
.addComponent(jScrollPane7, javax.swing.GroupLayout.PREFERRED_SIZE, 389, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(jScrollPane11, javax.swing.GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE)
|
||||
.addContainerGap())
|
||||
.addGroup(jPanel7Layout.createSequentialGroup()
|
||||
.addComponent(jLabel16)
|
||||
.addGap(35, 501, Short.MAX_VALUE))))
|
||||
.addComponent(jScrollPane11, javax.swing.GroupLayout.PREFERRED_SIZE, 542, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel7Layout.setVerticalGroup(
|
||||
jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -226,7 +222,7 @@ public class MainFrame extends javax.swing.JFrame {
|
|||
.addGroup(jPanel6Layout.createSequentialGroup()
|
||||
.addComponent(jLabel9)
|
||||
.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())
|
||||
);
|
||||
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.addItemListener(new java.awt.event.ItemListener() {
|
||||
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.addItemListener(new java.awt.event.ItemListener() {
|
||||
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)
|
||||
.addComponent(jSeparator2)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
|
|
@ -354,19 +344,10 @@ public class MainFrame extends javax.swing.JFrame {
|
|||
.addComponent(jLabel7)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.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)
|
||||
.addComponent(button_StartThread))
|
||||
.addGap(0, 0, Short.MAX_VALUE))
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addComponent(jButton2)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.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)
|
||||
.addGap(353, 353, 353)
|
||||
.addComponent(jLabel3)
|
||||
.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)
|
||||
|
|
@ -376,30 +357,32 @@ public class MainFrame extends javax.swing.JFrame {
|
|||
.addComponent(distributorPort, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
.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()
|
||||
.addComponent(threadManagerTabb, javax.swing.GroupLayout.PREFERRED_SIZE, 955, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(28, 28, 28)))
|
||||
.addGap(21, 21, 21)
|
||||
.addComponent(jSeparator1))
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
|
||||
.addComponent(button_StartThread)
|
||||
.addComponent(threadManagerTabb, javax.swing.GroupLayout.PREFERRED_SIZE, 945, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.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.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||
.addComponent(jButton2)
|
||||
.addComponent(jLabel8)
|
||||
.addComponent(comboCppCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel10)
|
||||
.addComponent(comboJavaCompiler, 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(comboJavaCompiler, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel4)
|
||||
.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)))
|
||||
.addComponent(jCheckBox2))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||
|
|
@ -512,25 +495,25 @@ public class MainFrame extends javax.swing.JFrame {
|
|||
}
|
||||
}//GEN-LAST:event_jLabel17MouseClicked
|
||||
private boolean checkForCompile() {
|
||||
String tmp = null;
|
||||
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")) {
|
||||
//String tmp = null;
|
||||
//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")) {
|
||||
//µ¯´°ÉèÖñ£´æ
|
||||
|
||||
JOptionPane.showMessageDialog(this, "请先配置C/C++编译器");
|
||||
// JOptionPane.showMessageDialog(this, "请先配置C/C++编译器");
|
||||
// NewCompileSetting window = new NewCompileSetting("c", this, true);
|
||||
// window.setVisible(true);
|
||||
return false;
|
||||
}
|
||||
// return false;
|
||||
//}
|
||||
|
||||
tmp = Config.getCompilerDir("java",comboJavaCompiler.getSelectedItem().toString());
|
||||
if (tmp == null || "".equals(tmp) || !FileFinder.isExistFile(tmp + File.separator + "javac.exe")) {
|
||||
// tmp = Config.getCompilerDir("java",comboJavaCompiler.getSelectedItem().toString());
|
||||
//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);
|
||||
// window.setVisible(true);
|
||||
return false;
|
||||
}
|
||||
// return false;
|
||||
//}
|
||||
return true;
|
||||
}
|
||||
public String getSelectedCppCompilerName(){
|
||||
|
|
@ -684,7 +667,6 @@ public class MainFrame extends javax.swing.JFrame {
|
|||
private javax.swing.JCheckBox jCheckBox1;
|
||||
private javax.swing.JCheckBox jCheckBox2;
|
||||
javax.swing.JComboBox<String> jComboBox1;
|
||||
private javax.swing.JLabel jLabel10;
|
||||
javax.swing.JLabel jLabel14;
|
||||
private javax.swing.JLabel jLabel15;
|
||||
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 jLabel6;
|
||||
private javax.swing.JLabel jLabel7;
|
||||
private javax.swing.JLabel jLabel8;
|
||||
private javax.swing.JLabel jLabel9;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
public javax.swing.JPanel jPanel2;
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@
|
|||
*/
|
||||
package swingworker;
|
||||
|
||||
import common.Const;
|
||||
import gui.Control;
|
||||
import java.awt.EventQueue;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Consumer;
|
||||
|
|
@ -12,6 +15,8 @@ import javax.swing.SwingWorker;
|
|||
import main.Answer;
|
||||
import main.Process;
|
||||
import persistence.oj_beans.ProblemTestCaseBean;
|
||||
import resultData.CompileInfo;
|
||||
import resultData.Result;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
@ -44,7 +49,9 @@ public class MySwingWorker extends SwingWorker<Answer,String>{
|
|||
|
||||
@Override
|
||||
protected Answer doInBackground() throws Exception {
|
||||
|
||||
return new Process().Judge(getSolutionId(),getProblemId(),getLanguage(),getCompiler(), getSourceCode(), timeOut, getTestCaseList(),this::writeToGui);
|
||||
|
||||
}
|
||||
|
||||
public void writeToGui(String s){
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import edu.dhu.ws.OJWS;
|
|||
import edu.dhu.ws.OJWS_Service;
|
||||
import static gui.Control.getDistributorField;
|
||||
import static gui.Control.getJudgeInfoEditorPane;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.rmi.RemoteException;
|
||||
|
|
@ -26,6 +27,7 @@ import javax.swing.JTextField;
|
|||
import javax.xml.namespace.QName;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.boot.logging.LogLevel;
|
||||
/**
|
||||
*
|
||||
* @author ytxlo
|
||||
|
|
@ -34,7 +36,7 @@ import org.apache.dubbo.config.annotation.DubboService;
|
|||
public class Webservice implements java.rmi.Remote{
|
||||
private OJWS_Service webs;
|
||||
private OJWS servicePort;
|
||||
public static boolean ENABLE_DUBBO=false;
|
||||
public static boolean ENABLE_DUBBO=true;
|
||||
public static boolean existDubbo=false;
|
||||
//@DubboReference(url = "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")
|
||||
//@Resource
|
||||
public OJWS dubboPort;
|
||||
common.Logger logger;
|
||||
public static OJWS initDubboPort(String url) {
|
||||
// 应用配置
|
||||
ApplicationConfig application = new ApplicationConfig();
|
||||
|
|
@ -60,7 +63,7 @@ public class Webservice implements java.rmi.Remote{
|
|||
return reference.get();
|
||||
}
|
||||
private void setDubbo(){
|
||||
|
||||
logger = common.Logger.getInstance();
|
||||
String url = "dubbo://localhost:8080/edu.dhu.ws.OJWS";
|
||||
JTextField ip=getDistributorField(0);
|
||||
JTextField port=getDistributorField(1);
|
||||
|
|
@ -69,16 +72,17 @@ public class Webservice implements java.rmi.Remote{
|
|||
try
|
||||
{
|
||||
JEditorPane infoPane=getJudgeInfoEditorPane(0);
|
||||
if(!existDubbo&&infoPane!=null)
|
||||
if(!existDubbo&&infoPane!=null){
|
||||
infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"正在请求Dubbo服务...\n");
|
||||
|
||||
logger.log("ÇëÇódubbo·þÎñ", common.LogLevel.INFO);
|
||||
}
|
||||
dubboPort = initDubboPort(url);
|
||||
//infoPane.setText(infoPane.getText()+LocalTime.now().toString()+"测试test请求:..."+dubboPort.test("aa")+"\n");
|
||||
|
||||
}
|
||||
catch(Exception e){
|
||||
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();
|
||||
}
|
||||
if(dubboPort!=null){
|
||||
|
|
@ -90,6 +94,7 @@ public class Webservice implements java.rmi.Remote{
|
|||
}else{
|
||||
existDubbo=false;
|
||||
JEditorPane infoPane=getJudgeInfoEditorPane(1);
|
||||
logger.log("ÇëÇódubbo·þÎñʧ°Ü", common.LogLevel.ERROR);
|
||||
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();
|
||||
}
|
||||
catch(Exception e){
|
||||
logger.log(e.getMessage(), common.LogLevel.ERROR);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
|
@ -138,21 +144,57 @@ public class Webservice implements java.rmi.Remote{
|
|||
setDubbo();
|
||||
}
|
||||
public String getSolutions(int arg0)throws java.rmi.RemoteException{
|
||||
try{
|
||||
String s =this.servicePort.wsGetSolutions("judge","judge123",arg0);
|
||||
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{
|
||||
// servicePort.wsGetProblem(arg0, arg1, arg, arg)
|
||||
try{
|
||||
byte[] soucre = this.servicePort.wsGetProblem4Judge("felix", "felix", arg);
|
||||
String result = Decrypt.decrypt("felix10000", soucre);
|
||||
//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{
|
||||
try{
|
||||
byte[] data=Decrypt.encrypt("judge123", arg);
|
||||
String s = servicePort.wsUpdateResult("judge","judge123",data);
|
||||
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) {
|
||||
Webservice ws=new Webservice();
|
||||
|
||||
|
|
@ -160,6 +202,7 @@ public class Webservice implements java.rmi.Remote{
|
|||
System.out.println(ws.getProblem(75));
|
||||
} catch (RemoteException ex) {
|
||||
Logger.getLogger(Webservice.class.getName()).log(Level.SEVERE, null, ex);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ import resultData.Result;
|
|||
import tool.ThreadTool;
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import java.awt.EventQueue;
|
||||
import java.lang.reflect.Field;
|
||||
import resultData.JudgerInfo;
|
||||
|
||||
|
|
@ -152,14 +153,14 @@ public class ExeCommand {
|
|||
RunInfo.remark = JudgerInfo.remark;
|
||||
}
|
||||
else if (flag) {
|
||||
RunInfo.remark = "运行时错误" + RunInfo.errorInfo;
|
||||
RunInfo.remark = "运行时错误";
|
||||
Result.status = Const.RE;
|
||||
} else if (RunInfo.isKilled == 1) {
|
||||
Result.status = Const.TLE;
|
||||
RunInfo.remark = "ÔËÐг¬Ê±" + RunInfo.errorInfo;
|
||||
} else if (result != 0) {
|
||||
Result.status = Const.RE;
|
||||
RunInfo.remark = "运行时错误:出口值不为零" + RunInfo.errorInfo;
|
||||
RunInfo.remark = "运行时错误:出口值不为零";
|
||||
}
|
||||
if (result == 0) {
|
||||
RunInfo.remark = "";
|
||||
|
|
@ -229,7 +230,7 @@ public class ExeCommand {
|
|||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
Result.status = Const.SE;
|
||||
JudgerInfo.remark = "系统出错,请重试";
|
||||
JudgerInfo.remark = "系统出错,请重试"+ex.getMessage();
|
||||
Log.writeExceptionLog("compileCommand line:3:" + ex.getMessage() + "\n" + ex.getStackTrace());
|
||||
return -1;
|
||||
} finally {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ public class Judger {
|
|||
// if (!file1.exists() || !file2.exists()) {
|
||||
// System.out.println("±àÒëÆ÷δÕÒµ½");
|
||||
// isFound = false;
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
|
|
@ -121,7 +122,7 @@ public class Judger {
|
|||
else
|
||||
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");
|
||||
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";
|
||||
return linkCommand;
|
||||
}
|
||||
|
|
@ -134,13 +135,6 @@ public class Judger {
|
|||
compiler=LangSelector.getDefaultCompilerName(language);
|
||||
}
|
||||
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<>();
|
||||
map.put(LangSelector.PlaceHolder.CompilerPath.getStr(),Config.getCompilerDir(language,compiler));
|
||||
|
|
@ -150,41 +144,38 @@ public class Judger {
|
|||
else
|
||||
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");
|
||||
compileCommand = LangSelector.matchPlaceHolder(LangSelector.getCompileCommand("C++",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!!!";
|
||||
}
|
||||
compileCommand = LangSelector.matchPlaceHolder(LangSelector.getCompileCommand(language,compiler), map);
|
||||
return compileCommand;
|
||||
}
|
||||
|
||||
private String runCommand(String language,String compiler) {
|
||||
String runCommand = "";
|
||||
if (language.equals("c")) {
|
||||
runCommand +="\""+ Config.getTargetPath()+ File.separator+"output"+File.separator + "Main"+"\"";
|
||||
|
||||
} else if (language.equals("java")) {
|
||||
runCommand += Config.getCompilerDir(language,compiler) + File.separator + "java"+ " -cp " + Config.getSourcePath()+ File.separator+"output"+File.separator+ " "+mainClassName; // TODO 文件路径 start
|
||||
runCommand+=LangSelector.getRunCommand(language, compiler);//ÆäËûÓïÑÔ£¬ÈçPython
|
||||
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++")) {
|
||||
runCommand += "\""+ Config.getTargetPath()+ File.separator+"output"+File.separator + "Main"+"\"";
|
||||
} 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{
|
||||
|
||||
|
||||
}
|
||||
// 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;
|
||||
}
|
||||
|
||||
public int compile(String sourceCode, String language,String compiler) {
|
||||
int result = -1;
|
||||
//检查语言是否在范围内
|
||||
|
||||
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 {
|
||||
if (Shared.PID!=-1&&ThreadTool.findProcess(Shared.PID)) { //tore0
|
||||
Runtime.getRuntime().exec("taskkill /f /t /PID "+Shared.PID).waitFor();
|
||||
|
|
@ -199,7 +190,12 @@ public class Judger {
|
|||
|
||||
int repeatTime = 3;
|
||||
String compileCom = compileCommand(language,compiler);
|
||||
if(compileCom==null){
|
||||
result=0;
|
||||
return result;
|
||||
}
|
||||
for (int i = 0; i < repeatTime; i++) {
|
||||
|
||||
result = exe.exeCompile(compileCom,"Path="+Config.getCompilerDir(language,compiler));
|
||||
if (result == 0) {
|
||||
if (language.equals("c") || language.equals("cpp")||language.equals("c++")) {
|
||||
|
|
|
|||
|
|
@ -373,33 +373,53 @@ public class Process {
|
|||
}
|
||||
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 = new String();
|
||||
|
||||
|
||||
|
||||
String message="";
|
||||
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);
|
||||
}
|
||||
|
||||
//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);
|
||||
//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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><languages/>
|
||||
Loading…
Reference in New Issue