java/code/src/com/redhat/rhn/FaultException.java | 1
java/code/src/com/redhat/rhn/common/IllegalRegexException.java | 7
java/code/src/com/redhat/rhn/common/MethodInvocationException.java | 7
java/code/src/com/redhat/rhn/common/ObjectCreateWrapperException.java | 7
java/code/src/com/redhat/rhn/common/RhnRuntimeException.java | 2
java/code/src/com/redhat/rhn/common/client/ClientCertificate.java | 25 +-
java/code/src/com/redhat/rhn/common/client/InvalidCertificateException.java | 7
java/code/src/com/redhat/rhn/common/client/Member.java | 8
java/code/src/com/redhat/rhn/common/conf/Config.java | 21 -
java/code/src/com/redhat/rhn/common/conf/ConfigException.java | 7
java/code/src/com/redhat/rhn/common/db/BindVariableNotFoundException.java | 7
java/code/src/com/redhat/rhn/common/db/ConstraintViolationException.java | 5
java/code/src/com/redhat/rhn/common/db/DatabaseException.java | 7
java/code/src/com/redhat/rhn/common/db/WrappedSQLException.java | 7
java/code/src/com/redhat/rhn/common/filediff/Diff.java | 20 -
java/code/src/com/redhat/rhn/common/filediff/Differ.java | 6
java/code/src/com/redhat/rhn/common/filediff/FileLines.java | 6
java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java | 15 -
java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java | 27 +-
java/code/src/com/redhat/rhn/common/filediff/Trace.java | 4
java/code/src/com/redhat/rhn/common/filediff/test/DiffTest.java | 19 -
java/code/src/com/redhat/rhn/common/finder/FileFinder.java | 16 -
java/code/src/com/redhat/rhn/common/finder/Finder.java | 4
java/code/src/com/redhat/rhn/common/finder/JarFinder.java | 17 -
java/code/src/com/redhat/rhn/common/finder/test/FileFinderTest.java | 8
java/code/src/com/redhat/rhn/common/finder/test/JarFinderTest.java | 6
java/code/src/com/redhat/rhn/common/hibernate/ConnectionManager.java | 37 +--
java/code/src/com/redhat/rhn/common/hibernate/EmptyVarcharInterceptor.java | 2
java/code/src/com/redhat/rhn/domain/action/ActionFactory.java | 113
+++++-----
29 files changed, 227 insertions(+), 191 deletions(-)
New commits:
commit 267533f3e37b179404548c481bed31db707fa3b4
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Nov 28 17:01:45 2012 -0500
Some more type-safety / checkstyle fixes
diff --git a/java/code/src/com/redhat/rhn/FaultException.java
b/java/code/src/com/redhat/rhn/FaultException.java
index f6d124a..03cd282 100644
--- a/java/code/src/com/redhat/rhn/FaultException.java
+++ b/java/code/src/com/redhat/rhn/FaultException.java
@@ -23,6 +23,7 @@ import com.redhat.rhn.common.localization.LocalizationService;
*/
public class FaultException extends RuntimeException {
+ private static final long serialVersionUID = -8293171315924454538L;
protected int errorCode;
protected String label;
protected Object [] arguments;
diff --git a/java/code/src/com/redhat/rhn/common/IllegalRegexException.java
b/java/code/src/com/redhat/rhn/common/IllegalRegexException.java
index 060febf..77a8c3f 100644
--- a/java/code/src/com/redhat/rhn/common/IllegalRegexException.java
+++ b/java/code/src/com/redhat/rhn/common/IllegalRegexException.java
@@ -27,11 +27,12 @@ package com.redhat.rhn.common;
*/
public class IllegalRegexException extends RhnRuntimeException {
+ private static final long serialVersionUID = -8547335837561868429L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -40,7 +41,7 @@ public class IllegalRegexException extends RhnRuntimeException {
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/MethodInvocationException.java
b/java/code/src/com/redhat/rhn/common/MethodInvocationException.java
index fd7cf75..97aaca9 100644
--- a/java/code/src/com/redhat/rhn/common/MethodInvocationException.java
+++ b/java/code/src/com/redhat/rhn/common/MethodInvocationException.java
@@ -27,11 +27,12 @@ package com.redhat.rhn.common;
*/
public class MethodInvocationException extends RhnRuntimeException {
+ private static final long serialVersionUID = -7750203321709785033L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -40,7 +41,7 @@ public class MethodInvocationException extends RhnRuntimeException {
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/ObjectCreateWrapperException.java
b/java/code/src/com/redhat/rhn/common/ObjectCreateWrapperException.java
index ebf6b24..6a0a410 100644
--- a/java/code/src/com/redhat/rhn/common/ObjectCreateWrapperException.java
+++ b/java/code/src/com/redhat/rhn/common/ObjectCreateWrapperException.java
@@ -27,11 +27,12 @@ package com.redhat.rhn.common;
*/
public class ObjectCreateWrapperException extends RhnRuntimeException {
+ private static final long serialVersionUID = -7377470979935659066L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -40,7 +41,7 @@ public class ObjectCreateWrapperException extends RhnRuntimeException
{
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/RhnRuntimeException.java
b/java/code/src/com/redhat/rhn/common/RhnRuntimeException.java
index 60a7582..1a0f515 100644
--- a/java/code/src/com/redhat/rhn/common/RhnRuntimeException.java
+++ b/java/code/src/com/redhat/rhn/common/RhnRuntimeException.java
@@ -30,6 +30,8 @@ package com.redhat.rhn.common;
*/
public class RhnRuntimeException extends RuntimeException {
+ private static final long serialVersionUID = -995137119395700757L;
+
/**
*
*/
diff --git a/java/code/src/com/redhat/rhn/common/client/ClientCertificate.java
b/java/code/src/com/redhat/rhn/common/client/ClientCertificate.java
index 0e1a98f..2d26b55 100644
--- a/java/code/src/com/redhat/rhn/common/client/ClientCertificate.java
+++ b/java/code/src/com/redhat/rhn/common/client/ClientCertificate.java
@@ -36,9 +36,9 @@ public class ClientCertificate {
public static final String SYSTEM_ID = "system_id";
public static final String FIELDS = "fields";
- private List members;
- private Map byName;
- private Map checksumFields;
+ private final List<Member> members;
+ private final Map<String, String[]> byName;
+ private final Map<String, String> checksumFields;
/**
@@ -46,10 +46,10 @@ public class ClientCertificate {
*/
public ClientCertificate() {
- members = new ArrayList();
- byName = new HashMap();
+ members = new ArrayList<Member>();
+ byName = new HashMap<String, String[]>();
// boy this is some ugly stuff
- checksumFields = new HashMap();
+ checksumFields = new HashMap<String, String>();
checksumFields.put("username", "");
checksumFields.put("os_release", "");
checksumFields.put("operating_system", "");
@@ -112,7 +112,7 @@ public class ClientCertificate {
* @return all the values for the given field name
*/
public String[] getValuesByName(String name) {
- return (String[]) byName.get(name);
+ return byName.get(name);
}
/**
@@ -185,11 +185,11 @@ public class ClientCertificate {
}
catch (UnsupportedEncodingException e) {
throw new InvalidCertificateException(
- "Problem getting bytes for signature", e);
+ "Problem getting bytes for signature", e);
}
catch (NoSuchAlgorithmException e) {
throw new InvalidCertificateException(
- "Problem getting MD5 message digest.", e);
+ "Problem getting MD5 message digest.", e);
}
return signature;
@@ -209,12 +209,12 @@ public class ClientCertificate {
param.addBody(value);
value.addBody(struct);
- for (Iterator itr = members.iterator(); itr.hasNext();) {
- Member m = (Member)itr.next();
+ for (Iterator<Member> itr = members.iterator(); itr.hasNext();) {
+ Member m = itr.next();
if (!m.getName().equals(FIELDS)) {
String[] values = m.getValues();
struct.addBody(createStringMember(m.getName(),
- (values != null && values.length > 0) ? values[0] :
""));
+ (values != null && values.length > 0) ? values[0] :
""));
}
else {
struct.addBody(createFieldMember(m.getName(), m.getValues()));
@@ -226,6 +226,7 @@ public class ClientCertificate {
/**
* {@inheritDoc}
*/
+ @Override
public String toString() {
return asXml();
}
diff --git a/java/code/src/com/redhat/rhn/common/client/InvalidCertificateException.java
b/java/code/src/com/redhat/rhn/common/client/InvalidCertificateException.java
index 58e9528..c9f6a43 100644
--- a/java/code/src/com/redhat/rhn/common/client/InvalidCertificateException.java
+++ b/java/code/src/com/redhat/rhn/common/client/InvalidCertificateException.java
@@ -27,11 +27,12 @@ package com.redhat.rhn.common.client;
*/
public class InvalidCertificateException extends Exception {
+ private static final long serialVersionUID = 4549595184117258582L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -40,7 +41,7 @@ public class InvalidCertificateException extends Exception {
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/client/Member.java
b/java/code/src/com/redhat/rhn/common/client/Member.java
index bf82e71..9137c24 100644
--- a/java/code/src/com/redhat/rhn/common/client/Member.java
+++ b/java/code/src/com/redhat/rhn/common/client/Member.java
@@ -24,14 +24,14 @@ import java.util.List;
public class Member {
private String name;
- private List values;
+ private List<String> values;
/**
* Public ctor
*/
public Member() {
name = "";
- values = new ArrayList();
+ values = new ArrayList<String>();
}
/**
@@ -55,7 +55,7 @@ public class Member {
* @return the values.
*/
public String[] getValues() {
- return (String[])values.toArray(new String[values.size()]);
+ return values.toArray(new String[values.size()]);
}
/**
@@ -70,7 +70,7 @@ public class Member {
* Replace all values with the new list of values.
* @param valuesLst used to replace current list.
*/
- public void setValues(List valuesLst) {
+ public void setValues(List<String> valuesLst) {
values = valuesLst;
}
}
diff --git a/java/code/src/com/redhat/rhn/common/conf/Config.java
b/java/code/src/com/redhat/rhn/common/conf/Config.java
index c740834..d37f69f 100644
--- a/java/code/src/com/redhat/rhn/common/conf/Config.java
+++ b/java/code/src/com/redhat/rhn/common/conf/Config.java
@@ -77,15 +77,16 @@ public class Config {
* array of prefix in the order they should be search
* if the given lookup string is without a namespace.
*/
- private String[] prefixOrder = new String[] {"web", "server"};
+ private final String[] prefixOrder = new String[] {"web",
"server"};
private static Config singletonConfig = null;
/** hash of configuration properties */
- private Properties configValues = new Properties();
+ private final Properties configValues = new Properties();
/** set of configuration file names */
- private TreeSet fileList = new TreeSet(new Comparator() {
+ private final TreeSet<File> fileList = new TreeSet<File>(new Comparator()
{
/** {inheritDoc} */
- public int compare(Object o1, Object o2) {
+ @Override
+ public int compare(Object o1, Object o2) {
// Need to make sure we read the child namespace before the base
// namespace. To do that, we sort the list in reverse order based
// on the length of the file name. If two filenames have the same
@@ -215,7 +216,7 @@ public class Config {
if (result != null) {
break;
}
- }
+ }
}
}
if (logger.isDebugEnabled()) {
@@ -308,8 +309,8 @@ public class Config {
* @param name config entry name
* @return instance of java.util.List populated with config values
*/
- public List getList(String name) {
- List retval = new LinkedList();
+ public List<String> getList(String name) {
+ List<String> retval = new LinkedList<String>();
String[] vals = getStringArray(name);
if (vals != null) {
retval.addAll(Arrays.asList(vals));
@@ -443,8 +444,8 @@ public class Config {
* Parse all of the added files.
*/
public void parseFiles() {
- for (Iterator i = fileList.iterator(); i.hasNext();) {
- File curr = (File) i.next();
+ for (Iterator<File> i = fileList.iterator(); i.hasNext();) {
+ File curr = i.next();
Properties props = new Properties();
try {
@@ -455,7 +456,7 @@ public class Config {
}
String ns = makeNamespace(curr);
logger.debug("Adding namespace: " + ns + " for file: " +
- curr.getAbsolutePath());
+ curr.getAbsolutePath());
// loop through all of the config values in the properties file
// making sure the prefix is there.
diff --git a/java/code/src/com/redhat/rhn/common/conf/ConfigException.java
b/java/code/src/com/redhat/rhn/common/conf/ConfigException.java
index a65654c..ba9727f 100644
--- a/java/code/src/com/redhat/rhn/common/conf/ConfigException.java
+++ b/java/code/src/com/redhat/rhn/common/conf/ConfigException.java
@@ -29,11 +29,12 @@ import com.redhat.rhn.common.RhnRuntimeException;
*/
public class ConfigException extends RhnRuntimeException {
+ private static final long serialVersionUID = 8090115133541595876L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -42,7 +43,7 @@ public class ConfigException extends RhnRuntimeException {
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/db/BindVariableNotFoundException.java
b/java/code/src/com/redhat/rhn/common/db/BindVariableNotFoundException.java
index 9c990ca..6de629a 100644
--- a/java/code/src/com/redhat/rhn/common/db/BindVariableNotFoundException.java
+++ b/java/code/src/com/redhat/rhn/common/db/BindVariableNotFoundException.java
@@ -27,11 +27,12 @@ package com.redhat.rhn.common.db;
*/
public class BindVariableNotFoundException extends DatabaseException {
+ private static final long serialVersionUID = 1838264161671802774L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -40,7 +41,7 @@ public class BindVariableNotFoundException extends DatabaseException {
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/db/ConstraintViolationException.java
b/java/code/src/com/redhat/rhn/common/db/ConstraintViolationException.java
index d490d7e..f97159e 100644
--- a/java/code/src/com/redhat/rhn/common/db/ConstraintViolationException.java
+++ b/java/code/src/com/redhat/rhn/common/db/ConstraintViolationException.java
@@ -27,13 +27,14 @@ package com.redhat.rhn.common.db;
*/
public class ConstraintViolationException extends DatabaseException {
+ private static final long serialVersionUID = 8280712690008736370L;
protected int constraintType;
protected String constraint;
/////////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param type constraint type
* @param name constraint name
@@ -47,7 +48,7 @@ public class ConstraintViolationException extends DatabaseException {
this.constraint = name;
}
- /**
+ /**
* Constructor
* @param type constraint type
* @param name constraint name
diff --git a/java/code/src/com/redhat/rhn/common/db/DatabaseException.java
b/java/code/src/com/redhat/rhn/common/db/DatabaseException.java
index e40b025..6a114af 100644
--- a/java/code/src/com/redhat/rhn/common/db/DatabaseException.java
+++ b/java/code/src/com/redhat/rhn/common/db/DatabaseException.java
@@ -30,11 +30,12 @@ import com.redhat.rhn.common.RhnRuntimeException;
*/
public class DatabaseException extends RhnRuntimeException {
+ private static final long serialVersionUID = -4010657878416571239L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -43,7 +44,7 @@ public class DatabaseException extends RhnRuntimeException {
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/db/WrappedSQLException.java
b/java/code/src/com/redhat/rhn/common/db/WrappedSQLException.java
index ea1e9c2..a574b67 100644
--- a/java/code/src/com/redhat/rhn/common/db/WrappedSQLException.java
+++ b/java/code/src/com/redhat/rhn/common/db/WrappedSQLException.java
@@ -27,11 +27,12 @@ package com.redhat.rhn.common.db;
*/
public class WrappedSQLException extends DatabaseException {
+ private static final long serialVersionUID = 8956678868060075067L;
- /////////////////////////
+ // ///////////////////////
// Constructors
/////////////////////////
- /**
+ /**
* Constructor
* @param message exception message
*/
@@ -40,7 +41,7 @@ public class WrappedSQLException extends DatabaseException {
// begin member variable initialization
}
- /**
+ /**
* Constructor
* @param message exception message
* @param cause the cause (which is saved for later retrieval
diff --git a/java/code/src/com/redhat/rhn/common/filediff/Diff.java
b/java/code/src/com/redhat/rhn/common/filediff/Diff.java
index 09edfbc..1357f90 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/Diff.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/Diff.java
@@ -26,9 +26,9 @@ import java.util.List;
*/
public class Diff {
- private String[] firstfile;
- private String[] secondfile;
- private int maxLength;
+ private final String[] firstfile;
+ private final String[] secondfile;
+ private final int maxLength;
/**
* @param firstfileIn The old(from) file as a String array.
@@ -48,7 +48,7 @@ public class Diff {
*/
public String htmlDiff(boolean onlyChanged) {
//do the file diff
- List hunks = diffFiles();
+ List<Hunk> hunks = diffFiles();
if (hunks == null) {
return null;
}
@@ -71,13 +71,13 @@ public class Diff {
public String patchDiff(String pathOne, String pathTwo,
Date fromDate, Date toDate) {
//do the file diff
- List hunks = diffFiles();
+ List<Hunk> hunks = diffFiles();
if (hunks == null) {
return null;
}
RhnPatchDiffWriter writer =
- new RhnPatchDiffWriter(pathOne, pathTwo, fromDate, toDate);
+ new RhnPatchDiffWriter(pathOne, pathTwo, fromDate, toDate);
writeHunks(hunks, writer);
return writer.getResult();
}
@@ -87,15 +87,15 @@ public class Diff {
* @return A list of Hunks.
* @see Hunk
*/
- public List diffFiles() {
+ public List<Hunk> diffFiles() {
Differ differ = new Differ(firstfile.length, secondfile.length);
return differ.diff(firstfile, secondfile);
}
- private void writeHunks(List hunks, DiffWriter writer) {
- Iterator i = hunks.iterator();
+ private void writeHunks(List<Hunk> hunks, DiffWriter writer) {
+ Iterator<Hunk> i = hunks.iterator();
while (i.hasNext()) {
- writer.writeHunk((Hunk)i.next());
+ writer.writeHunk(i.next());
}
}
diff --git a/java/code/src/com/redhat/rhn/common/filediff/Differ.java
b/java/code/src/com/redhat/rhn/common/filediff/Differ.java
index cc16091..879ee75 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/Differ.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/Differ.java
@@ -47,8 +47,8 @@ public class Differ {
* @param newFile The new(second, to) file
* @return A list of Hunks representing the differences.
*/
- public List diff(String[] oldFile, String[] newFile) {
- List retval = null;
+ public List<Hunk> diff(String[] oldFile, String[] newFile) {
+ List<Hunk> retval = null;
while (retval == null) {
retval = step(oldFile, newFile);
}
@@ -75,7 +75,7 @@ public class Differ {
* @return A list of Hunks representing the differences. null if we need to
* step again
*/
- private List step(String[] oldFile, String[] newFile) {
+ private List<Hunk> step(String[] oldFile, String[] newFile) {
beforeCurrent = head;
boolean forked;
int minimumMatchValue = 0;
diff --git a/java/code/src/com/redhat/rhn/common/filediff/FileLines.java
b/java/code/src/com/redhat/rhn/common/filediff/FileLines.java
index 6680a47..147ca9f 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/FileLines.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/FileLines.java
@@ -23,7 +23,7 @@ import java.util.List;
*/
public class FileLines {
- private List lines;
+ private final List<String> lines;
private int fromLine;
private int toLine;
@@ -31,7 +31,7 @@ public class FileLines {
* Can only be created in this package.
*/
protected FileLines() {
- lines = new ArrayList();
+ lines = new ArrayList<String>();
}
@@ -70,7 +70,7 @@ public class FileLines {
/**
* @return Returns the lines.
*/
- public List getLines() {
+ public List<String> getLines() {
return lines;
}
diff --git a/java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java
b/java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java
index 8f3d8b9..245abcb 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java
@@ -29,9 +29,9 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
private static final int CHARS_PER_LINE = 40;
- private StringBuffer oldfile;
- private StringBuffer newfile;
- private NumberFormat formatter;
+ private final StringBuffer oldfile;
+ private final StringBuffer newfile;
+ private final NumberFormat formatter;
private boolean onlyChanged;
@@ -53,6 +53,7 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
+ @Override
public void writeHunk(Hunk hunk) {
hunk.visit(this);
}
@@ -60,6 +61,7 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
+ @Override
public void accept(ChangeHunk hunk) {
printStartDiv("changed");
int numOld = printLines(oldfile, hunk.getOldLines());
@@ -78,6 +80,7 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
+ @Override
public void accept(DeleteHunk hunk) {
printStartDiv("deleted");
int numlines = printLines(oldfile, hunk.getOldLines());
@@ -92,6 +95,7 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
+ @Override
public void accept(MatchHunk hunk) {
if (!onlyChanged) {
printLines(oldfile, hunk.getOldLines());
@@ -107,6 +111,7 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
+ @Override
public void accept(InsertHunk hunk) {
printStartDiv("inserted");
int numlines = printLines(newfile, hunk.getNewLines());
@@ -119,11 +124,11 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
}
private int printLines(StringBuffer buffy, FileLines block) {
- Iterator i = block.getLines().iterator();
+ Iterator<String> i = block.getLines().iterator();
int numWritten = 0;
int linenum = block.getFromLine();
while (i.hasNext()) {
- String line = (String)i.next();
+ String line = i.next();
buffy.append(formatter.format(linenum));
buffy.append(" ");
while (line.length() > CHARS_PER_LINE) {
diff --git a/java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java
b/java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java
index b315494..a346b2f 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java
@@ -32,8 +32,8 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
private static final String HUNK_LABEL = "@@";
//diff the entire result
- private StringBuffer diff;
- private int contextLines;
+ private final StringBuffer diff;
+ private final int contextLines;
//stores the current edit, which can consist of multiple hunks with context lines.
private EditPoint currentEdit;
@@ -75,6 +75,7 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
+ @Override
public void writeHunk(Hunk hunkIn) {
hunkIn.visit(this);
}
@@ -82,6 +83,7 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
+ @Override
public void accept(ChangeHunk hunk) {
processEditHunk(hunk);
}
@@ -89,6 +91,7 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
+ @Override
public void accept(DeleteHunk hunk) {
processEditHunk(hunk);
}
@@ -96,6 +99,7 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
+ @Override
public void accept(InsertHunk hunk) {
processEditHunk(hunk);
}
@@ -118,30 +122,31 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter
{
newEndLine = hunk.getNewLines().getToLine();
}
- private void addEditLines(List lines, char edit) {
+ private void addEditLines(List<String> lines, char edit) {
//adding lines to the edit.
- Iterator i = lines.iterator();
+ Iterator<String> i = lines.iterator();
while (i.hasNext()) {
- currentEdit.addLine((String)i.next(), edit);
+ currentEdit.addLine(i.next(), edit);
}
}
/**
* {@inheritDoc}
*/
+ @Override
public void accept(MatchHunk hunk) {
int startLine = hunk.getOldLines().getFromLine();
int endLine = hunk.getOldLines().getToLine();
int numLines = endLine - startLine;
//Get the matching lines.
- Iterator lines = hunk.getOldLines().getLines().iterator();
+ Iterator<String> lines = hunk.getOldLines().getLines().iterator();
int counter = 0;
if (currentEdit != null) { //There was an edit hunk before us.
//Add context after a previous edit.
while (lines.hasNext() && counter < contextLines) {
- currentEdit.addLine((String)lines.next(), MATCH_LABEL);
+ currentEdit.addLine(lines.next(), MATCH_LABEL);
counter++;
}
}
@@ -166,7 +171,7 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
}
while (lines.hasNext()) {
//add context before an edit.
- currentEdit.addLine((String)lines.next(), MATCH_LABEL);
+ currentEdit.addLine(lines.next(), MATCH_LABEL);
}
}
@@ -188,10 +193,10 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter
{
}
private class EditPoint {
- private int fromStart;
- private int toStart;
+ private final int fromStart;
+ private final int toStart;
private boolean writable;
- private StringBuffer lines;
+ private final StringBuffer lines;
/**
* @param fromLine Starting line for from file
diff --git a/java/code/src/com/redhat/rhn/common/filediff/Trace.java
b/java/code/src/com/redhat/rhn/common/filediff/Trace.java
index 1b872d2..adb15fa 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/Trace.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/Trace.java
@@ -202,13 +202,13 @@ public class Trace {
* @param newFile The new(second, to) file
* @return A list of hunks representing the edit to make oldFile into newFile.
*/
- public List createHunks(String[] oldFile, String[] newFile) {
+ public List<Hunk> createHunks(String[] oldFile, String[] newFile) {
//start at the beginning of both files.
currentLineOld = 0;
currentLineNew = 0;
int linesOld = 0;
int linesNew = 0;
- List retval = new ArrayList();
+ List<Hunk> retval = new ArrayList<Hunk>();
Edit current = edit;
while (current != null) {
diff --git a/java/code/src/com/redhat/rhn/common/filediff/test/DiffTest.java
b/java/code/src/com/redhat/rhn/common/filediff/test/DiffTest.java
index b0369b4..4e5fead 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/test/DiffTest.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/test/DiffTest.java
@@ -16,6 +16,7 @@ package com.redhat.rhn.common.filediff.test;
import com.redhat.rhn.common.filediff.ChangeHunk;
import com.redhat.rhn.common.filediff.Diff;
+import com.redhat.rhn.common.filediff.Hunk;
import com.redhat.rhn.common.filediff.InsertHunk;
import com.redhat.rhn.common.filediff.MatchHunk;
import com.redhat.rhn.testing.RhnBaseTestCase;
@@ -28,34 +29,34 @@ public class DiffTest extends RhnBaseTestCase {
public void testDiff() {
String[] testOld = {"one", "two", "three",
"four"};
String[] testNew = {"one", "too", "three",
"for"};
- Class[] testTypes = {MatchHunk.class, ChangeHunk.class,
- MatchHunk.class, ChangeHunk.class};
+ Class<?>[] testTypes = { MatchHunk.class, ChangeHunk.class,
+ MatchHunk.class, ChangeHunk.class};
checkDiff(testOld, testNew, testTypes);
String[] testOld1 = {"one", "two", "three",
"four"};
String[] testNew1 = {"one", "two", "too",
"three", "four", "for"};
- Class[] testTypes1 = {MatchHunk.class, InsertHunk.class,
- MatchHunk.class, InsertHunk.class};
+ Class<?>[] testTypes1 = { MatchHunk.class, InsertHunk.class,
+ MatchHunk.class, InsertHunk.class};
checkDiff(testOld1, testNew1, testTypes1);
String[] testOld2 = {"one", "two", "three",
"four"};
String[] testNew2 = {"one", "for"};
- Class[] testTypes2 = {MatchHunk.class, ChangeHunk.class};
+ Class<?>[] testTypes2 = { MatchHunk.class, ChangeHunk.class };
checkDiff(testOld2, testNew2, testTypes2);
}
public void testEmptyFiles() {
String[] testOld = new String[0];
String[] testNew = new String[0];
- Class[] testType = new Class[0];
+ Class<?>[] testType = new Class[0];
checkDiff(testOld, testNew, testType);
}
- private void checkDiff(String[] oldFile, String[] newFile, Class[] types) {
+ private void checkDiff(String[] oldFile, String[] newFile, Class<?>[] types) {
Diff diff = new Diff(oldFile, newFile);
- List hunks = diff.diffFiles();
+ List<Hunk> hunks = diff.diffFiles();
assertTrue(types.length == hunks.size());
- Iterator i = hunks.iterator();
+ Iterator<Hunk> i = hunks.iterator();
int a = 0;
while (i.hasNext()) {
assertTrue(types[a].isInstance(i.next()));
diff --git a/java/code/src/com/redhat/rhn/common/finder/FileFinder.java
b/java/code/src/com/redhat/rhn/common/finder/FileFinder.java
index 5c051b0..a0f0045 100644
--- a/java/code/src/com/redhat/rhn/common/finder/FileFinder.java
+++ b/java/code/src/com/redhat/rhn/common/finder/FileFinder.java
@@ -29,7 +29,7 @@ import java.util.List;
*/
class FileFinder implements Finder {
- private File startDir;
+ private final File startDir;
private static Logger log = Logger.getLogger(FileFinder.class);
private String path;
@@ -42,13 +42,15 @@ class FileFinder implements Finder {
}
/** {@inheritDoc} */
- public List find(String endStr) {
+ @Override
+ public List<String> find(String endStr) {
return findExcluding(null, endStr);
}
/** {@inheritDoc} */
- public List findExcluding(String[] excludes, String endStr) {
- List results = new LinkedList();
+ @Override
+ public List<String> findExcluding(String[] excludes, String endStr) {
+ List<String> results = new LinkedList<String>();
if (!startDir.exists()) {
// Shouldn't ever happen, because the FinderFactory should only
@@ -65,9 +67,9 @@ class FileFinder implements Finder {
File current = new File(startDir, fileList[i]);
if (current.isDirectory()) {
- List subdirList = new FileFinder(current,
- path + File.separator +
- fileList[i]).findExcluding(excludes, endStr);
+ List<String> subdirList = new FileFinder(current,
+ path + File.separator +
+ fileList[i]).findExcluding(excludes, endStr);
if (log.isDebugEnabled()) {
log.debug("adding: " + subdirList);
}
diff --git a/java/code/src/com/redhat/rhn/common/finder/Finder.java
b/java/code/src/com/redhat/rhn/common/finder/Finder.java
index 08dca81..c81604a 100644
--- a/java/code/src/com/redhat/rhn/common/finder/Finder.java
+++ b/java/code/src/com/redhat/rhn/common/finder/Finder.java
@@ -32,7 +32,7 @@ public interface Finder {
* @return a list of all classes within the package that end with the
* specified string
*/
- List find(String endStr);
+ List<String> find(String endStr);
/**
* Find all files within a package that end with the specified string
@@ -42,5 +42,5 @@ public interface Finder {
* @return a list of all classes within the package that end with the
* specified string
*/
- List findExcluding(String[] excluding, String endStr);
+ List<String> findExcluding(String[] excluding, String endStr);
}
diff --git a/java/code/src/com/redhat/rhn/common/finder/JarFinder.java
b/java/code/src/com/redhat/rhn/common/finder/JarFinder.java
index b8c43f7..fe2a33f 100644
--- a/java/code/src/com/redhat/rhn/common/finder/JarFinder.java
+++ b/java/code/src/com/redhat/rhn/common/finder/JarFinder.java
@@ -23,6 +23,7 @@ import java.net.URL;
import java.util.Enumeration;
import java.util.LinkedList;
import java.util.List;
+import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.ZipEntry;
@@ -34,29 +35,31 @@ import java.util.zip.ZipEntry;
class JarFinder implements Finder {
private static Logger log = Logger.getLogger(JarFinder.class);
- private URL url;
+ private final URL url;
JarFinder(URL packageUrl) {
url = packageUrl;
}
/** {@inheritDoc} */
- public List find(String endStr) {
+ @Override
+ public List<String> find(String endStr) {
return findExcluding(null, endStr);
}
/** {@inheritDoc} */
- public List findExcluding(String[] excludes, String endStr) {
+ @Override
+ public List<String> findExcluding(String[] excludes, String endStr) {
try {
JarURLConnection conn = (JarURLConnection)url.openConnection();
String starts = conn.getEntryName();
JarFile jfile = conn.getJarFile();
- List result = new LinkedList();
+ List<String> result = new LinkedList<String>();
- Enumeration e = jfile.entries();
+ Enumeration<JarEntry> e = jfile.entries();
while (e.hasMoreElements()) {
- ZipEntry entry = (ZipEntry)e.nextElement();
+ ZipEntry entry = e.nextElement();
String entryName = entry.getName();
if (log.isDebugEnabled()) {
@@ -64,7 +67,7 @@ class JarFinder implements Finder {
}
if (entryName.startsWith(starts) &&
- !entry.isDirectory()) {
+ !entry.isDirectory()) {
// Now we know that we have a file from the jar. We need
// to parse the file to get the actual filename so that we
// can exclude the appropriate files.
diff --git a/java/code/src/com/redhat/rhn/common/finder/test/FileFinderTest.java
b/java/code/src/com/redhat/rhn/common/finder/test/FileFinderTest.java
index 6f0fd12..5cb4546 100644
--- a/java/code/src/com/redhat/rhn/common/finder/test/FileFinderTest.java
+++ b/java/code/src/com/redhat/rhn/common/finder/test/FileFinderTest.java
@@ -31,8 +31,8 @@ public class FileFinderTest extends RhnBaseTestCase {
Finder f =
FinderFactory.getFinder("com.redhat.rhn.common.finder.test");
assertNotNull(f);
- List result = f.find("Test.class");
- String first = (String)result.get(0);
+ List<String> result = f.find("Test.class");
+ String first = result.get(0);
assertTrue(first.startsWith("com/redhat/rhn/common/finder/test"));
assertEquals(2, result.size());
}
@@ -41,7 +41,7 @@ public class FileFinderTest extends RhnBaseTestCase {
Finder f = FinderFactory.getFinder("com.redhat.rhn.common.finder");
assertNotNull(f);
- List result = f.find(".class");
+ List<String> result = f.find(".class");
assertEquals(6, result.size());
}
@@ -49,7 +49,7 @@ public class FileFinderTest extends RhnBaseTestCase {
Finder f = FinderFactory.getFinder("com.redhat.rhn.common.finder");
assertNotNull(f);
String[] sarr = {"Test"};
- List result = f.findExcluding(sarr, "class");
+ List<String> result = f.findExcluding(sarr, "class");
assertEquals(4, result.size());
}
}
diff --git a/java/code/src/com/redhat/rhn/common/finder/test/JarFinderTest.java
b/java/code/src/com/redhat/rhn/common/finder/test/JarFinderTest.java
index 8888acd..90df31b 100644
--- a/java/code/src/com/redhat/rhn/common/finder/test/JarFinderTest.java
+++ b/java/code/src/com/redhat/rhn/common/finder/test/JarFinderTest.java
@@ -31,7 +31,7 @@ public class JarFinderTest extends RhnBaseTestCase {
Finder f = FinderFactory.getFinder("redstone.xmlrpc");
assertNotNull(f);
- List result = f.find(".class");
+ List<String> result = f.find(".class");
assertEquals(28, result.size());
}
@@ -39,7 +39,7 @@ public class JarFinderTest extends RhnBaseTestCase {
Finder f = FinderFactory.getFinder("redstone.xmlrpc");
assertNotNull(f);
- List result = f.find("");
+ List<String> result = f.find("");
assertEquals(29, result.size());
}
@@ -49,7 +49,7 @@ public class JarFinderTest extends RhnBaseTestCase {
String[] sarr = {"End"};
- List result = f.findExcluding(sarr, "class");
+ List<String> result = f.findExcluding(sarr, "class");
assertEquals(28, result.size());
}
}
diff --git a/java/code/src/com/redhat/rhn/common/hibernate/ConnectionManager.java
b/java/code/src/com/redhat/rhn/common/hibernate/ConnectionManager.java
index 147da85..c059e1a 100644
--- a/java/code/src/com/redhat/rhn/common/hibernate/ConnectionManager.java
+++ b/java/code/src/com/redhat/rhn/common/hibernate/ConnectionManager.java
@@ -45,18 +45,20 @@ class ConnectionManager {
private static final Logger LOG = Logger.getLogger(ConnectionManager.class);
private static final String[] PACKAGE_NAMES = {"com.redhat.rhn.domain",
- "com.redhat.rhn.taskomatic"};
+ "com.redhat.rhn.taskomatic"};
- private List configurators = new LinkedList();
+ private final List<Configurator> configurators = new
LinkedList<Configurator>();
private SessionFactory sessionFactory;
- private ThreadLocal SESSION_TLS = new ThreadLocal() {
+ private final ThreadLocal<SessionInfo> SESSION_TLS = new
ThreadLocal<SessionInfo>() {
- public Object get() {
- Object result = super.get();
+ @Override
+ public SessionInfo get() {
+ SessionInfo result = super.get();
return result;
}
};
- private Set packageNames = new HashSet<String>(Arrays.asList(PACKAGE_NAMES));
+ private final Set<String> packageNames = new HashSet<String>(
+ Arrays.asList(PACKAGE_NAMES));
/**
* enable possibility to load hbm.xml files from different path
@@ -142,10 +144,10 @@ class ConnectionManager {
return;
}
- List hbms = new LinkedList();
+ List<String> hbms = new LinkedList<String>();
- for (Iterator iter = packageNames.iterator(); iter.hasNext();) {
- String pn = (String) iter.next();
+ for (Iterator<String> iter = packageNames.iterator(); iter.hasNext();) {
+ String pn = iter.next();
hbms.addAll(FinderFactory.getFinder(pn).find("hbm.xml"));
if (LOG.isDebugEnabled()) {
LOG.debug("Found: " + hbms);
@@ -162,13 +164,13 @@ class ConnectionManager {
Properties hibProperties = Config.get().getNamespaceProperties(
"hibernate");
hibProperties.put("hibernate.connection.username",
- Config.get()
+ Config.get()
.getString(ConfigDefaults.DB_USER));
hibProperties.put("hibernate.connection.password",
- Config.get()
+ Config.get()
.getString(ConfigDefaults.DB_PASSWORD));
String connectionUrl =
- Config.get().getString(ConfigDefaults.DB_PROTO) + ":";
+ Config.get().getString(ConfigDefaults.DB_PROTO) + ":";
String dbName = Config.get().getString(ConfigDefaults.DB_NAME);
String dbHost = Config.get().getString(ConfigDefaults.DB_HOST);
String dbPort = Config.get().getString(ConfigDefaults.DB_PORT);
@@ -200,16 +202,17 @@ class ConnectionManager {
" it is set to a fixed value by the code");
}
- for (Iterator i = hbms.iterator(); i.hasNext();) {
- String hbmFile = (String) i.next();
+ for (Iterator<String> i = hbms.iterator(); i.hasNext();) {
+ String hbmFile = i.next();
if (LOG.isDebugEnabled()) {
LOG.debug("Adding resource " + hbmFile);
}
config.addResource(hbmFile);
}
if (configurators != null) {
- for (Iterator i = configurators.iterator(); i.hasNext();) {
- Configurator c = (Configurator) i.next();
+ for (Iterator<Configurator> i = configurators.iterator(); i
+ .hasNext();) {
+ Configurator c = i.next();
c.addConfig(config);
}
}
@@ -227,7 +230,7 @@ class ConnectionManager {
}
private SessionInfo threadSessionInfo() {
- return (SessionInfo) SESSION_TLS.get();
+ return SESSION_TLS.get();
}
/**
diff --git a/java/code/src/com/redhat/rhn/common/hibernate/EmptyVarcharInterceptor.java
b/java/code/src/com/redhat/rhn/common/hibernate/EmptyVarcharInterceptor.java
index 4ea3073..45b9280 100644
--- a/java/code/src/com/redhat/rhn/common/hibernate/EmptyVarcharInterceptor.java
+++ b/java/code/src/com/redhat/rhn/common/hibernate/EmptyVarcharInterceptor.java
@@ -30,6 +30,8 @@ import java.io.Serializable;
*/
public class EmptyVarcharInterceptor extends EmptyInterceptor {
+ private static final long serialVersionUID = 5351605245345217308L;
+
private static final Logger LOG = Logger
.getLogger(EmptyVarcharInterceptor.class);
diff --git a/java/code/src/com/redhat/rhn/domain/action/ActionFactory.java
b/java/code/src/com/redhat/rhn/domain/action/ActionFactory.java
index 950dbb7..39df498 100644
--- a/java/code/src/com/redhat/rhn/domain/action/ActionFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/action/ActionFactory.java
@@ -97,8 +97,8 @@ public class ActionFactory extends HibernateFactory {
try {
session = HibernateFactory.getSession();
List types = session.getNamedQuery("ActionArchType.loadAll")
- //Retrieve from cache if there
- .setCacheable(true).list();
+ //Retrieve from cache if there
+ .setCacheable(true).list();
actionArchTypes = new HashSet();
Iterator i = types.iterator();
@@ -110,7 +110,7 @@ public class ActionFactory extends HibernateFactory {
catch (HibernateException he) {
log.error("Error loading ActionArchTypes from DB", he);
throw new
- HibernateRuntimeException("Error loading ActionArchTypes from
db");
+ HibernateRuntimeException("Error loading ActionArchTypes from
db");
}
}
}
@@ -124,7 +124,7 @@ public class ActionFactory extends HibernateFactory {
Session session = HibernateFactory.getSession();
List<Number> ids = session.getNamedQuery("Action.findServerIds")
- .setLong("action_id", actionId).list();
+ .setLong("action_id", actionId).list();
int failed = 0;
for (Number id : ids) {
try {
@@ -163,7 +163,7 @@ public class ActionFactory extends HibernateFactory {
private static void removeActionForSystem(Number actionId, Number sid) {
CallableMode mode =
- ModeFactory.getCallableMode("System_queries",
"delete_action_for_system");
+ ModeFactory.getCallableMode("System_queries",
"delete_action_for_system");
Map params = new HashMap();
params.put("action_id", actionId);
params.put("server_id", sid);
@@ -175,6 +175,7 @@ public class ActionFactory extends HibernateFactory {
* Get the Logger for the derived class so log messages
* show up on the correct class
*/
+ @Override
protected Logger getLogger() {
return log;
}
@@ -241,9 +242,9 @@ public class ActionFactory extends HibernateFactory {
sad.setScript(script.getBytes("UTF-8"));
}
catch (UnsupportedEncodingException uee) {
- throw new
- IllegalArgumentException(
- "This VM or environment doesn't support
UTF-8");
+ throw new
+ IllegalArgumentException(
+ "This VM or environment doesn't support UTF-8");
}
return sad;
@@ -257,7 +258,7 @@ public class ActionFactory extends HibernateFactory {
public static boolean doesServerHaveKickstartScheduled(Long serverId) {
Session session = HibernateFactory.getSession();
Query query =
-
session.getNamedQuery("ServerAction.findPendingKickstartsForServer");
+
session.getNamedQuery("ServerAction.findPendingKickstartsForServer");
query.setParameter("serverId", serverId);
query.setParameter("label", "kickstart.initiate");
List retval = query.list();
@@ -297,15 +298,15 @@ public class ActionFactory extends HibernateFactory {
retval = new ConfigUploadAction();
}
else if (typeIn.equals(TYPE_PACKAGES_AUTOUPDATE) ||
- typeIn.equals(TYPE_PACKAGES_DELTA) ||
- typeIn.equals(TYPE_PACKAGES_REFRESH_LIST) ||
- typeIn.equals(TYPE_PACKAGES_REMOVE) ||
- typeIn.equals(TYPE_PACKAGES_RUNTRANSACTION) ||
- typeIn.equals(TYPE_PACKAGES_UPDATE) ||
- typeIn.equals(TYPE_PACKAGES_VERIFY) ||
- typeIn.equals(TYPE_SOLARISPKGS_REMOVE) ||
- typeIn.equals(TYPE_SOLARISPKGS_INSTALL)) {
- retval = new PackageAction();
+ typeIn.equals(TYPE_PACKAGES_DELTA) ||
+ typeIn.equals(TYPE_PACKAGES_REFRESH_LIST) ||
+ typeIn.equals(TYPE_PACKAGES_REMOVE) ||
+ typeIn.equals(TYPE_PACKAGES_RUNTRANSACTION) ||
+ typeIn.equals(TYPE_PACKAGES_UPDATE) ||
+ typeIn.equals(TYPE_PACKAGES_VERIFY) ||
+ typeIn.equals(TYPE_SOLARISPKGS_REMOVE) ||
+ typeIn.equals(TYPE_SOLARISPKGS_INSTALL)) {
+ retval = new PackageAction();
}
else if (typeIn.equals(TYPE_CONFIGFILES_MTIME_UPLOAD)) {
retval = new ConfigUploadMtimeAction();
@@ -402,7 +403,7 @@ public class ActionFactory extends HibernateFactory {
params.put("aid", id);
params.put("orgId", user.getOrg().getId());
return (Action)singleton.lookupObjectByNamedQuery(
- "Action.findByIdandOrgId", params);
+ "Action.findByIdandOrgId", params);
}
/**
@@ -419,7 +420,7 @@ public class ActionFactory extends HibernateFactory {
params.put("aid", action.getId());
params.put("stid", status.getId());
return (Integer)singleton.lookupObjectByNamedQuery(
- "Action.getServerActionCountByStatus",
params);
+ "Action.getServerActionCountByStatus", params);
}
@@ -435,15 +436,15 @@ public class ActionFactory extends HibernateFactory {
* @return the Action found or null if none exists
*/
public static Action lookupLastCompletedAction(User user,
- ActionType type,
- Server server) {
+ ActionType type,
+ Server server) {
Map params = new HashMap();
params.put("userId", user.getId());
params.put("actionTypeId", type.getId());
params.put("serverId", server.getId());
return (Action)singleton.lookupObjectByNamedQuery(
-
"Action.findLastActionByServerIdAndActionTypeIdAndUserId",
- params);
+ "Action.findLastActionByServerIdAndActionTypeIdAndUserId",
+ params);
}
@@ -465,10 +466,10 @@ public class ActionFactory extends HibernateFactory {
* @throws Exception
*/
public static ActionType lookupActionTypeByLabel(String label) {
- Map params = new HashMap();
+ Map<String, String> params = new HashMap<String, String>();
params.put("label", label);
return (ActionType)
- singleton.lookupObjectByNamedQuery("ActionType.findByLabel",
params, true);
+ singleton.lookupObjectByNamedQuery("ActionType.findByLabel",
params, true);
}
/**
@@ -477,10 +478,10 @@ public class ActionFactory extends HibernateFactory {
* @return Returns the ActionStatus corresponding to name
*/
private static ActionStatus lookupActionStatusByName(String name) {
- Map params = new HashMap();
+ Map<String, String> params = new HashMap<String, String>();
params.put("name", name);
return (ActionStatus)
- singleton.lookupObjectByNamedQuery("ActionStatus.findByName",
params, true);
+ singleton.lookupObjectByNamedQuery("ActionStatus.findByName",
params, true);
}
@@ -492,12 +493,12 @@ public class ActionFactory extends HibernateFactory {
* @return The ConfigRevisionActionResult corresponding to the revison ID.
*/
public static ConfigRevisionActionResult
- lookupConfigActionResult(Long actionConfigRevisionId) {
- Map params = new HashMap();
+ lookupConfigActionResult(Long actionConfigRevisionId) {
+ Map<String, Object> params = new HashMap<String, Object>();
params.put("id", actionConfigRevisionId);
return (ConfigRevisionActionResult)
-
singleton.lookupObjectByNamedQuery("ConfigRevisionActionResult.findById",
- params, true);
+
singleton.lookupObjectByNamedQuery("ConfigRevisionActionResult.findById",
+ params, true);
}
/**
@@ -508,11 +509,11 @@ public class ActionFactory extends HibernateFactory {
* @return The ConfigRevisionAction corresponding to the revison ID.
*/
public static ConfigRevisionAction
- lookupConfigRevisionAction(Long id) {
+ lookupConfigRevisionAction(Long id) {
Session session = HibernateFactory.getSession();
ConfigRevisionAction c = (ConfigRevisionAction) session.
- get(ConfigRevisionAction.class, id);
+ get(ConfigRevisionAction.class, id);
return c;
}
@@ -527,12 +528,12 @@ public class ActionFactory extends HibernateFactory {
* the foreign key constraint holds.
*/
if (actionIn.getActionType().equals(TYPE_PACKAGES_AUTOUPDATE) ||
- actionIn.getActionType().equals(TYPE_PACKAGES_DELTA) ||
- actionIn.getActionType().equals(TYPE_PACKAGES_REFRESH_LIST) ||
- actionIn.getActionType().equals(TYPE_PACKAGES_REMOVE) ||
- actionIn.getActionType().equals(TYPE_PACKAGES_RUNTRANSACTION) ||
- actionIn.getActionType().equals(TYPE_PACKAGES_UPDATE) ||
- actionIn.getActionType().equals(TYPE_PACKAGES_VERIFY)) {
+ actionIn.getActionType().equals(TYPE_PACKAGES_DELTA) ||
+ actionIn.getActionType().equals(TYPE_PACKAGES_REFRESH_LIST) ||
+ actionIn.getActionType().equals(TYPE_PACKAGES_REMOVE) ||
+ actionIn.getActionType().equals(TYPE_PACKAGES_RUNTRANSACTION) ||
+ actionIn.getActionType().equals(TYPE_PACKAGES_UPDATE) ||
+ actionIn.getActionType().equals(TYPE_PACKAGES_VERIFY)) {
PackageAction action = (PackageAction) actionIn;
Set details = action.getDetails();
@@ -621,7 +622,7 @@ public class ActionFactory extends HibernateFactory {
Session session = HibernateFactory.getSession();
Query serverActionsToDelete =
- session.getNamedQuery("ServerAction.deleteByParentActions");
+ session.getNamedQuery("ServerAction.deleteByParentActions");
serverActionsToDelete.setParameterList("actions", parentActions);
serverActionsToDelete.executeUpdate();
}
@@ -636,7 +637,7 @@ public class ActionFactory extends HibernateFactory {
params.put("orgId", user.getOrg().getId());
params.put("server", serverIn);
return singleton.listObjectsByNamedQuery(
- "Action.findByServerAndOrgId",
params);
+ "Action.findByServerAndOrgId", params);
}
/**
@@ -648,7 +649,7 @@ public class ActionFactory extends HibernateFactory {
Map params = new HashMap();
params.put("server", serverIn);
return singleton.listObjectsByNamedQuery(
- "ServerAction.findByServer", params);
+ "ServerAction.findByServer", params);
}
/**
@@ -658,10 +659,10 @@ public class ActionFactory extends HibernateFactory {
*/
public static void rescheduleFailedServerActions(Action action, Long tries) {
HibernateFactory.getSession().getNamedQuery("Action.rescheduleFailedActions")
- .setParameter("action", action)
- .setParameter("tries", tries)
- .setParameter("failed", ActionFactory.STATUS_FAILED)
- .setParameter("queued",
ActionFactory.STATUS_QUEUED).executeUpdate();
+ .setParameter("action", action)
+ .setParameter("tries", tries)
+ .setParameter("failed", ActionFactory.STATUS_FAILED)
+ .setParameter("queued", ActionFactory.STATUS_QUEUED).executeUpdate();
}
/**
@@ -671,26 +672,26 @@ public class ActionFactory extends HibernateFactory {
*/
public static void rescheduleAllServerActions(Action action, Long tries) {
HibernateFactory.getSession().getNamedQuery("Action.rescheduleAllActions")
- .setParameter("action", action)
- .setParameter("tries", tries)
- .setParameter("queued",
ActionFactory.STATUS_QUEUED).executeUpdate();
+ .setParameter("action", action)
+ .setParameter("tries", tries)
+ .setParameter("queued", ActionFactory.STATUS_QUEUED).executeUpdate();
}
/**
- * The constant representing the Action Status QUEUED
- */
+ * The constant representing the Action Status QUEUED
+ */
public static final ActionStatus STATUS_QUEUED =
lookupActionStatusByName("Queued");
/**
- * The constant representing the Action Status COMPLETED
- */
+ * The constant representing the Action Status COMPLETED
+ */
public static final ActionStatus STATUS_COMPLETED =
lookupActionStatusByName("Completed");
/**
- * The constant representing the Action Status FAILED
- */
+ * The constant representing the Action Status FAILED
+ */
public static final ActionStatus STATUS_FAILED =
lookupActionStatusByName("Failed");