Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings #497

Merged
merged 6 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions opendap/dtswar/src/main/java/opendap/dts/DTSServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,7 @@ protected void printStatus(PrintWriter os) {
int pending = 0;
StringBuilder preqs = new StringBuilder();
for (int i = 0; i < n; i++) {
ReqState rs = (ReqState) prArr.get(i);
ReqState rs = prArr.get(i);
RequestDebug reqD = (RequestDebug) rs.getUserObject();
if (!reqD.done) {
preqs.append("<pre>-----------------------\n");
Expand Down Expand Up @@ -1657,7 +1657,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) {
reqD = new RequestDebug(reqno, Thread.currentThread().toString());
rs.setUserObject(reqD);
if (prArr == null)
prArr = new ArrayList(10000);
prArr = new ArrayList<>(10000);
prArr.add((int) reqno, rs);
}

Expand Down Expand Up @@ -1824,7 +1824,7 @@ private void printBadURLPage(PrintWriter pw) {
//////////////////////////////////////////////////
// debug

private ArrayList prArr = null;
private ArrayList<ReqState> prArr = null;

static private class RequestDebug {
long reqno;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class CEEvaluator {
/**
* The Clause objects which hold the parsed selection information.
*/
private Vector _cv;
private Vector<Clause> _cv;

/**
* The factory which will be used by the parser to construct the clause
Expand All @@ -120,7 +120,7 @@ public class CEEvaluator {
*/
public CEEvaluator(ServerDDS dds) {
_dds = dds;
_cv = new Vector();
_cv = new Vector<>();
_Debug = Debug.isSet("CE");
if (_Debug)
System.out.println("CE debugging enabled.");
Expand All @@ -140,7 +140,7 @@ public CEEvaluator(ServerDDS dds) {
*/
public CEEvaluator(ServerDDS dds, ClauseFactory clauseFactory) {
_dds = dds;
_cv = new Vector();
_cv = new Vector<>();
_Debug = Debug.isSet("CE");
if (_Debug)
System.out.println("CE debugging enabled.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Vector getRowVector() throws NoSuchVariableException {
if (_Debug)
System.out.println("This sequence has " + getRowCount() + " rows.");

Vector rv = new Vector();
Vector<BaseType> rv = new Vector<>();

for (int i = 0; i < elementCount(false); i++) {
if (_Debug)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,7 @@ protected void printStatus(PrintWriter os) throws IOException {
int pending = 0;
StringBuilder preqs = new StringBuilder();
for (int i = 0; i < n; i++) {
ReqState rs = (ReqState) prArr.get(i);
ReqState rs = prArr.get(i);
RequestDebug reqD = (RequestDebug) rs.getUserObject();
if (!reqD.done) {
preqs.append("<pre>-----------------------\n");
Expand Down Expand Up @@ -1615,7 +1615,7 @@ public void doGet(HttpServletRequest request, HttpServletResponse response) {
reqD = new RequestDebug(reqno, Thread.currentThread().toString());
rs.setUserObject(reqD);
if (prArr == null)
prArr = new ArrayList(10000);
prArr = new ArrayList<>(10000);
prArr.add((int) reqno, rs);
}

Expand Down Expand Up @@ -1782,7 +1782,7 @@ private void printBadURLPage(PrintWriter pw) {
// **************************************************************************

// debug
private ArrayList prArr = null;
private ArrayList<ReqState> prArr = null;

private static class RequestDebug {
long reqno;
Expand Down
12 changes: 4 additions & 8 deletions tds/src/main/java/thredds/server/admin/AdminLogController.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,15 @@ protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServlet
if (path.equals("access/current")) {

File dir = tdsContext.getTomcatLogDirectory();
File[] files = dir.listFiles((dir1, name) -> {
return name.startsWith("access");
});
File[] files = dir.listFiles((dir1, name) -> name.startsWith("access"));
if ((files == null) || (files.length == 0)) {
res.sendError(HttpServletResponse.SC_NOT_FOUND);
return null;
}

List fileList = Arrays.asList(files);
List<File> fileList = Arrays.asList(files);
Collections.sort(fileList);
file = (File) fileList.get(fileList.size() - 1); // last one
file = fileList.get(fileList.size() - 1);

} else if (path.equals("access/")) {
showFiles(tdsContext.getTomcatLogDirectory(), "access", res);
Expand Down Expand Up @@ -105,9 +103,7 @@ protected ModelAndView handleRequestInternal(HttpServletRequest req, HttpServlet
}

private void showFiles(File dir, final String filter, HttpServletResponse res) throws IOException {
File[] files = dir.listFiles((dir1, name) -> {
return name.contains(filter);
});
File[] files = dir.listFiles((dir1, name) -> name.contains(filter));

if ((files == null) || (files.length == 0)) {
res.sendError(HttpServletResponse.SC_NOT_FOUND);
Expand Down
4 changes: 2 additions & 2 deletions tds/src/main/java/thredds/servlet/ServletUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ public static void forwardToCatalogServices(HttpServletRequest req, HttpServletR
static public void showSystemProperties(PrintStream out) {

Properties sysp = System.getProperties();
Enumeration e = sysp.propertyNames();
List<String> list = Collections.list(e);
Set<String> propertyNames = sysp.stringPropertyNames();
List<String> list = new ArrayList<>(propertyNames);
Collections.sort(list);

out.println("System Properties:");
Expand Down
Loading