code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public static void unRegister(Monitor monitor) {
ScheduledFuture future = register.remove(monitor);
if (future != null) {
future.cancel(true);// 打断
}
} } | public class class_name {
public static void unRegister(Monitor monitor) {
ScheduledFuture future = register.remove(monitor);
if (future != null) {
future.cancel(true);// 打断 // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public int compare(HashMap m1, HashMap m2) {
double val1;
double val2;
for (String sortId : sortIds) {
val1 = getValue(m1, sortId);
val2 = getValue(m2, sortId);
if (val1 > val2) {
return decVal;
} else if (val1 < val2) {
return ascVal;
}
}
return 0;
} } | public class class_name {
@Override
public int compare(HashMap m1, HashMap m2) {
double val1;
double val2;
for (String sortId : sortIds) {
val1 = getValue(m1, sortId); // depends on control dependency: [for], data = [sortId]
val2 = getValue(m2, sortId); // depends on control dependency: [for], data = [sortId]
if (val1 > val2) {
return decVal; // depends on control dependency: [if], data = [none]
} else if (val1 < val2) {
return ascVal; // depends on control dependency: [if], data = [none]
}
}
return 0;
} } |
public class class_name {
@Override
public EClass getIfcDuctSegmentType() {
if (ifcDuctSegmentTypeEClass == null) {
ifcDuctSegmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(203);
}
return ifcDuctSegmentTypeEClass;
} } | public class class_name {
@Override
public EClass getIfcDuctSegmentType() {
if (ifcDuctSegmentTypeEClass == null) {
ifcDuctSegmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(203);
// depends on control dependency: [if], data = [none]
}
return ifcDuctSegmentTypeEClass;
} } |
public class class_name {
protected Terminal createTerminal() {
terminal = TerminalFactory.create();
if (isWindows()) {
terminal.setEchoEnabled(true);
}
return terminal;
} } | public class class_name {
protected Terminal createTerminal() {
terminal = TerminalFactory.create();
if (isWindows()) {
terminal.setEchoEnabled(true); // depends on control dependency: [if], data = [none]
}
return terminal;
} } |
public class class_name {
public void lineTo(float x, float y) {
if (hole != null) {
hole.add(new float[] {x,y});
} else {
localPoints.add(new float[] {x,y});
}
cx = x;
cy = y;
pointsDirty = true;
} } | public class class_name {
public void lineTo(float x, float y) {
if (hole != null) {
hole.add(new float[] {x,y});
// depends on control dependency: [if], data = [none]
} else {
localPoints.add(new float[] {x,y});
// depends on control dependency: [if], data = [none]
}
cx = x;
cy = y;
pointsDirty = true;
} } |
public class class_name {
public List<FieldValue> getFieldValues() {
long offset = fileOffset + getInstanceFieldValuesOffset();
List<Field> fields = dumpClass.getAllInstanceFields();
List<FieldValue> values = new ArrayList<FieldValue>(fields.size());
Iterator<Field> fit = fields.iterator();
while (fit.hasNext()) {
HprofField field = (HprofField) fit.next();
if (field.getValueType() == HprofHeap.OBJECT) {
values.add(new HprofInstanceObjectValue(this, field, offset));
} else {
values.add(new HprofInstanceValue(this, field, offset));
}
offset += field.getValueSize();
}
return values;
} } | public class class_name {
public List<FieldValue> getFieldValues() {
long offset = fileOffset + getInstanceFieldValuesOffset();
List<Field> fields = dumpClass.getAllInstanceFields();
List<FieldValue> values = new ArrayList<FieldValue>(fields.size());
Iterator<Field> fit = fields.iterator();
while (fit.hasNext()) {
HprofField field = (HprofField) fit.next();
if (field.getValueType() == HprofHeap.OBJECT) {
values.add(new HprofInstanceObjectValue(this, field, offset)); // depends on control dependency: [if], data = [none]
} else {
values.add(new HprofInstanceValue(this, field, offset)); // depends on control dependency: [if], data = [none]
}
offset += field.getValueSize(); // depends on control dependency: [while], data = [none]
}
return values;
} } |
public class class_name {
public String returnArg(String key) {
SeLionElement element = HtmlSeLionElementSet.getInstance().findMatch(key);
if (element == null) {
return key;
}
if (!element.isUIElement()) {
return key;
}
return key.substring(0, key.indexOf(element.getElementClass()));
} } | public class class_name {
public String returnArg(String key) {
SeLionElement element = HtmlSeLionElementSet.getInstance().findMatch(key);
if (element == null) {
return key; // depends on control dependency: [if], data = [none]
}
if (!element.isUIElement()) {
return key; // depends on control dependency: [if], data = [none]
}
return key.substring(0, key.indexOf(element.getElementClass()));
} } |
public class class_name {
public static String getMEName(Object o) {
String meName;
if (!threadLocalStack.isEmpty()) {
meName = threadLocalStack.peek();
} else {
meName = DEFAULT_ME_NAME;
}
String str = "";
if (o != null) {
str = "/" + Integer.toHexString(System.identityHashCode(o));
}
// Defect 91793 to avoid SIBMessage in Systemout.log starting with [:]
return "";
} } | public class class_name {
public static String getMEName(Object o) {
String meName;
if (!threadLocalStack.isEmpty()) {
meName = threadLocalStack.peek(); // depends on control dependency: [if], data = [none]
} else {
meName = DEFAULT_ME_NAME; // depends on control dependency: [if], data = [none]
}
String str = "";
if (o != null) {
str = "/" + Integer.toHexString(System.identityHashCode(o)); // depends on control dependency: [if], data = [(o]
}
// Defect 91793 to avoid SIBMessage in Systemout.log starting with [:]
return "";
} } |
public class class_name {
public static String simpleName (Type type)
{
if (type instanceof GenericArrayType) {
return simpleName(((GenericArrayType)type).getGenericComponentType()) + "[]";
} else if (type instanceof Class<?>) {
Class<?> clazz = (Class<?>)type;
if (clazz.isArray()) {
return simpleName(clazz.getComponentType()) + "[]";
} else {
Package pkg = clazz.getPackage();
int offset = (pkg == null) ? 0 : pkg.getName().length()+1;
return clazz.getName().substring(offset).replace('$', '.');
}
} else if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)type;
StringBuilder buf = new StringBuilder();
for (Type arg : pt.getActualTypeArguments()) {
if (buf.length() > 0) {
buf.append(", ");
}
buf.append(simpleName(arg));
}
return simpleName(pt.getRawType()) + "<" + buf + ">";
} else if (type instanceof WildcardType) {
WildcardType wt = (WildcardType)type;
if (wt.getLowerBounds().length > 0) {
String errmsg = "Generation of simple name for wildcard type with lower bounds " +
"not implemented [type=" + type +
", lbounds=" + StringUtil.toString(wt.getLowerBounds()) + "]";
throw new IllegalArgumentException(errmsg);
}
if (wt.getUpperBounds().length > 1) {
String errmsg = "Generation of simple name for wildcard type with multiple upper " +
"bounds not implemented [type=" + type +
", ubounds=" + StringUtil.toString(wt.getUpperBounds()) + "]";
throw new IllegalArgumentException(errmsg);
}
StringBuilder buf = new StringBuilder("?");
if (!Object.class.equals(wt.getUpperBounds()[0])) {
buf.append(" extends ").append(simpleName(wt.getUpperBounds()[0]));
}
return buf.toString();
} else if (type instanceof TypeVariable) {
return ((TypeVariable<?>)type).getName();
} else {
throw new IllegalArgumentException("Can't generate simple name [type=" + type +
", tclass=" + StringUtil.shortClassName(type) + "]");
}
} } | public class class_name {
public static String simpleName (Type type)
{
if (type instanceof GenericArrayType) {
return simpleName(((GenericArrayType)type).getGenericComponentType()) + "[]";
} else if (type instanceof Class<?>) {
Class<?> clazz = (Class<?>)type;
if (clazz.isArray()) {
return simpleName(clazz.getComponentType()) + "[]";
} else {
Package pkg = clazz.getPackage();
int offset = (pkg == null) ? 0 : pkg.getName().length()+1;
return clazz.getName().substring(offset).replace('$', '.');
}
} else if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType)type;
StringBuilder buf = new StringBuilder();
for (Type arg : pt.getActualTypeArguments()) {
if (buf.length() > 0) {
buf.append(", "); // depends on control dependency: [if], data = [none]
}
buf.append(simpleName(arg)); // depends on control dependency: [for], data = [arg]
}
return simpleName(pt.getRawType()) + "<" + buf + ">";
} else if (type instanceof WildcardType) {
WildcardType wt = (WildcardType)type;
if (wt.getLowerBounds().length > 0) {
String errmsg = "Generation of simple name for wildcard type with lower bounds " +
"not implemented [type=" + type +
", lbounds=" + StringUtil.toString(wt.getLowerBounds()) + "]";
throw new IllegalArgumentException(errmsg);
}
if (wt.getUpperBounds().length > 1) {
String errmsg = "Generation of simple name for wildcard type with multiple upper " +
"bounds not implemented [type=" + type +
", ubounds=" + StringUtil.toString(wt.getUpperBounds()) + "]";
throw new IllegalArgumentException(errmsg);
}
StringBuilder buf = new StringBuilder("?");
if (!Object.class.equals(wt.getUpperBounds()[0])) {
buf.append(" extends ").append(simpleName(wt.getUpperBounds()[0])); // depends on control dependency: [if], data = [none]
}
return buf.toString();
} else if (type instanceof TypeVariable) {
return ((TypeVariable<?>)type).getName();
} else {
throw new IllegalArgumentException("Can't generate simple name [type=" + type +
", tclass=" + StringUtil.shortClassName(type) + "]");
}
} } |
public class class_name {
public void transform(WorldViewTransformer transformer) {
if (original != null) {
if (original instanceof Coordinate) {
transformed = transformer.worldToPan((Coordinate) original);
} else if (original instanceof Bbox) {
transformed = transformer.worldToPan((Bbox) original);
} else if (original instanceof Geometry) {
transformed = transformer.worldToPan((Geometry) original);
}
}
} } | public class class_name {
public void transform(WorldViewTransformer transformer) {
if (original != null) {
if (original instanceof Coordinate) {
transformed = transformer.worldToPan((Coordinate) original); // depends on control dependency: [if], data = [none]
} else if (original instanceof Bbox) {
transformed = transformer.worldToPan((Bbox) original); // depends on control dependency: [if], data = [none]
} else if (original instanceof Geometry) {
transformed = transformer.worldToPan((Geometry) original); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
private L listRequestHelper(URL url) {
try {
HttpUrl.Builder requestUrlBuilder = HttpUrl.get(url).newBuilder();
addQueryStringParam(requestUrlBuilder, "labelSelector", getLabelQueryParam());
addQueryStringParam(requestUrlBuilder, "fieldSelector", getFieldQueryParam());
Request.Builder requestBuilder = new Request.Builder().get().url(requestUrlBuilder.build());
L answer = handleResponse(requestBuilder, listType);
updateApiVersion(answer);
return answer;
} catch (InterruptedException | ExecutionException | IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType("list"), e);
}
} } | public class class_name {
private L listRequestHelper(URL url) {
try {
HttpUrl.Builder requestUrlBuilder = HttpUrl.get(url).newBuilder();
addQueryStringParam(requestUrlBuilder, "labelSelector", getLabelQueryParam()); // depends on control dependency: [try], data = [none]
addQueryStringParam(requestUrlBuilder, "fieldSelector", getFieldQueryParam()); // depends on control dependency: [try], data = [none]
Request.Builder requestBuilder = new Request.Builder().get().url(requestUrlBuilder.build());
L answer = handleResponse(requestBuilder, listType);
updateApiVersion(answer); // depends on control dependency: [try], data = [none]
return answer; // depends on control dependency: [try], data = [none]
} catch (InterruptedException | ExecutionException | IOException e) {
throw KubernetesClientException.launderThrowable(forOperationType("list"), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean hasMixin(final Node node) {
try {
return node.isNodeType(FEDORA_TIME_MAP);
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} } | public class class_name {
public static boolean hasMixin(final Node node) {
try {
return node.isNodeType(FEDORA_TIME_MAP); // depends on control dependency: [try], data = [none]
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected byte[] PBKDF2(PRF prf, byte[] S, int c, int dkLen)
{
if (S == null)
{
S = new byte[0];
}
int hLen = prf.getHLen();
int l = ceil(dkLen, hLen);
int r = dkLen - (l - 1) * hLen;
byte T[] = new byte[l * hLen];
int ti_offset = 0;
for (int i = 1; i <= l; i++)
{
_F(T, ti_offset, prf, S, c, i);
ti_offset += hLen;
}
if (r < hLen)
{
// Incomplete last block
byte DK[] = new byte[dkLen];
System.arraycopy(T, 0, DK, 0, dkLen);
return DK;
}
return T;
} } | public class class_name {
protected byte[] PBKDF2(PRF prf, byte[] S, int c, int dkLen)
{
if (S == null)
{
S = new byte[0]; // depends on control dependency: [if], data = [none]
}
int hLen = prf.getHLen();
int l = ceil(dkLen, hLen);
int r = dkLen - (l - 1) * hLen;
byte T[] = new byte[l * hLen];
int ti_offset = 0;
for (int i = 1; i <= l; i++)
{
_F(T, ti_offset, prf, S, c, i); // depends on control dependency: [for], data = [i]
ti_offset += hLen; // depends on control dependency: [for], data = [none]
}
if (r < hLen)
{
// Incomplete last block
byte DK[] = new byte[dkLen];
System.arraycopy(T, 0, DK, 0, dkLen); // depends on control dependency: [if], data = [none]
return DK; // depends on control dependency: [if], data = [none]
}
return T;
} } |
public class class_name {
@FFDCIgnore(Exception.class)
@Override
public IdentityToken encodeIdentityToken(Codec codec) {
IdentityToken token = null;
String distinguishedName = null;
try {
distinguishedName = getDistinguishedName();
token = createIdentityToken(codec, distinguishedName);
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "The client cannot create the ITTDistinguishedName identity assertion token for distinguished name " + distinguishedName
+ ". The exception message is: " + e.getMessage());
}
String messageFromBundle = Tr.formatMessage(tc, "CSIv2_CLIENT_ASSERTION_CANNOT_ENCODE_DN", distinguishedName, e.getMessage());
throw new org.omg.CORBA.NO_PERMISSION(messageFromBundle, SecurityMinorCodes.CREDENTIAL_NOT_AVAILABLE, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
}
return token;
} } | public class class_name {
@FFDCIgnore(Exception.class)
@Override
public IdentityToken encodeIdentityToken(Codec codec) {
IdentityToken token = null;
String distinguishedName = null;
try {
distinguishedName = getDistinguishedName(); // depends on control dependency: [try], data = [none]
token = createIdentityToken(codec, distinguishedName); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "The client cannot create the ITTDistinguishedName identity assertion token for distinguished name " + distinguishedName
+ ". The exception message is: " + e.getMessage()); // depends on control dependency: [if], data = [none]
}
String messageFromBundle = Tr.formatMessage(tc, "CSIv2_CLIENT_ASSERTION_CANNOT_ENCODE_DN", distinguishedName, e.getMessage());
throw new org.omg.CORBA.NO_PERMISSION(messageFromBundle, SecurityMinorCodes.CREDENTIAL_NOT_AVAILABLE, org.omg.CORBA.CompletionStatus.COMPLETED_NO);
} // depends on control dependency: [catch], data = [none]
return token;
} } |
public class class_name {
public void replaceNumericFeatures(List<Vec> newNumericFeatures)
{
if(this.size() != newNumericFeatures.size())
throw new RuntimeException("Input list does not have the same not of dataums as the dataset");
for(int i = 0; i < newNumericFeatures.size(); i++)
{
DataPoint dp_i = getDataPoint(i);
setDataPoint(i, new DataPoint(newNumericFeatures.get(i), dp_i.getCategoricalValues(), dp_i.getCategoricalData()));
}
this.numNumerVals = getDataPoint(0).numNumericalValues();
if (this.numericalVariableNames != null)
this.numericalVariableNames.clear();
} } | public class class_name {
public void replaceNumericFeatures(List<Vec> newNumericFeatures)
{
if(this.size() != newNumericFeatures.size())
throw new RuntimeException("Input list does not have the same not of dataums as the dataset");
for(int i = 0; i < newNumericFeatures.size(); i++)
{
DataPoint dp_i = getDataPoint(i);
setDataPoint(i, new DataPoint(newNumericFeatures.get(i), dp_i.getCategoricalValues(), dp_i.getCategoricalData()));
// depends on control dependency: [for], data = [i]
}
this.numNumerVals = getDataPoint(0).numNumericalValues();
if (this.numericalVariableNames != null)
this.numericalVariableNames.clear();
} } |
public class class_name {
public static String getStatusAsString(int status)
{
if (status >= Status.STATUS_ACTIVE && status <= Status.STATUS_ROLLING_BACK)
{
return TX_STATUS_STRINGS[status];
}
else
{
return "STATUS_INVALID(" + status + ")";
}
} } | public class class_name {
public static String getStatusAsString(int status)
{
if (status >= Status.STATUS_ACTIVE && status <= Status.STATUS_ROLLING_BACK)
{
return TX_STATUS_STRINGS[status]; // depends on control dependency: [if], data = [none]
}
else
{
return "STATUS_INVALID(" + status + ")"; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static int completeCircularPasses(int index, int seqLength) {
int count = 0;
while (index > seqLength) {
count++;
index -= seqLength;
}
return count - 1;
} } | public class class_name {
public static int completeCircularPasses(int index, int seqLength) {
int count = 0;
while (index > seqLength) {
count++; // depends on control dependency: [while], data = [none]
index -= seqLength; // depends on control dependency: [while], data = [none]
}
return count - 1;
} } |
public class class_name {
@Deprecated
public static <V> CompletableFuture<V> unmodifiableFuture(CompletableFuture<V> future, boolean propagateCancel)
{
requireNonNull(future, "future is null");
Function<Boolean, Boolean> onCancelFunction;
if (propagateCancel) {
onCancelFunction = future::cancel;
}
else {
onCancelFunction = mayInterrupt -> false;
}
UnmodifiableCompletableFuture<V> unmodifiableFuture = new UnmodifiableCompletableFuture<>(onCancelFunction);
future.whenComplete((value, exception) -> {
if (exception != null) {
unmodifiableFuture.internalCompleteExceptionally(exception);
}
else {
unmodifiableFuture.internalComplete(value);
}
});
return unmodifiableFuture;
} } | public class class_name {
@Deprecated
public static <V> CompletableFuture<V> unmodifiableFuture(CompletableFuture<V> future, boolean propagateCancel)
{
requireNonNull(future, "future is null");
Function<Boolean, Boolean> onCancelFunction;
if (propagateCancel) {
onCancelFunction = future::cancel; // depends on control dependency: [if], data = [none]
}
else {
onCancelFunction = mayInterrupt -> false; // depends on control dependency: [if], data = [none]
}
UnmodifiableCompletableFuture<V> unmodifiableFuture = new UnmodifiableCompletableFuture<>(onCancelFunction);
future.whenComplete((value, exception) -> {
if (exception != null) {
unmodifiableFuture.internalCompleteExceptionally(exception); // depends on control dependency: [if], data = [(exception]
}
else {
unmodifiableFuture.internalComplete(value); // depends on control dependency: [if], data = [none]
}
});
return unmodifiableFuture;
} } |
public class class_name {
@Override
public IndividualHelper firstIndividual() {
Property property=getProperty();
if(property==null) {
return null;
}
for(Value value:property) {
if(value instanceof Individual<?,?>) {
return new IndividualHelperImpl((Individual<?,?>)value);
}
}
return null;
} } | public class class_name {
@Override
public IndividualHelper firstIndividual() {
Property property=getProperty();
if(property==null) {
return null; // depends on control dependency: [if], data = [none]
}
for(Value value:property) {
if(value instanceof Individual<?,?>) {
return new IndividualHelperImpl((Individual<?,?>)value); // depends on control dependency: [if], data = [)]
}
}
return null;
} } |
public class class_name {
public List<BatchArtifactRef<BatchArtifacts<T>>> getAllRef()
{
List<BatchArtifactRef<BatchArtifacts<T>>> list = new ArrayList<BatchArtifactRef<BatchArtifacts<T>>>();
List<Node> nodeList = childNode.get("ref");
for(Node node: nodeList)
{
BatchArtifactRef<BatchArtifacts<T>> type = new BatchArtifactRefImpl<BatchArtifacts<T>>(this, "ref", childNode, node);
list.add(type);
}
return list;
} } | public class class_name {
public List<BatchArtifactRef<BatchArtifacts<T>>> getAllRef()
{
List<BatchArtifactRef<BatchArtifacts<T>>> list = new ArrayList<BatchArtifactRef<BatchArtifacts<T>>>();
List<Node> nodeList = childNode.get("ref");
for(Node node: nodeList)
{
BatchArtifactRef<BatchArtifacts<T>> type = new BatchArtifactRefImpl<BatchArtifacts<T>>(this, "ref", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} } |
public class class_name {
public static void addOperation(final OperationContext context) {
RbacSanityCheckOperation added = context.getAttachment(KEY);
if (added == null) {
// TODO support managed domain
if (!context.isNormalServer()) return;
context.addStep(createOperation(), INSTANCE, Stage.MODEL);
context.attach(KEY, INSTANCE);
}
} } | public class class_name {
public static void addOperation(final OperationContext context) {
RbacSanityCheckOperation added = context.getAttachment(KEY);
if (added == null) {
// TODO support managed domain
if (!context.isNormalServer()) return;
context.addStep(createOperation(), INSTANCE, Stage.MODEL); // depends on control dependency: [if], data = [none]
context.attach(KEY, INSTANCE); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static void propertyNullCheck(String dbType, String host, String port, String dbName)
{
if (dbType == null || dbType.isEmpty())
{
LOGGER.error("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty");
throw new KunderaException("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty");
}
if (host == null || host.isEmpty())
{
LOGGER.error("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty");
throw new KunderaException("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty");
}
if (port == null || port.isEmpty())
{
LOGGER.error("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty");
throw new KunderaException("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty");
}
if (dbName == null || dbName.isEmpty())
{
LOGGER.error("Property'" + EthConstants.DATABASE_NAME + "' can't be null or empty");
throw new KunderaException("Property '" + EthConstants.DATABASE_NAME + "' can't be null or empty");
}
} } | public class class_name {
private static void propertyNullCheck(String dbType, String host, String port, String dbName)
{
if (dbType == null || dbType.isEmpty())
{
LOGGER.error("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty"); // depends on control dependency: [if], data = [none]
throw new KunderaException("Property '" + EthConstants.DATABASE_TYPE + "' can't be null or empty");
}
if (host == null || host.isEmpty())
{
LOGGER.error("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty"); // depends on control dependency: [if], data = [none]
throw new KunderaException("Property '" + EthConstants.DATABASE_HOST + "' can't be null or empty");
}
if (port == null || port.isEmpty())
{
LOGGER.error("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty"); // depends on control dependency: [if], data = [none]
throw new KunderaException("Property '" + EthConstants.DATABASE_PORT + "' can't be null or empty");
}
if (dbName == null || dbName.isEmpty())
{
LOGGER.error("Property'" + EthConstants.DATABASE_NAME + "' can't be null or empty"); // depends on control dependency: [if], data = [none]
throw new KunderaException("Property '" + EthConstants.DATABASE_NAME + "' can't be null or empty");
}
} } |
public class class_name {
public ResolvableType getGeneric(int... indexes) {
try {
if (indexes == null || indexes.length == 0) {
return getGenerics()[0];
}
ResolvableType generic = this;
for (int index : indexes) {
generic = generic.getGenerics()[index];
}
return generic;
} catch (IndexOutOfBoundsException ex) {
return NONE;
}
} } | public class class_name {
public ResolvableType getGeneric(int... indexes) {
try {
if (indexes == null || indexes.length == 0) {
return getGenerics()[0]; // depends on control dependency: [if], data = [none]
}
ResolvableType generic = this;
for (int index : indexes) {
generic = generic.getGenerics()[index]; // depends on control dependency: [for], data = [index]
}
return generic; // depends on control dependency: [try], data = [none]
} catch (IndexOutOfBoundsException ex) {
return NONE;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public GetDomainStatisticsReportResult withDailyVolumes(DailyVolume... dailyVolumes) {
if (this.dailyVolumes == null) {
setDailyVolumes(new java.util.ArrayList<DailyVolume>(dailyVolumes.length));
}
for (DailyVolume ele : dailyVolumes) {
this.dailyVolumes.add(ele);
}
return this;
} } | public class class_name {
public GetDomainStatisticsReportResult withDailyVolumes(DailyVolume... dailyVolumes) {
if (this.dailyVolumes == null) {
setDailyVolumes(new java.util.ArrayList<DailyVolume>(dailyVolumes.length)); // depends on control dependency: [if], data = [none]
}
for (DailyVolume ele : dailyVolumes) {
this.dailyVolumes.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private void writeFullBuffer(ByteBuffer buffer) throws IOException {
int iterationsCount = MAX_WRITE_ITERATIONS;
int writeCount;
while(buffer.remaining() > 0 && iterationsCount > 0) {
writeCount = _channel.write(buffer);
if(writeCount == 0) {
// we decrement iterations count only when we could not write anything
--iterationsCount;
} else {
// as long as we can write, we reset iterationsCount
iterationsCount = MAX_WRITE_ITERATIONS;
}
}
if(buffer.remaining() > 0)
throw new IOException("couldn't write the buffer after " + MAX_WRITE_ITERATIONS + " tries");
} } | public class class_name {
private void writeFullBuffer(ByteBuffer buffer) throws IOException {
int iterationsCount = MAX_WRITE_ITERATIONS;
int writeCount;
while(buffer.remaining() > 0 && iterationsCount > 0) {
writeCount = _channel.write(buffer);
if(writeCount == 0) {
// we decrement iterations count only when we could not write anything
--iterationsCount; // depends on control dependency: [if], data = [none]
} else {
// as long as we can write, we reset iterationsCount
iterationsCount = MAX_WRITE_ITERATIONS; // depends on control dependency: [if], data = [none]
}
}
if(buffer.remaining() > 0)
throw new IOException("couldn't write the buffer after " + MAX_WRITE_ITERATIONS + " tries");
} } |
public class class_name {
public void setRulePriorities(java.util.Collection<RulePriorityPair> rulePriorities) {
if (rulePriorities == null) {
this.rulePriorities = null;
return;
}
this.rulePriorities = new java.util.ArrayList<RulePriorityPair>(rulePriorities);
} } | public class class_name {
public void setRulePriorities(java.util.Collection<RulePriorityPair> rulePriorities) {
if (rulePriorities == null) {
this.rulePriorities = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.rulePriorities = new java.util.ArrayList<RulePriorityPair>(rulePriorities);
} } |
public class class_name {
public static String[] addConfigurationClasses(String[] configurationClasses, AdditionalWebAppJettyConfigurationClass[] optionalAdditionalsWebappConfigurationClasses) {
List<String> newConfigurationClasses = new ArrayList<>(Arrays.asList(configurationClasses));
for (AdditionalWebAppJettyConfigurationClass additionalWebappConfigurationClass : optionalAdditionalsWebappConfigurationClasses) {
if (additionalWebappConfigurationClass.getClasses() == null || additionalWebappConfigurationClass.getPosition() == null) {
LOG.warn("Bad support class name");
} else {
if (ClassUtil.classesExists(additionalWebappConfigurationClass.getClasses())) {
int index = 0;
if (additionalWebappConfigurationClass.getReferenceClass() == null) {
if (additionalWebappConfigurationClass.getPosition() == Position.AFTER) {
index = newConfigurationClasses.size();
}
} else {
index = newConfigurationClasses.indexOf(additionalWebappConfigurationClass.getReferenceClass());
if (index == -1) {
if (additionalWebappConfigurationClass.getPosition() == Position.AFTER) {
LOG.warn("[{}] reference unreachable, add at the end", additionalWebappConfigurationClass.getReferenceClass());
index = newConfigurationClasses.size();
} else {
LOG.warn("[{}] reference unreachable, add at the top", additionalWebappConfigurationClass.getReferenceClass());
index = 0;
}
} else {
if (additionalWebappConfigurationClass.getPosition() == Position.AFTER) {
index++;
}
}
}
newConfigurationClasses.addAll(index, additionalWebappConfigurationClass.getClasses());
for (String className : additionalWebappConfigurationClass.getClasses()) {
LOG.debug("[{}] support added", className);
}
} else {
for (String className : additionalWebappConfigurationClass.getClasses()) {
LOG.debug("[{}] not available", className);
}
}
}
}
// List configurations
for (String configurationClasse : newConfigurationClasses) {
LOG.trace("Jetty WebAppContext Configuration => " + configurationClasse);
}
return newConfigurationClasses.toArray(new String[newConfigurationClasses.size()]);
} } | public class class_name {
public static String[] addConfigurationClasses(String[] configurationClasses, AdditionalWebAppJettyConfigurationClass[] optionalAdditionalsWebappConfigurationClasses) {
List<String> newConfigurationClasses = new ArrayList<>(Arrays.asList(configurationClasses));
for (AdditionalWebAppJettyConfigurationClass additionalWebappConfigurationClass : optionalAdditionalsWebappConfigurationClasses) {
if (additionalWebappConfigurationClass.getClasses() == null || additionalWebappConfigurationClass.getPosition() == null) {
LOG.warn("Bad support class name"); // depends on control dependency: [if], data = [none]
} else {
if (ClassUtil.classesExists(additionalWebappConfigurationClass.getClasses())) {
int index = 0;
if (additionalWebappConfigurationClass.getReferenceClass() == null) {
if (additionalWebappConfigurationClass.getPosition() == Position.AFTER) {
index = newConfigurationClasses.size(); // depends on control dependency: [if], data = [none]
}
} else {
index = newConfigurationClasses.indexOf(additionalWebappConfigurationClass.getReferenceClass()); // depends on control dependency: [if], data = [(additionalWebappConfigurationClass.getReferenceClass()]
if (index == -1) {
if (additionalWebappConfigurationClass.getPosition() == Position.AFTER) {
LOG.warn("[{}] reference unreachable, add at the end", additionalWebappConfigurationClass.getReferenceClass()); // depends on control dependency: [if], data = [none]
index = newConfigurationClasses.size(); // depends on control dependency: [if], data = [none]
} else {
LOG.warn("[{}] reference unreachable, add at the top", additionalWebappConfigurationClass.getReferenceClass()); // depends on control dependency: [if], data = [none]
index = 0; // depends on control dependency: [if], data = [none]
}
} else {
if (additionalWebappConfigurationClass.getPosition() == Position.AFTER) {
index++; // depends on control dependency: [if], data = [none]
}
}
}
newConfigurationClasses.addAll(index, additionalWebappConfigurationClass.getClasses()); // depends on control dependency: [if], data = [none]
for (String className : additionalWebappConfigurationClass.getClasses()) {
LOG.debug("[{}] support added", className); // depends on control dependency: [for], data = [className]
}
} else {
for (String className : additionalWebappConfigurationClass.getClasses()) {
LOG.debug("[{}] not available", className); // depends on control dependency: [for], data = [className]
}
}
}
}
// List configurations
for (String configurationClasse : newConfigurationClasses) {
LOG.trace("Jetty WebAppContext Configuration => " + configurationClasse); // depends on control dependency: [for], data = [configurationClasse]
}
return newConfigurationClasses.toArray(new String[newConfigurationClasses.size()]);
} } |
public class class_name {
public static long lcm(long a, long b)
{
try {
if (a < 0L || b < 0L) {
return lcm(safeAbs(a), safeAbs(b));
}
if (a == 0L) {
return b;
}
if (b == 0L) {
return a;
}
return safeMultiply(a / gcd(a, b), b);
} catch (ArithmeticException e) {
throw new ArithmeticException(
"Long overflow: lcm(" + a + ", " + b + ")");
}
} } | public class class_name {
public static long lcm(long a, long b)
{
try {
if (a < 0L || b < 0L) {
return lcm(safeAbs(a), safeAbs(b)); // depends on control dependency: [if], data = [(a]
}
if (a == 0L) {
return b; // depends on control dependency: [if], data = [none]
}
if (b == 0L) {
return a; // depends on control dependency: [if], data = [none]
}
return safeMultiply(a / gcd(a, b), b);
} catch (ArithmeticException e) {
throw new ArithmeticException(
"Long overflow: lcm(" + a + ", " + b + ")");
}
} } |
public class class_name {
private synchronized void reschedule(long millis) {
currentFut = null; // Remove current future.
if (!closed) {
SCHEDULER.schedule(this::refresh, millis, TimeUnit.MILLISECONDS);
} else {
try {
underlying.close();
} catch (Exception ex) {
LOG.log(Level.WARNING, "failed to close resolver " + underlying.configString(), ex);
}
}
} } | public class class_name {
private synchronized void reschedule(long millis) {
currentFut = null; // Remove current future.
if (!closed) {
SCHEDULER.schedule(this::refresh, millis, TimeUnit.MILLISECONDS); // depends on control dependency: [if], data = [none]
} else {
try {
underlying.close(); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
LOG.log(Level.WARNING, "failed to close resolver " + underlying.configString(), ex);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
private int sequentialSearchEqual(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int xcc; /* Current compare result */
int idx = -1; /* The returned index (-1 if not found) */
for (int i = lower; i <= upper; i++)
{
xcc = comp.compare(searchKey, _nodeKey[i]);
if (xcc == 0) /* Found a match */
{
idx = i; /* Remember current point */
break;
}
}
return idx;
} } | public class class_name {
private int sequentialSearchEqual(
SearchComparator comp,
int lower,
int upper,
Object searchKey)
{
int xcc; /* Current compare result */
int idx = -1; /* The returned index (-1 if not found) */
for (int i = lower; i <= upper; i++)
{
xcc = comp.compare(searchKey, _nodeKey[i]); // depends on control dependency: [for], data = [i]
if (xcc == 0) /* Found a match */
{
idx = i; /* Remember current point */ // depends on control dependency: [if], data = [none]
break;
}
}
return idx;
} } |
public class class_name {
public static Duration between(Temporal startInclusive, Temporal endExclusive) {
try {
return ofNanos(startInclusive.until(endExclusive, NANOS));
} catch (DateTimeException | ArithmeticException ex) {
long secs = startInclusive.until(endExclusive, SECONDS);
long nanos;
try {
nanos = endExclusive.getLong(NANO_OF_SECOND) - startInclusive.getLong(NANO_OF_SECOND);
if (secs > 0 && nanos < 0) {
secs++;
} else if (secs < 0 && nanos > 0) {
secs--;
}
} catch (DateTimeException ex2) {
nanos = 0;
}
return ofSeconds(secs, nanos);
}
} } | public class class_name {
public static Duration between(Temporal startInclusive, Temporal endExclusive) {
try {
return ofNanos(startInclusive.until(endExclusive, NANOS)); // depends on control dependency: [try], data = [none]
} catch (DateTimeException | ArithmeticException ex) {
long secs = startInclusive.until(endExclusive, SECONDS);
long nanos;
try {
nanos = endExclusive.getLong(NANO_OF_SECOND) - startInclusive.getLong(NANO_OF_SECOND); // depends on control dependency: [try], data = [none]
if (secs > 0 && nanos < 0) {
secs++; // depends on control dependency: [if], data = [none]
} else if (secs < 0 && nanos > 0) {
secs--; // depends on control dependency: [if], data = [none]
}
} catch (DateTimeException ex2) {
nanos = 0;
} // depends on control dependency: [catch], data = [none]
return ofSeconds(secs, nanos);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private synchronized void appendXMLProperty(Document doc, Element conf,
String propertyName) {
// skip writing if given property name is empty or null
if (!Strings.isNullOrEmpty(propertyName)) {
String value = properties.getProperty(propertyName);
if (value != null) {
Element propNode = doc.createElement("property");
conf.appendChild(propNode);
Element nameNode = doc.createElement("name");
nameNode.appendChild(doc.createTextNode(propertyName));
propNode.appendChild(nameNode);
Element valueNode = doc.createElement("value");
valueNode.appendChild(doc.createTextNode(
properties.getProperty(propertyName)));
propNode.appendChild(valueNode);
Element finalNode = doc.createElement("final");
finalNode.appendChild(doc.createTextNode(
String.valueOf(finalParameters.contains(propertyName))));
propNode.appendChild(finalNode);
if (updatingResource != null) {
String[] sources = updatingResource.get(propertyName);
if(sources != null) {
for(String s : sources) {
Element sourceNode = doc.createElement("source");
sourceNode.appendChild(doc.createTextNode(s));
propNode.appendChild(sourceNode);
}
}
}
}
}
} } | public class class_name {
private synchronized void appendXMLProperty(Document doc, Element conf,
String propertyName) {
// skip writing if given property name is empty or null
if (!Strings.isNullOrEmpty(propertyName)) {
String value = properties.getProperty(propertyName);
if (value != null) {
Element propNode = doc.createElement("property");
conf.appendChild(propNode); // depends on control dependency: [if], data = [none]
Element nameNode = doc.createElement("name");
nameNode.appendChild(doc.createTextNode(propertyName)); // depends on control dependency: [if], data = [none]
propNode.appendChild(nameNode); // depends on control dependency: [if], data = [none]
Element valueNode = doc.createElement("value");
valueNode.appendChild(doc.createTextNode(
properties.getProperty(propertyName))); // depends on control dependency: [if], data = [none]
propNode.appendChild(valueNode); // depends on control dependency: [if], data = [(value]
Element finalNode = doc.createElement("final");
finalNode.appendChild(doc.createTextNode(
String.valueOf(finalParameters.contains(propertyName)))); // depends on control dependency: [if], data = [none]
propNode.appendChild(finalNode); // depends on control dependency: [if], data = [none]
if (updatingResource != null) {
String[] sources = updatingResource.get(propertyName);
if(sources != null) {
for(String s : sources) {
Element sourceNode = doc.createElement("source");
sourceNode.appendChild(doc.createTextNode(s)); // depends on control dependency: [for], data = [s]
propNode.appendChild(sourceNode); // depends on control dependency: [for], data = [s]
}
}
}
}
}
} } |
public class class_name {
public String asSQLStatement(Criteria crit, ClassDescriptor cld)
{
Enumeration e = crit.getElements();
StringBuffer statement = new StringBuffer();
while (e.hasMoreElements())
{
Object o = e.nextElement();
if (o instanceof Criteria)
{
String addAtStart;
String addAtEnd;
Criteria pc = (Criteria) o;
// need to add parenthesises?
if (pc.isEmbraced())
{
addAtStart = " (";
addAtEnd = ") ";
}
else
{
addAtStart = "";
addAtEnd = "";
}
switch (pc.getType())
{
case (Criteria.OR) :
{
statement.append(" OR ").append(addAtStart);
statement.append(asSQLStatement(pc, cld));
statement.append(addAtEnd);
break;
}
case (Criteria.AND) :
{
statement.insert(0, "( ");
statement.append(") ");
statement.append(" AND ").append(addAtStart);
statement.append(asSQLStatement(pc, cld));
statement.append(addAtEnd);
break;
}
}
}
else
{
SelectionCriteria c = (SelectionCriteria) o;
if (statement.length() == 0)
{
statement.append(asSQLClause(c, cld));
}
else
{
statement.insert(0, "(");
statement.append(") ");
statement.append(" AND ");
statement.append(asSQLClause(c, cld));
}
}
} // while
if (statement.length() == 0)
{
return null;
}
return statement.toString();
} } | public class class_name {
public String asSQLStatement(Criteria crit, ClassDescriptor cld)
{
Enumeration e = crit.getElements();
StringBuffer statement = new StringBuffer();
while (e.hasMoreElements())
{
Object o = e.nextElement();
if (o instanceof Criteria)
{
String addAtStart;
String addAtEnd;
Criteria pc = (Criteria) o;
// need to add parenthesises?
if (pc.isEmbraced())
{
addAtStart = " (";
addAtEnd = ") ";
}
else
{
addAtStart = "";
addAtEnd = "";
// depends on control dependency: [if], data = [none]
}
switch (pc.getType())
{
case (Criteria.OR) :
{
statement.append(" OR ").append(addAtStart);
statement.append(asSQLStatement(pc, cld));
statement.append(addAtEnd);
break;
}
case (Criteria.AND) :
{
statement.insert(0, "( ");
statement.append(") ");
statement.append(" AND ").append(addAtStart);
statement.append(asSQLStatement(pc, cld));
statement.append(addAtEnd);
break;
}
}
}
else
{
SelectionCriteria c = (SelectionCriteria) o;
if (statement.length() == 0)
{
statement.append(asSQLClause(c, cld));
// depends on control dependency: [if], data = [none]
}
else
{
statement.insert(0, "(");
statement.append(") ");
statement.append(" AND ");
statement.append(asSQLClause(c, cld));
// depends on control dependency: [if], data = [none]
}
}
} // while
if (statement.length() == 0)
{
return null;
}
return statement.toString();
} } |
public class class_name {
public void setNatGatewayAddresses(java.util.Collection<NatGatewayAddress> natGatewayAddresses) {
if (natGatewayAddresses == null) {
this.natGatewayAddresses = null;
return;
}
this.natGatewayAddresses = new com.amazonaws.internal.SdkInternalList<NatGatewayAddress>(natGatewayAddresses);
} } | public class class_name {
public void setNatGatewayAddresses(java.util.Collection<NatGatewayAddress> natGatewayAddresses) {
if (natGatewayAddresses == null) {
this.natGatewayAddresses = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.natGatewayAddresses = new com.amazonaws.internal.SdkInternalList<NatGatewayAddress>(natGatewayAddresses);
} } |
public class class_name {
public java.awt.Image createAwtImage(Color foreground, Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
Canvas canvas = new Canvas();
paintCode();
int h = (int)yHeight;
int pix[] = new int[bitColumns * codeRows * h];
int stride = (bitColumns + 7) / 8;
int ptr = 0;
for (int k = 0; k < codeRows; ++k) {
int p = k * stride;
for (int j = 0; j < bitColumns; ++j) {
int b = outBits[p + (j / 8)] & 0xff;
b <<= j % 8;
pix[ptr++] = (b & 0x80) == 0 ? g : f;
}
for (int j = 1; j < h; ++j) {
System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns);
}
ptr += bitColumns * (h - 1);
}
java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns));
return img;
} } | public class class_name {
public java.awt.Image createAwtImage(Color foreground, Color background) {
int f = foreground.getRGB();
int g = background.getRGB();
Canvas canvas = new Canvas();
paintCode();
int h = (int)yHeight;
int pix[] = new int[bitColumns * codeRows * h];
int stride = (bitColumns + 7) / 8;
int ptr = 0;
for (int k = 0; k < codeRows; ++k) {
int p = k * stride;
for (int j = 0; j < bitColumns; ++j) {
int b = outBits[p + (j / 8)] & 0xff;
b <<= j % 8; // depends on control dependency: [for], data = [j]
pix[ptr++] = (b & 0x80) == 0 ? g : f; // depends on control dependency: [for], data = [none]
}
for (int j = 1; j < h; ++j) {
System.arraycopy(pix, ptr - bitColumns, pix, ptr + bitColumns * (j - 1), bitColumns); // depends on control dependency: [for], data = [j]
}
ptr += bitColumns * (h - 1); // depends on control dependency: [for], data = [none]
}
java.awt.Image img = canvas.createImage(new MemoryImageSource(bitColumns, codeRows * h, pix, 0, bitColumns));
return img;
} } |
public class class_name {
@RequestMapping(value = "root", method = RequestMethod.GET)
public Resources<UIEvent> getEvents(
@RequestParam(required = false, defaultValue = "0") int offset,
@RequestParam(required = false, defaultValue = "20") int count) {
// Gets the events
Resources<UIEvent> resources = Resources.of(
eventQueryService.getEvents(offset, count).stream()
.map(this::toUIEvent)
.collect(Collectors.toList()),
uri(on(getClass()).getEvents(offset, count))).forView(UIEvent.class);
// Pagination information
Pagination pagination = Pagination.of(offset, count, -1);
// Previous page
if (offset > 0) {
pagination = pagination.withPrev(
uri(on(EventController.class).getEvents(
Math.max(0, offset - count),
count
))
);
}
// Next page
pagination = pagination.withNext(
uri(on(EventController.class).getEvents(
offset + count,
count
))
);
return resources.withPagination(pagination);
} } | public class class_name {
@RequestMapping(value = "root", method = RequestMethod.GET)
public Resources<UIEvent> getEvents(
@RequestParam(required = false, defaultValue = "0") int offset,
@RequestParam(required = false, defaultValue = "20") int count) {
// Gets the events
Resources<UIEvent> resources = Resources.of(
eventQueryService.getEvents(offset, count).stream()
.map(this::toUIEvent)
.collect(Collectors.toList()),
uri(on(getClass()).getEvents(offset, count))).forView(UIEvent.class);
// Pagination information
Pagination pagination = Pagination.of(offset, count, -1);
// Previous page
if (offset > 0) {
pagination = pagination.withPrev(
uri(on(EventController.class).getEvents(
Math.max(0, offset - count),
count
))
); // depends on control dependency: [if], data = [none]
}
// Next page
pagination = pagination.withNext(
uri(on(EventController.class).getEvents(
offset + count,
count
))
);
return resources.withPagination(pagination);
} } |
public class class_name {
public static void removeLocalVariableTypeTables(MethodGen mg) {
for (Attribute a : mg.getCodeAttributes()) {
if (isLocalVariableTypeTable(a, mg.getConstantPool())) {
mg.removeCodeAttribute(a);
}
}
} } | public class class_name {
public static void removeLocalVariableTypeTables(MethodGen mg) {
for (Attribute a : mg.getCodeAttributes()) {
if (isLocalVariableTypeTable(a, mg.getConstantPool())) {
mg.removeCodeAttribute(a); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public CircuitBreakerBuilder listener(CircuitBreakerListener listener) {
requireNonNull(listener, "listener");
if (listeners.isEmpty()) {
listeners = new ArrayList<>(3);
}
listeners.add(listener);
return this;
} } | public class class_name {
public CircuitBreakerBuilder listener(CircuitBreakerListener listener) {
requireNonNull(listener, "listener");
if (listeners.isEmpty()) {
listeners = new ArrayList<>(3); // depends on control dependency: [if], data = [none]
}
listeners.add(listener);
return this;
} } |
public class class_name {
public String[] split(String text, String splitValue,
String[] HTMLBalanceTags) {
String restOfText = text;
int nextBreakIndex = 0;
List<String> list = new ArrayList<String>();
int splitValueLength = splitValue.length();
while (restOfText.length() > 0) {
nextBreakIndex = restOfText.indexOf(splitValue);
if (nextBreakIndex < 0) {
list.add(restOfText);
break;
}
list.add(restOfText.substring(0, nextBreakIndex+splitValueLength));
restOfText = restOfText.substring(nextBreakIndex+splitValueLength);
}
// This code makes sure that no ending HTML </> tags are left out
// causing malfomed pages.
if (HTMLBalanceTags.length > 0) {
List<String> balancedList = new ArrayList<String>();
for (int t = 0; t < HTMLBalanceTags.length; t++) {
// first tag pass through
if (t < 1) {
balancedList = getBalancedList(HTMLBalanceTags[t], list);
}
else if (balancedList.size() > 1) {
// after the first pass through keep trying on each
// subsequent tag.
balancedList =
getBalancedList(HTMLBalanceTags[t], balancedList);
}
}
return balancedList.toArray(new String[balancedList.size()]);
}
else {
return list.toArray(new String[list.size()]);
}
} } | public class class_name {
public String[] split(String text, String splitValue,
String[] HTMLBalanceTags) {
String restOfText = text;
int nextBreakIndex = 0;
List<String> list = new ArrayList<String>();
int splitValueLength = splitValue.length();
while (restOfText.length() > 0) {
nextBreakIndex = restOfText.indexOf(splitValue); // depends on control dependency: [while], data = [none]
if (nextBreakIndex < 0) {
list.add(restOfText); // depends on control dependency: [if], data = [none]
break;
}
list.add(restOfText.substring(0, nextBreakIndex+splitValueLength)); // depends on control dependency: [while], data = [none]
restOfText = restOfText.substring(nextBreakIndex+splitValueLength); // depends on control dependency: [while], data = [none]
}
// This code makes sure that no ending HTML </> tags are left out
// causing malfomed pages.
if (HTMLBalanceTags.length > 0) {
List<String> balancedList = new ArrayList<String>();
for (int t = 0; t < HTMLBalanceTags.length; t++) {
// first tag pass through
if (t < 1) {
balancedList = getBalancedList(HTMLBalanceTags[t], list); // depends on control dependency: [if], data = [none]
}
else if (balancedList.size() > 1) {
// after the first pass through keep trying on each
// subsequent tag.
balancedList =
getBalancedList(HTMLBalanceTags[t], balancedList); // depends on control dependency: [if], data = [none]
}
}
return balancedList.toArray(new String[balancedList.size()]); // depends on control dependency: [if], data = [none]
}
else {
return list.toArray(new String[list.size()]); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void init() throws ChannelException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "init");
}
// Prevent duplicate initialization.
if (this.isInitialized) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "init");
}
return;
}
// Extract the channel properties.
try {
Properties channelProps = getConfig().getProperties();
// Handle a potentially null property map.
if (channelProps != null) {
this.alias = channelProps.getProperty(SSLChannelData.ALIAS_KEY);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (this.alias != null) {
Tr.debug(tc, "Found alias in SSL properties, " + this.alias);
} else {
Tr.debug(tc, "No alias found in SSL properties");
}
}
//PI52696 - Timeout value for which the SSL closing handshake loop will attempt to complete final handshake
//write before giving up.
String timeoutValueInSSLClosingHandshake = channelProps.getProperty(SSLChannelConstants.TIMEOUT_VALUE_IN_SSL_CLOSING_HANDSHAKE);
if (timeoutValueInSSLClosingHandshake != null) {
this.timeoutValueInSSLClosingHandshake = Integer.parseInt(timeoutValueInSSLClosingHandshake);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found timeoutValueInSSLClosingHandshake in SSL properties, " + this.timeoutValueInSSLClosingHandshake);
}
}
//Check for system property so all SSL Channels can have the property enabled
//APAR PI70332 - Add Java custom property to allow this property to be set on all inbound/outbound channels
//without need of SSL configuration.
String timeoutValueSystemProperty = AccessController.doPrivileged(new java.security.PrivilegedAction<String>() {
@Override
public String run() {
return (System.getProperty(SSLChannelConstants.TIMEOUT_VALUE_IN_SSL_CLOSING_HANDSHAKE));
}
});
if (timeoutValueSystemProperty != null) {
this.timeoutValueInSSLClosingHandshake = Integer.parseInt(timeoutValueSystemProperty);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found timeoutValueInSSLClosingHandshake in SSL system properties, " + this.timeoutValueInSSLClosingHandshake);
}
}
String protocolVersion = channelProps.getProperty(SSLChannelConstants.PROPNAME_PROTOCOL_VERSION);
if (protocolVersion != null) {
if (SSLChannelConstants.PROTOCOL_VERSION_11.equalsIgnoreCase(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.FALSE;
} else if (SSLChannelConstants.PROTOCOL_VERSION_2.equalsIgnoreCase(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.TRUE;
}
if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled()) && useH2ProtocolAttribute != null) {
Tr.event(tc, "SSL Channel Config: versionProtocolOption has been set to " + protocolVersion.toLowerCase(Locale.ENGLISH));
}
}
}
} catch (Exception e) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "init received exception handling properties; " + e);
}
throw new ChannelException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "jsseProvider=" + this.jsseProvider);
}
// Indicate that initialization is complete.
this.isInitialized = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "init");
}
} } | public class class_name {
@Override
public void init() throws ChannelException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(tc, "init");
}
// Prevent duplicate initialization.
if (this.isInitialized) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "init"); // depends on control dependency: [if], data = [none]
}
return;
}
// Extract the channel properties.
try {
Properties channelProps = getConfig().getProperties();
// Handle a potentially null property map.
if (channelProps != null) {
this.alias = channelProps.getProperty(SSLChannelData.ALIAS_KEY); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
if (this.alias != null) {
Tr.debug(tc, "Found alias in SSL properties, " + this.alias); // depends on control dependency: [if], data = [none]
} else {
Tr.debug(tc, "No alias found in SSL properties"); // depends on control dependency: [if], data = [none]
}
}
//PI52696 - Timeout value for which the SSL closing handshake loop will attempt to complete final handshake
//write before giving up.
String timeoutValueInSSLClosingHandshake = channelProps.getProperty(SSLChannelConstants.TIMEOUT_VALUE_IN_SSL_CLOSING_HANDSHAKE);
if (timeoutValueInSSLClosingHandshake != null) {
this.timeoutValueInSSLClosingHandshake = Integer.parseInt(timeoutValueInSSLClosingHandshake); // depends on control dependency: [if], data = [(timeoutValueInSSLClosingHandshake]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found timeoutValueInSSLClosingHandshake in SSL properties, " + this.timeoutValueInSSLClosingHandshake); // depends on control dependency: [if], data = [none]
}
}
//Check for system property so all SSL Channels can have the property enabled
//APAR PI70332 - Add Java custom property to allow this property to be set on all inbound/outbound channels
//without need of SSL configuration.
String timeoutValueSystemProperty = AccessController.doPrivileged(new java.security.PrivilegedAction<String>() {
@Override
public String run() {
return (System.getProperty(SSLChannelConstants.TIMEOUT_VALUE_IN_SSL_CLOSING_HANDSHAKE));
}
});
if (timeoutValueSystemProperty != null) {
this.timeoutValueInSSLClosingHandshake = Integer.parseInt(timeoutValueSystemProperty); // depends on control dependency: [if], data = [(timeoutValueSystemProperty]
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Found timeoutValueInSSLClosingHandshake in SSL system properties, " + this.timeoutValueInSSLClosingHandshake); // depends on control dependency: [if], data = [none]
}
}
String protocolVersion = channelProps.getProperty(SSLChannelConstants.PROPNAME_PROTOCOL_VERSION);
if (protocolVersion != null) {
if (SSLChannelConstants.PROTOCOL_VERSION_11.equalsIgnoreCase(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.FALSE; // depends on control dependency: [if], data = [none]
} else if (SSLChannelConstants.PROTOCOL_VERSION_2.equalsIgnoreCase(protocolVersion)) {
this.useH2ProtocolAttribute = Boolean.TRUE; // depends on control dependency: [if], data = [none]
}
if ((TraceComponent.isAnyTracingEnabled()) && (tc.isEventEnabled()) && useH2ProtocolAttribute != null) {
Tr.event(tc, "SSL Channel Config: versionProtocolOption has been set to " + protocolVersion.toLowerCase(Locale.ENGLISH)); // depends on control dependency: [if], data = [none]
}
}
}
} catch (Exception e) {
// no FFDC required
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "init received exception handling properties; " + e); // depends on control dependency: [if], data = [none]
}
throw new ChannelException(e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "jsseProvider=" + this.jsseProvider);
}
// Indicate that initialization is complete.
this.isInitialized = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(tc, "init");
}
} } |
public class class_name {
public static Matrix random(int M, int N) {
Matrix A = new Matrix(M, N);
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
A.data[i][j] = Math.random();
}
}
return A;
} } | public class class_name {
public static Matrix random(int M, int N) {
Matrix A = new Matrix(M, N);
for (int i = 0; i < M; i++) {
for (int j = 0; j < N; j++) {
A.data[i][j] = Math.random(); // depends on control dependency: [for], data = [j]
}
}
return A;
} } |
public class class_name {
public double[][] solve(double[][] B) {
if (B.length != n) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!isspd) {
throw new RuntimeException("Matrix is not symmetric positive definite.");
}
// Copy right hand side.
double[][] X = Matrix.Copy(B);
int nx = B[0].length;
// Solve L*Y = B;
for (int k = 0; k < n; k++) {
for (int j = 0; j < nx; j++) {
for (int i = 0; i < k; i++) {
X[k][j] -= X[i][j] * L[k][i];
}
X[k][j] /= L[k][k];
}
}
// Solve L'*X = Y;
for (int k = n - 1; k >= 0; k--) {
for (int j = 0; j < nx; j++) {
for (int i = k + 1; i < n; i++) {
X[k][j] -= X[i][j] * L[i][k];
}
X[k][j] /= L[k][k];
}
}
return Matrix.SubMatrix(X, n, nx);
} } | public class class_name {
public double[][] solve(double[][] B) {
if (B.length != n) {
throw new IllegalArgumentException("Matrix row dimensions must agree.");
}
if (!isspd) {
throw new RuntimeException("Matrix is not symmetric positive definite.");
}
// Copy right hand side.
double[][] X = Matrix.Copy(B);
int nx = B[0].length;
// Solve L*Y = B;
for (int k = 0; k < n; k++) {
for (int j = 0; j < nx; j++) {
for (int i = 0; i < k; i++) {
X[k][j] -= X[i][j] * L[k][i]; // depends on control dependency: [for], data = [i]
}
X[k][j] /= L[k][k]; // depends on control dependency: [for], data = [j]
}
}
// Solve L'*X = Y;
for (int k = n - 1; k >= 0; k--) {
for (int j = 0; j < nx; j++) {
for (int i = k + 1; i < n; i++) {
X[k][j] -= X[i][j] * L[i][k]; // depends on control dependency: [for], data = [i]
}
X[k][j] /= L[k][k]; // depends on control dependency: [for], data = [j]
}
}
return Matrix.SubMatrix(X, n, nx);
} } |
public class class_name {
public static void pickupFromRequest(RpcInvokeContext context, SofaRequest request, boolean init) {
if (context == null && !init) {
return;
}
// 解析请求
Map<String, String> requestBaggage = (Map<String, String>) request
.getRequestProp(RemotingConstants.RPC_REQUEST_BAGGAGE);
if (CommonUtils.isNotEmpty(requestBaggage)) {
if (context == null) {
context = RpcInvokeContext.getContext();
}
context.putAllRequestBaggage(requestBaggage);
}
} } | public class class_name {
public static void pickupFromRequest(RpcInvokeContext context, SofaRequest request, boolean init) {
if (context == null && !init) {
return; // depends on control dependency: [if], data = [none]
}
// 解析请求
Map<String, String> requestBaggage = (Map<String, String>) request
.getRequestProp(RemotingConstants.RPC_REQUEST_BAGGAGE);
if (CommonUtils.isNotEmpty(requestBaggage)) {
if (context == null) {
context = RpcInvokeContext.getContext(); // depends on control dependency: [if], data = [none]
}
context.putAllRequestBaggage(requestBaggage); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsException {
// extract the content from the resource
I_CmsExtractionResult content = null;
if (index.isExtractingContent()) {
// do full text content extraction only if required
// check if caching is enabled for this document type
CmsExtractionResultCache cache = getCache();
String cacheName = null;
if ((cache != null) && (resource.getSiblingCount() > 1)) {
// hard drive based caching only makes sense for resources that have siblings,
// because the index will also store the content as a blob
cacheName = cache.getCacheName(
resource,
isLocaleDependend() ? index.getLocaleForResource(cms, resource, null) : null,
getName());
content = cache.getCacheObject(cacheName);
}
if (content == null) {
// extraction result has not been found in the cache
// use the currently indexed content, if it is still up to date.
content = index.getContentIfUnchanged(resource);
}
if (content == null) {
// extraction result has not been attached to the resource
try {
content = extractContent(cms, resource, index);
if (LOG.isDebugEnabled()) {
LOG.debug("Extracting content for '" + resource.getRootPath() + "' successful.");
}
if ((cache != null) && (resource.getSiblingCount() > 1)) {
// save extracted content to the cache
cache.saveCacheObject(cacheName, content);
}
} catch (CmsIndexNoContentException e) {
// there was no content found for the resource
LOG.info(
Messages.get().getBundle().key(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath())
+ " "
+ e.getMessage());
} catch (Throwable e) {
// text extraction failed for document - continue indexing meta information only
LOG.error(
Messages.get().getBundle().key(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
}
}
}
// create the Lucene document according to the index field configuration
return index.getFieldConfiguration().createDocument(cms, resource, index, content);
} } | public class class_name {
public I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, I_CmsSearchIndex index)
throws CmsException {
// extract the content from the resource
I_CmsExtractionResult content = null;
if (index.isExtractingContent()) {
// do full text content extraction only if required
// check if caching is enabled for this document type
CmsExtractionResultCache cache = getCache();
String cacheName = null;
if ((cache != null) && (resource.getSiblingCount() > 1)) {
// hard drive based caching only makes sense for resources that have siblings,
// because the index will also store the content as a blob
cacheName = cache.getCacheName(
resource,
isLocaleDependend() ? index.getLocaleForResource(cms, resource, null) : null,
getName());
content = cache.getCacheObject(cacheName);
}
if (content == null) {
// extraction result has not been found in the cache
// use the currently indexed content, if it is still up to date.
content = index.getContentIfUnchanged(resource);
}
if (content == null) {
// extraction result has not been attached to the resource
try {
content = extractContent(cms, resource, index); // depends on control dependency: [try], data = [none]
if (LOG.isDebugEnabled()) {
LOG.debug("Extracting content for '" + resource.getRootPath() + "' successful."); // depends on control dependency: [if], data = [none]
}
if ((cache != null) && (resource.getSiblingCount() > 1)) {
// save extracted content to the cache
cache.saveCacheObject(cacheName, content); // depends on control dependency: [if], data = [none]
}
} catch (CmsIndexNoContentException e) {
// there was no content found for the resource
LOG.info(
Messages.get().getBundle().key(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath())
+ " "
+ e.getMessage());
} catch (Throwable e) { // depends on control dependency: [catch], data = [none]
// text extraction failed for document - continue indexing meta information only
LOG.error(
Messages.get().getBundle().key(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()),
e);
} // depends on control dependency: [catch], data = [none]
}
}
// create the Lucene document according to the index field configuration
return index.getFieldConfiguration().createDocument(cms, resource, index, content);
} } |
public class class_name {
@Override
protected Operand createLessThanExpression(final LessThanFilter filter, final boolean not) {
if (filter == null) {
return null;
}
final String name = filter.getAttribute().getName();
final String value = AttributeUtil.getAsStringValue(filter.getAttribute());
if (StringUtil.isBlank(value)) {
return null;
}
return new Operand(Operator.LT, name, value, not);
} } | public class class_name {
@Override
protected Operand createLessThanExpression(final LessThanFilter filter, final boolean not) {
if (filter == null) {
return null; // depends on control dependency: [if], data = [none]
}
final String name = filter.getAttribute().getName();
final String value = AttributeUtil.getAsStringValue(filter.getAttribute());
if (StringUtil.isBlank(value)) {
return null; // depends on control dependency: [if], data = [none]
}
return new Operand(Operator.LT, name, value, not);
} } |
public class class_name {
public void marshall(Ec2InstanceAttributes ec2InstanceAttributes, ProtocolMarshaller protocolMarshaller) {
if (ec2InstanceAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(ec2InstanceAttributes.getEc2KeyName(), EC2KEYNAME_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getEc2SubnetId(), EC2SUBNETID_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getRequestedEc2SubnetIds(), REQUESTEDEC2SUBNETIDS_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getEc2AvailabilityZone(), EC2AVAILABILITYZONE_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getRequestedEc2AvailabilityZones(), REQUESTEDEC2AVAILABILITYZONES_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getIamInstanceProfile(), IAMINSTANCEPROFILE_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getEmrManagedMasterSecurityGroup(), EMRMANAGEDMASTERSECURITYGROUP_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getEmrManagedSlaveSecurityGroup(), EMRMANAGEDSLAVESECURITYGROUP_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getServiceAccessSecurityGroup(), SERVICEACCESSSECURITYGROUP_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getAdditionalMasterSecurityGroups(), ADDITIONALMASTERSECURITYGROUPS_BINDING);
protocolMarshaller.marshall(ec2InstanceAttributes.getAdditionalSlaveSecurityGroups(), ADDITIONALSLAVESECURITYGROUPS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(Ec2InstanceAttributes ec2InstanceAttributes, ProtocolMarshaller protocolMarshaller) {
if (ec2InstanceAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(ec2InstanceAttributes.getEc2KeyName(), EC2KEYNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getEc2SubnetId(), EC2SUBNETID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getRequestedEc2SubnetIds(), REQUESTEDEC2SUBNETIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getEc2AvailabilityZone(), EC2AVAILABILITYZONE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getRequestedEc2AvailabilityZones(), REQUESTEDEC2AVAILABILITYZONES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getIamInstanceProfile(), IAMINSTANCEPROFILE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getEmrManagedMasterSecurityGroup(), EMRMANAGEDMASTERSECURITYGROUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getEmrManagedSlaveSecurityGroup(), EMRMANAGEDSLAVESECURITYGROUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getServiceAccessSecurityGroup(), SERVICEACCESSSECURITYGROUP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getAdditionalMasterSecurityGroups(), ADDITIONALMASTERSECURITYGROUPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(ec2InstanceAttributes.getAdditionalSlaveSecurityGroups(), ADDITIONALSLAVESECURITYGROUPS_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 {
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
// ICU 4.8 custom serialization.
// locale as a BCP 47 language tag
out.writeObject(ulocale.toLanguageTag());
// ApostropheMode
if (msgPattern == null) {
msgPattern = new MessagePattern();
}
out.writeObject(msgPattern.getApostropheMode());
// message pattern string
out.writeObject(msgPattern.getPatternString());
// custom formatters
if (customFormatArgStarts == null || customFormatArgStarts.isEmpty()) {
out.writeInt(0);
} else {
out.writeInt(customFormatArgStarts.size());
int formatIndex = 0;
for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
if (customFormatArgStarts.contains(partIndex)) {
out.writeInt(formatIndex);
out.writeObject(cachedFormatters.get(partIndex));
}
++formatIndex;
}
}
// number of future (int, Object) pairs
out.writeInt(0);
} } | public class class_name {
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
out.defaultWriteObject();
// ICU 4.8 custom serialization.
// locale as a BCP 47 language tag
out.writeObject(ulocale.toLanguageTag());
// ApostropheMode
if (msgPattern == null) {
msgPattern = new MessagePattern();
}
out.writeObject(msgPattern.getApostropheMode());
// message pattern string
out.writeObject(msgPattern.getPatternString());
// custom formatters
if (customFormatArgStarts == null || customFormatArgStarts.isEmpty()) {
out.writeInt(0);
} else {
out.writeInt(customFormatArgStarts.size());
int formatIndex = 0;
for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) {
if (customFormatArgStarts.contains(partIndex)) {
out.writeInt(formatIndex); // depends on control dependency: [if], data = [none]
out.writeObject(cachedFormatters.get(partIndex)); // depends on control dependency: [if], data = [none]
}
++formatIndex; // depends on control dependency: [for], data = [none]
}
}
// number of future (int, Object) pairs
out.writeInt(0);
} } |
public class class_name {
private static boolean parseArguments(String args[],
Configuration conf) {
int argsLen = (args == null) ? 0 : args.length;
StartupOption startOpt = StartupOption.REGULAR;
for(int i=0; i < argsLen; i++) {
String cmd = args[i];
if ("-r".equalsIgnoreCase(cmd) || "--rack".equalsIgnoreCase(cmd)) {
LOG.error("-r, --rack arguments are not supported anymore. RackID " +
"resolution is handled by the NameNode.");
System.exit(-1);
} else if ("-rollback".equalsIgnoreCase(cmd)) {
startOpt = StartupOption.ROLLBACK;
} else if ("-regular".equalsIgnoreCase(cmd)) {
startOpt = StartupOption.REGULAR;
} else if ("-d".equalsIgnoreCase(cmd)) {
++i;
if(i >= argsLen) {
LOG.error("-D option requires following argument.");
System.exit(-1);
}
String[] keyval = args[i].split("=", 2);
if (keyval.length == 2) {
conf.set(keyval[0], keyval[1]);
} else {
LOG.error("-D option invalid (expected =): " + args[i]);
System.exit(-1);
}
} else
return false;
}
setStartupOption(conf, startOpt);
return true;
} } | public class class_name {
private static boolean parseArguments(String args[],
Configuration conf) {
int argsLen = (args == null) ? 0 : args.length;
StartupOption startOpt = StartupOption.REGULAR;
for(int i=0; i < argsLen; i++) {
String cmd = args[i];
if ("-r".equalsIgnoreCase(cmd) || "--rack".equalsIgnoreCase(cmd)) {
LOG.error("-r, --rack arguments are not supported anymore. RackID " +
"resolution is handled by the NameNode."); // depends on control dependency: [if], data = [none]
System.exit(-1); // depends on control dependency: [if], data = [none]
} else if ("-rollback".equalsIgnoreCase(cmd)) {
startOpt = StartupOption.ROLLBACK; // depends on control dependency: [if], data = [none]
} else if ("-regular".equalsIgnoreCase(cmd)) {
startOpt = StartupOption.REGULAR; // depends on control dependency: [if], data = [none]
} else if ("-d".equalsIgnoreCase(cmd)) {
++i; // depends on control dependency: [if], data = [none]
if(i >= argsLen) {
LOG.error("-D option requires following argument."); // depends on control dependency: [if], data = [none]
System.exit(-1); // depends on control dependency: [if], data = [none]
}
String[] keyval = args[i].split("=", 2);
if (keyval.length == 2) {
conf.set(keyval[0], keyval[1]); // depends on control dependency: [if], data = [none]
} else {
LOG.error("-D option invalid (expected =): " + args[i]);
System.exit(-1); // depends on control dependency: [if], data = [none]
}
} else
return false;
}
setStartupOption(conf, startOpt);
return true;
} } |
public class class_name {
public void setEnhancedMonitoring(java.util.Collection<EnhancedMetrics> enhancedMonitoring) {
if (enhancedMonitoring == null) {
this.enhancedMonitoring = null;
return;
}
this.enhancedMonitoring = new com.amazonaws.internal.SdkInternalList<EnhancedMetrics>(enhancedMonitoring);
} } | public class class_name {
public void setEnhancedMonitoring(java.util.Collection<EnhancedMetrics> enhancedMonitoring) {
if (enhancedMonitoring == null) {
this.enhancedMonitoring = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.enhancedMonitoring = new com.amazonaws.internal.SdkInternalList<EnhancedMetrics>(enhancedMonitoring);
} } |
public class class_name {
public static List<FileStatus> listStatusHelper(FileSystem fs, Path path,
int depth, List<FileStatus> acc) throws IOException {
FileStatus[] fileStatusResults = fs.listStatus(path);
if (fileStatusResults == null) {
throw new IOException("Path does not exist: " + path);
}
for (FileStatus f : fileStatusResults) {
Path subPath = f.getPath();
if (!f.isDir()) {
acc.add(f); // Accumulate all files
} else {
if (depth > 1) {
listStatusHelper(fs, subPath, depth - 1, acc);
} else {
acc.add(f); // Accumulate all leaves
}
}
}
return acc;
} } | public class class_name {
public static List<FileStatus> listStatusHelper(FileSystem fs, Path path,
int depth, List<FileStatus> acc) throws IOException {
FileStatus[] fileStatusResults = fs.listStatus(path);
if (fileStatusResults == null) {
throw new IOException("Path does not exist: " + path);
}
for (FileStatus f : fileStatusResults) {
Path subPath = f.getPath();
if (!f.isDir()) {
acc.add(f); // Accumulate all files // depends on control dependency: [if], data = [none]
} else {
if (depth > 1) {
listStatusHelper(fs, subPath, depth - 1, acc); // depends on control dependency: [if], data = [none]
} else {
acc.add(f); // Accumulate all leaves // depends on control dependency: [if], data = [none]
}
}
}
return acc;
} } |
public class class_name {
public static String hexSHA1(String value) {
try {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1");
md.update(value.getBytes("utf-8"));
byte[] digest = md.digest();
return byteToHexString(digest);
} catch (Exception ex) {
throw new UnexpectedException(ex);
}
} } | public class class_name {
public static String hexSHA1(String value) {
try {
MessageDigest md;
md = MessageDigest.getInstance("SHA-1"); // depends on control dependency: [try], data = [none]
md.update(value.getBytes("utf-8")); // depends on control dependency: [try], data = [none]
byte[] digest = md.digest();
return byteToHexString(digest); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new UnexpectedException(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public String getOverrideBundleDescriptor(String groupId, String artifactId) throws PluginExecutionException {
File overrideJar = downloadOverrideJar(groupId, artifactId);
if (overrideJar != null && overrideJar.exists()) {
String symbolicName = extractSymbolicName(overrideJar);
if (symbolicName != null) {
return overrideJar.getAbsolutePath() + ";" + symbolicName;
}
}
return null;
} } | public class class_name {
public String getOverrideBundleDescriptor(String groupId, String artifactId) throws PluginExecutionException {
File overrideJar = downloadOverrideJar(groupId, artifactId);
if (overrideJar != null && overrideJar.exists()) {
String symbolicName = extractSymbolicName(overrideJar);
if (symbolicName != null) {
return overrideJar.getAbsolutePath() + ";" + symbolicName; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
private EventConsumer isChannelAlreadyConnected(DeviceProxy deviceProxy) {
try {
String adminName = deviceProxy.adm_name();
EventChannelStruct eventChannelStruct = EventConsumer.getChannelMap().get(adminName);
if (eventChannelStruct==null) {
return null;
}
else {
return eventChannelStruct.consumer;
}
}
catch (DevFailed e) {
return null;
}
} } | public class class_name {
private EventConsumer isChannelAlreadyConnected(DeviceProxy deviceProxy) {
try {
String adminName = deviceProxy.adm_name();
EventChannelStruct eventChannelStruct = EventConsumer.getChannelMap().get(adminName);
if (eventChannelStruct==null) {
return null; // depends on control dependency: [if], data = [none]
}
else {
return eventChannelStruct.consumer; // depends on control dependency: [if], data = [none]
}
}
catch (DevFailed e) {
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Enumeration<String> getInitParameterNames() {
ServletConfig sc = getServletConfig();
if (sc == null) {
throw new IllegalStateException(
lStrings.getString("err.servlet_config_not_initialized"));
}
return sc.getInitParameterNames();
} } | public class class_name {
public Enumeration<String> getInitParameterNames() {
ServletConfig sc = getServletConfig();
if (sc == null) {
throw new IllegalStateException(
lStrings.getString("err.servlet_config_not_initialized"));
}
return sc.getInitParameterNames(); // depends on control dependency: [if], data = [none]
} } |
public class class_name {
@SuppressWarnings("unchecked")
private final void addBacktrackLocation(int usedAlternative) {
backtrackStack.push(new BacktrackLocation((Stack<Integer>) stateStack.clone(), actionStack.size(),
streamPosition, stepCounter, usedAlternative));
if (backtrackDepth > 0) {
while (backtrackStack.size() > backtrackDepth) {
backtrackStack.remove(0);
}
}
} } | public class class_name {
@SuppressWarnings("unchecked")
private final void addBacktrackLocation(int usedAlternative) {
backtrackStack.push(new BacktrackLocation((Stack<Integer>) stateStack.clone(), actionStack.size(),
streamPosition, stepCounter, usedAlternative));
if (backtrackDepth > 0) {
while (backtrackStack.size() > backtrackDepth) {
backtrackStack.remove(0); // depends on control dependency: [while], data = [none]
}
}
} } |
public class class_name {
public ServiceCall<SessionResponse> createSession(CreateSessionOptions createSessionOptions) {
Validator.notNull(createSessionOptions, "createSessionOptions cannot be null");
String[] pathSegments = { "v2/assistants", "sessions" };
String[] pathParameters = { createSessionOptions.assistantId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "createSession");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(SessionResponse.class));
} } | public class class_name {
public ServiceCall<SessionResponse> createSession(CreateSessionOptions createSessionOptions) {
Validator.notNull(createSessionOptions, "createSessionOptions cannot be null");
String[] pathSegments = { "v2/assistants", "sessions" };
String[] pathParameters = { createSessionOptions.assistantId() };
RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
builder.query("version", versionDate);
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "createSession");
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");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(SessionResponse.class));
} } |
public class class_name {
private void loadMimeType(URL url) {
try {
Stopwatch watch = new Stopwatch(true);
InputStream im = url.openStream();
contentTypes.load(im);
logger.info("Load {} content types in {}", contentTypes.size(), watch);
im.close();
} catch (IOException e) {
logger.error("load " + url + " error", e);
}
} } | public class class_name {
private void loadMimeType(URL url) {
try {
Stopwatch watch = new Stopwatch(true);
InputStream im = url.openStream();
contentTypes.load(im); // depends on control dependency: [try], data = [none]
logger.info("Load {} content types in {}", contentTypes.size(), watch); // depends on control dependency: [try], data = [none]
im.close(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
logger.error("load " + url + " error", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setTags(java.util.Collection<TagListEntry> tags) {
if (tags == null) {
this.tags = null;
return;
}
this.tags = new java.util.ArrayList<TagListEntry>(tags);
} } | public class class_name {
public void setTags(java.util.Collection<TagListEntry> tags) {
if (tags == null) {
this.tags = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.tags = new java.util.ArrayList<TagListEntry>(tags);
} } |
public class class_name {
public static String getFormatedDBProperty(final String _key,
final Object... _args)
{
String language = null;
try {
language = Context.getThreadContext().getLanguage();
} catch (final EFapsException e) {
DBProperties.LOG.error("not able to read the language from the context", e);
}
return DBProperties.getFormatedDBProperty(_key, language, _args);
} } | public class class_name {
public static String getFormatedDBProperty(final String _key,
final Object... _args)
{
String language = null;
try {
language = Context.getThreadContext().getLanguage(); // depends on control dependency: [try], data = [none]
} catch (final EFapsException e) {
DBProperties.LOG.error("not able to read the language from the context", e);
} // depends on control dependency: [catch], data = [none]
return DBProperties.getFormatedDBProperty(_key, language, _args);
} } |
public class class_name {
static void checkValid(Path path, ConfigValueType referenceType, AbstractConfigValue value,
List<ConfigException.ValidationProblem> accumulator) {
if (haveCompatibleTypes(referenceType, value)) {
if (referenceType == ConfigValueType.LIST && value instanceof SimpleConfigObject) {
// attempt conversion of indexed object to list
AbstractConfigValue listValue = DefaultTransformer.transform(value,
ConfigValueType.LIST);
if (!(listValue instanceof SimpleConfigList))
addWrongType(accumulator, referenceType, value, path);
}
} else {
addWrongType(accumulator, referenceType, value, path);
}
} } | public class class_name {
static void checkValid(Path path, ConfigValueType referenceType, AbstractConfigValue value,
List<ConfigException.ValidationProblem> accumulator) {
if (haveCompatibleTypes(referenceType, value)) {
if (referenceType == ConfigValueType.LIST && value instanceof SimpleConfigObject) {
// attempt conversion of indexed object to list
AbstractConfigValue listValue = DefaultTransformer.transform(value,
ConfigValueType.LIST);
if (!(listValue instanceof SimpleConfigList))
addWrongType(accumulator, referenceType, value, path);
}
} else {
addWrongType(accumulator, referenceType, value, path); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private byte[] toCookedBytes()
{
// Allocate for a int pair per token/partition ID entry, plus a size.
ByteBuffer buf = ByteBuffer.allocate(4 + (m_tokenCount * 8));
buf.putInt(m_tokenCount);
// Keep tokens and partition ids separate to aid compression.
for (int zz = 3; zz >= 0; zz--) {
int lastToken = Integer.MIN_VALUE;
for (int ii = 0; ii < m_tokenCount; ii++) {
int token = Bits.unsafe.getInt(m_tokens + (ii * 8));
Preconditions.checkArgument(token >= lastToken);
lastToken = token;
token = token >>> (zz * 8);
token = token & 0xFF;
buf.put((byte)token);
}
}
for (int ii = 0; ii < m_tokenCount; ii++) {
buf.putInt(Bits.unsafe.getInt(m_tokens + (ii * 8) + 4));
}
try {
return CompressionService.gzipBytes(buf.array());
} catch (IOException e) {
throw new RuntimeException("Failed to compress bytes", e);
}
} } | public class class_name {
private byte[] toCookedBytes()
{
// Allocate for a int pair per token/partition ID entry, plus a size.
ByteBuffer buf = ByteBuffer.allocate(4 + (m_tokenCount * 8));
buf.putInt(m_tokenCount);
// Keep tokens and partition ids separate to aid compression.
for (int zz = 3; zz >= 0; zz--) {
int lastToken = Integer.MIN_VALUE;
for (int ii = 0; ii < m_tokenCount; ii++) {
int token = Bits.unsafe.getInt(m_tokens + (ii * 8));
Preconditions.checkArgument(token >= lastToken); // depends on control dependency: [for], data = [none]
lastToken = token; // depends on control dependency: [for], data = [none]
token = token >>> (zz * 8); // depends on control dependency: [for], data = [none]
token = token & 0xFF; // depends on control dependency: [for], data = [none]
buf.put((byte)token); // depends on control dependency: [for], data = [none]
}
}
for (int ii = 0; ii < m_tokenCount; ii++) {
buf.putInt(Bits.unsafe.getInt(m_tokens + (ii * 8) + 4)); // depends on control dependency: [for], data = [ii]
}
try {
return CompressionService.gzipBytes(buf.array()); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException("Failed to compress bytes", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
void addOverlappingElement(Tile from, Tile to, MapElementContainer element) {
if (!overlapData.containsKey(from)) {
overlapData.put(from, new HashMap<Tile, Set<MapElementContainer>>());
}
if (!overlapData.get(from).containsKey(to)) {
overlapData.get(from).put(to, new HashSet<MapElementContainer>());
}
overlapData.get(from).get(to).add(element);
} } | public class class_name {
void addOverlappingElement(Tile from, Tile to, MapElementContainer element) {
if (!overlapData.containsKey(from)) {
overlapData.put(from, new HashMap<Tile, Set<MapElementContainer>>()); // depends on control dependency: [if], data = [none]
}
if (!overlapData.get(from).containsKey(to)) {
overlapData.get(from).put(to, new HashSet<MapElementContainer>()); // depends on control dependency: [if], data = [none]
}
overlapData.get(from).get(to).add(element);
} } |
public class class_name {
public Deferred<IncomingDataPoint> getLastPoint(final boolean resolve_names,
final int back_scan) {
if (back_scan < 0) {
throw new IllegalArgumentException(
"Backscan must be zero or a positive number");
}
this.resolve_names = resolve_names;
this.back_scan = back_scan;
final boolean meta_enabled = tsdb.getConfig().enable_tsuid_tracking() ||
tsdb.getConfig().enable_tsuid_incrementing();
class TSUIDCB implements Callback<Deferred<IncomingDataPoint>, byte[]> {
@Override
public Deferred<IncomingDataPoint> call(final byte[] incoming_tsuid)
throws Exception {
if (tsuid == null && incoming_tsuid == null) {
return Deferred.fromError(new RuntimeException("Both incoming and "
+ "supplied TSUIDs were null for " + TSUIDQuery.this));
} else if (incoming_tsuid != null) {
setTSUID(incoming_tsuid);
}
if (back_scan < 1 && meta_enabled) {
final GetRequest get = new GetRequest(tsdb.metaTable(), tsuid);
get.family(TSMeta.FAMILY());
get.qualifier(TSMeta.COUNTER_QUALIFIER());
return tsdb.getClient().get(get).addCallbackDeferring(new MetaCB());
}
if (last_timestamp > 0) {
last_timestamp = Internal.baseTime(last_timestamp);
} else {
last_timestamp = Internal.baseTime(DateTime.currentTimeMillis());
}
final byte[] key = RowKey.rowKeyFromTSUID(tsdb, tsuid, last_timestamp);
final GetRequest get = new GetRequest(tsdb.dataTable(), key);
get.family(TSDB.FAMILY());
return tsdb.getClient().get(get).addCallbackDeferring(new LastPointCB());
}
@Override
public String toString() {
return "TSUID callback";
}
}
if (tsuid == null) {
return tsuidFromMetric(tsdb, metric, tags)
.addCallbackDeferring(new TSUIDCB());
}
try {
// damn typed exceptions....
return new TSUIDCB().call(null);
} catch (Exception e) {
return Deferred.fromError(e);
}
} } | public class class_name {
public Deferred<IncomingDataPoint> getLastPoint(final boolean resolve_names,
final int back_scan) {
if (back_scan < 0) {
throw new IllegalArgumentException(
"Backscan must be zero or a positive number");
}
this.resolve_names = resolve_names;
this.back_scan = back_scan;
final boolean meta_enabled = tsdb.getConfig().enable_tsuid_tracking() ||
tsdb.getConfig().enable_tsuid_incrementing();
class TSUIDCB implements Callback<Deferred<IncomingDataPoint>, byte[]> {
@Override
public Deferred<IncomingDataPoint> call(final byte[] incoming_tsuid)
throws Exception {
if (tsuid == null && incoming_tsuid == null) {
return Deferred.fromError(new RuntimeException("Both incoming and "
+ "supplied TSUIDs were null for " + TSUIDQuery.this));
} else if (incoming_tsuid != null) {
setTSUID(incoming_tsuid);
}
if (back_scan < 1 && meta_enabled) {
final GetRequest get = new GetRequest(tsdb.metaTable(), tsuid);
get.family(TSMeta.FAMILY()); // depends on control dependency: [if], data = [none]
get.qualifier(TSMeta.COUNTER_QUALIFIER()); // depends on control dependency: [if], data = [none]
return tsdb.getClient().get(get).addCallbackDeferring(new MetaCB()); // depends on control dependency: [if], data = [none]
}
if (last_timestamp > 0) {
last_timestamp = Internal.baseTime(last_timestamp); // depends on control dependency: [if], data = [(last_timestamp]
} else {
last_timestamp = Internal.baseTime(DateTime.currentTimeMillis()); // depends on control dependency: [if], data = [none]
}
final byte[] key = RowKey.rowKeyFromTSUID(tsdb, tsuid, last_timestamp);
final GetRequest get = new GetRequest(tsdb.dataTable(), key);
get.family(TSDB.FAMILY());
return tsdb.getClient().get(get).addCallbackDeferring(new LastPointCB());
}
@Override
public String toString() {
return "TSUID callback";
}
}
if (tsuid == null) {
return tsuidFromMetric(tsdb, metric, tags)
.addCallbackDeferring(new TSUIDCB());
}
try {
// damn typed exceptions....
return new TSUIDCB().call(null);
} catch (Exception e) {
return Deferred.fromError(e);
}
} } |
public class class_name {
public static Policy getPoolConfigPolicy(com.impetus.client.cassandra.service.CassandraHost cassandraHost)
{
Policy policy = new Policy();
if (cassandraHost.getMaxActive() > 0)
{
policy.setMaxActivePerNode(cassandraHost.getMaxActive());
}
if (cassandraHost.getMaxIdle() > 0)
{
policy.setMaxIdlePerNode(cassandraHost.getMaxIdle());
}
if (cassandraHost.getMinIdle() > 0)
{
policy.setMinIdlePerNode(cassandraHost.getMinIdle());
}
if (cassandraHost.getMaxTotal() > 0)
{
policy.setMaxTotal(cassandraHost.getMaxTotal());
}
return policy;
} } | public class class_name {
public static Policy getPoolConfigPolicy(com.impetus.client.cassandra.service.CassandraHost cassandraHost)
{
Policy policy = new Policy();
if (cassandraHost.getMaxActive() > 0)
{
policy.setMaxActivePerNode(cassandraHost.getMaxActive());
// depends on control dependency: [if], data = [(cassandraHost.getMaxActive()]
}
if (cassandraHost.getMaxIdle() > 0)
{
policy.setMaxIdlePerNode(cassandraHost.getMaxIdle());
// depends on control dependency: [if], data = [(cassandraHost.getMaxIdle()]
}
if (cassandraHost.getMinIdle() > 0)
{
policy.setMinIdlePerNode(cassandraHost.getMinIdle());
// depends on control dependency: [if], data = [(cassandraHost.getMinIdle()]
}
if (cassandraHost.getMaxTotal() > 0)
{
policy.setMaxTotal(cassandraHost.getMaxTotal());
// depends on control dependency: [if], data = [(cassandraHost.getMaxTotal()]
}
return policy;
} } |
public class class_name {
public final void write(byte[] data) {
if (sendBinary) {
int prev = 0;
for (int i = 0;i < data.length;i++) {
if (data[i] == -1) {
rawWrite(data, prev, i - prev);
send(new byte[]{-1, -1});
prev = i + 1;
}
}
rawWrite(data, prev, data.length - prev);
} else {
for (int i = 0;i < data.length;i++) {
data[i] = (byte)(data[i] & 0x7F);
}
send(data);
}
} } | public class class_name {
public final void write(byte[] data) {
if (sendBinary) {
int prev = 0;
for (int i = 0;i < data.length;i++) {
if (data[i] == -1) {
rawWrite(data, prev, i - prev); // depends on control dependency: [if], data = [none]
send(new byte[]{-1, -1}); // depends on control dependency: [if], data = [none]
prev = i + 1; // depends on control dependency: [if], data = [none]
}
}
rawWrite(data, prev, data.length - prev); // depends on control dependency: [if], data = [none]
} else {
for (int i = 0;i < data.length;i++) {
data[i] = (byte)(data[i] & 0x7F); // depends on control dependency: [for], data = [i]
}
send(data); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Set<Result> evaluatePids(Set<String> pids,
Map<String, List<String>> resultMap,
HttpServletRequest request,
DataResponseWrapper response)
throws ServletException {
RequestCtx[] requests = new RequestCtx[pids.size()];
int ix = 0;
for (String pidDN : pids) {
logger.debug("Checking: {}", pidDN);
Map<URI, AttributeValue> actions =
new HashMap<URI, AttributeValue>();
Map<URI, AttributeValue> resAttr;
String[] components = pidDN.split("\\/");
String pid = components[1];
String dsID = null;
if (components.length == 3) {
dsID = components[2];
}
try {
actions
.put(Constants.ACTION.ID.getURI(),
new StringAttribute(Constants.ACTION.LIST_OBJECT_IN_RESOURCE_INDEX_RESULTS
.getURI().toASCIIString()));
actions.put(Constants.ACTION.API.getURI(),
new StringAttribute(Constants.ACTION.APIA.getURI()
.toASCIIString()));
// Modification to uniquely identify datastreams
resAttr = ResourceAttributes.getResources(pid);
if (dsID != null && !dsID.isEmpty()) {
resAttr.put(Constants.DATASTREAM.ID.getURI(),
new StringAttribute(dsID));
}
RequestCtx req =
m_contextUtil.buildRequest(getSubjects(request),
actions,
resAttr,
getEnvironment(request),
m_relationshipResolver);
String xacmlResourceId = getXacmlResourceId(req);
if (xacmlResourceId != null) {
if (logger.isDebugEnabled()) {
logger.debug("Extracted XacmlResourceId: "
+ xacmlResourceId);
}
List<String> resultPid = resultMap.get(xacmlResourceId);
if (resultPid == null) {
resultPid = new ArrayList<String>();
resultMap.put(xacmlResourceId, resultPid);
}
resultPid.add(pidDN);
}
requests[ix++] = req;
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ServletException(e.getMessage(), e);
}
}
ResponseCtx resCtx = null;
try {
logger.debug("Number of requests: {}", requests.length);
resCtx =
getContextHandler().evaluateBatch(requests);
} catch (MelcoeXacmlException pe) {
throw new ServletException("Error evaluating pids: "
+ pe.getMessage(), pe);
}
@SuppressWarnings("unchecked")
Set<Result> results = resCtx.getResults();
return results;
} } | public class class_name {
private Set<Result> evaluatePids(Set<String> pids,
Map<String, List<String>> resultMap,
HttpServletRequest request,
DataResponseWrapper response)
throws ServletException {
RequestCtx[] requests = new RequestCtx[pids.size()];
int ix = 0;
for (String pidDN : pids) {
logger.debug("Checking: {}", pidDN);
Map<URI, AttributeValue> actions =
new HashMap<URI, AttributeValue>();
Map<URI, AttributeValue> resAttr;
String[] components = pidDN.split("\\/");
String pid = components[1];
String dsID = null;
if (components.length == 3) {
dsID = components[2]; // depends on control dependency: [if], data = [none]
}
try {
actions
.put(Constants.ACTION.ID.getURI(),
new StringAttribute(Constants.ACTION.LIST_OBJECT_IN_RESOURCE_INDEX_RESULTS
.getURI().toASCIIString())); // depends on control dependency: [try], data = [none]
actions.put(Constants.ACTION.API.getURI(),
new StringAttribute(Constants.ACTION.APIA.getURI()
.toASCIIString())); // depends on control dependency: [try], data = [none]
// Modification to uniquely identify datastreams
resAttr = ResourceAttributes.getResources(pid); // depends on control dependency: [try], data = [none]
if (dsID != null && !dsID.isEmpty()) {
resAttr.put(Constants.DATASTREAM.ID.getURI(),
new StringAttribute(dsID)); // depends on control dependency: [if], data = [none]
}
RequestCtx req =
m_contextUtil.buildRequest(getSubjects(request),
actions,
resAttr,
getEnvironment(request),
m_relationshipResolver);
String xacmlResourceId = getXacmlResourceId(req);
if (xacmlResourceId != null) {
if (logger.isDebugEnabled()) {
logger.debug("Extracted XacmlResourceId: "
+ xacmlResourceId); // depends on control dependency: [if], data = [none]
}
List<String> resultPid = resultMap.get(xacmlResourceId);
if (resultPid == null) {
resultPid = new ArrayList<String>(); // depends on control dependency: [if], data = [none]
resultMap.put(xacmlResourceId, resultPid); // depends on control dependency: [if], data = [none]
}
resultPid.add(pidDN); // depends on control dependency: [if], data = [none]
}
requests[ix++] = req; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new ServletException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
ResponseCtx resCtx = null;
try {
logger.debug("Number of requests: {}", requests.length);
resCtx =
getContextHandler().evaluateBatch(requests);
} catch (MelcoeXacmlException pe) {
throw new ServletException("Error evaluating pids: "
+ pe.getMessage(), pe);
}
@SuppressWarnings("unchecked")
Set<Result> results = resCtx.getResults();
return results;
} } |
public class class_name {
private CmsSpellcheckingRequest parseJsonRequest(JSONObject jsonRequest) {
final String id = jsonRequest.optString(JSON_ID);
final JSONObject params = jsonRequest.optJSONObject(JSON_PARAMS);
if (null == params) {
LOG.debug("Invalid JSON request: No field \"params\" defined. ");
return null;
}
final JSONArray words = params.optJSONArray(JSON_WORDS);
final String lang = params.optString(JSON_LANG, LANG_DEFAULT);
if (null == words) {
LOG.debug("Invalid JSON request: No field \"words\" defined. ");
return null;
}
// Convert JSON array to array of type String
final List<String> wordsToCheck = new LinkedList<String>();
for (int i = 0; i < words.length(); i++) {
final String word = words.opt(i).toString();
wordsToCheck.add(word);
if (Character.isUpperCase(word.codePointAt(0))) {
wordsToCheck.add(word.toLowerCase());
}
}
return new CmsSpellcheckingRequest(wordsToCheck.toArray(new String[wordsToCheck.size()]), lang, id);
} } | public class class_name {
private CmsSpellcheckingRequest parseJsonRequest(JSONObject jsonRequest) {
final String id = jsonRequest.optString(JSON_ID);
final JSONObject params = jsonRequest.optJSONObject(JSON_PARAMS);
if (null == params) {
LOG.debug("Invalid JSON request: No field \"params\" defined. "); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
final JSONArray words = params.optJSONArray(JSON_WORDS);
final String lang = params.optString(JSON_LANG, LANG_DEFAULT);
if (null == words) {
LOG.debug("Invalid JSON request: No field \"words\" defined. "); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// Convert JSON array to array of type String
final List<String> wordsToCheck = new LinkedList<String>();
for (int i = 0; i < words.length(); i++) {
final String word = words.opt(i).toString();
wordsToCheck.add(word); // depends on control dependency: [for], data = [none]
if (Character.isUpperCase(word.codePointAt(0))) {
wordsToCheck.add(word.toLowerCase()); // depends on control dependency: [if], data = [none]
}
}
return new CmsSpellcheckingRequest(wordsToCheck.toArray(new String[wordsToCheck.size()]), lang, id);
} } |
public class class_name {
public void printDate(CharBuffer cb)
{
cb.append(DAY_NAMES[(int) (_dayOfEpoch % 7 + 11) % 7]);
cb.append(", ");
cb.append((_dayOfMonth + 1) / 10);
cb.append((_dayOfMonth + 1) % 10);
cb.append(" ");
cb.append(MONTH_NAMES[(int) _month]);
cb.append(" ");
cb.append(_year);
cb.append(" ");
cb.append((_timeOfDay / 36000000L) % 10);
cb.append((_timeOfDay / 3600000L) % 10);
cb.append(":");
cb.append((_timeOfDay / 600000L) % 6);
cb.append((_timeOfDay / 60000L) % 10);
cb.append(":");
cb.append((_timeOfDay / 10000L) % 6);
cb.append((_timeOfDay / 1000L) % 10);
if (_zoneName == null || _zoneName.equals("GMT")) {
cb.append(" GMT");
return;
}
long offset = _zoneOffset;
if (offset < 0) {
cb.append(" -");
offset = - offset;
} else
cb.append(" +");
cb.append((offset / 36000000) % 10);
cb.append((offset / 3600000) % 10);
cb.append((offset / 600000) % 6);
cb.append((offset / 60000) % 10);
cb.append(" (");
cb.append(_zoneName);
cb.append(")");
} } | public class class_name {
public void printDate(CharBuffer cb)
{
cb.append(DAY_NAMES[(int) (_dayOfEpoch % 7 + 11) % 7]);
cb.append(", ");
cb.append((_dayOfMonth + 1) / 10);
cb.append((_dayOfMonth + 1) % 10);
cb.append(" ");
cb.append(MONTH_NAMES[(int) _month]);
cb.append(" ");
cb.append(_year);
cb.append(" ");
cb.append((_timeOfDay / 36000000L) % 10);
cb.append((_timeOfDay / 3600000L) % 10);
cb.append(":");
cb.append((_timeOfDay / 600000L) % 6);
cb.append((_timeOfDay / 60000L) % 10);
cb.append(":");
cb.append((_timeOfDay / 10000L) % 6);
cb.append((_timeOfDay / 1000L) % 10);
if (_zoneName == null || _zoneName.equals("GMT")) {
cb.append(" GMT"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
long offset = _zoneOffset;
if (offset < 0) {
cb.append(" -"); // depends on control dependency: [if], data = [none]
offset = - offset; // depends on control dependency: [if], data = [none]
} else
cb.append(" +");
cb.append((offset / 36000000) % 10);
cb.append((offset / 3600000) % 10);
cb.append((offset / 600000) % 6);
cb.append((offset / 60000) % 10);
cb.append(" (");
cb.append(_zoneName);
cb.append(")");
} } |
public class class_name {
public void setVerticalLayout(VerticalLayout layout, boolean addAll) {
if (m_results.size() > 0) {
if (addAll) {
for (CmsResourceTypeStatResult result : m_results) {
layout.addComponent(getLayoutFromResult(result), 0);
}
} else {
CmsResourceTypeStatResult statResult = m_results.get(m_results.size() - 1);
if (m_updated) {
removeRow(layout, statResult);
}
layout.addComponent(getLayoutFromResult(statResult), 0);
}
}
} } | public class class_name {
public void setVerticalLayout(VerticalLayout layout, boolean addAll) {
if (m_results.size() > 0) {
if (addAll) {
for (CmsResourceTypeStatResult result : m_results) {
layout.addComponent(getLayoutFromResult(result), 0); // depends on control dependency: [for], data = [result]
}
} else {
CmsResourceTypeStatResult statResult = m_results.get(m_results.size() - 1);
if (m_updated) {
removeRow(layout, statResult); // depends on control dependency: [if], data = [none]
}
layout.addComponent(getLayoutFromResult(statResult), 0); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public Observable<ServiceResponse<Evaluate>> evaluateUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, Boolean cacheImage) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (imageUrl == null) {
throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null.");
}
Validator.validate(imageUrl);
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
return service.evaluateUrlInput(cacheImage, contentType, imageUrl, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Evaluate>>>() {
@Override
public Observable<ServiceResponse<Evaluate>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Evaluate> clientResponse = evaluateUrlInputDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} } | public class class_name {
public Observable<ServiceResponse<Evaluate>> evaluateUrlInputWithServiceResponseAsync(String contentType, BodyModelModel imageUrl, Boolean cacheImage) {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
if (contentType == null) {
throw new IllegalArgumentException("Parameter contentType is required and cannot be null.");
}
if (imageUrl == null) {
throw new IllegalArgumentException("Parameter imageUrl is required and cannot be null.");
}
Validator.validate(imageUrl);
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
return service.evaluateUrlInput(cacheImage, contentType, imageUrl, this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<Evaluate>>>() {
@Override
public Observable<ServiceResponse<Evaluate>> call(Response<ResponseBody> response) {
try {
ServiceResponse<Evaluate> clientResponse = evaluateUrlInputDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public MobicentsSipApplicationSessionKey getCorrespondingSipApplicationSession(MobicentsSipApplicationSessionKey sipApplicationSessionKey, String headerName) {
MobicentsSipApplicationSessionKey correspondingSipApplicationSession = null;
if(headerName.equalsIgnoreCase(JoinHeader.NAME)) {
correspondingSipApplicationSession = joinApplicationSession.get(sipApplicationSessionKey);
} else if (headerName.equalsIgnoreCase(ReplacesHeader.NAME)) {
correspondingSipApplicationSession = replacesApplicationSession.get(sipApplicationSessionKey);
} else {
throw new IllegalArgumentException("headerName argument should either be one of Join or Replaces");
}
return correspondingSipApplicationSession;
} } | public class class_name {
public MobicentsSipApplicationSessionKey getCorrespondingSipApplicationSession(MobicentsSipApplicationSessionKey sipApplicationSessionKey, String headerName) {
MobicentsSipApplicationSessionKey correspondingSipApplicationSession = null;
if(headerName.equalsIgnoreCase(JoinHeader.NAME)) {
correspondingSipApplicationSession = joinApplicationSession.get(sipApplicationSessionKey);
// depends on control dependency: [if], data = [none]
} else if (headerName.equalsIgnoreCase(ReplacesHeader.NAME)) {
correspondingSipApplicationSession = replacesApplicationSession.get(sipApplicationSessionKey);
// depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("headerName argument should either be one of Join or Replaces");
}
return correspondingSipApplicationSession;
} } |
public class class_name {
@Override
protected boolean reSubscribe(EventChannelStruct event_channel_struct,
EventCallBackStruct callback_struct) {
boolean retVal = true;
try {
DeviceData subscriber_in = new DeviceData();
String[] subscriber_info = new String[4];
subscriber_info[0] = callback_struct.device.name();
subscriber_info[1] = callback_struct.attr_name;
subscriber_info[2] = "subscribe";
subscriber_info[3] = callback_struct.event_name;
subscriber_in.insert(subscriber_info);
event_channel_struct.adm_device_proxy.command_inout("EventSubscriptionChange", subscriber_in);
event_channel_struct.heartbeat_skipped = false;
event_channel_struct.last_subscribed = System.currentTimeMillis();
callback_struct.last_subscribed = event_channel_struct.last_subscribed;
} catch (Exception e) {
retVal = false;
}
return retVal;
} } | public class class_name {
@Override
protected boolean reSubscribe(EventChannelStruct event_channel_struct,
EventCallBackStruct callback_struct) {
boolean retVal = true;
try {
DeviceData subscriber_in = new DeviceData();
String[] subscriber_info = new String[4];
subscriber_info[0] = callback_struct.device.name(); // depends on control dependency: [try], data = [none]
subscriber_info[1] = callback_struct.attr_name; // depends on control dependency: [try], data = [none]
subscriber_info[2] = "subscribe"; // depends on control dependency: [try], data = [none]
subscriber_info[3] = callback_struct.event_name; // depends on control dependency: [try], data = [none]
subscriber_in.insert(subscriber_info); // depends on control dependency: [try], data = [none]
event_channel_struct.adm_device_proxy.command_inout("EventSubscriptionChange", subscriber_in); // depends on control dependency: [try], data = [none]
event_channel_struct.heartbeat_skipped = false; // depends on control dependency: [try], data = [none]
event_channel_struct.last_subscribed = System.currentTimeMillis(); // depends on control dependency: [try], data = [none]
callback_struct.last_subscribed = event_channel_struct.last_subscribed; // depends on control dependency: [try], data = [none]
} catch (Exception e) {
retVal = false;
} // depends on control dependency: [catch], data = [none]
return retVal;
} } |
public class class_name {
public static void turnScreenOn(Activity context) {
try {
Window window = context.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
} catch (Exception ex) {
Log.e("Caffeine", "Unable to turn on screen for activity " + context);
}
} } | public class class_name {
public static void turnScreenOn(Activity context) {
try {
Window window = context.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); // depends on control dependency: [try], data = [none]
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED); // depends on control dependency: [try], data = [none]
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
Log.e("Caffeine", "Unable to turn on screen for activity " + context);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static String getThreadInfo(Thread thread) {
final StringBuilder sb = new StringBuilder();
sb.append("Thread: ");
sb.append(thread.getId());
sb.append(" (");
sb.append(thread.getName());
sb.append(")");
sb.append(lineSeparator);
final StackTraceElement[] stack = thread.getStackTrace();
if (stack.length == 0) {
sb.append(" No Java callstack associated with this thread");
sb.append(lineSeparator);
} else {
for (StackTraceElement element : stack) {
sb.append(" at ");
sb.append(element.getClassName());
sb.append(".");
sb.append(element.getMethodName());
sb.append("(");
final int lineNumber = element.getLineNumber();
if (lineNumber == -2) {
sb.append("Native Method");
} else if (lineNumber >=0) {
sb.append(element.getFileName());
sb.append(":");
sb.append(element.getLineNumber());
} else {
sb.append(element.getFileName());
}
sb.append(")");
sb.append(lineSeparator);
}
}
sb.append(lineSeparator);
return sb.toString();
} } | public class class_name {
private static String getThreadInfo(Thread thread) {
final StringBuilder sb = new StringBuilder();
sb.append("Thread: ");
sb.append(thread.getId());
sb.append(" (");
sb.append(thread.getName());
sb.append(")");
sb.append(lineSeparator);
final StackTraceElement[] stack = thread.getStackTrace();
if (stack.length == 0) {
sb.append(" No Java callstack associated with this thread"); // depends on control dependency: [if], data = [none]
sb.append(lineSeparator); // depends on control dependency: [if], data = [none]
} else {
for (StackTraceElement element : stack) {
sb.append(" at "); // depends on control dependency: [for], data = [none]
sb.append(element.getClassName()); // depends on control dependency: [for], data = [element]
sb.append("."); // depends on control dependency: [for], data = [none]
sb.append(element.getMethodName()); // depends on control dependency: [for], data = [element]
sb.append("("); // depends on control dependency: [for], data = [none]
final int lineNumber = element.getLineNumber();
if (lineNumber == -2) {
sb.append("Native Method"); // depends on control dependency: [if], data = [none]
} else if (lineNumber >=0) {
sb.append(element.getFileName()); // depends on control dependency: [if], data = [none]
sb.append(":"); // depends on control dependency: [if], data = [none]
sb.append(element.getLineNumber()); // depends on control dependency: [if], data = [none]
} else {
sb.append(element.getFileName()); // depends on control dependency: [if], data = [none]
}
sb.append(")"); // depends on control dependency: [for], data = [none]
sb.append(lineSeparator); // depends on control dependency: [for], data = [none]
}
}
sb.append(lineSeparator);
return sb.toString();
} } |
public class class_name {
public void unsubscribe() {
if (this.dispatcher != null) {
throw new IllegalStateException(
"Subscriptions that belong to a dispatcher cannot respond to unsubscribe directly.");
} else if (this.incoming == null) {
throw new IllegalStateException("This subscription is inactive.");
}
if (isDraining()) { // No op while draining
return;
}
this.connection.unsubscribe(this, -1);
} } | public class class_name {
public void unsubscribe() {
if (this.dispatcher != null) {
throw new IllegalStateException(
"Subscriptions that belong to a dispatcher cannot respond to unsubscribe directly.");
} else if (this.incoming == null) {
throw new IllegalStateException("This subscription is inactive.");
}
if (isDraining()) { // No op while draining
return; // depends on control dependency: [if], data = [none]
}
this.connection.unsubscribe(this, -1);
} } |
public class class_name {
public static <T> AuthorityReactiveAuthorizationManager<T> hasAnyAuthority(String... authorities) {
Assert.notNull(authorities, "authorities cannot be null");
for (String authority : authorities) {
Assert.notNull(authority, "authority cannot be null");
}
return new AuthorityReactiveAuthorizationManager<>(authorities);
} } | public class class_name {
public static <T> AuthorityReactiveAuthorizationManager<T> hasAnyAuthority(String... authorities) {
Assert.notNull(authorities, "authorities cannot be null");
for (String authority : authorities) {
Assert.notNull(authority, "authority cannot be null"); // depends on control dependency: [for], data = [authority]
}
return new AuthorityReactiveAuthorizationManager<>(authorities);
} } |
public class class_name {
public static double min(final double[] values) {
double min = NaN;
if (values.length > 0) {
min = values[0];
for (int i = 0; i < values.length; ++i) {
if (values[i] < min) {
min = values[i];
}
}
}
return min;
} } | public class class_name {
public static double min(final double[] values) {
double min = NaN;
if (values.length > 0) {
min = values[0]; // depends on control dependency: [if], data = [none]
for (int i = 0; i < values.length; ++i) {
if (values[i] < min) {
min = values[i]; // depends on control dependency: [if], data = [none]
}
}
}
return min;
} } |
public class class_name {
@SuppressWarnings("unchecked")
protected <C> Constructor<C> retrieveCachedConstructor(Class<C> clazz) {
return (Constructor<C>) constructorMemoization.computeIfAbsent(clazz, key -> {
Constructor<C> constructor;
try {
constructor = clazz.getDeclaredConstructor();
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("The class (" + clazz
+ ") should have a no-arg constructor to create a planning clone.", e);
}
constructor.setAccessible(true);
return constructor;
});
} } | public class class_name {
@SuppressWarnings("unchecked")
protected <C> Constructor<C> retrieveCachedConstructor(Class<C> clazz) {
return (Constructor<C>) constructorMemoization.computeIfAbsent(clazz, key -> {
Constructor<C> constructor;
try {
constructor = clazz.getDeclaredConstructor(); // depends on control dependency: [try], data = [none]
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("The class (" + clazz
+ ") should have a no-arg constructor to create a planning clone.", e);
} // depends on control dependency: [catch], data = [none]
constructor.setAccessible(true);
return constructor;
});
} } |
public class class_name {
public Range<T> intersect(Range<T> range) {
if (range == null)
throw new IllegalArgumentException("range must not be null");
int cmpLower = range.mLower.compareTo(mLower);
int cmpUpper = range.mUpper.compareTo(mUpper);
if (cmpLower <= 0 && cmpUpper >= 0) {
// range includes this
return this;
} else if (cmpLower >= 0 && cmpUpper <= 0) {
// this inludes range
return range;
} else {
return Range.create(
cmpLower <= 0 ? mLower : range.mLower,
cmpUpper >= 0 ? mUpper : range.mUpper);
}
} } | public class class_name {
public Range<T> intersect(Range<T> range) {
if (range == null)
throw new IllegalArgumentException("range must not be null");
int cmpLower = range.mLower.compareTo(mLower);
int cmpUpper = range.mUpper.compareTo(mUpper);
if (cmpLower <= 0 && cmpUpper >= 0) {
// range includes this
return this; // depends on control dependency: [if], data = [none]
} else if (cmpLower >= 0 && cmpUpper <= 0) {
// this inludes range
return range; // depends on control dependency: [if], data = [none]
} else {
return Range.create(
cmpLower <= 0 ? mLower : range.mLower,
cmpUpper >= 0 ? mUpper : range.mUpper); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public <T extends InteractionAwareFixture> T create(Class<T> clazz, Object... constructorArgs) {
T result;
if (constructorArgs != null && constructorArgs.length > 0) {
Class<?>[] types = new Class[constructorArgs.length];
for (int i = 0; i < constructorArgs.length; i++) {
types[i] = constructorArgs[i].getClass();
}
result = create(clazz, types, constructorArgs);
} else {
result = create(clazz, null, null);
}
return result;
} } | public class class_name {
public <T extends InteractionAwareFixture> T create(Class<T> clazz, Object... constructorArgs) {
T result;
if (constructorArgs != null && constructorArgs.length > 0) {
Class<?>[] types = new Class[constructorArgs.length]; // depends on control dependency: [if], data = [none]
for (int i = 0; i < constructorArgs.length; i++) {
types[i] = constructorArgs[i].getClass(); // depends on control dependency: [for], data = [i]
}
result = create(clazz, types, constructorArgs); // depends on control dependency: [if], data = [none]
} else {
result = create(clazz, null, null); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
private void moveToNext() {
if (controller != null) {
currentItemIndex = controller.nextItem(this, currentItemIndex);
} else {
currentItemIndex = defaultController.nextItem(this, currentItemIndex);
}
} } | public class class_name {
private void moveToNext() {
if (controller != null) {
currentItemIndex = controller.nextItem(this, currentItemIndex);
// depends on control dependency: [if], data = [none]
} else {
currentItemIndex = defaultController.nextItem(this, currentItemIndex);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String calculateChecksum(final File installedFile) throws MojoExecutionException {
int bufsize = CHECKSUM_BUFFER_SIZE;
byte[] buffer = new byte[bufsize];
FileInputStream fis = null;
BufferedInputStream bis = null;
String checksum = null;
try {
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
fis = new FileInputStream(installedFile);
sha1.reset();
int size = fis.read(buffer, 0, bufsize);
while (size >= 0) {
sha1.update(buffer, 0, size);
size = fis.read(buffer, 0, bufsize);
}
checksum = String.format("%040x", new BigInteger(1, sha1.digest()));
} catch (Exception e) {
throw new MojoExecutionException("Failed to calculate digest checksum for " + installedFile, e);
} finally {
IOUtil.close(bis);
IOUtil.close(fis);
}
if (checksum != null) {
return checksum;
} else {
throw new MojoExecutionException("Failed to calculate digest checksum for " + installedFile);
}
} } | public class class_name {
public static String calculateChecksum(final File installedFile) throws MojoExecutionException {
int bufsize = CHECKSUM_BUFFER_SIZE;
byte[] buffer = new byte[bufsize];
FileInputStream fis = null;
BufferedInputStream bis = null;
String checksum = null;
try {
MessageDigest sha1 = MessageDigest.getInstance("SHA-1");
fis = new FileInputStream(installedFile);
sha1.reset();
int size = fis.read(buffer, 0, bufsize);
while (size >= 0) {
sha1.update(buffer, 0, size);
// depends on control dependency: [while], data = [none]
size = fis.read(buffer, 0, bufsize);
// depends on control dependency: [while], data = [none]
}
checksum = String.format("%040x", new BigInteger(1, sha1.digest()));
} catch (Exception e) {
throw new MojoExecutionException("Failed to calculate digest checksum for " + installedFile, e);
} finally {
IOUtil.close(bis);
IOUtil.close(fis);
}
if (checksum != null) {
return checksum;
} else {
throw new MojoExecutionException("Failed to calculate digest checksum for " + installedFile);
}
} } |
public class class_name {
private DatanodeDescriptor getDatanode(DatanodeID node) {
if (node == null) {
return null;
}
DatanodeDescriptor ds = null;
try {
ds = namesystem.getDatanode(node);
} catch (Exception e) {
// probably dead on unregistered datanode
LOG.warn("Failover - caught exception when getting datanode", e);
return null;
}
return ds;
} } | public class class_name {
private DatanodeDescriptor getDatanode(DatanodeID node) {
if (node == null) {
return null; // depends on control dependency: [if], data = [none]
}
DatanodeDescriptor ds = null;
try {
ds = namesystem.getDatanode(node); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// probably dead on unregistered datanode
LOG.warn("Failover - caught exception when getting datanode", e);
return null;
} // depends on control dependency: [catch], data = [none]
return ds;
} } |
public class class_name {
private Metadata createMetadata(String tableName) {
Metadata metadata = new Metadata();
if (tableName != null) {
metadata.put(GRPC_RESOURCE_PREFIX_KEY, tableName);
}
return metadata;
} } | public class class_name {
private Metadata createMetadata(String tableName) {
Metadata metadata = new Metadata();
if (tableName != null) {
metadata.put(GRPC_RESOURCE_PREFIX_KEY, tableName); // depends on control dependency: [if], data = [none]
}
return metadata;
} } |
public class class_name {
public EEnum getBDDReserved2() {
if (bddReserved2EEnum == null) {
bddReserved2EEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(4);
}
return bddReserved2EEnum;
} } | public class class_name {
public EEnum getBDDReserved2() {
if (bddReserved2EEnum == null) {
bddReserved2EEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(4); // depends on control dependency: [if], data = [none]
}
return bddReserved2EEnum;
} } |
public class class_name {
public static Object parsePattern(String pattern, boolean escaped, char escape) {
char[] accum = new char[pattern.length()];
int finger = 0;
List tokens = new ArrayList();
boolean trivial = true;
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (c == sqlMatchOne) {
finger = flush(accum, finger, tokens);
tokens.add(matchOne);
trivial = false;
}
else if (c == sqlMatchMany) {
finger = flush(accum, finger, tokens);
tokens.add(matchMany);
trivial = false;
}
else if (escaped && c == escape)
if (i == pattern.length()-1)
return null;
else {
i++;
accum[finger++] = pattern.charAt(i);
}
else
accum[finger++] = c;
}
if (trivial)
return new String(accum, 0, finger);
flush(accum, finger, tokens);
if (tokens.size() == 1 && tokens.get(0) == matchMany)
return matchMany;
return new Pattern(tokens.iterator());
} } | public class class_name {
public static Object parsePattern(String pattern, boolean escaped, char escape) {
char[] accum = new char[pattern.length()];
int finger = 0;
List tokens = new ArrayList();
boolean trivial = true;
for (int i = 0; i < pattern.length(); i++) {
char c = pattern.charAt(i);
if (c == sqlMatchOne) {
finger = flush(accum, finger, tokens); // depends on control dependency: [if], data = [none]
tokens.add(matchOne); // depends on control dependency: [if], data = [none]
trivial = false; // depends on control dependency: [if], data = [none]
}
else if (c == sqlMatchMany) {
finger = flush(accum, finger, tokens); // depends on control dependency: [if], data = [none]
tokens.add(matchMany); // depends on control dependency: [if], data = [none]
trivial = false; // depends on control dependency: [if], data = [none]
}
else if (escaped && c == escape)
if (i == pattern.length()-1)
return null;
else {
i++; // depends on control dependency: [if], data = [none]
accum[finger++] = pattern.charAt(i); // depends on control dependency: [if], data = [(i]
}
else
accum[finger++] = c;
}
if (trivial)
return new String(accum, 0, finger);
flush(accum, finger, tokens);
if (tokens.size() == 1 && tokens.get(0) == matchMany)
return matchMany;
return new Pattern(tokens.iterator());
} } |
public class class_name {
public long getUsedSpace() {
long count = 0L;
final int bufferSize = 1024 * 8;// Relatively big buffer (8MB); we're just reading
final Map<ArchivePath, Node> contents = archive.getContent();
final Collection<Node> nodes = contents.values();
for (final Node node : nodes) {
final Asset asset = node.getAsset();
if (asset == null) {
continue; // Directory
}
final InputStream in = new BufferedInputStream(asset.openStream(), bufferSize);
final byte[] buffer = new byte[bufferSize];
int read = 0;
try {
while ((read = in.read(buffer)) != -1) {
// Just count
count += read;
}
} catch (final IOException ioe) {
throw new RuntimeException("Could not count size of archive " + this.archive.getName() + " at "
+ asset.toString(), ioe);
}
}
return count;
} } | public class class_name {
public long getUsedSpace() {
long count = 0L;
final int bufferSize = 1024 * 8;// Relatively big buffer (8MB); we're just reading
final Map<ArchivePath, Node> contents = archive.getContent();
final Collection<Node> nodes = contents.values();
for (final Node node : nodes) {
final Asset asset = node.getAsset();
if (asset == null) {
continue; // Directory
}
final InputStream in = new BufferedInputStream(asset.openStream(), bufferSize);
final byte[] buffer = new byte[bufferSize];
int read = 0;
try {
while ((read = in.read(buffer)) != -1) {
// Just count
count += read; // depends on control dependency: [while], data = [none]
}
} catch (final IOException ioe) {
throw new RuntimeException("Could not count size of archive " + this.archive.getName() + " at "
+ asset.toString(), ioe);
} // depends on control dependency: [catch], data = [none]
}
return count;
} } |
public class class_name {
private void parseValue() {
// 当值无时,视为空判定
if (null == this.value) {
this.operator = OPERATOR_IS;
this.value = VALUE_NULL;
return;
}
// 对数组和集合值按照 IN 处理
if (this.value instanceof Collection || ArrayUtil.isArray(this.value)) {
this.operator = OPERATOR_IN;
return;
}
// 其他类型值,跳过
if (false == (this.value instanceof String)) {
return;
}
String valueStr = ((String) value);
if (StrUtil.isBlank(valueStr)) {
// 空字段不做处理
return;
}
valueStr = valueStr.trim();
// 处理null
if (StrUtil.endWithIgnoreCase(valueStr, "null")) {
if (StrUtil.equalsIgnoreCase("= null", valueStr) || StrUtil.equalsIgnoreCase("is null", valueStr)) {
// 处理"= null"和"is null"转换为"IS NULL"
this.operator = OPERATOR_IS;
this.value = VALUE_NULL;
this.isPlaceHolder = false;
return;
} else if (StrUtil.equalsIgnoreCase("!= null", valueStr) || StrUtil.equalsIgnoreCase("is not null", valueStr)) {
// 处理"!= null"和"is not null"转换为"IS NOT NULL"
this.operator = OPERATOR_IS_NOT;
this.value = VALUE_NULL;
this.isPlaceHolder = false;
return;
}
}
List<String> strs = StrUtil.split(valueStr, StrUtil.C_SPACE, 2);
if (strs.size() < 2) {
return;
}
// 处理常用符号和IN
final String firstPart = strs.get(0).trim().toUpperCase();
if (OPERATORS.contains(firstPart)) {
this.operator = firstPart;
this.value = strs.get(1).trim();
return;
}
// 处理LIKE
if (OPERATOR_LIKE.equals(firstPart)) {
this.operator = OPERATOR_LIKE;
this.value = unwrapQuote(strs.get(1));
return;
}
// 处理BETWEEN x AND y
if (OPERATOR_BETWEEN.equals(firstPart)) {
final List<String> betweenValueStrs = StrSpliter.splitTrimIgnoreCase(strs.get(1), LogicalOperator.AND.toString(), 2, true);
if (betweenValueStrs.size() < 2) {
// 必须满足a AND b格式,不满足被当作普通值
return;
}
this.operator = OPERATOR_BETWEEN;
this.value = unwrapQuote(betweenValueStrs.get(0));
this.secondValue = unwrapQuote(betweenValueStrs.get(1));
return;
}
} } | public class class_name {
private void parseValue() {
// 当值无时,视为空判定
if (null == this.value) {
this.operator = OPERATOR_IS;
// depends on control dependency: [if], data = [none]
this.value = VALUE_NULL;
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
// 对数组和集合值按照 IN 处理
if (this.value instanceof Collection || ArrayUtil.isArray(this.value)) {
this.operator = OPERATOR_IN;
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
// 其他类型值,跳过
if (false == (this.value instanceof String)) {
return;
// depends on control dependency: [if], data = [none]
}
String valueStr = ((String) value);
if (StrUtil.isBlank(valueStr)) {
// 空字段不做处理
return;
// depends on control dependency: [if], data = [none]
}
valueStr = valueStr.trim();
// 处理null
if (StrUtil.endWithIgnoreCase(valueStr, "null")) {
if (StrUtil.equalsIgnoreCase("= null", valueStr) || StrUtil.equalsIgnoreCase("is null", valueStr)) {
// 处理"= null"和"is null"转换为"IS NULL"
this.operator = OPERATOR_IS;
// depends on control dependency: [if], data = [none]
this.value = VALUE_NULL;
// depends on control dependency: [if], data = [none]
this.isPlaceHolder = false;
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
} else if (StrUtil.equalsIgnoreCase("!= null", valueStr) || StrUtil.equalsIgnoreCase("is not null", valueStr)) {
// 处理"!= null"和"is not null"转换为"IS NOT NULL"
this.operator = OPERATOR_IS_NOT;
// depends on control dependency: [if], data = [none]
this.value = VALUE_NULL;
// depends on control dependency: [if], data = [none]
this.isPlaceHolder = false;
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
}
List<String> strs = StrUtil.split(valueStr, StrUtil.C_SPACE, 2);
if (strs.size() < 2) {
return;
// depends on control dependency: [if], data = [none]
}
// 处理常用符号和IN
final String firstPart = strs.get(0).trim().toUpperCase();
if (OPERATORS.contains(firstPart)) {
this.operator = firstPart;
// depends on control dependency: [if], data = [none]
this.value = strs.get(1).trim();
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
// 处理LIKE
if (OPERATOR_LIKE.equals(firstPart)) {
this.operator = OPERATOR_LIKE;
// depends on control dependency: [if], data = [none]
this.value = unwrapQuote(strs.get(1));
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
// 处理BETWEEN x AND y
if (OPERATOR_BETWEEN.equals(firstPart)) {
final List<String> betweenValueStrs = StrSpliter.splitTrimIgnoreCase(strs.get(1), LogicalOperator.AND.toString(), 2, true);
if (betweenValueStrs.size() < 2) {
// 必须满足a AND b格式,不满足被当作普通值
return;
// depends on control dependency: [if], data = [none]
}
this.operator = OPERATOR_BETWEEN;
// depends on control dependency: [if], data = [none]
this.value = unwrapQuote(betweenValueStrs.get(0));
// depends on control dependency: [if], data = [none]
this.secondValue = unwrapQuote(betweenValueStrs.get(1));
// depends on control dependency: [if], data = [none]
return;
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void initFieldInjectionPoints() {
final Set<AnnotatedField<? super T>> annotatedFields = annotatedType.getFields();
for (final AnnotatedField<? super T> annotatedField : annotatedFields) {
final FieldInjectionPoint fieldInjectionPoint = new FieldInjectionPoint(this, annotatedField);
fieldInjectionPoints.add(fieldInjectionPoint);
}
} } | public class class_name {
private void initFieldInjectionPoints() {
final Set<AnnotatedField<? super T>> annotatedFields = annotatedType.getFields();
for (final AnnotatedField<? super T> annotatedField : annotatedFields) {
final FieldInjectionPoint fieldInjectionPoint = new FieldInjectionPoint(this, annotatedField);
fieldInjectionPoints.add(fieldInjectionPoint); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public boolean contains(ImmutableRoaringBitmap subset) {
if(subset.getCardinality() > getCardinality()) {
return false;
}
final int length1 = this.highLowContainer.size();
final int length2 = subset.highLowContainer.size();
int pos1 = 0, pos2 = 0;
while (pos1 < length1 && pos2 < length2) {
final short s1 = this.highLowContainer.getKeyAtIndex(pos1);
final short s2 = subset.highLowContainer.getKeyAtIndex(pos2);
if (s1 == s2) {
MappeableContainer c1 = this.highLowContainer.getContainerAtIndex(pos1);
MappeableContainer c2 = subset.highLowContainer.getContainerAtIndex(pos2);
if(!c1.contains(c2)) {
return false;
}
++pos1;
++pos2;
} else if (compareUnsigned(s1, s2) > 0) {
return false;
} else {
pos1 = subset.highLowContainer.advanceUntil(s2, pos1);
}
}
return pos2 == length2;
} } | public class class_name {
public boolean contains(ImmutableRoaringBitmap subset) {
if(subset.getCardinality() > getCardinality()) {
return false; // depends on control dependency: [if], data = [none]
}
final int length1 = this.highLowContainer.size();
final int length2 = subset.highLowContainer.size();
int pos1 = 0, pos2 = 0;
while (pos1 < length1 && pos2 < length2) {
final short s1 = this.highLowContainer.getKeyAtIndex(pos1);
final short s2 = subset.highLowContainer.getKeyAtIndex(pos2);
if (s1 == s2) {
MappeableContainer c1 = this.highLowContainer.getContainerAtIndex(pos1);
MappeableContainer c2 = subset.highLowContainer.getContainerAtIndex(pos2);
if(!c1.contains(c2)) {
return false; // depends on control dependency: [if], data = [none]
}
++pos1; // depends on control dependency: [if], data = [none]
++pos2; // depends on control dependency: [if], data = [none]
} else if (compareUnsigned(s1, s2) > 0) {
return false; // depends on control dependency: [if], data = [none]
} else {
pos1 = subset.highLowContainer.advanceUntil(s2, pos1); // depends on control dependency: [if], data = [none]
}
}
return pos2 == length2;
} } |
public class class_name {
public AnalyzerJob getAnalyzerJob(final AnalyzerJob analyzerJob) {
if (_jobs.contains(analyzerJob)) {
return analyzerJob;
}
final String analyzerInputName;
final InputColumn<?> inputColumn = getIdentifyingInputColumn(analyzerJob);
if (inputColumn == null) {
analyzerInputName = null;
} else {
analyzerInputName = inputColumn.getName();
}
return getAnalyzerJob(analyzerJob.getDescriptor().getDisplayName(), analyzerJob.getName(), analyzerInputName);
} } | public class class_name {
public AnalyzerJob getAnalyzerJob(final AnalyzerJob analyzerJob) {
if (_jobs.contains(analyzerJob)) {
return analyzerJob; // depends on control dependency: [if], data = [none]
}
final String analyzerInputName;
final InputColumn<?> inputColumn = getIdentifyingInputColumn(analyzerJob);
if (inputColumn == null) {
analyzerInputName = null; // depends on control dependency: [if], data = [none]
} else {
analyzerInputName = inputColumn.getName(); // depends on control dependency: [if], data = [none]
}
return getAnalyzerJob(analyzerJob.getDescriptor().getDisplayName(), analyzerJob.getName(), analyzerInputName);
} } |
public class class_name {
public static Integer safeJsonToInteger(Object obj) {
Integer intValue = null;
try {
String str = safeJsonToString(obj);
intValue = str != null ? Integer.parseInt(str) : null;
} catch (NumberFormatException e) {
LOGGER.warn("Safe JSON conversion to Integer failed", e);
}
return intValue;
} } | public class class_name {
public static Integer safeJsonToInteger(Object obj) {
Integer intValue = null;
try {
String str = safeJsonToString(obj);
intValue = str != null ? Integer.parseInt(str) : null; // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
LOGGER.warn("Safe JSON conversion to Integer failed", e);
} // depends on control dependency: [catch], data = [none]
return intValue;
} } |
public class class_name {
private final void doEnqueueWork(AsyncUpdate asyncUpdate)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "doEnqueueWork", asyncUpdate);
try
{
msUpdateThread.enqueueWork(asyncUpdate);
countAsyncUpdatesOutstanding++; // can do it here since synchronized on this
}
catch (ClosedException e)
{
// should not occur!
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AOStream.doEnqueueWork",
"1:2713:1.80.3.24",
this);
SibTr.exception(tc, e);
}
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "doEnqueueWork");
} } | public class class_name {
private final void doEnqueueWork(AsyncUpdate asyncUpdate)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "doEnqueueWork", asyncUpdate);
try
{
msUpdateThread.enqueueWork(asyncUpdate); // depends on control dependency: [try], data = [none]
countAsyncUpdatesOutstanding++; // can do it here since synchronized on this // depends on control dependency: [try], data = [none]
}
catch (ClosedException e)
{
// should not occur!
FFDCFilter.processException(
e,
"com.ibm.ws.sib.processor.impl.AOStream.doEnqueueWork",
"1:2713:1.80.3.24",
this);
SibTr.exception(tc, e);
} // depends on control dependency: [catch], data = [none]
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "doEnqueueWork");
} } |
public class class_name {
private void validate(JSONObject json) throws HelloSignException {
if (json.has("error")) {
try {
JSONObject error = json.getJSONObject("error");
String message = error.getString("error_msg");
String type = error.getString("error_name");
throw new HelloSignException(message, getLastResponseCode(), type);
} catch (JSONException ex) {
throw new HelloSignException(ex);
}
}
} } | public class class_name {
private void validate(JSONObject json) throws HelloSignException {
if (json.has("error")) {
try {
JSONObject error = json.getJSONObject("error");
String message = error.getString("error_msg");
String type = error.getString("error_name");
throw new HelloSignException(message, getLastResponseCode(), type);
} catch (JSONException ex) {
throw new HelloSignException(ex);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static String get(String host, String path, Map<String, String> headers, String param) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
// host校验,一定不能为空,否则无法进行请求
ExceptionUtil.notNull(host);
// 创建HttpClient
httpClient = wrapClient(host);
// 创建HttpGet
HttpGet request = new HttpGet(buildUrl(host, path, param));
defaultHeader(request);
// header处理
if (MapUtil.isNotEmpty(headers)) {
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue());
}
}
// 响应结果
response = httpClient.execute(request);
// 响应结果处理响应内容
String result = null;
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, Charset.UTF_8);
}
}
return result;
} catch (IOException | ParseException e) {
e.printStackTrace();
} finally {
close(httpClient, response);
}
return null;
} } | public class class_name {
public static String get(String host, String path, Map<String, String> headers, String param) {
CloseableHttpClient httpClient = null;
CloseableHttpResponse response = null;
try {
// host校验,一定不能为空,否则无法进行请求
ExceptionUtil.notNull(host); // depends on control dependency: [try], data = [none]
// 创建HttpClient
httpClient = wrapClient(host); // depends on control dependency: [try], data = [none]
// 创建HttpGet
HttpGet request = new HttpGet(buildUrl(host, path, param));
defaultHeader(request); // depends on control dependency: [try], data = [none]
// header处理
if (MapUtil.isNotEmpty(headers)) {
for (Map.Entry<String, String> e : headers.entrySet()) {
request.addHeader(e.getKey(), e.getValue()); // depends on control dependency: [for], data = [e]
}
}
// 响应结果
response = httpClient.execute(request); // depends on control dependency: [try], data = [none]
// 响应结果处理响应内容
String result = null;
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, Charset.UTF_8); // depends on control dependency: [if], data = [(resEntity]
}
}
return result; // depends on control dependency: [try], data = [none]
} catch (IOException | ParseException e) {
e.printStackTrace();
} finally { // depends on control dependency: [catch], data = [none]
close(httpClient, response);
}
return null;
} } |
public class class_name {
private JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus checkChanges(JApiClass jApiClass) {
JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus state = JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE;
if (jApiClass.getChangeStatus() == JApiChangeStatus.REMOVED) {
return JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_INCOMPATIBLE_CLASS_REMOVED;
}
state = checkChangesForClassType(jApiClass, state);
if (state != JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE) {
return state;
}
state = checkChangesForSuperclass(jApiClass, state);
if (state != JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE) {
return state;
}
state = checkChangesForFields(jApiClass, state);
if (state != JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE) {
return state;
}
state = checkChangesForInterfaces(jApiClass, state);
return state;
} } | public class class_name {
private JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus checkChanges(JApiClass jApiClass) {
JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus state = JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE;
if (jApiClass.getChangeStatus() == JApiChangeStatus.REMOVED) {
return JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_INCOMPATIBLE_CLASS_REMOVED; // depends on control dependency: [if], data = [none]
}
state = checkChangesForClassType(jApiClass, state);
if (state != JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE) {
return state; // depends on control dependency: [if], data = [none]
}
state = checkChangesForSuperclass(jApiClass, state);
if (state != JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE) {
return state; // depends on control dependency: [if], data = [none]
}
state = checkChangesForFields(jApiClass, state);
if (state != JApiJavaObjectSerializationCompatibility.JApiJavaObjectSerializationChangeStatus.SERIALIZABLE_COMPATIBLE) {
return state; // depends on control dependency: [if], data = [none]
}
state = checkChangesForInterfaces(jApiClass, state);
return state;
} } |
public class class_name {
private static String getFOXMLPolicyTemplate(String pid,
String label,
String contentModel,
String collection,
String collectionRelationship,
String policyOrLocation,
String controlGroup)
throws PolicyStoreException {
StringBuilder foxml = new StringBuilder(1024);
foxml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
foxml.append("<foxml:digitalObject VERSION=\"1.1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
foxml.append(" xmlns:foxml=\"info:fedora/fedora-system:def/foxml#\"\n");
foxml.append(" xsi:schemaLocation=\"" + Constants.FOXML.uri
+ " " + Constants.FOXML1_1.xsdLocation + "\"");
foxml.append("\n PID=\"");
StreamUtility.enc(pid, foxml);
foxml.append("\">\n <foxml:objectProperties>\n");
foxml.append(" <foxml:property NAME=\"info:fedora/fedora-system:def/model#state\" VALUE=\"A\"/>\n");
foxml.append(" <foxml:property NAME=\"info:fedora/fedora-system:def/model#label\" VALUE=\"");
StreamUtility.enc(label, foxml);
foxml.append("\"/>\n </foxml:objectProperties>\n");
// RELS-EXT specifying content model - if present, collection relationship if present
// but not for bootstrap policies
if (!pid.startsWith(FESL_BOOTSTRAP_POLICY_NAMESPACE + ":")) {
if (!contentModel.isEmpty() || !collection.isEmpty()) {
foxml.append("<foxml:datastream ID=\"RELS-EXT\" CONTROL_GROUP=\"X\">");
foxml.append("<foxml:datastreamVersion FORMAT_URI=\"info:fedora/fedora-system:FedoraRELSExt-1.0\" ID=\"RELS-EXT.0\" MIMETYPE=\"application/rdf+xml\" LABEL=\"RDF Statements about this object\">");
foxml.append(" <foxml:xmlContent>");
foxml.append(" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:fedora-model=\"info:fedora/fedora-system:def/model#\" xmlns:rel=\"info:fedora/fedora-system:def/relations-external#\">");
foxml.append(" <rdf:Description rdf:about=\"" + "info:fedora/");
StreamUtility.enc(pid, foxml);
foxml.append("\">");
if (!contentModel.isEmpty()) {
foxml.append(" <fedora-model:hasModel rdf:resource=\"");
StreamUtility.enc(contentModel, foxml);
foxml.append("\"/>");
}
if (!collection.isEmpty()) {
foxml.append(" <rel:");
StreamUtility.enc(collectionRelationship, foxml);
foxml.append(" rdf:resource=\"");
StreamUtility.enc(collection, foxml);
foxml.append("\"/>");
}
foxml.append(" </rdf:Description>");
foxml.append(" </rdf:RDF>");
foxml.append(" </foxml:xmlContent>");
foxml.append(" </foxml:datastreamVersion>");
foxml.append("</foxml:datastream>");
}
}
// the POLICY datastream
foxml.append("<foxml:datastream ID=\"" + FESL_POLICY_DATASTREAM
+ "\" CONTROL_GROUP=\"" + controlGroup + "\">");
foxml.append("<foxml:datastreamVersion ID=\"POLICY.0\" MIMETYPE=\"text/xml\" LABEL=\"XACML policy datastream\">");
if (controlGroup.equals("M")) {
foxml.append(" <foxml:contentLocation REF=\"" + policyOrLocation
+ "\" TYPE=\"" + org.fcrepo.server.storage.types.Datastream.DS_LOCATION_TYPE_URL + "\"/>");
} else if (controlGroup.equals("X")) {
foxml.append(" <foxml:xmlContent>");
foxml.append(policyOrLocation);
foxml.append(" </foxml:xmlContent>");
} else {
throw new PolicyStoreException("Generating new object XML: Invalid control group: "
+ controlGroup + " - use X or M.");
}
foxml.append(" </foxml:datastreamVersion>");
foxml.append("</foxml:datastream>");
foxml.append("</foxml:digitalObject>");
return foxml.toString();
} } | public class class_name {
private static String getFOXMLPolicyTemplate(String pid,
String label,
String contentModel,
String collection,
String collectionRelationship,
String policyOrLocation,
String controlGroup)
throws PolicyStoreException {
StringBuilder foxml = new StringBuilder(1024);
foxml.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
foxml.append("<foxml:digitalObject VERSION=\"1.1\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
foxml.append(" xmlns:foxml=\"info:fedora/fedora-system:def/foxml#\"\n");
foxml.append(" xsi:schemaLocation=\"" + Constants.FOXML.uri
+ " " + Constants.FOXML1_1.xsdLocation + "\"");
foxml.append("\n PID=\"");
StreamUtility.enc(pid, foxml);
foxml.append("\">\n <foxml:objectProperties>\n");
foxml.append(" <foxml:property NAME=\"info:fedora/fedora-system:def/model#state\" VALUE=\"A\"/>\n");
foxml.append(" <foxml:property NAME=\"info:fedora/fedora-system:def/model#label\" VALUE=\"");
StreamUtility.enc(label, foxml);
foxml.append("\"/>\n </foxml:objectProperties>\n");
// RELS-EXT specifying content model - if present, collection relationship if present
// but not for bootstrap policies
if (!pid.startsWith(FESL_BOOTSTRAP_POLICY_NAMESPACE + ":")) {
if (!contentModel.isEmpty() || !collection.isEmpty()) {
foxml.append("<foxml:datastream ID=\"RELS-EXT\" CONTROL_GROUP=\"X\">");
foxml.append("<foxml:datastreamVersion FORMAT_URI=\"info:fedora/fedora-system:FedoraRELSExt-1.0\" ID=\"RELS-EXT.0\" MIMETYPE=\"application/rdf+xml\" LABEL=\"RDF Statements about this object\">");
foxml.append(" <foxml:xmlContent>"); // depends on control dependency: [if], data = [none]
foxml.append(" <rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\" xmlns:fedora-model=\"info:fedora/fedora-system:def/model#\" xmlns:rel=\"info:fedora/fedora-system:def/relations-external#\">");
foxml.append(" <rdf:Description rdf:about=\"" + "info:fedora/");
StreamUtility.enc(pid, foxml); // depends on control dependency: [if], data = [none]
foxml.append("\">"); // depends on control dependency: [if], data = [none]
if (!contentModel.isEmpty()) {
foxml.append(" <fedora-model:hasModel rdf:resource=\"");
StreamUtility.enc(contentModel, foxml);
foxml.append("\"/>"); // depends on control dependency: [if], data = [none]
}
if (!collection.isEmpty()) {
foxml.append(" <rel:"); // depends on control dependency: [if], data = [none]
StreamUtility.enc(collectionRelationship, foxml); // depends on control dependency: [if], data = [none]
foxml.append(" rdf:resource=\""); // depends on control dependency: [if], data = [none]
StreamUtility.enc(collection, foxml); // depends on control dependency: [if], data = [none]
foxml.append("\"/>"); // depends on control dependency: [if], data = [none]
}
foxml.append(" </rdf:Description>"); // depends on control dependency: [if], data = [none]
foxml.append(" </rdf:RDF>"); // depends on control dependency: [if], data = [none]
foxml.append(" </foxml:xmlContent>"); // depends on control dependency: [if], data = [none]
foxml.append(" </foxml:datastreamVersion>"); // depends on control dependency: [if], data = [none]
foxml.append("</foxml:datastream>"); // depends on control dependency: [if], data = [none]
}
}
// the POLICY datastream
foxml.append("<foxml:datastream ID=\"" + FESL_POLICY_DATASTREAM
+ "\" CONTROL_GROUP=\"" + controlGroup + "\">");
foxml.append("<foxml:datastreamVersion ID=\"POLICY.0\" MIMETYPE=\"text/xml\" LABEL=\"XACML policy datastream\">");
if (controlGroup.equals("M")) {
foxml.append(" <foxml:contentLocation REF=\"" + policyOrLocation
+ "\" TYPE=\"" + org.fcrepo.server.storage.types.Datastream.DS_LOCATION_TYPE_URL + "\"/>");
} else if (controlGroup.equals("X")) {
foxml.append(" <foxml:xmlContent>");
foxml.append(policyOrLocation);
foxml.append(" </foxml:xmlContent>");
} else {
throw new PolicyStoreException("Generating new object XML: Invalid control group: "
+ controlGroup + " - use X or M.");
}
foxml.append(" </foxml:datastreamVersion>");
foxml.append("</foxml:datastream>");
foxml.append("</foxml:digitalObject>");
return foxml.toString();
} } |
public class class_name {
public void setAttribute(String name, Object value)
throws IllegalArgumentException
{
if (name.equals(FEATURE_INCREMENTAL))
{
if(value instanceof Boolean)
{
// Accept a Boolean object..
m_incremental = ((Boolean)value).booleanValue();
}
else if(value instanceof String)
{
// .. or a String object
m_incremental = (new Boolean((String)value)).booleanValue();
}
else
{
// Give a more meaningful error message
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value);
}
}
else if (name.equals(FEATURE_OPTIMIZE))
{
if(value instanceof Boolean)
{
// Accept a Boolean object..
m_optimize = ((Boolean)value).booleanValue();
}
else if(value instanceof String)
{
// .. or a String object
m_optimize = (new Boolean((String)value)).booleanValue();
}
else
{
// Give a more meaningful error message
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value);
}
}
// Custom Xalan feature: annotate DTM with SAX source locator fields.
// This gets used during SAX2DTM instantiation.
//
// %REVIEW% Should the name of this field really be in XalanProperties?
// %REVIEW% I hate that it's a global static, but didn't want to change APIs yet.
else if(name.equals(FEATURE_SOURCE_LOCATION))
{
if(value instanceof Boolean)
{
// Accept a Boolean object..
m_source_location = ((Boolean)value).booleanValue();
}
else if(value instanceof String)
{
// .. or a String object
m_source_location = (new Boolean((String)value)).booleanValue();
}
else
{
// Give a more meaningful error message
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value);
}
}
else
{
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUPPORTED, new Object[]{name})); //name + "not supported");
}
} } | public class class_name {
public void setAttribute(String name, Object value)
throws IllegalArgumentException
{
if (name.equals(FEATURE_INCREMENTAL))
{
if(value instanceof Boolean)
{
// Accept a Boolean object..
m_incremental = ((Boolean)value).booleanValue(); // depends on control dependency: [if], data = [none]
}
else if(value instanceof String)
{
// .. or a String object
m_incremental = (new Boolean((String)value)).booleanValue(); // depends on control dependency: [if], data = [none]
}
else
{
// Give a more meaningful error message
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value);
}
}
else if (name.equals(FEATURE_OPTIMIZE))
{
if(value instanceof Boolean)
{
// Accept a Boolean object..
m_optimize = ((Boolean)value).booleanValue(); // depends on control dependency: [if], data = [none]
}
else if(value instanceof String)
{
// .. or a String object
m_optimize = (new Boolean((String)value)).booleanValue(); // depends on control dependency: [if], data = [none]
}
else
{
// Give a more meaningful error message
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value);
}
}
// Custom Xalan feature: annotate DTM with SAX source locator fields.
// This gets used during SAX2DTM instantiation.
//
// %REVIEW% Should the name of this field really be in XalanProperties?
// %REVIEW% I hate that it's a global static, but didn't want to change APIs yet.
else if(name.equals(FEATURE_SOURCE_LOCATION))
{
if(value instanceof Boolean)
{
// Accept a Boolean object..
m_source_location = ((Boolean)value).booleanValue(); // depends on control dependency: [if], data = [none]
}
else if(value instanceof String)
{
// .. or a String object
m_source_location = (new Boolean((String)value)).booleanValue(); // depends on control dependency: [if], data = [none]
}
else
{
// Give a more meaningful error message
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_BAD_VALUE, new Object[]{name, value})); //name + " bad value " + value);
}
}
else
{
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUPPORTED, new Object[]{name})); //name + "not supported");
}
} } |
public class class_name {
public void marshall(RemoveAttributesRequest removeAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (removeAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(removeAttributesRequest.getApplicationId(), APPLICATIONID_BINDING);
protocolMarshaller.marshall(removeAttributesRequest.getAttributeType(), ATTRIBUTETYPE_BINDING);
protocolMarshaller.marshall(removeAttributesRequest.getUpdateAttributesRequest(), UPDATEATTRIBUTESREQUEST_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RemoveAttributesRequest removeAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (removeAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(removeAttributesRequest.getApplicationId(), APPLICATIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(removeAttributesRequest.getAttributeType(), ATTRIBUTETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(removeAttributesRequest.getUpdateAttributesRequest(), UPDATEATTRIBUTESREQUEST_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 synchronized static Object allocateNamedLock(String name) {
Object result = namedLocks.get(name);
if (result != null) {
namedLockUseCounts.put(name, namedLockUseCounts.get(name) + 1);
return result;
}
namedLockUseCounts.put(name, 1);
result = new Object();
namedLocks.put(name, result);
return result;
} } | public class class_name {
public synchronized static Object allocateNamedLock(String name) {
Object result = namedLocks.get(name);
if (result != null) {
namedLockUseCounts.put(name, namedLockUseCounts.get(name) + 1); // depends on control dependency: [if], data = [none]
return result; // depends on control dependency: [if], data = [none]
}
namedLockUseCounts.put(name, 1);
result = new Object();
namedLocks.put(name, result);
return result;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.