Un-static part 4: Logs
This commit is contained in:
@ -72,8 +72,7 @@ public class SettingsFrame extends TabLogoPanel {
|
||||
|
||||
|
||||
|
||||
private static final Log _log = LogFactory.getLog(SettingsFrame.class);
|
||||
private static Boolean instanceShown = false;
|
||||
private final Log _log = LogFactory.getLog(SettingsFrame.class);
|
||||
|
||||
// ConnectPanel
|
||||
private JTextField txtRouterIP;
|
||||
|
@ -16,7 +16,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class GetEcho {
|
||||
private final static Log _log = LogFactory.getLog(GetEcho.class);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static String execute(String str)
|
||||
@ -34,8 +33,10 @@ public class GetEcho {
|
||||
Map inParams = (HashMap) resp.getResult();
|
||||
return (String) inParams.get("Result");
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(GetEcho.class);
|
||||
_log.error("GetEcho failed.", e);
|
||||
} catch (InvalidParametersException e) {
|
||||
Log _log = LogFactory.getLog(GetEcho.class);
|
||||
_log.error("Remote host rejected provided parameters: " + req.toJSON().toJSONString());
|
||||
}
|
||||
return null;
|
||||
|
@ -20,8 +20,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class GetI2PControl {
|
||||
private final static Log _log = LogFactory.getLog(GetI2PControl.class);
|
||||
|
||||
|
||||
public static EnumMap<I2P_CONTROL, Object> execute(I2P_CONTROL ... settings)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException{
|
||||
@ -58,8 +56,10 @@ public class GetI2PControl {
|
||||
return new EnumMap<I2P_CONTROL, Object>(I2P_CONTROL.class);
|
||||
}
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(GetI2PControl.class);
|
||||
_log.error("getI2PControl failed.", e);
|
||||
} catch (InvalidParametersException e) {
|
||||
Log _log = LogFactory.getLog(GetI2PControl.class);
|
||||
_log.error("getI2PControl was rejected by remote host as invalid.", e);
|
||||
}
|
||||
return null;
|
||||
|
@ -22,7 +22,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class GetNetworkSetting {
|
||||
private final static Log _log = LogFactory.getLog(GetNetworkSetting.class);
|
||||
|
||||
public static EnumMap<NETWORK_SETTING, Object> execute(NETWORK_SETTING ... options)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException{
|
||||
@ -61,8 +60,10 @@ public class GetNetworkSetting {
|
||||
return new EnumMap<NETWORK_SETTING, Object>(NETWORK_SETTING.class);
|
||||
}
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(GetNetworkSetting.class);
|
||||
_log.error("getNetworkInfo failed.", e);
|
||||
} catch (InvalidParametersException e) {
|
||||
Log _log = LogFactory.getLog(GetNetworkSetting.class);
|
||||
_log.error("Remote host rejected provided parameters: " + req.toJSON().toJSONString());
|
||||
}
|
||||
return null;
|
||||
|
@ -17,7 +17,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class GetRateStat{
|
||||
private final static Log _log = LogFactory.getLog(GetRateStat.class);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static Double execute(String stat, long period)
|
||||
@ -42,6 +41,7 @@ public class GetRateStat{
|
||||
Double dbl = (Double) inParams.get("Result");
|
||||
return dbl;
|
||||
} catch (ClassCastException e){
|
||||
Log _log = LogFactory.getLog(GetRateStat.class);
|
||||
_log.debug("Error: Tried to cast a BigDecimal as Double");
|
||||
}
|
||||
try {
|
||||
@ -49,9 +49,11 @@ public class GetRateStat{
|
||||
Double dbl = bigNum.doubleValue();
|
||||
return dbl;
|
||||
} catch (ClassCastException e){
|
||||
Log _log = LogFactory.getLog(GetRateStat.class);
|
||||
_log.debug("Error: Tried to cast a double as a BigDecimal");
|
||||
}
|
||||
}catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(GetRateStat.class);
|
||||
_log.error("getRateStat failed.", e);
|
||||
}
|
||||
return new Double(0);
|
||||
|
@ -23,7 +23,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class GetRouterInfo {
|
||||
private final static Log _log = LogFactory.getLog(GetRouterInfo.class);
|
||||
private static HashMap<Integer, NETWORK_STATUS> enumMap;
|
||||
|
||||
public static enum NETWORK_STATUS{
|
||||
@ -89,8 +88,10 @@ public class GetRouterInfo {
|
||||
return new EnumMap<ROUTER_INFO, Object>(ROUTER_INFO.class);
|
||||
}
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(GetRouterInfo.class);
|
||||
_log.error("getRouterInfo failed.", e);
|
||||
} catch (InvalidParametersException e) {
|
||||
Log _log = LogFactory.getLog(GetRouterInfo.class);
|
||||
_log.error("Remote host rejected provided parameters: " + req.toJSON().toJSONString());
|
||||
}
|
||||
return null;
|
||||
|
@ -20,8 +20,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class SetI2PControl {
|
||||
private final static Log _log = LogFactory.getLog(SetI2PControl.class);
|
||||
|
||||
|
||||
public static EnumMap<I2P_CONTROL, Object> execute(Map<I2P_CONTROL,String> settings)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException{
|
||||
@ -59,6 +57,7 @@ public class SetI2PControl {
|
||||
return new EnumMap<I2P_CONTROL, Object>(I2P_CONTROL.class);
|
||||
}
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(SetI2PControl.class);
|
||||
_log.error("setI2PControl failed.", e);
|
||||
}
|
||||
return null;
|
||||
|
@ -20,8 +20,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class SetNetworkSetting {
|
||||
private final static Log _log = LogFactory.getLog(SetNetworkSetting.class);
|
||||
|
||||
|
||||
public static EnumMap<NETWORK_SETTING, Object> execute(Map<NETWORK_SETTING,String> settings)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException, InvalidParametersException{
|
||||
@ -59,6 +57,7 @@ public class SetNetworkSetting {
|
||||
return new EnumMap<NETWORK_SETTING, Object>(NETWORK_SETTING.class);
|
||||
}
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(SetNetworkSetting.class);
|
||||
_log.error("setNetworkInfo failed.", e);
|
||||
}
|
||||
return null;
|
||||
|
@ -22,8 +22,6 @@ import com.thetransactioncompany.jsonrpc2.JSONRPC2Response;
|
||||
import com.thetransactioncompany.jsonrpc2.client.JSONRPC2SessionException;
|
||||
|
||||
public class SetRouterManager {
|
||||
private final static Log _log = LogFactory.getLog(SetRouterManager.class);
|
||||
|
||||
|
||||
public static EnumMap<ROUTER_MANAGER, Object> execute(Map<ROUTER_MANAGER,String> commands)
|
||||
throws InvalidPasswordException, JSONRPC2SessionException{
|
||||
@ -63,8 +61,10 @@ public class SetRouterManager {
|
||||
return new EnumMap<ROUTER_MANAGER, Object>(ROUTER_MANAGER.class);
|
||||
}
|
||||
} catch (UnrecoverableFailedRequestException e) {
|
||||
Log _log = LogFactory.getLog(SetRouterManager.class);
|
||||
_log.error("setRouterManager failed.", e);
|
||||
} catch (InvalidParametersException e) {
|
||||
Log _log = LogFactory.getLog(SetRouterManager.class);
|
||||
_log.error("Remote host rejected provided parameters: " + req.toJSON().toJSONString());
|
||||
}
|
||||
return null;
|
||||
|
@ -23,18 +23,13 @@ import org.apache.commons.logging.LogFactory;
|
||||
|
||||
public class CertificateHelper {
|
||||
|
||||
private static Log _log;
|
||||
|
||||
static {
|
||||
_log = LogFactory.getLog(CertificateHelper.class);
|
||||
}
|
||||
|
||||
public static X509Certificate certFromBase64(String base64){
|
||||
try {
|
||||
CertificateFactory cf = CertificateFactory.getInstance(CertificateManager.DEFAULT_CERT_SPI);
|
||||
byte[] bytes = Base64.decode(base64);
|
||||
return (X509Certificate) cf.generateCertificate(new ByteArrayInputStream(bytes));
|
||||
} catch (CertificateException e) {
|
||||
Log _log = LogFactory.getLog(CertificateHelper.class);
|
||||
_log.fatal("Unable to load service interface provider, " +
|
||||
CertificateManager.DEFAULT_CERT_SPI +
|
||||
" used for reading base64 encoded certificates", e);
|
||||
|
Reference in New Issue
Block a user