Skip to content

Commit bc29062

Browse files
author
Gintas Grigelionis
committed
Suppress “deprecation” and “unused” warnings
1 parent e14481c commit bc29062

File tree

17 files changed

+69
-5
lines changed

17 files changed

+69
-5
lines changed

src/java/org/apache/ivy/core/settings/IvySettings.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ private synchronized void addSystemProperties() {
316316
*
317317
* @param remote boolean
318318
*/
319+
@SuppressWarnings("deprecation")
319320
public synchronized void configureRepositories(boolean remote) {
320321
if (!repositoriesConfigured) {
321322
Properties props = new Properties();

src/java/org/apache/ivy/core/settings/XmlSettingsParser.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ public File resolveFile(String path, String filename) {
148148
doParse(settings);
149149
}
150150

151+
@SuppressWarnings("deprecation")
151152
private void doParse(URL settingsUrl) throws IOException, ParseException {
152153
this.settings = settingsUrl;
153154
InputStream stream = null;
@@ -319,6 +320,7 @@ private void cachesStarted(String qName, Map<String, String> attributes) {
319320
}
320321
}
321322

323+
@SuppressWarnings("deprecation")
322324
private void settingsStarted(String qName, Map<String, String> attributes) {
323325
if ("conf".equals(qName) && !deprecatedMessagePrinted) {
324326
Message.deprecated("'conf' is deprecated, use 'settings' instead (" + settings + ")");

src/java/org/apache/ivy/plugins/parser/m2/MavenVersionRangeParser.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ static boolean rangeAccepts(final String range, final String value) {
8080
return parsedRange != null && parsedRange.accepts(valToCompare);
8181
}
8282

83-
8483
private static Range parse(final String rangeValue) {
8584
if (rangeValue == null || rangeValue.trim().isEmpty()) {
8685
return null;
@@ -156,8 +155,11 @@ private interface Range {
156155

157156
private static final class BasicRange implements Range {
158157
private final DeweyDecimal lowerBound;
158+
159159
private final DeweyDecimal upperBound;
160+
160161
private final boolean lowerInclusive;
162+
161163
private final boolean upperInclusive;
162164

163165
private BasicRange(final DeweyDecimal lowerBound, final boolean lowerInclusive,
@@ -216,6 +218,7 @@ private static final class DeweyDecimal {
216218
*
217219
* @param components an array of integer components.
218220
*/
221+
@SuppressWarnings("unused")
219222
public DeweyDecimal(final int[] components) {
220223
this.components = new int[components.length];
221224
System.arraycopy(components, 0, this.components, 0, components.length);
@@ -242,11 +245,11 @@ public DeweyDecimal(final String string)
242245

243246
components[i] = Integer.parseInt(component);
244247

245-
//Strip '.' token
248+
// Strip '.' token
246249
if (tokenizer.hasMoreTokens()) {
247250
tokenizer.nextToken();
248251

249-
//If it ended in a dot, throw an exception
252+
// If it ended in a dot, throw an exception
250253
if (!tokenizer.hasMoreTokens()) {
251254
throw new NumberFormatException("DeweyDecimal ended in a '.'");
252255
}
@@ -259,6 +262,7 @@ public DeweyDecimal(final String string)
259262
*
260263
* @return the number of components in dewey decimal
261264
*/
265+
@SuppressWarnings("unused")
262266
public int getSize() {
263267
return components.length;
264268
}
@@ -269,6 +273,7 @@ public int getSize() {
269273
* @param index the index of components
270274
* @return the value of component at index
271275
*/
276+
@SuppressWarnings("unused")
272277
public int get(final int index) {
273278
return components[index];
274279
}
@@ -393,6 +398,7 @@ public String toString() {
393398
* @return result
394399
* @see java.lang.Comparable#compareTo(Object)
395400
*/
401+
@SuppressWarnings("unused")
396402
public int compareTo(DeweyDecimal other) {
397403
final int max = Math.max(other.components.length, components.length);
398404
for (int i = 0; i < max; i++) {

src/java/org/apache/ivy/plugins/parser/m2/PomReader.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ public class PomReader {
118118

119119
private final Element parentElement;
120120

121+
@SuppressWarnings("deprecation")
121122
public PomReader(final URL descriptorURL, final Resource res) throws IOException, SAXException {
122123
InputStream stream = new AddDTDFilterInputStream(
123124
URLHandlerRegistry.getDefault().openStream(descriptorURL));
@@ -373,6 +374,7 @@ public PomDependencyMgtElement(PomDependencyMgtElement copyFrom) {
373374

374375
/*
375376
* (non-Javadoc)
377+
*
376378
* @see org.apache.ivy.plugins.parser.m2.PomDependencyMgt#getGroupId()
377379
*/
378380
public String getGroupId() {
@@ -382,6 +384,7 @@ public String getGroupId() {
382384

383385
/*
384386
* (non-Javadoc)
387+
*
385388
* @see org.apache.ivy.plugins.parser.m2.PomDependencyMgt#getArtifaceId()
386389
*/
387390
public String getArtifactId() {
@@ -391,6 +394,7 @@ public String getArtifactId() {
391394

392395
/*
393396
* (non-Javadoc)
397+
*
394398
* @see org.apache.ivy.plugins.parser.m2.PomDependencyMgt#getVersion()
395399
*/
396400
public String getVersion() {
@@ -539,12 +543,17 @@ public class PomProfileElement {
539543
private static final String ACTIVE_BY_DEFAULT_ELEMENT = "activeByDefault";
540544

541545
private static final String OS = "os";
546+
542547
private static final String FAMILY = "family";
548+
543549
private static final String VERSION = "version";
550+
544551
private static final String ARCH = "arch";
545552

546553
private static final String FILE = "file";
554+
547555
private static final String MISSING = "missing";
556+
548557
private static final String EXISTS = "exists";
549558

550559
private static final String JDK = "jdk";

src/java/org/apache/ivy/plugins/repository/url/URLResource.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public long getLastModified() {
7474
return lastModified;
7575
}
7676

77+
@SuppressWarnings("deprecation")
7778
private void init() {
7879
final URLHandler handler = URLHandlerRegistry.getDefault();
7980
final URLInfo info;
@@ -114,6 +115,7 @@ public boolean isLocal() {
114115
return url.getProtocol().equals("file");
115116
}
116117

118+
@SuppressWarnings("deprecation")
117119
public InputStream openStream() throws IOException {
118120
final URLHandler handler = URLHandlerRegistry.getDefault();
119121
if (handler instanceof TimeoutConstrainedURLHandler) {

src/java/org/apache/ivy/util/FileUtil.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ public static boolean deepCopy(File src, File dest, CopyProgressListener l, bool
200200
return true;
201201
}
202202

203+
@SuppressWarnings("deprecation")
203204
public static void copy(final URL src, final File dest, final CopyProgressListener listener,
204205
final TimeoutConstraint timeoutConstraint) throws IOException {
205206
final URLHandler handler = URLHandlerRegistry.getDefault();
@@ -210,6 +211,7 @@ public static void copy(final URL src, final File dest, final CopyProgressListen
210211
handler.download(src, dest, listener);
211212
}
212213

214+
@SuppressWarnings("deprecation")
213215
public static void copy(final File src, final URL dest, final CopyProgressListener listener,
214216
final TimeoutConstraint timeoutConstraint) throws IOException {
215217
final URLHandler handler = URLHandlerRegistry.getDefault();
@@ -680,6 +682,7 @@ public boolean markSupported() {
680682

681683
private static final class DissectedPath {
682684
private final String root;
685+
683686
private final String remainingPath;
684687

685688
private DissectedPath(final String root, final String remainingPath) {

src/java/org/apache/ivy/util/XMLHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ public static void parse(URL xmlURL, URL schema, DefaultHandler handler) throws
117117
}
118118

119119
public static void parse(URL xmlURL, URL schema, DefaultHandler handler, LexicalHandler lHandler)
120+
@SuppressWarnings("deprecation")
120121
throws SAXException, IOException, ParserConfigurationException {
121122
InputStream xmlStream = URLHandlerRegistry.getDefault().openStream(xmlURL);
122123
try {
@@ -142,6 +143,7 @@ public static void parse(InputSource xmlStream, URL schema, DefaultHandler handl
142143
parse(xmlStream, schema, handler, lHandler, true);
143144
}
144145

146+
@SuppressWarnings("deprecation")
145147
public static void parse(InputSource xmlStream, URL schema, DefaultHandler handler,
146148
LexicalHandler lHandler, boolean loadExternalDtds) throws SAXException, IOException,
147149
ParserConfigurationException {

src/java/org/apache/ivy/util/url/AbstractURLHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030
import java.util.zip.GZIPInputStream;
3131
import java.util.zip.Inflater;
3232
import java.util.zip.InflaterInputStream;
33+
3334
import org.apache.ivy.Ivy;
3435
import org.apache.ivy.core.settings.TimeoutConstraint;
3536

37+
@SuppressWarnings("deprecation")
3638
public abstract class AbstractURLHandler implements URLHandler {
3739

3840
private static final Pattern ESCAPE_PATTERN = Pattern.compile("%25([0-9a-fA-F][0-9a-fA-F])");
@@ -70,7 +72,6 @@ public long getLastModified(final URL url, final int timeout) {
7072
return getURLInfo(url, timeout).getLastModified();
7173
}
7274

73-
7475
protected String getUserAgent() {
7576
return System.getProperty("http.agent", "Apache Ivy/" + Ivy.getIvyVersion());
7677
}

src/java/org/apache/ivy/util/url/ApacheURLLister.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ public List<URL> listFiles(URL url) throws IOException {
101101
* @throws IOException
102102
* If an error occurs retrieving the HTML.
103103
*/
104+
@SuppressWarnings("deprecation")
104105
public List<URL> retrieveListing(URL url, boolean includeFiles, boolean includeDirectories)
105106
throws IOException {
106107
List<URL> urlList = new ArrayList<>();

src/java/org/apache/ivy/util/url/BasicURLHandler.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,37 @@ private HttpStatus() {
5050
}
5151
}
5252

53+
@SuppressWarnings("deprecation")
5354
@Override
5455
public URLInfo getURLInfo(final URL url) {
5556
return this.getURLInfo(url, null);
5657
}
5758

59+
@SuppressWarnings("deprecation")
5860
@Override
5961
public URLInfo getURLInfo(final URL url, final int timeout) {
6062
return this.getURLInfo(url, createTimeoutConstraints(timeout));
6163
}
6264

65+
@SuppressWarnings("deprecation")
6366
@Override
6467
public boolean isReachable(final URL url, final TimeoutConstraint timeoutConstraint) {
6568
return this.getURLInfo(url, timeoutConstraint).isReachable();
6669
}
6770

71+
@SuppressWarnings("deprecation")
6872
@Override
6973
public long getContentLength(final URL url, final TimeoutConstraint timeoutConstraint) {
7074
return this.getURLInfo(url, timeoutConstraint).getContentLength();
7175
}
7276

77+
@SuppressWarnings("deprecation")
7378
@Override
7479
public long getLastModified(final URL url, final TimeoutConstraint timeoutConstraint) {
7580
return this.getURLInfo(url, timeoutConstraint).getLastModified();
7681
}
7782

83+
@SuppressWarnings("deprecation")
7884
@Override
7985
public URLInfo getURLInfo(final URL url, final TimeoutConstraint timeoutConstraint) {
8086
// Install the IvyAuthenticator

0 commit comments

Comments
 (0)