aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/helper
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2018-06-02 22:12:44 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2018-06-02 22:12:44 +1200
commit06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07 (patch)
tree8f5d7b71ca3fa39448e93b3d0652a7fa8d496932 /src/org/traccar/helper
parent5a9811c3771d92832c9bba718b5ec935844978e8 (diff)
downloadtrackermap-server-06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07.tar.gz
trackermap-server-06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07.tar.bz2
trackermap-server-06e3bd8b16da12baafc9a97ba5949b3f7ffb5e07.zip
Start Netty 4 migration
Diffstat (limited to 'src/org/traccar/helper')
-rw-r--r--src/org/traccar/helper/BcdUtil.java8
-rw-r--r--src/org/traccar/helper/BitBuffer.java12
-rw-r--r--src/org/traccar/helper/Log.java78
-rw-r--r--src/org/traccar/helper/StringFinder.java9
4 files changed, 14 insertions, 93 deletions
diff --git a/src/org/traccar/helper/BcdUtil.java b/src/org/traccar/helper/BcdUtil.java
index 495f94104..c87529e32 100644
--- a/src/org/traccar/helper/BcdUtil.java
+++ b/src/org/traccar/helper/BcdUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,14 +15,14 @@
*/
package org.traccar.helper;
-import org.jboss.netty.buffer.ChannelBuffer;
+import io.netty.buffer.ByteBuf;
public final class BcdUtil {
private BcdUtil() {
}
- public static int readInteger(ChannelBuffer buf, int digits) {
+ public static int readInteger(ByteBuf buf, int digits) {
int result = 0;
for (int i = 0; i < digits / 2; i++) {
@@ -42,7 +42,7 @@ public final class BcdUtil {
return result;
}
- public static double readCoordinate(ChannelBuffer buf) {
+ public static double readCoordinate(ByteBuf buf) {
int b1 = buf.readUnsignedByte();
int b2 = buf.readUnsignedByte();
int b3 = buf.readUnsignedByte();
diff --git a/src/org/traccar/helper/BitBuffer.java b/src/org/traccar/helper/BitBuffer.java
index ac307efdf..f30a4557b 100644
--- a/src/org/traccar/helper/BitBuffer.java
+++ b/src/org/traccar/helper/BitBuffer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 - 2017 Anton Tananaev (anton@traccar.org)
+ * Copyright 2016 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,12 +15,12 @@
*/
package org.traccar.helper;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBuffers;
+import io.netty.buffer.ByteBuf;
+import io.netty.buffer.Unpooled;
public class BitBuffer {
- private final ChannelBuffer buffer;
+ private final ByteBuf buffer;
private int writeByte;
private int writeCount;
@@ -29,10 +29,10 @@ public class BitBuffer {
private int readCount;
public BitBuffer() {
- buffer = ChannelBuffers.dynamicBuffer();
+ buffer = Unpooled.buffer();
}
- public BitBuffer(ChannelBuffer buffer) {
+ public BitBuffer(ByteBuf buffer) {
this.buffer = buffer;
}
diff --git a/src/org/traccar/helper/Log.java b/src/org/traccar/helper/Log.java
index d74246a64..a22e4bde2 100644
--- a/src/org/traccar/helper/Log.java
+++ b/src/org/traccar/helper/Log.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012 - 2016 Anton Tananaev (anton@traccar.org)
+ * Copyright 2012 - 2018 Anton Tananaev (anton@traccar.org)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,9 +23,6 @@ import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.varia.NullAppender;
-import org.jboss.netty.logging.AbstractInternalLogger;
-import org.jboss.netty.logging.InternalLogger;
-import org.jboss.netty.logging.InternalLoggerFactory;
import org.traccar.Config;
import java.io.IOException;
@@ -67,14 +64,6 @@ public final class Log {
logger.addAppender(appender);
logger.setLevel(Level.toLevel(config.getString("logger.level"), Level.ALL));
- // Workaround for "Bug 745866 - (EDG-45) Possible netty logging config problem"
- InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory() {
- @Override
- public InternalLogger newInstance(String string) {
- return new NettyInternalLogger();
- }
- });
-
Log.logSystemInfo();
Log.info("Version: " + getAppVersion());
}
@@ -200,69 +189,4 @@ public final class Log {
return s.toString();
}
- /**
- * Netty logger implementation
- */
- private static class NettyInternalLogger extends AbstractInternalLogger {
-
- @Override
- public boolean isDebugEnabled() {
- return false;
- }
-
- @Override
- public boolean isInfoEnabled() {
- return false;
- }
-
- @Override
- public boolean isWarnEnabled() {
- return true;
- }
-
- @Override
- public boolean isErrorEnabled() {
- return true;
- }
-
- @Override
- public void debug(String string) {
- debug(string, null);
- }
-
- @Override
- public void debug(String string, Throwable thrwbl) {
- }
-
- @Override
- public void info(String string) {
- info(string, null);
- }
-
- @Override
- public void info(String string, Throwable thrwbl) {
- }
-
- @Override
- public void warn(String string) {
- warn(string, null);
- }
-
- @Override
- public void warn(String string, Throwable thrwbl) {
- getLogger().warn("netty warning: " + string);
- }
-
- @Override
- public void error(String string) {
- error(string, null);
- }
-
- @Override
- public void error(String string, Throwable thrwbl) {
- getLogger().error("netty error: " + string);
- }
-
- }
-
}
diff --git a/src/org/traccar/helper/StringFinder.java b/src/org/traccar/helper/StringFinder.java
index 2fa0aa9a4..53e9bd68a 100644
--- a/src/org/traccar/helper/StringFinder.java
+++ b/src/org/traccar/helper/StringFinder.java
@@ -15,14 +15,11 @@
*/
package org.traccar.helper;
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.jboss.netty.buffer.ChannelBufferIndexFinder;
-
import java.nio.charset.StandardCharsets;
-public class StringFinder implements ChannelBufferIndexFinder {
+public class StringFinder /*implements ChannelBufferIndexFinder*/ { // TODO handle this
- private String string;
+ /*private String string;
public StringFinder(String string) {
this.string = string;
@@ -36,6 +33,6 @@ public class StringFinder implements ChannelBufferIndexFinder {
}
return string.equals(buffer.toString(guessedIndex, string.length(), StandardCharsets.US_ASCII));
- }
+ }*/
}