Commit ec6b33c42be058c412868df32e7fbc5549f522ce
Merge branch 'master' of http://61.169.120.202:8888/wt11111111/gb32960_server
Showing
1 changed file
with
5 additions
and
3 deletions
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 |