Skip to content

Commit

Permalink
Deprecated methods in Descriptor class, removed unused code
Browse files Browse the repository at this point in the history
- see issue #24084 , now I just documented the problem.
  • Loading branch information
dmatej committed Sep 18, 2022
1 parent 71a23f7 commit 6444a4c
Showing 1 changed file with 19 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@

package org.glassfish.deployment.common;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
Expand All @@ -39,14 +36,7 @@
*/
public class Descriptor extends DynamicAttributesDescriptor {

/**
* Notification String for a general descriptor change.
*/
public static final String DESCRIPTOR_CHANGED = "Descriptor change";
public static final String NAME_CHANGED = "NameChanged";
public static final String DESCRIPTION_CHANGED = "DescriptionChanged";
public static final String LARGE_ICON_CHANGED = "LargeIconChanged";
public static final String SMALL_ICON_CHANGED = "SmallIconChanged";
private static final long serialVersionUID = 1L;

/**
* static flag to indicate descriptors should bounds check.
Expand All @@ -56,21 +46,22 @@ public class Descriptor extends DynamicAttributesDescriptor {
/**
* My display name indexed by language
*/
private Map<String, String> displayNames = null;
private Map<String, String> displayNames;

/**
* My descriptions indexed by language
*/
private Map<String, String> descriptions = null;
private Map<String, String> descriptions;

/**
* icons map indexed by language
*/
private Map<String, String> largeIcons = null;
private Map<String, String> smallIcons = null;
private Map<String, String> largeIcons;
private Map<String, String> smallIcons;

private final Map<Class<? extends Descriptor>, List<? extends Descriptor>> descriptorExtensions = new HashMap<>();


/**
* The default constructor. Constructs a descriptor with
* name, description and icons as empty Strings.
Expand Down Expand Up @@ -161,21 +152,30 @@ public Descriptor(String name, String description) {
setLocalizedDescription(null, description);
}


/**
* Sets a global flag to enable or disable boudsn checking
* of deployment information
*
* @deprecated Changes global state, synchronization doesn't prevent concurrent change, because
* setters are not synchronized.
* @param b true for bounds checking on, false else.
*/
@Deprecated(since = "7.0.0", forRemoval = true)
public static synchronized void setBoundsChecking(boolean b) {
boundsChecking = b;
}


/**
* Answers whether the object model is bounds checking.
*
* @deprecated Changes global state, synchronization doesn't prevent concurrent change, because
* setters are not synchronized. Even worse, usages often rely on a change made by
* SetMethodAction (side effect).
* @return true for boudsn checking, false else.
*/
@Deprecated(since = "7.0.0", forRemoval = true)
public static synchronized boolean isBoundsChecking() {
return boundsChecking;
}
Expand Down Expand Up @@ -554,8 +554,8 @@ public static String createUniqueNameAmongstNamedDescriptors(String trialName, S
/**
* @return an iterator on the deployment-extension
*/
public Iterator<Object> getDeploymentExtensions() {
Vector<Object> extensions = (Vector<Object>) getExtraAttribute("deployment-extension");
public Iterator<Descriptor> getDeploymentExtensions() {
Vector<Descriptor> extensions = (Vector<Descriptor>) getExtraAttribute("deployment-extension");
if (extensions != null) {
return extensions.iterator();
}
Expand All @@ -579,7 +579,6 @@ public void addPrefixMapping(String mapping, String uri) {
/**
* @return the map of prefix to namepace uri
*/
@SuppressWarnings("unchecked")
public Map<String, String> getPrefixMapping() {
return (Map<String, String>) getExtraAttribute("prefix-mapping");
}
Expand Down Expand Up @@ -610,11 +609,11 @@ public void print(StringBuffer sb) {
if (prefix != null) {
sb.append("\n Prefix Mapping = ").append(prefix);
}
Iterator itr = getDeploymentExtensions();
Iterator<Descriptor> itr = getDeploymentExtensions();
if (itr != null && itr.hasNext()) {
do {
sb.append("\n Deployment Extension : ");
((Descriptor) (itr.next())).print(sb);
itr.next().print(sb);
} while (itr.hasNext());
}
sb.append("\n");
Expand Down Expand Up @@ -644,28 +643,4 @@ private void displayLocalizedMap(StringBuffer sb, Map<String, String> localizedM
public void visit(DescriptorVisitor aVisitor) {
aVisitor.accept(this);
}

//start IASRI 4713550
public String docType = null;

public String getDocType() {
return docType;
}

public void fillDocType(InputStream in) {
try {
BufferedReader inr = new BufferedReader(new InputStreamReader(in));
String s = inr.readLine();
while (s != null) {
if (s.indexOf("DOCTYPE") > -1) {
docType = s;
in.close();
return;
}
s = inr.readLine();
}
} catch (Exception e) {
// ignore
}
}
}

0 comments on commit 6444a4c

Please sign in to comment.