summaryrefslogtreecommitdiffstats
path: root/pki/base/common/src/com/netscape/cms
diff options
context:
space:
mode:
authorAdam Young <ayoung@redhat.com>2011-11-18 14:39:59 -0500
committerAdam Young <ayoung@redhat.com>2012-01-04 11:24:45 -0500
commit9c3c8ee12bfc4b0bd3a6a57382f90d7c0ff8abbb (patch)
treed7f2dc5b6a4e01493428d487b9491aed2e7b461f /pki/base/common/src/com/netscape/cms
parente06776464042c557f2a66cbca874507e2be521a8 (diff)
downloadpki-9c3c8ee12bfc4b0bd3a6a57382f90d7c0ff8abbb.tar.gz
pki-9c3c8ee12bfc4b0bd3a6a57382f90d7c0ff8abbb.tar.xz
pki-9c3c8ee12bfc4b0bd3a6a57382f90d7c0ff8abbb.zip
typesafety db and logging
Diffstat (limited to 'pki/base/common/src/com/netscape/cms')
-rw-r--r--pki/base/common/src/com/netscape/cms/logging/LogFile.java26
-rw-r--r--pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java12
-rw-r--r--pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java36
3 files changed, 38 insertions, 36 deletions
diff --git a/pki/base/common/src/com/netscape/cms/logging/LogFile.java b/pki/base/common/src/com/netscape/cms/logging/LogFile.java
index 284ff02d7..c2dd7b332 100644
--- a/pki/base/common/src/com/netscape/cms/logging/LogFile.java
+++ b/pki/base/common/src/com/netscape/cms/logging/LogFile.java
@@ -193,7 +193,7 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
* The selected log event types
*/
protected String mSelectedEventsList = null;
- protected Vector mSelectedEvents = null;
+ protected Vector<String> mSelectedEvents = null;
/**
* The eventType that this log is triggered
@@ -297,8 +297,8 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
/**
* turns a comma-separated String into a Vector
*/
- protected Vector string2Vector(String theString) {
- Vector theVector = new Vector();
+ protected Vector<String> string2Vector(String theString) {
+ Vector<String> theVector = new Vector<String>();
if (theString == null) {
return theVector;
}
@@ -337,7 +337,7 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
* @param events comma-separated event list
*/
public void replaceEvents(String events) {
- Vector v = string2Vector(events);
+ Vector<String> v = string2Vector(events);
mSelectedEvents.removeAllElements();
mSelectedEvents = v;
}
@@ -1145,8 +1145,8 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
* @param fName The log file name to be read. If it's null, read the current
* log file
*/
- public Vector readEntry(int maxLine, int lowLevel, int source, String fName) {
- Vector mEntries = new Vector();
+ public Vector<LogEntry> readEntry(int maxLine, int lowLevel, int source, String fName) {
+ Vector<LogEntry> mEntries = new Vector<LogEntry>();
String fileName = mFileName;
BufferedReader fBuffer;
int lineNo = 0; // lineNo of the current entry in the log file
@@ -1319,12 +1319,12 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
* and from source "source". If the parameter is omitted. All entries
* are sent back.
*/
- public synchronized NameValuePairs retrieveLogContent(Hashtable req) throws ServletException,
+ public synchronized NameValuePairs retrieveLogContent(Hashtable<String, String> req) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
String tmp, fName = null;
int maxLine = -1, level = -1, source = -1;
- Vector entries = null;
+ Vector<LogEntry> entries = null;
if ((tmp = (String)req.get(Constants.PR_LOG_ENTRY)) != null) {
maxLine = Integer.parseInt(tmp);
@@ -1359,7 +1359,7 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
/**
* Retrieve log file list.
*/
- public synchronized NameValuePairs retrieveLogList(Hashtable req) throws ServletException,
+ public synchronized NameValuePairs retrieveLogList(Hashtable<String, String> req) throws ServletException,
IOException, EBaseException {
return null;
}
@@ -1372,8 +1372,8 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
return "LogFile";
}
- public Vector getDefaultParams() {
- Vector v = new Vector();
+ public Vector<String> getDefaultParams() {
+ Vector<String> v = new Vector<String>();
v.addElement(PROP_TYPE + "=");
v.addElement(PROP_ON + "=");
@@ -1394,8 +1394,8 @@ public class LogFile implements ILogEventListener, IExtendedPluginInfo {
return v;
}
- public Vector getInstanceParams() {
- Vector v = new Vector();
+ public Vector<String> getInstanceParams() {
+ Vector<String> v = new Vector<String>();
try {
diff --git a/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java b/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java
index 2f97dcaac..d2dab3950 100644
--- a/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java
+++ b/pki/base/common/src/com/netscape/cms/logging/RollingLogFile.java
@@ -519,7 +519,7 @@ public class RollingLogFile extends LogFile {
/**
* Retrieve log file list.
*/
- public synchronized NameValuePairs retrieveLogList(Hashtable req
+ public synchronized NameValuePairs retrieveLogList(Hashtable<String, String> req
) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
@@ -584,8 +584,8 @@ public class RollingLogFile extends LogFile {
return "RollingLogFile";
}
- public Vector getDefaultParams() {
- Vector v = super.getDefaultParams();
+ public Vector<String> getDefaultParams() {
+ Vector<String> v = super.getDefaultParams();
v.addElement(PROP_MAX_FILE_SIZE + "=");
v.addElement(PROP_ROLLOVER_INTERVAL + "=");
@@ -593,8 +593,8 @@ public class RollingLogFile extends LogFile {
return v;
}
- public Vector getInstanceParams() {
- Vector v = super.getInstanceParams();
+ public Vector<String> getInstanceParams() {
+ Vector<String> v = super.getInstanceParams();
try {
v.addElement(PROP_MAX_FILE_SIZE + "=" + mMaxFileSize / 1024);
@@ -617,7 +617,7 @@ public class RollingLogFile extends LogFile {
public String[] getExtendedPluginInfo(Locale locale) {
String[] p = super.getExtendedPluginInfo(locale);
- Vector info = new Vector();
+ Vector<String> info = new Vector<String>();
for (int i = 0; i < p.length; i++) {
if (!p[i].startsWith(IExtendedPluginInfo.HELP_TOKEN) && !p[i].startsWith(IExtendedPluginInfo.HELP_TEXT))
diff --git a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java
index 358553074..08d6fcf56 100644
--- a/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java
+++ b/pki/base/common/src/com/netscape/cms/servlet/admin/LogAdminServlet.java
@@ -83,9 +83,9 @@ public class LogAdminServlet extends AdminServlet {
super();
}
- public static Hashtable toHashtable(HttpServletRequest req) {
- Hashtable httpReqHash = new Hashtable();
- Enumeration names = req.getParameterNames();
+ public static Hashtable<String, String> toHashtable(HttpServletRequest req) {
+ Hashtable<String, String> httpReqHash = new Hashtable<String, String>();
+ Enumeration<?> names = req.getParameterNames();
while (names.hasMoreElements()) {
String name = (String) names.nextElement();
@@ -342,7 +342,7 @@ public class LogAdminServlet extends AdminServlet {
NameValuePairs params = new NameValuePairs();
String insts = null;
- Enumeration e = mSys.getLogInsts().keys();
+ Enumeration<String> e = mSys.getLogInsts().keys();
for (; e.hasMoreElements();) {
String name = (String) e.nextElement();
@@ -422,7 +422,8 @@ public class LogAdminServlet extends AdminServlet {
* @exception IOException an input/output error has occurred
* @exception EBaseException an error has occurred
*/
- private synchronized void addLogPlugin(HttpServletRequest req,
+ @SuppressWarnings("unchecked")
+ private synchronized void addLogPlugin(HttpServletRequest req,
HttpServletResponse resp, String scope)
throws ServletException, IOException, EBaseException {
String auditMessage = null;
@@ -507,10 +508,10 @@ public class LogAdminServlet extends AdminServlet {
destStore.getSubStore("impl");
// Does the class exist?
- Class newImpl = null;
+ Class<ILogEventListener> newImpl = null;
try {
- newImpl = Class.forName(classPath);
+ newImpl = (Class<ILogEventListener>) Class.forName(classPath);
} catch (ClassNotFoundException e) {
// store a message in the signed audit log file
if (logType.equals(SIGNED_AUDIT_LOG_TYPE)) {
@@ -810,7 +811,7 @@ public class LogAdminServlet extends AdminServlet {
return;
}
- Vector configParams = mSys.getLogDefaultParams(implname);
+ Vector<String> configParams = mSys.getLogDefaultParams(implname);
IConfigStore destStore =
mConfig.getSubStore("log");
@@ -1029,7 +1030,7 @@ public class LogAdminServlet extends AdminServlet {
HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
NameValuePairs params = new NameValuePairs();
- Enumeration e = mSys.getLogPlugins().keys();
+ Enumeration<String> e = mSys.getLogPlugins().keys();
while (e.hasMoreElements()) {
String name = (String) e.nextElement();
@@ -1304,7 +1305,7 @@ public class LogAdminServlet extends AdminServlet {
// first check if any instances from this log
// DON'T remove log if any instance
- for (Enumeration e = mSys.getLogInsts().keys();
+ for (Enumeration<String> e = mSys.getLogInsts().keys();
e.hasMoreElements();) {
String name = (String) e.nextElement();
ILogEventListener log = mSys.getLogInstance(name);
@@ -1559,7 +1560,7 @@ public class LogAdminServlet extends AdminServlet {
ILogEventListener oldinst =
(ILogEventListener) mSys.getLogInstance(id);
- Vector oldConfigParms = oldinst.getInstanceParams();
+ Vector<String> oldConfigParms = oldinst.getInstanceParams();
NameValuePairs saveParams = new NameValuePairs();
// implName is always required so always include it it.
@@ -1585,7 +1586,7 @@ public class LogAdminServlet extends AdminServlet {
// create new substore.
- Vector configParams = mSys.getLogInstanceParams(id);
+ Vector<String> configParams = mSys.getLogInstanceParams(id);
//instancesConfig.removeSubStore(id);
@@ -2204,7 +2205,7 @@ public class LogAdminServlet extends AdminServlet {
return;
}
- Vector configParams = mSys.getLogDefaultParams(implname);
+ Vector<String> configParams = mSys.getLogDefaultParams(implname);
NameValuePairs params = new NameValuePairs();
// implName is always required so always send it.
@@ -2250,7 +2251,7 @@ public class LogAdminServlet extends AdminServlet {
ILogEventListener logInst = (ILogEventListener)
mSys.getLogInstance(id);
- Vector configParams = logInst.getInstanceParams();
+ Vector<String> configParams = logInst.getInstanceParams();
NameValuePairs params = new NameValuePairs();
params.add(Constants.PR_LOG_IMPL_NAME,
@@ -2276,7 +2277,7 @@ public class LogAdminServlet extends AdminServlet {
store.removeSubStore(id);
IConfigStore rstore = store.makeSubStore(id);
- Enumeration keys = saveParams.getNames();
+ Enumeration<String> keys = saveParams.getNames();
while (keys.hasMoreElements()) {
String key = (String) keys.nextElement();
@@ -2329,11 +2330,12 @@ public class LogAdminServlet extends AdminServlet {
HttpServletResponse resp) throws ServletException,
IOException, EBaseException {
- Enumeration enum1 = req.getParameterNames();
+ @SuppressWarnings("unchecked")
+ Enumeration<String> enum1 = req.getParameterNames();
boolean restart = false;
while (enum1.hasMoreElements()) {
- String key = (String) enum1.nextElement();
+ String key = enum1.nextElement();
String value = req.getParameter(key);
if (key.equals(Constants.PR_DEBUG_LOG_ENABLE)) {