Adding some more traces and donginsome small fixes
This commit is contained in:
parent
35af69def3
commit
94c8b0dd72
5 changed files with 58 additions and 40 deletions
|
|
@ -125,6 +125,7 @@ public class CoderClient extends Application{
|
|||
this.selectServerDialog.addSelectProjectDialogListener(new SelectServerDialogListener() {
|
||||
@Override
|
||||
public void willShow() {
|
||||
logger.fine("about to show select server dialog on main stage");
|
||||
closeCurrentSession();
|
||||
selectServerDialog.clearServerList();
|
||||
if(ssdpClient != null){
|
||||
|
|
@ -162,7 +163,7 @@ public class CoderClient extends Application{
|
|||
this.loginDialog.addLoginDialogListener(new LoginDialogListener(){
|
||||
@Override
|
||||
public void willShow() {
|
||||
|
||||
logger.fine("about to show login dialog on main stage");
|
||||
}
|
||||
@Override
|
||||
public void cancel() {
|
||||
|
|
@ -179,30 +180,7 @@ public class CoderClient extends Application{
|
|||
loginDialog.setErrorMessage("Wrong username or password");
|
||||
selectServerDialog.showOnStage(mainStage);
|
||||
return;
|
||||
}else{
|
||||
// create a guard for when the session is closed
|
||||
new Thread(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
logger.fine("starting a session guard");
|
||||
while(true){
|
||||
if(session == null || !session.isConnected()){
|
||||
logger.fine("session guard: no connection");
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
selectServerDialog.setErrorMessage("The current session was disconnected");
|
||||
closeCurrentSession();
|
||||
selectServerDialog.showOnStage(mainStage);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
Thread.yield();
|
||||
}
|
||||
logger.fine("terminating session guard");
|
||||
}}).start();
|
||||
|
||||
}else{
|
||||
loginDialog.setErrorMessage("");
|
||||
setupSessionListener(); //resister a message listener to the session
|
||||
session.start(); //start receiving traffic from the server
|
||||
|
|
@ -224,6 +202,28 @@ public class CoderClient extends Application{
|
|||
logger.warning("Cannot setup session listeners for a non-authenticated session. ignoring call.");
|
||||
return;
|
||||
}
|
||||
// create a guard for when the session is closed
|
||||
new Thread(new Runnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
logger.fine("starting a session guard");
|
||||
while(true){
|
||||
if(session == null || !session.isConnected()){
|
||||
logger.fine("session guard: no connection");
|
||||
Platform.runLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
selectServerDialog.setErrorMessage("The current session was disconnected");
|
||||
closeCurrentSession();
|
||||
selectServerDialog.showOnStage(mainStage);
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
Thread.yield();
|
||||
}
|
||||
logger.fine("terminating session guard");
|
||||
}}).start();
|
||||
session.addCoderMessageReceivedListener(new CoderMessageReceivedListener() {
|
||||
@Override
|
||||
public void projectListRspReceived(final Map<String, ProjectListData> projectListRsp) {
|
||||
|
|
@ -291,6 +291,7 @@ public class CoderClient extends Application{
|
|||
this.selectProjectDialog.addSelectProjectDialogListener(new SelectProjectDialogListener() {
|
||||
@Override
|
||||
public void willShow() {
|
||||
logger.fine("about to show select project dialog on main stage");
|
||||
selectProjectDialog.clearProjectList();
|
||||
if(!selectProjectDialog.isProjectSelected()){
|
||||
sendProjectListReq();
|
||||
|
|
@ -335,6 +336,7 @@ public class CoderClient extends Application{
|
|||
this.newProjectDialog.addNewProjectDialogListener(new NewProjectDialogListener(){
|
||||
@Override
|
||||
public void willShow() {
|
||||
logger.fine("about to show new project dialog on main stage");
|
||||
newProjectDialog.clearProjectTypeList();
|
||||
sendProjectTypeReqMsg();
|
||||
}
|
||||
|
|
@ -380,6 +382,7 @@ public class CoderClient extends Application{
|
|||
this.editorWindow.addEditorWindowListener(new EditorWindowListener() {
|
||||
@Override
|
||||
public void willShow() {
|
||||
logger.fine("about to show edit window on main stage");
|
||||
sendProjectReqMsg();
|
||||
}
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -72,11 +72,11 @@ public class Session extends Thread {
|
|||
try {
|
||||
msg = in.readGenericObject();
|
||||
} catch (IOException e) {
|
||||
logger.log(Level.FINE, "socket was probably closed by the peer", e);
|
||||
logger.fine("socket has been closed");
|
||||
break;
|
||||
}
|
||||
if(msg == null){
|
||||
logger.fine("socket was probably closed by the peer");
|
||||
logger.severe("reading null from socket. socket assumed to be closed.");
|
||||
break;
|
||||
}else{
|
||||
handleMessage(msg);
|
||||
|
|
@ -182,8 +182,7 @@ public class Session extends Thread {
|
|||
CoderMessage authRsp = new CoderMessage();
|
||||
authRsp.AuthenticationRsp = new AuthenticationRspMsg();
|
||||
authRsp.AuthenticationRsp.timestamp = System.currentTimeMillis();
|
||||
authRsp.AuthenticationRsp.hash = Hasher.PBKDF2(
|
||||
hashedPassword, msg.AuthenticationChallenge.salt, AUTH_HASH_ITERATIONS);
|
||||
authRsp.AuthenticationRsp.hash = key;
|
||||
logger.fine("Sending AuthenticationRsp");
|
||||
send(authRsp);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,15 +7,14 @@
|
|||
<?import java.lang.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
|
||||
|
||||
<AnchorPane prefHeight="116.0" prefWidth="378.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Label layoutX="10.0" layoutY="17.0" text="username" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="17.0" />
|
||||
<TextField fx:id="usernameTextField" layoutX="80.0" layoutY="13.0" onKeyPressed="#keyPressed" prefHeight="25.0" prefWidth="291.0" AnchorPane.leftAnchor="80.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="13.0" />
|
||||
<TextField fx:id="usernameTextField" layoutX="80.0" layoutY="13.0" onKeyPressed="#keyPressed" prefHeight="25.0" prefWidth="291.0" promptText="Username" AnchorPane.leftAnchor="80.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="13.0" />
|
||||
<Label layoutX="10.0" layoutY="48.0" text="password" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="48.0" />
|
||||
<PasswordField fx:id="passwordPasswordField" layoutX="80.0" layoutY="44.0" onKeyPressed="#keyPressed" prefHeight="25.0" prefWidth="291.0" AnchorPane.leftAnchor="80.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="44.0" />
|
||||
<Label fx:id="errorLabel" alignment="TOP_LEFT" layoutX="10.0" layoutY="75.0" maxWidth="1.7976931348623157E308" prefHeight="35.0" prefWidth="242.0" text="error" textFill="RED" wrapText="true" />
|
||||
<HBox alignment="CENTER_RIGHT" layoutX="42.0" layoutY="34.0" prefHeight="35.0" prefWidth="200.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="0.0">
|
||||
<PasswordField fx:id="passwordPasswordField" layoutX="80.0" layoutY="44.0" onKeyPressed="#keyPressed" prefHeight="25.0" prefWidth="291.0" promptText="Password" AnchorPane.leftAnchor="80.0" AnchorPane.rightAnchor="7.0" AnchorPane.topAnchor="44.0" />
|
||||
<Label fx:id="errorLabel" alignment="TOP_LEFT" layoutX="10.0" layoutY="75.0" maxWidth="1.7976931348623157E308" prefHeight="34.0" prefWidth="216.0" text="Error Message" textFill="RED" wrapText="true" AnchorPane.bottomAnchor="7.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="152.0" AnchorPane.topAnchor="75.0" />
|
||||
<HBox alignment="CENTER_RIGHT" layoutX="42.0" layoutY="34.0" prefHeight="35.0" prefWidth="148.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="0.0">
|
||||
<children>
|
||||
<Button fx:id="cancelButton" mnemonicParsing="false" onAction="#cancel" text="Cancel">
|
||||
<HBox.margin>
|
||||
|
|
|
|||
|
|
@ -1,15 +1,30 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.*?>
|
||||
<?import javafx.scene.control.*?>
|
||||
<?import java.lang.*?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="159.0" prefWidth="382.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<AnchorPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="112.0" prefWidth="382.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||
<children>
|
||||
<Button fx:id="cancelButton" layoutX="60.0" layoutY="67.0" mnemonicParsing="false" onAction="#cancel" text="cancel" />
|
||||
<Button fx:id="createButton" defaultButton="true" disable="true" layoutX="195.0" layoutY="67.0" mnemonicParsing="false" onAction="#create" text="create" />
|
||||
<ComboBox fx:id="projectTypeComboBox" layoutX="160.0" layoutY="21.0" prefHeight="25.0" prefWidth="196.0" promptText="Select a Project Type" />
|
||||
<Label fx:id="errorMessageLabel" layoutX="71.0" layoutY="111.0" text="Error Message" textFill="RED" />
|
||||
<TextField fx:id="projectNameTextField" layoutX="11.0" layoutY="21.0" onKeyPressed="#keyPressed" promptText="Project Name" />
|
||||
<ComboBox fx:id="projectTypeComboBox" layoutX="58.0" layoutY="39.0" prefHeight="25.0" prefWidth="196.0" promptText="Select a Project Type" AnchorPane.leftAnchor="55.0" AnchorPane.rightAnchor="10.0" />
|
||||
<Label fx:id="errorMessageLabel" alignment="TOP_LEFT" layoutX="14.0" layoutY="71.0" prefHeight="17.0" prefWidth="237.0" text="Error Message" textFill="RED" AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" AnchorPane.rightAnchor="135.0" AnchorPane.topAnchor="71.0" />
|
||||
<TextField fx:id="projectNameTextField" layoutX="58.0" layoutY="10.0" onKeyPressed="#keyPressed" prefHeight="25.0" prefWidth="314.0" promptText="Project Name" AnchorPane.leftAnchor="55.0" AnchorPane.rightAnchor="10.0" />
|
||||
<Label layoutX="14.0" layoutY="14.0" text="Name" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="14.0" />
|
||||
<Label layoutX="14.0" layoutY="43.0" text="Type" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="43.0" />
|
||||
<HBox alignment="CENTER_RIGHT" layoutX="168.0" layoutY="109.0" prefHeight="35.0" prefWidth="127.0" AnchorPane.bottomAnchor="5.0" AnchorPane.rightAnchor="10.0">
|
||||
<children>
|
||||
<Button fx:id="cancelButton" mnemonicParsing="false" onAction="#cancel" text="cancel">
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
<Button fx:id="createButton" defaultButton="true" disable="true" mnemonicParsing="false" onAction="#create" text="create">
|
||||
<HBox.margin>
|
||||
<Insets left="10.0" />
|
||||
</HBox.margin>
|
||||
</Button>
|
||||
</children>
|
||||
</HBox>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ public class SelectProjectDialog extends GuiWindow {
|
|||
|
||||
@FXML
|
||||
protected void newProject(ActionEvent event){
|
||||
logger.fine("user triggered the new project button");
|
||||
for(SelectProjectDialogListener listener : this.listeners){
|
||||
listener.newProject();
|
||||
}
|
||||
|
|
@ -120,6 +121,7 @@ public class SelectProjectDialog extends GuiWindow {
|
|||
|
||||
@FXML
|
||||
protected void cancel(ActionEvent event){
|
||||
logger.fine("user triggered the cancel button");
|
||||
for(SelectProjectDialogListener listener : this.listeners){
|
||||
listener.cancel();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue