Skip to content

Commit

Permalink
Fix some deprecation warnings in test-suite component
Browse files Browse the repository at this point in the history
  • Loading branch information
melissalinkert committed Apr 9, 2024
1 parent a975398 commit 60003ea
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
32 changes: 16 additions & 16 deletions components/test-suite/src/loci/tests/testng/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,12 @@ public boolean doTest() {
if (delim >= 0) {
test = test.substring(0, delim);
}
return new Boolean(test.trim()).booleanValue();
return Boolean.parseBoolean(test.trim());
}

public boolean hasValidXML() {
if (globalTable.get(HAS_VALID_XML) == null) return true;
return new Boolean(globalTable.get(HAS_VALID_XML)).booleanValue();
return Boolean.parseBoolean(globalTable.get(HAS_VALID_XML));
}

public String getReader() {
Expand Down Expand Up @@ -261,19 +261,19 @@ public String getDimensionOrder() {
}

public boolean isInterleaved() {
return new Boolean(currentTable.get(IS_INTERLEAVED)).booleanValue();
return Boolean.parseBoolean(currentTable.get(IS_INTERLEAVED));
}

public boolean isIndexed() {
return new Boolean(currentTable.get(IS_INDEXED)).booleanValue();
return Boolean.parseBoolean(currentTable.get(IS_INDEXED));
}

public boolean isFalseColor() {
return new Boolean(currentTable.get(IS_FALSE_COLOR)).booleanValue();
return Boolean.parseBoolean(currentTable.get(IS_FALSE_COLOR));
}

public boolean isRGB() {
return new Boolean(currentTable.get(IS_RGB)).booleanValue();
return Boolean.parseBoolean(currentTable.get(IS_RGB));
}

public int getThumbSizeX() {
Expand All @@ -289,7 +289,7 @@ public String getPixelType() {
}

public boolean isLittleEndian() {
return new Boolean(currentTable.get(IS_LITTLE_ENDIAN)).booleanValue();
return Boolean.parseBoolean(currentTable.get(IS_LITTLE_ENDIAN));
}

public String getMD5() {
Expand Down Expand Up @@ -324,7 +324,7 @@ public Time getTimeIncrement() {
String timeIncrement = currentTable.get(TIME_INCREMENT);
String timeIncrementUnits = currentTable.get(TIME_INCREMENT_UNIT);
try {
return timeIncrement == null ? null : FormatTools.getTime(new Double(timeIncrement), timeIncrementUnits);
return timeIncrement == null ? null : FormatTools.getTime(DataTools.parseDouble(timeIncrement), timeIncrementUnits);
}
catch (NumberFormatException e) {
return null;
Expand All @@ -351,7 +351,7 @@ public Time getExposureTime(int channel) {
String exposure = currentTable.get(EXPOSURE_TIME + channel);
String exposureUnits = currentTable.get(EXPOSURE_TIME_UNIT + channel);
try {
return exposure == null ? null : FormatTools.getTime(new Double(exposure), exposureUnits);
return exposure == null ? null : FormatTools.getTime(DataTools.parseDouble(exposure), exposureUnits);
}
catch (NumberFormatException e) {
return null;
Expand All @@ -360,12 +360,12 @@ public Time getExposureTime(int channel) {

public Double getDeltaT(int plane) {
String deltaT = currentTable.get(DELTA_T + plane);
return deltaT == null ? null : new Double(deltaT);
return deltaT == null ? null : DataTools.parseDouble(deltaT);
}

public Double getPositionX(int plane) {
String pos = currentTable.get(X_POSITION + plane);
return pos == null ? null : new Double(pos);
return pos == null ? null : DataTools.parseDouble(pos);
}

public String getPositionXUnit(int plane) {
Expand All @@ -374,7 +374,7 @@ public String getPositionXUnit(int plane) {

public Double getPositionY(int plane) {
String pos = currentTable.get(Y_POSITION + plane);
return pos == null ? null : new Double(pos);
return pos == null ? null : DataTools.parseDouble(pos);
}

public String getPositionYUnit(int plane) {
Expand All @@ -383,7 +383,7 @@ public String getPositionYUnit(int plane) {

public Double getPositionZ(int plane) {
String pos = currentTable.get(Z_POSITION + plane);
return pos == null ? null : new Double(pos);
return pos == null ? null : DataTools.parseDouble(pos);
}

public String getPositionZUnit(int plane) {
Expand All @@ -394,7 +394,7 @@ public Length getEmissionWavelength(int channel) {
String wavelength = currentTable.get(EMISSION_WAVELENGTH + channel);
String emissionUnits = currentTable.get(EMISSION_WAVELENGTH_UNIT + channel);
try {
return wavelength == null ? null : FormatTools.getWavelength(new Double(wavelength), emissionUnits);
return wavelength == null ? null : FormatTools.getWavelength(DataTools.parseDouble(wavelength), emissionUnits);
}
catch (NumberFormatException e) {
return null;
Expand All @@ -405,7 +405,7 @@ public Length getExcitationWavelength(int channel) {
String wavelength = currentTable.get(EXCITATION_WAVELENGTH + channel);
String excitationUnits = currentTable.get(EXCITATION_WAVELENGTH_UNIT + channel);
try {
return wavelength == null ? null : FormatTools.getWavelength(new Double(wavelength), excitationUnits);
return wavelength == null ? null : FormatTools.getWavelength(DataTools.parseDouble(wavelength), excitationUnits);
}
catch (NumberFormatException e) {
return null;
Expand Down Expand Up @@ -828,7 +828,7 @@ private Length getPhysicalSize(String valueKey, String unitKey) {
String units = currentTable.get(unitKey);
try {
UnitsLength unit = units == null ? UnitsLength.MICROMETER : UnitsLength.fromString(units);
return physicalSize == null ? null : UnitsLength.create(new Double(physicalSize), unit);
return physicalSize == null ? null : UnitsLength.create(DataTools.parseDouble(physicalSize), unit);
}
catch (NumberFormatException e) { }
catch (EnumerationException e) { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,15 @@ public Object[][] getWriterList() {
String[] compressionTypes = writers[i].getCompressionTypes();
if (compressionTypes == null) {
try {
IFormatWriter w = (IFormatWriter) writers[i].getClass().newInstance();
IFormatWriter w = (IFormatWriter) writers[i].getClass().getDeclaredConstructor().newInstance();
tmp.add(w);
}
catch (InstantiationException ie) { }
catch (IllegalAccessException iae) { }
catch (ReflectiveOperationException roe) { }
continue;
}
for (int q=0; q<compressionTypes.length; q++) {
try {
IFormatWriter w = (IFormatWriter) writers[i].getClass().newInstance();
IFormatWriter w = (IFormatWriter) writers[i].getClass().getDeclaredConstructor().newInstance();
if (DataTools.containsValue(w.getPixelTypes(compressionTypes[q]),
reader.getPixelType()))
{
Expand All @@ -128,8 +127,7 @@ public Object[][] getWriterList() {
}
}
catch (FormatException fe) { }
catch (InstantiationException ie) { }
catch (IllegalAccessException iae) { }
catch (ReflectiveOperationException roe) { }
}
}
IFormatWriter[][] writersToUse = new IFormatWriter[tmp.size()][1];
Expand Down

0 comments on commit 60003ea

Please sign in to comment.