11/*
2- * Copyright (c) 2000, 2024 , Oracle and/or its affiliates. All rights reserved.
2+ * Copyright (c) 2000, 2025 , Oracle and/or its affiliates. All rights reserved.
33 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44 *
55 * This code is free software; you can redistribute it and/or modify it
@@ -201,12 +201,16 @@ public DescriptorSupport(DescriptorSupport inDescr) {
201201 * @exception XMLParseException XML parsing problem while parsing
202202 * the input String
203203 * @exception MBeanException Wraps a distributed communication Exception.
204+ * @deprecated This constructor exists for historical reasons. If
205+ * reading from XML is required, it should be implemented externally.
204206 */
205207 /* At some stage we should rewrite this code to be cleverer. Using
206208 a StringTokenizer as we do means, first, that we accept a lot of
207209 bogus strings without noticing they are bogus, and second, that we
208210 split the string being parsed at characters like > even if they
209211 occur in the middle of a field value. */
212+ @ Deprecated (since ="25" , forRemoval =true )
213+ @ SuppressWarnings ("removal" )
210214 public DescriptorSupport (String inStr )
211215 throws MBeanException , RuntimeOperationsException ,
212216 XMLParseException {
@@ -230,6 +234,7 @@ public DescriptorSupport(String inStr)
230234 if (!lowerInStr .startsWith ("<descriptor>" )
231235 || !lowerInStr .endsWith ("</descriptor>" )) {
232236 throw new XMLParseException ("No <descriptor>, </descriptor> pair" );
237+ // XMLParseException is deprecated for removal.
233238 }
234239
235240 // parse xmlstring into structures
@@ -284,11 +289,13 @@ else if (kwPart.equalsIgnoreCase("VALUE"))
284289 final String msg =
285290 "Expected `name' or `value', got `" + tok + "'" ;
286291 throw new XMLParseException (msg );
292+ // XMLParseException is deprecated for removal.
287293 }
288294 } else { // xml parse exception
289295 final String msg =
290296 "Expected `keyword=value', got `" + tok + "'" ;
291297 throw new XMLParseException (msg );
298+ // XMLParseException is deprecated for removal.
292299 }
293300 }
294301 } // while tokens
@@ -967,7 +974,10 @@ private boolean validateField(String fldName, Object fldValue) {
967974 * field Names or field Values. If the XML formatted string
968975 * construction fails for any reason, this exception will be
969976 * thrown.
977+ * @deprecated This method exists for historical reasons. If
978+ * writing to XML is required, it should be implemented externally.
970979 */
980+ @ Deprecated (since ="25" , forRemoval =true )
971981 public synchronized String toXMLString () {
972982 final StringBuilder buf = new StringBuilder ("<Descriptor>" );
973983 Set <Map .Entry <String , Object >> returnedSet = descriptorMap .entrySet ();
@@ -1057,9 +1067,12 @@ private static String quote(String s) {
10571067 return buf .toString ();
10581068 }
10591069
1070+ @ SuppressWarnings ("removal" )
10601071 private static String unquote (String s ) throws XMLParseException {
1061- if (!s .startsWith ("\" " ) || !s .endsWith ("\" " ))
1072+ if (!s .startsWith ("\" " ) || !s .endsWith ("\" " )) {
10621073 throw new XMLParseException ("Value must be quoted: <" + s + ">" );
1074+ // XMLParseException is deprecated for removal.
1075+ }
10631076 final StringBuilder buf = new StringBuilder ();
10641077 final int len = s .length () - 1 ;
10651078 for (int i = 1 ; i < len ; i ++) {
@@ -1120,6 +1133,7 @@ private static String makeFieldValue(Object value) {
11201133 * - some other string, in which case the result is that string,
11211134 * without the parentheses.
11221135 */
1136+ @ SuppressWarnings ("removal" )
11231137 private static Object parseQuotedFieldValue (String s )
11241138 throws XMLParseException {
11251139 s = unquote (s );
@@ -1142,8 +1156,8 @@ private static Object parseQuotedFieldValue(String s)
11421156 Class .forName (className , false , contextClassLoader );
11431157 constr = c .getConstructor (new Class <?>[] {String .class });
11441158 } catch (Exception e ) {
1145- throw new XMLParseException (e ,
1146- "Cannot parse value: <" + s + ">" );
1159+ throw new XMLParseException (e , "Cannot parse value: <" + s + ">" );
1160+ // XMLParseException is deprecated for removal.
11471161 }
11481162 final String arg = s .substring (slash + 1 , s .length () - 1 );
11491163 try {
@@ -1153,6 +1167,7 @@ private static Object parseQuotedFieldValue(String s)
11531167 "Cannot construct instance of " + className +
11541168 " with arg: <" + s + ">" ;
11551169 throw new XMLParseException (e , msg );
1170+ // XMLParseException is deprecated for removal.
11561171 }
11571172 }
11581173
0 commit comments