Commit ec6b33c42be058c412868df32e7fbc5549f522ce

Authored by “fan1305”
2 parents f7a4c69c 10b69295
src/main/java/com/bsth/socket/protocol/Message02Factory.java
@@ -8,23 +8,24 @@ import org.slf4j.LoggerFactory; @@ -8,23 +8,24 @@ import org.slf4j.LoggerFactory;
8 * @author Hill 8 * @author Hill
9 */ 9 */
10 public class Message02Factory { 10 public class Message02Factory {
11 - 11 +
12 private final static Logger log = LoggerFactory.getLogger(Message02Factory.class); 12 private final static Logger log = LoggerFactory.getLogger(Message02Factory.class);
13 13
14 public static IMessageBody02 create(int commandType, byte[] data, int idx) { 14 public static IMessageBody02 create(int commandType, byte[] data, int idx) {
15 String pkgName = Message02Factory.class.getPackage().getName(); 15 String pkgName = Message02Factory.class.getPackage().getName();
16 IMessageBody02 body = null; 16 IMessageBody02 body = null;
17 try { 17 try {
18 - System.out.println(pkgName + ".Message02" + String.format("%02x", commandType)); 18 + log.info("{}.Message02{}", pkgName, String.format("%02x", commandType));
19 Class<?> cls = Class.forName(pkgName + ".Message02" + String.format("%02x", commandType)); 19 Class<?> cls = Class.forName(pkgName + ".Message02" + String.format("%02x", commandType));
20 body = (IMessageBody02)cls.newInstance(); 20 body = (IMessageBody02)cls.newInstance();
21 body.read(data, idx); 21 body.read(data, idx);
  22 + log.info(body.toString());
22 } catch (Exception e) { 23 } catch (Exception e) {
23 // TODO Auto-generated catch block 24 // TODO Auto-generated catch block
24 - log.error("Message02Factory create: " + ConvertUtil.toHexString(data), e); 25 + log.error("Message02Factory create: {}", ConvertUtil.toHexString(data), e);
25 throw new RuntimeException(); 26 throw new RuntimeException();
26 } 27 }
27 28
28 return body; 29 return body;
29 } 30 }
30 -} 31 -}
  32 +}
31 \ No newline at end of file 33 \ No newline at end of file