Browse Source

Minor changes

Fixes
master
Sogomn 9 years ago
parent
commit
c0579d4047
  1. 4
      Ratty/src/de/sogomn/rat/Ratty.java
  2. 9
      Ratty/src/de/sogomn/rat/builder/StubBuilder.java

4
Ratty/src/de/sogomn/rat/Ratty.java

@ -40,7 +40,7 @@ public final class Ratty {
private static void readConnectionData() {
final String[] lines = FileUtils.readInternalLines(CONNECTION_DATA_FILE_NAME);
if (lines.length >= 4) {
if (lines.length >= 3) {
final String addressString = lines[0].trim();
final String portString = lines[1].trim();
final String clientString = lines[2].trim();
@ -71,7 +71,7 @@ public final class Ratty {
try {
final int port = Integer.parseInt(input);
if (port < 0) {
if (port < 0 || port > 65535) {
return -1;
}

9
Ratty/src/de/sogomn/rat/builder/StubBuilder.java

@ -13,15 +13,19 @@ import java.nio.file.StandardCopyOption;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.filechooser.FileNameExtensionFilter;
import de.sogomn.engine.util.FileUtils;
import de.sogomn.rat.Ratty;
/*
* This class is kinda hardcoded.
*/
public final class StubBuilder {
private static final String ADDRESS_MESSAGE = "Address?";
private static final String PORT_MESSAGE = "Port?";
private static final String ADDRESS_MESSAGE = "Which address should the client connect to?";
private static final String PORT_MESSAGE = "Which port?";
private static final String FILE_NAME = "/connection_data.txt";
@ -35,6 +39,7 @@ public final class StubBuilder {
final File currentDirectory = new File(currentDirectoryPath);
fileChooser.setCurrentDirectory(currentDirectory);
fileChooser.setFileFilter(new FileNameExtensionFilter("*.jar", "JAR"));
final int input = open ? fileChooser.showOpenDialog(null) : fileChooser.showSaveDialog(null);

Loading…
Cancel
Save