Skip to content

Commit

Permalink
Fix compiler warnings about using deprecated boxing constructors (#509)
Browse files Browse the repository at this point in the history
  • Loading branch information
tdrwenski authored Jul 12, 2024
1 parent 56cafaf commit 5217eaf
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions dap4/d4servlet/src/main/java/dap4/servlet/CDMWrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,8 @@ protected DapEnumeration buildenum(EnumTypedef cdmenum) throws DapException {
for (Map.Entry<Integer, String> entry : ecvalues.entrySet()) {
String name = entry.getValue();
assert (name != null);
int value = (int) entry.getKey();
dapenum.addEnumConst(dmrfactory.newEnumConst(name, new Long(value)));
long value = entry.getKey();
dapenum.addEnumConst(dmrfactory.newEnumConst(name, value));
}
return dapenum;
}
Expand Down
10 changes: 5 additions & 5 deletions opendap/dtswar/src/main/java/opendap/dts/Getopts.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public String getOption(Character sw) {
* @param sw int value switch whose option is requested
*/
public String getOption(int sw) {
Character opt = new Character((char) sw);
Character opt = (char) sw;
return getOption(opt);
}

Expand Down Expand Up @@ -192,7 +192,7 @@ protected void initialize(String progname, String flags, String args[]) throws I
for (int i = 0; i < flags.length(); i++) {
boolean found;
int cc = flags.charAt(i);
Character c = new Character((char) cc);
Character c = (char) cc;
char alpha[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x', 'y', 'z'};

Expand All @@ -205,7 +205,7 @@ protected void initialize(String progname, String flags, String args[]) throws I

found = false;
for (int j = 0; j < alpha.length; j++) {
Character ch = new Character(alpha[j]);
Character ch = alpha[j];
char uc = Character.toUpperCase(ch.charValue());
if (alpha[j] == cc || uc == cc) {
found = true;
Expand All @@ -228,7 +228,7 @@ protected void initialize(String progname, String flags, String args[]) throws I
if (prv == ':') {
throw new InvalidSwitch(throwstring + "Can't have consecutive ':'\n" + usage + "\n");
} else {
Character cp = new Character((char) prv);
Character cp = (char) prv;
OptSwitch sw = (OptSwitch) switchtab.get(cp);
sw.SetHasValue(OptSwitch.VAL);
}
Expand Down Expand Up @@ -259,7 +259,7 @@ protected void initialize(String progname, String flags, String args[]) throws I
// more options, iterate them
for (int j = 1; j < args[i].length(); j++) {
cc = args[i].charAt(j);
Character fc = new Character(cc);
Character fc = cc;
OptSwitch cs = (OptSwitch) switchtab.get(fc);
if (cs == null) {
// The supplied switch wasn't recognised.
Expand Down
6 changes: 3 additions & 3 deletions opendap/dtswar/src/main/java/opendap/dts/SDTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ public static void parse_options(String[] args) {
String arg = null;
try {
opts = new Getopts("f:c:", args);
if (opts.getSwitch(new Character('f')).set) {
arg = opts.getSwitch(new Character('f')).val;
if (opts.getSwitch('f').set) {
arg = opts.getSwitch('f').val;
if (Debug)
// System.out.print("DDS File: " + ((arg != null) ? arg : "null") + "\n");
DDSFile = arg;
}
if (opts.getSwitch(new Character('c')).set) {
if (opts.getSwitch('c').set) {
arg = g.getOptarg();
if (Debug)
// System.out.print("Constraint Expression: \"" + ((arg != null) ? arg : "null") + "\"\n");
Expand Down
14 changes: 7 additions & 7 deletions opendap/server/src/main/java/opendap/servlet/AsciiWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -105,19 +105,19 @@ public void showPrimitive(BaseType data, PrintWriter pw, boolean addName, String
if (data instanceof DString) // covers DURL case
showString(pw, ((DString) data).getValue());
else if (data instanceof DFloat32)
pw.print((new Float(((DFloat32) data).getValue())).toString());
pw.print((Float.valueOf(((DFloat32) data).getValue())).toString());
else if (data instanceof DFloat64)
pw.print((new Double(((DFloat64) data).getValue())).toString());
pw.print((Double.valueOf(((DFloat64) data).getValue())).toString());
else if (data instanceof DUInt32)
pw.print((new Long(((DUInt32) data).getValue() & ((long) 0xFFFFFFFF))).toString());
pw.print((Long.valueOf(((DUInt32) data).getValue() & ((long) 0xFFFFFFFF))).toString());
else if (data instanceof DUInt16)
pw.print((new Integer(((DUInt16) data).getValue() & 0xFFFF)).toString());
pw.print((Integer.valueOf(((DUInt16) data).getValue() & 0xFFFF)).toString());
else if (data instanceof DInt32)
pw.print((new Integer(((DInt32) data).getValue())).toString());
pw.print((Integer.valueOf(((DInt32) data).getValue())).toString());
else if (data instanceof DInt16)
pw.print((new Short(((DInt16) data).getValue())).toString());
pw.print((Short.valueOf(((DInt16) data).getValue())).toString());
else if (data instanceof DByte)
pw.print((new Integer(((DByte) data).getValue() & 0xFF)).toString());
pw.print((Integer.valueOf(((DByte) data).getValue() & 0xFF)).toString());
else
pw.print("Not implemented type = " + data.getTypeName() + " " + data.getEncodedName() + "\n");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean ne
if (addName)
pw.print(", ");

pw.print((new Byte(getValue())).toString());
pw.print((Byte.valueOf(getValue())).toString());

if (newLine)
pw.print("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean ne
pw.print(", ");


pw.print((new Float(getValue())).toString());
pw.print((Float.valueOf(getValue())).toString());

if (newLine)
pw.print("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean ne
if (addName)
pw.print(", ");

pw.print((new Double(getValue())).toString());
pw.print((Double.valueOf(getValue())).toString());

if (newLine)
pw.print("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean ne
if (addName)
pw.print(", ");

pw.print((new Short(getValue())).toString());
pw.print((Short.valueOf(getValue())).toString());

if (newLine)
pw.print("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean ne
if (addName)
pw.print(", ");

pw.print((new Long(getValue())).toString());
pw.print((Long.valueOf(getValue())).toString());

if (newLine)
pw.print("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean ne
if (addName)
pw.print(", ");

pw.print((new Integer(getValue() & 0xFFFF)).toString());
pw.print((Integer.valueOf(getValue() & 0xFFFF)).toString());

if (newLine)
pw.print("\n");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public void toASCII(PrintWriter pw, boolean addName, String rootName, boolean ne
if (addName)
pw.print(", ");

pw.print((new Long(getValue() & ((long) 0xFFFFFFFF))).toString());
pw.print((Long.valueOf(getValue() & ((long) 0xFFFFFFFF))).toString());

if (newLine)
pw.print("\n");
Expand Down

0 comments on commit 5217eaf

Please sign in to comment.