2 commits - rel-eng/packages spec-tree/dwr
by Tomas Lestach
rel-eng/packages/dwr | 1 +
spec-tree/dwr/build.py.props | 3 +++
spec-tree/dwr/dwr.spec | 36 ++++++++++++++++++++++++++++++++++++
3 files changed, 40 insertions(+)
New commits:
commit 17e6883f89df4cec8c4748b50986600124ecacec
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Thu Nov 29 14:00:23 2012 +0100
Automatic commit of package [dwr] minor release [3.0rc2-1].
diff --git a/rel-eng/packages/dwr b/rel-eng/packages/dwr
new file mode 100644
index 0000000..1c8f6e5
--- /dev/null
+++ b/rel-eng/packages/dwr
@@ -0,0 +1 @@
+3.0rc2-1 spec-tree/dwr/
diff --git a/spec-tree/dwr/dwr.spec b/spec-tree/dwr/dwr.spec
index cadf481..48f196a 100644
--- a/spec-tree/dwr/dwr.spec
+++ b/spec-tree/dwr/dwr.spec
@@ -30,4 +30,7 @@ install -m 644 %{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{versi
%changelog
+* Thu Nov 29 2012 Tomas Lestach <tlestach(a)redhat.com> 3.0rc2-1
+- initial dwr build
+
commit 4c64d72e698403a44f1ae64e8d85e6d7e7258945
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Thu Nov 29 13:35:03 2012 +0100
initial dwr build
diff --git a/spec-tree/dwr/build.py.props b/spec-tree/dwr/build.py.props
new file mode 100644
index 0000000..ccc90ea
--- /dev/null
+++ b/spec-tree/dwr/build.py.props
@@ -0,0 +1,3 @@
+[buildconfig]
+tagger = spacewalk.releng.tagger.ReleaseTagger
+
diff --git a/spec-tree/dwr/dwr.spec b/spec-tree/dwr/dwr.spec
new file mode 100644
index 0000000..cadf481
--- /dev/null
+++ b/spec-tree/dwr/dwr.spec
@@ -0,0 +1,33 @@
+Name: dwr
+Version: 3.0rc2
+Release: 1%{?dist}
+Summary: Direct Web Remoting
+Group: Development/Libraries/Java
+License: Apache Software License v2
+URL: http://directwebremoting.org
+Source0: %{name}-%{version}.tar.gz
+BuildArch: noarch
+
+Requires: java
+
+%description
+DWR is a Java library that enables Java on the server and JavaScript in a browser to interact and call each other as simply as possible.
+
+%prep
+%setup -q
+
+%build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT%{_javadir}
+install -m 644 %{name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
+(cd $RPM_BUILD_ROOT%{_javadir} && ln -sf %{name}-%{version}.jar %{name}.jar)
+
+%files
+%attr(0644,root,root) %{_javadir}/dwr-3.0rc2.jar
+%attr(0644,root,root) %{_javadir}/dwr.jar
+
+
+%changelog
+
10 years, 10 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java | 56 ++++++----
1 file changed, 34 insertions(+), 22 deletions(-)
New commits:
commit 54fa83c2691b75bee0598281f56a05b63aef1418
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Thu Nov 29 11:36:54 2012 +0100
851942 - copy GPG information from the original channel within
channel.software.clone API, when the user omits it
in case the user sets GPG info - even if empty - it will be used
diff --git a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
index 1c4995f..f091117 100644
--- a/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
+++ b/java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java
@@ -1937,28 +1937,6 @@ public class ChannelSoftwareHandler extends BaseHandler {
String archLabel = (String) channelDetails.get("arch_label");
String summary = (String) channelDetails.get("summary");
String description = (String) channelDetails.get("description");
- String gpgUrl;
- if (channelDetails.get("gpg_key_url") == null) {
- gpgUrl = (String) channelDetails.get("gpg_url");
- }
- else {
- gpgUrl = (String) channelDetails.get("gpg_key_url");
- }
- String gpgId;
- if ((String) channelDetails.get("gpg_key_id") == null) {
- gpgId = (String) channelDetails.get("gpg_id");
- }
- else {
- gpgId = (String) channelDetails.get("gpg_key_id");
- }
- String gpgFingerprint;
- if (channelDetails.get("gpg_key_fp") == null) {
- gpgFingerprint = (String) channelDetails.get("gpg_fingerprint");
- }
- else {
- gpgFingerprint = (String) channelDetails.get("gpg_key_fp");
- }
-
if (ChannelFactory.lookupByLabel(loggedInUser.getOrg(), label) != null) {
throw new DuplicateChannelLabelException(label);
@@ -1983,6 +1961,40 @@ public class ChannelSoftwareHandler extends BaseHandler {
arch = originalChan.getChannelArch();
}
+ String gpgUrl, gpgId, gpgFingerprint;
+ if (channelDetails.containsKey("gpg_key_url") ||
+ channelDetails.containsKey("gpg_url") ||
+ channelDetails.containsKey("gpg_key_id") ||
+ channelDetails.containsKey("gpg_id") ||
+ channelDetails.containsKey("gpg_key_fp") ||
+ channelDetails.containsKey("gpg_fingerprint")) {
+ // if one of the GPG information was set, use it
+ if (channelDetails.get("gpg_key_url") == null) {
+ gpgUrl = (String) channelDetails.get("gpg_url");
+ }
+ else {
+ gpgUrl = (String) channelDetails.get("gpg_key_url");
+ }
+ if ((String) channelDetails.get("gpg_key_id") == null) {
+ gpgId = (String) channelDetails.get("gpg_id");
+ }
+ else {
+ gpgId = (String) channelDetails.get("gpg_key_id");
+ }
+ if (channelDetails.get("gpg_key_fp") == null) {
+ gpgFingerprint = (String) channelDetails.get("gpg_fingerprint");
+ }
+ else {
+ gpgFingerprint = (String) channelDetails.get("gpg_key_fp");
+ }
+ }
+ else {
+ // copy GPG info from the original channel
+ gpgUrl = originalChan.getGPGKeyUrl();
+ gpgId = originalChan.getGPGKeyId();
+ gpgFingerprint = originalChan.getGPGKeyFp();
+ }
+
NewChannelHelper helper = new NewChannelHelper();
helper.setName(name);
helper.setArch(arch);
10 years, 10 months
java/code
by Tomáš Kašpárek
java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java | 3 +
java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml | 18 ++++++++++
java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp | 8 ++--
3 files changed, 26 insertions(+), 3 deletions(-)
New commits:
commit c3641e5dbecba58d471ad021b1a3b69433238a37
Author: Tomas Kasparek <tkasparek(a)redhat.com>
Date: Wed Nov 7 16:09:07 2012 +0100
OrgSoftwareSubscribtions CSV export
diff --git a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java b/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
index 28f3038..04307a8 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/multiorg/OrgSoftwareSubscriptionsAction.java
@@ -115,6 +115,9 @@ public class OrgSoftwareSubscriptionsAction extends RhnAction implements Listabl
request.getSession().removeAttribute(makeLabel(request));
}
}
+
+ request.setAttribute(RequestContext.PAGE_LIST, helper.getDataSet());
+
return retval;
}
diff --git a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
index 7ac0c31..102c04b 100644
--- a/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
+++ b/java/code/src/com/redhat/rhn/frontend/strings/jsp/StringResource_en_US.xml
@@ -18170,6 +18170,24 @@ given channel.</source>
<trans-unit id="provider">
<source>Content Provider</source>
</trans-unit>
+ <trans-unit id="currentMembers">
+ <source>Regular Usage - Used</source>
+ </trans-unit>
+ <trans-unit id="maxMembers">
+ <source>Regular Usage - Alloted</source>
+ </trans-unit>
+ <trans-unit id="maxAvailable">
+ <source>Regular Proposed Total</source>
+ </trans-unit>
+ <trans-unit id="currentFlex">
+ <source>Flex Usage - Used</source>
+ </trans-unit>
+ <trans-unit id="maxFlex">
+ <source>Flex Usage - Allotted</source>
+ </trans-unit>
+ <trans-unit id="maxAvailableFlex">
+ <source>Flex Proposed Total</source>
+ </trans-unit>
<trans-unit id="channel.jsp.package.viewpackages">
<source>View Packages</source>
</trans-unit>
diff --git a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
index 486dd0a..9085629 100644
--- a/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
+++ b/java/code/webapp/WEB-INF/pages/admin/multiorg/orgsoftwaresubs.jsp
@@ -46,7 +46,8 @@
<rhn:submitted/>
<input type="hidden" name="oid" value="${param.oid}"/>
- <rl:list
+ <rl:list dataset="pageList"
+ name="entitlement"
alphabarcolumn="name"
styleclass="list"
emptykey="orgsoftwaresubs.jsp.nochannelfams">
@@ -93,7 +94,6 @@
</rl:column>
<rl:column styleclass="center"
headertext="${rhn:localize('Flex Usage')} <br/>(${rhn:localize('Used/Allotted')})*">
-
<c:choose>
<c:when test="${empty current.maxFlex or current.maxFlex == 0}">
<bean:message key="None Allocated"/>
@@ -130,6 +130,9 @@
</c:choose>
</rl:column>
</rl:list>
+ <rl:csv dataset="pageList"
+ name="entitlement"
+ exportColumns="name,currentMembers,maxMembers,maxAvailable,currentFlex,maxFlex,maxAvailableFlex" />
<p><rhn:tooltip>*-<bean:message key = "Used/Allotted.tip"/></rhn:tooltip></p>
<c:if test="${param.oid != 1}">
<div align="right">
@@ -140,7 +143,6 @@
</rl:listset>
</div>
-
</body>
</html>
10 years, 10 months
java/code
by Tomas Lestach
java/code/src/com/redhat/rhn/common/conf/Config.java | 1 -
java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java | 5 -----
java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java | 5 -----
java/code/src/com/redhat/rhn/common/finder/FileFinder.java | 2 --
java/code/src/com/redhat/rhn/common/finder/JarFinder.java | 2 --
java/code/src/com/redhat/rhn/domain/user/UserFactory.java | 1 -
6 files changed, 16 deletions(-)
New commits:
commit c1a525cbedd270f298e45eb625b71a2a647395c5
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Thu Nov 29 10:50:44 2012 +0100
removing @Override annotation from methods that aren't overriden
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 d37f69f..dad76d3 100644
--- a/java/code/src/com/redhat/rhn/common/conf/Config.java
+++ b/java/code/src/com/redhat/rhn/common/conf/Config.java
@@ -85,7 +85,6 @@ public class Config {
private final TreeSet<File> fileList = new TreeSet<File>(new Comparator() {
/** {inheritDoc} */
- @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
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 245abcb..a997629 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/RhnHtmlDiffWriter.java
@@ -53,7 +53,6 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
- @Override
public void writeHunk(Hunk hunk) {
hunk.visit(this);
}
@@ -61,7 +60,6 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
- @Override
public void accept(ChangeHunk hunk) {
printStartDiv("changed");
int numOld = printLines(oldfile, hunk.getOldLines());
@@ -80,7 +78,6 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
- @Override
public void accept(DeleteHunk hunk) {
printStartDiv("deleted");
int numlines = printLines(oldfile, hunk.getOldLines());
@@ -95,7 +92,6 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
- @Override
public void accept(MatchHunk hunk) {
if (!onlyChanged) {
printLines(oldfile, hunk.getOldLines());
@@ -111,7 +107,6 @@ public class RhnHtmlDiffWriter implements DiffWriter, DiffVisitor {
/**
* {@inheritDoc}
*/
- @Override
public void accept(InsertHunk hunk) {
printStartDiv("inserted");
int numlines = printLines(newfile, hunk.getNewLines());
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 a346b2f..226696f 100644
--- a/java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java
+++ b/java/code/src/com/redhat/rhn/common/filediff/RhnPatchDiffWriter.java
@@ -75,7 +75,6 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
- @Override
public void writeHunk(Hunk hunkIn) {
hunkIn.visit(this);
}
@@ -83,7 +82,6 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
- @Override
public void accept(ChangeHunk hunk) {
processEditHunk(hunk);
}
@@ -91,7 +89,6 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
- @Override
public void accept(DeleteHunk hunk) {
processEditHunk(hunk);
}
@@ -99,7 +96,6 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
- @Override
public void accept(InsertHunk hunk) {
processEditHunk(hunk);
}
@@ -133,7 +129,6 @@ public class RhnPatchDiffWriter implements DiffVisitor, DiffWriter {
/**
* {@inheritDoc}
*/
- @Override
public void accept(MatchHunk hunk) {
int startLine = hunk.getOldLines().getFromLine();
int endLine = hunk.getOldLines().getToLine();
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 a0f0045..c859eb3 100644
--- a/java/code/src/com/redhat/rhn/common/finder/FileFinder.java
+++ b/java/code/src/com/redhat/rhn/common/finder/FileFinder.java
@@ -42,13 +42,11 @@ class FileFinder implements Finder {
}
/** {@inheritDoc} */
- @Override
public List<String> find(String endStr) {
return findExcluding(null, endStr);
}
/** {@inheritDoc} */
- @Override
public List<String> findExcluding(String[] excludes, String endStr) {
List<String> results = new LinkedList<String>();
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 fe2a33f..9d958e9 100644
--- a/java/code/src/com/redhat/rhn/common/finder/JarFinder.java
+++ b/java/code/src/com/redhat/rhn/common/finder/JarFinder.java
@@ -42,13 +42,11 @@ class JarFinder implements Finder {
}
/** {@inheritDoc} */
- @Override
public List<String> find(String endStr) {
return findExcluding(null, endStr);
}
/** {@inheritDoc} */
- @Override
public List<String> findExcluding(String[] excludes, String endStr) {
try {
JarURLConnection conn = (JarURLConnection)url.openConnection();
diff --git a/java/code/src/com/redhat/rhn/domain/user/UserFactory.java b/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
index 8d207d4..36e5808 100644
--- a/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
@@ -522,7 +522,6 @@ public class UserFactory extends HibernateFactory {
//All other timezones are sorted West to East based on raw off-set.
if (timeZones != null) {
Collections.sort(timeZones, new Comparator() {
- @Override
public int compare(Object o1, Object o2) {
int offSet1 = ((RhnTimeZone)o1).getTimeZone().getRawOffset();
int offSet2 = ((RhnTimeZone)o2).getTimeZone().getRawOffset();
10 years, 10 months
Changes to 'refs/tags/spacewalk-java-1.9.23-1'
by Tomas Lestach
Tag 'spacewalk-java-1.9.23-1' created by Tomas Lestach <tlestach(a)redhat.com> at 2012-11-29 09:42 +0000
Tagging package [spacewalk-java] version [1.9.23-1] in directory [java/].
Changes since spacewalk-java-1.9.22-1:
Stephen Herr (4):
876740 - server url auto-corrects common mistakes, messages say "Satellite"
876740 - fix typo
Fixing a bunch of type-safety and checkstyle warnings
Some more type-safety / checkstyle fixes
Tomas Lestach (2):
fix checkstyle issue
Automatic commit of package [spacewalk-java] release [1.9.23-1].
---
client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py | 36 -
client/rhel/rhn-client-tools/src/up2date_client/tui.py | 11
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/NamedPreparedStatement.java | 51 +
java/code/src/com/redhat/rhn/common/db/WrappedSQLException.java | 7
java/code/src/com/redhat/rhn/common/db/datasource/CachedStatement.java | 261 +++++-----
java/code/src/com/redhat/rhn/common/db/datasource/CallableMode.java | 3
java/code/src/com/redhat/rhn/common/db/datasource/DataResult.java | 28 -
java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java | 120 ++++
java/code/src/com/redhat/rhn/common/db/datasource/SelectMode.java | 26
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 ++--
java/code/src/com/redhat/rhn/domain/org/OrgFactory.java | 14
java/code/src/com/redhat/rhn/domain/user/UserFactory.java | 122 ++--
java/code/src/com/redhat/rhn/frontend/action/channel/manage/DeleteChannelAction.java | 19
java/spacewalk-java.spec | 7
rel-eng/packages/spacewalk-java | 2
42 files changed, 655 insertions(+), 463 deletions(-)
---
10 years, 10 months
2 commits - java/code java/spacewalk-java.spec rel-eng/packages
by Tomas Lestach
java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java | 15 ++++++++++
java/spacewalk-java.spec | 7 ++++
rel-eng/packages/spacewalk-java | 2 -
3 files changed, 22 insertions(+), 2 deletions(-)
New commits:
commit 5f003ebc2af57f46b33d7a0527be3345422f31ae
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Thu Nov 29 10:42:57 2012 +0100
Automatic commit of package [spacewalk-java] release [1.9.23-1].
diff --git a/java/spacewalk-java.spec b/java/spacewalk-java.spec
index 8071f0c..853d194 100644
--- a/java/spacewalk-java.spec
+++ b/java/spacewalk-java.spec
@@ -23,7 +23,7 @@ Name: spacewalk-java
Summary: Spacewalk Java site packages
Group: Applications/Internet
License: GPLv2
-Version: 1.9.22
+Version: 1.9.23
Release: 1%{?dist}
URL: https://fedorahosted.org/spacewalk
Source0: https://fedorahosted.org/releases/s/p/spacewalk/%{name}-%{version}.tar.gz
@@ -617,6 +617,11 @@ fi
%{jardir}/postgresql-jdbc.jar
%changelog
+* Thu Nov 29 2012 Tomas Lestach <tlestach(a)redhat.com> 1.9.23-1
+- fix checkstyle issue
+- Some more type-safety / checkstyle fixes
+- Fixing a bunch of type-safety and checkstyle warnings
+
* Wed Nov 28 2012 Tomas Lestach <tlestach(a)redhat.com> 1.9.22-1
- typo fix
- 519472 - suggest deleting custom packages after a channel is deleted
diff --git a/rel-eng/packages/spacewalk-java b/rel-eng/packages/spacewalk-java
index 310bd77..3ef4ff1 100644
--- a/rel-eng/packages/spacewalk-java
+++ b/rel-eng/packages/spacewalk-java
@@ -1 +1 @@
-1.9.22-1 java/
+1.9.23-1 java/
commit 967efbd67f1d712a530e631e8018633ad3eb9d20
Author: Tomas Lestach <tlestach(a)redhat.com>
Date: Thu Nov 29 09:56:08 2012 +0100
fix checkstyle issue
addressing:
./code/src/com/redhat/rhn/common/db/datasource/RestartData.java:1: Line does not match expected header line of '^/\*\*$'.
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java b/java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java
index a60a66d..d669ccd 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java
@@ -1,3 +1,18 @@
+/**
+ * Copyright (c) 2012 Red Hat, Inc.
+ *
+ * This software is licensed to you under the GNU General Public License,
+ * version 2 (GPLv2). There is NO WARRANTY for this software, express or
+ * implied, including the implied warranties of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
+ * along with this software; if not, see
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
+ *
+ * Red Hat trademarks are not licensed under GPLv2. No permission is
+ * granted to use or replicate Red Hat trademarks that are incorporated
+ * in this software or its documentation.
+ */
+
package com.redhat.rhn.common.db.datasource;
import java.util.List;
10 years, 10 months
java/code
by StephenHerr
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");
10 years, 10 months
java/code
by StephenHerr
java/code/src/com/redhat/rhn/common/db/NamedPreparedStatement.java | 51 +
java/code/src/com/redhat/rhn/common/db/datasource/CachedStatement.java | 261 +++++-----
java/code/src/com/redhat/rhn/common/db/datasource/CallableMode.java | 3
java/code/src/com/redhat/rhn/common/db/datasource/DataResult.java | 28 -
java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java | 105 ++++
java/code/src/com/redhat/rhn/common/db/datasource/SelectMode.java | 26
java/code/src/com/redhat/rhn/domain/org/OrgFactory.java | 14
java/code/src/com/redhat/rhn/domain/user/UserFactory.java | 122 ++--
java/code/src/com/redhat/rhn/frontend/action/channel/manage/DeleteChannelAction.java | 19
9 files changed, 379 insertions(+), 250 deletions(-)
New commits:
commit a88943f36f68303a924dc62780f8631d1b8db600
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Nov 28 15:28:32 2012 -0500
Fixing a bunch of type-safety and checkstyle warnings
diff --git a/java/code/src/com/redhat/rhn/common/db/NamedPreparedStatement.java b/java/code/src/com/redhat/rhn/common/db/NamedPreparedStatement.java
index 6eb1a0c..e21b393 100644
--- a/java/code/src/com/redhat/rhn/common/db/NamedPreparedStatement.java
+++ b/java/code/src/com/redhat/rhn/common/db/NamedPreparedStatement.java
@@ -73,7 +73,7 @@ public final class NamedPreparedStatement {
* @return a SQL statement that can be used with JDBC
*/
public static String replaceBindParams(String rawSQL,
- Map parameterMap) {
+ Map<String, List<Integer>> parameterMap) {
StringBuffer sql = new StringBuffer(rawSQL);
int idx = findColon(0, sql);
@@ -83,9 +83,9 @@ public final class NamedPreparedStatement {
String name = sql.substring(idx + 1, end).toLowerCase();
sql = sql.replace(idx, end, "?");
- List lst = (List)parameterMap.get(name);
+ List<Integer> lst = parameterMap.get(name);
if (lst == null) {
- lst = new ArrayList();
+ lst = new ArrayList<Integer>();
}
lst.add(new Integer(variableNumber));
parameterMap.put(name, lst);
@@ -107,8 +107,10 @@ public final class NamedPreparedStatement {
* @return true if CallableStatement executed without error, false otherwise.
* @throws RuntimeException in case of SQLException
*/
- public static boolean execute(CallableStatement cs, Map parameterMap,
- Map inParams, Map outParams) throws RuntimeException {
+ public static boolean execute(CallableStatement cs,
+ Map<String, List<Integer>> parameterMap,
+ Map<String, Object> inParams, Map<String, Integer> outParams)
+ throws RuntimeException {
try {
setVars(cs, parameterMap, inParams);
setOutputVars(cs, parameterMap, outParams);
@@ -131,8 +133,8 @@ public final class NamedPreparedStatement {
* @throws RuntimeException in case of SQLException
*/
public static boolean execute(PreparedStatement ps,
- Map parameterMap,
- Map parameters) {
+ Map<String, List<Integer>> parameterMap,
+ Map<String, Object> parameters) {
try {
setVars(ps, parameterMap, parameters);
return ps.execute();
@@ -162,26 +164,27 @@ public final class NamedPreparedStatement {
* @return The iterator for the list of data returned.
* @throws BindVariableNotFoundException couldn't find bind variable
*/
- public static Iterator getPositions(String name, Map parameterMap)
- throws BindVariableNotFoundException {
+ public static Iterator<Integer> getPositions(String name,
+ Map<String, List<Integer>> parameterMap)
+ throws BindVariableNotFoundException {
- List lst = (List)parameterMap.get(name.toLowerCase());
+ List<Integer> lst = parameterMap.get(name.toLowerCase());
if (lst == null) {
throw new BindVariableNotFoundException("Can't find variable: " +
- name);
+ name);
}
return lst.iterator();
}
- private static void setVars(PreparedStatement ps, Map parameterMap,
- Map map) {
- Iterator i = map.keySet().iterator();
+ private static void setVars(PreparedStatement ps,
+ Map<String, List<Integer>> parameterMap, Map<String, Object> map) {
+ Iterator<String> i = map.keySet().iterator();
while (i.hasNext()) {
- String name = (String)i.next();
- Iterator positions = getPositions(name, parameterMap);
+ String name = i.next();
+ Iterator<Integer> positions = getPositions(name, parameterMap);
while (positions.hasNext()) {
- Integer pos = (Integer)positions.next();
+ Integer pos = positions.next();
try {
Object value = map.get(name);
ps.setObject(pos.intValue(), value);
@@ -193,21 +196,21 @@ public final class NamedPreparedStatement {
}
}
- private static void setOutputVars(CallableStatement cs, Map parameterMap,
- Map map) {
- Iterator i = map.keySet().iterator();
+ private static void setOutputVars(CallableStatement cs,
+ Map<String, List<Integer>> parameterMap, Map<String, Integer> map) {
+ Iterator<String> i = map.keySet().iterator();
while (i.hasNext()) {
- String name = (String)i.next();
- Iterator positions = getPositions(name, parameterMap);
+ String name = i.next();
+ Iterator<Integer> positions = getPositions(name, parameterMap);
while (positions.hasNext()) {
- Integer pos = (Integer)positions.next();
+ Integer pos = positions.next();
try {
// JDBC sucks. It uses static int's instead of Integers
// to represent SQL types. So, we treat the values as
// Integers, and the caller is responsible for inserting
// the Integer object.
- Integer type = (Integer)map.get(name);
+ Integer type = map.get(name);
cs.registerOutParameter(pos.intValue(), type.intValue());
}
catch (SQLException e) {
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/CachedStatement.java b/java/code/src/com/redhat/rhn/common/db/datasource/CachedStatement.java
index 0b49f62..714868e 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/CachedStatement.java
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/CachedStatement.java
@@ -61,22 +61,22 @@ public class CachedStatement {
private static Logger log = Logger
.getLogger(CachedStatement.class);
static final int BATCH_SIZE = 500;
- private String alias;
- private String name;
+ private final String alias;
+ private final String name;
/** the original query, before the named bind parameters were removed. */
private String origQuery;
private String query;
private String column;
- private Map qMap;
- private List params;
- private List sortOptions;
+ private Map<String, List<Integer>> qMap;
+ private List<String> params;
+ private List<String> sortOptions;
private String defaultSort;
private String sortOrder;
private boolean multiple;
// This is only set if the current CachedStatement is a duplicate of an
// existing one with the %s expanded out.
private CachedStatement parentStatement;
- private List restartData = null;
+ private RestartData restartData = null;
// We could (and probably should) cache the ResultSet metadata here as
// well. There is no reason that the first call to each statement
@@ -90,8 +90,8 @@ public class CachedStatement {
public CachedStatement(String n, String a) {
name = n;
alias = a;
- params = new ArrayList();
- sortOptions = new ArrayList();
+ params = new ArrayList<String>();
+ sortOptions = new ArrayList<String>();
}
/**
@@ -125,8 +125,8 @@ public class CachedStatement {
this.column = new String(orig.column);
}
- this.params = new ArrayList(orig.params);
- this.sortOptions = new ArrayList(orig.sortOptions);
+ this.params = new ArrayList<String>(orig.params);
+ this.sortOptions = new ArrayList<String>(orig.sortOptions);
if (orig.defaultSort != null) {
this.defaultSort = new String(orig.defaultSort);
@@ -177,7 +177,7 @@ public class CachedStatement {
* @param q the query to set.
*/
public void setQuery(String q) {
- qMap = new HashMap();
+ qMap = new HashMap<String, List<Integer>>();
origQuery = q;
query = NamedPreparedStatement.replaceBindParams(q, qMap);
}
@@ -217,7 +217,7 @@ public class CachedStatement {
* Set the parameters.
* @param p the parameters to set.
*/
- public void setParams(List p) {
+ public void setParams(List<String> p) {
params.addAll(p);
}
@@ -239,7 +239,7 @@ public class CachedStatement {
* Set the parameters.
* @param p the parameters to set.
*/
- public void setSortOptions(List p) {
+ public void setSortOptions(List<String> p) {
sortOptions.addAll(p);
}
@@ -269,37 +269,40 @@ public class CachedStatement {
multiple = m;
}
- int executeUpdate(Map parameters) {
+ int executeUpdate(Map<String, Object> parameters) {
Integer res = (Integer)execute(query, qMap, parameters, null);
return res.intValue();
}
- int executeUpdate(Map parameters, List inClause) {
+ int executeUpdate(Map<String, Object> parameters, List<Object> inClause) {
Integer res = (Integer)execute(parameters, inClause, "", "", null);
return res.intValue();
}
- DataResult execute(Map parameters, Mode mode) {
+ DataResult<Object> execute(Map<String, Object> parameters, Mode mode) {
return execute(parameters, defaultSort, sortOrder, mode);
}
- DataResult execute(List parameters, Mode mode) {
- return (DataResult) execute(null, parameters, "", "", mode);
+ DataResult<Object> execute(List<Object> parameters, Mode mode) {
+ return (DataResult<Object>) execute(null, parameters, "", "", mode);
}
- DataResult execute(Map parameters, List inClause, Mode mode) {
- return (DataResult) execute(parameters, inClause, "", "", mode);
+ DataResult<Object> execute(Map<String, Object> parameters,
+ List<Object> inClause,
+ Mode mode) {
+ return (DataResult<Object>) execute(parameters, inClause, "", "", mode);
}
- Object execute(Map parameters, List inClause, String sortColumn,
- String order, Mode mode) {
+ Object execute(Map<String, Object> parameters, List<Object> inClause,
+ String sortColumn,
+ String order, Mode mode) {
if (query.indexOf("%o") > 0 && !sortOptions.contains(sortColumn)) {
throw new IllegalArgumentException("Sort Column, " + sortColumn +
- " invalid for query " + this);
+ " invalid for query " + this);
}
String finalQuery = query.replaceFirst("%o",
- sortColumn + " " + order);
+ sortColumn + " " + order);
if (query.indexOf("%s") > 0 &&
(inClause != null && !inClause.isEmpty())) {
@@ -339,14 +342,16 @@ public class CachedStatement {
return execute(finalQuery, qMap, parameters, mode);
}
- DataResult execute(Map parameters, String sortColumn,
- String order, Mode mode) {
- return (DataResult) execute(parameters, null, sortColumn, order, mode);
+ DataResult<Object> execute(Map<String, Object> parameters,
+ String sortColumn,
+ String order, Mode mode) {
+ return (DataResult<Object>) execute(parameters, null, sortColumn,
+ order, mode);
}
- Collection executeElaborator(List resultList, Mode mode,
- Map parametersIn) {
- List elaborated = new LinkedList();
+ Collection<Object> executeElaborator(List<Object> resultList, Mode mode,
+ Map<String, Object> parametersIn) {
+ List<Object> elaborated = new LinkedList<Object>();
for (int batch = 0; batch < resultList.size(); batch = batch + BATCH_SIZE) {
int toIndex = batch + BATCH_SIZE;
if (toIndex > resultList.size()) {
@@ -354,15 +359,17 @@ public class CachedStatement {
}
elaborated.addAll(
executeElaboratorBatch(resultList.subList(batch, toIndex),
- mode, parametersIn));
+ mode, parametersIn));
}
return elaborated;
}
- private Collection executeElaboratorBatch(List resultList, Mode mode,
- Map parametersIn) {
+ private Collection<Object> executeElaboratorBatch(List<Object> resultList,
+ Mode mode,
+ Map<String, Object> parametersIn) {
int len = resultList.size();
- Map parameters = new HashMap(parametersIn);
+ Map<String, Object> parameters = new HashMap<String, Object>(
+ parametersIn);
if (len == 0) {
// Nothing to elaborate, just return;
@@ -371,16 +378,16 @@ public class CachedStatement {
// If we aren't actually operating on a list, just elaborate.
if (origQuery.indexOf("%s") == -1) {
- return (DataResult)execute(query, qMap, parameters,
- mode, resultList);
+ return (DataResult<Object>) execute(query, qMap, parameters,
+ mode, resultList);
}
StringBuffer bindParams = new StringBuffer(":l0");
- List newParams = new ArrayList(params);
+ List<String> newParams = new ArrayList<String>(params);
if (!checkForColumn(resultList.get(0), column)) {
throw new MapColumnNotFoundException("Column, " + column +
- ", not found " +
- "in driving query results");
+ ", not found " +
+ "in driving query results");
}
parameters.put("l0", getKey(resultList.get(0), column));
@@ -409,16 +416,16 @@ public class CachedStatement {
return cs.executeElaboratorBatch(resultList, mode, parameters);
}
- private Map setupParamMap(Map parameters) {
+ private Map<String, Object> setupParamMap(Map<String, Object> parameters) {
if (parameters == null && !params.isEmpty()) {
throw new IllegalArgumentException("Query contains named parameter," +
" but value map is null");
}
// Only pass the parameters from the original query.
- HashMap intersection = new HashMap();
- Iterator i = params.iterator();
+ HashMap<String, Object> intersection = new HashMap<String, Object>();
+ Iterator<String> i = params.iterator();
while (i.hasNext()) {
- String curr = (String)i.next();
+ String curr = i.next();
if (!parameters.containsKey(curr)) {
throw new ParameterValueNotFoundException("Parameter '" + curr +
"' not given for query: " + query);
@@ -428,16 +435,16 @@ public class CachedStatement {
return intersection;
}
- private Object execute(String sql, Map parameterMap,
- Map parameters, Mode mode) {
- return execute(sql, parameterMap, parameters, mode, null);
+ private Object execute(String sql, Map<String, List<Integer>> parameterMap,
+ Map<String, Object> parameters, Mode mode) {
+ return execute(sql, parameterMap, parameters, mode, null);
}
// This isn't great, but I want to return either an integer count of the
// number of rows updated, or the DataResult. That can only be done by
// returning an Object and letting the caller do the casting for us.
- private Object execute(String sql, Map parameterMap,
- Map parameters, Mode mode, List dr) {
+ private Object execute(String sql, Map<String, List<Integer>> parameterMap,
+ Map<String, Object> parameters, Mode mode, List<Object> dr) {
storeForRestart(sql, parameterMap, parameters, mode, dr);
PreparedStatement ps = null;
try {
@@ -455,8 +462,8 @@ public class CachedStatement {
}
boolean returnType = NamedPreparedStatement.execute(ps,
- parameterMap,
- setupParamMap(parameters));
+ parameterMap,
+ setupParamMap(parameters));
if (log.isDebugEnabled()) {
log.debug("execute() - Return type: " + returnType);
}
@@ -470,7 +477,7 @@ public class CachedStatement {
}
catch (HibernateException he) {
throw new
- HibernateRuntimeException(
+ HibernateRuntimeException(
"HibernateException executing CachedStatement", he);
}
@@ -484,17 +491,19 @@ public class CachedStatement {
}
}
- private Map processOutputParams(CallableStatement cs, Map outParams)
- throws SQLException {
+ private Map<String, Object> processOutputParams(CallableStatement cs,
+ Map<String, Integer> outParams)
+ throws SQLException {
- Iterator i = outParams.keySet().iterator();
- Map result = new HashMap();
+ Iterator<String> i = outParams.keySet().iterator();
+ Map<String, Object> result = new HashMap<String, Object>();
while (i.hasNext()) {
- String param = (String)i.next();
- Iterator positions = NamedPreparedStatement.getPositions(param, qMap);
+ String param = i.next();
+ Iterator<Integer> positions = NamedPreparedStatement.getPositions(
+ param, qMap);
// For now assume that we only specify each output parameter once,
// to do otherwise just doesn't make a lot of sense.
- Integer pos = (Integer)positions.next();
+ Integer pos = positions.next();
Object o = cs.getObject(pos.intValue());
if (o instanceof BigDecimal) {
o = new Long(((BigDecimal)o).longValue());
@@ -504,7 +513,8 @@ public class CachedStatement {
return result;
}
- Map executeCallable(Map inParams, Map outParams) {
+ Map<String, Object> executeCallable(Map<String, Object> inParams,
+ Map<String, Integer> outParams) {
CallableStatement cs = null;
try {
Connection conn = stealConnection();
@@ -513,7 +523,7 @@ public class CachedStatement {
// Do we need to check the return code? The original code in
// ConnInvocHandler didn't, but I'm not sure that is correct. rbb
NamedPreparedStatement.execute(cs, qMap, inParams,
- outParams);
+ outParams);
return processOutputParams(cs, outParams);
}
catch (SQLException e) {
@@ -521,7 +531,7 @@ public class CachedStatement {
}
catch (HibernateException he) {
throw new
- HibernateRuntimeException(
+ HibernateRuntimeException(
"HibernateException executing CachedStatement", he);
}
@@ -530,28 +540,28 @@ public class CachedStatement {
}
}
- private DataResult processResultSet(ResultSet rs, SelectMode mode,
- List currentResults) {
+ private DataResult<Object> processResultSet(ResultSet rs, SelectMode mode,
+ List<Object> currentResults) {
- Map pointers = null;
- DataResult dr;
+ Map<Object, Integer> pointers = null;
+ DataResult<Object> dr;
if (currentResults != null) {
pointers = generatePointers(currentResults, getColumn());
- dr = new DataResult(currentResults);
+ dr = new DataResult<Object>(currentResults);
}
else {
- dr = new DataResult(mode);
+ dr = new DataResult<Object>(mode);
}
String className = mode.getClassString();
try {
// Get the column names from the result set.
- List columns = getColumnNames(rs.getMetaData());
+ List<String> columns = getColumnNames(rs.getMetaData());
if (currentResults != null &&
- !columns.contains(getColumn().toLowerCase())) {
+ !columns.contains(getColumn().toLowerCase())) {
// This is ugly, but we check driving query results someplace
// else, so this is only executed if we are elaborating.
throw new MapColumnNotFoundException("Column, " + column +
- ", not found in elaborator results");
+ ", not found in elaborator results");
}
// loop through the results, adding them to the displayMap
@@ -560,12 +570,12 @@ public class CachedStatement {
* If no className was specified *or* if the caller wants a Map
*/
if (className == null || className.equals("java.util.Map")) {
- Map resultMap;
+ Map<String, Object> resultMap;
if (pointers == null) {
- resultMap = new HashMap();
+ resultMap = new HashMap<String, Object>();
}
else {
- Integer pos = (Integer)pointers.get(getObject(rs, getColumn()));
+ Integer pos = pointers.get(getObject(rs, getColumn()));
/* TODO: there is a possible bug here. If the elaborator does
* not restrict itself to only the current results (%s thing),
* then the pos here is null, because the object might not
@@ -573,10 +583,11 @@ public class CachedStatement {
* Decide if this is a bug here or a bug with the query that
* allows such effect. Decide what to do about it.
*/
- resultMap = (Map)currentResults.get(pos.intValue());
+ resultMap = (Map<String, Object>) currentResults
+ .get(pos.intValue());
}
addToMap(columns, rs, resultMap,
- mode.getElaborators().indexOf(parentStatement));
+ mode.getElaborators().indexOf(parentStatement));
// bug 141664: Don't add to the DataResult if we are
// elaborating the data.
@@ -588,17 +599,17 @@ public class CachedStatement {
* Otherwise, try to set the results to the class given.
*/
else {
- Class clazz = Class.forName(className);
+ Class<?> clazz = Class.forName(className);
Object obj;
if (pointers == null) {
obj = clazz.newInstance();
}
else {
- Integer pos = (Integer)pointers.get(getObject(rs, getColumn()));
+ Integer pos = pointers.get(getObject(rs, getColumn()));
if (pos == null) {
// possible mismatch on elaborator ids
throw new IllegalArgumentException("Null elab match for " +
- getColumn() + " " + getObject(rs, getColumn()));
+ getColumn() + " " + getObject(rs, getColumn()));
}
obj = currentResults.get(pos.intValue());
}
@@ -630,27 +641,29 @@ public class CachedStatement {
}
catch (ClassNotFoundException e) {
throw new ObjectCreateWrapperException("Could not create " +
- className, e);
+ className, e);
}
catch (InstantiationException e) {
throw new ObjectCreateWrapperException("Could not create " +
- className, e);
+ className, e);
}
catch (IllegalAccessException e) {
throw new ObjectCreateWrapperException("Could not create " +
- className, e);
+ className, e);
}
finally {
HibernateHelper.cleanupDB(rs);
}
}
- private void addToMap(List columns, ResultSet rs, Map resultMap, int pos)
- throws SQLException {
- Map newMap = new HashMap();
- Iterator i = columns.iterator();
+ private void addToMap(List<String> columns, ResultSet rs,
+ Map<String, Object> resultMap,
+ int pos)
+ throws SQLException {
+ Map<String, Object> newMap = new HashMap<String, Object>();
+ Iterator<String> i = columns.iterator();
while (i.hasNext()) {
- String columnName = (String)i.next();
+ String columnName = i.next();
newMap.put(columnName.toLowerCase(),
getObject(rs, columnName));
}
@@ -673,12 +686,12 @@ public class CachedStatement {
stmtName = "elaborator" + pos;
}
if (multiple) {
- List newList = null;
+ List<Object> newList = null;
if (resultMap.containsKey(stmtName)) {
- newList = (List)resultMap.get(stmtName);
+ newList = (List<Object>) resultMap.get(stmtName);
}
else {
- newList = new ArrayList();
+ newList = new ArrayList<Object>();
}
newList.add(newMap);
resultMap.put(stmtName, newList);
@@ -689,10 +702,11 @@ public class CachedStatement {
}
}
- private void addToObject(List columns, ResultSet rs, Object obj, boolean elaborator)
- throws SQLException {
+ private void addToObject(List<String> columns, ResultSet rs, Object obj,
+ boolean elaborator)
+ throws SQLException {
- List columnSkip;
+ List<String> columnSkip;
if (elaborator && obj instanceof RowCallback) {
RowCallback cb = (RowCallback)obj;
cb.callback(rs);
@@ -702,9 +716,9 @@ public class CachedStatement {
columnSkip = new ArrayList<String>();
}
- Iterator i = columns.iterator();
+ Iterator<String> i = columns.iterator();
while (i.hasNext()) {
- String columnName = (String)i.next();
+ String columnName = i.next();
if (columnSkip.contains(columnName.toLowerCase())) {
continue;
}
@@ -724,7 +738,7 @@ public class CachedStatement {
//getName() gets the name of the set method
//setName is the name of the set method
if (methods[j].getName().equals(setName)) {
- Class paramType = methods[j].getParameterTypes()[0];
+ Class<?> paramType = methods[j].getParameterTypes()[0];
if (Collection.class.isAssignableFrom(paramType)) {
isList = true;
}
@@ -733,10 +747,11 @@ public class CachedStatement {
}
if (isList) { //requires matching get method returning the same list
- Collection c = (Collection)MethodUtil.callMethod(obj,
- getName, new Object[0]);
+ Collection<Object> c = (Collection<Object>) MethodUtil
+ .callMethod(obj,
+ getName, new Object[0]);
if (c == null) {
- c = new ArrayList();
+ c = new ArrayList<Object>();
}
c.add(getObject(rs, columnName));
MethodUtil.callMethod(obj, setName, c);
@@ -777,9 +792,12 @@ public class CachedStatement {
// this : August 23, 2005 12:00:00 AM PDT
// vs the real date: August 23, 2005 1:36:12 PM PDT
if (columnValue instanceof Date ||
- ("oracle.sql.TIMESTAMPLTZ".equals(columnValue.getClass().getCanonicalName())) ||
- ("oracle.sql.TIMESTAMP".equals(columnValue.getClass().getCanonicalName())) ||
- ("oracle.sql.TIMESTAMPTZ".equals(columnValue.getClass().getCanonicalName()))) {
+ ("oracle.sql.TIMESTAMPLTZ".equals(columnValue.getClass()
+ .getCanonicalName())) ||
+ ("oracle.sql.TIMESTAMP".equals(columnValue.getClass()
+ .getCanonicalName())) ||
+ ("oracle.sql.TIMESTAMPTZ".equals(columnValue.getClass()
+ .getCanonicalName()))) {
Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
return rs.getTimestamp(columnName, cal);
}
@@ -788,9 +806,10 @@ public class CachedStatement {
}
return columnValue;
}
- private List getColumnNames(ResultSetMetaData rsmd) {
+
+ private List<String> getColumnNames(ResultSetMetaData rsmd) {
try {
- ArrayList columns = new ArrayList();
+ ArrayList<String> columns = new ArrayList<String>();
int count = rsmd.getColumnCount();
for (int i = 1; i <= count; i++) {
@@ -805,9 +824,9 @@ public class CachedStatement {
private boolean checkForColumn(Object obj, String key) {
if (obj instanceof Map) {
- return ((Map)obj).containsKey(key);
+ return ((Map<String, Object>) obj).containsKey(key);
}
- Class clazz = obj.getClass();
+ Class<?> clazz = obj.getClass();
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++) {
if (methods[i].getName().equals(StringUtil.beanify("get " + key))) {
@@ -819,7 +838,7 @@ public class CachedStatement {
private Object getKey(Object obj, String key) {
if (obj instanceof Map) {
- return ((Map)obj).get(key);
+ return ((Map<String, Object>) obj).get(key);
}
Object keyData = MethodUtil.callMethod(obj,
StringUtil.beanify("get " + key),
@@ -827,17 +846,18 @@ public class CachedStatement {
return keyData;
}
- private Map generatePointers(List dr, String key) {
+ private Map<Object, Integer> generatePointers(List<Object> dr, String key) {
- Iterator i = dr.iterator();
+ Iterator<Object> i = dr.iterator();
int pos = 0;
- Map pointers = new HashMap();
+ Map<Object, Integer> pointers = new HashMap<Object, Integer>();
while (i.hasNext()) {
Object row = i.next();
if (row instanceof Map) {
- pointers.put(((Map)row).get(key), new Integer(pos));
+ pointers.put(((Map<String, Object>) row).get(key), new Integer(
+ pos));
}
else {
Object keyData = MethodUtil.callMethod(row,
@@ -866,14 +886,10 @@ public class CachedStatement {
return conn;
}
- private void storeForRestart(String sql, Map parameterMap,
- Map parameters, Mode mode, List dr) {
- restartData = new ArrayList();
- restartData.add(sql);
- restartData.add(parameterMap);
- restartData.add(parameters);
- restartData.add(mode);
- restartData.add(dr);
+ private void storeForRestart(String sql,
+ Map<String, List<Integer>> parameterMap,
+ Map<String, Object> parameters, Mode mode, List<Object> dr) {
+ restartData = new RestartData(sql, parameterMap, parameters, mode, dr);
}
/**
@@ -881,12 +897,9 @@ public class CachedStatement {
* @return what the previous query returned or null.
*/
public Object restartQuery() {
- return restartData == null ? null :
- execute((String) restartData.get(0),
- (Map) restartData.get(1),
- (Map) restartData.get(2),
- (Mode) restartData.get(3),
- (List) restartData.get(4));
+ return restartData == null ? null : execute(restartData.getSql(),
+ restartData.getParameterMap(), restartData.getParameters(),
+ restartData.getMode(), restartData.getDr());
}
}
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/CallableMode.java b/java/code/src/com/redhat/rhn/common/db/datasource/CallableMode.java
index 3029196..72299a5 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/CallableMode.java
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/CallableMode.java
@@ -30,7 +30,8 @@ public class CallableMode extends BaseMode {
* @param outParams A map of parameter names to SQL Type
* @return A map of all result parameters to the result value
*/
- public Map execute(Map inParams, Map outParams) {
+ public Map<String, Object> execute(Map<String, Object> inParams,
+ Map<String, Integer> outParams) {
return getQuery().executeCallable(inParams, outParams);
}
}
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/DataResult.java b/java/code/src/com/redhat/rhn/common/db/datasource/DataResult.java
index e12a78a..eb2698f 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/DataResult.java
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/DataResult.java
@@ -42,13 +42,13 @@ public class DataResult<T> extends ArrayList<T> {
private CharacterMap index;
private String filterData;
private boolean filter;
- private Map elabParams;
+ private Map<String, Object> elabParams;
/**
* Create a new DataResult object
* @param dr The Mode that created this DataResult
*/
- protected DataResult(DataResult dr) {
+ protected DataResult(DataResult<T> dr) {
super(dr);
mode = dr.getMode();
start = dr.getStart();
@@ -74,7 +74,7 @@ public class DataResult<T> extends ArrayList<T> {
* @param l The list to add
* @param m The Mode that created this DataResult
*/
- protected DataResult(Collection l, Mode m) {
+ protected DataResult(Collection<T> l, Mode m) {
super(l);
mode = (SelectMode)m;
}
@@ -85,7 +85,7 @@ public class DataResult<T> extends ArrayList<T> {
* short lists Hibernate Objects
* @param l Collection of Objects you want in the Result
*/
- public DataResult(Collection l) {
+ public DataResult(Collection<T> l) {
this(l, null);
this.setTotalSize(l.size());
start = 1;
@@ -101,6 +101,7 @@ public class DataResult<T> extends ArrayList<T> {
}
/** {@inheritDoc} */
+ @Override
public DataResult<T> subList(int fromIndex, int toIndex) {
int last = toIndex;
@@ -113,11 +114,11 @@ public class DataResult<T> extends ArrayList<T> {
fromIndex = last - 1;
}
if (fromIndex == -1) {
- return new DataResult(mode);
+ return new DataResult<T>(mode);
}
- List temp = super.subList(fromIndex, last);
- DataResult dr = new DataResult(temp, mode);
+ List<T> temp = super.subList(fromIndex, last);
+ DataResult<T> dr = new DataResult<T>(temp, mode);
dr.start = fromIndex + 1;
dr.end = toIndex;
dr.totalSize = this.getTotalSize();
@@ -143,7 +144,7 @@ public class DataResult<T> extends ArrayList<T> {
* key. This will execute all elaborators.
* @param values The values to bind to the BindParameters
*/
- public void elaborate(Map values) {
+ public void elaborate(Map<String, Object> values) {
elabParams = values;
if (mode != null) {
mode.elaborate(this, values);
@@ -170,14 +171,14 @@ public class DataResult<T> extends ArrayList<T> {
* cycle.
*/
public Elaborator getElaborator() {
- return new ModeElaborator(mode, elabParams);
+ return new ModeElaborator(mode, elabParams);
}
/**
* Return the parameters that were passed into the last call to elaborate()
* @return Map of elaboration values
*/
- public Map getElaborationParams() {
+ public Map<String, Object> getElaborationParams() {
return elabParams;
}
@@ -189,7 +190,7 @@ public class DataResult<T> extends ArrayList<T> {
* @param values name/value pairs used to elaborate the query
*
*/
- public void setElaborationParams(Map values) {
+ public void setElaborationParams(Map<String, Object> values) {
elabParams = values;
}
@@ -296,9 +297,10 @@ public class DataResult<T> extends ArrayList<T> {
}
/** {@inheritDoc} */
+ @Override
public String toString() {
return "{Start: " + start + " End: " + end + " Total: " + totalSize +
- super.toString() + "}";
+ super.toString() + "}";
}
/**
@@ -306,7 +308,7 @@ public class DataResult<T> extends ArrayList<T> {
* @param dr data result to add
* @return if data resule was changed
*/
- public boolean addDataResult(DataResult dr) {
+ public boolean addDataResult(DataResult<T> dr) {
boolean changed = super.addAll(dr);
totalSize += dr.size();
end += dr.size();
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java b/java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java
new file mode 100644
index 0000000..a60a66d
--- /dev/null
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/RestartData.java
@@ -0,0 +1,105 @@
+package com.redhat.rhn.common.db.datasource;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * An object that stores data needed for a sql query so that it can be
+ * restarted if necessary.
+ * @author sherr
+ */
+public class RestartData {
+ private String sql;
+ private Map<String, List<Integer>> parameterMap;
+ private Map<String, Object> parameters;
+ private Mode mode;
+ private List<Object> dr;
+
+ /**
+ * Create a RestartData for a query
+ * @param sqlIn the sql to execute
+ * @param parameterMapIn the parameter map
+ * @param parametersIn the parameters
+ * @param modeIn the mode
+ * @param drIn the dr
+ */
+ public RestartData(String sqlIn, Map<String, List<Integer>> parameterMapIn,
+ Map<String, Object> parametersIn, Mode modeIn, List<Object> drIn) {
+ this.sql = sqlIn;
+ this.parameterMap = parameterMapIn;
+ this.parameters = parametersIn;
+ this.mode = modeIn;
+ this.dr = drIn;
+ }
+
+ /**
+ * @return the sql
+ */
+ public String getSql() {
+ return sql;
+ }
+
+ /**
+ * @param sqlIn the sql to set
+ */
+ public void setSql(String sqlIn) {
+ this.sql = sqlIn;
+ }
+
+ /**
+ * @return the parameterMap
+ */
+ public Map<String, List<Integer>> getParameterMap() {
+ return parameterMap;
+ }
+
+ /**
+ * @param parameterMapIn the parameterMap to set
+ */
+ public void setParameterMap(Map<String, List<Integer>> parameterMapIn) {
+ this.parameterMap = parameterMapIn;
+ }
+
+ /**
+ * @return the parameters
+ */
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ /**
+ * @param parametersIn the parameters to set
+ */
+ public void setParameters(Map<String, Object> parametersIn) {
+ this.parameters = parametersIn;
+ }
+
+ /**
+ * @return the mode
+ */
+ public Mode getMode() {
+ return mode;
+ }
+
+ /**
+ * @param modeIn the mode to set
+ */
+ public void setMode(Mode modeIn) {
+ this.mode = modeIn;
+ }
+
+ /**
+ * @return the dr
+ */
+ public List<Object> getDr() {
+ return dr;
+ }
+
+ /**
+ * @param drIn the dr to set
+ */
+ public void setDr(List<Object> drIn) {
+ this.dr = drIn;
+ }
+
+}
diff --git a/java/code/src/com/redhat/rhn/common/db/datasource/SelectMode.java b/java/code/src/com/redhat/rhn/common/db/datasource/SelectMode.java
index 53e8ad4..98aadcc 100644
--- a/java/code/src/com/redhat/rhn/common/db/datasource/SelectMode.java
+++ b/java/code/src/com/redhat/rhn/common/db/datasource/SelectMode.java
@@ -29,7 +29,7 @@ import java.util.Map;
public class SelectMode extends BaseMode implements Serializable {
private String clazz;
- private List elaborators;
+ private List<CachedStatement> elaborators;
private int maxRows;
// increase this number on any data change
@@ -41,7 +41,7 @@ public class SelectMode extends BaseMode implements Serializable {
/** Constructs a new SelectMode */
public SelectMode() {
- elaborators = new ArrayList();
+ elaborators = new ArrayList<CachedStatement>();
}
/**
@@ -51,7 +51,8 @@ public class SelectMode extends BaseMode implements Serializable {
public SelectMode(SelectMode modeIn) {
if (modeIn != null) {
this.clazz = modeIn.getClassString();
- this.elaborators = new ArrayList(modeIn.getElaborators());
+ this.elaborators = new ArrayList<CachedStatement>(
+ modeIn.getElaborators());
setName(modeIn.getName());
setQuery(new CachedStatement(modeIn.getQuery()));
}
@@ -85,7 +86,7 @@ public class SelectMode extends BaseMode implements Serializable {
* Returns the list of elaborator queries.
* @return List of elaborator queries.
*/
- public List getElaborators() {
+ public List<CachedStatement> getElaborators() {
return elaborators;
}
@@ -138,10 +139,10 @@ public class SelectMode extends BaseMode implements Serializable {
while (subStart < inClause.size()) {
int subLength = subStart + CachedStatement.BATCH_SIZE >= inClause.size() ?
inClause.size() - subStart : CachedStatement.BATCH_SIZE;
- List subClause = inClause.subList(subStart, subStart + subLength);
- DataResult subDr = getQuery().execute(parameters, subClause, this);
- toReturn.addDataResult(subDr);
- subStart += subLength;
+ List subClause = inClause.subList(subStart, subStart + subLength);
+ DataResult subDr = getQuery().execute(parameters, subClause, this);
+ toReturn.addDataResult(subDr);
+ subStart += subLength;
}
return toReturn;
}
@@ -155,23 +156,24 @@ public class SelectMode extends BaseMode implements Serializable {
*/
public void elaborate(List resultList, Map parameters) {
// find the requested elaborator.
- Iterator i = elaborators.iterator();
+ Iterator<CachedStatement> i = elaborators.iterator();
CachedStatement cs = null;
while (i.hasNext()) {
- cs = (CachedStatement)i.next();
+ cs = i.next();
Collection elaborated = cs.executeElaborator(resultList, this,
- parameters);
+ parameters);
resultList.clear();
resultList.addAll(elaborated);
}
}
/** {@inheritDoc} */
+ @Override
public String toString() {
String str = super.toString();
return str +
- " # of elaborators: " + elaborators.size() + " ]";
+ " # of elaborators: " + elaborators.size() + " ]";
}
/**
diff --git a/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java b/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
index a08968b..1af1752 100644
--- a/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/org/OrgFactory.java
@@ -95,11 +95,11 @@ public class OrgFactory extends HibernateFactory {
}
}
- Map in = new HashMap();
+ Map<String, Object> in = new HashMap<String, Object>();
in.put("org_id", oid);
CallableMode m = ModeFactory.getCallableMode(
"Org_queries", "delete_organization");
- m.execute(in, new HashMap());
+ m.execute(in, new HashMap<String, Integer>());
}
/**
@@ -186,8 +186,8 @@ public class OrgFactory extends HibernateFactory {
CallableMode m = ModeFactory.getCallableMode("General_queries",
"create_org");
- Map inParams = new HashMap();
- Map outParams = new HashMap();
+ Map<String, Object> inParams = new HashMap<String, Object>();
+ Map<String, Integer> outParams = new HashMap<String, Integer>();
inParams.put("name", org.getName());
// password is currently required as an input to the create_new_org
@@ -195,7 +195,7 @@ public class OrgFactory extends HibernateFactory {
inParams.put("password", org.getName());
outParams.put("org_id", new Integer(Types.NUMERIC));
- Map row = m.execute(inParams, outParams);
+ Map<String, Object> row = m.execute(inParams, outParams);
// Get the out params
Org retval = lookupById((Long) row.get("org_id"));
@@ -302,7 +302,7 @@ public class OrgFactory extends HibernateFactory {
SelectMode m = ModeFactory.getMode("General_queries",
"activation_keys_for_org");
- Map params = new HashMap();
+ Map<String, Long> params = new HashMap<String, Long>();
params.put("org_id", orgIn.getId());
DataList keys = DataList.getDataList(m, params, Collections.EMPTY_MAP);
return new Long(keys.size());
@@ -316,7 +316,7 @@ public class OrgFactory extends HibernateFactory {
public static Long getKickstarts(Org orgIn) {
SelectMode m = ModeFactory.getMode("General_queries",
"kickstarts_for_org");
- Map params = new HashMap();
+ Map<String, Long> params = new HashMap<String, Long>();
params.put("org_id", orgIn.getId());
DataList kickstarts = DataList.getDataList(m, params, Collections.EMPTY_MAP);
return new Long(kickstarts.size());
diff --git a/java/code/src/com/redhat/rhn/domain/user/UserFactory.java b/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
index 68a0fa7..8d207d4 100644
--- a/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
+++ b/java/code/src/com/redhat/rhn/domain/user/UserFactory.java
@@ -61,8 +61,8 @@ public class UserFactory extends HibernateFactory {
private static List timeZoneList;
private static final Role[] IMPLIEDROLESARRAY = {RoleFactory.CHANNEL_ADMIN,
- RoleFactory.CONFIG_ADMIN, RoleFactory.SYSTEM_GROUP_ADMIN,
- RoleFactory.ACTIVATION_KEY_ADMIN, RoleFactory.MONITORING_ADMIN};
+ RoleFactory.CONFIG_ADMIN, RoleFactory.SYSTEM_GROUP_ADMIN,
+ RoleFactory.ACTIVATION_KEY_ADMIN, RoleFactory.MONITORING_ADMIN};
/** List of Role objects that are applied if you are an Org_admin */
public static final List <Role> IMPLIEDROLES = Arrays.asList(IMPLIEDROLESARRAY);
@@ -84,10 +84,10 @@ public class UserFactory extends HibernateFactory {
private static State loadState(String label) {
Session session = HibernateFactory.getSession();
State state = (State) session.getNamedQuery("UserState.lookupByLabel")
- .setParameter("label", label)
- //Retrieve from cache if there
- .setCacheable(true)
- .uniqueResult();
+ .setParameter("label", label)
+ //Retrieve from cache if there
+ .setCacheable(true)
+ .uniqueResult();
return state;
}
@@ -100,10 +100,10 @@ public class UserFactory extends HibernateFactory {
public static User findResponsibleUser(Long orgId, Role r) {
Session session = HibernateFactory.getSession();
Iterator itr = session.getNamedQuery("User.findResponsibleUser")
- .setParameter("org_id", orgId)
- .setParameter("type_id", r.getId())
- //Retrieve from cache if there
- .list().iterator();
+ .setParameter("org_id", orgId)
+ .setParameter("type_id", r.getId())
+ //Retrieve from cache if there
+ .list().iterator();
if (itr.hasNext()) {
// only care about the first one
Object[] row = (Object[])itr.next();
@@ -123,21 +123,22 @@ public class UserFactory extends HibernateFactory {
public static User findRandomOrgAdmin(Org orgIn) {
Role r = RoleFactory.ORG_ADMIN;
Session session = HibernateFactory.getSession();
- Iterator itr = session.getNamedQuery("User.findRandomOrgAdmin")
- .setParameter("org_id", orgIn.getId())
- .setParameter("type_id", r.getId())
- //Retrieve from cache if there
- .list().iterator();
+ Iterator<Long> itr = session.getNamedQuery("User.findRandomOrgAdmin")
+ .setParameter("org_id", orgIn.getId())
+ .setParameter("type_id", r.getId())
+ //Retrieve from cache if there
+ .list().iterator();
if (itr.hasNext()) {
// only care about the first one
- return UserFactory.lookupById((Long)itr.next());
+ return UserFactory.lookupById(itr.next());
}
return null;
}
/** Get the Logger for the derived class so log messages
- * show up on the correct class
- */
+ * show up on the correct class
+ */
+ @Override
protected Logger getLogger() {
return log;
}
@@ -190,7 +191,7 @@ public class UserFactory extends HibernateFactory {
* @param ids the ids to lookup for
* @return the list of com.redhat.rhn.domain.User objects found
*/
- public static List lookupByIds(Collection<Long> ids) {
+ public static List<User> lookupByIds(Collection<Long> ids) {
if (ids.size() < 1000) {
return realLookupByIds(ids);
}
@@ -214,7 +215,7 @@ public class UserFactory extends HibernateFactory {
private static List<User> realLookupByIds(Collection<Long> ids) {
Session session = HibernateFactory.getSession();
Query query = session.getNamedQuery("User.findByIds")
- .setParameterList("userIds", ids);
+ .setParameterList("userIds", ids);
return query.list();
}
@@ -226,11 +227,11 @@ public class UserFactory extends HibernateFactory {
* @return the user found
*/
public static User lookupById(User user, Long id) {
- Map params = new HashMap();
+ Map<String, Object> params = new HashMap<String, Object>();
params.put("uid", id);
params.put("orgId", user.getOrg().getId());
User returnedUser = (User)getInstance().lookupObjectByNamedQuery(
- "User.findByIdandOrgId", params);
+ "User.findByIdandOrgId", params);
if (returnedUser == null || !user.getOrg().equals(returnedUser.getOrg())) {
LocalizationService ls = LocalizationService.getInstance();
LookupException e = new LookupException("Could not find user " + id);
@@ -248,10 +249,10 @@ public class UserFactory extends HibernateFactory {
* @return the User found
*/
public static User lookupByLogin(String login) {
- Map params = new HashMap();
+ Map<String, Object> params = new HashMap<String, Object>();
params.put(LOGIN_UC, login.toUpperCase());
User user = (User)getInstance()
- .lookupObjectByNamedQuery("User.findByLogin", params);
+ .lookupObjectByNamedQuery("User.findByLogin", params);
if (user == null) {
LocalizationService ls = LocalizationService.getInstance();
@@ -271,11 +272,11 @@ public class UserFactory extends HibernateFactory {
* @return the User found
*/
public static User lookupByLogin(User user, String login) {
- Map params = new HashMap();
+ Map<String, Object> params = new HashMap<String, Object>();
params.put(LOGIN_UC, login.toUpperCase());
params.put("orgId", user.getOrg().getId());
User returnedUser = (User)getInstance().lookupObjectByNamedQuery(
- "User.findByLoginAndOrgId", params);
+ "User.findByLoginAndOrgId", params);
if (returnedUser == null) {
LocalizationService ls = LocalizationService.getInstance();
@@ -320,12 +321,12 @@ public class UserFactory extends HibernateFactory {
* @return Returns true if the user is disabled
*/
public static boolean isDisabled(User user) {
- Map params = new HashMap();
+ Map<String, Object> params = new HashMap<String, Object>();
params.put("user", user);
List <StateChange> changes = getInstance().
- listObjectsByNamedQuery("StateChanges.lookupByUserId", params);
+ listObjectsByNamedQuery("StateChanges.lookupByUserId", params);
return changes != null && !changes.isEmpty() &&
- DISABLED.equals(changes.get(0).getState());
+ DISABLED.equals(changes.get(0).getState());
}
@@ -352,8 +353,8 @@ public class UserFactory extends HibernateFactory {
}
// save the user
CallableMode m = ModeFactory.getCallableMode("User_queries", "create_new_user");
- Map inParams = new HashMap();
- Map outParams = new HashMap();
+ Map<String, Object> inParams = new HashMap<String, Object>();
+ Map<String, Integer> outParams = new HashMap<String, Integer>();
// Can't add the orgId to the object until the User has been
// successfully added to the DB. Doing so will mean that if
@@ -390,7 +391,7 @@ public class UserFactory extends HibernateFactory {
inParams.put("contEmail", "N");
outParams.put("userId", new Integer(Types.NUMERIC));
- Map result = m.execute(inParams, outParams);
+ Map<String, Object> result = m.execute(inParams, outParams);
Org org = OrgFactory.lookupById(orgId);
if (org != null) {
@@ -443,7 +444,7 @@ public class UserFactory extends HibernateFactory {
Boolean wasOrgAdmin = uimpl.wasOrgAdmin();
if (wasOrgAdmin != null) {
orgAdminChanged =
- usr.hasRole(RoleFactory.ORG_ADMIN) != wasOrgAdmin.booleanValue();
+ usr.hasRole(RoleFactory.ORG_ADMIN) != wasOrgAdmin.booleanValue();
}
if (orgAdminChanged) {
@@ -458,10 +459,10 @@ public class UserFactory extends HibernateFactory {
*/
public void syncServerGroupPerms(User usr) {
CallableMode m = ModeFactory.getCallableMode("User_queries",
- "update_perms_for_user");
- Map inParams = new HashMap();
+ "update_perms_for_user");
+ Map<String, Object> inParams = new HashMap<String, Object>();
inParams.put("user_id", usr.getId());
- m.execute(inParams, new HashMap());
+ m.execute(inParams, new HashMap<String, Integer>());
}
@@ -474,10 +475,10 @@ public class UserFactory extends HibernateFactory {
public static RhnTimeZone getTimeZone(int id) {
Session session = HibernateFactory.getSession();
return (RhnTimeZone) session.getNamedQuery("RhnTimeZone.loadTimeZoneById")
- .setInteger("tid", id)
- //Retrieve from cache if there
- .setCacheable(true)
- .uniqueResult();
+ .setInteger("tid", id)
+ //Retrieve from cache if there
+ .setCacheable(true)
+ .uniqueResult();
}
/**
@@ -488,11 +489,11 @@ public class UserFactory extends HibernateFactory {
public static RhnTimeZone getTimeZone(String olsonName) {
Session session = HibernateFactory.getSession();
return (RhnTimeZone) session
- .getNamedQuery("RhnTimeZone.loadTimeZoneByOlsonName")
- .setString("ton", olsonName)
- //Retrieve from cache if there
- .setCacheable(true)
- .uniqueResult();
+ .getNamedQuery("RhnTimeZone.loadTimeZoneByOlsonName")
+ .setString("ton", olsonName)
+ //Retrieve from cache if there
+ .setCacheable(true)
+ .uniqueResult();
}
/**
@@ -509,7 +510,7 @@ public class UserFactory extends HibernateFactory {
*/
public static List lookupAllTimeZones() {
//timeZoneList is manually cached because instance variable is properly sorted
- //whereas the database is not.
+ //whereas the database is not.
if (timeZoneList == null) {
List timeZones = null; //temporary holding place until sorted
Session session = HibernateFactory.getSession();
@@ -521,12 +522,13 @@ public class UserFactory extends HibernateFactory {
//All other timezones are sorted West to East based on raw off-set.
if (timeZones != null) {
Collections.sort(timeZones, new Comparator() {
+ @Override
public int compare(Object o1, Object o2) {
int offSet1 = ((RhnTimeZone)o1).getTimeZone().getRawOffset();
int offSet2 = ((RhnTimeZone)o2).getTimeZone().getRawOffset();
if (offSet1 <= -18000000 && offSet1 >= -36000000 &&
- offSet2 <= -18000000 && offSet2 >= -36000000) {
+ offSet2 <= -18000000 && offSet2 >= -36000000) {
//both in America
return offSet2 - offSet1;
}
@@ -543,10 +545,10 @@ public class UserFactory extends HibernateFactory {
return offSet1 - offSet2;
}
}
- );
+ );
}
- timeZoneList = timeZones;
+ timeZoneList = timeZones;
}
return timeZoneList;
}
@@ -595,7 +597,7 @@ public class UserFactory extends HibernateFactory {
*/
public static boolean satelliteHasUsers() {
SelectMode m = ModeFactory.getMode("User_queries", "user_count");
- DataResult dr = m.execute(new HashMap());
+ DataResult dr = m.execute(new HashMap<String, Object>());
Map row = (Map) dr.get(0);
Long count = (Long) row.get("user_count");
return (count.longValue() > 0);
@@ -618,8 +620,8 @@ public class UserFactory extends HibernateFactory {
* @return UserServerPreference that corresponds to the parameters
*/
public UserServerPreference lookupServerPreferenceByUserServerAndName(User user,
- Server server,
- String name) {
+ Server server,
+ String name) {
UserServerPreferenceId id = new UserServerPreferenceId(user, server, name);
Session session = HibernateFactory.getSession();
return (UserServerPreference) session.get(UserServerPreference.class, id);
@@ -634,15 +636,15 @@ public class UserFactory extends HibernateFactory {
* @param value true if the preference should be true, false otherwise
*/
public void setUserServerPreferenceValue(User user,
- Server server,
- String preferenceName,
- boolean value) {
+ Server server,
+ String preferenceName,
+ boolean value) {
Session session = HibernateFactory.getSession();
UserServerPreferenceId id = new UserServerPreferenceId(user,
- server,
- preferenceName);
+ server,
+ preferenceName);
UserServerPreference usp = (UserServerPreference)
- session.get(UserServerPreference.class, id);
+ session.get(UserServerPreference.class, id);
/* Here, we delete the preference's entry if it should be true.
* We would hopefully be ok setting the value to "1," but I'm emulating
@@ -696,8 +698,8 @@ public class UserFactory extends HibernateFactory {
public static void deleteUser(Long userId) {
CallableMode m = ModeFactory.getCallableMode("User_queries",
"delete_user");
- Map inParams = new HashMap();
- Map outParams = new HashMap();
+ Map<String, Object> inParams = new HashMap<String, Object>();
+ Map<String, Integer> outParams = new HashMap<String, Integer>();
inParams.put("user_id", userId);
m.execute(inParams, outParams);
}
diff --git a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/DeleteChannelAction.java b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/DeleteChannelAction.java
index c193f35..2366516 100644
--- a/java/code/src/com/redhat/rhn/frontend/action/channel/manage/DeleteChannelAction.java
+++ b/java/code/src/com/redhat/rhn/frontend/action/channel/manage/DeleteChannelAction.java
@@ -50,11 +50,12 @@ public class DeleteChannelAction extends RhnAction {
private static final String DISABLE_DELETE = "disableDelete";
/** {@inheritDoc} */
+ @Override
public ActionForward execute(ActionMapping actionMapping,
- ActionForm actionForm,
- HttpServletRequest request,
- HttpServletResponse response)
- throws Exception {
+ ActionForm actionForm,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ throws Exception {
RequestContext context = new RequestContext(request);
User user = context.getLoggedInUser();
@@ -68,14 +69,14 @@ public class DeleteChannelAction extends RhnAction {
// The channel doesn't carry its subscribed system count, so add this separately
int subscribedSystemsCount =
- SystemManager.countSystemsSubscribedToChannel(channelId, user);
+ SystemManager.countSystemsSubscribedToChannel(channelId, user);
request.setAttribute("subscribedSystemsCount", subscribedSystemsCount);
// Load the number of systems subscribed through a trust relationship to
// the channel
int trustedSystemsCount =
- SystemManager.countSubscribedToChannelWithoutOrg(channel.getOrg().getId(),
- channelId);
+ SystemManager.countSubscribedToChannelWithoutOrg(channel.getOrg().getId(),
+ channelId);
request.setAttribute("trustedSystemsCount", trustedSystemsCount);
if (context.isSubmitted()) {
@@ -107,8 +108,8 @@ public class DeleteChannelAction extends RhnAction {
Map params = new HashMap();
params.put("selected_channel", "all_managed_packages");
params.put("forwarded", "true");
- return getStrutsDelegate().forwardParams(actionMapping.findForward("delete"),
- params);
+ return getStrutsDelegate().forwardParams(
+ actionMapping.findForward("delete"), params);
}
return actionMapping.findForward("success");
}
10 years, 10 months
client/rhel
by StephenHerr
client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit e8115186aaeea1196b4750a8ec16594eb341126d
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Nov 28 15:01:10 2012 -0500
876740 - fix typo
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py
index bbe7283..b83481a 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py
@@ -233,7 +233,7 @@ NO_SYS_ENTITLEMENT = _("This system was unable to be associated with "
"about this problem. Once you make the "
"appropriate active subscriptions available in your account, you may browse "
"to this system's profile in the RHN web interface, delete the profile, and "
-"re-connect this system to Red Hat Network Sattelite.")
+"re-connect this system to Red Hat Network Satellite.")
ACTIVATION_KEY = _("Universal default activation key detected\n"
"A universal default activation key was detected in your account. "
"This means that a set of properties (software channel subscriptions, "
10 years, 10 months
client/rhel
by StephenHerr
client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py | 36 +++++-----
client/rhel/rhn-client-tools/src/up2date_client/tui.py | 11 ++-
2 files changed, 27 insertions(+), 20 deletions(-)
New commits:
commit a697bc9f58f2b54e41c543ea1789687f16ac8eb0
Author: Stephen Herr <sherr(a)redhat.com>
Date: Wed Nov 28 14:34:59 2012 -0500
876740 - server url auto-corrects common mistakes, messages say "Satellite"
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py
index ad6cfda..bbe7283 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/rhnreg_constants.py
@@ -26,7 +26,7 @@ SSL_REQUIRED = _("If you are using https you must enter the location "
"of a valid SSL certificate.")
# Connect Window
-CONNECT_WINDOW = _("Attempting to contact the Red Hat Network server.")
+CONNECT_WINDOW = _("Attempting to contact the Red Hat Network Satellite server.")
CONNECT_WINDOW_TEXT = _("We are attempting to contact the Red Hat "
"Network server at %s.")
CONNECT_WINDOW_TEXT2 = _("A proxy was specified at %s.")
@@ -35,7 +35,7 @@ CONNECT_WINDOW_TEXT2 = _("A proxy was specified at %s.")
START_REGISTER_WINDOW = _("System Registration")
START_REGISTER_TEXT = _("This assistant will guide you through "
"connecting your system to "
- "Red Hat Network (RHN) to receive software "
+ "Red Hat Network (RHN) Satellite to receive software "
"updates, including "
"security updates, to keep your system supported "
"and compliant. "
@@ -43,12 +43,12 @@ START_REGISTER_TEXT = _("This assistant will guide you through "
" * A network connection\n"
" * Your Red Hat Login & password\n"
" * The location of a Red Hat Network Satellite "
- "or Proxy (optional)\n\n")
+ "or Proxy\n\n")
# Why Register Window
WHY_REGISTER = _("Why Should I Connect to RHN? ...")
WHY_REGISTER_WINDOW = _("Why Register")
-WHY_REGISTER_TEXT = _("Connecting your system to Red Hat Network allows you to take full "
+WHY_REGISTER_TEXT = _("Connecting your system to Red Hat Network Satellite allows you to take full "
"advantage of the benefits of a paid subscription, including:")
WHY_REGISTER_SEC = _("Security & Updates:")
WHY_REGISTER_DLD = _("Downloads & Upgrades:")
@@ -69,10 +69,10 @@ BACK_REGISTER = _("Take me back to the registration")
# Confirm Quit Window
CONFIRM_QUIT = _("Software Update Not Set Up")
-CONFIRM_QUIT_SURE = _("Are you sure you don't want to connect your system to Red Hat Network? "
+CONFIRM_QUIT_SURE = _("Are you sure you don't want to connect your system to Red Hat Network Satellite? "
"You'll miss out on the benefits of a Red Hat Enterprise Linux subscription:\n")
CONFIRM_QUIT_WILLNOT = _("You will not be able to take advantage of these subscription privileges without connecting "
- "your system to Red Hat Network.\n")
+ "your system to Red Hat Network Satellite.\n")
CONTINUE_REGISTERING = _("Take me back to the setup process.")
REGISTER_LATER2 = _("I'll register later.")
@@ -103,7 +103,7 @@ CONFIRM_OS_ALL = _("Your system will be subscribed to the base"
HARDWARE_WINDOW = _("Create Profile - Hardware")
HARDWARE_WINDOW_DESC1 = _("A Profile Name is a descriptive name that"
" you choose to identify this System Profile"
- " on the Red Hat Network web pages. Optionally,"
+ " on the Red Hat Network Satellite web pages. Optionally,"
" include a computer serial or identification number.")
HARDWARE_WINDOW_DESC2 = _("Additional hardware information including PCI"
" devices, disk sizes and mount points will be"
@@ -138,33 +138,33 @@ RHSM_SYSTEM_ALREADY_REGISTERED = _("This system has already been registered with
" Knowledge Base Article: https://access.redhat.com/kb/docs/DOC-45563")
# Send Window
-SEND_WINDOW = _("Send Profile Information to Red Hat Network")
+SEND_WINDOW = _("Send Profile Information to Red Hat Network Satellite")
SEND_WINDOW_DESC = _("We are finished collecting information for the System Profile.\n\n"
- "Press \"Next\" to send this System Profile to Red Hat Network. "
+ "Press \"Next\" to send this System Profile to Red Hat Network Satellite. "
"Click \"Cancel\" and no information will be sent. "
"You can run the registration program later by "
"typing `rhn_register` at the command line.")
# Sending Window
-SENDING_WINDOW = _("Sending Profile to Red Hat Network")
+SENDING_WINDOW = _("Sending Profile to Red Hat Network Satellite")
# Finish Window
FINISH_WINDOW = _("Updates Configured")
FINISH_WINDOW_TEXT_TUI = _("You may now run 'yum update' from this system's "
"command line to get the latest "
- "software updates from Red Hat Network. You will need to run this "
+ "software updates from Red Hat Network Satellite. You will need to run this "
"periodically to "
"get the latest updates. Alternatively, you may configure this "
"system for automatic software updates (also known as 'auto errata update') "
- "via the Red Hat Network web interface. (Instructions for this are in chapter 6 "
+ "via the Red Hat Network Satellite web interface. (Instructions for this are in chapter 6 "
"of the RHN Reference Guide, available from the 'Help' button in the main Red "
- "Hat Network web interface.)")
+ "Hat Network Satellite web interface.)")
# Review Window
REVIEW_WINDOW = _("Review Subscription")
REVIEW_WINDOW_PROMPT = _("Please review the subscription details below:")
SUB_NUM = _("The installation number %s was activated during "
- "this system's initial connection to Red Hat Network.")
+ "this system's initial connection to Red Hat Network Satellite.")
SUB_NUM_RESULT = _("Subscriptions have been activated for the following "
"Red Hat products/services:")
CHANNELS_TITLE = _("Software Channel Subscriptions:")
@@ -233,7 +233,7 @@ NO_SYS_ENTITLEMENT = _("This system was unable to be associated with "
"about this problem. Once you make the "
"appropriate active subscriptions available in your account, you may browse "
"to this system's profile in the RHN web interface, delete the profile, and "
-"re-connect this system to Red Hat Network.")
+"re-connect this system to Red Hat Network Sattelite.")
ACTIVATION_KEY = _("Universal default activation key detected\n"
"A universal default activation key was detected in your account. "
"This means that a set of properties (software channel subscriptions, "
@@ -248,12 +248,12 @@ ACTIVATION_KEY = _("Universal default activation key detected\n"
# Error Messages.
FATAL_ERROR = _("Fatal Error")
WARNING = _("Warning")
-HOSTED_CONNECTION_ERROR = _("We can't contact the Red Hat Network Server.\n\n"
+HOSTED_CONNECTION_ERROR = _("We can't contact the Red Hat Network Satellite.\n\n"
"Double check the location provided - is '%s' correct?\n"
"If not, you can correct it and try again.\n\n"
"Make sure that the network connection on this system is operational.\n\n"
"This system will not be able to successfully receive software updates "
- "from Red Hat without connecting to a Red Hat Network server")
+ "from Red Hat without connecting to a Red Hat Network Satellite server")
BASECHANNELERROR = _("Architecture: %s, OS Release: %s, OS "
"Version: %s")
@@ -265,7 +265,7 @@ SERVER_TOO_OLD = _("This server doesn't support functionality "
SSL_CERT_ERROR_MSG = _("<b><span size=\"16000\">Incompatible Certificate File</span></b>\n\n"
"The certificate you provided, <b>%s</b>, is not compatible with "
- " the Red Hat Network server at <b>%s</b>. You may want to double-check"
+ " the Red Hat Network Satellite server at <b>%s</b>. You may want to double-check"
" that you have provided a valid certificate file."
" Are you sure you have provided the correct certificate, and that"
" the certificate file has not been corrupted?\n\n"
diff --git a/client/rhel/rhn-client-tools/src/up2date_client/tui.py b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
index 94ac8cf..fd7d6ac 100644
--- a/client/rhel/rhn-client-tools/src/up2date_client/tui.py
+++ b/client/rhel/rhn-client-tools/src/up2date_client/tui.py
@@ -229,6 +229,7 @@ class SatelliteUrlWindow:
buttons = [OK.encode('utf-8')])
self.g.setCurrent(self.urlEntry)
return 0
+
if (self.urlEntry.value()[:5] == 'https' and
self.sslEntry.value() == ""):
snack.ButtonChoiceWindow(self.screen, ERROR.encode('utf-8'),
@@ -239,9 +240,15 @@ class SatelliteUrlWindow:
return 1
def saveResults(self):
- self.tui.serverURL = self.urlEntry.value()
+ serverEntry = self.urlEntry.value()
+ # fix up the server url, E.G. if someone left off /XMLRPC
+ fixed_server_url = rhnreg.makeNiceServerUrl(serverEntry)
+ if fixed_server_url != serverEntry:
+ serverEntry = fixed_server_url
+
+ self.tui.serverURL = serverEntry
self.tui.sslCACert = self.sslEntry.value()
- config.setServerURL(self.urlEntry.value())
+ config.setServerURL(serverEntry)
config.setSSLCACert(self.sslEntry.value())
cfg.save()
10 years, 10 months