# HG changeset patch # User kono # Date 1223944411 -32400 # Node ID 86935b87238556e1e3a70923bb6b882675563220 # Parent edf0e0a5ffc830c68a53681e705cb2c2c8bd7126 *** empty log message *** diff -r edf0e0a5ffc8 -r 86935b872385 rep/SessionManager.java --- a/rep/SessionManager.java Tue Oct 14 09:33:31 2008 +0900 +++ b/rep/SessionManager.java Tue Oct 14 09:33:31 2008 +0900 @@ -170,9 +170,7 @@ } else { try { manage(p.channel, p.command); - } catch (IOException e1) { - close(p.channel); - } catch (SAXException e1) { + } catch (Exception e1) { close(p.channel); } } diff -r edf0e0a5ffc8 -r 86935b872385 rep/handler/REPEditorHandler.java --- a/rep/handler/REPEditorHandler.java Tue Oct 14 09:33:31 2008 +0900 +++ b/rep/handler/REPEditorHandler.java Tue Oct 14 09:33:31 2008 +0900 @@ -1,7 +1,5 @@ package rep.handler; -import java.io.IOException; - import rep.REPCommand; import rep.SessionManager; import rep.channel.REPSelectionKey; @@ -16,7 +14,7 @@ this.manager = manager; } - public void handle(REPSelectionKey key) throws IOException { + public void handle(REPSelectionKey key) throws Exception { REPSocketChannel channel = key.channel1(); REPCommand command = channel.read(); SessionManager.logger.writeLog("REPHandlerImpl.handle() read : command = " + command +" from "+channel); diff -r edf0e0a5ffc8 -r 86935b872385 rep/handler/REPHandler.java --- a/rep/handler/REPHandler.java Tue Oct 14 09:33:31 2008 +0900 +++ b/rep/handler/REPHandler.java Tue Oct 14 09:33:31 2008 +0900 @@ -1,12 +1,11 @@ package rep.handler; -import java.io.IOException; import rep.REPCommand; import rep.channel.REPSelectionKey; import rep.channel.REPSocketChannel; public interface REPHandler { - void handle(REPSelectionKey key)throws IOException; + void handle(REPSelectionKey key)throws Exception; void cancel(REPSocketChannel socketChannel); diff -r edf0e0a5ffc8 -r 86935b872385 rep/handler/REPSessionManagerHandler.java --- a/rep/handler/REPSessionManagerHandler.java Tue Oct 14 09:33:31 2008 +0900 +++ b/rep/handler/REPSessionManagerHandler.java Tue Oct 14 09:33:31 2008 +0900 @@ -1,7 +1,5 @@ package rep.handler; -import java.io.IOException; - import rep.Forwarder; import rep.REPCommand; import rep.Session; @@ -21,7 +19,7 @@ manager.remove(socketChannel); } - public void handle(REPSelectionKey key) throws IOException { + public void handle(REPSelectionKey key) throws Exception { /* * SessionManagerから来たコマンドは、Editor関係のコマンドは、 * sessionとeidを判定して、そのeditorにforwardしてやれば良い。 diff -r edf0e0a5ffc8 -r 86935b872385 rep/xml/SessionXMLDecoder.java --- a/rep/xml/SessionXMLDecoder.java Tue Oct 14 09:33:31 2008 +0900 +++ b/rep/xml/SessionXMLDecoder.java Tue Oct 14 09:33:31 2008 +0900 @@ -1,14 +1,17 @@ package rep.xml; +import java.io.IOException; import java.io.StringReader; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; import org.xml.sax.InputSource; +import org.xml.sax.SAXException; import rep.Editor; import rep.Session; @@ -16,34 +19,37 @@ public class SessionXMLDecoder { - public SessionXMLDecoder(String string) { + DocumentBuilderFactory factory; + DocumentBuilder builder; + + public SessionXMLDecoder(String string) throws SAXException, IOException { decode(string); } public SessionXMLDecoder() { + factory = DocumentBuilderFactory.newInstance(); + try { + factory.newDocumentBuilder(); + } catch (ParserConfigurationException e) { + } } - public SessionList decode(String string) { + public SessionList decode(String string) throws SAXException, IOException { SessionList sessionlist = null; //System.out.println(""); - try { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - DocumentBuilder builder = factory.newDocumentBuilder(); - InputSource source = new InputSource(new StringReader(string)); - //source.setEncoding("UTF-8"); - Document doc = builder.parse(source); - Element root = doc.getDocumentElement(); - - //sessionlist = createSessionList(root); - sessionlist = generateSessionList(root); - sessionlist.setMaxHost(getSessionManagerHost(root)); - - } catch (Exception e) { - e.printStackTrace(); - } + InputSource source = new InputSource(new StringReader(string)); + //source.setEncoding("UTF-8"); + Document doc = builder.parse(source); + Element root = doc.getDocumentElement(); + + //sessionlist = createSessionList(root); + sessionlist = generateSessionList(root); + sessionlist.setMaxHost(getSessionManagerHost(root)); + + return sessionlist; } - + private String getSessionManagerHost(Element root) { NodeList nodelist = root.getChildNodes(); String host = null; diff -r edf0e0a5ffc8 -r 86935b872385 test/XMLTest.java --- a/test/XMLTest.java Tue Oct 14 09:33:31 2008 +0900 +++ b/test/XMLTest.java Tue Oct 14 09:33:31 2008 +0900 @@ -1,9 +1,5 @@ package test; -import java.io.IOException; - -import org.xml.sax.SAXException; - import rep.Editor; import rep.Session; import rep.SessionList;