Commit 4a380d45 authored by Claes Sjöfors's avatar Claes Sjöfors

Java local charaters fix

parent cd44f1f8
...@@ -102,11 +102,11 @@ public class HistSender { ...@@ -102,11 +102,11 @@ public class HistSender {
try { try {
out = new ObjectOutputStream( socket.getOutputStream() ); out = new ObjectOutputStream( socket.getOutputStream() );
out.flush(); out.flush();
//varför??? //why???
in = new ObjectInputStream( socket.getInputStream() ); in = new ObjectInputStream( socket.getInputStream() );
} }
catch(Exception e) { catch(Exception e) {
System.out.println("IOException vid skapande av strömmar mot server"); System.out.println("IOException at server stream creation");
//errh.error("DataStream failed"); //errh.error("DataStream failed");
return new MhData(100,100); return new MhData(100,100);
} }
......
...@@ -65,10 +65,10 @@ public class JopApplet extends JApplet implements GdhApplIfc ...@@ -65,10 +65,10 @@ public class JopApplet extends JApplet implements GdhApplIfc
engine = new JopEngine(1000, this); engine = new JopEngine(1000, this);
session = new JopSession( engine, (Object)this); session = new JopSession( engine, (Object)this);
if ( instance != null && instance.length() != 0) { if ( instance != null && instance.length() != 0) {
// Substitutes for åäö because of mozilla... // Substitutes for local char because of mozilla...
instance = instance.replace( '\\', '); instance = instance.replace( '\\', (char)229);
instance = instance.replace( '/', '); instance = instance.replace( '/', (char)228);
instance = instance.replace( '@', '); instance = instance.replace( '@', (char)246);
System.out.println( "Parameter instance: " + instance); System.out.println( "Parameter instance: " + instance);
engine.gdh.logString("Parameter instance: " + instance); engine.gdh.logString("Parameter instance: " + instance);
......
...@@ -588,7 +588,7 @@ public class MhTable extends JPanel ...@@ -588,7 +588,7 @@ public class MhTable extends JPanel
public final Object[] longValues = {"A", "Acknowledge", public final Object[] longValues = {"A", "Acknowledge",
"10-12-31 12:12:12.98", "10-12-31 12:12:12.98",
"QWERTYUIOPAAOLK_JHGFDSAZXCVBNM__POIUYTRQWERTYUIOPAAOL", "QWERTYUIOPAAOLK_JHGFDSAZXCVBNM__POAIUYTRQWERTYUIOPAAOL",
"QWERTYUIOPAAOLK"}; "QWERTYUIOPAAOLK"};
......
...@@ -813,10 +813,10 @@ public class GdhServer ...@@ -813,10 +813,10 @@ public class GdhServer
long K = 1024; long K = 1024;
long freeMem = Runtime.getRuntime().freeMemory() / K; long freeMem = Runtime.getRuntime().freeMemory() / K;
long totalMem = Runtime.getRuntime().totalMemory() / K; long totalMem = Runtime.getRuntime().totalMemory() / K;
System.out.println("Slut på minne, storlek på thSub: " + thSub.size() + System.out.println("Out of memory, size of thSub: " + thSub.size() +
"storlek på sub: " + subscriptions.size() + "size of sub: " + subscriptions.size() +
"Tillgängligt minne: " + freeMem + " KB" + "Available memory: " + freeMem + " KB" +
"Totalt minne: " + totalMem + " KB"); "Total memory: " + totalMem + " KB");
} }
catch(IOException e) catch(IOException e)
...@@ -1806,9 +1806,9 @@ public class GdhServer ...@@ -1806,9 +1806,9 @@ public class GdhServer
{ {
long freeMem = Runtime.getRuntime().freeMemory(); long freeMem = Runtime.getRuntime().freeMemory();
long totalMem = Runtime.getRuntime().totalMemory(); long totalMem = Runtime.getRuntime().totalMemory();
System.out.println("Slut på minne, storlek på subcp: " + subscriptions.size() + System.out.println("Out of memory, size of subcp: " + subscriptions.size() +
"Tillgängligt minne: " + freeMem + "Available memory: " + freeMem +
"Totalt minne: " + totalMem); "Total memory: " + totalMem);
} }
catch(IOException e) catch(IOException e)
{ {
...@@ -1975,7 +1975,7 @@ public class GdhServer ...@@ -1975,7 +1975,7 @@ public class GdhServer
{ {
} }
} }
//minska storleken på subscriptions för att spara minne // Reduce subscription size to save memory
this.trimRefObjectList(); this.trimRefObjectList();
threadCount--; threadCount--;
setCurrentConnections(threadCount); setCurrentConnections(threadCount);
......
...@@ -189,7 +189,7 @@ public class GdhServerMonitor extends JFrame implements ActionListener ...@@ -189,7 +189,7 @@ public class GdhServerMonitor extends JFrame implements ActionListener
totalMem = totalMem / 1024; totalMem = totalMem / 1024;
labelMessage.setText("Ledigt minne(av allokerat): " + freeMem + " Allokerat minne: " + totalMem + labelMessage.setText("Ledigt minne(av allokerat): " + freeMem + " Allokerat minne: " + totalMem +
" Antal prenumerationer: " + nrOfSubscriptions); " Antal prenumerationer: " + nrOfSubscriptions);
//qqq behvs detta??? // is this needed???
data = new Object[size][5]; data = new Object[size][5];
for(int i = 0; i < size;i++) for(int i = 0; i < size;i++)
{ {
......
...@@ -269,7 +269,7 @@ public class Mh ...@@ -269,7 +269,7 @@ public class Mh
lastMhrEvent = evItem; lastMhrEvent = evItem;
newAlarmArrived = true; newAlarmArrived = true;
nrOfAlarmsArrived++; //behövs ej nrOfAlarmsArrived++; // not needed
} }
......
...@@ -182,7 +182,7 @@ public class MhServer ...@@ -182,7 +182,7 @@ public class MhServer
maxConnections = cdhrMaxCon.value; maxConnections = cdhrMaxCon.value;
maxAlarms = cdhrMaxAlarms.value; maxAlarms = cdhrMaxAlarms.value;
maxEvents = cdhrMaxEvents.value; maxEvents = cdhrMaxEvents.value;
//pga bugg i proview, MaxNoOfAlarms syns ej i arbetsbnken // because if Proview bugg, MaxNoOfAlarms is not visible in wb
if(maxAlarms == 0) maxAlarms = 100; if(maxAlarms == 0) maxAlarms = 100;
if(maxEvents == 0) maxEvents = 200; if(maxEvents == 0) maxEvents = 200;
//currentConnectionsStr = cdhrString.str + ".CurrentConnections"; //currentConnectionsStr = cdhrString.str + ".CurrentConnections";
...@@ -407,13 +407,12 @@ public class MhServer ...@@ -407,13 +407,12 @@ public class MhServer
//System.out.println("efter insertNewMess"); //System.out.println("efter insertNewMess");
for(int i = 0;i < totalThreadCount && i < mhThread.length;i++) for(int i = 0;i < totalThreadCount && i < mhThread.length;i++)
{ {
//System.out.println("Nu skall sendMess anropas"); // Some client may have been terminated
//det kan ju vara s att ngon klient har avslutats
if(mhThread[i] == null) if(mhThread[i] == null)
{ {
if(log) if(log)
{ {
System.out.println("mhThread[" + i + "] r null"); System.out.println("mhThread[" + i + "] is null");
} }
continue; continue;
} }
...@@ -462,7 +461,7 @@ public class MhServer ...@@ -462,7 +461,7 @@ public class MhServer
catch(IOException e) catch(IOException e)
{ {
this.keepRunning = false; this.keepRunning = false;
System.out.println("IOException vid skapande av strmmar mot klient"); System.out.println("IOException at client stream creation");
errh.error("DataStream failed"); errh.error("DataStream failed");
threadCount--; threadCount--;
//setCurrentConnections(threadCount); //setCurrentConnections(threadCount);
...@@ -494,7 +493,7 @@ public class MhServer ...@@ -494,7 +493,7 @@ public class MhServer
out.writeInt(nrOfEvents); out.writeInt(nrOfEvents);
if(log) if(log)
{ {
System.out.println("Hndelsestorlek: " + nrOfEvents); System.out.println("Event size: " + nrOfEvents);
} }
if(nrOfEvents > 0) if(nrOfEvents > 0)
{ {
...@@ -515,22 +514,21 @@ public class MhServer ...@@ -515,22 +514,21 @@ public class MhServer
while(this.keepRunning) while(this.keepRunning)
{ {
//hr skall vi ligga och vnta p meddelanden frn klienterna // Wait for client messages, alarm ack and so
//typ alarmkvittens och dylikt
try try
{ {
MhrsEventId id = (MhrsEventId)in.readObject(); MhrsEventId id = (MhrsEventId)in.readObject();
if(log) if(log)
{ {
System.out.println("ftt meddelande" + id.idx + " " + id.nix + " " + System.out.println("Message received " + id.idx + " " + id.nix + " " +
id.birthTime); id.birthTime);
} }
PwrtStatus sts = mh.outunitAck(id); PwrtStatus sts = mh.outunitAck(id);
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("Exception i receivemesstrd " + e.toString()); System.out.println("Exception i receive message thread " + e.toString());
this.keepRunning = false; this.keepRunning = false;
} }
Thread.sleep(3); Thread.sleep(3);
...@@ -538,8 +536,8 @@ public class MhServer ...@@ -538,8 +536,8 @@ public class MhServer
} }
catch(Exception e) catch(Exception e)
{ {
System.out.println("exception i run MhThread"); System.out.println("exception in run MhThread");
System.out.println("avslutar trden"); System.out.println("Terminate thread");
} }
finally finally
{ {
...@@ -571,7 +569,7 @@ public class MhServer ...@@ -571,7 +569,7 @@ public class MhServer
} }
} }
/** /**
* Anropas var gng ett nytt meddelande skall skickas till klienterna * Called every time a new message is sent to the clients
*/ */
public void sendMess(MhrEvent event) public void sendMess(MhrEvent event)
{ {
......
...@@ -122,14 +122,14 @@ public class RtUtilities { ...@@ -122,14 +122,14 @@ public class RtUtilities {
int offs1; int offs1;
int offs2; int offs2;
// Replace in instance name because mozilla can't pass them as // Replace local char in instance name because mozilla can't pass them as
// parameter // parameter
for ( int i = 0; i < instance.length(); i++) { for ( int i = 0; i < instance.length(); i++) {
if ( instanceBuff[i] == '' || instanceBuff[i] == '') if ( instanceBuff[i] == 229 || instanceBuff[i] == 197)
instanceBuff[i] = '\\'; instanceBuff[i] = '\\';
if ( instanceBuff[i] == '' || instanceBuff[i] == '') if ( instanceBuff[i] == 228 || instanceBuff[i] == 196)
instanceBuff[i] = '/'; instanceBuff[i] = '/';
if ( instanceBuff[i] == '' || instanceBuff[i] == '') if ( instanceBuff[i] == 246 || instanceBuff[i] == 214)
instanceBuff[i] = '@'; instanceBuff[i] = '@';
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment