(merge avec precedent) Intégration de PandacubeWeb dans le code PHP actuel + Corrections bugs

This commit is contained in:
Marc Baloup 2016-07-31 12:57:39 +02:00
parent 5f10f1d55f
commit 0df60d9d01
4 changed files with 18 additions and 14 deletions

View File

@ -89,11 +89,11 @@ public final class ORM {
if (tables.contains(elemClass)) return;
try {
tables.add(elemClass);
Log.info("Start initializing SQL table "+elemClass.getName());
//Log.info("Start Init SQL table "+elemClass.getSimpleName());
E instance = elemClass.newInstance();
String tableName = instance.tableName();
if (!tableExist(tableName)) createTable(instance);
Log.info("End of initializing SQL table "+elemClass.getName());
//Log.info("End init SQL table "+elemClass.getSimpleName());
} catch (Exception|ExceptionInInitializerError e) {
throw new ORMInitTableException(elemClass, e);
}
@ -287,8 +287,7 @@ public final class ORM {
* for(SQLPlayer p : players) {
* System.out.println(p.get(SQLPlayer.playerDisplayName));
* }
* // TODO LIST
* - Gérer mise à jour relative d'un champ (incrément / décrément)
* // TODO mise à jour relative d'un champ (incrément / décrément)
* }
*/

View File

@ -25,11 +25,12 @@ public class ByteBuffer implements Cloneable {
}
private void askForBufferExtension(int needed) {
if (buff.remaining() >= needed) return;
while (buff.remaining() < needed) {
java.nio.ByteBuffer newBuff = java.nio.ByteBuffer.wrap(Arrays.copyOf(buff.array(), buff.array().length * 2));
newBuff.position(buff.position());
buff = newBuff;
}
}
@Override
public ByteBuffer clone() {

View File

@ -21,8 +21,7 @@ public class PacketServerException extends PacketServer {
@Override
public void deserializeFromByteBuffer(ByteBuffer buffer) {
// TODO Auto-generated method stub
exception = buffer.getString();
}

View File

@ -8,6 +8,7 @@ import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.BlockingQueue;
@ -80,8 +81,10 @@ public class TCPServer extends Thread implements Closeable {
Log.getLogger().log(Level.SEVERE, "Connexion impossible avec " + socketClient.getInetAddress());
}
}
} catch(SocketException e) {
} catch (Exception e) {
Log.getLogger().log(Level.WARNING, "Plus aucune connexion ne peux être acceptée", e);
Log.warning("Plus aucune connexion ne peux être acceptée", e);
}
}
@ -136,6 +139,7 @@ public class TCPServer extends Thread implements Closeable {
}
}
} catch(SocketException e) {
} catch (Exception e) {
Log.severe("Closing connection " + address, e);
}
@ -242,16 +246,17 @@ public class TCPServer extends Thread implements Closeable {
public void close() {
try {
if (isClosed.get()) return;
isClosed.set(true);
clients.forEach(el -> el.close());
socket.close();
isClosed.set(true);
try {
listener.onSocketClose(this);
} catch(Exception e) {
Log.severe("Exception while calling TCPServerListener.onSocketClose()", e);
}
socket.close();
} catch (IOException e) {}
}