code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void revert() {
for (Iterator i = listeners.iterator(); i.hasNext();) {
((CommitTriggerListener) i.next()).revert();
}
} } | public class class_name {
public void revert() {
for (Iterator i = listeners.iterator(); i.hasNext();) {
((CommitTriggerListener) i.next()).revert(); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public String fixValue(String value) {
logger.trace("Fix label value : ", value);
if (value != null && !value.equals("")) {
value = value.toUpperCase();
if (value.startsWith("MI "))
value = value.replaceFirst("MI ", "");
if (value.startsWith("MEN "))
value = value.replaceFirst("MEN ", "");
if (value.startsWith("MOD "))
value = value.replaceFirst("MOD ", "");
value = value.replaceAll("-", " ");
value = value.replaceAll("_", " ");
value = JKStringUtil.capitalizeFully(value);
// final String[] words = value.toLowerCase().split("_");
// value = "";
// for (final String word : words) {
// if (word.length() > 1) {
// value += word.substring(0, 1).toUpperCase() + word.substring(1) + " ";
// } else {
// value = word;
// }
// }
}
if (value.contains("\\n")) {
value = value.replace("\\n", System.getProperty("line.separator"));
}
return value;
} } | public class class_name {
public String fixValue(String value) {
logger.trace("Fix label value : ", value);
if (value != null && !value.equals("")) {
value = value.toUpperCase();
// depends on control dependency: [if], data = [none]
if (value.startsWith("MI "))
value = value.replaceFirst("MI ", "");
if (value.startsWith("MEN "))
value = value.replaceFirst("MEN ", "");
if (value.startsWith("MOD "))
value = value.replaceFirst("MOD ", "");
value = value.replaceAll("-", " ");
// depends on control dependency: [if], data = [none]
value = value.replaceAll("_", " ");
// depends on control dependency: [if], data = [none]
value = JKStringUtil.capitalizeFully(value);
// depends on control dependency: [if], data = [(value]
// final String[] words = value.toLowerCase().split("_");
// value = "";
// for (final String word : words) {
// if (word.length() > 1) {
// value += word.substring(0, 1).toUpperCase() + word.substring(1) + " ";
// } else {
// value = word;
// }
// }
}
if (value.contains("\\n")) {
value = value.replace("\\n", System.getProperty("line.separator"));
}
return value;
// depends on control dependency: [if], data = [none]
} } |
public class class_name {
private static Map<String, String> getRankMap(Utils utils, List<? extends Element> params){
if (params == null) {
return null;
}
HashMap<String, String> result = new HashMap<>();
int rank = 0;
for (Element e : params) {
String name = utils.isTypeParameterElement(e)
? utils.getTypeName(e.asType(), false)
: utils.getSimpleName(e);
result.put(name, String.valueOf(rank));
rank++;
}
return result;
} } | public class class_name {
private static Map<String, String> getRankMap(Utils utils, List<? extends Element> params){
if (params == null) {
return null; // depends on control dependency: [if], data = [none]
}
HashMap<String, String> result = new HashMap<>();
int rank = 0;
for (Element e : params) {
String name = utils.isTypeParameterElement(e)
? utils.getTypeName(e.asType(), false)
: utils.getSimpleName(e);
result.put(name, String.valueOf(rank)); // depends on control dependency: [for], data = [e]
rank++; // depends on control dependency: [for], data = [none]
}
return result;
} } |
public class class_name {
private List< Dashboard > findExistingDashboardsFromRequest( DashboardRemoteRequest request ) {
String businessService = request.getMetaData().getBusinessService();
String businessApplication = request.getMetaData().getBusinessApplication();
if( !StringUtils.isEmpty( businessService ) && !StringUtils.isEmpty( businessApplication ) ){
return dashboardRepository.findAllByConfigurationItemBusServNameContainingIgnoreCaseAndConfigurationItemBusAppNameContainingIgnoreCase( businessService, businessApplication );
}else {
return dashboardRepository.findByTitle( request.getMetaData().getTitle() );
}
} } | public class class_name {
private List< Dashboard > findExistingDashboardsFromRequest( DashboardRemoteRequest request ) {
String businessService = request.getMetaData().getBusinessService();
String businessApplication = request.getMetaData().getBusinessApplication();
if( !StringUtils.isEmpty( businessService ) && !StringUtils.isEmpty( businessApplication ) ){
return dashboardRepository.findAllByConfigurationItemBusServNameContainingIgnoreCaseAndConfigurationItemBusAppNameContainingIgnoreCase( businessService, businessApplication ); // depends on control dependency: [if], data = [none]
}else {
return dashboardRepository.findByTitle( request.getMetaData().getTitle() ); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void onEvent(FSMState state) {
if (logger.isEnabledFor(Priority.WARN)) {
logger.warn(String.format("PENDING timedout for As=%s", this.asImpl.getName()));
}
// Clear the Pending Queue for this As
this.asImpl.clearPendingQueue();
this.inactive = false;
// check if there are any ASP's who are INACTIVE, transition to
// INACTIVE else DOWN
for (FastList.Node<Asp> n = this.asImpl.appServerProcs.head(), end = this.asImpl.appServerProcs.tail(); (n = n
.getNext()) != end;) {
AspImpl aspImpl = (AspImpl) n.getValue();
FSM aspLocalFSM = aspImpl.getLocalFSM();
if (AspState.getState(aspLocalFSM.getState().getName()) == AspState.INACTIVE) {
try {
this.fsm.signal(TransitionState.AS_INACTIVE);
inactive = true;
break;
} catch (UnknownTransitionException e) {
logger.error(e.getMessage(), e);
}
}// if
}// for
if (!this.inactive) {
// else transition to DOWN
try {
this.fsm.signal(TransitionState.AS_DOWN);
inactive = true;
} catch (UnknownTransitionException e) {
logger.error(e.getMessage(), e);
}
}
// Now send MTP3 PAUSE
FastSet<AsStateListener> asStateListeners = this.asImpl.getAsStateListeners();
for (FastSet.Record r = asStateListeners.head(), end = asStateListeners.tail(); (r = r.getNext()) != end;) {
AsStateListener asAsStateListener = asStateListeners.valueOf(r);
try {
asAsStateListener.onAsInActive(this.asImpl);
} catch (Exception e) {
logger.error(String.format("Error while calling AsStateListener=%s onAsInActive method for As=%s",
asAsStateListener, this.asImpl));
}
}
} } | public class class_name {
public void onEvent(FSMState state) {
if (logger.isEnabledFor(Priority.WARN)) {
logger.warn(String.format("PENDING timedout for As=%s", this.asImpl.getName())); // depends on control dependency: [if], data = [none]
}
// Clear the Pending Queue for this As
this.asImpl.clearPendingQueue();
this.inactive = false;
// check if there are any ASP's who are INACTIVE, transition to
// INACTIVE else DOWN
for (FastList.Node<Asp> n = this.asImpl.appServerProcs.head(), end = this.asImpl.appServerProcs.tail(); (n = n
.getNext()) != end;) {
AspImpl aspImpl = (AspImpl) n.getValue();
FSM aspLocalFSM = aspImpl.getLocalFSM();
if (AspState.getState(aspLocalFSM.getState().getName()) == AspState.INACTIVE) {
try {
this.fsm.signal(TransitionState.AS_INACTIVE); // depends on control dependency: [try], data = [none]
inactive = true; // depends on control dependency: [try], data = [none]
break;
} catch (UnknownTransitionException e) {
logger.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}// if
}// for
if (!this.inactive) {
// else transition to DOWN
try {
this.fsm.signal(TransitionState.AS_DOWN); // depends on control dependency: [try], data = [none]
inactive = true; // depends on control dependency: [try], data = [none]
} catch (UnknownTransitionException e) {
logger.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
// Now send MTP3 PAUSE
FastSet<AsStateListener> asStateListeners = this.asImpl.getAsStateListeners();
for (FastSet.Record r = asStateListeners.head(), end = asStateListeners.tail(); (r = r.getNext()) != end;) {
AsStateListener asAsStateListener = asStateListeners.valueOf(r);
try {
asAsStateListener.onAsInActive(this.asImpl); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error(String.format("Error while calling AsStateListener=%s onAsInActive method for As=%s",
asAsStateListener, this.asImpl));
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
protected Token fetchSpecialId() {
Token result = Token.create(Token.TokenType.SPECIAL_ID, input.current());
result.addToTrigger(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume());
}
return handleKeywords(result);
} } | public class class_name {
protected Token fetchSpecialId() {
Token result = Token.create(Token.TokenType.SPECIAL_ID, input.current());
result.addToTrigger(input.consume());
while (isIdentifierChar(input.current())) {
result.addToContent(input.consume()); // depends on control dependency: [while], data = [none]
}
return handleKeywords(result);
} } |
public class class_name {
public void evaluate(DoubleSolution solution) {
int numberOfVariables = getNumberOfVariables();
int numberOfObjectives = getNumberOfObjectives() ;
double[] f = new double[numberOfObjectives];
double[] x = new double[numberOfVariables] ;
int k = getNumberOfVariables() - getNumberOfObjectives() + 1;
for (int i = 0; i < numberOfVariables; i++) {
x[i] = solution.getVariableValue(i) ;
}
double g = 0.0;
for (int i = numberOfVariables - k; i < numberOfVariables; i++) {
g += x[i];
}
g = 1 + (9.0 * g) / k;
System.arraycopy(x, 0, f, 0, numberOfObjectives - 1);
double h = 0.0;
for (int i = 0; i < numberOfObjectives - 1; i++) {
h += (f[i] / (1.0 + g)) * (1 + Math.sin(3.0 * Math.PI * f[i]));
}
h = numberOfObjectives - h;
f[numberOfObjectives - 1] = (1 + g) * h;
for (int i = 0; i < numberOfObjectives; i++) {
solution.setObjective(i, f[i]);
}
} } | public class class_name {
public void evaluate(DoubleSolution solution) {
int numberOfVariables = getNumberOfVariables();
int numberOfObjectives = getNumberOfObjectives() ;
double[] f = new double[numberOfObjectives];
double[] x = new double[numberOfVariables] ;
int k = getNumberOfVariables() - getNumberOfObjectives() + 1;
for (int i = 0; i < numberOfVariables; i++) {
x[i] = solution.getVariableValue(i) ;
// depends on control dependency: [for], data = [i]
}
double g = 0.0;
for (int i = numberOfVariables - k; i < numberOfVariables; i++) {
g += x[i];
// depends on control dependency: [for], data = [i]
}
g = 1 + (9.0 * g) / k;
System.arraycopy(x, 0, f, 0, numberOfObjectives - 1);
double h = 0.0;
for (int i = 0; i < numberOfObjectives - 1; i++) {
h += (f[i] / (1.0 + g)) * (1 + Math.sin(3.0 * Math.PI * f[i]));
// depends on control dependency: [for], data = [i]
}
h = numberOfObjectives - h;
f[numberOfObjectives - 1] = (1 + g) * h;
for (int i = 0; i < numberOfObjectives; i++) {
solution.setObjective(i, f[i]);
// depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
private void addScriptingLineInfo(Element jspElement) {
JspId jspId = new JspId(jspElement.getAttributeNS(Constants.JSP_NAMESPACE, "id"));
if (fileList.contains(jspId.getFilePath()) == false) {
smapStratum.addFile(jspId.getFileName(), jspId.getFilePath());
fileList.add(jspId.getFilePath()); //227804
}
if (jspId.getStartGeneratedLineNum() > 0) {
CDATASection cdata = (CDATASection)jspElement.getChildNodes().item(0);
BufferedReader reader = new BufferedReader(new StringReader(cdata.getData()));
int skipLeadingCount = 0;
int skipTrailingCount = 0;
int lineCount = 0;
boolean contentFound = false;
try {
for (String line = null;(line = reader.readLine()) != null;) {
lineCount++;
if (line.trim().length() < 1) {
if (contentFound) {
skipTrailingCount++;
}
else {
skipLeadingCount++;
}
}
else {
contentFound = true;
skipTrailingCount = 0;
}
}
}
catch (IOException ex) {}
smapStratum.addLineData(jspId.getStartSourceLineNum()+skipLeadingCount,
jspId.getFileName(),
lineCount - skipLeadingCount - skipTrailingCount,
jspId.getStartGeneratedLineNum()+skipLeadingCount,
1);
}
} } | public class class_name {
private void addScriptingLineInfo(Element jspElement) {
JspId jspId = new JspId(jspElement.getAttributeNS(Constants.JSP_NAMESPACE, "id"));
if (fileList.contains(jspId.getFilePath()) == false) {
smapStratum.addFile(jspId.getFileName(), jspId.getFilePath()); // depends on control dependency: [if], data = [none]
fileList.add(jspId.getFilePath()); //227804 // depends on control dependency: [if], data = [none]
}
if (jspId.getStartGeneratedLineNum() > 0) {
CDATASection cdata = (CDATASection)jspElement.getChildNodes().item(0);
BufferedReader reader = new BufferedReader(new StringReader(cdata.getData()));
int skipLeadingCount = 0;
int skipTrailingCount = 0;
int lineCount = 0;
boolean contentFound = false;
try {
for (String line = null;(line = reader.readLine()) != null;) {
lineCount++; // depends on control dependency: [for], data = [none]
if (line.trim().length() < 1) {
if (contentFound) {
skipTrailingCount++; // depends on control dependency: [if], data = [none]
}
else {
skipLeadingCount++; // depends on control dependency: [if], data = [none]
}
}
else {
contentFound = true; // depends on control dependency: [if], data = [none]
skipTrailingCount = 0; // depends on control dependency: [if], data = [none]
}
}
}
catch (IOException ex) {} // depends on control dependency: [catch], data = [none]
smapStratum.addLineData(jspId.getStartSourceLineNum()+skipLeadingCount,
jspId.getFileName(),
lineCount - skipLeadingCount - skipTrailingCount,
jspId.getStartGeneratedLineNum()+skipLeadingCount,
1); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Object getDefaultValue(Class<? extends Annotation> annotationType, String attributeName) {
try {
Method method = annotationType.getDeclaredMethod(attributeName, new Class[0]);
return method.getDefaultValue();
}
catch (Exception ex) {
return null;
}
} } | public class class_name {
public static Object getDefaultValue(Class<? extends Annotation> annotationType, String attributeName) {
try {
Method method = annotationType.getDeclaredMethod(attributeName, new Class[0]);
return method.getDefaultValue(); // depends on control dependency: [try], data = [none]
}
catch (Exception ex) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected int copyToBuffer(StringBuilder s, int initialLen, int startChar, int currentChar) {
int overrun = 0;
int currentSize = s.length() - initialLen;
int readSize = currentChar - startChar;
if (maxLine > -1 && currentSize + readSize > maxLine) {
int adjustedReadSize = maxLine - currentSize;
if (adjustedReadSize > 0) {
s.append(cb, startChar, adjustedReadSize);
overrun = readSize - adjustedReadSize;
} else {
overrun = readSize;
}
} else {
s.append(cb, startChar, readSize);
}
return overrun;
} } | public class class_name {
protected int copyToBuffer(StringBuilder s, int initialLen, int startChar, int currentChar) {
int overrun = 0;
int currentSize = s.length() - initialLen;
int readSize = currentChar - startChar;
if (maxLine > -1 && currentSize + readSize > maxLine) {
int adjustedReadSize = maxLine - currentSize;
if (adjustedReadSize > 0) {
s.append(cb, startChar, adjustedReadSize); // depends on control dependency: [if], data = [none]
overrun = readSize - adjustedReadSize; // depends on control dependency: [if], data = [none]
} else {
overrun = readSize; // depends on control dependency: [if], data = [none]
}
} else {
s.append(cb, startChar, readSize); // depends on control dependency: [if], data = [none]
}
return overrun;
} } |
public class class_name {
public int totalThreadTransactions() {
ArrayList<JtxTransaction> txList = txStack.get();
if (txList == null) {
return 0;
}
return txList.size();
} } | public class class_name {
public int totalThreadTransactions() {
ArrayList<JtxTransaction> txList = txStack.get();
if (txList == null) {
return 0; // depends on control dependency: [if], data = [none]
}
return txList.size();
} } |
public class class_name {
private Model makeModel() {
Model model = new DefaultModel();
Mapping map = model.getMapping();
//Create 4 online nodes
for (int i = 0; i < 4; i++) {
Node n = model.newNode();
nodes.add(n);
map.addOnlineNode(n);
}
//Create 6 VMs: vm0..vm5
for (int i = 0; i < 6; i++) {
VM v = model.newVM();
vms.add(v);
}
//vm2,vm1,vm0,vm3,vm5 are running on the nodes
map.addRunningVM(vms.get(2), nodes.get(0));
map.addRunningVM(vms.get(1), nodes.get(1));
map.addRunningVM(vms.get(0), nodes.get(2));
map.addRunningVM(vms.get(3), nodes.get(2));
map.addRunningVM(vms.get(5), nodes.get(3));
//vm4 is ready to be running on a node.
map.addReadyVM(vms.get(4));
//Declare a view to specify the "cpu" physical capacity of the nodes
// and the virtual consumption of the VMs.
//By default, nodes have 8 "cpu" resources
ShareableResource rcCPU = new ShareableResource("cpu", 8, 0);
rcCPU.setConsumption(vms.get(0), 2);
rcCPU.setConsumption(vms.get(1), 3);
rcCPU.setConsumption(vms.get(2), 4);
rcCPU.setConsumption(vms.get(3), 3);
rcCPU.setConsumption(vms.get(5), 5);
//By default, nodes have 7 "mem" resources
ShareableResource rcMem = new ShareableResource("mem", 7, 0);
rcMem.setConsumption(vms.get(0), 2);
rcMem.setConsumption(vms.get(1), 2);
rcMem.setConsumption(vms.get(2), 4);
rcMem.setConsumption(vms.get(3), 3);
rcMem.setConsumption(vms.get(5), 4);
//Attach the resources
model.attach(rcCPU);
model.attach(rcMem);
return model;
} } | public class class_name {
private Model makeModel() {
Model model = new DefaultModel();
Mapping map = model.getMapping();
//Create 4 online nodes
for (int i = 0; i < 4; i++) {
Node n = model.newNode();
nodes.add(n); // depends on control dependency: [for], data = [none]
map.addOnlineNode(n); // depends on control dependency: [for], data = [none]
}
//Create 6 VMs: vm0..vm5
for (int i = 0; i < 6; i++) {
VM v = model.newVM();
vms.add(v); // depends on control dependency: [for], data = [none]
}
//vm2,vm1,vm0,vm3,vm5 are running on the nodes
map.addRunningVM(vms.get(2), nodes.get(0));
map.addRunningVM(vms.get(1), nodes.get(1));
map.addRunningVM(vms.get(0), nodes.get(2));
map.addRunningVM(vms.get(3), nodes.get(2));
map.addRunningVM(vms.get(5), nodes.get(3));
//vm4 is ready to be running on a node.
map.addReadyVM(vms.get(4));
//Declare a view to specify the "cpu" physical capacity of the nodes
// and the virtual consumption of the VMs.
//By default, nodes have 8 "cpu" resources
ShareableResource rcCPU = new ShareableResource("cpu", 8, 0);
rcCPU.setConsumption(vms.get(0), 2);
rcCPU.setConsumption(vms.get(1), 3);
rcCPU.setConsumption(vms.get(2), 4);
rcCPU.setConsumption(vms.get(3), 3);
rcCPU.setConsumption(vms.get(5), 5);
//By default, nodes have 7 "mem" resources
ShareableResource rcMem = new ShareableResource("mem", 7, 0);
rcMem.setConsumption(vms.get(0), 2);
rcMem.setConsumption(vms.get(1), 2);
rcMem.setConsumption(vms.get(2), 4);
rcMem.setConsumption(vms.get(3), 3);
rcMem.setConsumption(vms.get(5), 4);
//Attach the resources
model.attach(rcCPU);
model.attach(rcMem);
return model;
} } |
public class class_name {
private final void validateChar(int value)
throws XMLStreamException
{
/* 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic,
* need to be reported by a surrogate pair..
*/
if (value >= 0xD800) {
if (value < 0xE000) { // no surrogates via entity expansion
reportIllegalChar(value);
}
if (value > 0xFFFF) {
// Within valid range at all?
if (value > MAX_UNICODE_CHAR) {
reportUnicodeOverflow();
}
} else if (value >= 0xFFFE) { // 0xFFFE and 0xFFFF are illegal too
reportIllegalChar(value);
}
// Ok, fine as is
} else if (value < 32) {
if (value == 0) {
throwParseError("Invalid character reference: null character not allowed in XML content.");
}
// XML 1.1 allows most other chars; 1.0 does not:
if (!mXml11 && !mAllowXml11EscapedCharsInXml10
&& (value != 0x9 && value != 0xA && value != 0xD)) {
reportIllegalChar(value);
}
}
} } | public class class_name {
private final void validateChar(int value)
throws XMLStreamException
{
/* 24-Jan-2006, TSa: Ok, "high" Unicode chars are problematic,
* need to be reported by a surrogate pair..
*/
if (value >= 0xD800) {
if (value < 0xE000) { // no surrogates via entity expansion
reportIllegalChar(value); // depends on control dependency: [if], data = [(value]
}
if (value > 0xFFFF) {
// Within valid range at all?
if (value > MAX_UNICODE_CHAR) {
reportUnicodeOverflow(); // depends on control dependency: [if], data = [none]
}
} else if (value >= 0xFFFE) { // 0xFFFE and 0xFFFF are illegal too
reportIllegalChar(value); // depends on control dependency: [if], data = [(value]
}
// Ok, fine as is
} else if (value < 32) {
if (value == 0) {
throwParseError("Invalid character reference: null character not allowed in XML content.");
}
// XML 1.1 allows most other chars; 1.0 does not:
if (!mXml11 && !mAllowXml11EscapedCharsInXml10
&& (value != 0x9 && value != 0xA && value != 0xD)) {
reportIllegalChar(value);
}
}
} } |
public class class_name {
public void close() {
if (open) {
PdfReaderInstance ri = currentPdfReaderInstance;
pdf.close();
super.close();
if (ri != null) {
try {
ri.getReader().close();
ri.getReaderFile().close();
}
catch (IOException ioe) {
// empty on purpose
}
}
}
} } | public class class_name {
public void close() {
if (open) {
PdfReaderInstance ri = currentPdfReaderInstance;
pdf.close(); // depends on control dependency: [if], data = [none]
super.close(); // depends on control dependency: [if], data = [none]
if (ri != null) {
try {
ri.getReader().close(); // depends on control dependency: [try], data = [none]
ri.getReaderFile().close(); // depends on control dependency: [try], data = [none]
}
catch (IOException ioe) {
// empty on purpose
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
FacesContext getFacesContextWithoutServletContextLookup() {
FacesContext result = facesContextCurrentInstance.get();
if (null == result) {
if (null != facesContextThreadInitContextMap && !facesContextThreadInitContextMap.isEmpty()) {
result = facesContextThreadInitContextMap.get(Thread.currentThread());
}
}
return result;
} } | public class class_name {
FacesContext getFacesContextWithoutServletContextLookup() {
FacesContext result = facesContextCurrentInstance.get();
if (null == result) {
if (null != facesContextThreadInitContextMap && !facesContextThreadInitContextMap.isEmpty()) {
result = facesContextThreadInitContextMap.get(Thread.currentThread()); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public static boolean isSupportedJDKType(TypeName typeName) {
if (typeName.isPrimitive()) {
return getPrimitiveTransform(typeName) != null;
}
String name = typeName.toString();
if (name.startsWith("java.lang")) {
return getLanguageTransform(typeName) != null;
}
if (name.startsWith("java.util")) {
return getUtilTransform(typeName) != null;
}
if (name.startsWith("java.math")) {
return getMathTransform(typeName) != null;
}
if (name.startsWith("java.net")) {
return getNetTransform(typeName) != null;
}
if (name.startsWith("java.sql")) {
return getSqlTransform(typeName) != null;
}
return false;
} } | public class class_name {
public static boolean isSupportedJDKType(TypeName typeName) {
if (typeName.isPrimitive()) {
return getPrimitiveTransform(typeName) != null; // depends on control dependency: [if], data = [none]
}
String name = typeName.toString();
if (name.startsWith("java.lang")) {
return getLanguageTransform(typeName) != null;
}
if (name.startsWith("java.util")) {
return getUtilTransform(typeName) != null;
}
if (name.startsWith("java.math")) {
return getMathTransform(typeName) != null;
}
if (name.startsWith("java.net")) {
return getNetTransform(typeName) != null;
}
if (name.startsWith("java.sql")) {
return getSqlTransform(typeName) != null;
}
return false;
} } |
public class class_name {
public ConfigurableEmitter duplicate() {
ConfigurableEmitter theCopy = null;
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ParticleIO.saveEmitter(bout, this);
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
theCopy = ParticleIO.loadEmitter(bin);
} catch (IOException e) {
Log.error("Slick: ConfigurableEmitter.duplicate(): caught exception " + e.toString());
return null;
}
return theCopy;
} } | public class class_name {
public ConfigurableEmitter duplicate() {
ConfigurableEmitter theCopy = null;
try {
ByteArrayOutputStream bout = new ByteArrayOutputStream();
ParticleIO.saveEmitter(bout, this);
// depends on control dependency: [try], data = [none]
ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
theCopy = ParticleIO.loadEmitter(bin);
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
Log.error("Slick: ConfigurableEmitter.duplicate(): caught exception " + e.toString());
return null;
}
// depends on control dependency: [catch], data = [none]
return theCopy;
} } |
public class class_name {
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
try {
HashSet<Class<?>> registeredTypes = new HashSet<>();
// Get Service Broker
ServiceBroker broker = applicationContext.getBean(ServiceBroker.class);
// Find Services in Spring Application Context
Map<String, Service> serviceMap = applicationContext.getBeansOfType(Service.class);
if (serviceMap != null && !serviceMap.isEmpty()) {
String name;
for (Map.Entry<String, Service> service : serviceMap.entrySet()) {
// Register Service in Broker
name = service.getKey();
registeredTypes.add(service.getClass());
if (name != null && name.startsWith("$")) {
broker.createService(name, service.getValue());
logger.info("Service \"" + name + "\" registered.");
} else {
Service instance = service.getValue();
broker.createService(instance);
logger.info("Service \"" + instance.getName() + "\" registered.");
}
}
}
// Add new Services
if (packagesToScan != null && packagesToScan.length > 0) {
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) applicationContext
.getAutowireCapableBeanFactory();
for (String packageName : packagesToScan) {
if (!packageName.isEmpty()) {
LinkedList<String> classNames = scan(packageName);
for (String className : classNames) {
if (className.indexOf('$') > -1) {
continue;
}
className = packageName + '.' + className;
Class<?> type = Class.forName(className);
if (Service.class.isAssignableFrom(type)) {
// Check type
if (!registeredTypes.add(type)) {
continue;
}
// Register Service in Spring
String name = nameOf(type, false);
BeanDefinition definition = BeanDefinitionBuilder.genericBeanDefinition(type)
.setScope(BeanDefinition.SCOPE_SINGLETON)
.setAutowireMode(DefaultListableBeanFactory.AUTOWIRE_BY_TYPE).setLazyInit(false)
.getBeanDefinition();
beanFactory.registerBeanDefinition(name, definition);
Service service = (Service) beanFactory.createBean(type);
// Register Service in Broker
broker.createService(service);
// Log
logger.info("Service \"" + name + "\" registered.");
}
}
}
}
}
} catch (Exception cause) {
throw new FatalBeanException("Unable to define Moleculer Service!", cause);
}
} } | public class class_name {
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
try {
HashSet<Class<?>> registeredTypes = new HashSet<>();
// Get Service Broker
ServiceBroker broker = applicationContext.getBean(ServiceBroker.class);
// Find Services in Spring Application Context
Map<String, Service> serviceMap = applicationContext.getBeansOfType(Service.class);
if (serviceMap != null && !serviceMap.isEmpty()) {
String name;
for (Map.Entry<String, Service> service : serviceMap.entrySet()) {
// Register Service in Broker
name = service.getKey();
// depends on control dependency: [for], data = [service]
registeredTypes.add(service.getClass());
// depends on control dependency: [for], data = [service]
if (name != null && name.startsWith("$")) {
broker.createService(name, service.getValue());
// depends on control dependency: [if], data = [(name]
logger.info("Service \"" + name + "\" registered.");
// depends on control dependency: [if], data = [none]
} else {
Service instance = service.getValue();
broker.createService(instance);
// depends on control dependency: [if], data = [none]
logger.info("Service \"" + instance.getName() + "\" registered.");
// depends on control dependency: [if], data = [none]
}
}
}
// Add new Services
if (packagesToScan != null && packagesToScan.length > 0) {
DefaultListableBeanFactory beanFactory = (DefaultListableBeanFactory) applicationContext
.getAutowireCapableBeanFactory();
for (String packageName : packagesToScan) {
if (!packageName.isEmpty()) {
LinkedList<String> classNames = scan(packageName);
for (String className : classNames) {
if (className.indexOf('$') > -1) {
continue;
}
className = packageName + '.' + className;
// depends on control dependency: [for], data = [className]
Class<?> type = Class.forName(className);
if (Service.class.isAssignableFrom(type)) {
// Check type
if (!registeredTypes.add(type)) {
continue;
}
// Register Service in Spring
String name = nameOf(type, false);
BeanDefinition definition = BeanDefinitionBuilder.genericBeanDefinition(type)
.setScope(BeanDefinition.SCOPE_SINGLETON)
.setAutowireMode(DefaultListableBeanFactory.AUTOWIRE_BY_TYPE).setLazyInit(false)
.getBeanDefinition();
beanFactory.registerBeanDefinition(name, definition);
// depends on control dependency: [if], data = [none]
Service service = (Service) beanFactory.createBean(type);
// Register Service in Broker
broker.createService(service);
// depends on control dependency: [if], data = [none]
// Log
logger.info("Service \"" + name + "\" registered.");
// depends on control dependency: [if], data = [none]
}
}
}
}
}
} catch (Exception cause) {
throw new FatalBeanException("Unable to define Moleculer Service!", cause);
}
} } |
public class class_name {
public Discriminator getDiscriminator() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "getDiscriminator should not be called in UDPChannel");
}
return null;
} } | public class class_name {
public Discriminator getDiscriminator() {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "getDiscriminator should not be called in UDPChannel"); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public List<String> getSectionNames() {
List<String> sections = new ArrayList<String>();
for (Map.Entry<String, String> entry : this.entrySet()) {
String key = entry.getKey();
int pos = key.indexOf('.');
if (pos > 0)
key = key.substring(0, pos);
// Perform case sensitive search
boolean found = false;
for (String section : sections) {
if (section.equalsIgnoreCase(key)) {
found = true;
break;
}
}
if (!found)
sections.add(key);
}
return sections;
} } | public class class_name {
public List<String> getSectionNames() {
List<String> sections = new ArrayList<String>();
for (Map.Entry<String, String> entry : this.entrySet()) {
String key = entry.getKey();
int pos = key.indexOf('.');
if (pos > 0)
key = key.substring(0, pos);
// Perform case sensitive search
boolean found = false;
for (String section : sections) {
if (section.equalsIgnoreCase(key)) {
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!found)
sections.add(key);
}
return sections;
} } |
public class class_name {
@Override
public final String getRuleSummary() {
final Collection<RuleViolation> values = ruleViolationMap.values();
final StringBuilder builder = new StringBuilder();
for (final RuleViolation ruleViolation : values) {
builder.append('[').append(ruleViolation.getRuleName()).append('/').append(ruleViolation.getStatus()) .append(']');
}
return builder.toString();
} } | public class class_name {
@Override
public final String getRuleSummary() {
final Collection<RuleViolation> values = ruleViolationMap.values();
final StringBuilder builder = new StringBuilder();
for (final RuleViolation ruleViolation : values) {
builder.append('[').append(ruleViolation.getRuleName()).append('/').append(ruleViolation.getStatus()) .append(']'); // depends on control dependency: [for], data = [ruleViolation]
}
return builder.toString();
} } |
public class class_name {
public static Object invokeMethod(Object object, Method method, Object... args) throws Throwable {
try {
return method.invoke(object, args);
} catch (InvocationTargetException e) {
throw e.getTargetException();
}
} } | public class class_name {
public static Object invokeMethod(Object object, Method method, Object... args) throws Throwable {
try {
return method.invoke(object, args); // depends on control dependency: [try], data = [none]
} catch (InvocationTargetException e) {
throw e.getTargetException();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Nullable
public ExpressionTreeElement addTreeElement(@Nonnull final ExpressionTreeElement element) {
assertNotEmptySlot();
assertNotNull("The element is null", element);
final int newElementPriority = element.getPriority();
ExpressionTreeElement result = this;
final ExpressionTreeElement parentTreeElement = this.parentTreeElement;
final int currentPriority = getPriority();
if (newElementPriority < currentPriority) {
if (parentTreeElement == null) {
element.addTreeElement(this);
result = element;
} else {
result = parentTreeElement.addTreeElement(element);
}
} else if (newElementPriority == currentPriority) {
if (parentTreeElement != null) {
parentTreeElement.replaceElement(this, element);
}
if (element.nextChildSlot >= element.childElements.length) {
throw new PreprocessorException("[Expression]Can't process expression item, may be wrong number of arguments", this.sourceString, this.includeStack, null);
}
element.childElements[element.nextChildSlot] = this;
element.nextChildSlot++;
this.parentTreeElement = element;
result = element;
} else if (isFull()) {
final int lastElementIndex = getArity() - 1;
final ExpressionTreeElement lastElement = childElements[lastElementIndex];
if (lastElement.getPriority() > newElementPriority) {
element.addElementToNextFreeSlot(lastElement);
childElements[lastElementIndex] = element;
element.parentTreeElement = this;
result = element;
}
} else {
addElementToNextFreeSlot(element);
result = element;
}
return result;
} } | public class class_name {
@Nullable
public ExpressionTreeElement addTreeElement(@Nonnull final ExpressionTreeElement element) {
assertNotEmptySlot();
assertNotNull("The element is null", element);
final int newElementPriority = element.getPriority();
ExpressionTreeElement result = this;
final ExpressionTreeElement parentTreeElement = this.parentTreeElement;
final int currentPriority = getPriority();
if (newElementPriority < currentPriority) {
if (parentTreeElement == null) {
element.addTreeElement(this); // depends on control dependency: [if], data = [none]
result = element; // depends on control dependency: [if], data = [none]
} else {
result = parentTreeElement.addTreeElement(element); // depends on control dependency: [if], data = [none]
}
} else if (newElementPriority == currentPriority) {
if (parentTreeElement != null) {
parentTreeElement.replaceElement(this, element); // depends on control dependency: [if], data = [none]
}
if (element.nextChildSlot >= element.childElements.length) {
throw new PreprocessorException("[Expression]Can't process expression item, may be wrong number of arguments", this.sourceString, this.includeStack, null);
}
element.childElements[element.nextChildSlot] = this; // depends on control dependency: [if], data = [none]
element.nextChildSlot++; // depends on control dependency: [if], data = [none]
this.parentTreeElement = element; // depends on control dependency: [if], data = [none]
result = element; // depends on control dependency: [if], data = [none]
} else if (isFull()) {
final int lastElementIndex = getArity() - 1;
final ExpressionTreeElement lastElement = childElements[lastElementIndex];
if (lastElement.getPriority() > newElementPriority) {
element.addElementToNextFreeSlot(lastElement); // depends on control dependency: [if], data = [none]
childElements[lastElementIndex] = element; // depends on control dependency: [if], data = [none]
element.parentTreeElement = this; // depends on control dependency: [if], data = [none]
result = element; // depends on control dependency: [if], data = [none]
}
} else {
addElementToNextFreeSlot(element); // depends on control dependency: [if], data = [none]
result = element; // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public static String decode(String str) {
if (str != null) {
try {
return URLDecoder.decode(str, UTF_8.name());
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("JVM must support UTF-8", e);
}
}
return null;
} } | public class class_name {
public static String decode(String str) {
if (str != null) {
try {
return URLDecoder.decode(str, UTF_8.name()); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
throw new RuntimeException("JVM must support UTF-8", e);
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
private void processServletMappingConfig(ServletMapping servletMapping) throws UnableToAdaptException {
String servletName = servletMapping.getServletName();
Map<String, ConfigItem<List<String>>> servletMappingMap = configurator.getConfigItemMap("servlet-mapping");
ConfigItem<List<String>> existedServletMapping = servletMappingMap.get(servletName);
if (existedServletMapping == null) {
List<String> urlPatterns = servletMapping.getURLPatterns();
for (String urlPattern : urlPatterns) {
if (isServletSpecLevel31OrHigher()) {
// Strange to 'put' on error cases.
String existingName = urlToServletNameMap.put(urlPattern, servletName);
if ((existingName != null) && !(existingName.equals(servletName))) {
Tr.error(tc,"duplicate.url.pattern.for.servlet.mapping", urlPattern, servletName, existingName);
throw new UnableToAdaptException(nls.getFormattedMessage("duplicate.url.pattern.for.servlet.mapping",
new Object[]{urlPattern, servletName, existingName} ,
"servlet-mapping value matches multiple servlets: " + urlPattern));
}
}
webAppConfiguration.addServletMapping(servletName, urlPattern);
}
if (urlPatterns.size() > 0) {
servletMappingMap.put(servletName, createConfigItem(urlPatterns));
}
} else {
if ((existedServletMapping.getSource() == ConfigSource.WEB_XML && configurator.getConfigSource() == ConfigSource.WEB_XML)
|| (existedServletMapping.getSource() == ConfigSource.WEB_FRAGMENT && configurator.getConfigSource() == ConfigSource.WEB_FRAGMENT)) {
for (String urlPattern : servletMapping.getURLPatterns()) {
if (isServletSpecLevel31OrHigher()) {
// Strange to 'put' on error cases.
String existingName = urlToServletNameMap.put(urlPattern,servletName);
if ((existingName != null) && !(existingName.equals(servletName))) {
Tr.error(tc,"duplicate.url.pattern.for.servlet.mapping", urlPattern, servletName, existingName);
throw new UnableToAdaptException( nls.getFormattedMessage("duplicate.url.pattern.for.servlet.mapping",
new Object[]{urlPattern, servletName, existingName} ,
"servlet-mapping value matches multiple servlets: " + urlPattern));
}
}
webAppConfiguration.addServletMapping(servletName, urlPattern);
}
} else if (existedServletMapping.getSource() == ConfigSource.WEB_XML && configurator.getConfigSource() == ConfigSource.WEB_FRAGMENT) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "servlet-mapping for servlet " + servletName + " is configured in web.xml, the value from web-fragment.xml in "
+ configurator.getLibraryURI()
+ " is ignored");
}
} else if (existedServletMapping.getSource() == ConfigSource.WEB_FRAGMENT && configurator.getConfigSource() == ConfigSource.ANNOTATION) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "servlet-mapping for servlet " + servletName + " is configured in web-fragment.xml from " + existedServletMapping.getLibraryURI()
+ " , the value from annotation is ignored");
}
}
}
} } | public class class_name {
private void processServletMappingConfig(ServletMapping servletMapping) throws UnableToAdaptException {
String servletName = servletMapping.getServletName();
Map<String, ConfigItem<List<String>>> servletMappingMap = configurator.getConfigItemMap("servlet-mapping");
ConfigItem<List<String>> existedServletMapping = servletMappingMap.get(servletName);
if (existedServletMapping == null) {
List<String> urlPatterns = servletMapping.getURLPatterns();
for (String urlPattern : urlPatterns) {
if (isServletSpecLevel31OrHigher()) {
// Strange to 'put' on error cases.
String existingName = urlToServletNameMap.put(urlPattern, servletName);
if ((existingName != null) && !(existingName.equals(servletName))) {
Tr.error(tc,"duplicate.url.pattern.for.servlet.mapping", urlPattern, servletName, existingName); // depends on control dependency: [if], data = [none]
throw new UnableToAdaptException(nls.getFormattedMessage("duplicate.url.pattern.for.servlet.mapping",
new Object[]{urlPattern, servletName, existingName} ,
"servlet-mapping value matches multiple servlets: " + urlPattern));
}
}
webAppConfiguration.addServletMapping(servletName, urlPattern);
}
if (urlPatterns.size() > 0) {
servletMappingMap.put(servletName, createConfigItem(urlPatterns));
}
} else {
if ((existedServletMapping.getSource() == ConfigSource.WEB_XML && configurator.getConfigSource() == ConfigSource.WEB_XML)
|| (existedServletMapping.getSource() == ConfigSource.WEB_FRAGMENT && configurator.getConfigSource() == ConfigSource.WEB_FRAGMENT)) {
for (String urlPattern : servletMapping.getURLPatterns()) {
if (isServletSpecLevel31OrHigher()) {
// Strange to 'put' on error cases.
String existingName = urlToServletNameMap.put(urlPattern,servletName);
if ((existingName != null) && !(existingName.equals(servletName))) {
Tr.error(tc,"duplicate.url.pattern.for.servlet.mapping", urlPattern, servletName, existingName); // depends on control dependency: [if], data = [none]
throw new UnableToAdaptException( nls.getFormattedMessage("duplicate.url.pattern.for.servlet.mapping",
new Object[]{urlPattern, servletName, existingName} ,
"servlet-mapping value matches multiple servlets: " + urlPattern));
}
}
webAppConfiguration.addServletMapping(servletName, urlPattern); // depends on control dependency: [for], data = [urlPattern]
}
} else if (existedServletMapping.getSource() == ConfigSource.WEB_XML && configurator.getConfigSource() == ConfigSource.WEB_FRAGMENT) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "servlet-mapping for servlet " + servletName + " is configured in web.xml, the value from web-fragment.xml in "
+ configurator.getLibraryURI()
+ " is ignored"); // depends on control dependency: [if], data = [none]
}
} else if (existedServletMapping.getSource() == ConfigSource.WEB_FRAGMENT && configurator.getConfigSource() == ConfigSource.ANNOTATION) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "servlet-mapping for servlet " + servletName + " is configured in web-fragment.xml from " + existedServletMapping.getLibraryURI()
+ " , the value from annotation is ignored"); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public PortletType<PortletDescriptor> getOrCreatePortlet()
{
List<Node> nodeList = model.get("portlet");
if (nodeList != null && nodeList.size() > 0)
{
return new PortletTypeImpl<PortletDescriptor>(this, "portlet", model, nodeList.get(0));
}
return createPortlet();
} } | public class class_name {
public PortletType<PortletDescriptor> getOrCreatePortlet()
{
List<Node> nodeList = model.get("portlet");
if (nodeList != null && nodeList.size() > 0)
{
return new PortletTypeImpl<PortletDescriptor>(this, "portlet", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createPortlet();
} } |
public class class_name {
public static boolean copy(File source, File dest) {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
boolean result = true;
try {
bis = new BufferedInputStream(new FileInputStream(source));
bos = new BufferedOutputStream(new FileOutputStream(dest, false));
byte[] buf = new byte[1024];
bis.read(buf);
do {
bos.write(buf);
} while (bis.read(buf) != -1);
} catch (IOException e) {
result = false;
} finally {
try {
if (bis != null) bis.close();
if (bos != null) bos.close();
} catch (IOException e) {
result = false;
}
}
return result;
} } | public class class_name {
public static boolean copy(File source, File dest) {
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
boolean result = true;
try {
bis = new BufferedInputStream(new FileInputStream(source)); // depends on control dependency: [try], data = [none]
bos = new BufferedOutputStream(new FileOutputStream(dest, false)); // depends on control dependency: [try], data = [none]
byte[] buf = new byte[1024];
bis.read(buf); // depends on control dependency: [try], data = [none]
do {
bos.write(buf);
} while (bis.read(buf) != -1);
} catch (IOException e) {
result = false;
} finally { // depends on control dependency: [catch], data = [none]
try {
if (bis != null) bis.close();
if (bos != null) bos.close();
} catch (IOException e) {
result = false;
} // depends on control dependency: [catch], data = [none]
}
return result;
} } |
public class class_name {
@SuppressWarnings("unchecked")
public void addBeanContextMembershipListener(BeanContextMembershipListener listener)
{
if (listener == null)
{
throw new NullPointerException();
}
synchronized (bcmListeners)
{
if (!bcmListeners.contains(listener))
{
bcmListeners.add(listener);
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
public void addBeanContextMembershipListener(BeanContextMembershipListener listener)
{
if (listener == null)
{
throw new NullPointerException();
}
synchronized (bcmListeners)
{
if (!bcmListeners.contains(listener))
{
bcmListeners.add(listener); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void marshall(UserPoolClientType userPoolClientType, ProtocolMarshaller protocolMarshaller) {
if (userPoolClientType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPoolClientType.getUserPoolId(), USERPOOLID_BINDING);
protocolMarshaller.marshall(userPoolClientType.getClientName(), CLIENTNAME_BINDING);
protocolMarshaller.marshall(userPoolClientType.getClientId(), CLIENTID_BINDING);
protocolMarshaller.marshall(userPoolClientType.getClientSecret(), CLIENTSECRET_BINDING);
protocolMarshaller.marshall(userPoolClientType.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING);
protocolMarshaller.marshall(userPoolClientType.getCreationDate(), CREATIONDATE_BINDING);
protocolMarshaller.marshall(userPoolClientType.getRefreshTokenValidity(), REFRESHTOKENVALIDITY_BINDING);
protocolMarshaller.marshall(userPoolClientType.getReadAttributes(), READATTRIBUTES_BINDING);
protocolMarshaller.marshall(userPoolClientType.getWriteAttributes(), WRITEATTRIBUTES_BINDING);
protocolMarshaller.marshall(userPoolClientType.getExplicitAuthFlows(), EXPLICITAUTHFLOWS_BINDING);
protocolMarshaller.marshall(userPoolClientType.getSupportedIdentityProviders(), SUPPORTEDIDENTITYPROVIDERS_BINDING);
protocolMarshaller.marshall(userPoolClientType.getCallbackURLs(), CALLBACKURLS_BINDING);
protocolMarshaller.marshall(userPoolClientType.getLogoutURLs(), LOGOUTURLS_BINDING);
protocolMarshaller.marshall(userPoolClientType.getDefaultRedirectURI(), DEFAULTREDIRECTURI_BINDING);
protocolMarshaller.marshall(userPoolClientType.getAllowedOAuthFlows(), ALLOWEDOAUTHFLOWS_BINDING);
protocolMarshaller.marshall(userPoolClientType.getAllowedOAuthScopes(), ALLOWEDOAUTHSCOPES_BINDING);
protocolMarshaller.marshall(userPoolClientType.getAllowedOAuthFlowsUserPoolClient(), ALLOWEDOAUTHFLOWSUSERPOOLCLIENT_BINDING);
protocolMarshaller.marshall(userPoolClientType.getAnalyticsConfiguration(), ANALYTICSCONFIGURATION_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UserPoolClientType userPoolClientType, ProtocolMarshaller protocolMarshaller) {
if (userPoolClientType == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(userPoolClientType.getUserPoolId(), USERPOOLID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getClientName(), CLIENTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getClientId(), CLIENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getClientSecret(), CLIENTSECRET_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getLastModifiedDate(), LASTMODIFIEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getCreationDate(), CREATIONDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getRefreshTokenValidity(), REFRESHTOKENVALIDITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getReadAttributes(), READATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getWriteAttributes(), WRITEATTRIBUTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getExplicitAuthFlows(), EXPLICITAUTHFLOWS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getSupportedIdentityProviders(), SUPPORTEDIDENTITYPROVIDERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getCallbackURLs(), CALLBACKURLS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getLogoutURLs(), LOGOUTURLS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getDefaultRedirectURI(), DEFAULTREDIRECTURI_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getAllowedOAuthFlows(), ALLOWEDOAUTHFLOWS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getAllowedOAuthScopes(), ALLOWEDOAUTHSCOPES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getAllowedOAuthFlowsUserPoolClient(), ALLOWEDOAUTHFLOWSUSERPOOLCLIENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(userPoolClientType.getAnalyticsConfiguration(), ANALYTICSCONFIGURATION_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Nullable
public static PathAndQuery parse(@Nullable String rawPath) {
if (CACHE != null && rawPath != null) {
final PathAndQuery parsed = CACHE.getIfPresent(rawPath);
if (parsed != null) {
return parsed;
}
}
return splitPathAndQuery(rawPath);
} } | public class class_name {
@Nullable
public static PathAndQuery parse(@Nullable String rawPath) {
if (CACHE != null && rawPath != null) {
final PathAndQuery parsed = CACHE.getIfPresent(rawPath);
if (parsed != null) {
return parsed; // depends on control dependency: [if], data = [none]
}
}
return splitPathAndQuery(rawPath);
} } |
public class class_name {
private void adaptHeaderIcon(@Nullable final DrawableAnimation animation) {
if (headerIconImageView != null) {
ImageViewCompat.setImageTintList(headerIconImageView, headerIconTintList);
ImageViewCompat.setImageTintMode(headerIconImageView, headerIconTintMode);
Drawable newIcon = headerIcon;
if (animation != null && newIcon != null) {
Drawable previousIcon = headerIconImageView.getDrawable();
if (previousIcon != null) {
if (previousIcon instanceof AbstractTransitionDrawable) {
previousIcon = ((AbstractTransitionDrawable) previousIcon).getDrawable(1);
}
if (animation instanceof ScaleTransitionAnimation) {
ScaleTransitionDrawable transition =
new ScaleTransitionDrawable(new Drawable[]{previousIcon, newIcon});
transition.setListener(animation.getListener());
transition.startTransition(animation.getDuration());
newIcon = transition;
} else if (animation instanceof CircleTransitionAnimation) {
CircleTransitionAnimation circleTransitionAnimation =
(CircleTransitionAnimation) animation;
CircleTransitionDrawable transition =
new CircleTransitionDrawable(new Drawable[]{previousIcon, newIcon});
transition.setRadius(circleTransitionAnimation.getRadius());
transition.setListener(circleTransitionAnimation.getListener());
if (circleTransitionAnimation.getX() != null) {
transition.setX(circleTransitionAnimation.getX());
}
if (circleTransitionAnimation.getY() != null) {
transition.setY(circleTransitionAnimation.getY());
}
transition.startTransition(circleTransitionAnimation.getDuration());
newIcon = transition;
} else if (animation instanceof CrossFadeTransitionAnimation) {
CrossFadeTransitionDrawable transition = new CrossFadeTransitionDrawable(
new Drawable[]{previousIcon, newIcon});
transition.setCrossFade(true);
transition.setListener(animation.getListener());
transition.startTransition(animation.getDuration());
newIcon = transition;
} else {
throw new RuntimeException("Unknown type of animation: " +
animation.getClass().getSimpleName());
}
}
}
headerIconImageView.setImageDrawable(newIcon);
}
} } | public class class_name {
private void adaptHeaderIcon(@Nullable final DrawableAnimation animation) {
if (headerIconImageView != null) {
ImageViewCompat.setImageTintList(headerIconImageView, headerIconTintList); // depends on control dependency: [if], data = [(headerIconImageView]
ImageViewCompat.setImageTintMode(headerIconImageView, headerIconTintMode); // depends on control dependency: [if], data = [(headerIconImageView]
Drawable newIcon = headerIcon;
if (animation != null && newIcon != null) {
Drawable previousIcon = headerIconImageView.getDrawable();
if (previousIcon != null) {
if (previousIcon instanceof AbstractTransitionDrawable) {
previousIcon = ((AbstractTransitionDrawable) previousIcon).getDrawable(1); // depends on control dependency: [if], data = [none]
}
if (animation instanceof ScaleTransitionAnimation) {
ScaleTransitionDrawable transition =
new ScaleTransitionDrawable(new Drawable[]{previousIcon, newIcon});
transition.setListener(animation.getListener()); // depends on control dependency: [if], data = [none]
transition.startTransition(animation.getDuration()); // depends on control dependency: [if], data = [none]
newIcon = transition; // depends on control dependency: [if], data = [none]
} else if (animation instanceof CircleTransitionAnimation) {
CircleTransitionAnimation circleTransitionAnimation =
(CircleTransitionAnimation) animation;
CircleTransitionDrawable transition =
new CircleTransitionDrawable(new Drawable[]{previousIcon, newIcon});
transition.setRadius(circleTransitionAnimation.getRadius()); // depends on control dependency: [if], data = [none]
transition.setListener(circleTransitionAnimation.getListener()); // depends on control dependency: [if], data = [none]
if (circleTransitionAnimation.getX() != null) {
transition.setX(circleTransitionAnimation.getX()); // depends on control dependency: [if], data = [(circleTransitionAnimation.getX()]
}
if (circleTransitionAnimation.getY() != null) {
transition.setY(circleTransitionAnimation.getY()); // depends on control dependency: [if], data = [(circleTransitionAnimation.getY()]
}
transition.startTransition(circleTransitionAnimation.getDuration()); // depends on control dependency: [if], data = [none]
newIcon = transition; // depends on control dependency: [if], data = [none]
} else if (animation instanceof CrossFadeTransitionAnimation) {
CrossFadeTransitionDrawable transition = new CrossFadeTransitionDrawable(
new Drawable[]{previousIcon, newIcon});
transition.setCrossFade(true); // depends on control dependency: [if], data = [none]
transition.setListener(animation.getListener()); // depends on control dependency: [if], data = [none]
transition.startTransition(animation.getDuration()); // depends on control dependency: [if], data = [none]
newIcon = transition; // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Unknown type of animation: " +
animation.getClass().getSimpleName());
}
}
}
headerIconImageView.setImageDrawable(newIcon); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public java.util.List<String> getCompatibleRuntimes() {
if (compatibleRuntimes == null) {
compatibleRuntimes = new com.amazonaws.internal.SdkInternalList<String>();
}
return compatibleRuntimes;
} } | public class class_name {
public java.util.List<String> getCompatibleRuntimes() {
if (compatibleRuntimes == null) {
compatibleRuntimes = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return compatibleRuntimes;
} } |
public class class_name {
public static StateBackend fromApplicationOrConfigOrDefault(
@Nullable StateBackend fromApplication,
Configuration config,
ClassLoader classLoader,
@Nullable Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException {
checkNotNull(config, "config");
checkNotNull(classLoader, "classLoader");
final StateBackend backend;
// (1) the application defined state backend has precedence
if (fromApplication != null) {
if (logger != null) {
logger.info("Using application-defined state backend: {}", fromApplication);
}
// see if this is supposed to pick up additional configuration parameters
if (fromApplication instanceof ConfigurableStateBackend) {
// needs to pick up configuration
if (logger != null) {
logger.info("Configuring application-defined state backend with job/cluster config");
}
backend = ((ConfigurableStateBackend) fromApplication).configure(config, classLoader);
}
else {
// keep as is!
backend = fromApplication;
}
}
else {
// (2) check if the config defines a state backend
final StateBackend fromConfig = loadStateBackendFromConfig(config, classLoader, logger);
if (fromConfig != null) {
backend = fromConfig;
}
else {
// (3) use the default
backend = new MemoryStateBackendFactory().createFromConfig(config, classLoader);
if (logger != null) {
logger.info("No state backend has been configured, using default (Memory / JobManager) {}", backend);
}
}
}
// to keep supporting the old behavior where default (JobManager) Backend + HA mode = checkpoints in HA store
// we add the HA persistence dir as the checkpoint directory if none other is set
if (backend instanceof MemoryStateBackend) {
final MemoryStateBackend memBackend = (MemoryStateBackend) backend;
if (memBackend.getCheckpointPath() == null && HighAvailabilityMode.isHighAvailabilityModeActivated(config)) {
final String haStoragePath = config.getString(HighAvailabilityOptions.HA_STORAGE_PATH);
if (haStoragePath != null) {
try {
Path checkpointDirPath = new Path(haStoragePath, UUID.randomUUID().toString());
if (checkpointDirPath.toUri().getScheme() == null) {
checkpointDirPath = checkpointDirPath.makeQualified(checkpointDirPath.getFileSystem());
}
Configuration tempConfig = new Configuration(config);
tempConfig.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDirPath.toString());
return memBackend.configure(tempConfig, classLoader);
} catch (Exception ignored) {}
}
}
}
return backend;
} } | public class class_name {
public static StateBackend fromApplicationOrConfigOrDefault(
@Nullable StateBackend fromApplication,
Configuration config,
ClassLoader classLoader,
@Nullable Logger logger) throws IllegalConfigurationException, DynamicCodeLoadingException, IOException {
checkNotNull(config, "config");
checkNotNull(classLoader, "classLoader");
final StateBackend backend;
// (1) the application defined state backend has precedence
if (fromApplication != null) {
if (logger != null) {
logger.info("Using application-defined state backend: {}", fromApplication);
}
// see if this is supposed to pick up additional configuration parameters
if (fromApplication instanceof ConfigurableStateBackend) {
// needs to pick up configuration
if (logger != null) {
logger.info("Configuring application-defined state backend with job/cluster config"); // depends on control dependency: [if], data = [none]
}
backend = ((ConfigurableStateBackend) fromApplication).configure(config, classLoader);
}
else {
// keep as is!
backend = fromApplication;
}
}
else {
// (2) check if the config defines a state backend
final StateBackend fromConfig = loadStateBackendFromConfig(config, classLoader, logger);
if (fromConfig != null) {
backend = fromConfig;
}
else {
// (3) use the default
backend = new MemoryStateBackendFactory().createFromConfig(config, classLoader);
if (logger != null) {
logger.info("No state backend has been configured, using default (Memory / JobManager) {}", backend);
}
}
}
// to keep supporting the old behavior where default (JobManager) Backend + HA mode = checkpoints in HA store
// we add the HA persistence dir as the checkpoint directory if none other is set
if (backend instanceof MemoryStateBackend) {
final MemoryStateBackend memBackend = (MemoryStateBackend) backend;
if (memBackend.getCheckpointPath() == null && HighAvailabilityMode.isHighAvailabilityModeActivated(config)) {
final String haStoragePath = config.getString(HighAvailabilityOptions.HA_STORAGE_PATH);
if (haStoragePath != null) {
try {
Path checkpointDirPath = new Path(haStoragePath, UUID.randomUUID().toString());
if (checkpointDirPath.toUri().getScheme() == null) {
checkpointDirPath = checkpointDirPath.makeQualified(checkpointDirPath.getFileSystem());
}
Configuration tempConfig = new Configuration(config);
tempConfig.setString(CheckpointingOptions.CHECKPOINTS_DIRECTORY, checkpointDirPath.toString());
return memBackend.configure(tempConfig, classLoader);
} catch (Exception ignored) {}
}
}
}
return backend;
} } |
public class class_name {
public String getProxyRemoteAddr(String realIpHeader) {
String ip = null;
if (realIpHeader != null && realIpHeader.length() != 0) {
ip = getHeaderString(realIpHeader);
}
if (StringUtils.isBlank(ip)) {
ip = getHeaderString("X-Real-IP");
if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = getHeaderString("X-Forwarded-For");
if (StringUtils.isNotBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
ip = ip.split(",")[0];
}
}
if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = getHeaderString("Proxy-Client-IP");
}
if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = getHeaderString("WL-Proxy-Client-IP");
}
if (StringUtils.isNotBlank(ip)) {
ip = ip.toLowerCase();
}
}
return ip;
} } | public class class_name {
public String getProxyRemoteAddr(String realIpHeader) {
String ip = null;
if (realIpHeader != null && realIpHeader.length() != 0) {
ip = getHeaderString(realIpHeader); // depends on control dependency: [if], data = [(realIpHeader]
}
if (StringUtils.isBlank(ip)) {
ip = getHeaderString("X-Real-IP"); // depends on control dependency: [if], data = [none]
if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = getHeaderString("X-Forwarded-For"); // depends on control dependency: [if], data = [none]
if (StringUtils.isNotBlank(ip) && !"unknown".equalsIgnoreCase(ip)) {
ip = ip.split(",")[0]; // depends on control dependency: [if], data = [none]
}
}
if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = getHeaderString("Proxy-Client-IP"); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isBlank(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = getHeaderString("WL-Proxy-Client-IP"); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(ip)) {
ip = ip.toLowerCase(); // depends on control dependency: [if], data = [none]
}
}
return ip;
} } |
public class class_name {
public V put(K key, V value) {
Object k = maskNull(key);
int h = sun.misc.Hashing.singleWordWangJenkinsHash(k);
Entry<K,V>[] tab = getTable();
int i = indexFor(h, tab.length);
for (Entry<K,V> e = tab[i]; e != null; e = e.next) {
if (h == e.hash && eq(k, e.get())) {
V oldValue = e.value;
if (value != oldValue)
e.value = value;
return oldValue;
}
}
modCount++;
Entry<K,V> e = tab[i];
tab[i] = new Entry<>(k, value, queue, h, e);
if (++size >= threshold)
resize(tab.length * 2);
return null;
} } | public class class_name {
public V put(K key, V value) {
Object k = maskNull(key);
int h = sun.misc.Hashing.singleWordWangJenkinsHash(k);
Entry<K,V>[] tab = getTable();
int i = indexFor(h, tab.length);
for (Entry<K,V> e = tab[i]; e != null; e = e.next) {
if (h == e.hash && eq(k, e.get())) {
V oldValue = e.value;
if (value != oldValue)
e.value = value;
return oldValue; // depends on control dependency: [if], data = [none]
}
}
modCount++;
Entry<K,V> e = tab[i];
tab[i] = new Entry<>(k, value, queue, h, e);
if (++size >= threshold)
resize(tab.length * 2);
return null;
} } |
public class class_name {
public static byte[] decode(String in) {
in = in.replaceAll("\\r|\\n","");
if(in.length() % 4 != 0) {
throw new IllegalArgumentException("The length of the input string must be a multiple of four.");
}
if(!in.matches("^[A-Za-z0-9+/]*[=]{0,3}$")) {
throw new IllegalArgumentException("The argument contains illegal characters.");
}
byte[] out = new byte[(in.length()*3)/4];
char[] input = in.toCharArray();
int outi = 0;
int b1, b2, b3, b4;
for(int i = 0; i < input.length; i+=4) {
b1 = map.get(input[i]) - 1;
b2 = map.get(input[i+1]) - 1;
b3 = map.get(input[i+2]) - 1;
b4 = map.get(input[i+3]) - 1;
out[outi++] = (byte)(b1 << 2 | b2 >>> 4);
out[outi++] = (byte)((b2 & 0x0F) << 4 | b3 >>> 2);
out[outi++] = (byte)((b3 & 0x03) << 6 | (b4 & 0x3F));
}
if(in.endsWith("=")) {
byte[] trimmed = new byte[out.length - (in.length() - in.indexOf("="))];
System.arraycopy(out, 0, trimmed, 0, trimmed.length);
return trimmed;
}
return out;
} } | public class class_name {
public static byte[] decode(String in) {
in = in.replaceAll("\\r|\\n","");
if(in.length() % 4 != 0) {
throw new IllegalArgumentException("The length of the input string must be a multiple of four.");
}
if(!in.matches("^[A-Za-z0-9+/]*[=]{0,3}$")) {
throw new IllegalArgumentException("The argument contains illegal characters.");
}
byte[] out = new byte[(in.length()*3)/4];
char[] input = in.toCharArray();
int outi = 0;
int b1, b2, b3, b4;
for(int i = 0; i < input.length; i+=4) {
b1 = map.get(input[i]) - 1; // depends on control dependency: [for], data = [i]
b2 = map.get(input[i+1]) - 1; // depends on control dependency: [for], data = [i]
b3 = map.get(input[i+2]) - 1; // depends on control dependency: [for], data = [i]
b4 = map.get(input[i+3]) - 1; // depends on control dependency: [for], data = [i]
out[outi++] = (byte)(b1 << 2 | b2 >>> 4); // depends on control dependency: [for], data = [none]
out[outi++] = (byte)((b2 & 0x0F) << 4 | b3 >>> 2); // depends on control dependency: [for], data = [none]
out[outi++] = (byte)((b3 & 0x03) << 6 | (b4 & 0x3F)); // depends on control dependency: [for], data = [none]
}
if(in.endsWith("=")) {
byte[] trimmed = new byte[out.length - (in.length() - in.indexOf("="))];
System.arraycopy(out, 0, trimmed, 0, trimmed.length); // depends on control dependency: [if], data = [none]
return trimmed; // depends on control dependency: [if], data = [none]
}
return out;
} } |
public class class_name {
public TaskExecution getTaskProfile(String taskPath) {
TaskExecution result = tasks.get(taskPath);
if (result == null) {
result = new TaskExecution(taskPath);
tasks.put(taskPath, result);
}
return result;
} } | public class class_name {
public TaskExecution getTaskProfile(String taskPath) {
TaskExecution result = tasks.get(taskPath);
if (result == null) {
result = new TaskExecution(taskPath); // depends on control dependency: [if], data = [none]
tasks.put(taskPath, result); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private ParameterBinding getBindingFor(Object ebeanQuery, int position, Parameter parameter) {
Assert.notNull(ebeanQuery, "EbeanQueryWrapper must not be null!");
Assert.notNull(parameter, "Parameter must not be null!");
if (parameter.isNamedParameter()) {
return query.getBindingFor(parameter.getName().orElseThrow(() -> new IllegalArgumentException("Parameter needs to be named!")));
}
try {
return query.getBindingFor(position);
} catch (IllegalArgumentException ex) {
// We should actually reject parameters unavailable, but as EclipseLink doesn't implement ….getParameter(int) for
// native queries correctly we need to fall back to an indexed parameter
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427892
return new ParameterBinding(position);
}
} } | public class class_name {
private ParameterBinding getBindingFor(Object ebeanQuery, int position, Parameter parameter) {
Assert.notNull(ebeanQuery, "EbeanQueryWrapper must not be null!");
Assert.notNull(parameter, "Parameter must not be null!");
if (parameter.isNamedParameter()) {
return query.getBindingFor(parameter.getName().orElseThrow(() -> new IllegalArgumentException("Parameter needs to be named!")));
// depends on control dependency: [if], data = [none]
}
try {
return query.getBindingFor(position);
// depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException ex) {
// We should actually reject parameters unavailable, but as EclipseLink doesn't implement ….getParameter(int) for
// native queries correctly we need to fall back to an indexed parameter
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=427892
return new ParameterBinding(position);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static CmsRelationType valueOfXml(String name) {
CmsRelationType result = valueOfInternal(name);
if (result == null) {
result = valueOf(PREFIX_XML + name);
}
return result;
} } | public class class_name {
public static CmsRelationType valueOfXml(String name) {
CmsRelationType result = valueOfInternal(name);
if (result == null) {
result = valueOf(PREFIX_XML + name); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public UNode getShardStats(String shardName) {
try {
// Send a GET request to "/{application}/_shards/{shard}"
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix());
uri.append("/");
uri.append(Utils.urlEncode(m_appDef.getAppName()));
uri.append("/_shards/");
uri.append(shardName);
RESTResponse response = m_restClient.sendRequest(HttpMethod.GET, uri.toString());
m_logger.debug("mergeShard() response: {}", response.toString());
throwIfErrorResponse(response);
return getUNodeResult(response);
} catch (Exception e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public UNode getShardStats(String shardName) {
try {
// Send a GET request to "/{application}/_shards/{shard}"
StringBuilder uri = new StringBuilder(Utils.isEmpty(m_restClient.getApiPrefix()) ? "" : "/" + m_restClient.getApiPrefix());
uri.append("/");
// depends on control dependency: [try], data = [none]
uri.append(Utils.urlEncode(m_appDef.getAppName()));
// depends on control dependency: [try], data = [none]
uri.append("/_shards/");
// depends on control dependency: [try], data = [none]
uri.append(shardName);
// depends on control dependency: [try], data = [none]
RESTResponse response = m_restClient.sendRequest(HttpMethod.GET, uri.toString());
m_logger.debug("mergeShard() response: {}", response.toString());
// depends on control dependency: [try], data = [none]
throwIfErrorResponse(response);
// depends on control dependency: [try], data = [none]
return getUNodeResult(response);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new RuntimeException(e);
}
// depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean apply(final MappedClass mappedClass, final MappedField mappedField, final Object value,
final List<ValidationFailure> validationFailures) {
if (appliesTo(mappedClass, mappedField)) {
Class classOfValue = value.getClass();
Class classOfIdFieldForType = mappedClass.getMappedIdField().getConcreteType();
if (!mappedField.getType().equals(classOfValue) && !classOfValue.equals(classOfIdFieldForType)) {
validationFailures.add(new ValidationFailure(format("The value class needs to match the type of ID for the field. "
+ "Value was %s and was a %s and the ID of the type was %s",
value, classOfValue, classOfIdFieldForType)));
}
return true;
}
return false;
} } | public class class_name {
public boolean apply(final MappedClass mappedClass, final MappedField mappedField, final Object value,
final List<ValidationFailure> validationFailures) {
if (appliesTo(mappedClass, mappedField)) {
Class classOfValue = value.getClass();
Class classOfIdFieldForType = mappedClass.getMappedIdField().getConcreteType();
if (!mappedField.getType().equals(classOfValue) && !classOfValue.equals(classOfIdFieldForType)) {
validationFailures.add(new ValidationFailure(format("The value class needs to match the type of ID for the field. "
+ "Value was %s and was a %s and the ID of the type was %s",
value, classOfValue, classOfIdFieldForType))); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public Rectangle getCellRect(int row, int column, boolean includeSpacing) {
Rectangle r = new Rectangle();
boolean valid = true;
if (row < 0) {
// y = height = 0;
valid = false;
} else if (row >= getRowCount()) {
r.y = getHeight();
valid = false;
} else {
r.height = getRowHeight(row);
// r.y = (getRowModel() == null) ? row * r.height :
// getRowModel().getPosition(row);
r.y = row * r.height;
}
if (column < 0) {
if (!getComponentOrientation().isLeftToRight()) {
r.x = getWidth();
}
// otherwise, x = width = 0;
valid = false;
} else if (column >= getColumnCount()) {
if (getComponentOrientation().isLeftToRight()) {
r.x = getWidth();
}
// otherwise, x = width = 0;
valid = false;
} else {
TableColumnModel64 cm = getColumnModel64();
if (getComponentOrientation().isLeftToRight()) {
for (int i = 0; i < column; i++) {
r.x += cm.getColumnWidth(i);
}
} else {
for (int i = cm.getColumnCount() - 1; i > column; i--) {
r.x += cm.getColumnWidth(i);
}
}
r.width = cm.getColumnWidth(column);
}
if (valid && !includeSpacing) {
// Bound the margins by their associated dimensions to prevent
// returning bounds with negative dimensions.
int rm = Math.min(getRowMargin(), r.height);
int cm = Math.min(getColumnModel().getColumnMargin(), r.width);
// This is not the same as grow(), it rounds differently.
r.setBounds(r.x + cm / 2, r.y + rm / 2, r.width - cm, r.height - rm);
}
return r;
} } | public class class_name {
public Rectangle getCellRect(int row, int column, boolean includeSpacing) {
Rectangle r = new Rectangle();
boolean valid = true;
if (row < 0) {
// y = height = 0;
valid = false;
// depends on control dependency: [if], data = [none]
} else if (row >= getRowCount()) {
r.y = getHeight();
// depends on control dependency: [if], data = [none]
valid = false;
// depends on control dependency: [if], data = [none]
} else {
r.height = getRowHeight(row);
// depends on control dependency: [if], data = [(row]
// r.y = (getRowModel() == null) ? row * r.height :
// getRowModel().getPosition(row);
r.y = row * r.height;
// depends on control dependency: [if], data = [none]
}
if (column < 0) {
if (!getComponentOrientation().isLeftToRight()) {
r.x = getWidth();
// depends on control dependency: [if], data = [none]
}
// otherwise, x = width = 0;
valid = false;
// depends on control dependency: [if], data = [none]
} else if (column >= getColumnCount()) {
if (getComponentOrientation().isLeftToRight()) {
r.x = getWidth();
// depends on control dependency: [if], data = [none]
}
// otherwise, x = width = 0;
valid = false;
// depends on control dependency: [if], data = [none]
} else {
TableColumnModel64 cm = getColumnModel64();
if (getComponentOrientation().isLeftToRight()) {
for (int i = 0; i < column; i++) {
r.x += cm.getColumnWidth(i);
// depends on control dependency: [for], data = [i]
}
} else {
for (int i = cm.getColumnCount() - 1; i > column; i--) {
r.x += cm.getColumnWidth(i);
// depends on control dependency: [for], data = [i]
}
}
r.width = cm.getColumnWidth(column);
// depends on control dependency: [if], data = [(column]
}
if (valid && !includeSpacing) {
// Bound the margins by their associated dimensions to prevent
// returning bounds with negative dimensions.
int rm = Math.min(getRowMargin(), r.height);
int cm = Math.min(getColumnModel().getColumnMargin(), r.width);
// This is not the same as grow(), it rounds differently.
r.setBounds(r.x + cm / 2, r.y + rm / 2, r.width - cm, r.height - rm);
// depends on control dependency: [if], data = [none]
}
return r;
} } |
public class class_name {
public String buildLanguageList() {
try {
StringBuffer retValue = new StringBuffer(512);
retValue.append("<table border=\"0\">\n");
// get locale for current element
Locale elLocale = getElementLocale();
// get locale names based on properties and global settings
List<Locale> localeList = OpenCms.getLocaleManager().getAvailableLocales(getCms(), getParamTempfile());
// read xml content for checking locale availability
CmsFile file = getCms().readFile(getParamTempfile(), CmsResourceFilter.IGNORE_EXPIRATION);
CmsXmlContent content = CmsXmlContentFactory.unmarshal(getCms(), file);
// show all possible elements
Iterator<Locale> i = localeList.iterator();
while (i.hasNext()) {
// get the current list element
Locale curLocale = i.next();
// skip locale of current element
if (elLocale.equals(curLocale)) {
continue;
}
// build an element row
retValue.append("<tr>\n");
retValue.append("\t<td class=\"textcenter\" unselectable=\"on\"><input type=\"checkbox\" name=\"");
retValue.append(PARAM_LANGUAGE);
retValue.append("\" value=\"");
retValue.append(curLocale.toString());
retValue.append("\">");
retValue.append("</td>\n");
retValue.append("\t<td style=\"white-space: nowrap;\" unselectable=\"on\">");
retValue.append(curLocale.getDisplayName(getLocale()));
retValue.append(!content.hasLocale(curLocale) ? " [-]" : "");
retValue.append("</td>\n");
retValue.append("\t<td style=\"white-space: nowrap;\" unselectable=\"on\">");
retValue.append(
!content.hasLocale(curLocale)
? Messages.get().getBundle(getLocale()).key(Messages.GUI_EDITOR_DIALOG_COPYLANGUAGE_NEW_0)
: "");
retValue.append("</td>\n");
retValue.append("</tr>\n");
}
retValue.append("</table>\n");
return retValue.toString();
} catch (Throwable e) {
// should usually never happen
if (LOG.isInfoEnabled()) {
LOG.info(e);
}
return "";
}
} } | public class class_name {
public String buildLanguageList() {
try {
StringBuffer retValue = new StringBuffer(512);
retValue.append("<table border=\"0\">\n"); // depends on control dependency: [try], data = [none]
// get locale for current element
Locale elLocale = getElementLocale();
// get locale names based on properties and global settings
List<Locale> localeList = OpenCms.getLocaleManager().getAvailableLocales(getCms(), getParamTempfile());
// read xml content for checking locale availability
CmsFile file = getCms().readFile(getParamTempfile(), CmsResourceFilter.IGNORE_EXPIRATION);
CmsXmlContent content = CmsXmlContentFactory.unmarshal(getCms(), file);
// show all possible elements
Iterator<Locale> i = localeList.iterator();
while (i.hasNext()) {
// get the current list element
Locale curLocale = i.next();
// skip locale of current element
if (elLocale.equals(curLocale)) {
continue;
}
// build an element row
retValue.append("<tr>\n"); // depends on control dependency: [while], data = [none]
retValue.append("\t<td class=\"textcenter\" unselectable=\"on\"><input type=\"checkbox\" name=\""); // depends on control dependency: [while], data = [none]
retValue.append(PARAM_LANGUAGE); // depends on control dependency: [while], data = [none]
retValue.append("\" value=\""); // depends on control dependency: [while], data = [none]
retValue.append(curLocale.toString()); // depends on control dependency: [while], data = [none]
retValue.append("\">"); // depends on control dependency: [while], data = [none]
retValue.append("</td>\n"); // depends on control dependency: [while], data = [none]
retValue.append("\t<td style=\"white-space: nowrap;\" unselectable=\"on\">"); // depends on control dependency: [while], data = [none]
retValue.append(curLocale.getDisplayName(getLocale())); // depends on control dependency: [while], data = [none]
retValue.append(!content.hasLocale(curLocale) ? " [-]" : ""); // depends on control dependency: [while], data = [none]
retValue.append("</td>\n"); // depends on control dependency: [while], data = [none]
retValue.append("\t<td style=\"white-space: nowrap;\" unselectable=\"on\">"); // depends on control dependency: [while], data = [none]
retValue.append(
!content.hasLocale(curLocale)
? Messages.get().getBundle(getLocale()).key(Messages.GUI_EDITOR_DIALOG_COPYLANGUAGE_NEW_0)
: "");
retValue.append("</td>\n"); // depends on control dependency: [while], data = [none]
retValue.append("</tr>\n"); // depends on control dependency: [while], data = [none]
}
retValue.append("</table>\n"); // depends on control dependency: [try], data = [none]
return retValue.toString(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
// should usually never happen
if (LOG.isInfoEnabled()) {
LOG.info(e); // depends on control dependency: [if], data = [none]
}
return "";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(DetachPolicyRequest detachPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (detachPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detachPolicyRequest.getDirectoryArn(), DIRECTORYARN_BINDING);
protocolMarshaller.marshall(detachPolicyRequest.getPolicyReference(), POLICYREFERENCE_BINDING);
protocolMarshaller.marshall(detachPolicyRequest.getObjectReference(), OBJECTREFERENCE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DetachPolicyRequest detachPolicyRequest, ProtocolMarshaller protocolMarshaller) {
if (detachPolicyRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(detachPolicyRequest.getDirectoryArn(), DIRECTORYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(detachPolicyRequest.getPolicyReference(), POLICYREFERENCE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(detachPolicyRequest.getObjectReference(), OBJECTREFERENCE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static int find(Object[] arr, int start, int end, Object valueToFind) {
assert arr != null;
assert end >= 0;
assert end <= arr.length;
for (int i = start; i < end; i++) {
if (Objects.equals(arr[i], valueToFind)) {
return i;
}
}
return NOT_FOUND;
} } | public class class_name {
public static int find(Object[] arr, int start, int end, Object valueToFind) {
assert arr != null;
assert end >= 0;
assert end <= arr.length;
for (int i = start; i < end; i++) {
if (Objects.equals(arr[i], valueToFind)) {
return i; // depends on control dependency: [if], data = [none]
}
}
return NOT_FOUND;
} } |
public class class_name {
@Override
public void onPushMsg(Context var1, byte[] var2, String var3) {
try {
String message = new String(var2, "UTF-8");
AndroidNotificationManager androidNotificationManager = AndroidNotificationManager.getInstance();
androidNotificationManager.processMixPushMessage(message);
} catch (Exception ex) {
LOGGER.e("failed to process PushMessage.", ex);
}
} } | public class class_name {
@Override
public void onPushMsg(Context var1, byte[] var2, String var3) {
try {
String message = new String(var2, "UTF-8");
AndroidNotificationManager androidNotificationManager = AndroidNotificationManager.getInstance();
androidNotificationManager.processMixPushMessage(message); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
LOGGER.e("failed to process PushMessage.", ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void addInitial(G g) {
Set<T> typeCounts = g.edgeTypes();
LinkedList<Map.Entry<G,Integer>> graphs = typesToGraphs.get(typeCounts);
if (graphs == null) {
graphs = new LinkedList<Map.Entry<G,Integer>>();
typesToGraphs.put(new HashSet<T>(typeCounts), graphs);
}
graphs.add(new SimpleEntry<G,Integer>(g, 0));
} } | public class class_name {
private void addInitial(G g) {
Set<T> typeCounts = g.edgeTypes();
LinkedList<Map.Entry<G,Integer>> graphs = typesToGraphs.get(typeCounts);
if (graphs == null) {
graphs = new LinkedList<Map.Entry<G,Integer>>(); // depends on control dependency: [if], data = [none]
typesToGraphs.put(new HashSet<T>(typeCounts), graphs); // depends on control dependency: [if], data = [none]
}
graphs.add(new SimpleEntry<G,Integer>(g, 0));
} } |
public class class_name {
@Override
public void setValueAt(final Object value, final int row, final int col) {
if (!editable) {
throw new IllegalStateException("Attempted to set a value on an uneditable model");
}
TableTreeNode node = getNodeAtLine(row);
Object bean = node.getData();
String property = properties[col];
if (bean != null) {
if (".".equals(property)) {
LOG.error("Set of entire bean is not supported by this model");
//node.setData(value);
} else {
try {
PropertyUtils.setProperty(bean, property, value);
} catch (Exception e) {
LOG.error("Failed to set bean property " + property + " on " + bean, e);
}
}
}
} } | public class class_name {
@Override
public void setValueAt(final Object value, final int row, final int col) {
if (!editable) {
throw new IllegalStateException("Attempted to set a value on an uneditable model");
}
TableTreeNode node = getNodeAtLine(row);
Object bean = node.getData();
String property = properties[col];
if (bean != null) {
if (".".equals(property)) {
LOG.error("Set of entire bean is not supported by this model"); // depends on control dependency: [if], data = [none]
//node.setData(value);
} else {
try {
PropertyUtils.setProperty(bean, property, value); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOG.error("Failed to set bean property " + property + " on " + bean, e);
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
public static Field findField(Class<?> type, String fieldName ) {
while( type != null ) {
Field[] fields = type.getDeclaredFields();
for( Field field: fields ) {
if( field.getName().equals(fieldName) )
return field;
}
type = type.getSuperclass();
}
return null;
} } | public class class_name {
public static Field findField(Class<?> type, String fieldName ) {
while( type != null ) {
Field[] fields = type.getDeclaredFields();
for( Field field: fields ) {
if( field.getName().equals(fieldName) )
return field;
}
type = type.getSuperclass(); // depends on control dependency: [while], data = [none]
}
return null;
} } |
public class class_name {
public void marshall(Output output, ProtocolMarshaller protocolMarshaller) {
if (output == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(output.getName(), NAME_BINDING);
protocolMarshaller.marshall(output.getKinesisStreamsOutput(), KINESISSTREAMSOUTPUT_BINDING);
protocolMarshaller.marshall(output.getKinesisFirehoseOutput(), KINESISFIREHOSEOUTPUT_BINDING);
protocolMarshaller.marshall(output.getLambdaOutput(), LAMBDAOUTPUT_BINDING);
protocolMarshaller.marshall(output.getDestinationSchema(), DESTINATIONSCHEMA_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Output output, ProtocolMarshaller protocolMarshaller) {
if (output == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(output.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(output.getKinesisStreamsOutput(), KINESISSTREAMSOUTPUT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(output.getKinesisFirehoseOutput(), KINESISFIREHOSEOUTPUT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(output.getLambdaOutput(), LAMBDAOUTPUT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(output.getDestinationSchema(), DESTINATIONSCHEMA_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String readEnvironment(String environmentName, String defaultValue) {
String property = System.getenv(environmentName);
if (isNullOrEmpty(property)) {
return defaultValue;
}
return property;
} } | public class class_name {
public static String readEnvironment(String environmentName, String defaultValue) {
String property = System.getenv(environmentName);
if (isNullOrEmpty(property)) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
return property;
} } |
public class class_name {
public TrajectoryEnvelope getClosestGroundEnvelope(long time) {
if (this.getTemporalVariable().getEST() > time || this.getTemporalVariable().getEET() < time) return null;
if (!this.hasSubEnvelopes()) return this;
for (TrajectoryEnvelope te : this.getGroundEnvelopes()) {
if (te.getTemporalVariable().getEST() <= time) {
if (te.getTemporalVariable().getEET() >= time) {
return te;
}
else if (this.getGroundEnvelopes().higher(te).getTemporalVariable().getEST() > time) {
return te;//this.getGroundEnvelopes().higher(te);
}
}
}
return null;
} } | public class class_name {
public TrajectoryEnvelope getClosestGroundEnvelope(long time) {
if (this.getTemporalVariable().getEST() > time || this.getTemporalVariable().getEET() < time) return null;
if (!this.hasSubEnvelopes()) return this;
for (TrajectoryEnvelope te : this.getGroundEnvelopes()) {
if (te.getTemporalVariable().getEST() <= time) {
if (te.getTemporalVariable().getEET() >= time) {
return te; // depends on control dependency: [if], data = [none]
}
else if (this.getGroundEnvelopes().higher(te).getTemporalVariable().getEST() > time) {
return te;//this.getGroundEnvelopes().higher(te); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
protected synchronized void activate(BundleContext context, Map<String, Object> props) {
String jndiName = (String) props.get("jndiName");
String originalValue = (String) props.get("value");
//Since we declare a default value of false in the metatype, if decode isn't specified, props should return false
boolean decode = (Boolean) props.get("decode");
if (jndiName == null || jndiName.isEmpty() || originalValue == null || originalValue.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set");
}
return;
}
String value = originalValue;
if (decode) {
try {
value = PasswordUtil.decode(originalValue);
} catch (Exception e) {
Tr.error(tc, "jndi.decode.failed", originalValue, e);
}
}
Object parsedValue = LiteralParser.parse(value);
String valueClassName = parsedValue.getClass().getName();
final Object serviceObject = decode ? new Decode(originalValue) : parsedValue;
Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName);
}
this.serviceRegistration = context.registerService(valueClassName, serviceObject, propertiesForJndiService);
} } | public class class_name {
protected synchronized void activate(BundleContext context, Map<String, Object> props) {
String jndiName = (String) props.get("jndiName");
String originalValue = (String) props.get("value");
//Since we declare a default value of false in the metatype, if decode isn't specified, props should return false
boolean decode = (Boolean) props.get("decode");
if (jndiName == null || jndiName.isEmpty() || originalValue == null || originalValue.isEmpty()) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Unable to register JNDIEntry with jndiName " + jndiName + " and value " + originalValue + " because both must be set"); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
String value = originalValue;
if (decode) {
try {
value = PasswordUtil.decode(originalValue); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
Tr.error(tc, "jndi.decode.failed", originalValue, e);
} // depends on control dependency: [catch], data = [none]
}
Object parsedValue = LiteralParser.parse(value);
String valueClassName = parsedValue.getClass().getName();
final Object serviceObject = decode ? new Decode(originalValue) : parsedValue;
Dictionary<String, Object> propertiesForJndiService = new Hashtable<String, Object>();
propertiesForJndiService.put("osgi.jndi.service.name", jndiName);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Registering JNDIEntry " + valueClassName + " with value " + parsedValue + " and JNDI name " + jndiName); // depends on control dependency: [if], data = [none]
}
this.serviceRegistration = context.registerService(valueClassName, serviceObject, propertiesForJndiService);
} } |
public class class_name {
public ListActionTypesResult withActionTypes(ActionType... actionTypes) {
if (this.actionTypes == null) {
setActionTypes(new java.util.ArrayList<ActionType>(actionTypes.length));
}
for (ActionType ele : actionTypes) {
this.actionTypes.add(ele);
}
return this;
} } | public class class_name {
public ListActionTypesResult withActionTypes(ActionType... actionTypes) {
if (this.actionTypes == null) {
setActionTypes(new java.util.ArrayList<ActionType>(actionTypes.length)); // depends on control dependency: [if], data = [none]
}
for (ActionType ele : actionTypes) {
this.actionTypes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static Font[] filterMonospaced(Font... fonts) {
List<Font> result = new ArrayList<Font>(fonts.length);
for(Font font: fonts) {
if (isFontMonospaced(font)) {
result.add(font);
}
}
return result.toArray(new Font[result.size()]);
} } | public class class_name {
public static Font[] filterMonospaced(Font... fonts) {
List<Font> result = new ArrayList<Font>(fonts.length);
for(Font font: fonts) {
if (isFontMonospaced(font)) {
result.add(font); // depends on control dependency: [if], data = [none]
}
}
return result.toArray(new Font[result.size()]);
} } |
public class class_name {
public void fixupVariables(java.util.Vector vars, int globalsSize)
{
m_predicateIndex = -1;
AxesWalker walker = m_firstWalker;
while (null != walker)
{
walker.fixupVariables(vars, globalsSize);
walker = walker.getNextWalker();
}
} } | public class class_name {
public void fixupVariables(java.util.Vector vars, int globalsSize)
{
m_predicateIndex = -1;
AxesWalker walker = m_firstWalker;
while (null != walker)
{
walker.fixupVariables(vars, globalsSize); // depends on control dependency: [while], data = [none]
walker = walker.getNextWalker(); // depends on control dependency: [while], data = [none]
}
} } |
public class class_name {
public void runUpdate(Password password) throws PageException {
checkWriteAccess();
ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
synchronized (factory) {
try {
cleanUp(factory);
factory.update(cs.getPassword(), cs.getIdentification());
}
catch (Exception e) {
throw Caster.toPageException(e);
}
}
} } | public class class_name {
public void runUpdate(Password password) throws PageException {
checkWriteAccess();
ConfigServerImpl cs = (ConfigServerImpl) ConfigImpl.getConfigServer(config, password);
CFMLEngineFactory factory = cs.getCFMLEngine().getCFMLEngineFactory();
synchronized (factory) {
try {
cleanUp(factory); // depends on control dependency: [try], data = [none]
factory.update(cs.getPassword(), cs.getIdentification()); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw Caster.toPageException(e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
@Override
public String encode(byte[] byteArray)
{
int len = byteArray.length;
char[] encoded = new char[len * 2];
int j = 0;
for(int i = 0; i < byteArray.length; i++)
{
int b = byteArray[i] & 0xFF;
String hexa = HEXA_VALUES[b];
encoded[j++] = hexa.charAt(0);
encoded[j++] = hexa.charAt(1);
}
return new String(encoded);
} } | public class class_name {
@Override
public String encode(byte[] byteArray)
{
int len = byteArray.length;
char[] encoded = new char[len * 2];
int j = 0;
for(int i = 0; i < byteArray.length; i++)
{
int b = byteArray[i] & 0xFF;
String hexa = HEXA_VALUES[b];
encoded[j++] = hexa.charAt(0); // depends on control dependency: [for], data = [none]
encoded[j++] = hexa.charAt(1); // depends on control dependency: [for], data = [none]
}
return new String(encoded);
} } |
public class class_name {
public static RpcReferenceContext lastReferenceContext(boolean clear) {
try {
RpcInvokeContext invokeCtx = RpcInvokeContext.getContext();
RpcReferenceContext referenceCtx = (RpcReferenceContext) invokeCtx
.get(RemotingConstants.INVOKE_CTX_RPC_REF_CTX);
if (referenceCtx != null) {
String resultCode = (String) invokeCtx.get(RemotingConstants.INVOKE_CTX_RPC_RESULT_CODE);
if (resultCode != null) {
referenceCtx.setResultCode(ResultCodeEnum.getResultCode(resultCode));
}
}
return referenceCtx;
} finally {
if (clear) {
clearReferenceContext();
}
}
} } | public class class_name {
public static RpcReferenceContext lastReferenceContext(boolean clear) {
try {
RpcInvokeContext invokeCtx = RpcInvokeContext.getContext();
RpcReferenceContext referenceCtx = (RpcReferenceContext) invokeCtx
.get(RemotingConstants.INVOKE_CTX_RPC_REF_CTX);
if (referenceCtx != null) {
String resultCode = (String) invokeCtx.get(RemotingConstants.INVOKE_CTX_RPC_RESULT_CODE);
if (resultCode != null) {
referenceCtx.setResultCode(ResultCodeEnum.getResultCode(resultCode)); // depends on control dependency: [if], data = [(resultCode]
}
}
return referenceCtx; // depends on control dependency: [try], data = [none]
} finally {
if (clear) {
clearReferenceContext(); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private void cancelNameResolverBackoff() {
syncContext.throwIfNotInThisSynchronizationContext();
if (scheduledNameResolverRefresh != null) {
scheduledNameResolverRefresh.cancel();
scheduledNameResolverRefresh = null;
nameResolverBackoffPolicy = null;
}
} } | public class class_name {
private void cancelNameResolverBackoff() {
syncContext.throwIfNotInThisSynchronizationContext();
if (scheduledNameResolverRefresh != null) {
scheduledNameResolverRefresh.cancel(); // depends on control dependency: [if], data = [none]
scheduledNameResolverRefresh = null; // depends on control dependency: [if], data = [none]
nameResolverBackoffPolicy = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void init(Source.Context context, String groupName, String prefix, List<Stage.ConfigIssue> issues) {
// Validate the ELs for string configs
List<String> elConfigs = ImmutableList.of("resourceUrl", "requestBody");
for (String configName : elConfigs) {
ELVars vars = context.createELVars();
vars.addVariable(START_AT, 0);
ELEval eval = context.createELEval(configName);
try {
eval.eval(vars, (String)getClass().getField(configName).get(this), String.class);
} catch (ELEvalException | NoSuchFieldException | IllegalAccessException e) {
LOG.error(Errors.HTTP_06.getMessage(), e.toString(), e);
issues.add(context.createConfigIssue(groupName, prefix + configName, Errors.HTTP_06, e.toString()));
}
}
client.init(context, Groups.PROXY.name(), prefix + "client.", issues);
// Validate the EL for each header entry
ELVars headerVars = context.createELVars();
ELEval headerEval = context.createELEval("headers");
for (String headerValue : headers.values()) {
try {
headerEval.eval(headerVars, headerValue, String.class);
} catch (ELEvalException e) {
LOG.error(Errors.HTTP_06.getMessage(), e.toString(), e);
issues.add(context.createConfigIssue(groupName, prefix + "headers", Errors.HTTP_06, e.toString()));
}
}
} } | public class class_name {
public void init(Source.Context context, String groupName, String prefix, List<Stage.ConfigIssue> issues) {
// Validate the ELs for string configs
List<String> elConfigs = ImmutableList.of("resourceUrl", "requestBody");
for (String configName : elConfigs) {
ELVars vars = context.createELVars();
vars.addVariable(START_AT, 0); // depends on control dependency: [for], data = [none]
ELEval eval = context.createELEval(configName);
try {
eval.eval(vars, (String)getClass().getField(configName).get(this), String.class); // depends on control dependency: [try], data = [none]
} catch (ELEvalException | NoSuchFieldException | IllegalAccessException e) {
LOG.error(Errors.HTTP_06.getMessage(), e.toString(), e);
issues.add(context.createConfigIssue(groupName, prefix + configName, Errors.HTTP_06, e.toString()));
} // depends on control dependency: [catch], data = [none]
}
client.init(context, Groups.PROXY.name(), prefix + "client.", issues);
// Validate the EL for each header entry
ELVars headerVars = context.createELVars();
ELEval headerEval = context.createELEval("headers");
for (String headerValue : headers.values()) {
try {
headerEval.eval(headerVars, headerValue, String.class); // depends on control dependency: [try], data = [none]
} catch (ELEvalException e) {
LOG.error(Errors.HTTP_06.getMessage(), e.toString(), e);
issues.add(context.createConfigIssue(groupName, prefix + "headers", Errors.HTTP_06, e.toString()));
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping) {
TypeInformation[] fieldTypes = new TypeInformation[fieldMapping.length];
String[] fieldNames = new String[fieldMapping.length];
for (int i = 0; i < fieldMapping.length; i++) {
fieldTypes[i] = rowType.getTypeAt(fieldMapping[i]);
fieldNames[i] = rowType.getFieldNames()[fieldMapping[i]];
}
return new RowTypeInfo(fieldTypes, fieldNames);
} } | public class class_name {
public static RowTypeInfo projectFields(RowTypeInfo rowType, int[] fieldMapping) {
TypeInformation[] fieldTypes = new TypeInformation[fieldMapping.length];
String[] fieldNames = new String[fieldMapping.length];
for (int i = 0; i < fieldMapping.length; i++) {
fieldTypes[i] = rowType.getTypeAt(fieldMapping[i]); // depends on control dependency: [for], data = [i]
fieldNames[i] = rowType.getFieldNames()[fieldMapping[i]]; // depends on control dependency: [for], data = [i]
}
return new RowTypeInfo(fieldTypes, fieldNames);
} } |
public class class_name {
@Override
public ResponseCtx getCacheItem(String request) {
String hash = null;
ResponseCtx response = null;
try {
hash = makeHash(request);
// thread-safety on cache operations
synchronized (requestCache) {
if (logger.isDebugEnabled()) {
logger.debug("Getting Cache Item (" + requestCache.size() + "/"
+ requestCacheUsageTracker.size() + "/"
+ requestCacheTimeTracker.size() + "): " + hash);
}
response = requestCache.get(hash);
if (response == null) {
return null;
}
// if this item is older than CACHE_ITEM_TTL then we can't use it
long usedLast =
System.currentTimeMillis()
- requestCacheTimeTracker.get(hash).longValue();
if (usedLast > TTL) {
requestCache.remove(hash);
requestCacheUsageTracker.remove(hash);
requestCacheTimeTracker.remove(hash);
if (logger.isDebugEnabled()) {
logger.debug("CACHE_ITEM_TTL exceeded: " + hash);
}
return null;
}
// we just used this item, move it to the end of the list (items at
// beginning get removed...)
requestCacheUsageTracker.add(requestCacheUsageTracker
.remove(requestCacheUsageTracker.indexOf(hash)));
}
} catch (Exception e) {
logger.warn("Error getting cache item: " + e.getMessage(), e);
response = null;
}
return response;
} } | public class class_name {
@Override
public ResponseCtx getCacheItem(String request) {
String hash = null;
ResponseCtx response = null;
try {
hash = makeHash(request); // depends on control dependency: [try], data = [none]
// thread-safety on cache operations
synchronized (requestCache) { // depends on control dependency: [try], data = [none]
if (logger.isDebugEnabled()) {
logger.debug("Getting Cache Item (" + requestCache.size() + "/"
+ requestCacheUsageTracker.size() + "/"
+ requestCacheTimeTracker.size() + "): " + hash); // depends on control dependency: [if], data = [none]
}
response = requestCache.get(hash);
if (response == null) {
return null; // depends on control dependency: [if], data = [none]
}
// if this item is older than CACHE_ITEM_TTL then we can't use it
long usedLast =
System.currentTimeMillis()
- requestCacheTimeTracker.get(hash).longValue();
if (usedLast > TTL) {
requestCache.remove(hash); // depends on control dependency: [if], data = [none]
requestCacheUsageTracker.remove(hash); // depends on control dependency: [if], data = [none]
requestCacheTimeTracker.remove(hash); // depends on control dependency: [if], data = [none]
if (logger.isDebugEnabled()) {
logger.debug("CACHE_ITEM_TTL exceeded: " + hash); // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
// we just used this item, move it to the end of the list (items at
// beginning get removed...)
requestCacheUsageTracker.add(requestCacheUsageTracker
.remove(requestCacheUsageTracker.indexOf(hash)));
}
} catch (Exception e) {
logger.warn("Error getting cache item: " + e.getMessage(), e);
response = null;
} // depends on control dependency: [catch], data = [none]
return response;
} } |
public class class_name {
private String getSlaUrl(String envSlaUrl, UriInfo uriInfo) {
String baseUrl = uriInfo.getBaseUri().toString();
if (envSlaUrl == null) {
envSlaUrl = "";
}
String result = ("".equals(envSlaUrl))? baseUrl : envSlaUrl;
logger.debug("getSlaUrl(env={}, supplied={}) = {}", envSlaUrl, baseUrl, result);
return result;
} } | public class class_name {
private String getSlaUrl(String envSlaUrl, UriInfo uriInfo) {
String baseUrl = uriInfo.getBaseUri().toString();
if (envSlaUrl == null) {
envSlaUrl = "";
// depends on control dependency: [if], data = [none]
}
String result = ("".equals(envSlaUrl))? baseUrl : envSlaUrl;
logger.debug("getSlaUrl(env={}, supplied={}) = {}", envSlaUrl, baseUrl, result);
return result;
} } |
public class class_name {
@Override
public void serviceChanged(ServiceEvent serviceEvent) {
final String topic = getTopic(serviceEvent);
// Bail quickly if the event is one that should be ignored
if (topic == null) {
return;
}
// Event properties
Map<String, Object> eventProperties = new HashMap<String, Object>();
// "event" --> the original event object
eventProperties.put(EventConstants.EVENT, serviceEvent);
// "service" --> result of getServiceReference
// "service.id" --> the service's ID
// "service.pid" --> the service's persistent ID if not null
// "service.objectClass" --> the services object class
ServiceReference serviceReference = serviceEvent.getServiceReference();
if (serviceReference != null) {
eventProperties.put(EventConstants.SERVICE, serviceReference);
Long serviceId = (Long) serviceReference.getProperty(Constants.SERVICE_ID);
eventProperties.put(EventConstants.SERVICE_ID, serviceId);
Object servicePersistentId = serviceReference.getProperty(Constants.SERVICE_PID);
if (servicePersistentId != null) {
// String[] must be coerced into Collection<String>
if (servicePersistentId instanceof String[]) {
servicePersistentId = Arrays.asList((String[]) servicePersistentId);
}
eventProperties.put(EventConstants.SERVICE_PID, servicePersistentId);
}
String[] objectClass = (String[]) serviceReference.getProperty(Constants.OBJECTCLASS);
if (objectClass != null) {
eventProperties.put(EventConstants.SERVICE_OBJECTCLASS, objectClass);
}
}
// Construct and fire the event
Event event = new Event(topic, eventProperties);
eventAdmin.postEvent(event);
} } | public class class_name {
@Override
public void serviceChanged(ServiceEvent serviceEvent) {
final String topic = getTopic(serviceEvent);
// Bail quickly if the event is one that should be ignored
if (topic == null) {
return; // depends on control dependency: [if], data = [none]
}
// Event properties
Map<String, Object> eventProperties = new HashMap<String, Object>();
// "event" --> the original event object
eventProperties.put(EventConstants.EVENT, serviceEvent);
// "service" --> result of getServiceReference
// "service.id" --> the service's ID
// "service.pid" --> the service's persistent ID if not null
// "service.objectClass" --> the services object class
ServiceReference serviceReference = serviceEvent.getServiceReference();
if (serviceReference != null) {
eventProperties.put(EventConstants.SERVICE, serviceReference); // depends on control dependency: [if], data = [none]
Long serviceId = (Long) serviceReference.getProperty(Constants.SERVICE_ID);
eventProperties.put(EventConstants.SERVICE_ID, serviceId); // depends on control dependency: [if], data = [none]
Object servicePersistentId = serviceReference.getProperty(Constants.SERVICE_PID);
if (servicePersistentId != null) {
// String[] must be coerced into Collection<String>
if (servicePersistentId instanceof String[]) {
servicePersistentId = Arrays.asList((String[]) servicePersistentId); // depends on control dependency: [if], data = [none]
}
eventProperties.put(EventConstants.SERVICE_PID, servicePersistentId); // depends on control dependency: [if], data = [none]
}
String[] objectClass = (String[]) serviceReference.getProperty(Constants.OBJECTCLASS);
if (objectClass != null) {
eventProperties.put(EventConstants.SERVICE_OBJECTCLASS, objectClass); // depends on control dependency: [if], data = [none]
}
}
// Construct and fire the event
Event event = new Event(topic, eventProperties);
eventAdmin.postEvent(event);
} } |
public class class_name {
public static <T> T accessMember(final AccessibleObject member, final Callable<T> callable, String errorMessage) {
if (callable == null) {
return null;
}
return AccessController.doPrivileged((PrivilegedAction<T>) () -> {
boolean wasAccessible = member.isAccessible();
try {
member.setAccessible(true);
return callable.call();
} catch (Exception exception) {
throw new IllegalStateException(errorMessage, exception);
} finally {
member.setAccessible(wasAccessible);
}
});
} } | public class class_name {
public static <T> T accessMember(final AccessibleObject member, final Callable<T> callable, String errorMessage) {
if (callable == null) {
return null; // depends on control dependency: [if], data = [none]
}
return AccessController.doPrivileged((PrivilegedAction<T>) () -> {
boolean wasAccessible = member.isAccessible();
try {
member.setAccessible(true);
return callable.call();
} catch (Exception exception) {
throw new IllegalStateException(errorMessage, exception);
} finally {
member.setAccessible(wasAccessible);
}
});
} } |
public class class_name {
@Deprecated
public static Matcher<Elements> containingElementsWithOwnTexts(final String... texts) {
Matcher[] elementWithTextMatchers = new Matcher[texts.length];
for (int i = 0; i < elementWithTextMatchers.length; i++) {
elementWithTextMatchers[i] = ElementWithOwnText.hasOwnText(texts[i]);
}
return Matchers.contains(
elementWithTextMatchers
);
} } | public class class_name {
@Deprecated
public static Matcher<Elements> containingElementsWithOwnTexts(final String... texts) {
Matcher[] elementWithTextMatchers = new Matcher[texts.length];
for (int i = 0; i < elementWithTextMatchers.length; i++) {
elementWithTextMatchers[i] = ElementWithOwnText.hasOwnText(texts[i]); // depends on control dependency: [for], data = [i]
}
return Matchers.contains(
elementWithTextMatchers
);
} } |
public class class_name {
public static void setReferrerURLCookieHandler(ReferrerURLCookieHandler referrerURLCookieHandler) {
// in case, the webAppSecurityConfig is dynamically changed
if (getReferrerURLCookieHandler() != referrerURLCookieHandler) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Old and new CookieHandler", getReferrerURLCookieHandler(), referrerURLCookieHandler);
}
webAppSecurityConfigRef.set(WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig());
referrerURLCookieHandlerRef.set(referrerURLCookieHandler);
}
} } | public class class_name {
public static void setReferrerURLCookieHandler(ReferrerURLCookieHandler referrerURLCookieHandler) {
// in case, the webAppSecurityConfig is dynamically changed
if (getReferrerURLCookieHandler() != referrerURLCookieHandler) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "Old and new CookieHandler", getReferrerURLCookieHandler(), referrerURLCookieHandler); // depends on control dependency: [if], data = [none]
}
webAppSecurityConfigRef.set(WebAppSecurityCollaboratorImpl.getGlobalWebAppSecurityConfig()); // depends on control dependency: [if], data = [none]
referrerURLCookieHandlerRef.set(referrerURLCookieHandler); // depends on control dependency: [if], data = [referrerURLCookieHandler)]
}
} } |
public class class_name {
@Override
public String encode(String... messages) {
Assert.notNull(messages, "messages must not be null");
StringBuilder sb = new StringBuilder();
sb.append("a[");
for (int i = 0; i < messages.length; i++) {
sb.append('"');
char[] quotedChars = applyJsonQuoting(messages[i]);
sb.append(escapeSockJsSpecialChars(quotedChars));
sb.append('"');
if (i < messages.length - 1) {
sb.append(',');
}
}
sb.append(']');
return sb.toString();
} } | public class class_name {
@Override
public String encode(String... messages) {
Assert.notNull(messages, "messages must not be null");
StringBuilder sb = new StringBuilder();
sb.append("a[");
for (int i = 0; i < messages.length; i++) {
sb.append('"'); // depends on control dependency: [for], data = [none]
char[] quotedChars = applyJsonQuoting(messages[i]);
sb.append(escapeSockJsSpecialChars(quotedChars)); // depends on control dependency: [for], data = [none]
sb.append('"'); // depends on control dependency: [for], data = [none]
if (i < messages.length - 1) {
sb.append(','); // depends on control dependency: [if], data = [none]
}
}
sb.append(']');
return sb.toString();
} } |
public class class_name {
public ServiceCall<ValueCollection> listValues(ListValuesOptions listValuesOptions) {
Validator.notNull(listValuesOptions, "listValuesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { listValuesOptions.workspaceId(), listValuesOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listValues");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
if (listValuesOptions.export() != null) {
builder.query("export", String.valueOf(listValuesOptions.export()));
}
if (listValuesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listValuesOptions.pageLimit()));
}
if (listValuesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listValuesOptions.includeCount()));
}
if (listValuesOptions.sort() != null) {
builder.query("sort", listValuesOptions.sort());
}
if (listValuesOptions.cursor() != null) {
builder.query("cursor", listValuesOptions.cursor());
}
if (listValuesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listValuesOptions.includeAudit()));
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ValueCollection.class));
} } | public class class_name {
public ServiceCall<ValueCollection> listValues(ListValuesOptions listValuesOptions) {
Validator.notNull(listValuesOptions, "listValuesOptions cannot be null");
String[] pathSegments = { "v1/workspaces", "entities", "values" };
String[] pathParameters = { listValuesOptions.workspaceId(), listValuesOptions.entity() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "listValues");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
if (listValuesOptions.export() != null) {
builder.query("export", String.valueOf(listValuesOptions.export())); // depends on control dependency: [if], data = [(listValuesOptions.export()]
}
if (listValuesOptions.pageLimit() != null) {
builder.query("page_limit", String.valueOf(listValuesOptions.pageLimit())); // depends on control dependency: [if], data = [(listValuesOptions.pageLimit()]
}
if (listValuesOptions.includeCount() != null) {
builder.query("include_count", String.valueOf(listValuesOptions.includeCount())); // depends on control dependency: [if], data = [(listValuesOptions.includeCount()]
}
if (listValuesOptions.sort() != null) {
builder.query("sort", listValuesOptions.sort()); // depends on control dependency: [if], data = [none]
}
if (listValuesOptions.cursor() != null) {
builder.query("cursor", listValuesOptions.cursor()); // depends on control dependency: [if], data = [none]
}
if (listValuesOptions.includeAudit() != null) {
builder.query("include_audit", String.valueOf(listValuesOptions.includeAudit())); // depends on control dependency: [if], data = [(listValuesOptions.includeAudit()]
}
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(ValueCollection.class));
} } |
public class class_name {
@SuppressWarnings("unchecked")
public static <T> List<T> getValueOfCertainColumnOfAllRecord(String sql, Object... arg) {
Connection connection = JDBCUtils.getConnection();
PreparedStatement ps = null;
ResultSet result = null;
List<T> list = new ArrayList<T>();// 存放查询到的记录的字段的值
try {
ps = connection.prepareStatement(sql);
// 填充占位符
for (int i = 0; i < arg.length; i++) {
ps.setObject(i + 1, arg[i]);
}
// 获取结果集
result = ps.executeQuery();
// 循环遍历结果集中的记录,并将每条记录的第一个字段放入List中
while (result.next()) {
list.add((T) result.getObject(1));
}
} catch (SQLException e) {
e.printStackTrace();
} finally {
JDBCUtils.release(result, ps, connection);
}
return list;
} } | public class class_name {
@SuppressWarnings("unchecked")
public static <T> List<T> getValueOfCertainColumnOfAllRecord(String sql, Object... arg) {
Connection connection = JDBCUtils.getConnection();
PreparedStatement ps = null;
ResultSet result = null;
List<T> list = new ArrayList<T>();// 存放查询到的记录的字段的值
try {
ps = connection.prepareStatement(sql); // depends on control dependency: [try], data = [none]
// 填充占位符
for (int i = 0; i < arg.length; i++) {
ps.setObject(i + 1, arg[i]); // depends on control dependency: [for], data = [i]
}
// 获取结果集
result = ps.executeQuery(); // depends on control dependency: [try], data = [none]
// 循环遍历结果集中的记录,并将每条记录的第一个字段放入List中
while (result.next()) {
list.add((T) result.getObject(1)); // depends on control dependency: [while], data = [none]
}
} catch (SQLException e) {
e.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
JDBCUtils.release(result, ps, connection);
}
return list;
} } |
public class class_name {
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) {
this.uncommittedRemovedOutVertexLabels.add(lbl);
if (!preserveData) {
deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END);
}
} } | public class class_name {
void removeOutVertexLabel(VertexLabel lbl, boolean preserveData) {
this.uncommittedRemovedOutVertexLabels.add(lbl);
if (!preserveData) {
deleteColumn(lbl.getFullName() + Topology.OUT_VERTEX_COLUMN_END); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void marshall(DescribeEventsRequest describeEventsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeEventsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeEventsRequest.getSourceName(), SOURCENAME_BINDING);
protocolMarshaller.marshall(describeEventsRequest.getSourceType(), SOURCETYPE_BINDING);
protocolMarshaller.marshall(describeEventsRequest.getStartTime(), STARTTIME_BINDING);
protocolMarshaller.marshall(describeEventsRequest.getEndTime(), ENDTIME_BINDING);
protocolMarshaller.marshall(describeEventsRequest.getDuration(), DURATION_BINDING);
protocolMarshaller.marshall(describeEventsRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(describeEventsRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeEventsRequest describeEventsRequest, ProtocolMarshaller protocolMarshaller) {
if (describeEventsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeEventsRequest.getSourceName(), SOURCENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeEventsRequest.getSourceType(), SOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeEventsRequest.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeEventsRequest.getEndTime(), ENDTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeEventsRequest.getDuration(), DURATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeEventsRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeEventsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public void unset(String propName) {
if (propName.equals("deleteDescendants")) {
unsetDeleteDescendants();
}
if (propName.equals("returnDeleted")) {
unsetReturnDeleted();
}
super.unset(propName);
} } | public class class_name {
@Override
public void unset(String propName) {
if (propName.equals("deleteDescendants")) {
unsetDeleteDescendants(); // depends on control dependency: [if], data = [none]
}
if (propName.equals("returnDeleted")) {
unsetReturnDeleted(); // depends on control dependency: [if], data = [none]
}
super.unset(propName);
} } |
public class class_name {
@GET
@Produces("text/plain;charset=UTF-8")
@Path("getNext")
public String getNext() {
logger.debug("Received getNext");
JSONObject resultJson;
try {
machine.getNextStep();
resultJson = Util.getStepAsJSON(machine, verbose, unvisited);
resultJson.put("result", "ok");
} catch (Exception e) {
resultJson = new JSONObject();
resultJson.put("result", "nok");
resultJson.put("error", e.getMessage());
}
return resultJson.toString();
} } | public class class_name {
@GET
@Produces("text/plain;charset=UTF-8")
@Path("getNext")
public String getNext() {
logger.debug("Received getNext");
JSONObject resultJson;
try {
machine.getNextStep(); // depends on control dependency: [try], data = [none]
resultJson = Util.getStepAsJSON(machine, verbose, unvisited); // depends on control dependency: [try], data = [none]
resultJson.put("result", "ok"); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
resultJson = new JSONObject();
resultJson.put("result", "nok");
resultJson.put("error", e.getMessage());
} // depends on control dependency: [catch], data = [none]
return resultJson.toString();
} } |
public class class_name {
private List populateData(EntityMetadata m, Map<Bytes, List<Column>> qResults, List<Object> entities,
boolean isRelational, List<String> relationNames, CassandraDataHandler dataHandler)
{
if (m.getType().isSuperColumnFamilyMetadata())
{
Set<Bytes> primaryKeys = qResults.keySet();
if (primaryKeys != null && !primaryKeys.isEmpty())
{
Object[] rowIds = new Object[primaryKeys.size()];
int i = 0;
for (Bytes b : primaryKeys)
{
rowIds[i] = PropertyAccessorHelper.getObject(b, (Field) m.getIdAttribute().getJavaMember());
i++;
}
entities.addAll(findAll(m.getEntityClazz(), null, rowIds));
}
}
else
{
Iterator<Bytes> rowIter = qResults.keySet().iterator();
while (rowIter.hasNext())
{
Bytes rowKey = rowIter.next();
List<Column> columns = qResults.get(rowKey);
try
{
Object id = PropertyAccessorHelper
.getObject(m.getIdAttribute().getJavaType(), rowKey.toByteArray());
Object e = null;
e = dataHandler.populateEntity(new ThriftRow(id, m.getTableName(), columns,
new ArrayList<SuperColumn>(0), new ArrayList<CounterColumn>(0),
new ArrayList<CounterSuperColumn>(0)), m, KunderaCoreUtils.getEntity(e), relationNames,
isRelational);
if (e != null)
{
entities.add(e);
}
}
catch (IllegalStateException e)
{
log.error("Error while returning entities for {}, Caused by: .", m.getEntityClazz(), e);
throw new KunderaException(e);
}
catch (Exception e)
{
log.error("Error while returning entities for {}, Caused by: .", m.getEntityClazz(), e);
throw new KunderaException(e);
}
}
}
return entities;
} } | public class class_name {
private List populateData(EntityMetadata m, Map<Bytes, List<Column>> qResults, List<Object> entities,
boolean isRelational, List<String> relationNames, CassandraDataHandler dataHandler)
{
if (m.getType().isSuperColumnFamilyMetadata())
{
Set<Bytes> primaryKeys = qResults.keySet();
if (primaryKeys != null && !primaryKeys.isEmpty())
{
Object[] rowIds = new Object[primaryKeys.size()];
int i = 0;
for (Bytes b : primaryKeys)
{
rowIds[i] = PropertyAccessorHelper.getObject(b, (Field) m.getIdAttribute().getJavaMember()); // depends on control dependency: [for], data = [b]
i++; // depends on control dependency: [for], data = [none]
}
entities.addAll(findAll(m.getEntityClazz(), null, rowIds)); // depends on control dependency: [if], data = [none]
}
}
else
{
Iterator<Bytes> rowIter = qResults.keySet().iterator();
while (rowIter.hasNext())
{
Bytes rowKey = rowIter.next();
List<Column> columns = qResults.get(rowKey);
try
{
Object id = PropertyAccessorHelper
.getObject(m.getIdAttribute().getJavaType(), rowKey.toByteArray());
Object e = null;
e = dataHandler.populateEntity(new ThriftRow(id, m.getTableName(), columns,
new ArrayList<SuperColumn>(0), new ArrayList<CounterColumn>(0),
new ArrayList<CounterSuperColumn>(0)), m, KunderaCoreUtils.getEntity(e), relationNames,
isRelational); // depends on control dependency: [try], data = [none]
if (e != null)
{
entities.add(e); // depends on control dependency: [if], data = [(e]
}
}
catch (IllegalStateException e)
{
log.error("Error while returning entities for {}, Caused by: .", m.getEntityClazz(), e);
throw new KunderaException(e);
} // depends on control dependency: [catch], data = [none]
catch (Exception e)
{
log.error("Error while returning entities for {}, Caused by: .", m.getEntityClazz(), e);
throw new KunderaException(e);
} // depends on control dependency: [catch], data = [none]
}
}
return entities;
} } |
public class class_name {
public JobGetAllLifetimeStatisticsOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null;
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate);
}
return this;
} } | public class class_name {
public JobGetAllLifetimeStatisticsOptions withOcpDate(DateTime ocpDate) {
if (ocpDate == null) {
this.ocpDate = null; // depends on control dependency: [if], data = [none]
} else {
this.ocpDate = new DateTimeRfc1123(ocpDate); // depends on control dependency: [if], data = [(ocpDate]
}
return this;
} } |
public class class_name {
public int valueForXPosition(int xPos) {
int value;
int minValue = slider.getMinimum();
int maxValue = slider.getMaximum();
int trackLeft = trackRect.x + thumbRect.width / 2 + trackBorder;
int trackRight = trackRect.x + trackRect.width - thumbRect.width / 2 - trackBorder;
int trackLength = trackRight - trackLeft;
if (xPos <= trackLeft) {
value = drawInverted() ? maxValue : minValue;
} else if (xPos >= trackRight) {
value = drawInverted() ? minValue : maxValue;
} else {
int distanceFromTrackLeft = xPos - trackLeft;
double valueRange = (double) maxValue - (double) minValue;
double valuePerPixel = valueRange / (double) trackLength;
int valueFromTrackLeft = (int) Math.round(distanceFromTrackLeft * valuePerPixel);
value = drawInverted() ? maxValue - valueFromTrackLeft : minValue + valueFromTrackLeft;
}
return value;
} } | public class class_name {
public int valueForXPosition(int xPos) {
int value;
int minValue = slider.getMinimum();
int maxValue = slider.getMaximum();
int trackLeft = trackRect.x + thumbRect.width / 2 + trackBorder;
int trackRight = trackRect.x + trackRect.width - thumbRect.width / 2 - trackBorder;
int trackLength = trackRight - trackLeft;
if (xPos <= trackLeft) {
value = drawInverted() ? maxValue : minValue; // depends on control dependency: [if], data = [none]
} else if (xPos >= trackRight) {
value = drawInverted() ? minValue : maxValue; // depends on control dependency: [if], data = [none]
} else {
int distanceFromTrackLeft = xPos - trackLeft;
double valueRange = (double) maxValue - (double) minValue;
double valuePerPixel = valueRange / (double) trackLength;
int valueFromTrackLeft = (int) Math.round(distanceFromTrackLeft * valuePerPixel);
value = drawInverted() ? maxValue - valueFromTrackLeft : minValue + valueFromTrackLeft; // depends on control dependency: [if], data = [none]
}
return value;
} } |
public class class_name {
public void close() {
try {
if (conn != null) {
conn.close();
}
} catch (IOException ignored) { }
if (zkClient != null) {
zkClient.stopAndWait();
}
} } | public class class_name {
public void close() {
try {
if (conn != null) {
conn.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException ignored) { } // depends on control dependency: [catch], data = [none]
if (zkClient != null) {
zkClient.stopAndWait(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setFontAndSize(BaseFont bf, float size) {
checkWriter();
state.size = size;
if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
state.fontDetails = new FontDetails(null, ((DocumentFont)bf).getIndirectReference(), bf);
}
else
state.fontDetails = writer.addSimple(bf);
PdfName psn = (PdfName)stdFieldFontNames.get(bf.getPostscriptFontName());
if (psn == null) {
if (bf.isSubset() && bf.getFontType() == BaseFont.FONT_TYPE_TTUNI)
psn = state.fontDetails.getFontName();
else {
psn = new PdfName(bf.getPostscriptFontName());
state.fontDetails.setSubset(false);
}
}
PageResources prs = getPageResources();
// PdfName name = state.fontDetails.getFontName();
prs.addFont(psn, state.fontDetails.getIndirectReference());
content.append(psn.getBytes()).append(' ').append(size).append(" Tf").append_i(separator);
} } | public class class_name {
public void setFontAndSize(BaseFont bf, float size) {
checkWriter();
state.size = size;
if (bf.getFontType() == BaseFont.FONT_TYPE_DOCUMENT) {
state.fontDetails = new FontDetails(null, ((DocumentFont)bf).getIndirectReference(), bf); // depends on control dependency: [if], data = [none]
}
else
state.fontDetails = writer.addSimple(bf);
PdfName psn = (PdfName)stdFieldFontNames.get(bf.getPostscriptFontName());
if (psn == null) {
if (bf.isSubset() && bf.getFontType() == BaseFont.FONT_TYPE_TTUNI)
psn = state.fontDetails.getFontName();
else {
psn = new PdfName(bf.getPostscriptFontName()); // depends on control dependency: [if], data = [none]
state.fontDetails.setSubset(false); // depends on control dependency: [if], data = [none]
}
}
PageResources prs = getPageResources();
// PdfName name = state.fontDetails.getFontName();
prs.addFont(psn, state.fontDetails.getIndirectReference());
content.append(psn.getBytes()).append(' ').append(size).append(" Tf").append_i(separator);
} } |
public class class_name {
@SuppressWarnings("unchecked")
private Hashtable getAutoTransferringHeaders()
{
Hashtable headers = (Hashtable)_req.getAttribute(AUTO_XFER_HEADERS_ATTR);
if (headers == null)
{
headers = new Hashtable();
_req.setAttribute(AUTO_XFER_HEADERS_ATTR, headers);
}
return headers;
} } | public class class_name {
@SuppressWarnings("unchecked")
private Hashtable getAutoTransferringHeaders()
{
Hashtable headers = (Hashtable)_req.getAttribute(AUTO_XFER_HEADERS_ATTR);
if (headers == null)
{
headers = new Hashtable(); // depends on control dependency: [if], data = [none]
_req.setAttribute(AUTO_XFER_HEADERS_ATTR, headers); // depends on control dependency: [if], data = [none]
}
return headers;
} } |
public class class_name {
public List<TorrentStatus> status() {
torrent_status_vector v = alert.getStatus();
int size = (int) v.size();
List<TorrentStatus> l = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
l.add(new TorrentStatus(v.get(i)));
}
return l;
} } | public class class_name {
public List<TorrentStatus> status() {
torrent_status_vector v = alert.getStatus();
int size = (int) v.size();
List<TorrentStatus> l = new ArrayList<>(size);
for (int i = 0; i < size; i++) {
l.add(new TorrentStatus(v.get(i))); // depends on control dependency: [for], data = [i]
}
return l;
} } |
public class class_name {
@SuppressWarnings("rawtypes")
boolean predicateMatchRules(
final Map<String, String> resource,
final Function<String, Predicate<String>> predicateTransformer,
final Function<List, Predicate<String>> listpred,
final Map<String, Object> ruleResource, final String sourceIdentity
)
{
for (final Object o : ruleResource.entrySet()) {
final Map.Entry entry = (Map.Entry) o;
final String key = (String) entry.getKey();
final Object test = entry.getValue();
final boolean matched = applyTest(resource, predicateTransformer, key, test, listpred, sourceIdentity);
if (!matched) {
return false;
}
}
return true;
} } | public class class_name {
@SuppressWarnings("rawtypes")
boolean predicateMatchRules(
final Map<String, String> resource,
final Function<String, Predicate<String>> predicateTransformer,
final Function<List, Predicate<String>> listpred,
final Map<String, Object> ruleResource, final String sourceIdentity
)
{
for (final Object o : ruleResource.entrySet()) {
final Map.Entry entry = (Map.Entry) o;
final String key = (String) entry.getKey();
final Object test = entry.getValue();
final boolean matched = applyTest(resource, predicateTransformer, key, test, listpred, sourceIdentity);
if (!matched) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} } |
public class class_name {
public String marshal(Object jaxbObject) {
// Precondition, check that the jaxbContext is set!
if (jaxbContext == null) {
logger.error("Trying to marshal with a null jaxbContext, returns null. Check your configuration, e.g. jaxb-transformers!");
return null;
}
try {
StringWriter writer = new StringWriter();
Marshaller marshaller = jaxbContext.createMarshaller();
if (marshallProps != null) {
for (Entry<String, Object> entry : marshallProps.entrySet()) {
marshaller.setProperty(entry.getKey(), entry.getValue());
}
}
marshaller.marshal(jaxbObject, writer);
String xml = writer.toString();
if (logger.isDebugEnabled()) logger.debug("marshalled jaxb object of type {}, returns xml: {}", jaxbObject.getClass().getSimpleName(), xml);
return xml;
} catch (JAXBException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public String marshal(Object jaxbObject) {
// Precondition, check that the jaxbContext is set!
if (jaxbContext == null) {
logger.error("Trying to marshal with a null jaxbContext, returns null. Check your configuration, e.g. jaxb-transformers!"); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
try {
StringWriter writer = new StringWriter();
Marshaller marshaller = jaxbContext.createMarshaller();
if (marshallProps != null) {
for (Entry<String, Object> entry : marshallProps.entrySet()) {
marshaller.setProperty(entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
}
marshaller.marshal(jaxbObject, writer); // depends on control dependency: [try], data = [none]
String xml = writer.toString();
if (logger.isDebugEnabled()) logger.debug("marshalled jaxb object of type {}, returns xml: {}", jaxbObject.getClass().getSimpleName(), xml);
return xml; // depends on control dependency: [try], data = [none]
} catch (JAXBException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public java.lang.String getMessage() {
if (resourceBundleName != null && resourceKey != null) {
String retrievedMessage = null;
String internalMessage = null;
String defaultEnglishMessage = null;
ResourceBundle bundle = null;
// retrieve the resource bundle
try {
bundle = ResourceBundle.getBundle(resourceBundleName);
} catch (MissingResourceException e) {
String key = null;
if (message == null) {
key = "missingResourceBundleNoDft";
defaultEnglishMessage = "There was an error retrieving resource bundle {0}. \nThere is no default message.";
} else {
key = "missingResourceBundleWithDft";
defaultEnglishMessage = "There was an error retrieving resource bundle {0}. \nThe default exception message is: {2}.";
}
internalMessage = getErrorMsg(DIST_EX_RESOURCE_BUNDLE_NAME, key, defaultEnglishMessage);
}
// if the resource bundle was successfully retrieved, get the specific message based
// on the resource key
if (bundle != null) {
try {
retrievedMessage = bundle.getString(resourceKey);
} catch (MissingResourceException e) {
String key = null;
if (message == null) {
key = "missingResourceKeyNoDft";
defaultEnglishMessage = "There was an error retrieving resource key {1} in resource bundle {0}. \nThere is no default message.";
} else {
key = "missingResourceKeyWithDft";
defaultEnglishMessage = "There was an error retrieving resource key {1} in resource bundle {0}. \nThe default exception message is: {2}.";
}
internalMessage = getErrorMsg(DIST_EX_RESOURCE_BUNDLE_NAME, key, defaultEnglishMessage);
}
}
String formattedMessage = null;
// format the message
if (retrievedMessage != null) {
if (formatArguments != null) {
formattedMessage = MessageFormat.format(retrievedMessage, formatArguments);
} else {
formattedMessage = retrievedMessage;
}
} else if (internalMessage != null) {
Object intFormatArguments[] = { resourceBundleName, resourceKey, message };
formattedMessage = MessageFormat.format(internalMessage, intFormatArguments);
} else { // shouldn't happen
return message; // which could be null
}
return formattedMessage;
} else { // resource information does not exist, so return the default message, if provided
return message;
}
} } | public class class_name {
public java.lang.String getMessage() {
if (resourceBundleName != null && resourceKey != null) {
String retrievedMessage = null;
String internalMessage = null;
String defaultEnglishMessage = null;
ResourceBundle bundle = null;
// retrieve the resource bundle
try {
bundle = ResourceBundle.getBundle(resourceBundleName); // depends on control dependency: [try], data = [none]
} catch (MissingResourceException e) {
String key = null;
if (message == null) {
key = "missingResourceBundleNoDft"; // depends on control dependency: [if], data = [none]
defaultEnglishMessage = "There was an error retrieving resource bundle {0}. \nThere is no default message."; // depends on control dependency: [if], data = [none]
} else {
key = "missingResourceBundleWithDft";
defaultEnglishMessage = "There was an error retrieving resource bundle {0}. \nThe default exception message is: {2}."; // depends on control dependency: [if], data = [none]
}
internalMessage = getErrorMsg(DIST_EX_RESOURCE_BUNDLE_NAME, key, defaultEnglishMessage);
}
// if the resource bundle was successfully retrieved, get the specific message based
// on the resource key
if (bundle != null) {
try {
retrievedMessage = bundle.getString(resourceKey); // depends on control dependency: [try], data = [none]
} catch (MissingResourceException e) {
String key = null;
if (message == null) {
key = "missingResourceKeyNoDft"; // depends on control dependency: [if], data = [none]
defaultEnglishMessage = "There was an error retrieving resource key {1} in resource bundle {0}. \nThere is no default message."; // depends on control dependency: [if], data = [none]
} else {
key = "missingResourceKeyWithDft"; // depends on control dependency: [if], data = [none]
defaultEnglishMessage = "There was an error retrieving resource key {1} in resource bundle {0}. \nThe default exception message is: {2}."; // depends on control dependency: [if], data = [none]
}
internalMessage = getErrorMsg(DIST_EX_RESOURCE_BUNDLE_NAME, key, defaultEnglishMessage);
} // depends on control dependency: [catch], data = [none]
}
String formattedMessage = null;
// format the message
if (retrievedMessage != null) {
if (formatArguments != null) {
formattedMessage = MessageFormat.format(retrievedMessage, formatArguments); // depends on control dependency: [if], data = [none]
} else {
formattedMessage = retrievedMessage; // depends on control dependency: [if], data = [none]
}
} else if (internalMessage != null) {
Object intFormatArguments[] = { resourceBundleName, resourceKey, message };
formattedMessage = MessageFormat.format(internalMessage, intFormatArguments); // depends on control dependency: [if], data = [(internalMessage]
} else { // shouldn't happen
return message; // which could be null // depends on control dependency: [if], data = [none]
}
return formattedMessage; // depends on control dependency: [if], data = [none]
} else { // resource information does not exist, so return the default message, if provided
return message; // depends on control dependency: [if], data = [none]
}
} } // depends on control dependency: [catch], data = [none] |
public class class_name {
synchronized static void setFactoryImplementation() {
if (initialized)
return;
initialized = true;
String authConfigProvider = Security.getProperty(AuthConfigFactory.DEFAULT_FACTORY_SECURITY_PROPERTY);
if (authConfigProvider == null || authConfigProvider.isEmpty()) {
Tr.info(tc, "JASPI_DEFAULT_AUTH_CONFIG_FACTORY", new Object[] { JASPI_PROVIDER_REGISTRY });
Security.setProperty(AuthConfigFactory.DEFAULT_FACTORY_SECURITY_PROPERTY, JASPI_PROVIDER_REGISTRY);
} else if (!authConfigProvider.equals(JASPI_PROVIDER_REGISTRY)) {
Tr.info(tc, "JASPI_AUTH_CONFIG_FACTORY", new Object[] { authConfigProvider });
}
} } | public class class_name {
synchronized static void setFactoryImplementation() {
if (initialized)
return;
initialized = true;
String authConfigProvider = Security.getProperty(AuthConfigFactory.DEFAULT_FACTORY_SECURITY_PROPERTY);
if (authConfigProvider == null || authConfigProvider.isEmpty()) {
Tr.info(tc, "JASPI_DEFAULT_AUTH_CONFIG_FACTORY", new Object[] { JASPI_PROVIDER_REGISTRY }); // depends on control dependency: [if], data = [none]
Security.setProperty(AuthConfigFactory.DEFAULT_FACTORY_SECURITY_PROPERTY, JASPI_PROVIDER_REGISTRY); // depends on control dependency: [if], data = [none]
} else if (!authConfigProvider.equals(JASPI_PROVIDER_REGISTRY)) {
Tr.info(tc, "JASPI_AUTH_CONFIG_FACTORY", new Object[] { authConfigProvider }); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static UIComponent resolveComponent(FacesContext context, UIComponent source, String expression, int hints) {
if (LangUtils.isValueBlank(expression)) {
if (SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.PARENT_FALLBACK)) {
return source.getParent();
}
return null;
}
final char separatorChar = UINamingContainer.getSeparatorChar(context);
expression = expression.trim();
validateExpression(context, source, expression, separatorChar);
if (expression.equals(SearchExpressionConstants.NONE_KEYWORD)) {
return null;
}
if (LangUtils.isValueBlank(expression)) {
return null;
}
UIComponent component;
// if it contains a keyword and it's not a nested expression (e.g. @parent:@parent), we don't need to loop
if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX) && expression.indexOf(separatorChar) != -1) {
component = resolveComponentByExpressionChain(context, source, expression, separatorChar, hints);
}
// it's a keyword and not nested, just ask our resolvers
else if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX)) {
SearchExpressionResolver resolver = SearchExpressionResolverFactory.findResolver(expression);
component = resolver.resolveComponent(context, source, source, expression, hints);
}
// default ID case
else {
ResolveComponentCallback callback = new ResolveComponentCallback();
resolveComponentById(source, expression, separatorChar, context, callback);
component = callback.getComponent();
}
if (component == null && !SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.IGNORE_NO_RESULT)) {
cannotFindComponent(context, source, expression);
}
return component;
} } | public class class_name {
public static UIComponent resolveComponent(FacesContext context, UIComponent source, String expression, int hints) {
if (LangUtils.isValueBlank(expression)) {
if (SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.PARENT_FALLBACK)) {
return source.getParent(); // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
final char separatorChar = UINamingContainer.getSeparatorChar(context);
expression = expression.trim();
validateExpression(context, source, expression, separatorChar);
if (expression.equals(SearchExpressionConstants.NONE_KEYWORD)) {
return null; // depends on control dependency: [if], data = [none]
}
if (LangUtils.isValueBlank(expression)) {
return null; // depends on control dependency: [if], data = [none]
}
UIComponent component;
// if it contains a keyword and it's not a nested expression (e.g. @parent:@parent), we don't need to loop
if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX) && expression.indexOf(separatorChar) != -1) {
component = resolveComponentByExpressionChain(context, source, expression, separatorChar, hints); // depends on control dependency: [if], data = [none]
}
// it's a keyword and not nested, just ask our resolvers
else if (expression.contains(SearchExpressionConstants.KEYWORD_PREFIX)) {
SearchExpressionResolver resolver = SearchExpressionResolverFactory.findResolver(expression);
component = resolver.resolveComponent(context, source, source, expression, hints); // depends on control dependency: [if], data = [none]
}
// default ID case
else {
ResolveComponentCallback callback = new ResolveComponentCallback();
resolveComponentById(source, expression, separatorChar, context, callback); // depends on control dependency: [if], data = [none]
component = callback.getComponent(); // depends on control dependency: [if], data = [none]
}
if (component == null && !SearchExpressionUtils.isHintSet(hints, SearchExpressionHint.IGNORE_NO_RESULT)) {
cannotFindComponent(context, source, expression); // depends on control dependency: [if], data = [none]
}
return component;
} } |
public class class_name {
public static void deleteSubDirs(File dir) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
File f = new File(dir, children[i]);
if (f.isDirectory()) {
deleteDir(f);
}
}
} } | public class class_name {
public static void deleteSubDirs(File dir) {
String[] children = dir.list();
for (int i = 0; i < children.length; i++) {
File f = new File(dir, children[i]);
if (f.isDirectory()) {
deleteDir(f);
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
protected boolean isTableElement(final Node node) {
if (node.getNodeType() != Node.NodeType.ELEMENT) {
return false;
}
String elementName = node.getNodeName().toLowerCase();
return elementName.equals("table");
} } | public class class_name {
protected boolean isTableElement(final Node node) {
if (node.getNodeType() != Node.NodeType.ELEMENT) {
return false; // depends on control dependency: [if], data = [none]
}
String elementName = node.getNodeName().toLowerCase();
return elementName.equals("table");
} } |
public class class_name {
private void cancelConnectionWaiterLocked(ConnectionWaiter waiter) {
if (waiter.mAssignedConnection != null || waiter.mException != null) {
// Waiter is done waiting but has not woken up yet.
return;
}
// Waiter must still be waiting. Dequeue it.
ConnectionWaiter predecessor = null;
ConnectionWaiter current = mConnectionWaiterQueue;
while (current != waiter) {
assert current != null;
predecessor = current;
current = current.mNext;
}
if (predecessor != null) {
predecessor.mNext = waiter.mNext;
} else {
mConnectionWaiterQueue = waiter.mNext;
}
// Send the waiter an exception and unpark it.
waiter.mException = new OperationCanceledException();
LockSupport.unpark(waiter.mThread);
// Check whether removing this waiter will enable other waiters to make progress.
wakeConnectionWaitersLocked();
} } | public class class_name {
private void cancelConnectionWaiterLocked(ConnectionWaiter waiter) {
if (waiter.mAssignedConnection != null || waiter.mException != null) {
// Waiter is done waiting but has not woken up yet.
return; // depends on control dependency: [if], data = [none]
}
// Waiter must still be waiting. Dequeue it.
ConnectionWaiter predecessor = null;
ConnectionWaiter current = mConnectionWaiterQueue;
while (current != waiter) {
assert current != null;
predecessor = current; // depends on control dependency: [while], data = [none]
current = current.mNext; // depends on control dependency: [while], data = [none]
}
if (predecessor != null) {
predecessor.mNext = waiter.mNext; // depends on control dependency: [if], data = [none]
} else {
mConnectionWaiterQueue = waiter.mNext; // depends on control dependency: [if], data = [none]
}
// Send the waiter an exception and unpark it.
waiter.mException = new OperationCanceledException();
LockSupport.unpark(waiter.mThread);
// Check whether removing this waiter will enable other waiters to make progress.
wakeConnectionWaitersLocked();
} } |
public class class_name {
private float getSensitivity(float x, float y) {
double furthestDistance = MAX_DISTANCE;
double distance = Math.sqrt(Math.pow(x - CENTER_X, 2) + Math.pow(y - CENTER_Y, 2));
double sens = MAX_SENSITIVITY * distance / furthestDistance;
if (sens > MAX_SENSITIVITY) {
sens = MAX_SENSITIVITY;
}
return (float) sens;
} } | public class class_name {
private float getSensitivity(float x, float y) {
double furthestDistance = MAX_DISTANCE;
double distance = Math.sqrt(Math.pow(x - CENTER_X, 2) + Math.pow(y - CENTER_Y, 2));
double sens = MAX_SENSITIVITY * distance / furthestDistance;
if (sens > MAX_SENSITIVITY) {
sens = MAX_SENSITIVITY; // depends on control dependency: [if], data = [none]
}
return (float) sens;
} } |
public class class_name {
public void marshall(TransactWriteItemsRequest transactWriteItemsRequest, ProtocolMarshaller protocolMarshaller) {
if (transactWriteItemsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(transactWriteItemsRequest.getTransactItems(), TRANSACTITEMS_BINDING);
protocolMarshaller.marshall(transactWriteItemsRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING);
protocolMarshaller.marshall(transactWriteItemsRequest.getReturnItemCollectionMetrics(), RETURNITEMCOLLECTIONMETRICS_BINDING);
protocolMarshaller.marshall(transactWriteItemsRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(TransactWriteItemsRequest transactWriteItemsRequest, ProtocolMarshaller protocolMarshaller) {
if (transactWriteItemsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(transactWriteItemsRequest.getTransactItems(), TRANSACTITEMS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transactWriteItemsRequest.getReturnConsumedCapacity(), RETURNCONSUMEDCAPACITY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transactWriteItemsRequest.getReturnItemCollectionMetrics(), RETURNITEMCOLLECTIONMETRICS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(transactWriteItemsRequest.getClientRequestToken(), CLIENTREQUESTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int encodeSamples(int[] samples, int count, int start, int skip,
EncodedElement result, long frameNumber) {
//System.err.println("FRAME::encodeSamples: frame#:"+frameNumber);
if(DEBUG_LEV > 0) {
System.err.println("FRAME::encodeSamplesNew(...)");
if(DEBUG_LEV > 10) {
System.err.println("\tsamples.length:"+samples.length+":count:"+
count+":start:"+start+":skip:"+skip+":frameNumber:"+
frameNumber);
}
}
int samplesEncoded = count;
testConstant = true;
EncodedElement data = null;
ChannelData[][] chanConfigData = this.getChannelsToEncode(samples, count,
sc.getChannelCount(), sc.getBitsPerSample());
int size = Integer.MAX_VALUE;
EncodingConfiguration.ChannelConfig chConf = EncodingConfiguration.ChannelConfig.INDEPENDENT;
for(int i = 0; i < chanConfigData.length; i++) {
EncodedElement temp = new EncodedElement();
int configSize = encodeChannels(chanConfigData[i], temp);
if(configSize < size) {
size = configSize;
data = temp;
chConf = determineConfigUsed(chanConfigData[i]);
}
}
//create header element; attach to result
EncodedElement header = new EncodedElement(FrameHeader.MAX_HEADER_SIZE, 0);
frameHeader.createHeader(true, count, sc.getSampleRate(), chConf,
sc.getBitsPerSample(), frameNumber, channels, header);
//result.setNext(header);
result.attachEnd(header);
//attach data to header
header.attachEnd(data);
//use "data" to zero-pad to byte boundary.
//EncodedElement temp = data.getEnd();
data.padToByte();
//calculate CRC and affix footer
EncodedElement crc16Ele = getCRC16(header);
data.attachEnd(crc16Ele);
if(DEBUG_LEV > 0)
System.err.println("Frame::encodeSamples(...): End");
return samplesEncoded;
} } | public class class_name {
public int encodeSamples(int[] samples, int count, int start, int skip,
EncodedElement result, long frameNumber) {
//System.err.println("FRAME::encodeSamples: frame#:"+frameNumber);
if(DEBUG_LEV > 0) {
System.err.println("FRAME::encodeSamplesNew(...)"); // depends on control dependency: [if], data = [none]
if(DEBUG_LEV > 10) {
System.err.println("\tsamples.length:"+samples.length+":count:"+
count+":start:"+start+":skip:"+skip+":frameNumber:"+
frameNumber); // depends on control dependency: [if], data = [none]
}
}
int samplesEncoded = count;
testConstant = true;
EncodedElement data = null;
ChannelData[][] chanConfigData = this.getChannelsToEncode(samples, count,
sc.getChannelCount(), sc.getBitsPerSample());
int size = Integer.MAX_VALUE;
EncodingConfiguration.ChannelConfig chConf = EncodingConfiguration.ChannelConfig.INDEPENDENT;
for(int i = 0; i < chanConfigData.length; i++) {
EncodedElement temp = new EncodedElement();
int configSize = encodeChannels(chanConfigData[i], temp);
if(configSize < size) {
size = configSize; // depends on control dependency: [if], data = [none]
data = temp; // depends on control dependency: [if], data = [none]
chConf = determineConfigUsed(chanConfigData[i]); // depends on control dependency: [if], data = [none]
}
}
//create header element; attach to result
EncodedElement header = new EncodedElement(FrameHeader.MAX_HEADER_SIZE, 0);
frameHeader.createHeader(true, count, sc.getSampleRate(), chConf,
sc.getBitsPerSample(), frameNumber, channels, header);
//result.setNext(header);
result.attachEnd(header);
//attach data to header
header.attachEnd(data);
//use "data" to zero-pad to byte boundary.
//EncodedElement temp = data.getEnd();
data.padToByte();
//calculate CRC and affix footer
EncodedElement crc16Ele = getCRC16(header);
data.attachEnd(crc16Ele);
if(DEBUG_LEV > 0)
System.err.println("Frame::encodeSamples(...): End");
return samplesEncoded;
} } |
public class class_name {
private void write(final Collection<Writer> writers, final Task task) {
try {
Writer writer = task.writer;
writer.write(task.logEntry);
if (!writers.contains(writer)) {
writers.add(writer);
}
} catch (Exception ex) {
InternalLogger.log(Level.ERROR, ex, "Failed to write log entry '" + task.logEntry.getMessage() + "'");
}
} } | public class class_name {
private void write(final Collection<Writer> writers, final Task task) {
try {
Writer writer = task.writer;
writer.write(task.logEntry); // depends on control dependency: [try], data = [none]
if (!writers.contains(writer)) {
writers.add(writer); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
InternalLogger.log(Level.ERROR, ex, "Failed to write log entry '" + task.logEntry.getMessage() + "'");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void forward() {
try {
CmsDbSettingsPanel panel = m_panel[0];
panel.saveToSetupBean();
boolean createDb = panel.getCreateDb();
boolean dropDb = panel.getDropDb();
boolean createTables = panel.getCreateTables();
setupDb(createDb, createTables, dropDb);
} catch (DBException e) {
CmsSetupErrorDialog.showErrorDialog(e.getMessage(), e.getDetails());
} catch (Exception e) {
CmsSetupErrorDialog.showErrorDialog(e);
}
} } | public class class_name {
private void forward() {
try {
CmsDbSettingsPanel panel = m_panel[0];
panel.saveToSetupBean(); // depends on control dependency: [try], data = [none]
boolean createDb = panel.getCreateDb();
boolean dropDb = panel.getDropDb();
boolean createTables = panel.getCreateTables();
setupDb(createDb, createTables, dropDb); // depends on control dependency: [try], data = [none]
} catch (DBException e) {
CmsSetupErrorDialog.showErrorDialog(e.getMessage(), e.getDetails());
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
CmsSetupErrorDialog.showErrorDialog(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void readControlFile(String fileName) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(fileName));
try {
controlList.clear();
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
if (line.isEmpty() || line.startsWith("#")) {
continue;
}
int separatorIndex = line.indexOf('=');
if (separatorIndex <= 0) {
logger.warn("Control file line \"" + line + "\" is invalid as does not have '=' separator.");
continue;
}
String className = line.substring(0, separatorIndex);
ControlMode controlMode;
try {
controlMode = ControlMode.valueOf(line.substring(separatorIndex + 1).trim().toUpperCase());
}
catch (IllegalArgumentException e) {
logger.warn("Control file line \"" + line + "\" is invalid as control mode is unknown.");
continue;
}
controlList.add(new ControlEntry(
className.startsWith("/") && className.endsWith("/") && className.length() > 2
? Pattern.compile(className.substring(1, className.length() - 1))
: Pattern.compile(className, Pattern.LITERAL),
controlMode));
}
configurationValues.put(ConfigurationOption.CONTROL, fileName);
}
finally {
reader.close();
}
} } | public class class_name {
void readControlFile(String fileName) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(fileName));
try {
controlList.clear();
String line;
while ((line = reader.readLine()) != null) {
line = line.trim();
// depends on control dependency: [while], data = [none]
if (line.isEmpty() || line.startsWith("#")) {
continue;
}
int separatorIndex = line.indexOf('=');
if (separatorIndex <= 0) {
logger.warn("Control file line \"" + line + "\" is invalid as does not have '=' separator.");
// depends on control dependency: [if], data = [none]
continue;
}
String className = line.substring(0, separatorIndex);
ControlMode controlMode;
try {
controlMode = ControlMode.valueOf(line.substring(separatorIndex + 1).trim().toUpperCase());
// depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException e) {
logger.warn("Control file line \"" + line + "\" is invalid as control mode is unknown.");
continue;
}
// depends on control dependency: [catch], data = [none]
controlList.add(new ControlEntry(
className.startsWith("/") && className.endsWith("/") && className.length() > 2
? Pattern.compile(className.substring(1, className.length() - 1))
: Pattern.compile(className, Pattern.LITERAL),
controlMode));
// depends on control dependency: [while], data = [none]
}
configurationValues.put(ConfigurationOption.CONTROL, fileName);
}
finally {
reader.close();
}
} } |
public class class_name {
@Override
public void visitLambda(JCLambda tree) {
LambdaTranslationContext localContext = (LambdaTranslationContext)context;
MethodSymbol sym = localContext.translatedSym;
MethodType lambdaType = (MethodType) sym.type;
{ /* Type annotation management: Based on where the lambda features, type annotations that
are interior to it, may at this point be attached to the enclosing method, or the first
constructor in the class, or in the enclosing class symbol or in the field whose
initializer is the lambda. In any event, gather up the annotations that belong to the
lambda and attach it to the implementation method.
*/
Symbol owner = localContext.owner;
apportionTypeAnnotations(tree,
owner::getRawTypeAttributes,
owner::setTypeAttributes,
sym::setTypeAttributes);
boolean init;
if ((init = (owner.name == names.init)) || owner.name == names.clinit) {
owner = owner.owner;
apportionTypeAnnotations(tree,
init ? owner::getInitTypeAttributes : owner::getClassInitTypeAttributes,
init ? owner::setInitTypeAttributes : owner::setClassInitTypeAttributes,
sym::appendUniqueTypeAttributes);
}
if (localContext.self != null && localContext.self.getKind() == ElementKind.FIELD) {
owner = localContext.self;
apportionTypeAnnotations(tree,
owner::getRawTypeAttributes,
owner::setTypeAttributes,
sym::appendUniqueTypeAttributes);
}
}
//create the method declaration hoisting the lambda body
JCMethodDecl lambdaDecl = make.MethodDef(make.Modifiers(sym.flags_field),
sym.name,
make.QualIdent(lambdaType.getReturnType().tsym),
List.nil(),
localContext.syntheticParams,
lambdaType.getThrownTypes() == null ?
List.nil() :
make.Types(lambdaType.getThrownTypes()),
null,
null);
lambdaDecl.sym = sym;
lambdaDecl.type = lambdaType;
//translate lambda body
//As the lambda body is translated, all references to lambda locals,
//captured variables, enclosing members are adjusted accordingly
//to refer to the static method parameters (rather than i.e. acessing to
//captured members directly).
lambdaDecl.body = translate(makeLambdaBody(tree, lambdaDecl));
//Add the method to the list of methods to be added to this class.
kInfo.addMethod(lambdaDecl);
//now that we have generated a method for the lambda expression,
//we can translate the lambda into a method reference pointing to the newly
//created method.
//
//Note that we need to adjust the method handle so that it will match the
//signature of the SAM descriptor - this means that the method reference
//should be added the following synthetic arguments:
//
// * the "this" argument if it is an instance method
// * enclosing locals captured by the lambda expression
ListBuffer<JCExpression> syntheticInits = new ListBuffer<>();
if (localContext.methodReferenceReceiver != null) {
syntheticInits.append(localContext.methodReferenceReceiver);
} else if (!sym.isStatic()) {
syntheticInits.append(makeThis(
sym.owner.enclClass().asType(),
localContext.owner.enclClass()));
}
//add captured locals
for (Symbol fv : localContext.getSymbolMap(CAPTURED_VAR).keySet()) {
if (fv != localContext.self) {
JCTree captured_local = make.Ident(fv).setType(fv.type);
syntheticInits.append((JCExpression) captured_local);
}
}
// add captured outer this instances (used only when `this' capture itself is illegal)
for (Symbol fv : localContext.getSymbolMap(CAPTURED_OUTER_THIS).keySet()) {
JCTree captured_local = make.QualThis(fv.type);
syntheticInits.append((JCExpression) captured_local);
}
//then, determine the arguments to the indy call
List<JCExpression> indy_args = translate(syntheticInits.toList(), localContext.prev);
//build a sam instance using an indy call to the meta-factory
int refKind = referenceKind(sym);
//convert to an invokedynamic call
result = makeMetafactoryIndyCall(context, refKind, sym, indy_args);
} } | public class class_name {
@Override
public void visitLambda(JCLambda tree) {
LambdaTranslationContext localContext = (LambdaTranslationContext)context;
MethodSymbol sym = localContext.translatedSym;
MethodType lambdaType = (MethodType) sym.type;
{ /* Type annotation management: Based on where the lambda features, type annotations that
are interior to it, may at this point be attached to the enclosing method, or the first
constructor in the class, or in the enclosing class symbol or in the field whose
initializer is the lambda. In any event, gather up the annotations that belong to the
lambda and attach it to the implementation method.
*/
Symbol owner = localContext.owner;
apportionTypeAnnotations(tree,
owner::getRawTypeAttributes,
owner::setTypeAttributes,
sym::setTypeAttributes);
boolean init;
if ((init = (owner.name == names.init)) || owner.name == names.clinit) {
owner = owner.owner; // depends on control dependency: [if], data = [none]
apportionTypeAnnotations(tree,
init ? owner::getInitTypeAttributes : owner::getClassInitTypeAttributes,
init ? owner::setInitTypeAttributes : owner::setClassInitTypeAttributes,
sym::appendUniqueTypeAttributes); // depends on control dependency: [if], data = [none]
}
if (localContext.self != null && localContext.self.getKind() == ElementKind.FIELD) {
owner = localContext.self; // depends on control dependency: [if], data = [none]
apportionTypeAnnotations(tree,
owner::getRawTypeAttributes,
owner::setTypeAttributes,
sym::appendUniqueTypeAttributes); // depends on control dependency: [if], data = [none]
}
}
//create the method declaration hoisting the lambda body
JCMethodDecl lambdaDecl = make.MethodDef(make.Modifiers(sym.flags_field),
sym.name,
make.QualIdent(lambdaType.getReturnType().tsym),
List.nil(),
localContext.syntheticParams,
lambdaType.getThrownTypes() == null ?
List.nil() :
make.Types(lambdaType.getThrownTypes()),
null,
null);
lambdaDecl.sym = sym;
lambdaDecl.type = lambdaType;
//translate lambda body
//As the lambda body is translated, all references to lambda locals,
//captured variables, enclosing members are adjusted accordingly
//to refer to the static method parameters (rather than i.e. acessing to
//captured members directly).
lambdaDecl.body = translate(makeLambdaBody(tree, lambdaDecl));
//Add the method to the list of methods to be added to this class.
kInfo.addMethod(lambdaDecl);
//now that we have generated a method for the lambda expression,
//we can translate the lambda into a method reference pointing to the newly
//created method.
//
//Note that we need to adjust the method handle so that it will match the
//signature of the SAM descriptor - this means that the method reference
//should be added the following synthetic arguments:
//
// * the "this" argument if it is an instance method
// * enclosing locals captured by the lambda expression
ListBuffer<JCExpression> syntheticInits = new ListBuffer<>();
if (localContext.methodReferenceReceiver != null) {
syntheticInits.append(localContext.methodReferenceReceiver); // depends on control dependency: [if], data = [(localContext.methodReferenceReceiver]
} else if (!sym.isStatic()) {
syntheticInits.append(makeThis(
sym.owner.enclClass().asType(),
localContext.owner.enclClass())); // depends on control dependency: [if], data = [none]
}
//add captured locals
for (Symbol fv : localContext.getSymbolMap(CAPTURED_VAR).keySet()) {
if (fv != localContext.self) {
JCTree captured_local = make.Ident(fv).setType(fv.type);
syntheticInits.append((JCExpression) captured_local); // depends on control dependency: [if], data = [none]
}
}
// add captured outer this instances (used only when `this' capture itself is illegal)
for (Symbol fv : localContext.getSymbolMap(CAPTURED_OUTER_THIS).keySet()) {
JCTree captured_local = make.QualThis(fv.type);
syntheticInits.append((JCExpression) captured_local); // depends on control dependency: [for], data = [none]
}
//then, determine the arguments to the indy call
List<JCExpression> indy_args = translate(syntheticInits.toList(), localContext.prev);
//build a sam instance using an indy call to the meta-factory
int refKind = referenceKind(sym);
//convert to an invokedynamic call
result = makeMetafactoryIndyCall(context, refKind, sym, indy_args);
} } |
public class class_name {
public java.util.List<String> getConnectionEvents() {
if (connectionEvents == null) {
connectionEvents = new com.amazonaws.internal.SdkInternalList<String>();
}
return connectionEvents;
} } | public class class_name {
public java.util.List<String> getConnectionEvents() {
if (connectionEvents == null) {
connectionEvents = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return connectionEvents;
} } |
public class class_name {
private Method setupSetterOrGetter(Class targetClass,
HashMap<Class, HashMap<String, Method>> propertyMapMap,
String prefix, Class valueType) {
Method setterOrGetter = null;
try {
// Have to lock property map prior to reading it, to guard against
// another thread putting something in there after we've checked it
// but before we've added an entry to it
mPropertyMapLock.writeLock().lock();
HashMap<String, Method> propertyMap = propertyMapMap.get(targetClass);
if (propertyMap != null) {
setterOrGetter = propertyMap.get(mPropertyName);
}
if (setterOrGetter == null) {
setterOrGetter = getPropertyFunction(targetClass, prefix, valueType);
if (propertyMap == null) {
propertyMap = new HashMap<String, Method>();
propertyMapMap.put(targetClass, propertyMap);
}
propertyMap.put(mPropertyName, setterOrGetter);
}
} finally {
mPropertyMapLock.writeLock().unlock();
}
return setterOrGetter;
} } | public class class_name {
private Method setupSetterOrGetter(Class targetClass,
HashMap<Class, HashMap<String, Method>> propertyMapMap,
String prefix, Class valueType) {
Method setterOrGetter = null;
try {
// Have to lock property map prior to reading it, to guard against
// another thread putting something in there after we've checked it
// but before we've added an entry to it
mPropertyMapLock.writeLock().lock(); // depends on control dependency: [try], data = [none]
HashMap<String, Method> propertyMap = propertyMapMap.get(targetClass);
if (propertyMap != null) {
setterOrGetter = propertyMap.get(mPropertyName); // depends on control dependency: [if], data = [none]
}
if (setterOrGetter == null) {
setterOrGetter = getPropertyFunction(targetClass, prefix, valueType); // depends on control dependency: [if], data = [none]
if (propertyMap == null) {
propertyMap = new HashMap<String, Method>(); // depends on control dependency: [if], data = [none]
propertyMapMap.put(targetClass, propertyMap); // depends on control dependency: [if], data = [none]
}
propertyMap.put(mPropertyName, setterOrGetter); // depends on control dependency: [if], data = [none]
}
} finally {
mPropertyMapLock.writeLock().unlock();
}
return setterOrGetter;
} } |
public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDialog dialog = (WDialog) component;
int state = dialog.getState();
if (state == WDialog.ACTIVE_STATE || dialog.getTrigger() != null) {
int width = dialog.getWidth();
int height = dialog.getHeight();
String title = dialog.getTitle();
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:dialog");
xml.appendAttribute("id", component.getId());
xml.appendOptionalAttribute("class", component.getHtmlClass());
xml.appendOptionalAttribute("track", component.isTracking(), "true");
xml.appendOptionalAttribute("width", width > 0, width);
xml.appendOptionalAttribute("height", height > 0, height);
xml.appendOptionalAttribute("modal", dialog.getMode() == WDialog.MODAL, "true");
xml.appendOptionalAttribute("open", dialog.getState() == WDialog.ACTIVE_STATE, "true");
xml.appendOptionalAttribute("title", title);
DialogOpenTrigger trigger = dialog.getTrigger();
if (trigger != null) {
xml.appendOptionalAttribute("triggerid", trigger.getId());
if (dialog.hasLegacyTriggerButton()) {
xml.appendClose();
trigger.paint(renderContext);
xml.appendEndTag("ui:dialog");
} else {
xml.appendEnd();
}
} else {
xml.appendEnd();
}
}
} } | public class class_name {
@Override
public void doRender(final WComponent component, final WebXmlRenderContext renderContext) {
WDialog dialog = (WDialog) component;
int state = dialog.getState();
if (state == WDialog.ACTIVE_STATE || dialog.getTrigger() != null) {
int width = dialog.getWidth();
int height = dialog.getHeight();
String title = dialog.getTitle();
XmlStringBuilder xml = renderContext.getWriter();
xml.appendTagOpen("ui:dialog"); // depends on control dependency: [if], data = [none]
xml.appendAttribute("id", component.getId()); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("class", component.getHtmlClass()); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("track", component.isTracking(), "true"); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("width", width > 0, width); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("height", height > 0, height); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("modal", dialog.getMode() == WDialog.MODAL, "true"); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("open", dialog.getState() == WDialog.ACTIVE_STATE, "true"); // depends on control dependency: [if], data = [none]
xml.appendOptionalAttribute("title", title); // depends on control dependency: [if], data = [none]
DialogOpenTrigger trigger = dialog.getTrigger();
if (trigger != null) {
xml.appendOptionalAttribute("triggerid", trigger.getId()); // depends on control dependency: [if], data = [none]
if (dialog.hasLegacyTriggerButton()) {
xml.appendClose(); // depends on control dependency: [if], data = [none]
trigger.paint(renderContext);
xml.appendEndTag("ui:dialog");
} else {
xml.appendEnd(); // depends on control dependency: [if], data = [none]
}
} else {
xml.appendEnd(); // depends on control dependency: [if], data = [none]
}
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.