code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
private void addPostParams(final Request request) {
if (certificateData != null) {
request.addPostParam("CertificateData", certificateData);
}
if (friendlyName != null) {
request.addPostParam("FriendlyName", friendlyName);
}
if (deviceSid != null) {
request.addPostParam("DeviceSid", deviceSid);
}
} } | public class class_name {
private void addPostParams(final Request request) {
if (certificateData != null) {
request.addPostParam("CertificateData", certificateData); // depends on control dependency: [if], data = [none]
}
if (friendlyName != null) {
request.addPostParam("FriendlyName", friendlyName); // depends on control dependency: [if], data = [none]
}
if (deviceSid != null) {
request.addPostParam("DeviceSid", deviceSid); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public AiBlendMode getBlendMode() {
Property p = getProperty(PropertyKey.BLEND_MODE.m_key);
if (null == p || null == p.getData()) {
return (AiBlendMode) m_defaults.get(PropertyKey.BLEND_MODE);
}
return AiBlendMode.fromRawValue((Integer) p.getData());
} } | public class class_name {
public AiBlendMode getBlendMode() {
Property p = getProperty(PropertyKey.BLEND_MODE.m_key);
if (null == p || null == p.getData()) {
return (AiBlendMode) m_defaults.get(PropertyKey.BLEND_MODE); // depends on control dependency: [if], data = [none]
}
return AiBlendMode.fromRawValue((Integer) p.getData());
} } |
public class class_name {
public static TableLocation parse(String concatenatedTableLocation, Boolean isH2Database) {
List<String> parts = new LinkedList<String>();
String catalog,schema,table;
catalog = table = schema = "";
StringTokenizer st = new StringTokenizer(concatenatedTableLocation, ".`\"", true);
boolean openQuote = false;
StringBuilder sb = new StringBuilder();
while(st.hasMoreTokens()) {
String token = st.nextToken();
if(token.equals("`") || token.equals("\"")) {
openQuote = !openQuote;
} else if(token.equals(".")) {
if(openQuote) {
// Still in part
sb.append(token);
} else {
// end of part
parts.add(sb.toString());
sb = new StringBuilder();
}
} else {
if(!openQuote && isH2Database != null) {
token = capsIdentifier(token, isH2Database);
}
sb.append(token);
}
}
if(sb.length() != 0) {
parts.add(sb.toString());
}
String[] values = parts.toArray(new String[0]);
switch (values.length) {
case 1:
table = values[0].trim();
break;
case 2:
schema = values[0].trim();
table = values[1].trim();
break;
case 3:
catalog = values[0].trim();
schema = values[1].trim();
table = values[2].trim();
}
return new TableLocation(catalog,schema,table);
} } | public class class_name {
public static TableLocation parse(String concatenatedTableLocation, Boolean isH2Database) {
List<String> parts = new LinkedList<String>();
String catalog,schema,table;
catalog = table = schema = "";
StringTokenizer st = new StringTokenizer(concatenatedTableLocation, ".`\"", true);
boolean openQuote = false;
StringBuilder sb = new StringBuilder();
while(st.hasMoreTokens()) {
String token = st.nextToken();
if(token.equals("`") || token.equals("\"")) {
openQuote = !openQuote; // depends on control dependency: [if], data = [none]
} else if(token.equals(".")) {
if(openQuote) {
// Still in part
sb.append(token); // depends on control dependency: [if], data = [none]
} else {
// end of part
parts.add(sb.toString()); // depends on control dependency: [if], data = [none]
sb = new StringBuilder(); // depends on control dependency: [if], data = [none]
}
} else {
if(!openQuote && isH2Database != null) {
token = capsIdentifier(token, isH2Database); // depends on control dependency: [if], data = [none]
}
sb.append(token); // depends on control dependency: [if], data = [none]
}
}
if(sb.length() != 0) {
parts.add(sb.toString()); // depends on control dependency: [if], data = [none]
}
String[] values = parts.toArray(new String[0]);
switch (values.length) {
case 1:
table = values[0].trim();
break;
case 2:
schema = values[0].trim();
table = values[1].trim();
break;
case 3:
catalog = values[0].trim();
schema = values[1].trim();
table = values[2].trim();
}
return new TableLocation(catalog,schema,table);
} } |
public class class_name {
public Content deprecatedTagOutput(Element element) {
ContentBuilder result = new ContentBuilder();
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> deprs = utils.getBlockTags(element, DocTree.Kind.DEPRECATED);
if (utils.isTypeElement(element)) {
if (utils.isDeprecated(element)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element)));
result.addContent(RawHtml.nbsp);
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0));
if (!commentTags.isEmpty()) {
result.addContent(commentTagsToOutput(null, element, commentTags, false));
}
}
}
} else {
if (utils.isDeprecated(element)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element)));
result.addContent(RawHtml.nbsp);
if (!deprs.isEmpty()) {
List<? extends DocTree> bodyTags = ch.getBody(configuration, deprs.get(0));
Content body = commentTagsToOutput(null, element, bodyTags, false);
if (!body.isEmpty())
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
}
} else {
Element ee = utils.getEnclosingTypeElement(element);
if (utils.isDeprecated(ee)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(ee)));
result.addContent(RawHtml.nbsp);
}
}
}
return result;
} } | public class class_name {
public Content deprecatedTagOutput(Element element) {
ContentBuilder result = new ContentBuilder();
CommentHelper ch = utils.getCommentHelper(element);
List<? extends DocTree> deprs = utils.getBlockTags(element, DocTree.Kind.DEPRECATED);
if (utils.isTypeElement(element)) {
if (utils.isDeprecated(element)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element))); // depends on control dependency: [if], data = [none]
result.addContent(RawHtml.nbsp); // depends on control dependency: [if], data = [none]
if (!deprs.isEmpty()) {
List<? extends DocTree> commentTags = ch.getDescription(configuration, deprs.get(0)); // depends on control dependency: [if], data = [none]
if (!commentTags.isEmpty()) {
result.addContent(commentTagsToOutput(null, element, commentTags, false)); // depends on control dependency: [if], data = [none]
}
}
}
} else {
if (utils.isDeprecated(element)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(element))); // depends on control dependency: [if], data = [none]
result.addContent(RawHtml.nbsp); // depends on control dependency: [if], data = [none]
if (!deprs.isEmpty()) {
List<? extends DocTree> bodyTags = ch.getBody(configuration, deprs.get(0)); // depends on control dependency: [if], data = [none]
Content body = commentTagsToOutput(null, element, bodyTags, false);
if (!body.isEmpty())
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecationComment, body));
}
} else {
Element ee = utils.getEnclosingTypeElement(element);
if (utils.isDeprecated(ee)) {
result.addContent(HtmlTree.SPAN(HtmlStyle.deprecatedLabel,
htmlWriter.getDeprecatedPhrase(ee))); // depends on control dependency: [if], data = [none]
result.addContent(RawHtml.nbsp); // depends on control dependency: [if], data = [none]
}
}
}
return result;
} } |
public class class_name {
protected void expirePage(P page) {
if(LOG.isDebuggingFine()) {
LOG.debugFine("Write to backing:" + page.getPageID());
}
if (page.isDirty()) {
file.writePage(page);
}
} } | public class class_name {
protected void expirePage(P page) {
if(LOG.isDebuggingFine()) {
LOG.debugFine("Write to backing:" + page.getPageID()); // depends on control dependency: [if], data = [none]
}
if (page.isDirty()) {
file.writePage(page); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private MBeanParameterInfo[] buildOperationParameterInfo(Method method, JmxOperationInfo operationInfo) {
Class<?>[] types = method.getParameterTypes();
MBeanParameterInfo[] parameterInfos = new MBeanParameterInfo[types.length];
String[] parameterNames = operationInfo.getParameterNames();
String[] parameterDescriptions = operationInfo.getParameterDescriptions();
for (int i = 0; i < types.length; i++) {
String parameterName;
if (parameterNames == null || i >= parameterNames.length) {
parameterName = "p" + (i + 1);
} else {
parameterName = parameterNames[i];
}
String typeName = types[i].getName();
String description;
if (parameterDescriptions == null || i >= parameterDescriptions.length) {
description = "parameter #" + (i + 1) + " of type: " + typeName;
} else {
description = parameterDescriptions[i];
}
parameterInfos[i] = new MBeanParameterInfo(parameterName, typeName, description);
}
return parameterInfos;
} } | public class class_name {
private MBeanParameterInfo[] buildOperationParameterInfo(Method method, JmxOperationInfo operationInfo) {
Class<?>[] types = method.getParameterTypes();
MBeanParameterInfo[] parameterInfos = new MBeanParameterInfo[types.length];
String[] parameterNames = operationInfo.getParameterNames();
String[] parameterDescriptions = operationInfo.getParameterDescriptions();
for (int i = 0; i < types.length; i++) {
String parameterName;
if (parameterNames == null || i >= parameterNames.length) {
parameterName = "p" + (i + 1);
} else {
parameterName = parameterNames[i];
}
String typeName = types[i].getName();
String description;
if (parameterDescriptions == null || i >= parameterDescriptions.length) {
description = "parameter #" + (i + 1) + " of type: " + typeName; // depends on control dependency: [if], data = [none]
} else {
description = parameterDescriptions[i]; // depends on control dependency: [if], data = [none]
}
parameterInfos[i] = new MBeanParameterInfo(parameterName, typeName, description);
}
return parameterInfos;
} } |
public class class_name {
public ListOperationsResult withOperations(OperationSummary... operations) {
if (this.operations == null) {
setOperations(new java.util.ArrayList<OperationSummary>(operations.length));
}
for (OperationSummary ele : operations) {
this.operations.add(ele);
}
return this;
} } | public class class_name {
public ListOperationsResult withOperations(OperationSummary... operations) {
if (this.operations == null) {
setOperations(new java.util.ArrayList<OperationSummary>(operations.length)); // depends on control dependency: [if], data = [none]
}
for (OperationSummary ele : operations) {
this.operations.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
private boolean satisfiesAnyPath(IgnoredResourcesConfig config, String destination, String verb) {
if (destination == null || destination.trim().length() == 0) {
destination = "/"; //$NON-NLS-1$
}
for (IgnoredResource resource : config.getRules()) {
String resourceVerb = resource.getVerb();
boolean verbMatches = verb == null || IgnoredResource.VERB_MATCH_ALL.equals(resourceVerb)
|| verb.equalsIgnoreCase(resourceVerb); // $NON-NLS-1$
boolean destinationMatches = destination.matches(resource.getPathPattern());
if (verbMatches && destinationMatches) {
return true;
}
}
return false;
} } | public class class_name {
private boolean satisfiesAnyPath(IgnoredResourcesConfig config, String destination, String verb) {
if (destination == null || destination.trim().length() == 0) {
destination = "/"; //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
for (IgnoredResource resource : config.getRules()) {
String resourceVerb = resource.getVerb();
boolean verbMatches = verb == null || IgnoredResource.VERB_MATCH_ALL.equals(resourceVerb)
|| verb.equalsIgnoreCase(resourceVerb); // $NON-NLS-1$
boolean destinationMatches = destination.matches(resource.getPathPattern());
if (verbMatches && destinationMatches) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public synchronized RawFastaRecord takeRawRecord() {
RawFastaRecord rawFastaRecord;
try {
rawFastaRecord = nextRawRecord();
} catch (IOException e) {
throw new RuntimeException(e);
}
if (rawFastaRecord == null)
isFinished = true;
return rawFastaRecord;
} } | public class class_name {
public synchronized RawFastaRecord takeRawRecord() {
RawFastaRecord rawFastaRecord;
try {
rawFastaRecord = nextRawRecord(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
if (rawFastaRecord == null)
isFinished = true;
return rawFastaRecord;
} } |
public class class_name {
public SSLConfig relaxedHTTPSValidation(String protocol) {
AssertParameter.notNull(protocol, "Protocol");
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance(protocol);
} catch (NoSuchAlgorithmException e) {
return SafeExceptionRethrower.safeRethrow(e);
}
// Set up a TrustManager that trusts everything
try {
sslContext.init(null, new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}}, new SecureRandom());
} catch (KeyManagementException e) {
return SafeExceptionRethrower.safeRethrow(e);
}
SSLSocketFactory sf = new SSLSocketFactory(sslContext, ALLOW_ALL_HOSTNAME_VERIFIER);
return sslSocketFactory(sf);
} } | public class class_name {
public SSLConfig relaxedHTTPSValidation(String protocol) {
AssertParameter.notNull(protocol, "Protocol");
SSLContext sslContext;
try {
sslContext = SSLContext.getInstance(protocol); // depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
return SafeExceptionRethrower.safeRethrow(e);
} // depends on control dependency: [catch], data = [none]
// Set up a TrustManager that trusts everything
try {
sslContext.init(null, new TrustManager[]{new X509TrustManager() {
public X509Certificate[] getAcceptedIssuers() {
return null;
}
public void checkClientTrusted(X509Certificate[] certs, String authType) {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) {
}
}}, new SecureRandom()); // depends on control dependency: [try], data = [none]
} catch (KeyManagementException e) {
return SafeExceptionRethrower.safeRethrow(e);
} // depends on control dependency: [catch], data = [none]
SSLSocketFactory sf = new SSLSocketFactory(sslContext, ALLOW_ALL_HOSTNAME_VERIFIER);
return sslSocketFactory(sf);
} } |
public class class_name {
public static boolean isSkewSymmetric(DMatrixRMaj A , double tol ){
if( A.numCols != A.numRows )
return false;
for( int i = 0; i < A.numRows; i++ ) {
for( int j = 0; j < i; j++ ) {
double a = A.get(i,j);
double b = A.get(j,i);
double diff = Math.abs(a+b);
if( !(diff <= tol) ) {
return false;
}
}
}
return true;
} } | public class class_name {
public static boolean isSkewSymmetric(DMatrixRMaj A , double tol ){
if( A.numCols != A.numRows )
return false;
for( int i = 0; i < A.numRows; i++ ) {
for( int j = 0; j < i; j++ ) {
double a = A.get(i,j);
double b = A.get(j,i);
double diff = Math.abs(a+b);
if( !(diff <= tol) ) {
return false; // depends on control dependency: [if], data = [none]
}
}
}
return true;
} } |
public class class_name {
public static String getSystemProperty(String key, @Nullable String defaultValue) {
String value;
try {
value = System.getProperty(key);
} catch (AccessControlException ex) {
return defaultValue;
}
return value != null ? value : defaultValue;
} } | public class class_name {
public static String getSystemProperty(String key, @Nullable String defaultValue) {
String value;
try {
value = System.getProperty(key); // depends on control dependency: [try], data = [none]
} catch (AccessControlException ex) {
return defaultValue;
} // depends on control dependency: [catch], data = [none]
return value != null ? value : defaultValue;
} } |
public class class_name {
private void close()
{
lock.lock();
try {
for (SocketBase s : sockets) {
try {
s.setSocketOpt(ZMQ.ZMQ_LINGER, 0);
s.close();
}
catch (Exception ignore) {
}
}
sockets.clear();
}
finally {
lock.unlock();
}
} } | public class class_name {
private void close()
{
lock.lock();
try {
for (SocketBase s : sockets) {
try {
s.setSocketOpt(ZMQ.ZMQ_LINGER, 0); // depends on control dependency: [try], data = [none]
s.close(); // depends on control dependency: [try], data = [none]
}
catch (Exception ignore) {
} // depends on control dependency: [catch], data = [none]
}
sockets.clear(); // depends on control dependency: [try], data = [none]
}
finally {
lock.unlock();
}
} } |
public class class_name {
public void setSelection(String[] selection) {
for (String sel : selection) {
for (int j = 0; j < mItems.length; ++j) {
if (mItems[j].equals(sel)) {
mSelection[j] = true;
}
}
}
refreshDisplayValue();
} } | public class class_name {
public void setSelection(String[] selection) {
for (String sel : selection) {
for (int j = 0; j < mItems.length; ++j) {
if (mItems[j].equals(sel)) {
mSelection[j] = true; // depends on control dependency: [if], data = [none]
}
}
}
refreshDisplayValue();
} } |
public class class_name {
public static void putPropertiesIntoConfiguration(Properties properties, Configuration configuration) {
for (String name : properties.stringPropertyNames()) {
configuration.set(name, properties.getProperty(name));
}
} } | public class class_name {
public static void putPropertiesIntoConfiguration(Properties properties, Configuration configuration) {
for (String name : properties.stringPropertyNames()) {
configuration.set(name, properties.getProperty(name)); // depends on control dependency: [for], data = [name]
}
} } |
public class class_name {
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsFailureUrlCQ> queryLambda,
ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsFailureUrlCA> aggsLambda) {
FailureUrlCQ cq = new FailureUrlCQ();
if (queryLambda != null) {
queryLambda.callback(cq);
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder);
}
if (aggsLambda != null) {
FailureUrlCA ca = new FailureUrlCA();
aggsLambda.callback(ca);
ca.getAggregationBuilderList().forEach(builder::subAggregation);
}
} } | public class class_name {
public void filter(String name, EsAbstractConditionQuery.OperatorCall<BsFailureUrlCQ> queryLambda,
ConditionOptionCall<FilterAggregationBuilder> opLambda, OperatorCall<BsFailureUrlCA> aggsLambda) {
FailureUrlCQ cq = new FailureUrlCQ();
if (queryLambda != null) {
queryLambda.callback(cq); // depends on control dependency: [if], data = [none]
}
FilterAggregationBuilder builder = regFilterA(name, cq.getQuery());
if (opLambda != null) {
opLambda.callback(builder); // depends on control dependency: [if], data = [none]
}
if (aggsLambda != null) {
FailureUrlCA ca = new FailureUrlCA();
aggsLambda.callback(ca); // depends on control dependency: [if], data = [none]
ca.getAggregationBuilderList().forEach(builder::subAggregation); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String collToCSVString(Iterable<?> strIterable) {
StringBuilder buffer = new StringBuilder();
for (Object value : strIterable) {
if (buffer.length() > 0) {
buffer.append(", ");
}
buffer.append(value.toString());
}
return buffer.toString();
} } | public class class_name {
public static String collToCSVString(Iterable<?> strIterable) {
StringBuilder buffer = new StringBuilder();
for (Object value : strIterable) {
if (buffer.length() > 0) {
buffer.append(", ");
// depends on control dependency: [if], data = [none]
}
buffer.append(value.toString());
// depends on control dependency: [for], data = [value]
}
return buffer.toString();
} } |
public class class_name {
public String getMessage(Throwable exception) {
String message;
if (getExceptionToMessage() != null) {
message = getExceptionToMessage().get(exception.getClass());
if (StringUtils.hasText(message)) {
return message;
}
// map entry with a null value
if (getExceptionToMessage().containsKey(exception.getClass())) {
return exception.getMessage();
}
}
if (isSendExceptionMessage()) {
return exception.getMessage();
}
return getDefaultExceptionMessage();
} } | public class class_name {
public String getMessage(Throwable exception) {
String message;
if (getExceptionToMessage() != null) {
message = getExceptionToMessage().get(exception.getClass()); // depends on control dependency: [if], data = [none]
if (StringUtils.hasText(message)) {
return message; // depends on control dependency: [if], data = [none]
}
// map entry with a null value
if (getExceptionToMessage().containsKey(exception.getClass())) {
return exception.getMessage(); // depends on control dependency: [if], data = [none]
}
}
if (isSendExceptionMessage()) {
return exception.getMessage(); // depends on control dependency: [if], data = [none]
}
return getDefaultExceptionMessage();
} } |
public class class_name {
static List<URL> bringStageAndProtoLibsToFront(String stageLibName, List<URL> urls) {
List<URL> otherJars = new ArrayList<>();
List<URL> protolibJars = new ArrayList<>();
List<URL> stageLibjars = new ArrayList<>();
for (URL url : urls) {
String str = url.toExternalForm();
if (str.endsWith(".jar")) {
int nameIdx = str.lastIndexOf("/");
if (nameIdx > -1) {
String jarName = str.substring(nameIdx + 1);
if (jarName.contains("-protolib-")) {
// adding only protolib jars
protolibJars.add(url);
} else if (jarName.contains(stageLibName)) {
stageLibjars.add(url);
} else {
otherJars.add(url);
}
} else {
otherJars.add(url);
}
} else {
otherJars.add(url);
}
}
List<URL> allJars = new ArrayList<>();
if (stageLibjars.size() != 1) {
throw new ExceptionInInitializerError("Expected exactly 1 stage lib jar but found " + stageLibjars.size() +
" with name " + stageLibName);
}
allJars.addAll(stageLibjars);
allJars.addAll(protolibJars);
allJars.addAll(otherJars);
return allJars;
} } | public class class_name {
static List<URL> bringStageAndProtoLibsToFront(String stageLibName, List<URL> urls) {
List<URL> otherJars = new ArrayList<>();
List<URL> protolibJars = new ArrayList<>();
List<URL> stageLibjars = new ArrayList<>();
for (URL url : urls) {
String str = url.toExternalForm();
if (str.endsWith(".jar")) {
int nameIdx = str.lastIndexOf("/");
if (nameIdx > -1) {
String jarName = str.substring(nameIdx + 1);
if (jarName.contains("-protolib-")) {
// adding only protolib jars
protolibJars.add(url); // depends on control dependency: [if], data = [none]
} else if (jarName.contains(stageLibName)) {
stageLibjars.add(url); // depends on control dependency: [if], data = [none]
} else {
otherJars.add(url); // depends on control dependency: [if], data = [none]
}
} else {
otherJars.add(url); // depends on control dependency: [if], data = [none]
}
} else {
otherJars.add(url); // depends on control dependency: [if], data = [none]
}
}
List<URL> allJars = new ArrayList<>();
if (stageLibjars.size() != 1) {
throw new ExceptionInInitializerError("Expected exactly 1 stage lib jar but found " + stageLibjars.size() +
" with name " + stageLibName);
}
allJars.addAll(stageLibjars);
allJars.addAll(protolibJars);
allJars.addAll(otherJars);
return allJars;
} } |
public class class_name {
protected int score(MediaType contentTypeFromRequest, MediaType... expectedTypes) {
if (contentTypeFromRequest == null) {
return DEFAULT_SCORE;
}
for (MediaType expected : expectedTypes) {
if (contentTypeFromRequest.matches(expected)) {
return MAXIMUM_FORMAT_SCORE;
}
}
return DEFAULT_SCORE;
} } | public class class_name {
protected int score(MediaType contentTypeFromRequest, MediaType... expectedTypes) {
if (contentTypeFromRequest == null) {
return DEFAULT_SCORE; // depends on control dependency: [if], data = [none]
}
for (MediaType expected : expectedTypes) {
if (contentTypeFromRequest.matches(expected)) {
return MAXIMUM_FORMAT_SCORE; // depends on control dependency: [if], data = [none]
}
}
return DEFAULT_SCORE;
} } |
public class class_name {
private String readUid(File uidFile) {
String uid = null;
// Try to read the shared UID
try (BufferedReader br = new BufferedReader(new FileReader(uidFile))) {
String line;
while ((line = br.readLine()) != null) {
uid = line;
}
} catch (IOException ioe) {
}
return uid;
} } | public class class_name {
private String readUid(File uidFile) {
String uid = null;
// Try to read the shared UID
try (BufferedReader br = new BufferedReader(new FileReader(uidFile))) {
String line;
while ((line = br.readLine()) != null) {
uid = line; // depends on control dependency: [while], data = [none]
}
} catch (IOException ioe) {
}
return uid;
} } |
public class class_name {
@Override
public List<String> getObjectHistory(String pid) {
MessageContext ctx = context.getMessageContext();
Context context = ReadOnlyContext.getSoapContext(ctx);
assertInitialized();
try {
String[] changeTimestamps = m_access.getObjectHistory(context, pid);
if (changeTimestamps != null && debug) {
for (int i = 0; i < changeTimestamps.length; i++) {
LOG.debug("changeTimestamps[{}] = {}", i, changeTimestamps[i]);
}
}
return changeTimestamps == null ? null : Arrays.asList(changeTimestamps);
} catch (Throwable th) {
LOG.error("Error getting object history", th);
throw CXFUtility.getFault(th);
}
} } | public class class_name {
@Override
public List<String> getObjectHistory(String pid) {
MessageContext ctx = context.getMessageContext();
Context context = ReadOnlyContext.getSoapContext(ctx);
assertInitialized();
try {
String[] changeTimestamps = m_access.getObjectHistory(context, pid);
if (changeTimestamps != null && debug) {
for (int i = 0; i < changeTimestamps.length; i++) {
LOG.debug("changeTimestamps[{}] = {}", i, changeTimestamps[i]); // depends on control dependency: [for], data = [i]
}
}
return changeTimestamps == null ? null : Arrays.asList(changeTimestamps); // depends on control dependency: [try], data = [none]
} catch (Throwable th) {
LOG.error("Error getting object history", th);
throw CXFUtility.getFault(th);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static double minAbsolute(FlatDataCollection flatDataCollection) {
double minAbs=Double.POSITIVE_INFINITY;
Iterator<Double> it = flatDataCollection.iteratorDouble();
while(it.hasNext()) {
Double v = it.next();
if(v != null) {
minAbs= Math.min(minAbs, Math.abs(v));
}
}
return minAbs;
} } | public class class_name {
public static double minAbsolute(FlatDataCollection flatDataCollection) {
double minAbs=Double.POSITIVE_INFINITY;
Iterator<Double> it = flatDataCollection.iteratorDouble();
while(it.hasNext()) {
Double v = it.next();
if(v != null) {
minAbs= Math.min(minAbs, Math.abs(v)); // depends on control dependency: [if], data = [(v]
}
}
return minAbs;
} } |
public class class_name {
@Override
public long getMaxX() {
if (!excludeOutOfRangeValues) {
return super.getMaxX();
} else {
long retMax = 0;
Iterator<Long> iter = values.keySet().iterator();
if (iter.hasNext()) {
retMax = iter.next();
}
long excludeValue = getGranulationValue() * excludeCount;
while (iter.hasNext()) {
long value = iter.next();
if (value > retMax) {
if ((value - retMax) < excludeValue) {
retMax = value;
}
}
}
return retMax;
}
} } | public class class_name {
@Override
public long getMaxX() {
if (!excludeOutOfRangeValues) {
return super.getMaxX(); // depends on control dependency: [if], data = [none]
} else {
long retMax = 0;
Iterator<Long> iter = values.keySet().iterator();
if (iter.hasNext()) {
retMax = iter.next(); // depends on control dependency: [if], data = [none]
}
long excludeValue = getGranulationValue() * excludeCount;
while (iter.hasNext()) {
long value = iter.next();
if (value > retMax) {
if ((value - retMax) < excludeValue) {
retMax = value; // depends on control dependency: [if], data = [none]
}
}
}
return retMax; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static JAXBSerialiser getMoxy(String contextPath)
{
if (log.isTraceEnabled())
log.trace("Create moxy serialiser for " + contextPath);
try
{
JAXBContext ctx = org.eclipse.persistence.jaxb.JAXBContext.newInstance(contextPath);
return getInstance(ctx);
}
catch (JAXBException e)
{
throw new JAXBRuntimeException(e);
}
} } | public class class_name {
public static JAXBSerialiser getMoxy(String contextPath)
{
if (log.isTraceEnabled())
log.trace("Create moxy serialiser for " + contextPath);
try
{
JAXBContext ctx = org.eclipse.persistence.jaxb.JAXBContext.newInstance(contextPath);
return getInstance(ctx); // depends on control dependency: [try], data = [none]
}
catch (JAXBException e)
{
throw new JAXBRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Nullable
public static TreePath findEnclosingMethodOrLambdaOrInitializer(TreePath path) {
TreePath curPath = path.getParentPath();
while (curPath != null) {
if (curPath.getLeaf() instanceof MethodTree
|| curPath.getLeaf() instanceof LambdaExpressionTree) {
return curPath;
}
TreePath parent = curPath.getParentPath();
if (parent != null && parent.getLeaf() instanceof ClassTree) {
if (curPath.getLeaf() instanceof BlockTree) {
// found initializer block
return curPath;
}
if (curPath.getLeaf() instanceof VariableTree
&& ((VariableTree) curPath.getLeaf()).getInitializer() != null) {
// found field with an inline initializer
return curPath;
}
}
curPath = parent;
}
return null;
} } | public class class_name {
@Nullable
public static TreePath findEnclosingMethodOrLambdaOrInitializer(TreePath path) {
TreePath curPath = path.getParentPath();
while (curPath != null) {
if (curPath.getLeaf() instanceof MethodTree
|| curPath.getLeaf() instanceof LambdaExpressionTree) {
return curPath; // depends on control dependency: [if], data = [none]
}
TreePath parent = curPath.getParentPath();
if (parent != null && parent.getLeaf() instanceof ClassTree) {
if (curPath.getLeaf() instanceof BlockTree) {
// found initializer block
return curPath; // depends on control dependency: [if], data = [none]
}
if (curPath.getLeaf() instanceof VariableTree
&& ((VariableTree) curPath.getLeaf()).getInitializer() != null) {
// found field with an inline initializer
return curPath; // depends on control dependency: [if], data = [none]
}
}
curPath = parent; // depends on control dependency: [while], data = [none]
}
return null;
} } |
public class class_name {
public Calendar calendarValue()
{
Calendar cal = new GregorianCalendar(_Private_Utils.UTC);
long millis = getMillis();
Integer offset = _offset;
if (offset != null && offset != 0)
{
int offsetMillis = offset * 60 * 1000;
millis += offsetMillis;
cal.setTimeInMillis(millis); // Resets the offset!
cal.set(Calendar.ZONE_OFFSET, offsetMillis);
}
else
{
cal.setTimeInMillis(millis);
}
switch (_precision) {
case YEAR:
cal.clear(Calendar.MONTH);
case MONTH:
cal.clear(Calendar.DAY_OF_MONTH);
case DAY:
cal.clear(Calendar.HOUR_OF_DAY);
cal.clear(Calendar.MINUTE);
case MINUTE:
cal.clear(Calendar.SECOND);
cal.clear(Calendar.MILLISECOND);
case SECOND:
if (_fraction == null) {
cal.clear(Calendar.MILLISECOND);
}
}
return cal;
} } | public class class_name {
public Calendar calendarValue()
{
Calendar cal = new GregorianCalendar(_Private_Utils.UTC);
long millis = getMillis();
Integer offset = _offset;
if (offset != null && offset != 0)
{
int offsetMillis = offset * 60 * 1000;
millis += offsetMillis; // depends on control dependency: [if], data = [none]
cal.setTimeInMillis(millis); // Resets the offset! // depends on control dependency: [if], data = [none]
cal.set(Calendar.ZONE_OFFSET, offsetMillis); // depends on control dependency: [if], data = [none]
}
else
{
cal.setTimeInMillis(millis); // depends on control dependency: [if], data = [none]
}
switch (_precision) {
case YEAR:
cal.clear(Calendar.MONTH);
case MONTH:
cal.clear(Calendar.DAY_OF_MONTH);
case DAY:
cal.clear(Calendar.HOUR_OF_DAY);
cal.clear(Calendar.MINUTE);
case MINUTE:
cal.clear(Calendar.SECOND);
cal.clear(Calendar.MILLISECOND);
case SECOND:
if (_fraction == null) {
cal.clear(Calendar.MILLISECOND); // depends on control dependency: [if], data = [none]
}
}
return cal;
} } |
public class class_name {
public SymbolReference<ResolvedMethodDeclaration> solve(MethodCallExpr methodCallExpr, boolean solveLambdas) {
List<ResolvedType> argumentTypes = new LinkedList<>();
List<LambdaArgumentTypePlaceholder> placeholders = new LinkedList<>();
solveArguments(methodCallExpr, methodCallExpr.getArguments(), solveLambdas, argumentTypes, placeholders);
SymbolReference<ResolvedMethodDeclaration> res = JavaParserFactory.getContext(methodCallExpr, typeSolver).solveMethod(methodCallExpr.getName().getId(), argumentTypes, false, typeSolver);
for (LambdaArgumentTypePlaceholder placeholder : placeholders) {
placeholder.setMethod(res);
}
return res;
} } | public class class_name {
public SymbolReference<ResolvedMethodDeclaration> solve(MethodCallExpr methodCallExpr, boolean solveLambdas) {
List<ResolvedType> argumentTypes = new LinkedList<>();
List<LambdaArgumentTypePlaceholder> placeholders = new LinkedList<>();
solveArguments(methodCallExpr, methodCallExpr.getArguments(), solveLambdas, argumentTypes, placeholders);
SymbolReference<ResolvedMethodDeclaration> res = JavaParserFactory.getContext(methodCallExpr, typeSolver).solveMethod(methodCallExpr.getName().getId(), argumentTypes, false, typeSolver);
for (LambdaArgumentTypePlaceholder placeholder : placeholders) {
placeholder.setMethod(res); // depends on control dependency: [for], data = [placeholder]
}
return res;
} } |
public class class_name {
public void changeRemoteDate(Application application, String strParams, CachedItem productItem, Date dateStart, Date dateEnd)
{
//+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Lookup.gif", "Lookup"), CalendarConstants.START_ICON + 1);
//x this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Price.gif", "Price"), CalendarConstants.START_ICON + 2);
productItem.setStatus(productItem.getStatus() | (1 << 2));
//+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Inventory.gif", "Inventory"), CalendarConstants.START_ICON + 3);
//+ if (application == null)
//+ application = BaseApplet.getSharedInstance().getApplication();
// Step 1 - Send a message to the subscriber that I want to lookup the date, price, and inventory.
//+ CalendarDateChangeMessage message = new CalendarDateChangeMessage(strParams, productItem, dateStart, dateEnd);
// Step 2 - Listen for messages that modify this object's information
// I could potentially get 3 messages back: 1. chg date 2. set price 3. set avail.
// message.getModel();
//x application.getTaskScheduler().addTask(message);
//+ this.sendMessage(new CalendarDateChangeMessage(application, strParams, productItem, dateStart, dateEnd));
BaseApplet applet = BaseApplet.getSharedInstance();
try {
//+ if (database == null)
MessageSender sendQueue = null;
String strSendQueueName = "lookupHotelRate";
Map<String,Object> properties = new Hashtable<String,Object>();
properties.put("rateType", "Rack");
properties.put("roomClass", "Single");
MessageManager messageManager = applet.getApplication().getMessageManager();
sendQueue = messageManager.getMessageQueue(strSendQueueName, null).getMessageSender();
if (gbFirstTime)
{
BaseMessageReceiver handler = (BaseMessageReceiver)messageManager.getMessageQueue("sendHotelRate", null).getMessageReceiver();
/*?JMessageListener listener =*/ new CalendarMessageListener(handler, m_model);
gbFirstTime = false;
}
properties.put("correlationID", Integer.toString(this.hashCode()));
sendQueue.sendMessage(new MapMessage(null, properties)); // See ya!
} catch (Exception ex) {
ex.printStackTrace();
}
} } | public class class_name {
public void changeRemoteDate(Application application, String strParams, CachedItem productItem, Date dateStart, Date dateEnd)
{
//+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Lookup.gif", "Lookup"), CalendarConstants.START_ICON + 1);
//x this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Price.gif", "Price"), CalendarConstants.START_ICON + 2);
productItem.setStatus(productItem.getStatus() | (1 << 2));
//+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Inventory.gif", "Inventory"), CalendarConstants.START_ICON + 3);
//+ if (application == null)
//+ application = BaseApplet.getSharedInstance().getApplication();
// Step 1 - Send a message to the subscriber that I want to lookup the date, price, and inventory.
//+ CalendarDateChangeMessage message = new CalendarDateChangeMessage(strParams, productItem, dateStart, dateEnd);
// Step 2 - Listen for messages that modify this object's information
// I could potentially get 3 messages back: 1. chg date 2. set price 3. set avail.
// message.getModel();
//x application.getTaskScheduler().addTask(message);
//+ this.sendMessage(new CalendarDateChangeMessage(application, strParams, productItem, dateStart, dateEnd));
BaseApplet applet = BaseApplet.getSharedInstance();
try {
//+ if (database == null)
MessageSender sendQueue = null;
String strSendQueueName = "lookupHotelRate";
Map<String,Object> properties = new Hashtable<String,Object>();
properties.put("rateType", "Rack"); // depends on control dependency: [try], data = [none]
properties.put("roomClass", "Single"); // depends on control dependency: [try], data = [none]
MessageManager messageManager = applet.getApplication().getMessageManager();
sendQueue = messageManager.getMessageQueue(strSendQueueName, null).getMessageSender(); // depends on control dependency: [try], data = [none]
if (gbFirstTime)
{
BaseMessageReceiver handler = (BaseMessageReceiver)messageManager.getMessageQueue("sendHotelRate", null).getMessageReceiver();
/*?JMessageListener listener =*/ new CalendarMessageListener(handler, m_model); // depends on control dependency: [if], data = [none]
gbFirstTime = false; // depends on control dependency: [if], data = [none]
}
properties.put("correlationID", Integer.toString(this.hashCode())); // depends on control dependency: [try], data = [none]
sendQueue.sendMessage(new MapMessage(null, properties)); // See ya! // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@SuppressWarnings("nls")
public List<BucketDataPointBean> getCounterData(String tenantId, String counterId, Date from, Date to,
BucketSizeType bucketSize) {
try {
StringBuilder params = new StringBuilder();
params.append("?")
.append("start=")
.append(from.getTime())
.append("&end=")
.append(to.getTime())
.append("&bucketDuration=")
.append(bucketSize.getValue());
URL endpoint = serverUrl.toURI().resolve("counters/" + counterId + "/stats" + params.toString()).toURL(); //$NON-NLS-1$
Request request = new Request.Builder()
.url(endpoint)
.header("Accept", "application/json") //$NON-NLS-1$ //$NON-NLS-2$
.header("Hawkular-Tenant", tenantId) //$NON-NLS-1$
.build();
Response response = httpClient.newCall(request).execute();
if (response.code() >= 400) {
throw hawkularMetricsError(response);
}
if (response.code() == 204) {
return Collections.EMPTY_LIST;
}
String responseBody = response.body().string();
return readMapper.reader(new TypeReference<List<BucketDataPointBean>>() {}).readValue(responseBody);
} catch (URISyntaxException | IOException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
@SuppressWarnings("nls")
public List<BucketDataPointBean> getCounterData(String tenantId, String counterId, Date from, Date to,
BucketSizeType bucketSize) {
try {
StringBuilder params = new StringBuilder();
params.append("?")
.append("start=")
.append(from.getTime())
.append("&end=")
.append(to.getTime())
.append("&bucketDuration=")
.append(bucketSize.getValue()); // depends on control dependency: [try], data = [none]
URL endpoint = serverUrl.toURI().resolve("counters/" + counterId + "/stats" + params.toString()).toURL(); //$NON-NLS-1$
Request request = new Request.Builder()
.url(endpoint)
.header("Accept", "application/json") //$NON-NLS-1$ //$NON-NLS-2$
.header("Hawkular-Tenant", tenantId) //$NON-NLS-1$
.build();
Response response = httpClient.newCall(request).execute();
if (response.code() >= 400) {
throw hawkularMetricsError(response);
}
if (response.code() == 204) {
return Collections.EMPTY_LIST; // depends on control dependency: [if], data = [none]
}
String responseBody = response.body().string();
return readMapper.reader(new TypeReference<List<BucketDataPointBean>>() {}).readValue(responseBody); // depends on control dependency: [try], data = [none]
} catch (URISyntaxException | IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public int getValue(int x, int y, final int boundaryMode){
if(x < 0 || y < 0 || x >= this.width || y >= this.height){
switch (boundaryMode) {
case boundary_mode_zero:
return 0;
case boundary_mode_repeat_edge:
x = (x < 0 ? 0: (x >= this.width ? this.width-1:x));
y = (y < 0 ? 0: (y >= this.height ? this.height-1:y));
return getValue(x, y);
case boundary_mode_repeat_image:
x = (this.width + (x % this.width)) % this.width;
y = (this.height + (y % this.height)) % this.height;
return getValue(x,y);
case boundary_mode_mirror:
if(x < 0){ // mirror x to right side of image
x = -x - 1;
}
if(y < 0 ){ // mirror y to bottom side of image
y = -y - 1;
}
x = (x/this.width) % 2 == 0 ? (x%this.width) : (this.width-1)-(x%this.width);
y = (y/this.height) % 2 == 0 ? (y%this.height) : (this.height-1)-(y%this.height);
return getValue(x, y);
default:
return boundaryMode; // boundary mode can be default color
}
} else {
return getValue(x, y);
}
} } | public class class_name {
public int getValue(int x, int y, final int boundaryMode){
if(x < 0 || y < 0 || x >= this.width || y >= this.height){
switch (boundaryMode) {
case boundary_mode_zero:
return 0;
case boundary_mode_repeat_edge:
x = (x < 0 ? 0: (x >= this.width ? this.width-1:x));
y = (y < 0 ? 0: (y >= this.height ? this.height-1:y));
return getValue(x, y);
case boundary_mode_repeat_image:
x = (this.width + (x % this.width)) % this.width;
y = (this.height + (y % this.height)) % this.height;
return getValue(x,y);
case boundary_mode_mirror:
if(x < 0){ // mirror x to right side of image
x = -x - 1; // depends on control dependency: [if], data = [none]
}
if(y < 0 ){ // mirror y to bottom side of image
y = -y - 1; // depends on control dependency: [if], data = [none]
}
x = (x/this.width) % 2 == 0 ? (x%this.width) : (this.width-1)-(x%this.width);
y = (y/this.height) % 2 == 0 ? (y%this.height) : (this.height-1)-(y%this.height);
return getValue(x, y);
default:
return boundaryMode; // boundary mode can be default color
}
} else {
return getValue(x, y); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private static <V> IntTree<V> rebalanced(final long key, final V value,
final IntTree<V> left, final IntTree<V> right) {
if(left.size + right.size > 1) {
if(left.size >= OMEGA*right.size) { // rotate to the right
IntTree<V> ll = left.left, lr = left.right;
if(lr.size < ALPHA*ll.size) // single rotation
return new IntTree<V>(left.key+key, left.value,
ll,
new IntTree<V>(-left.key, value,
lr.withKey(lr.key+left.key),
right));
else { // double rotation:
IntTree<V> lrl = lr.left, lrr = lr.right;
return new IntTree<V>(lr.key+left.key+key, lr.value,
new IntTree<V>(-lr.key, left.value,
ll,
lrl.withKey(lrl.key+lr.key)),
new IntTree<V>(-left.key-lr.key, value,
lrr.withKey(lrr.key+lr.key+left.key),
right));
}
}
else if(right.size >= OMEGA*left.size) { // rotate to the left
IntTree<V> rl = right.left, rr = right.right;
if(rl.size < ALPHA*rr.size) // single rotation
return new IntTree<V>(right.key+key, right.value,
new IntTree<V>(-right.key, value,
left,
rl.withKey(rl.key+right.key)),
rr);
else { // double rotation:
IntTree<V> rll = rl.left, rlr = rl.right;
return new IntTree<V>(rl.key+right.key+key, rl.value,
new IntTree<V>(-right.key-rl.key, value,
left,
rll.withKey(rll.key+rl.key+right.key)),
new IntTree<V>(-rl.key, right.value,
rlr.withKey(rlr.key+rl.key),
rr));
}
}
}
// otherwise already balanced enough:
return new IntTree<V>(key, value, left, right);
} } | public class class_name {
private static <V> IntTree<V> rebalanced(final long key, final V value,
final IntTree<V> left, final IntTree<V> right) {
if(left.size + right.size > 1) {
if(left.size >= OMEGA*right.size) { // rotate to the right
IntTree<V> ll = left.left, lr = left.right;
if(lr.size < ALPHA*ll.size) // single rotation
return new IntTree<V>(left.key+key, left.value,
ll,
new IntTree<V>(-left.key, value,
lr.withKey(lr.key+left.key),
right));
else { // double rotation:
IntTree<V> lrl = lr.left, lrr = lr.right;
return new IntTree<V>(lr.key+left.key+key, lr.value,
new IntTree<V>(-lr.key, left.value,
ll,
lrl.withKey(lrl.key+lr.key)),
new IntTree<V>(-left.key-lr.key, value,
lrr.withKey(lrr.key+lr.key+left.key),
right)); // depends on control dependency: [if], data = [none]
}
}
else if(right.size >= OMEGA*left.size) { // rotate to the left
IntTree<V> rl = right.left, rr = right.right;
if(rl.size < ALPHA*rr.size) // single rotation
return new IntTree<V>(right.key+key, right.value,
new IntTree<V>(-right.key, value,
left,
rl.withKey(rl.key+right.key)),
rr);
else { // double rotation:
IntTree<V> rll = rl.left, rlr = rl.right;
return new IntTree<V>(rl.key+right.key+key, rl.value,
new IntTree<V>(-right.key-rl.key, value,
left,
rll.withKey(rll.key+rl.key+right.key)),
new IntTree<V>(-rl.key, right.value,
rlr.withKey(rlr.key+rl.key),
rr)); // depends on control dependency: [if], data = [none]
}
}
}
// otherwise already balanced enough:
return new IntTree<V>(key, value, left, right);
} } |
public class class_name {
public static Map getAllProperties(Class clazz)
throws IntrospectionException {
synchronized (cPropertiesCache) {
Map properties;
Reference ref = (Reference)cPropertiesCache.get(clazz);
if (ref != null) {
properties = (Map)ref.get();
if (properties != null) {
return properties;
}
else {
// Clean up cleared reference.
cPropertiesCache.remove(clazz);
}
}
properties = Collections.unmodifiableMap(createProperties(clazz));
cPropertiesCache.put(clazz, new SoftReference(properties));
return properties;
}
} } | public class class_name {
public static Map getAllProperties(Class clazz)
throws IntrospectionException {
synchronized (cPropertiesCache) {
Map properties;
Reference ref = (Reference)cPropertiesCache.get(clazz);
if (ref != null) {
properties = (Map)ref.get(); // depends on control dependency: [if], data = [none]
if (properties != null) {
return properties; // depends on control dependency: [if], data = [none]
}
else {
// Clean up cleared reference.
cPropertiesCache.remove(clazz); // depends on control dependency: [if], data = [none]
}
}
properties = Collections.unmodifiableMap(createProperties(clazz));
cPropertiesCache.put(clazz, new SoftReference(properties));
return properties;
}
} } |
public class class_name {
private boolean handleNonReadyStatus() {
synchronized (this.syncObject) {
Status nodeStatus = this.node.getStatus();
boolean quickFinish = false;
final long time = System.currentTimeMillis();
if (Status.isStatusFinished(nodeStatus)) {
quickFinish = true;
} else if (nodeStatus == Status.DISABLED) {
nodeStatus = changeStatus(Status.SKIPPED, time);
quickFinish = true;
} else if (this.isKilled()) {
nodeStatus = changeStatus(Status.KILLED, time);
quickFinish = true;
}
if (quickFinish) {
this.node.setStartTime(time);
fireEvent(
Event.create(this, EventType.JOB_STARTED,
new EventData(nodeStatus, this.node.getNestedId())));
this.node.setEndTime(time);
fireEvent(
Event
.create(this, EventType.JOB_FINISHED,
new EventData(nodeStatus, this.node.getNestedId())));
return true;
}
return false;
}
} } | public class class_name {
private boolean handleNonReadyStatus() {
synchronized (this.syncObject) {
Status nodeStatus = this.node.getStatus();
boolean quickFinish = false;
final long time = System.currentTimeMillis();
if (Status.isStatusFinished(nodeStatus)) {
quickFinish = true; // depends on control dependency: [if], data = [none]
} else if (nodeStatus == Status.DISABLED) {
nodeStatus = changeStatus(Status.SKIPPED, time); // depends on control dependency: [if], data = [none]
quickFinish = true; // depends on control dependency: [if], data = [none]
} else if (this.isKilled()) {
nodeStatus = changeStatus(Status.KILLED, time); // depends on control dependency: [if], data = [none]
quickFinish = true; // depends on control dependency: [if], data = [none]
}
if (quickFinish) {
this.node.setStartTime(time); // depends on control dependency: [if], data = [none]
fireEvent(
Event.create(this, EventType.JOB_STARTED,
new EventData(nodeStatus, this.node.getNestedId()))); // depends on control dependency: [if], data = [none]
this.node.setEndTime(time); // depends on control dependency: [if], data = [none]
fireEvent(
Event
.create(this, EventType.JOB_FINISHED,
new EventData(nodeStatus, this.node.getNestedId()))); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
}
} } |
public class class_name {
private Segment segupdate(double xend, double yend, int dir, boolean tail, Segment[] seg) {
Segment seglist = seg[0];
if (seglist == null) {
seg[1] = null;
return null;
}
switch (dir) {
case 1:
case 3:
if (YMATCH(yend, seglist.y0)) {
if (!tail) {
seglist.swap();
}
seg[1] = seglist;
return seglist.next;
}
if (YMATCH(yend, seglist.y1)) {
if (tail) {
seglist.swap();
}
seg[1] = seglist;
return seglist.next;
}
if (YMATCH(yend, seglist.y1)) {
if (tail) {
seglist.swap();
}
seg[1] = seglist;
return seglist.next;
}
break;
case 2:
case 4:
if (XMATCH(xend, seglist.x0)) {
if (!tail) {
seglist.swap();
}
seg[1] = seglist;
return seglist.next;
}
if (XMATCH(xend, seglist.x1)) {
if (tail) {
seglist.swap();
}
seg[1] = seglist;
return seglist.next;
}
break;
}
Segment[] seg2 = {seglist.next, seg[1]};
seglist.next = segupdate(xend, yend, dir, tail, seg2);
seg[1] = seg2[1];
return seglist;
} } | public class class_name {
private Segment segupdate(double xend, double yend, int dir, boolean tail, Segment[] seg) {
Segment seglist = seg[0];
if (seglist == null) {
seg[1] = null; // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
switch (dir) {
case 1:
case 3:
if (YMATCH(yend, seglist.y0)) {
if (!tail) {
seglist.swap(); // depends on control dependency: [if], data = [none]
}
seg[1] = seglist; // depends on control dependency: [if], data = [none]
return seglist.next; // depends on control dependency: [if], data = [none]
}
if (YMATCH(yend, seglist.y1)) {
if (tail) {
seglist.swap(); // depends on control dependency: [if], data = [none]
}
seg[1] = seglist; // depends on control dependency: [if], data = [none]
return seglist.next; // depends on control dependency: [if], data = [none]
}
if (YMATCH(yend, seglist.y1)) {
if (tail) {
seglist.swap(); // depends on control dependency: [if], data = [none]
}
seg[1] = seglist; // depends on control dependency: [if], data = [none]
return seglist.next; // depends on control dependency: [if], data = [none]
}
break;
case 2:
case 4:
if (XMATCH(xend, seglist.x0)) {
if (!tail) {
seglist.swap(); // depends on control dependency: [if], data = [none]
}
seg[1] = seglist; // depends on control dependency: [if], data = [none]
return seglist.next; // depends on control dependency: [if], data = [none]
}
if (XMATCH(xend, seglist.x1)) {
if (tail) {
seglist.swap(); // depends on control dependency: [if], data = [none]
}
seg[1] = seglist; // depends on control dependency: [if], data = [none]
return seglist.next; // depends on control dependency: [if], data = [none]
}
break;
}
Segment[] seg2 = {seglist.next, seg[1]};
seglist.next = segupdate(xend, yend, dir, tail, seg2);
seg[1] = seg2[1];
return seglist;
} } |
public class class_name {
@GET
@Path(WEBUI_DATA)
@ReturnType("alluxio.wire.MasterWebUIData")
public Response getWebUIData(@DefaultValue("0") @QueryParam("offset") String requestOffset,
@DefaultValue("20") @QueryParam("limit") String requestLimit) {
return RestUtils.call(() -> {
MasterWebUIData response = new MasterWebUIData();
if (!ServerConfiguration.getBoolean(PropertyKey.WEB_FILE_INFO_ENABLED)) {
return response;
}
if (SecurityUtils.isSecurityEnabled(ServerConfiguration.global())
&& AuthenticatedClientUser.get(ServerConfiguration.global()) == null) {
AuthenticatedClientUser.set(LoginUser.get(ServerConfiguration.global()).getName());
}
response.setMasterNodeAddress(mMasterProcess.getRpcAddress().toString()).setFatalError("")
.setShowPermissions(ServerConfiguration
.getBoolean(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED));
List<AlluxioURI> inAlluxioFiles = mFileSystemMaster.getInAlluxioFiles();
Collections.sort(inAlluxioFiles);
List<UIFileInfo> fileInfos = new ArrayList<>(inAlluxioFiles.size());
for (AlluxioURI file : inAlluxioFiles) {
try {
long fileId = mFileSystemMaster.getFileId(file);
FileInfo fileInfo = mFileSystemMaster.getFileInfo(fileId);
if (fileInfo != null && fileInfo.getInAlluxioPercentage() == 100) {
fileInfos.add(new UIFileInfo(fileInfo, ServerConfiguration.global(),
new MasterStorageTierAssoc().getOrderedStorageAliases()));
}
} catch (FileDoesNotExistException e) {
response.setFatalError("Error: File does not exist " + e.getLocalizedMessage());
return response;
} catch (AccessControlException e) {
response
.setPermissionError("Error: File " + file + " cannot be accessed " + e.getMessage());
return response;
}
}
response.setInAlluxioFileNum(fileInfos.size());
try {
int offset = Integer.parseInt(requestOffset);
int limit = Integer.parseInt(requestLimit);
limit = offset == 0 && limit > fileInfos.size() ? fileInfos.size() : limit;
limit = offset + limit > fileInfos.size() ? fileInfos.size() - offset : limit;
int sum = Math.addExact(offset, limit);
fileInfos = fileInfos.subList(offset, sum);
response.setFileInfos(fileInfos);
} catch (NumberFormatException e) {
response.setFatalError("Error: offset or limit parse error, " + e.getLocalizedMessage());
return response;
} catch (ArithmeticException e) {
response.setFatalError(
"Error: offset or offset + limit is out of bound, " + e.getLocalizedMessage());
return response;
} catch (IllegalArgumentException e) {
response.setFatalError(e.getLocalizedMessage());
return response;
}
return response;
}, ServerConfiguration.global());
} } | public class class_name {
@GET
@Path(WEBUI_DATA)
@ReturnType("alluxio.wire.MasterWebUIData")
public Response getWebUIData(@DefaultValue("0") @QueryParam("offset") String requestOffset,
@DefaultValue("20") @QueryParam("limit") String requestLimit) {
return RestUtils.call(() -> {
MasterWebUIData response = new MasterWebUIData();
if (!ServerConfiguration.getBoolean(PropertyKey.WEB_FILE_INFO_ENABLED)) {
return response; // depends on control dependency: [if], data = [none]
}
if (SecurityUtils.isSecurityEnabled(ServerConfiguration.global())
&& AuthenticatedClientUser.get(ServerConfiguration.global()) == null) {
AuthenticatedClientUser.set(LoginUser.get(ServerConfiguration.global()).getName()); // depends on control dependency: [if], data = [none]
}
response.setMasterNodeAddress(mMasterProcess.getRpcAddress().toString()).setFatalError("")
.setShowPermissions(ServerConfiguration
.getBoolean(PropertyKey.SECURITY_AUTHORIZATION_PERMISSION_ENABLED));
List<AlluxioURI> inAlluxioFiles = mFileSystemMaster.getInAlluxioFiles();
Collections.sort(inAlluxioFiles);
List<UIFileInfo> fileInfos = new ArrayList<>(inAlluxioFiles.size());
for (AlluxioURI file : inAlluxioFiles) {
try {
long fileId = mFileSystemMaster.getFileId(file);
FileInfo fileInfo = mFileSystemMaster.getFileInfo(fileId);
if (fileInfo != null && fileInfo.getInAlluxioPercentage() == 100) {
fileInfos.add(new UIFileInfo(fileInfo, ServerConfiguration.global(),
new MasterStorageTierAssoc().getOrderedStorageAliases())); // depends on control dependency: [if], data = [none]
}
} catch (FileDoesNotExistException e) {
response.setFatalError("Error: File does not exist " + e.getLocalizedMessage());
return response;
} catch (AccessControlException e) { // depends on control dependency: [catch], data = [none]
response
.setPermissionError("Error: File " + file + " cannot be accessed " + e.getMessage());
return response;
} // depends on control dependency: [catch], data = [none]
}
response.setInAlluxioFileNum(fileInfos.size());
try {
int offset = Integer.parseInt(requestOffset);
int limit = Integer.parseInt(requestLimit);
limit = offset == 0 && limit > fileInfos.size() ? fileInfos.size() : limit; // depends on control dependency: [try], data = [none]
limit = offset + limit > fileInfos.size() ? fileInfos.size() - offset : limit; // depends on control dependency: [try], data = [none]
int sum = Math.addExact(offset, limit);
fileInfos = fileInfos.subList(offset, sum); // depends on control dependency: [try], data = [none]
response.setFileInfos(fileInfos); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
response.setFatalError("Error: offset or limit parse error, " + e.getLocalizedMessage());
return response;
} catch (ArithmeticException e) { // depends on control dependency: [catch], data = [none]
response.setFatalError(
"Error: offset or offset + limit is out of bound, " + e.getLocalizedMessage());
return response;
} catch (IllegalArgumentException e) { // depends on control dependency: [catch], data = [none]
response.setFatalError(e.getLocalizedMessage());
return response;
} // depends on control dependency: [catch], data = [none]
return response;
}, ServerConfiguration.global());
} } |
public class class_name {
public Set<Integer> getZoomLevels() {
final Set<Integer> zoomLevels = new TreeSet<Integer>();
for (final GEMFRange rs: mRangeData) {
zoomLevels.add(rs.zoom);
}
return zoomLevels;
} } | public class class_name {
public Set<Integer> getZoomLevels() {
final Set<Integer> zoomLevels = new TreeSet<Integer>();
for (final GEMFRange rs: mRangeData) {
zoomLevels.add(rs.zoom); // depends on control dependency: [for], data = [rs]
}
return zoomLevels;
} } |
public class class_name {
private static void init() {
String pkgs = System.getProperty("java.protocol.handler.pkgs");
if (pkgs == null || pkgs.trim().length() == 0) {
pkgs = "org.jboss.net.protocol|org.jboss.vfs.protocol";
System.setProperty("java.protocol.handler.pkgs", pkgs);
} else if (pkgs.contains("org.jboss.vfs.protocol") == false) {
if (pkgs.contains("org.jboss.net.protocol") == false) { pkgs += "|org.jboss.net.protocol"; }
pkgs += "|org.jboss.vfs.protocol";
System.setProperty("java.protocol.handler.pkgs", pkgs);
}
} } | public class class_name {
private static void init() {
String pkgs = System.getProperty("java.protocol.handler.pkgs");
if (pkgs == null || pkgs.trim().length() == 0) {
pkgs = "org.jboss.net.protocol|org.jboss.vfs.protocol"; // depends on control dependency: [if], data = [none]
System.setProperty("java.protocol.handler.pkgs", pkgs); // depends on control dependency: [if], data = [none]
} else if (pkgs.contains("org.jboss.vfs.protocol") == false) {
if (pkgs.contains("org.jboss.net.protocol") == false) { pkgs += "|org.jboss.net.protocol"; } // depends on control dependency: [if], data = [none]
pkgs += "|org.jboss.vfs.protocol"; // depends on control dependency: [if], data = [none]
System.setProperty("java.protocol.handler.pkgs", pkgs); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Response getBatchDeleteResponse(App app, List<String> ids) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "batch", "delete")) {
LinkedList<ParaObject> objects = new LinkedList<>();
if (app != null && ids != null && !ids.isEmpty()) {
if (ids.size() <= Config.MAX_ITEMS_PER_PAGE) {
for (ParaObject pobj : Para.getDAO().readAll(app.getAppIdentifier(), ids, true).values()) {
if (pobj != null && pobj.getId() != null && pobj.getType() != null) {
// deleting apps in batch is not allowed
if (isNotAnApp(pobj.getType()) && checkIfUserCanModifyObject(app, pobj)) {
objects.add(pobj);
}
}
}
Para.getDAO().deleteAll(app.getAppIdentifier(), objects);
} else {
return getStatusResponse(Response.Status.BAD_REQUEST,
"Limit reached. Maximum number of items to delete is " + Config.MAX_ITEMS_PER_PAGE);
}
} else {
return getStatusResponse(Response.Status.BAD_REQUEST, "Missing ids.");
}
return Response.ok().build();
}
} } | public class class_name {
public static Response getBatchDeleteResponse(App app, List<String> ids) {
try (final Metrics.Context context = Metrics.time(app == null ? null : app.getAppid(),
RestUtils.class, "batch", "delete")) {
LinkedList<ParaObject> objects = new LinkedList<>();
if (app != null && ids != null && !ids.isEmpty()) {
if (ids.size() <= Config.MAX_ITEMS_PER_PAGE) {
for (ParaObject pobj : Para.getDAO().readAll(app.getAppIdentifier(), ids, true).values()) {
if (pobj != null && pobj.getId() != null && pobj.getType() != null) {
// deleting apps in batch is not allowed
if (isNotAnApp(pobj.getType()) && checkIfUserCanModifyObject(app, pobj)) {
objects.add(pobj); // depends on control dependency: [if], data = [none]
}
}
}
Para.getDAO().deleteAll(app.getAppIdentifier(), objects); // depends on control dependency: [if], data = [none]
} else {
return getStatusResponse(Response.Status.BAD_REQUEST,
"Limit reached. Maximum number of items to delete is " + Config.MAX_ITEMS_PER_PAGE); // depends on control dependency: [if], data = [none]
}
} else {
return getStatusResponse(Response.Status.BAD_REQUEST, "Missing ids."); // depends on control dependency: [if], data = [none]
}
return Response.ok().build();
}
} } |
public class class_name {
private CompletableFuture<T> orderedFuture() {
if (!complete) {
synchronized (orderedFutures) {
if (!complete) {
CompletableFuture<T> future = new CompletableFuture<>();
orderedFutures.add(future);
return future;
}
}
}
// Completed
if (error == null) {
return CompletableFuture.completedFuture(result);
} else {
return Futures.exceptionalFuture(error);
}
} } | public class class_name {
private CompletableFuture<T> orderedFuture() {
if (!complete) {
synchronized (orderedFutures) { // depends on control dependency: [if], data = [none]
if (!complete) {
CompletableFuture<T> future = new CompletableFuture<>();
orderedFutures.add(future); // depends on control dependency: [if], data = [none]
return future; // depends on control dependency: [if], data = [none]
}
}
}
// Completed
if (error == null) {
return CompletableFuture.completedFuture(result); // depends on control dependency: [if], data = [none]
} else {
return Futures.exceptionalFuture(error); // depends on control dependency: [if], data = [(error]
}
} } |
public class class_name {
@Override
public EEnum getIfcAudioVisualApplianceTypeEnum() {
if (ifcAudioVisualApplianceTypeEnumEEnum == null) {
ifcAudioVisualApplianceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(917);
}
return ifcAudioVisualApplianceTypeEnumEEnum;
} } | public class class_name {
@Override
public EEnum getIfcAudioVisualApplianceTypeEnum() {
if (ifcAudioVisualApplianceTypeEnumEEnum == null) {
ifcAudioVisualApplianceTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(917);
// depends on control dependency: [if], data = [none]
}
return ifcAudioVisualApplianceTypeEnumEEnum;
} } |
public class class_name {
public void addImmutableResource(String immutableResource) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ADDED_IMMUTABLE_RESOURCE_1,
immutableResource));
}
m_immutableResources.add(immutableResource);
} } | public class class_name {
public void addImmutableResource(String immutableResource) {
if (LOG.isDebugEnabled()) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_IMPORTEXPORT_ADDED_IMMUTABLE_RESOURCE_1,
immutableResource)); // depends on control dependency: [if], data = [none]
}
m_immutableResources.add(immutableResource);
} } |
public class class_name {
private static Element getCobolXsdAnnotations(XmlSchemaElement xsdElement) {
XmlSchemaAnnotation annotation = xsdElement.getAnnotation();
if (annotation == null || annotation.getItems().size() == 0) {
throw new IllegalArgumentException("Xsd element of type "
+ xsdElement.getSchemaType().getQName()
+ " at line " + xsdElement.getLineNumber()
+ " does not have COBOL annotations");
}
XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) annotation.getItems()
.get(0);
if (appinfo.getMarkup() == null) {
throw new IllegalArgumentException("Xsd element of type "
+ xsdElement.getSchemaType().getQName()
+ " does not have any markup in its annotations");
}
Node node = null;
boolean found = false;
for (int i = 0; i < appinfo.getMarkup().getLength(); i++) {
node = appinfo.getMarkup().item(i);
if (node instanceof Element
&& node.getLocalName().equals(CobolMarkup.ELEMENT)
&& node.getNamespaceURI().equals(CobolMarkup.NS)) {
found = true;
break;
}
}
if (!found) {
throw new IllegalArgumentException("Xsd element of type "
+ xsdElement.getSchemaType().getQName()
+ " at line " + xsdElement.getLineNumber()
+ " does not have any COBOL annotations");
}
return (Element) node;
} } | public class class_name {
private static Element getCobolXsdAnnotations(XmlSchemaElement xsdElement) {
XmlSchemaAnnotation annotation = xsdElement.getAnnotation();
if (annotation == null || annotation.getItems().size() == 0) {
throw new IllegalArgumentException("Xsd element of type "
+ xsdElement.getSchemaType().getQName()
+ " at line " + xsdElement.getLineNumber()
+ " does not have COBOL annotations");
}
XmlSchemaAppInfo appinfo = (XmlSchemaAppInfo) annotation.getItems()
.get(0);
if (appinfo.getMarkup() == null) {
throw new IllegalArgumentException("Xsd element of type "
+ xsdElement.getSchemaType().getQName()
+ " does not have any markup in its annotations");
}
Node node = null;
boolean found = false;
for (int i = 0; i < appinfo.getMarkup().getLength(); i++) {
node = appinfo.getMarkup().item(i); // depends on control dependency: [for], data = [i]
if (node instanceof Element
&& node.getLocalName().equals(CobolMarkup.ELEMENT)
&& node.getNamespaceURI().equals(CobolMarkup.NS)) {
found = true; // depends on control dependency: [if], data = [none]
break;
}
}
if (!found) {
throw new IllegalArgumentException("Xsd element of type "
+ xsdElement.getSchemaType().getQName()
+ " at line " + xsdElement.getLineNumber()
+ " does not have any COBOL annotations");
}
return (Element) node;
} } |
public class class_name {
@Override
public void sawOpcode(int seen) {
boolean processed = false;
Iterator<IfStatement> isi = ifStatements.iterator();
while (isi.hasNext()) {
IfStatement.Action action = isi.next().processOpcode(this, bugReporter, seen);
if (action == IfStatement.Action.REMOVE_ACTION) {
isi.remove();
} else if (action == IfStatement.Action.PROCESSED_ACTION) {
processed = true;
}
}
if (!processed && OpcodeUtils.isALoad(seen)) {
IfStatement is = new IfStatement(this, seen);
ifStatements.add(is);
}
} } | public class class_name {
@Override
public void sawOpcode(int seen) {
boolean processed = false;
Iterator<IfStatement> isi = ifStatements.iterator();
while (isi.hasNext()) {
IfStatement.Action action = isi.next().processOpcode(this, bugReporter, seen);
if (action == IfStatement.Action.REMOVE_ACTION) {
isi.remove(); // depends on control dependency: [if], data = [none]
} else if (action == IfStatement.Action.PROCESSED_ACTION) {
processed = true; // depends on control dependency: [if], data = [none]
}
}
if (!processed && OpcodeUtils.isALoad(seen)) {
IfStatement is = new IfStatement(this, seen);
ifStatements.add(is); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected String filterTemplateText(String templateText, Object pmb) {
final String replaced = Srl.replace(templateText, CRLF, LF);
final List<String> lineList = Srl.splitList(replaced, LF);
final StringBuilder sb = new StringBuilder(templateText.length());
boolean nextNoLine = false;
int lineNumber = 0;
for (String line : lineList) {
++lineNumber;
if (nextNoLine) {
sb.append(line);
nextNoLine = false;
continue;
}
if (isIfEndCommentLine(line) || isForEndCommentLine(line)) {
appendLfLine(sb, lineNumber, Srl.substringLastFront(line, END_COMMENT));
sb.append(LF).append(END_COMMENT);
nextNoLine = true;
continue;
}
final String realLine;
if (isOnlyIfCommentLine(line) || isOnlyForCommentLine(line) || isOnlyEndCommentLine(line)) {
nextNoLine = true;
realLine = Srl.ltrim(line);
} else {
realLine = line;
}
appendLfLine(sb, lineNumber, realLine);
}
return sb.toString();
} } | public class class_name {
protected String filterTemplateText(String templateText, Object pmb) {
final String replaced = Srl.replace(templateText, CRLF, LF);
final List<String> lineList = Srl.splitList(replaced, LF);
final StringBuilder sb = new StringBuilder(templateText.length());
boolean nextNoLine = false;
int lineNumber = 0;
for (String line : lineList) {
++lineNumber; // depends on control dependency: [for], data = [line]
if (nextNoLine) {
sb.append(line); // depends on control dependency: [if], data = [none]
nextNoLine = false; // depends on control dependency: [if], data = [none]
continue;
}
if (isIfEndCommentLine(line) || isForEndCommentLine(line)) {
appendLfLine(sb, lineNumber, Srl.substringLastFront(line, END_COMMENT)); // depends on control dependency: [if], data = [none]
sb.append(LF).append(END_COMMENT); // depends on control dependency: [if], data = [none]
nextNoLine = true; // depends on control dependency: [if], data = [none]
continue;
}
final String realLine;
if (isOnlyIfCommentLine(line) || isOnlyForCommentLine(line) || isOnlyEndCommentLine(line)) {
nextNoLine = true; // depends on control dependency: [if], data = [none]
realLine = Srl.ltrim(line); // depends on control dependency: [if], data = [none]
} else {
realLine = line; // depends on control dependency: [if], data = [none]
}
appendLfLine(sb, lineNumber, realLine); // depends on control dependency: [for], data = [line]
}
return sb.toString();
} } |
public class class_name {
public void sendMail(String toAddress, String subject, String content, String attachmentName,
String attachmentPath) {
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
logger.debug("Sending mail...");
Properties props = System.getProperties();
props.setProperty("mail.smtp.host", "smtp.gmail.com");
props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.port", "465");
props.setProperty("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.auth", "true");
props.put("mail.debug", "true");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
final String username = "intellimate.izou@gmail.com";
final String password = "Karlskrone"; // TODO: hide this when password stuff is done
try{
Session session = Session.getDefaultInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(username));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress));
message.setSubject(subject);
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
// Now set the actual message
messageBodyPart.setText(content);
// Create a multipart message
Multipart multipart = new MimeMultipart();
// Set text message part
multipart.addBodyPart(messageBodyPart);
// Part two is attachment
messageBodyPart = new MimeBodyPart();
DataSource source = new FileDataSource(attachmentPath);
messageBodyPart.setDataHandler(new DataHandler(source));
messageBodyPart.setFileName(attachmentName);
multipart.addBodyPart(messageBodyPart);
// Send the complete message parts
message.setContent(multipart);
// Send message
Transport.send(message);
logger.debug("Mail sent successfully.");
} catch (MessagingException e) {
logger.error("Unable to send error report.", e);
}
} } | public class class_name {
public void sendMail(String toAddress, String subject, String content, String attachmentName,
String attachmentPath) {
final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
logger.debug("Sending mail...");
Properties props = System.getProperties();
props.setProperty("mail.smtp.host", "smtp.gmail.com");
props.setProperty("mail.smtp.socketFactory.class", SSL_FACTORY);
props.setProperty("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.port", "465");
props.setProperty("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.auth", "true");
props.put("mail.debug", "true");
props.put("mail.store.protocol", "pop3");
props.put("mail.transport.protocol", "smtp");
final String username = "intellimate.izou@gmail.com";
final String password = "Karlskrone"; // TODO: hide this when password stuff is done
try{
Session session = Session.getDefaultInstance(props, new Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(username, password);
}
});
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(username)); // depends on control dependency: [try], data = [none]
message.addRecipient(Message.RecipientType.TO, new InternetAddress(toAddress)); // depends on control dependency: [try], data = [none]
message.setSubject(subject); // depends on control dependency: [try], data = [none]
// Create the message part
BodyPart messageBodyPart = new MimeBodyPart();
// Now set the actual message
messageBodyPart.setText(content); // depends on control dependency: [try], data = [none]
// Create a multipart message
Multipart multipart = new MimeMultipart();
// Set text message part
multipart.addBodyPart(messageBodyPart); // depends on control dependency: [try], data = [none]
// Part two is attachment
messageBodyPart = new MimeBodyPart(); // depends on control dependency: [try], data = [none]
DataSource source = new FileDataSource(attachmentPath);
messageBodyPart.setDataHandler(new DataHandler(source)); // depends on control dependency: [try], data = [none]
messageBodyPart.setFileName(attachmentName); // depends on control dependency: [try], data = [none]
multipart.addBodyPart(messageBodyPart); // depends on control dependency: [try], data = [none]
// Send the complete message parts
message.setContent(multipart); // depends on control dependency: [try], data = [none]
// Send message
Transport.send(message); // depends on control dependency: [try], data = [none]
logger.debug("Mail sent successfully."); // depends on control dependency: [try], data = [none]
} catch (MessagingException e) {
logger.error("Unable to send error report.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void beginEntry(JarEntry je, ManifestEntryVerifier mev)
throws IOException
{
if (je == null)
return;
if (debug != null) {
debug.println("beginEntry "+je.getName());
}
String name = je.getName();
/*
* Assumptions:
* 1. The manifest should be the first entry in the META-INF directory.
* 2. The .SF/.DSA/.EC files follow the manifest, before any normal entries
* 3. Any of the following will throw a SecurityException:
* a. digest mismatch between a manifest section and
* the SF section.
* b. digest mismatch between the actual jar entry and the manifest
*/
if (parsingMeta) {
String uname = name.toUpperCase(Locale.ENGLISH);
if ((uname.startsWith("META-INF/") ||
uname.startsWith("/META-INF/"))) {
if (je.isDirectory()) {
mev.setEntry(null, je);
return;
}
if (SignatureFileVerifier.isBlockOrSF(uname)) {
/* We parse only DSA, RSA or EC PKCS7 blocks. */
parsingBlockOrSF = true;
baos.reset();
mev.setEntry(null, je);
}
return;
}
}
if (parsingMeta) {
doneWithMeta();
}
if (je.isDirectory()) {
mev.setEntry(null, je);
return;
}
// be liberal in what you accept. If the name starts with ./, remove
// it as we internally canonicalize it with out the ./.
if (name.startsWith("./"))
name = name.substring(2);
// be liberal in what you accept. If the name starts with /, remove
// it as we internally canonicalize it with out the /.
if (name.startsWith("/"))
name = name.substring(1);
// only set the jev object for entries that have a signature
if (sigFileSigners.get(name) != null) {
mev.setEntry(name, je);
return;
}
// don't compute the digest for this entry
mev.setEntry(null, je);
return;
} } | public class class_name {
public void beginEntry(JarEntry je, ManifestEntryVerifier mev)
throws IOException
{
if (je == null)
return;
if (debug != null) {
debug.println("beginEntry "+je.getName());
}
String name = je.getName();
/*
* Assumptions:
* 1. The manifest should be the first entry in the META-INF directory.
* 2. The .SF/.DSA/.EC files follow the manifest, before any normal entries
* 3. Any of the following will throw a SecurityException:
* a. digest mismatch between a manifest section and
* the SF section.
* b. digest mismatch between the actual jar entry and the manifest
*/
if (parsingMeta) {
String uname = name.toUpperCase(Locale.ENGLISH);
if ((uname.startsWith("META-INF/") ||
uname.startsWith("/META-INF/"))) {
if (je.isDirectory()) {
mev.setEntry(null, je); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (SignatureFileVerifier.isBlockOrSF(uname)) {
/* We parse only DSA, RSA or EC PKCS7 blocks. */
parsingBlockOrSF = true; // depends on control dependency: [if], data = [none]
baos.reset(); // depends on control dependency: [if], data = [none]
mev.setEntry(null, je); // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [if], data = [none]
}
}
if (parsingMeta) {
doneWithMeta();
}
if (je.isDirectory()) {
mev.setEntry(null, je);
return;
}
// be liberal in what you accept. If the name starts with ./, remove
// it as we internally canonicalize it with out the ./.
if (name.startsWith("./"))
name = name.substring(2);
// be liberal in what you accept. If the name starts with /, remove
// it as we internally canonicalize it with out the /.
if (name.startsWith("/"))
name = name.substring(1);
// only set the jev object for entries that have a signature
if (sigFileSigners.get(name) != null) {
mev.setEntry(name, je);
return;
}
// don't compute the digest for this entry
mev.setEntry(null, je);
return;
} } |
public class class_name {
void setBuilder(final QueryBuilder builder) {
super.setBuilder(builder);
for (WhereItem item : items) {
item.setBuilder(builder);
}
} } | public class class_name {
void setBuilder(final QueryBuilder builder) {
super.setBuilder(builder);
for (WhereItem item : items) {
item.setBuilder(builder); // depends on control dependency: [for], data = [item]
}
} } |
public class class_name {
public void setVolumeLabel(String label) {
for (int i=0; i < 11; i++) {
final byte c =
(label == null) ? 0 :
(label.length() > i) ? (byte) label.charAt(i) : 0x20;
set8(0x47 + i, c);
}
} } | public class class_name {
public void setVolumeLabel(String label) {
for (int i=0; i < 11; i++) {
final byte c =
(label == null) ? 0 :
(label.length() > i) ? (byte) label.charAt(i) : 0x20;
set8(0x47 + i, c); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public Object next() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
yychar+= zzMarkedPosL-zzStartRead;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 30:
// lookahead expression with fixed base length
zzMarkedPos = zzStartRead + 1;
{ /* invert quote - often but not always right */
return handleQuotes(yytext(), true);
}
case 43: break;
case 8:
{ if (ptb3Dashes) {
return getNext(ptbmdash, yytext()); }
else {
return getNext();
}
}
case 44: break;
case 19:
{ if (escapeForwardSlashAsterisk) {
return getNext(delimit(yytext(), '*'), yytext()); }
else {
return getNext();
}
}
case 45: break;
case 15:
{ return handleQuotes(yytext(), false);
}
case 46: break;
case 29:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return handleQuotes(yytext(), false);
}
case 47: break;
case 12:
{ if (yylength() >= 3 && yylength() <= 4 && ptb3Dashes) {
return getNext(ptbmdash, yytext());
} else {
return getNext();
}
}
case 48: break;
case 38:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNormalizedAmpNext();
}
case 49: break;
case 28:
{ return getNormalizedAmpNext();
}
case 50: break;
case 4:
{ return getNext();
}
case 51: break;
case 21:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNext();
}
case 52: break;
case 33:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 11;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzInput = zzBufferL[zzFPos++];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzFState = 12;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
};
zzMarkedPos = zzFPos;
}
{ return getNext();
}
case 53: break;
case 34:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 13;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzInput = zzBufferL[zzFPos++];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzFState = 12;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
};
zzMarkedPos = zzFPos;
}
{ return getNext();
}
case 54: break;
case 40:
{ String txt = yytext();
if (escapeForwardSlashAsterisk) {
txt = delimit(txt, '/');
}
return getNext(txt, yytext());
}
case 55: break;
case 23:
{ final String origTxt = yytext();
String txt = origTxt;
if (normalizeSpace) {
txt = txt.replaceAll(" ", "\u00A0"); // change to non-breaking space
}
return getNext(txt, origTxt);
}
case 56: break;
case 6:
{ if (normalizeOtherBrackets) {
return getNext(closeparen, yytext()); }
else {
return getNext();
}
}
case 57: break;
case 26:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 3;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzInput = zzBufferL[zzFPos++];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzFState = 4;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
};
zzMarkedPos = zzFPos;
}
{ final String origTxt = yytext();
String tmp = removeSoftHyphens(origTxt);
if (americanize) {
tmp = Americanize.americanize(tmp);
}
return getNext(tmp, origTxt);
}
case 58: break;
case 16:
{ if (normalizeOtherBrackets) {
return getNext(closebrace, yytext()); }
else {
return getNext();
}
}
case 59: break;
case 24:
{ if (escapeForwardSlashAsterisk) {
return getNext(delimit(yytext(), '/'), yytext());
} else {
return getNext();
}
}
case 60: break;
case 18:
{ if (normalizeParentheses) {
return getNext(closeparen, yytext()); }
else {
return getNext();
}
}
case 61: break;
case 36:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 9;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzInput = zzBufferL[zzFPos++];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzFState = 10;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
};
zzMarkedPos = zzFPos;
}
{ String s;
if (strictTreebank3) {
yypushback(1); // return a period for next time
s = yytext();
} else {
s = yytext();
yypushback(1); // return a period for next time
}
return getNext(s, yytext());
}
case 62: break;
case 39:
{ yypushback(3) ; return getNext();
}
case 63: break;
case 22:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return handleQuotes(yytext(), true);
}
case 64: break;
case 41:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 7;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzInput = zzBufferL[zzFPos++];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzFState = 8;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
};
zzMarkedPos = zzFPos;
}
{ String s;
// try to fight around an apparent jflex bug where it gets a space at the token
// end by getting wrong the length of the trailing context.
while (yylength() > 0) {
char last = yycharat(yylength()-1);
if (last == ' ' || last == '\t') {
yypushback(1);
} else {
break;
}
}
if (strictTreebank3) {
yypushback(1); // return a period for next time
s = yytext();
} else {
s = yytext();
yypushback(1); // return a period for next time
}
return getNext(s, yytext());
}
case 65: break;
case 2:
{ if (normalizeOtherBrackets) {
return getNext(openparen, yytext()); }
else {
return getNext();
}
}
case 66: break;
case 32:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 5;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzInput = zzBufferL[zzFPos++];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
zzFState = 6;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
};
zzMarkedPos = zzFPos;
}
{ final String txt = yytext();
return getNext(removeSoftHyphens(txt),
txt);
}
case 67: break;
case 20:
{ if (normalizeOtherBrackets) {
return getNext(openbrace, yytext()); }
else {
return getNext();
}
}
case 68: break;
case 17:
{ if (normalizeParentheses) {
return getNext(openparen, yytext()); }
else {
return getNext();
}
}
case 69: break;
case 11:
{ return handleEllipsis(yytext());
}
case 70: break;
case 13:
{ return normalizeFractions(yytext());
}
case 71: break;
case 14:
{ if (normalizeCurrency) {
return getNext(normalizeCurrency(yytext()), yytext()); }
else {
return getNext();
}
}
case 72: break;
case 10:
{ if (invertible) {
prevWordAfter.append(yytext());
}
}
case 73: break;
case 3:
{ if (escapeForwardSlashAsterisk) {
return getNext(delimit(yytext(), '/'), yytext()); }
else {
return getNext();
}
}
case 74: break;
case 37:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNext(removeSoftHyphens(yytext()),
yytext());
}
case 75: break;
case 25:
{ return getNext(removeSoftHyphens(yytext()), yytext());
}
case 76: break;
case 31:
{ String txt = yytext();
if (escapeForwardSlashAsterisk) {
txt = delimit(txt, '/');
}
if (normalizeSpace) {
txt = txt.replaceAll(" ", "\u00A0"); // change to non-breaking space
}
return getNext(txt, yytext());
}
case 77: break;
case 7:
{ final String origTxt = yytext();
String tmp = removeSoftHyphens(origTxt);
if (americanize) {
tmp = Americanize.americanize(tmp);
}
return getNext(tmp, origTxt);
}
case 78: break;
case 42:
{ String txt = yytext();
if (normalizeSpace) {
txt = txt.replaceAll(" ", "\u00A0"); // change to non-breaking space
}
if (normalizeParentheses) {
txt = txt.replaceAll("\\(", openparen);
txt = txt.replaceAll("\\)", closeparen);
}
return getNext(txt, yytext());
}
case 79: break;
case 9:
{ return getNext(removeSoftHyphens(yytext()),
yytext());
}
case 80: break;
case 27:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNext(removeSoftHyphens(yytext()),
yytext());
}
case 81: break;
case 1:
{ String str = yytext();
int first = str.charAt(0);
String msg = String.format("Untokenizable: %s (U+%s, decimal: %s)", yytext(), Integer.toHexString(first).toUpperCase(), Integer.toString(first));
switch (untokenizable) {
case NONE_DELETE:
if (invertible) {
prevWordAfter.append(str);
}
break;
case FIRST_DELETE:
if (invertible) {
prevWordAfter.append(str);
}
if ( ! this.seenUntokenizableCharacter) {
LOGGER.warning(msg);
this.seenUntokenizableCharacter = true;
}
break;
case ALL_DELETE:
if (invertible) {
prevWordAfter.append(str);
}
LOGGER.warning(msg);
this.seenUntokenizableCharacter = true;
break;
case NONE_KEEP:
return getNext();
case FIRST_KEEP:
if ( ! this.seenUntokenizableCharacter) {
LOGGER.warning(msg);
this.seenUntokenizableCharacter = true;
}
return getNext();
case ALL_KEEP:
LOGGER.warning(msg);
this.seenUntokenizableCharacter = true;
return getNext();
}
}
case 82: break;
case 5:
{ if (tokenizeNLs) {
return getNext(NEWLINE_TOKEN, yytext()); // js: for tokenizing carriage returns
} else if (invertible) {
prevWordAfter.append(yytext());
}
}
case 83: break;
case 35:
{ String txt = yytext();
if (escapeForwardSlashAsterisk) {
txt = delimit(txt, '/');
txt = delimit(txt, '*');
}
return getNext(txt, yytext());
}
case 84: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
{
if (invertible) {
prevWordAfter.append(yytext());
String str = prevWordAfter.toString();
prevWordAfter.setLength(0);
prevWord.set(AfterAnnotation.class, str);
}
return null;
}
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
} } | public class class_name {
public Object next() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
yychar+= zzMarkedPosL-zzStartRead;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
// depends on control dependency: [if], data = [none]
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
// depends on control dependency: [if], data = [none]
zzMarkedPos = zzMarkedPosL;
// depends on control dependency: [if], data = [none]
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
// depends on control dependency: [if], data = [none]
zzMarkedPosL = zzMarkedPos;
// depends on control dependency: [if], data = [none]
zzBufferL = zzBuffer;
// depends on control dependency: [if], data = [none]
zzEndReadL = zzEndRead;
// depends on control dependency: [if], data = [none]
if (eof) {
zzInput = YYEOF;
// depends on control dependency: [if], data = [none]
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
// depends on control dependency: [if], data = [none]
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
// depends on control dependency: [while], data = [none]
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
// depends on control dependency: [if], data = [none]
zzMarkedPosL = zzCurrentPosL;
// depends on control dependency: [if], data = [none]
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 30:
// lookahead expression with fixed base length
zzMarkedPos = zzStartRead + 1;
{ /* invert quote - often but not always right */
return handleQuotes(yytext(), true);
}
case 43: break;
case 8:
{ if (ptb3Dashes) {
return getNext(ptbmdash, yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 44: break;
case 19:
{ if (escapeForwardSlashAsterisk) {
return getNext(delimit(yytext(), '*'), yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 45: break;
case 15:
{ return handleQuotes(yytext(), false);
}
case 46: break;
case 29:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return handleQuotes(yytext(), false);
}
case 47: break;
case 12:
{ if (yylength() >= 3 && yylength() <= 4 && ptb3Dashes) {
return getNext(ptbmdash, yytext());
// depends on control dependency: [if], data = [none]
} else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 48: break;
case 38:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNormalizedAmpNext();
}
case 49: break;
case 28:
{ return getNormalizedAmpNext();
}
case 50: break;
case 4:
{ return getNext();
}
case 51: break;
case 21:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNext();
}
case 52: break;
case 33:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 11;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
// depends on control dependency: [if], data = [none]
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzInput = zzBufferL[zzFPos++];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzFState = 12;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
};
zzMarkedPos = zzFPos;
}
{ return getNext();
}
case 53: break;
case 34:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 13;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
// depends on control dependency: [if], data = [none]
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzInput = zzBufferL[zzFPos++];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzFState = 12;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
};
zzMarkedPos = zzFPos;
}
{ return getNext();
}
case 54: break;
case 40:
{ String txt = yytext();
if (escapeForwardSlashAsterisk) {
txt = delimit(txt, '/');
// depends on control dependency: [if], data = [none]
}
return getNext(txt, yytext());
}
case 55: break;
case 23:
{ final String origTxt = yytext();
String txt = origTxt;
if (normalizeSpace) {
txt = txt.replaceAll(" ", "\u00A0"); // change to non-breaking space
// depends on control dependency: [if], data = [none]
}
return getNext(txt, origTxt);
}
case 56: break;
case 6:
{ if (normalizeOtherBrackets) {
return getNext(closeparen, yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 57: break;
case 26:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 3;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
// depends on control dependency: [if], data = [none]
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzInput = zzBufferL[zzFPos++];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzFState = 4;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
};
zzMarkedPos = zzFPos;
}
{ final String origTxt = yytext();
String tmp = removeSoftHyphens(origTxt);
if (americanize) {
tmp = Americanize.americanize(tmp);
// depends on control dependency: [if], data = [none]
}
return getNext(tmp, origTxt);
}
case 58: break;
case 16:
{ if (normalizeOtherBrackets) {
return getNext(closebrace, yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 59: break;
case 24:
{ if (escapeForwardSlashAsterisk) {
return getNext(delimit(yytext(), '/'), yytext());
// depends on control dependency: [if], data = [none]
} else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 60: break;
case 18:
{ if (normalizeParentheses) {
return getNext(closeparen, yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 61: break;
case 36:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 9;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
// depends on control dependency: [if], data = [none]
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzInput = zzBufferL[zzFPos++];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzFState = 10;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
};
zzMarkedPos = zzFPos;
}
{ String s;
if (strictTreebank3) {
yypushback(1); // return a period for next time
// depends on control dependency: [if], data = [none]
s = yytext();
// depends on control dependency: [if], data = [none]
} else {
s = yytext();
// depends on control dependency: [if], data = [none]
yypushback(1); // return a period for next time
// depends on control dependency: [if], data = [none]
}
return getNext(s, yytext());
}
case 62: break;
case 39:
{ yypushback(3) ; return getNext();
}
case 63: break;
case 22:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return handleQuotes(yytext(), true);
}
case 64: break;
case 41:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 7;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
// depends on control dependency: [if], data = [none]
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzInput = zzBufferL[zzFPos++];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzFState = 8;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
};
zzMarkedPos = zzFPos;
}
{ String s;
// try to fight around an apparent jflex bug where it gets a space at the token
// end by getting wrong the length of the trailing context.
while (yylength() > 0) {
char last = yycharat(yylength()-1);
if (last == ' ' || last == '\t') {
yypushback(1);
// depends on control dependency: [if], data = [none]
} else {
break;
}
}
if (strictTreebank3) {
yypushback(1); // return a period for next time
// depends on control dependency: [if], data = [none]
s = yytext();
// depends on control dependency: [if], data = [none]
} else {
s = yytext();
// depends on control dependency: [if], data = [none]
yypushback(1); // return a period for next time
// depends on control dependency: [if], data = [none]
}
return getNext(s, yytext());
}
case 65: break;
case 2:
{ if (normalizeOtherBrackets) {
return getNext(openparen, yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 66: break;
case 32:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 5;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length) { zzFin = new boolean[zzBufferL.length+1]; }
// depends on control dependency: [if], data = [none]
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
if ((zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzInput = zzBufferL[zzFPos++];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
}
if (zzFState != -1 && (zzAttrL[zzFState] & 1) == 1) { zzFinL[zzFPos] = true; }
// depends on control dependency: [if], data = [none]
zzFState = 6;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = zzBufferL[--zzFPos];
// depends on control dependency: [while], data = [none]
zzFState = zzTransL[ zzRowMapL[zzFState] + zzCMapL[zzInput] ];
// depends on control dependency: [while], data = [none]
};
zzMarkedPos = zzFPos;
}
{ final String txt = yytext();
return getNext(removeSoftHyphens(txt),
txt);
}
case 67: break;
case 20:
{ if (normalizeOtherBrackets) {
return getNext(openbrace, yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 68: break;
case 17:
{ if (normalizeParentheses) {
return getNext(openparen, yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 69: break;
case 11:
{ return handleEllipsis(yytext());
}
case 70: break;
case 13:
{ return normalizeFractions(yytext());
}
case 71: break;
case 14:
{ if (normalizeCurrency) {
return getNext(normalizeCurrency(yytext()), yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 72: break;
case 10:
{ if (invertible) {
prevWordAfter.append(yytext());
// depends on control dependency: [if], data = [none]
}
}
case 73: break;
case 3:
{ if (escapeForwardSlashAsterisk) {
return getNext(delimit(yytext(), '/'), yytext()); }
// depends on control dependency: [if], data = [none]
else {
return getNext();
// depends on control dependency: [if], data = [none]
}
}
case 74: break;
case 37:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNext(removeSoftHyphens(yytext()),
yytext());
}
case 75: break;
case 25:
{ return getNext(removeSoftHyphens(yytext()), yytext());
}
case 76: break;
case 31:
{ String txt = yytext();
if (escapeForwardSlashAsterisk) {
txt = delimit(txt, '/');
// depends on control dependency: [if], data = [none]
}
if (normalizeSpace) {
txt = txt.replaceAll(" ", "\u00A0"); // change to non-breaking space
// depends on control dependency: [if], data = [none]
}
return getNext(txt, yytext());
}
case 77: break;
case 7:
{ final String origTxt = yytext();
String tmp = removeSoftHyphens(origTxt);
if (americanize) {
tmp = Americanize.americanize(tmp);
// depends on control dependency: [if], data = [none]
}
return getNext(tmp, origTxt);
}
case 78: break;
case 42:
{ String txt = yytext();
if (normalizeSpace) {
txt = txt.replaceAll(" ", "\u00A0"); // change to non-breaking space
// depends on control dependency: [if], data = [none]
}
if (normalizeParentheses) {
txt = txt.replaceAll("\\(", openparen);
txt = txt.replaceAll("\\)", closeparen);
// depends on control dependency: [if], data = [none]
}
return getNext(txt, yytext());
}
case 79: break;
case 9:
{ return getNext(removeSoftHyphens(yytext()),
yytext());
}
case 80: break;
case 27:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return getNext(removeSoftHyphens(yytext()),
yytext());
}
case 81: break;
case 1:
{ String str = yytext();
int first = str.charAt(0);
String msg = String.format("Untokenizable: %s (U+%s, decimal: %s)", yytext(), Integer.toHexString(first).toUpperCase(), Integer.toString(first));
switch (untokenizable) {
case NONE_DELETE:
if (invertible) {
prevWordAfter.append(str);
// depends on control dependency: [if], data = [none]
}
break;
case FIRST_DELETE:
if (invertible) {
prevWordAfter.append(str);
// depends on control dependency: [if], data = [none]
}
if ( ! this.seenUntokenizableCharacter) {
LOGGER.warning(msg);
// depends on control dependency: [if], data = [none]
this.seenUntokenizableCharacter = true;
// depends on control dependency: [if], data = [none]
}
break;
case ALL_DELETE:
if (invertible) {
prevWordAfter.append(str);
// depends on control dependency: [if], data = [none]
}
LOGGER.warning(msg);
this.seenUntokenizableCharacter = true;
break;
case NONE_KEEP:
return getNext();
case FIRST_KEEP:
if ( ! this.seenUntokenizableCharacter) {
LOGGER.warning(msg);
// depends on control dependency: [if], data = [none]
this.seenUntokenizableCharacter = true;
// depends on control dependency: [if], data = [none]
}
return getNext();
case ALL_KEEP:
LOGGER.warning(msg);
this.seenUntokenizableCharacter = true;
return getNext();
}
}
case 82: break;
case 5:
{ if (tokenizeNLs) {
return getNext(NEWLINE_TOKEN, yytext()); // js: for tokenizing carriage returns
// depends on control dependency: [if], data = [none]
} else if (invertible) {
prevWordAfter.append(yytext());
// depends on control dependency: [if], data = [none]
}
}
case 83: break;
case 35:
{ String txt = yytext();
if (escapeForwardSlashAsterisk) {
txt = delimit(txt, '/');
// depends on control dependency: [if], data = [none]
txt = delimit(txt, '*');
// depends on control dependency: [if], data = [none]
}
return getNext(txt, yytext());
}
case 84: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
// depends on control dependency: [if], data = [none]
{
if (invertible) {
prevWordAfter.append(yytext());
// depends on control dependency: [if], data = [none]
String str = prevWordAfter.toString();
prevWordAfter.setLength(0);
// depends on control dependency: [if], data = [none]
prevWord.set(AfterAnnotation.class, str);
// depends on control dependency: [if], data = [none]
}
return null;
}
}
else {
zzScanError(ZZ_NO_MATCH);
// depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public SlideContent getContent(final SlideStep slideStep) {
SlideContent res = null;
if (getSlide().getContent() != null && !getSlide().getContent().isEmpty()) {
for (final SlideContent sc : getSlide().getContent()) {
if (sc.getName() != null && !sc.getName().isEmpty() && sc.getName().equals(slideStep.name())) {
res = sc;
}
}
}
return res == null ? getDefaultContent() : res;
} } | public class class_name {
public SlideContent getContent(final SlideStep slideStep) {
SlideContent res = null;
if (getSlide().getContent() != null && !getSlide().getContent().isEmpty()) {
for (final SlideContent sc : getSlide().getContent()) {
if (sc.getName() != null && !sc.getName().isEmpty() && sc.getName().equals(slideStep.name())) {
res = sc; // depends on control dependency: [if], data = [none]
}
}
}
return res == null ? getDefaultContent() : res;
} } |
public class class_name {
public void add(int theOpCode, int theOperand) {
if (DEBUGCODE) {
System.out.println("Add " + bytecodeStr(theOpCode)
+ ", " + Integer.toHexString(theOperand));
}
int newStack = itsStackTop + stackChange(theOpCode);
if (newStack < 0 || Short.MAX_VALUE < newStack)
badStack(newStack);
switch (theOpCode) {
case ByteCode.GOTO:
// This is necessary because dead code is seemingly being
// generated and Sun's verifier is expecting type state to be
// placed even at dead blocks of code.
addSuperBlockStart(itsCodeBufferTop + 3);
// fallthru...
case ByteCode.IFEQ:
case ByteCode.IFNE:
case ByteCode.IFLT:
case ByteCode.IFGE:
case ByteCode.IFGT:
case ByteCode.IFLE:
case ByteCode.IF_ICMPEQ:
case ByteCode.IF_ICMPNE:
case ByteCode.IF_ICMPLT:
case ByteCode.IF_ICMPGE:
case ByteCode.IF_ICMPGT:
case ByteCode.IF_ICMPLE:
case ByteCode.IF_ACMPEQ:
case ByteCode.IF_ACMPNE:
case ByteCode.JSR:
case ByteCode.IFNULL:
case ByteCode.IFNONNULL: {
if ((theOperand & 0x80000000) != 0x80000000) {
if ((theOperand < 0) || (theOperand > 65535))
throw new IllegalArgumentException(
"Bad label for branch");
}
int branchPC = itsCodeBufferTop;
addToCodeBuffer(theOpCode);
if ((theOperand & 0x80000000) != 0x80000000) {
// hard displacement
addToCodeInt16(theOperand);
int target = theOperand + branchPC;
addSuperBlockStart(target);
itsJumpFroms.put(target, branchPC);
} else { // a label
int targetPC = getLabelPC(theOperand);
if (DEBUGLABELS) {
int theLabel = theOperand & 0x7FFFFFFF;
System.out.println("Fixing branch to " +
theLabel + " at " + targetPC +
" from " + branchPC);
}
if (targetPC != -1) {
int offset = targetPC - branchPC;
addToCodeInt16(offset);
addSuperBlockStart(targetPC);
itsJumpFroms.put(targetPC, branchPC);
} else {
addLabelFixup(theOperand, branchPC + 1);
addToCodeInt16(0);
}
}
}
break;
case ByteCode.BIPUSH:
if ((byte) theOperand != theOperand)
throw new IllegalArgumentException("out of range byte");
addToCodeBuffer(theOpCode);
addToCodeBuffer((byte) theOperand);
break;
case ByteCode.SIPUSH:
if ((short) theOperand != theOperand)
throw new IllegalArgumentException("out of range short");
addToCodeBuffer(theOpCode);
addToCodeInt16(theOperand);
break;
case ByteCode.NEWARRAY:
if (!(0 <= theOperand && theOperand < 256))
throw new IllegalArgumentException("out of range index");
addToCodeBuffer(theOpCode);
addToCodeBuffer(theOperand);
break;
case ByteCode.GETFIELD:
case ByteCode.PUTFIELD:
if (!(0 <= theOperand && theOperand < 65536))
throw new IllegalArgumentException("out of range field");
addToCodeBuffer(theOpCode);
addToCodeInt16(theOperand);
break;
case ByteCode.LDC:
case ByteCode.LDC_W:
case ByteCode.LDC2_W:
if (!(0 <= theOperand && theOperand < 65536))
throw new ClassFileFormatException("out of range index");
if (theOperand >= 256
|| theOpCode == ByteCode.LDC_W
|| theOpCode == ByteCode.LDC2_W) {
if (theOpCode == ByteCode.LDC) {
addToCodeBuffer(ByteCode.LDC_W);
} else {
addToCodeBuffer(theOpCode);
}
addToCodeInt16(theOperand);
} else {
addToCodeBuffer(theOpCode);
addToCodeBuffer(theOperand);
}
break;
case ByteCode.RET:
case ByteCode.ILOAD:
case ByteCode.LLOAD:
case ByteCode.FLOAD:
case ByteCode.DLOAD:
case ByteCode.ALOAD:
case ByteCode.ISTORE:
case ByteCode.LSTORE:
case ByteCode.FSTORE:
case ByteCode.DSTORE:
case ByteCode.ASTORE:
if (theOperand < 0 || 65536 <= theOperand)
throw new ClassFileFormatException("out of range variable");
if (theOperand >= 256) {
addToCodeBuffer(ByteCode.WIDE);
addToCodeBuffer(theOpCode);
addToCodeInt16(theOperand);
} else {
addToCodeBuffer(theOpCode);
addToCodeBuffer(theOperand);
}
break;
default:
throw new IllegalArgumentException(
"Unexpected opcode for 1 operand");
}
itsStackTop = (short) newStack;
if (newStack > itsMaxStack)
itsMaxStack = (short) newStack;
if (DEBUGSTACK) {
System.out.println("After " + bytecodeStr(theOpCode)
+ " stack = " + itsStackTop);
}
} } | public class class_name {
public void add(int theOpCode, int theOperand) {
if (DEBUGCODE) {
System.out.println("Add " + bytecodeStr(theOpCode)
+ ", " + Integer.toHexString(theOperand)); // depends on control dependency: [if], data = [none]
}
int newStack = itsStackTop + stackChange(theOpCode);
if (newStack < 0 || Short.MAX_VALUE < newStack)
badStack(newStack);
switch (theOpCode) {
case ByteCode.GOTO:
// This is necessary because dead code is seemingly being
// generated and Sun's verifier is expecting type state to be
// placed even at dead blocks of code.
addSuperBlockStart(itsCodeBufferTop + 3);
// fallthru...
case ByteCode.IFEQ:
case ByteCode.IFNE:
case ByteCode.IFLT:
case ByteCode.IFGE:
case ByteCode.IFGT:
case ByteCode.IFLE:
case ByteCode.IF_ICMPEQ:
case ByteCode.IF_ICMPNE:
case ByteCode.IF_ICMPLT:
case ByteCode.IF_ICMPGE:
case ByteCode.IF_ICMPGT:
case ByteCode.IF_ICMPLE:
case ByteCode.IF_ACMPEQ:
case ByteCode.IF_ACMPNE:
case ByteCode.JSR:
case ByteCode.IFNULL:
case ByteCode.IFNONNULL: {
if ((theOperand & 0x80000000) != 0x80000000) {
if ((theOperand < 0) || (theOperand > 65535))
throw new IllegalArgumentException(
"Bad label for branch");
}
int branchPC = itsCodeBufferTop;
addToCodeBuffer(theOpCode);
if ((theOperand & 0x80000000) != 0x80000000) {
// hard displacement
addToCodeInt16(theOperand); // depends on control dependency: [if], data = [none]
int target = theOperand + branchPC;
addSuperBlockStart(target); // depends on control dependency: [if], data = [none]
itsJumpFroms.put(target, branchPC); // depends on control dependency: [if], data = [none]
} else { // a label
int targetPC = getLabelPC(theOperand);
if (DEBUGLABELS) {
int theLabel = theOperand & 0x7FFFFFFF;
System.out.println("Fixing branch to " +
theLabel + " at " + targetPC +
" from " + branchPC); // depends on control dependency: [if], data = [none]
}
if (targetPC != -1) {
int offset = targetPC - branchPC;
addToCodeInt16(offset); // depends on control dependency: [if], data = [none]
addSuperBlockStart(targetPC); // depends on control dependency: [if], data = [(targetPC]
itsJumpFroms.put(targetPC, branchPC); // depends on control dependency: [if], data = [(targetPC]
} else {
addLabelFixup(theOperand, branchPC + 1); // depends on control dependency: [if], data = [none]
addToCodeInt16(0); // depends on control dependency: [if], data = [none]
}
}
}
break;
case ByteCode.BIPUSH:
if ((byte) theOperand != theOperand)
throw new IllegalArgumentException("out of range byte");
addToCodeBuffer(theOpCode);
addToCodeBuffer((byte) theOperand);
break;
case ByteCode.SIPUSH:
if ((short) theOperand != theOperand)
throw new IllegalArgumentException("out of range short");
addToCodeBuffer(theOpCode);
addToCodeInt16(theOperand);
break;
case ByteCode.NEWARRAY:
if (!(0 <= theOperand && theOperand < 256))
throw new IllegalArgumentException("out of range index");
addToCodeBuffer(theOpCode);
addToCodeBuffer(theOperand);
break;
case ByteCode.GETFIELD:
case ByteCode.PUTFIELD:
if (!(0 <= theOperand && theOperand < 65536))
throw new IllegalArgumentException("out of range field");
addToCodeBuffer(theOpCode);
addToCodeInt16(theOperand);
break;
case ByteCode.LDC:
case ByteCode.LDC_W:
case ByteCode.LDC2_W:
if (!(0 <= theOperand && theOperand < 65536))
throw new ClassFileFormatException("out of range index");
if (theOperand >= 256
|| theOpCode == ByteCode.LDC_W
|| theOpCode == ByteCode.LDC2_W) {
if (theOpCode == ByteCode.LDC) {
addToCodeBuffer(ByteCode.LDC_W); // depends on control dependency: [if], data = [none]
} else {
addToCodeBuffer(theOpCode); // depends on control dependency: [if], data = [(theOpCode]
}
addToCodeInt16(theOperand); // depends on control dependency: [if], data = [(theOperand]
} else {
addToCodeBuffer(theOpCode); // depends on control dependency: [if], data = [none]
addToCodeBuffer(theOperand); // depends on control dependency: [if], data = [(theOperand]
}
break;
case ByteCode.RET:
case ByteCode.ILOAD:
case ByteCode.LLOAD:
case ByteCode.FLOAD:
case ByteCode.DLOAD:
case ByteCode.ALOAD:
case ByteCode.ISTORE:
case ByteCode.LSTORE:
case ByteCode.FSTORE:
case ByteCode.DSTORE:
case ByteCode.ASTORE:
if (theOperand < 0 || 65536 <= theOperand)
throw new ClassFileFormatException("out of range variable");
if (theOperand >= 256) {
addToCodeBuffer(ByteCode.WIDE); // depends on control dependency: [if], data = [none]
addToCodeBuffer(theOpCode); // depends on control dependency: [if], data = [none]
addToCodeInt16(theOperand); // depends on control dependency: [if], data = [(theOperand]
} else {
addToCodeBuffer(theOpCode); // depends on control dependency: [if], data = [none]
addToCodeBuffer(theOperand); // depends on control dependency: [if], data = [(theOperand]
}
break;
default:
throw new IllegalArgumentException(
"Unexpected opcode for 1 operand");
}
itsStackTop = (short) newStack;
if (newStack > itsMaxStack)
itsMaxStack = (short) newStack;
if (DEBUGSTACK) {
System.out.println("After " + bytecodeStr(theOpCode)
+ " stack = " + itsStackTop); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet) {
checkNotNull(rangeSet);
if (rangeSet.isEmpty()) {
return of();
} else if (rangeSet.encloses(Range.<C>all())) {
return all();
}
if (rangeSet instanceof ImmutableRangeSet) {
ImmutableRangeSet<C> immutableRangeSet = (ImmutableRangeSet<C>) rangeSet;
if (!immutableRangeSet.isPartialView()) {
return immutableRangeSet;
}
}
return new ImmutableRangeSet<C>(ImmutableList.copyOf(rangeSet.asRanges()));
} } | public class class_name {
public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet) {
checkNotNull(rangeSet);
if (rangeSet.isEmpty()) {
return of(); // depends on control dependency: [if], data = [none]
} else if (rangeSet.encloses(Range.<C>all())) {
return all(); // depends on control dependency: [if], data = [none]
}
if (rangeSet instanceof ImmutableRangeSet) {
ImmutableRangeSet<C> immutableRangeSet = (ImmutableRangeSet<C>) rangeSet;
if (!immutableRangeSet.isPartialView()) {
return immutableRangeSet; // depends on control dependency: [if], data = [none]
}
}
return new ImmutableRangeSet<C>(ImmutableList.copyOf(rangeSet.asRanges()));
} } |
public class class_name {
protected void initOptions() {
if (null != toolOptions && !optionsHaveInited) {
for (CLIToolOptions toolOpts : toolOptions) {
toolOpts.addOptions(options);
}
optionsHaveInited=true;
}
} } | public class class_name {
protected void initOptions() {
if (null != toolOptions && !optionsHaveInited) {
for (CLIToolOptions toolOpts : toolOptions) {
toolOpts.addOptions(options); // depends on control dependency: [for], data = [toolOpts]
}
optionsHaveInited=true; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void publishEvent(FacesContext context,
Class<? extends SystemEvent> systemEventClass,
Object source) {
if (defaultApplication != null) {
defaultApplication.publishEvent(context, systemEventClass, source);
} else {
throw new UnsupportedOperationException();
}
} } | public class class_name {
public void publishEvent(FacesContext context,
Class<? extends SystemEvent> systemEventClass,
Object source) {
if (defaultApplication != null) {
defaultApplication.publishEvent(context, systemEventClass, source); // depends on control dependency: [if], data = [none]
} else {
throw new UnsupportedOperationException();
}
} } |
public class class_name {
public static AcceptPreference fromRequest(HttpServletRequest request) {
ArrayList<AcceptPreference> headers = new ArrayList<AcceptPreference>();
Enumeration<String> strHeaders = request.getHeaders(RFC7231_HEADER);
while (strHeaders.hasMoreElements()) {
headers.add(fromString(strHeaders.nextElement()));
}
if (headers.isEmpty()) {
return fromString("*/*");
} else {
return fromHeaders(headers);
}
} } | public class class_name {
public static AcceptPreference fromRequest(HttpServletRequest request) {
ArrayList<AcceptPreference> headers = new ArrayList<AcceptPreference>();
Enumeration<String> strHeaders = request.getHeaders(RFC7231_HEADER);
while (strHeaders.hasMoreElements()) {
headers.add(fromString(strHeaders.nextElement())); // depends on control dependency: [while], data = [none]
}
if (headers.isEmpty()) {
return fromString("*/*"); // depends on control dependency: [if], data = [none]
} else {
return fromHeaders(headers); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<ResourceRequestType.ResourceRequestCriterion> getResourceRequestCriterion()
{
if (resourceRequestCriterion == null)
{
resourceRequestCriterion = new ArrayList<ResourceRequestType.ResourceRequestCriterion>();
}
return this.resourceRequestCriterion;
} } | public class class_name {
public List<ResourceRequestType.ResourceRequestCriterion> getResourceRequestCriterion()
{
if (resourceRequestCriterion == null)
{
resourceRequestCriterion = new ArrayList<ResourceRequestType.ResourceRequestCriterion>(); // depends on control dependency: [if], data = [none]
}
return this.resourceRequestCriterion;
} } |
public class class_name {
public static KeyPairGenerator getKeyPairGenerator(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
KeyPairGenerator keyPairGen;
try {
keyPairGen = (null == provider) //
? KeyPairGenerator.getInstance(getMainAlgorithm(algorithm)) //
: KeyPairGenerator.getInstance(getMainAlgorithm(algorithm), provider);//
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
return keyPairGen;
} } | public class class_name {
public static KeyPairGenerator getKeyPairGenerator(String algorithm) {
final Provider provider = GlobalBouncyCastleProvider.INSTANCE.getProvider();
KeyPairGenerator keyPairGen;
try {
keyPairGen = (null == provider) //
? KeyPairGenerator.getInstance(getMainAlgorithm(algorithm)) //
: KeyPairGenerator.getInstance(getMainAlgorithm(algorithm), provider);//
// depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
throw new CryptoException(e);
}
// depends on control dependency: [catch], data = [none]
return keyPairGen;
} } |
public class class_name {
public void loadNewElementInfo(final AsyncCallback<Void> callback) {
CmsRpcAction<List<CmsNewResourceInfo>> newResourceInfoAction = new CmsRpcAction<List<CmsNewResourceInfo>>() {
@Override
public void execute() {
start(200, true);
getService().getNewElementInfo(m_data.getRoot().getSitePath(), this);
}
@Override
protected void onResponse(List<CmsNewResourceInfo> result) {
stop(false);
m_data.setNewElementInfos(result);
if (callback != null) {
callback.onSuccess(null);
}
}
};
newResourceInfoAction.execute();
} } | public class class_name {
public void loadNewElementInfo(final AsyncCallback<Void> callback) {
CmsRpcAction<List<CmsNewResourceInfo>> newResourceInfoAction = new CmsRpcAction<List<CmsNewResourceInfo>>() {
@Override
public void execute() {
start(200, true);
getService().getNewElementInfo(m_data.getRoot().getSitePath(), this);
}
@Override
protected void onResponse(List<CmsNewResourceInfo> result) {
stop(false);
m_data.setNewElementInfos(result);
if (callback != null) {
callback.onSuccess(null); // depends on control dependency: [if], data = [null)]
}
}
};
newResourceInfoAction.execute();
} } |
public class class_name {
protected void deleteTimerStartEventsForProcessDefinition(ProcessDefinition processDefinition) {
List<JobEntity> timerStartJobs = getJobManager().findJobsByConfiguration(TimerStartEventJobHandler.TYPE, processDefinition.getKey(), processDefinition.getTenantId());
ProcessDefinitionEntity latestVersion = getProcessDefinitionManager()
.findLatestProcessDefinitionByKeyAndTenantId(processDefinition.getKey(), processDefinition.getTenantId());
// delete timer start event jobs only if this is the latest version of the process definition.
if(latestVersion != null && latestVersion.getId().equals(processDefinition.getId())) {
for (Job job : timerStartJobs) {
((JobEntity)job).delete();
}
}
} } | public class class_name {
protected void deleteTimerStartEventsForProcessDefinition(ProcessDefinition processDefinition) {
List<JobEntity> timerStartJobs = getJobManager().findJobsByConfiguration(TimerStartEventJobHandler.TYPE, processDefinition.getKey(), processDefinition.getTenantId());
ProcessDefinitionEntity latestVersion = getProcessDefinitionManager()
.findLatestProcessDefinitionByKeyAndTenantId(processDefinition.getKey(), processDefinition.getTenantId());
// delete timer start event jobs only if this is the latest version of the process definition.
if(latestVersion != null && latestVersion.getId().equals(processDefinition.getId())) {
for (Job job : timerStartJobs) {
((JobEntity)job).delete(); // depends on control dependency: [for], data = [job]
}
}
} } |
public class class_name {
public String getListOfProvidersFromIdentities()
{
if(this.getIdentities() == null || this.getIdentities().isEmpty())
{
return "";
}
StringBuilder returnVal = new StringBuilder();
for(Identity identity : this.getIdentities())
{
returnVal.append(identity.getProvider());
returnVal.append(",");
}
String toString = returnVal.toString();
return toString.substring(0,toString.length() - 1);
} } | public class class_name {
public String getListOfProvidersFromIdentities()
{
if(this.getIdentities() == null || this.getIdentities().isEmpty())
{
return ""; // depends on control dependency: [if], data = [none]
}
StringBuilder returnVal = new StringBuilder();
for(Identity identity : this.getIdentities())
{
returnVal.append(identity.getProvider()); // depends on control dependency: [for], data = [identity]
returnVal.append(","); // depends on control dependency: [for], data = [none]
}
String toString = returnVal.toString();
return toString.substring(0,toString.length() - 1);
} } |
public class class_name {
private static <T> List<T> filterSelection(Class<T> clazz,
IStructuredSelection selection) {
List<T> list = new ArrayList<T>();
for (Object obj : selection.toList()) {
if (clazz.isAssignableFrom(obj.getClass())) {
list.add((T) obj);
}
}
return list;
} } | public class class_name {
private static <T> List<T> filterSelection(Class<T> clazz,
IStructuredSelection selection) {
List<T> list = new ArrayList<T>();
for (Object obj : selection.toList()) {
if (clazz.isAssignableFrom(obj.getClass())) {
list.add((T) obj); // depends on control dependency: [if], data = [none]
}
}
return list;
} } |
public class class_name {
protected JButton getBtnCancel() {
if (btnCancel == null) {
btnCancel = new JButton();
btnCancel.setName("btnCancel");
btnCancel.setText(Constant.messages.getString("all.button.cancel"));
btnCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
exitResult = JOptionPane.CANCEL_OPTION;
AbstractParamDialog.this.setVisible(false);
}
});
}
return btnCancel;
} } | public class class_name {
protected JButton getBtnCancel() {
if (btnCancel == null) {
btnCancel = new JButton(); // depends on control dependency: [if], data = [none]
btnCancel.setName("btnCancel"); // depends on control dependency: [if], data = [none]
btnCancel.setText(Constant.messages.getString("all.button.cancel")); // depends on control dependency: [if], data = [none]
btnCancel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
exitResult = JOptionPane.CANCEL_OPTION;
AbstractParamDialog.this.setVisible(false);
}
}); // depends on control dependency: [if], data = [none]
}
return btnCancel;
} } |
public class class_name {
public static RawData escape(ITemplate template, Object o) {
if (empty(o)) return RawData.NULL;
Escape escape;
if (null != template) {
escape = template.__curEscape();
} else {
RythmEngine engine = RythmEngine.get();
if (null != engine) {
escape = engine.conf().defaultCodeType().escape();
} else {
escape = Escape.RAW;
}
}
return escape.apply(o);
} } | public class class_name {
public static RawData escape(ITemplate template, Object o) {
if (empty(o)) return RawData.NULL;
Escape escape;
if (null != template) {
escape = template.__curEscape(); // depends on control dependency: [if], data = [none]
} else {
RythmEngine engine = RythmEngine.get();
if (null != engine) {
escape = engine.conf().defaultCodeType().escape(); // depends on control dependency: [if], data = [none]
} else {
escape = Escape.RAW; // depends on control dependency: [if], data = [none]
}
}
return escape.apply(o);
} } |
public class class_name {
public DirectoryVpcSettingsDescription withAvailabilityZones(String... availabilityZones) {
if (this.availabilityZones == null) {
setAvailabilityZones(new com.amazonaws.internal.SdkInternalList<String>(availabilityZones.length));
}
for (String ele : availabilityZones) {
this.availabilityZones.add(ele);
}
return this;
} } | public class class_name {
public DirectoryVpcSettingsDescription withAvailabilityZones(String... availabilityZones) {
if (this.availabilityZones == null) {
setAvailabilityZones(new com.amazonaws.internal.SdkInternalList<String>(availabilityZones.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : availabilityZones) {
this.availabilityZones.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
protected final Set<?> set(Object... datas) {
Set<Object> items = CollectUtils.newHashSet();
for (Object obj : datas) {
if (obj instanceof Class<?>) {
items.add(buildInnerReference((Class<?>) obj));
} else {
items.add(obj);
}
}
return items;
} } | public class class_name {
protected final Set<?> set(Object... datas) {
Set<Object> items = CollectUtils.newHashSet();
for (Object obj : datas) {
if (obj instanceof Class<?>) {
items.add(buildInnerReference((Class<?>) obj)); // depends on control dependency: [if], data = [)]
} else {
items.add(obj); // depends on control dependency: [if], data = [)]
}
}
return items;
} } |
public class class_name {
public void doOpen() throws DBException
{
try {
// FROM is automatic, since the remote BaseRecord is exactly the same as this one
// ORDER BY
KeyArea keyArea = this.getRecord().getKeyArea(-1); // Current index
String strKeyArea = null;
boolean bDirection = DBConstants.ASCENDING;
if (true)
{
strKeyArea = keyArea.getKeyName();
bDirection = keyArea.getKeyField(DBConstants.MAIN_KEY_FIELD).getKeyOrder();
}
m_bDirectionCurrent = bDirection;
// Open mode
int iOpenMode = this.getRecord().getOpenMode();
// SELECT (fields to select)
String strFields = null;
if (true) // All selected?
{
strFields = this.getRecord().getSQLFields(DBConstants.SQL_SELECT_TYPE, true);
if (strFields.equals(" *"))
strFields = null; // Select all
}
// WHERE XYZ >=
Object objInitialKey = null;
if (true)
{
BaseBuffer buffer = new VectorBuffer(null);
this.getRecord().handleInitialKey();
if (keyArea.isModified(DBConstants.START_SELECT_KEY))
{ // Anything set?
keyArea.setupKeyBuffer(buffer, DBConstants.START_SELECT_KEY, false);
objInitialKey = buffer.getPhysicalData();
buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.START_SELECT_KEY, false))); // Largest modified field.
}
}
// WHERE XYZ <=
Object objEndKey = null;
if (true)
{
BaseBuffer buffer = new VectorBuffer(null);
this.getRecord().handleEndKey();
if (keyArea.isModified(DBConstants.END_SELECT_KEY))
{ // Anything set?
keyArea.setupKeyBuffer(buffer, DBConstants.END_SELECT_KEY, false);
objEndKey = buffer.getPhysicalData();
buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.END_SELECT_KEY, false))); // Largest modified field.
}
}
// WHERE XYZ
byte[] byBehaviorData = null;
boolean bDirty = false;
if (this.getRecord().getListener() != null)
{
ByteArrayOutputStream baOut = new ByteArrayOutputStream();
ObjectOutputStream daOut = new ObjectOutputStream(baOut);
FileListener listener = (FileListener)this.getRecord().getListener();
while (listener != null)
{
if ((listener.getMasterSlaveFlag() & FileListener.RUN_IN_SLAVE) != 0) // Should exist in a SERVER environment
if ((listener.getMasterSlaveFlag() & FileListener.DONT_REPLICATE_TO_SLAVE) == 0) // Yes, replicate to the SERVER environment
if (listener.isEnabledListener()) // Yes, only replicate enabled listeners.
{ // There should be a copy of this on the server
bDirty = true;
daOut.writeUTF(listener.getClass().getName());
listener.initRemoteStub(daOut);
}
listener = (FileListener)listener.getNextListener();
}
daOut.flush();
if (bDirty)
byBehaviorData = baOut.toByteArray();
daOut.close();
baOut.close();
}
this.checkCacheMode(Boolean.TRUE); // Make sure the cache is set up correctly for this type of query (typically needed)
synchronized (this.getSyncObject())
{ // In case this is called from another task
m_tableRemote.open(strKeyArea, iOpenMode, bDirection, strFields, objInitialKey, objEndKey, byBehaviorData);
}
} catch (Exception ex) {
throw DatabaseException.toDatabaseException(ex);
}
} } | public class class_name {
public void doOpen() throws DBException
{
try {
// FROM is automatic, since the remote BaseRecord is exactly the same as this one
// ORDER BY
KeyArea keyArea = this.getRecord().getKeyArea(-1); // Current index
String strKeyArea = null;
boolean bDirection = DBConstants.ASCENDING;
if (true)
{
strKeyArea = keyArea.getKeyName();
bDirection = keyArea.getKeyField(DBConstants.MAIN_KEY_FIELD).getKeyOrder();
}
m_bDirectionCurrent = bDirection;
// Open mode
int iOpenMode = this.getRecord().getOpenMode();
// SELECT (fields to select)
String strFields = null;
if (true) // All selected?
{
strFields = this.getRecord().getSQLFields(DBConstants.SQL_SELECT_TYPE, true);
if (strFields.equals(" *"))
strFields = null; // Select all
}
// WHERE XYZ >=
Object objInitialKey = null;
if (true)
{
BaseBuffer buffer = new VectorBuffer(null);
this.getRecord().handleInitialKey();
if (keyArea.isModified(DBConstants.START_SELECT_KEY))
{ // Anything set?
keyArea.setupKeyBuffer(buffer, DBConstants.START_SELECT_KEY, false); // depends on control dependency: [if], data = [none]
objInitialKey = buffer.getPhysicalData(); // depends on control dependency: [if], data = [none]
buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.START_SELECT_KEY, false))); // Largest modified field. // depends on control dependency: [if], data = [none]
}
}
// WHERE XYZ <=
Object objEndKey = null;
if (true)
{
BaseBuffer buffer = new VectorBuffer(null);
this.getRecord().handleEndKey();
if (keyArea.isModified(DBConstants.END_SELECT_KEY))
{ // Anything set?
keyArea.setupKeyBuffer(buffer, DBConstants.END_SELECT_KEY, false); // depends on control dependency: [if], data = [none]
objEndKey = buffer.getPhysicalData(); // depends on control dependency: [if], data = [none]
buffer.addNextString(Integer.toString(keyArea.lastModified(DBConstants.END_SELECT_KEY, false))); // Largest modified field. // depends on control dependency: [if], data = [none]
}
}
// WHERE XYZ
byte[] byBehaviorData = null;
boolean bDirty = false;
if (this.getRecord().getListener() != null)
{
ByteArrayOutputStream baOut = new ByteArrayOutputStream();
ObjectOutputStream daOut = new ObjectOutputStream(baOut);
FileListener listener = (FileListener)this.getRecord().getListener();
while (listener != null)
{
if ((listener.getMasterSlaveFlag() & FileListener.RUN_IN_SLAVE) != 0) // Should exist in a SERVER environment
if ((listener.getMasterSlaveFlag() & FileListener.DONT_REPLICATE_TO_SLAVE) == 0) // Yes, replicate to the SERVER environment
if (listener.isEnabledListener()) // Yes, only replicate enabled listeners.
{ // There should be a copy of this on the server
bDirty = true;
daOut.writeUTF(listener.getClass().getName());
listener.initRemoteStub(daOut);
}
listener = (FileListener)listener.getNextListener();
}
daOut.flush();
if (bDirty)
byBehaviorData = baOut.toByteArray();
daOut.close();
baOut.close();
}
this.checkCacheMode(Boolean.TRUE); // Make sure the cache is set up correctly for this type of query (typically needed)
synchronized (this.getSyncObject())
{ // In case this is called from another task
m_tableRemote.open(strKeyArea, iOpenMode, bDirection, strFields, objInitialKey, objEndKey, byBehaviorData);
}
} catch (Exception ex) {
throw DatabaseException.toDatabaseException(ex);
}
} } |
public class class_name {
public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) {
// use the camel catalog
String json = camelCatalog.modelJSonSchema(modelName);
if (json == null) {
throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
}
List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
if (data != null) {
for (Map<String, String> propertyMap : data) {
String output = propertyMap.get("output");
if (output != null) {
return "true".equals(output);
}
}
}
return false;
} } | public class class_name {
public static boolean isModelSupportOutput(CamelCatalog camelCatalog, String modelName) {
// use the camel catalog
String json = camelCatalog.modelJSonSchema(modelName);
if (json == null) {
throw new IllegalArgumentException("Could not find catalog entry for model name: " + modelName);
}
List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("model", json, false);
if (data != null) {
for (Map<String, String> propertyMap : data) {
String output = propertyMap.get("output");
if (output != null) {
return "true".equals(output); // depends on control dependency: [if], data = [(output]
}
}
}
return false;
} } |
public class class_name {
private Composite getOrCreateGroup(Object parent, String name) {
if (groups.containsKey(name)) {
return groups.get(name);
}
Composite group = new Composite(name);
mapWidget.getVectorContext().drawGroup(parent, group);
groups.put(name, group);
return group;
} } | public class class_name {
private Composite getOrCreateGroup(Object parent, String name) {
if (groups.containsKey(name)) {
return groups.get(name); // depends on control dependency: [if], data = [none]
}
Composite group = new Composite(name);
mapWidget.getVectorContext().drawGroup(parent, group);
groups.put(name, group);
return group;
} } |
public class class_name {
public void onSave(StubAmp stub, Result<Void> result)
{
try {
MethodAmp onDelete = _onDelete;
MethodAmp onSave = _onSave;
if (stub.state().isDelete() && onDelete != null) {
onDelete.query(HeadersNull.NULL, result, stub);
}
else if (onSave != null) {
//QueryRefAmp queryRef = new QueryRefChainAmpCompletion(result);
onSave.query(HeadersNull.NULL, result, stub);
}
else {
result.ok(null);
}
stub.state().onSaveComplete(stub);
//stub.onSaveEnd(true);
} catch (Throwable e) {
e.printStackTrace();
result.fail(e);
}
} } | public class class_name {
public void onSave(StubAmp stub, Result<Void> result)
{
try {
MethodAmp onDelete = _onDelete;
MethodAmp onSave = _onSave;
if (stub.state().isDelete() && onDelete != null) {
onDelete.query(HeadersNull.NULL, result, stub); // depends on control dependency: [if], data = [none]
}
else if (onSave != null) {
//QueryRefAmp queryRef = new QueryRefChainAmpCompletion(result);
onSave.query(HeadersNull.NULL, result, stub); // depends on control dependency: [if], data = [none]
}
else {
result.ok(null); // depends on control dependency: [if], data = [null)]
}
stub.state().onSaveComplete(stub); // depends on control dependency: [try], data = [none]
//stub.onSaveEnd(true);
} catch (Throwable e) {
e.printStackTrace();
result.fail(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean getBooleanValue(String primaryKey, String secondaryKey) {
Object val = CFG.get(primaryKey);
if (val == null) {
val = CFG.get(secondaryKey);
if (val == null) {
throw new SofaRpcRuntimeException("Not found key: " + primaryKey + "/" + secondaryKey);
}
}
return Boolean.valueOf(val.toString());
} } | public class class_name {
public static boolean getBooleanValue(String primaryKey, String secondaryKey) {
Object val = CFG.get(primaryKey);
if (val == null) {
val = CFG.get(secondaryKey); // depends on control dependency: [if], data = [none]
if (val == null) {
throw new SofaRpcRuntimeException("Not found key: " + primaryKey + "/" + secondaryKey);
}
}
return Boolean.valueOf(val.toString());
} } |
public class class_name {
@CallerSensitive
public static java.util.Enumeration<Driver> getDrivers() {
java.util.Vector<Driver> result = new java.util.Vector<Driver>();
ClassLoader callerClassLoader = ClassLoader.getSystemClassLoader();
// Walk through the loaded registeredDrivers.
for(DriverInfo aDriver : registeredDrivers) {
// If the caller does not have permission to load the driver then
// skip it.
if(isDriverAllowed(aDriver.driver, callerClassLoader)) {
result.addElement(aDriver.driver);
} else {
println(" skipping: " + aDriver.getClass().getName());
}
}
return (result.elements());
} } | public class class_name {
@CallerSensitive
public static java.util.Enumeration<Driver> getDrivers() {
java.util.Vector<Driver> result = new java.util.Vector<Driver>();
ClassLoader callerClassLoader = ClassLoader.getSystemClassLoader();
// Walk through the loaded registeredDrivers.
for(DriverInfo aDriver : registeredDrivers) {
// If the caller does not have permission to load the driver then
// skip it.
if(isDriverAllowed(aDriver.driver, callerClassLoader)) {
result.addElement(aDriver.driver); // depends on control dependency: [if], data = [none]
} else {
println(" skipping: " + aDriver.getClass().getName()); // depends on control dependency: [if], data = [none]
}
}
return (result.elements());
} } |
public class class_name {
public void fireResultAdded(Result r, Result parent) {
for(int i = resultListenerList.size(); --i >= 0;) {
resultListenerList.get(i).resultAdded(r, parent);
}
} } | public class class_name {
public void fireResultAdded(Result r, Result parent) {
for(int i = resultListenerList.size(); --i >= 0;) {
resultListenerList.get(i).resultAdded(r, parent); // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public void marshall(DeleteAlgorithmRequest deleteAlgorithmRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteAlgorithmRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteAlgorithmRequest.getAlgorithmName(), ALGORITHMNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DeleteAlgorithmRequest deleteAlgorithmRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteAlgorithmRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteAlgorithmRequest.getAlgorithmName(), ALGORITHMNAME_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 Set<String> getGroupIds( String parentGroupId )
{
Set<String> result = new TreeSet<String>();
for ( int i = 0; i < stores.length; i++ )
{
Set<String> groupIds = stores[i].getGroupIds( parentGroupId );
if ( groupIds != null )
{
result.addAll( groupIds );
}
}
return result;
} } | public class class_name {
public Set<String> getGroupIds( String parentGroupId )
{
Set<String> result = new TreeSet<String>();
for ( int i = 0; i < stores.length; i++ )
{
Set<String> groupIds = stores[i].getGroupIds( parentGroupId );
if ( groupIds != null )
{
result.addAll( groupIds ); // depends on control dependency: [if], data = [( groupIds]
}
}
return result;
} } |
public class class_name {
public void complete(VirtualConnection vc, TCPReadRequestContext rsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc);
}
// all we have to do is get the service context and continue the read
// process
if (vc instanceof OutboundVirtualConnection) {
HttpOutboundServiceContextImpl osc = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
osc.continueRead();
} else {
HttpInboundServiceContextImpl isc = (HttpInboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPISC);
isc.continueRead();
}
} } | public class class_name {
public void complete(VirtualConnection vc, TCPReadRequestContext rsc) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "complete() called: vc=" + vc); // depends on control dependency: [if], data = [none]
}
// all we have to do is get the service context and continue the read
// process
if (vc instanceof OutboundVirtualConnection) {
HttpOutboundServiceContextImpl osc = (HttpOutboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPOSC);
osc.continueRead(); // depends on control dependency: [if], data = [none]
} else {
HttpInboundServiceContextImpl isc = (HttpInboundServiceContextImpl) vc.getStateMap().get(CallbackIDs.CALLBACK_HTTPISC);
isc.continueRead(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public ValueRange range(ChronoField field) {
switch (field) {
case DAY_OF_MONTH:
case DAY_OF_WEEK:
case MICRO_OF_DAY:
case MICRO_OF_SECOND:
case HOUR_OF_DAY:
case HOUR_OF_AMPM:
case MINUTE_OF_DAY:
case MINUTE_OF_HOUR:
case SECOND_OF_DAY:
case SECOND_OF_MINUTE:
case MILLI_OF_DAY:
case MILLI_OF_SECOND:
case NANO_OF_DAY:
case NANO_OF_SECOND:
case CLOCK_HOUR_OF_DAY:
case CLOCK_HOUR_OF_AMPM:
case EPOCH_DAY:
case PROLEPTIC_MONTH:
return field.range();
}
Calendar jcal = Calendar.getInstance(LOCALE);
switch (field) {
case ERA: {
JapaneseEra[] eras = JapaneseEra.values();
return ValueRange.of(eras[0].getValue(), eras[eras.length - 1].getValue());
}
case YEAR: {
JapaneseEra[] eras = JapaneseEra.values();
return ValueRange.of(JapaneseDate.MIN_DATE.getYear(), eras[eras.length - 1].endDate().getYear());
}
case YEAR_OF_ERA: {
JapaneseEra[] eras = JapaneseEra.values();
int maxIso = eras[eras.length - 1].endDate().getYear();
int maxJapanese = maxIso - eras[eras.length - 1].startDate().getYear() + 1;
int min = Integer.MAX_VALUE;
for (int i = 0; i < eras.length; i++) {
min = Math.min(min, eras[i].endDate().getYear() - eras[i].startDate().getYear() + 1);
}
return ValueRange.of(1, 6, min, maxJapanese);
}
case MONTH_OF_YEAR:
return ValueRange.of(jcal.getMinimum(Calendar.MONTH) + 1, jcal.getGreatestMinimum(Calendar.MONTH) + 1,
jcal.getLeastMaximum(Calendar.MONTH) + 1, jcal.getMaximum(Calendar.MONTH) + 1);
case DAY_OF_YEAR: {
JapaneseEra[] eras = JapaneseEra.values();
int min = 366;
for (int i = 0; i < eras.length; i++) {
min = Math.min(min, eras[i].startDate().lengthOfYear() - eras[i].startDate().getDayOfYear() + 1);
}
return ValueRange.of(1, min, 366);
}
default:
// TODO: review the remaining fields
throw new UnsupportedOperationException("Unimplementable field: " + field);
}
} } | public class class_name {
@Override
public ValueRange range(ChronoField field) {
switch (field) {
case DAY_OF_MONTH:
case DAY_OF_WEEK:
case MICRO_OF_DAY:
case MICRO_OF_SECOND:
case HOUR_OF_DAY:
case HOUR_OF_AMPM:
case MINUTE_OF_DAY:
case MINUTE_OF_HOUR:
case SECOND_OF_DAY:
case SECOND_OF_MINUTE:
case MILLI_OF_DAY:
case MILLI_OF_SECOND:
case NANO_OF_DAY:
case NANO_OF_SECOND:
case CLOCK_HOUR_OF_DAY:
case CLOCK_HOUR_OF_AMPM:
case EPOCH_DAY:
case PROLEPTIC_MONTH:
return field.range();
}
Calendar jcal = Calendar.getInstance(LOCALE);
switch (field) {
case ERA: {
JapaneseEra[] eras = JapaneseEra.values();
return ValueRange.of(eras[0].getValue(), eras[eras.length - 1].getValue());
}
case YEAR: {
JapaneseEra[] eras = JapaneseEra.values();
return ValueRange.of(JapaneseDate.MIN_DATE.getYear(), eras[eras.length - 1].endDate().getYear());
}
case YEAR_OF_ERA: {
JapaneseEra[] eras = JapaneseEra.values();
int maxIso = eras[eras.length - 1].endDate().getYear();
int maxJapanese = maxIso - eras[eras.length - 1].startDate().getYear() + 1;
int min = Integer.MAX_VALUE;
for (int i = 0; i < eras.length; i++) {
min = Math.min(min, eras[i].endDate().getYear() - eras[i].startDate().getYear() + 1);
}
return ValueRange.of(1, 6, min, maxJapanese);
}
case MONTH_OF_YEAR:
return ValueRange.of(jcal.getMinimum(Calendar.MONTH) + 1, jcal.getGreatestMinimum(Calendar.MONTH) + 1,
jcal.getLeastMaximum(Calendar.MONTH) + 1, jcal.getMaximum(Calendar.MONTH) + 1);
case DAY_OF_YEAR: {
JapaneseEra[] eras = JapaneseEra.values();
int min = 366;
for (int i = 0; i < eras.length; i++) {
min = Math.min(min, eras[i].startDate().lengthOfYear() - eras[i].startDate().getDayOfYear() + 1); // depends on control dependency: [for], data = [i]
}
return ValueRange.of(1, min, 366);
}
default:
// TODO: review the remaining fields
throw new UnsupportedOperationException("Unimplementable field: " + field);
}
} } |
public class class_name {
private String getStandardAction(String id, HttpMethod requestMethod) {
String action = null;
if (requestMethod == HttpMethod.GET) {
if (id == null) {
action = INDEX_ACTION;
} else {
action = SHOW_ACTION;
}
} else if (requestMethod == HttpMethod.POST) {
action = CREATE_ACTION;
} else if (requestMethod == HttpMethod.DELETE) {
action = DESTROY_ACTION;
} else if (requestMethod.equals(HttpMethod.PUT)) {
action = UPDATE_ACTION;
}
return action;
} } | public class class_name {
private String getStandardAction(String id, HttpMethod requestMethod) {
String action = null;
if (requestMethod == HttpMethod.GET) {
if (id == null) {
action = INDEX_ACTION; // depends on control dependency: [if], data = [none]
} else {
action = SHOW_ACTION; // depends on control dependency: [if], data = [none]
}
} else if (requestMethod == HttpMethod.POST) {
action = CREATE_ACTION; // depends on control dependency: [if], data = [none]
} else if (requestMethod == HttpMethod.DELETE) {
action = DESTROY_ACTION; // depends on control dependency: [if], data = [none]
} else if (requestMethod.equals(HttpMethod.PUT)) {
action = UPDATE_ACTION; // depends on control dependency: [if], data = [none]
}
return action;
} } |
public class class_name {
private static ReadConfiguration getLocalConfiguration(String shortcutOrFile) {
File file = new File(shortcutOrFile);
if (file.exists()) return getLocalConfiguration(file);
else {
int pos = shortcutOrFile.indexOf(':');
if (pos<0) pos = shortcutOrFile.length();
String backend = shortcutOrFile.substring(0,pos);
Preconditions.checkArgument(StandardStoreManager.getAllManagerClasses().containsKey(backend.toLowerCase()), "Backend shorthand unknown: %s", backend);
String secondArg = null;
if (pos+1<shortcutOrFile.length()) secondArg = shortcutOrFile.substring(pos + 1).trim();
BaseConfiguration config = new BaseConfiguration();
ModifiableConfiguration writeConfig = new ModifiableConfiguration(ROOT_NS,new CommonsConfiguration(config), BasicConfiguration.Restriction.NONE);
writeConfig.set(STORAGE_BACKEND,backend);
ConfigOption option = Backend.getOptionForShorthand(backend);
if (option==null) {
Preconditions.checkArgument(secondArg==null);
} else if (option==STORAGE_DIRECTORY || option==STORAGE_CONF_FILE) {
Preconditions.checkArgument(StringUtils.isNotBlank(secondArg),"Need to provide additional argument to initialize storage backend");
writeConfig.set(option,getAbsolutePath(secondArg));
} else if (option==STORAGE_HOSTS) {
Preconditions.checkArgument(StringUtils.isNotBlank(secondArg),"Need to provide additional argument to initialize storage backend");
writeConfig.set(option,new String[]{secondArg});
} else throw new IllegalArgumentException("Invalid configuration option for backend "+option);
return new CommonsConfiguration(config);
}
} } | public class class_name {
private static ReadConfiguration getLocalConfiguration(String shortcutOrFile) {
File file = new File(shortcutOrFile);
if (file.exists()) return getLocalConfiguration(file);
else {
int pos = shortcutOrFile.indexOf(':');
if (pos<0) pos = shortcutOrFile.length();
String backend = shortcutOrFile.substring(0,pos);
Preconditions.checkArgument(StandardStoreManager.getAllManagerClasses().containsKey(backend.toLowerCase()), "Backend shorthand unknown: %s", backend); // depends on control dependency: [if], data = [none]
String secondArg = null;
if (pos+1<shortcutOrFile.length()) secondArg = shortcutOrFile.substring(pos + 1).trim();
BaseConfiguration config = new BaseConfiguration();
ModifiableConfiguration writeConfig = new ModifiableConfiguration(ROOT_NS,new CommonsConfiguration(config), BasicConfiguration.Restriction.NONE);
writeConfig.set(STORAGE_BACKEND,backend); // depends on control dependency: [if], data = [none]
ConfigOption option = Backend.getOptionForShorthand(backend);
if (option==null) {
Preconditions.checkArgument(secondArg==null); // depends on control dependency: [if], data = [null)]
} else if (option==STORAGE_DIRECTORY || option==STORAGE_CONF_FILE) {
Preconditions.checkArgument(StringUtils.isNotBlank(secondArg),"Need to provide additional argument to initialize storage backend"); // depends on control dependency: [if], data = [none]
writeConfig.set(option,getAbsolutePath(secondArg)); // depends on control dependency: [if], data = [(option]
} else if (option==STORAGE_HOSTS) {
Preconditions.checkArgument(StringUtils.isNotBlank(secondArg),"Need to provide additional argument to initialize storage backend"); // depends on control dependency: [if], data = [none]
writeConfig.set(option,new String[]{secondArg}); // depends on control dependency: [if], data = [(option]
} else throw new IllegalArgumentException("Invalid configuration option for backend "+option);
return new CommonsConfiguration(config); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Nonnull
public static Set<OWLAxiom> getAxiomsWithoutTypes(@Nonnull Set<OWLAxiom> sourceAxioms,
@Nonnull AxiomType<?>... axiomTypes) {
Set<OWLAxiom> result = new HashSet<>();
Set<AxiomType<?>> disallowed = Sets.newHashSet(axiomTypes);
for (OWLAxiom ax : sourceAxioms) {
if (!disallowed.contains(ax.getAxiomType())) {
result.add(ax);
}
}
return result;
} } | public class class_name {
@Nonnull
public static Set<OWLAxiom> getAxiomsWithoutTypes(@Nonnull Set<OWLAxiom> sourceAxioms,
@Nonnull AxiomType<?>... axiomTypes) {
Set<OWLAxiom> result = new HashSet<>();
Set<AxiomType<?>> disallowed = Sets.newHashSet(axiomTypes);
for (OWLAxiom ax : sourceAxioms) {
if (!disallowed.contains(ax.getAxiomType())) {
result.add(ax); // depends on control dependency: [if], data = [none]
}
}
return result;
} } |
public class class_name {
public String encrypt(String string, SecretKey key) {
// Basic null check.
// An empty string can be encrypted:
if (string == null) {
return null;
}
Cipher cipher = getCipher();
// Convert the input Sting to a byte array:
byte[] iv = Generate.byteArray(getIvSize(cipher));
byte[] data = ByteArray.fromString(string);
// Encrypt the data:
byte[] result = encrypt(iv, data, key, cipher);
// Prepend the IV
result = ArrayUtils.addAll(iv, result);
// Return as a String:
return ByteArray.toBase64(result);
} } | public class class_name {
public String encrypt(String string, SecretKey key) {
// Basic null check.
// An empty string can be encrypted:
if (string == null) {
return null;
// depends on control dependency: [if], data = [none]
}
Cipher cipher = getCipher();
// Convert the input Sting to a byte array:
byte[] iv = Generate.byteArray(getIvSize(cipher));
byte[] data = ByteArray.fromString(string);
// Encrypt the data:
byte[] result = encrypt(iv, data, key, cipher);
// Prepend the IV
result = ArrayUtils.addAll(iv, result);
// Return as a String:
return ByteArray.toBase64(result);
} } |
public class class_name {
@Override
public void run() {
LOG.entering(CLASS_NAME, "run");
try {
LOG.log(Level.FINE, "Subscribe event handlers");
subscribe(StartTime.class, this.startHandler.get());
subscribe(StopTime.class, this.stopHandler.get());
subscribe(RuntimeStart.class, this.runtimeStartHandler.get());
subscribe(RuntimeStop.class, this.runtimeStopHandler.get());
subscribe(IdleClock.class, this.idleHandler.get());
LOG.log(Level.FINE, "Initiate runtime start");
this.handlers.onNext(new RuntimeStart(this.timer.getCurrent()));
LOG.log(Level.FINE, "Initiate start time");
this.handlers.onNext(new StartTime(this.timer.getCurrent()));
while (true) {
LOG.log(Level.FINEST, "Enter clock main loop.");
try {
if (this.isIdle()) {
// Handle an idle clock event, without locking this.schedule
this.handlers.onNext(new IdleClock(this.timer.getCurrent()));
}
final Time event;
final int eventQueueLen;
synchronized (this.schedule) {
while (this.schedule.isEmpty()) {
this.schedule.wait();
}
assert this.schedule.first() != null;
// Wait until the first scheduled time is ready.
// NOTE: while waiting, another alarm could be scheduled with a shorter duration
// so the next time I go around the loop I need to revise my duration.
while (true) {
final long waitDuration = this.timer.getDuration(this.schedule.first());
if (waitDuration <= 0) {
break;
}
this.schedule.wait(waitDuration);
}
// Remove the event from the schedule and process it:
event = this.schedule.pollFirst();
if (event instanceof ClientAlarm) {
--this.numClientAlarms;
assert this.numClientAlarms >= 0;
}
eventQueueLen = this.numClientAlarms;
}
assert event != null;
LOG.log(Level.FINER,
"Process event: {0} Outstanding client alarms: {1}", new Object[] {event, eventQueueLen});
if (event instanceof Alarm) {
((Alarm) event).run();
} else {
this.handlers.onNext(event);
if (event instanceof StopTime) {
break; // we're done.
}
}
} catch (final InterruptedException expected) {
LOG.log(Level.FINEST, "Wait interrupted; continue event loop.");
}
}
this.handlers.onNext(new RuntimeStop(this.timer.getCurrent(), this.exceptionCausedStop));
} catch (final Exception e) {
LOG.log(Level.SEVERE, "Error in runtime clock", e);
this.handlers.onNext(new RuntimeStop(this.timer.getCurrent(), e));
} finally {
LOG.log(Level.FINE, "Runtime clock exit");
}
LOG.exiting(CLASS_NAME, "run");
} } | public class class_name {
@Override
public void run() {
LOG.entering(CLASS_NAME, "run");
try {
LOG.log(Level.FINE, "Subscribe event handlers"); // depends on control dependency: [try], data = [none]
subscribe(StartTime.class, this.startHandler.get()); // depends on control dependency: [try], data = [none]
subscribe(StopTime.class, this.stopHandler.get()); // depends on control dependency: [try], data = [none]
subscribe(RuntimeStart.class, this.runtimeStartHandler.get()); // depends on control dependency: [try], data = [none]
subscribe(RuntimeStop.class, this.runtimeStopHandler.get()); // depends on control dependency: [try], data = [none]
subscribe(IdleClock.class, this.idleHandler.get()); // depends on control dependency: [try], data = [none]
LOG.log(Level.FINE, "Initiate runtime start"); // depends on control dependency: [try], data = [none]
this.handlers.onNext(new RuntimeStart(this.timer.getCurrent())); // depends on control dependency: [try], data = [none]
LOG.log(Level.FINE, "Initiate start time"); // depends on control dependency: [try], data = [none]
this.handlers.onNext(new StartTime(this.timer.getCurrent())); // depends on control dependency: [try], data = [none]
while (true) {
LOG.log(Level.FINEST, "Enter clock main loop."); // depends on control dependency: [while], data = [none]
try {
if (this.isIdle()) {
// Handle an idle clock event, without locking this.schedule
this.handlers.onNext(new IdleClock(this.timer.getCurrent())); // depends on control dependency: [if], data = [none]
}
final Time event;
final int eventQueueLen;
synchronized (this.schedule) { // depends on control dependency: [try], data = [none]
while (this.schedule.isEmpty()) {
this.schedule.wait(); // depends on control dependency: [while], data = [none]
}
assert this.schedule.first() != null;
// Wait until the first scheduled time is ready.
// NOTE: while waiting, another alarm could be scheduled with a shorter duration
// so the next time I go around the loop I need to revise my duration.
while (true) {
final long waitDuration = this.timer.getDuration(this.schedule.first());
if (waitDuration <= 0) {
break;
}
this.schedule.wait(waitDuration); // depends on control dependency: [while], data = [none]
}
// Remove the event from the schedule and process it:
event = this.schedule.pollFirst();
if (event instanceof ClientAlarm) {
--this.numClientAlarms; // depends on control dependency: [if], data = [none]
assert this.numClientAlarms >= 0;
}
eventQueueLen = this.numClientAlarms;
}
assert event != null;
LOG.log(Level.FINER,
"Process event: {0} Outstanding client alarms: {1}", new Object[] {event, eventQueueLen}); // depends on control dependency: [try], data = [none]
if (event instanceof Alarm) {
((Alarm) event).run(); // depends on control dependency: [if], data = [none]
} else {
this.handlers.onNext(event); // depends on control dependency: [if], data = [none]
if (event instanceof StopTime) {
break; // we're done.
}
}
} catch (final InterruptedException expected) {
LOG.log(Level.FINEST, "Wait interrupted; continue event loop.");
} // depends on control dependency: [catch], data = [none]
}
this.handlers.onNext(new RuntimeStop(this.timer.getCurrent(), this.exceptionCausedStop)); // depends on control dependency: [try], data = [exception]
} catch (final Exception e) {
LOG.log(Level.SEVERE, "Error in runtime clock", e);
this.handlers.onNext(new RuntimeStop(this.timer.getCurrent(), e));
} finally { // depends on control dependency: [catch], data = [none]
LOG.log(Level.FINE, "Runtime clock exit");
}
LOG.exiting(CLASS_NAME, "run");
} } |
public class class_name {
public static void sendAttachmentFile(final String uri) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
if (TextUtils.isEmpty(uri)) {
return false; // TODO: add error message
}
CompoundMessage message = new CompoundMessage();
// No body, just attachment
message.setBody(null);
message.setRead(true);
message.setHidden(true);
message.setSenderId(conversation.getPerson().getId());
ArrayList<StoredFile> attachmentStoredFiles = new ArrayList<StoredFile>();
/* Make a local copy in the cache dir. By default the file name is "apptentive-api-file + nonce"
* If original uri is known, the name will be taken from the original uri
*/
Context context = ApptentiveInternal.getInstance().getApplicationContext();
String localFilePath = Util.generateCacheFilePathFromNonceOrPrefix(context, message.getNonce(), Uri.parse(uri).getLastPathSegment());
String mimeType = Util.getMimeTypeFromUri(context, Uri.parse(uri));
MimeTypeMap mime = MimeTypeMap.getSingleton();
String extension = mime.getExtensionFromMimeType(mimeType);
// If we can't get the mime type from the uri, try getting it from the extension.
if (extension == null) {
extension = MimeTypeMap.getFileExtensionFromUrl(uri);
}
if (mimeType == null && extension != null) {
mimeType = mime.getMimeTypeFromExtension(extension);
}
if (!TextUtils.isEmpty(extension)) {
localFilePath += "." + extension;
}
StoredFile storedFile = Util.createLocalStoredFile(uri, localFilePath, mimeType);
if (storedFile == null) {
return false; // TODO: add error message
}
storedFile.setId(message.getNonce());
attachmentStoredFiles.add(storedFile);
message.setAssociatedFiles(attachmentStoredFiles);
conversation.getMessageManager().sendMessage(message);
return true;
}
}, "send attachment file");
} } | public class class_name {
public static void sendAttachmentFile(final String uri) {
dispatchConversationTask(new ConversationDispatchTask() {
@Override
protected boolean execute(Conversation conversation) {
if (TextUtils.isEmpty(uri)) {
return false; // TODO: add error message // depends on control dependency: [if], data = [none]
}
CompoundMessage message = new CompoundMessage();
// No body, just attachment
message.setBody(null);
message.setRead(true);
message.setHidden(true);
message.setSenderId(conversation.getPerson().getId());
ArrayList<StoredFile> attachmentStoredFiles = new ArrayList<StoredFile>();
/* Make a local copy in the cache dir. By default the file name is "apptentive-api-file + nonce"
* If original uri is known, the name will be taken from the original uri
*/
Context context = ApptentiveInternal.getInstance().getApplicationContext();
String localFilePath = Util.generateCacheFilePathFromNonceOrPrefix(context, message.getNonce(), Uri.parse(uri).getLastPathSegment());
String mimeType = Util.getMimeTypeFromUri(context, Uri.parse(uri));
MimeTypeMap mime = MimeTypeMap.getSingleton();
String extension = mime.getExtensionFromMimeType(mimeType);
// If we can't get the mime type from the uri, try getting it from the extension.
if (extension == null) {
extension = MimeTypeMap.getFileExtensionFromUrl(uri); // depends on control dependency: [if], data = [none]
}
if (mimeType == null && extension != null) {
mimeType = mime.getMimeTypeFromExtension(extension); // depends on control dependency: [if], data = [none]
}
if (!TextUtils.isEmpty(extension)) {
localFilePath += "." + extension; // depends on control dependency: [if], data = [none]
}
StoredFile storedFile = Util.createLocalStoredFile(uri, localFilePath, mimeType);
if (storedFile == null) {
return false; // TODO: add error message // depends on control dependency: [if], data = [none]
}
storedFile.setId(message.getNonce());
attachmentStoredFiles.add(storedFile);
message.setAssociatedFiles(attachmentStoredFiles);
conversation.getMessageManager().sendMessage(message);
return true;
}
}, "send attachment file");
} } |
public class class_name {
public static boolean isAncestor(int idx1, int idx2, int[] parents) {
int anc = parents[idx2];
while (anc != -1) {
if (anc == idx1) {
return true;
}
anc = parents[anc];
}
return false;
} } | public class class_name {
public static boolean isAncestor(int idx1, int idx2, int[] parents) {
int anc = parents[idx2];
while (anc != -1) {
if (anc == idx1) {
return true; // depends on control dependency: [if], data = [none]
}
anc = parents[anc]; // depends on control dependency: [while], data = [none]
}
return false;
} } |
public class class_name {
public static NanoResponse serve(String url, String method, Properties header, Properties parms, String post_body) {
boolean hideParameters = true;
try {
// Jack priority for user-visible requests
Thread.currentThread().setPriority(Thread.MAX_PRIORITY - 1);
RequestType type = RequestType.requestType(url);
RequestUri uri = new RequestUri(method, url);
// Log the request
hideParameters = maybeLogRequest(uri, header, parms);
// For certain "special" requests that produce non-JSON payloads we require special handling.
NanoResponse special = maybeServeSpecial(uri);
if (special != null) return special;
// Determine the Route corresponding to this request, and also fill in {parms} with the path parameters
Route route = routesTree.lookup(uri, parms);
//----- DEPRECATED API handling ------------
// These APIs are broken, because they lead users to create invalid URLs. For example the endpoint
// /3/Frames/{frameid}/export/{path}/overwrite/{force}
// is invalid, because it leads to URLs like this:
// /3/Frames/predictions_9bd5_GLM_model_R_1471148_36_on_RTMP_sid_afec_27/export//tmp/pred.csv/overwrite/TRUE
// Here both the {frame_id} and {path} usually contain "/" (making them non-tokens), they may contain other
// special characters not valid within URLs (for example if filename is not in ASCII); finally the use of strings
// to represent booleans creates ambiguities: should I write "true", "True", "TRUE", or perhaps "1"?
//
// TODO These should be removed as soon as possible...
if (url.startsWith("/3/Frames/")) {
// /3/Frames/{frame_id}/export/{path}/overwrite/{force}
if ((url.toLowerCase().endsWith("/overwrite/true") || url.toLowerCase().endsWith("/overwrite/false")) && url.contains("/export/")) {
int i = url.indexOf("/export/");
boolean force = url.toLowerCase().endsWith("true");
parms.put("frame_id", url.substring(10, i));
parms.put("path", url.substring(i+8, url.length()-15-(force?0:1)));
parms.put("force", force? "true" : "false");
route = findRouteByApiName("exportFrame_deprecated");
}
// /3/Frames/{frame_id}/export
else if (url.endsWith("/export")) {
parms.put("frame_id", url.substring(10, url.length()-7));
route = findRouteByApiName("exportFrame");
}
// /3/Frames/{frame_id}/columns/{column}/summary
else if (url.endsWith("/summary") && url.contains("/columns/")) {
int i = url.indexOf("/columns/");
parms.put("frame_id", url.substring(10, i));
parms.put("column", url.substring(i+9, url.length()-8));
route = findRouteByApiName("frameColumnSummary");
}
// /3/Frames/{frame_id}/columns/{column}/domain
else if (url.endsWith("/domain") && url.contains("/columns/")) {
int i = url.indexOf("/columns/");
parms.put("frame_id", url.substring(10, i));
parms.put("column", url.substring(i+9, url.length()-7));
route = findRouteByApiName("frameColumnDomain");
}
// /3/Frames/{frame_id}/columns/{column}
else if (url.contains("/columns/")) {
int i = url.indexOf("/columns/");
parms.put("frame_id", url.substring(10, i));
parms.put("column", url.substring(i+9));
route = findRouteByApiName("frameColumn");
}
// /3/Frames/{frame_id}/summary
else if (url.endsWith("/summary")) {
parms.put("frame_id", url.substring(10, url.length()-8));
route = findRouteByApiName("frameSummary");
}
// /3/Frames/{frame_id}/light
else if (url.endsWith("/light")) {
parms.put("frame_id", url.substring(10, url.length()-"/light".length()));
route = findRouteByApiName("lightFrame");
}
// /3/Frames/{frame_id}/columns
else if (url.endsWith("/columns")) {
parms.put("frame_id", url.substring(10, url.length()-8));
route = findRouteByApiName("frameColumns");
}
// /3/Frames/{frame_id}
else {
parms.put("frame_id", url.substring(10));
route = findRouteByApiName(method.equals("DELETE")? "deleteFrame" : "frame");
}
} else if (url.startsWith("/3/ModelMetrics/predictions_frame/")){
route = findRouteByApiName("makeMetrics");
}
//------------------------------------------
if (route == null) {
// if the request is not known, treat as resource request, or 404 if not found
if (uri.isGetMethod())
return getResource(type, url);
else
return response404(method + " " + url, type);
} else {
Schema response = route._handler.handle(uri.getVersion(), route, parms, post_body);
PojoUtils.filterFields(response, (String)parms.get("_include_fields"), (String)parms.get("_exclude_fields"));
return serveSchema(response, type);
}
}
catch (H2OFailException e) {
H2OError error = e.toH2OError(url);
Log.fatal("Caught exception (fatal to the cluster): " + error.toString());
throw H2O.fail(serveError(error).toString());
}
catch (H2OModelBuilderIllegalArgumentException e) {
H2OModelBuilderError error = e.toH2OError(url);
Log.warn("Caught exception: " + error.toString());
return serveSchema(new H2OModelBuilderErrorV3().fillFromImpl(error), RequestType.json);
}
catch (H2OAbstractRuntimeException e) {
H2OError error = e.toH2OError(url);
Log.warn("Caught exception: " + error.toString());
return serveError(error);
}
catch (AssertionError e) {
H2OError error = new H2OError(
System.currentTimeMillis(),
url,
e.toString(),
e.toString(),
HttpResponseStatus.INTERNAL_SERVER_ERROR.getCode(),
new IcedHashMapGeneric.IcedHashMapStringObject(),
e);
Log.err("Caught assertion error: " + error.toString());
return serveError(error);
}
catch (Exception e) {
// make sure that no Exception is ever thrown out from the request
H2OError error = new H2OError(e, url);
// some special cases for which we return 400 because it's likely a problem with the client request:
if (e instanceof IllegalArgumentException || e instanceof FileNotFoundException || e instanceof MalformedURLException)
error._http_status = HttpResponseStatus.BAD_REQUEST.getCode();
String parmsInfo = hideParameters ? "<hidden>" : String.valueOf(parms);
Log.err("Caught exception: " + error.toString() + ";parms=" + parmsInfo);
return serveError(error);
}
} } | public class class_name {
public static NanoResponse serve(String url, String method, Properties header, Properties parms, String post_body) {
boolean hideParameters = true;
try {
// Jack priority for user-visible requests
Thread.currentThread().setPriority(Thread.MAX_PRIORITY - 1); // depends on control dependency: [try], data = [none]
RequestType type = RequestType.requestType(url);
RequestUri uri = new RequestUri(method, url);
// Log the request
hideParameters = maybeLogRequest(uri, header, parms); // depends on control dependency: [try], data = [none]
// For certain "special" requests that produce non-JSON payloads we require special handling.
NanoResponse special = maybeServeSpecial(uri);
if (special != null) return special;
// Determine the Route corresponding to this request, and also fill in {parms} with the path parameters
Route route = routesTree.lookup(uri, parms);
//----- DEPRECATED API handling ------------
// These APIs are broken, because they lead users to create invalid URLs. For example the endpoint
// /3/Frames/{frameid}/export/{path}/overwrite/{force}
// is invalid, because it leads to URLs like this:
// /3/Frames/predictions_9bd5_GLM_model_R_1471148_36_on_RTMP_sid_afec_27/export//tmp/pred.csv/overwrite/TRUE
// Here both the {frame_id} and {path} usually contain "/" (making them non-tokens), they may contain other
// special characters not valid within URLs (for example if filename is not in ASCII); finally the use of strings
// to represent booleans creates ambiguities: should I write "true", "True", "TRUE", or perhaps "1"?
//
// TODO These should be removed as soon as possible...
if (url.startsWith("/3/Frames/")) {
// /3/Frames/{frame_id}/export/{path}/overwrite/{force}
if ((url.toLowerCase().endsWith("/overwrite/true") || url.toLowerCase().endsWith("/overwrite/false")) && url.contains("/export/")) {
int i = url.indexOf("/export/");
boolean force = url.toLowerCase().endsWith("true");
parms.put("frame_id", url.substring(10, i)); // depends on control dependency: [if], data = [none]
parms.put("path", url.substring(i+8, url.length()-15-(force?0:1))); // depends on control dependency: [if], data = [none]
parms.put("force", force? "true" : "false"); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("exportFrame_deprecated"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}/export
else if (url.endsWith("/export")) {
parms.put("frame_id", url.substring(10, url.length()-7)); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("exportFrame"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}/columns/{column}/summary
else if (url.endsWith("/summary") && url.contains("/columns/")) {
int i = url.indexOf("/columns/");
parms.put("frame_id", url.substring(10, i)); // depends on control dependency: [if], data = [none]
parms.put("column", url.substring(i+9, url.length()-8)); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("frameColumnSummary"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}/columns/{column}/domain
else if (url.endsWith("/domain") && url.contains("/columns/")) {
int i = url.indexOf("/columns/");
parms.put("frame_id", url.substring(10, i)); // depends on control dependency: [if], data = [none]
parms.put("column", url.substring(i+9, url.length()-7)); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("frameColumnDomain"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}/columns/{column}
else if (url.contains("/columns/")) {
int i = url.indexOf("/columns/");
parms.put("frame_id", url.substring(10, i)); // depends on control dependency: [if], data = [none]
parms.put("column", url.substring(i+9)); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("frameColumn"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}/summary
else if (url.endsWith("/summary")) {
parms.put("frame_id", url.substring(10, url.length()-8)); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("frameSummary"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}/light
else if (url.endsWith("/light")) {
parms.put("frame_id", url.substring(10, url.length()-"/light".length())); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("lightFrame"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}/columns
else if (url.endsWith("/columns")) {
parms.put("frame_id", url.substring(10, url.length()-8)); // depends on control dependency: [if], data = [none]
route = findRouteByApiName("frameColumns"); // depends on control dependency: [if], data = [none]
}
// /3/Frames/{frame_id}
else {
parms.put("frame_id", url.substring(10)); // depends on control dependency: [if], data = [none]
route = findRouteByApiName(method.equals("DELETE")? "deleteFrame" : "frame"); // depends on control dependency: [if], data = [none]
}
} else if (url.startsWith("/3/ModelMetrics/predictions_frame/")){
route = findRouteByApiName("makeMetrics"); // depends on control dependency: [if], data = [none]
}
//------------------------------------------
if (route == null) {
// if the request is not known, treat as resource request, or 404 if not found
if (uri.isGetMethod())
return getResource(type, url);
else
return response404(method + " " + url, type);
} else {
Schema response = route._handler.handle(uri.getVersion(), route, parms, post_body);
PojoUtils.filterFields(response, (String)parms.get("_include_fields"), (String)parms.get("_exclude_fields")); // depends on control dependency: [if], data = [none]
return serveSchema(response, type); // depends on control dependency: [if], data = [none]
}
}
catch (H2OFailException e) {
H2OError error = e.toH2OError(url);
Log.fatal("Caught exception (fatal to the cluster): " + error.toString());
throw H2O.fail(serveError(error).toString());
} // depends on control dependency: [catch], data = [none]
catch (H2OModelBuilderIllegalArgumentException e) {
H2OModelBuilderError error = e.toH2OError(url);
Log.warn("Caught exception: " + error.toString());
return serveSchema(new H2OModelBuilderErrorV3().fillFromImpl(error), RequestType.json);
} // depends on control dependency: [catch], data = [none]
catch (H2OAbstractRuntimeException e) {
H2OError error = e.toH2OError(url);
Log.warn("Caught exception: " + error.toString());
return serveError(error);
} // depends on control dependency: [catch], data = [none]
catch (AssertionError e) {
H2OError error = new H2OError(
System.currentTimeMillis(),
url,
e.toString(),
e.toString(),
HttpResponseStatus.INTERNAL_SERVER_ERROR.getCode(),
new IcedHashMapGeneric.IcedHashMapStringObject(),
e);
Log.err("Caught assertion error: " + error.toString());
return serveError(error);
} // depends on control dependency: [catch], data = [none]
catch (Exception e) {
// make sure that no Exception is ever thrown out from the request
H2OError error = new H2OError(e, url);
// some special cases for which we return 400 because it's likely a problem with the client request:
if (e instanceof IllegalArgumentException || e instanceof FileNotFoundException || e instanceof MalformedURLException)
error._http_status = HttpResponseStatus.BAD_REQUEST.getCode();
String parmsInfo = hideParameters ? "<hidden>" : String.valueOf(parms);
Log.err("Caught exception: " + error.toString() + ";parms=" + parmsInfo);
return serveError(error);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void generate(ConfigurationImpl configuration,
ClassUseMapper mapper, ClassDoc classdoc) {
ClassUseWriter clsgen;
DocPath path = DocPath.forPackage(classdoc)
.resolve(DocPaths.CLASS_USE)
.resolve(DocPath.forName(classdoc));
try {
clsgen = new ClassUseWriter(configuration,
mapper, path,
classdoc);
clsgen.generateClassUseFile();
clsgen.close();
} catch (IOException exc) {
configuration.standardmessage.
error("doclet.exception_encountered",
exc.toString(), path.getPath());
throw new DocletAbortException(exc);
}
} } | public class class_name {
public static void generate(ConfigurationImpl configuration,
ClassUseMapper mapper, ClassDoc classdoc) {
ClassUseWriter clsgen;
DocPath path = DocPath.forPackage(classdoc)
.resolve(DocPaths.CLASS_USE)
.resolve(DocPath.forName(classdoc));
try {
clsgen = new ClassUseWriter(configuration,
mapper, path,
classdoc); // depends on control dependency: [try], data = [none]
clsgen.generateClassUseFile(); // depends on control dependency: [try], data = [none]
clsgen.close(); // depends on control dependency: [try], data = [none]
} catch (IOException exc) {
configuration.standardmessage.
error("doclet.exception_encountered",
exc.toString(), path.getPath());
throw new DocletAbortException(exc);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void submitRequests() {
//==========================================================================//
//================= Submit a Spot Instance Request =====================//
//==========================================================================//
// Initializes a Spot Instance Request
RequestSpotInstancesRequest requestRequest = new RequestSpotInstancesRequest();
// Request 1 x t1.micro instance with a bid price of $0.03.
requestRequest.setSpotPrice(bidPrice);
requestRequest.setInstanceCount(Integer.valueOf(1));
// Setup the specifications of the launch. This includes the instance type (e.g. t1.micro)
// and the latest Amazon Linux AMI id available. Note, you should always use the latest
// Amazon Linux AMI id or another of your choosing.
LaunchSpecification launchSpecification = new LaunchSpecification();
launchSpecification.setImageId(amiID);
launchSpecification.setInstanceType(instanceType);
// Add the security group to the request.
ArrayList<String> securityGroups = new ArrayList<String>();
securityGroups.add(securityGroup);
launchSpecification.setSecurityGroups(securityGroups);
// If a placement group has been set, then we will use it in the request.
if (placementGroupName != null && !placementGroupName.equals("")) {
// Setup the placement group to use with whatever name you desire.
SpotPlacement placement = new SpotPlacement();
placement.setGroupName(placementGroupName);
launchSpecification.setPlacement(placement);
}
// Check to see if we need to set the availability zone name.
if (availabilityZoneName != null && !availabilityZoneName.equals("")) {
// Setup the availability zone to use. Note we could retrieve the availability
// zones using the ec2.describeAvailabilityZones() API.
SpotPlacement placement = new SpotPlacement(availabilityZoneName);
launchSpecification.setPlacement(placement);
}
if (availabilityZoneGroupName != null && !availabilityZoneGroupName.equals("")) {
// Set the availability zone group.
requestRequest.setAvailabilityZoneGroup(availabilityZoneGroupName);
}
// Check to see if we need to set the launch group.
if (launchGroupName != null && !launchGroupName.equals("")) {
// Set the availability launch group.
requestRequest.setLaunchGroup(launchGroupName);
}
// Check to see if we need to set the valid from option.
if (validFrom != null) {
requestRequest.setValidFrom(validFrom);
}
// Check to see if we need to set the valid until option.
if (validTo != null) {
requestRequest.setValidUntil(validFrom);
}
// Check to see if we need to set the request type.
if (requestType != null && !requestType.equals("")) {
// Set the type of the bid.
requestRequest.setType(requestType);
}
// If we should delete the EBS boot partition on termination.
if (!deleteOnTermination) {
// Create the block device mapping to describe the root partition.
BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
blockDeviceMapping.setDeviceName("/dev/sda1");
// Set the delete on termination flag to false.
EbsBlockDevice ebs = new EbsBlockDevice();
ebs.setDeleteOnTermination(Boolean.FALSE);
blockDeviceMapping.setEbs(ebs);
// Add the block device mapping to the block list.
ArrayList<BlockDeviceMapping> blockList = new ArrayList<BlockDeviceMapping>();
blockList.add(blockDeviceMapping);
// Set the block device mapping configuration in the launch specifications.
launchSpecification.setBlockDeviceMappings(blockList);
}
// Add the launch specifications to the request.
requestRequest.setLaunchSpecification(launchSpecification);
// Call the RequestSpotInstance API.
RequestSpotInstancesResult requestResult = ec2.requestSpotInstances(requestRequest);
List<SpotInstanceRequest> requestResponses = requestResult.getSpotInstanceRequests();
// Setup an arraylist to collect all of the request ids we want to watch hit the running
// state.
spotInstanceRequestIds = new ArrayList<String>();
// Add all of the request ids to the hashset, so we can determine when they hit the
// active state.
for (SpotInstanceRequest requestResponse : requestResponses) {
System.out.println("Created Spot Request: "+requestResponse.getSpotInstanceRequestId());
spotInstanceRequestIds.add(requestResponse.getSpotInstanceRequestId());
}
} } | public class class_name {
public void submitRequests() {
//==========================================================================//
//================= Submit a Spot Instance Request =====================//
//==========================================================================//
// Initializes a Spot Instance Request
RequestSpotInstancesRequest requestRequest = new RequestSpotInstancesRequest();
// Request 1 x t1.micro instance with a bid price of $0.03.
requestRequest.setSpotPrice(bidPrice);
requestRequest.setInstanceCount(Integer.valueOf(1));
// Setup the specifications of the launch. This includes the instance type (e.g. t1.micro)
// and the latest Amazon Linux AMI id available. Note, you should always use the latest
// Amazon Linux AMI id or another of your choosing.
LaunchSpecification launchSpecification = new LaunchSpecification();
launchSpecification.setImageId(amiID);
launchSpecification.setInstanceType(instanceType);
// Add the security group to the request.
ArrayList<String> securityGroups = new ArrayList<String>();
securityGroups.add(securityGroup);
launchSpecification.setSecurityGroups(securityGroups);
// If a placement group has been set, then we will use it in the request.
if (placementGroupName != null && !placementGroupName.equals("")) {
// Setup the placement group to use with whatever name you desire.
SpotPlacement placement = new SpotPlacement();
placement.setGroupName(placementGroupName);
// depends on control dependency: [if], data = [(placementGroupName]
launchSpecification.setPlacement(placement);
// depends on control dependency: [if], data = [none]
}
// Check to see if we need to set the availability zone name.
if (availabilityZoneName != null && !availabilityZoneName.equals("")) {
// Setup the availability zone to use. Note we could retrieve the availability
// zones using the ec2.describeAvailabilityZones() API.
SpotPlacement placement = new SpotPlacement(availabilityZoneName);
launchSpecification.setPlacement(placement);
// depends on control dependency: [if], data = [none]
}
if (availabilityZoneGroupName != null && !availabilityZoneGroupName.equals("")) {
// Set the availability zone group.
requestRequest.setAvailabilityZoneGroup(availabilityZoneGroupName);
// depends on control dependency: [if], data = [(availabilityZoneGroupName]
}
// Check to see if we need to set the launch group.
if (launchGroupName != null && !launchGroupName.equals("")) {
// Set the availability launch group.
requestRequest.setLaunchGroup(launchGroupName);
// depends on control dependency: [if], data = [(launchGroupName]
}
// Check to see if we need to set the valid from option.
if (validFrom != null) {
requestRequest.setValidFrom(validFrom);
// depends on control dependency: [if], data = [(validFrom]
}
// Check to see if we need to set the valid until option.
if (validTo != null) {
requestRequest.setValidUntil(validFrom);
// depends on control dependency: [if], data = [none]
}
// Check to see if we need to set the request type.
if (requestType != null && !requestType.equals("")) {
// Set the type of the bid.
requestRequest.setType(requestType);
// depends on control dependency: [if], data = [(requestType]
}
// If we should delete the EBS boot partition on termination.
if (!deleteOnTermination) {
// Create the block device mapping to describe the root partition.
BlockDeviceMapping blockDeviceMapping = new BlockDeviceMapping();
blockDeviceMapping.setDeviceName("/dev/sda1");
// depends on control dependency: [if], data = [none]
// Set the delete on termination flag to false.
EbsBlockDevice ebs = new EbsBlockDevice();
ebs.setDeleteOnTermination(Boolean.FALSE);
// depends on control dependency: [if], data = [none]
blockDeviceMapping.setEbs(ebs);
// depends on control dependency: [if], data = [none]
// Add the block device mapping to the block list.
ArrayList<BlockDeviceMapping> blockList = new ArrayList<BlockDeviceMapping>();
blockList.add(blockDeviceMapping);
// depends on control dependency: [if], data = [none]
// Set the block device mapping configuration in the launch specifications.
launchSpecification.setBlockDeviceMappings(blockList);
// depends on control dependency: [if], data = [none]
}
// Add the launch specifications to the request.
requestRequest.setLaunchSpecification(launchSpecification);
// Call the RequestSpotInstance API.
RequestSpotInstancesResult requestResult = ec2.requestSpotInstances(requestRequest);
List<SpotInstanceRequest> requestResponses = requestResult.getSpotInstanceRequests();
// Setup an arraylist to collect all of the request ids we want to watch hit the running
// state.
spotInstanceRequestIds = new ArrayList<String>();
// Add all of the request ids to the hashset, so we can determine when they hit the
// active state.
for (SpotInstanceRequest requestResponse : requestResponses) {
System.out.println("Created Spot Request: "+requestResponse.getSpotInstanceRequestId());
// depends on control dependency: [for], data = [requestResponse]
spotInstanceRequestIds.add(requestResponse.getSpotInstanceRequestId());
// depends on control dependency: [for], data = [requestResponse]
}
} } |
public class class_name {
public void setRetentionConfigurations(java.util.Collection<RetentionConfiguration> retentionConfigurations) {
if (retentionConfigurations == null) {
this.retentionConfigurations = null;
return;
}
this.retentionConfigurations = new com.amazonaws.internal.SdkInternalList<RetentionConfiguration>(retentionConfigurations);
} } | public class class_name {
public void setRetentionConfigurations(java.util.Collection<RetentionConfiguration> retentionConfigurations) {
if (retentionConfigurations == null) {
this.retentionConfigurations = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.retentionConfigurations = new com.amazonaws.internal.SdkInternalList<RetentionConfiguration>(retentionConfigurations);
} } |
public class class_name {
static PublicKey
parseRecord(int alg, byte [] data) {
ByteArrayInputStream bytes = new ByteArrayInputStream(data);
DataInputStream in = new DataInputStream(bytes);
try {
switch (alg) {
case DNSSEC.RSAMD5:
case DNSSEC.RSASHA1:
case DNSSEC.RSA_NSEC3_SHA1:
return parseRSA(in);
case DNSSEC.DH:
return parseDH(in);
case DNSSEC.DSA:
case DNSSEC.DSA_NSEC3_SHA1:
return parseDSA(in);
default:
return null;
}
}
catch (IOException e) {
if (Options.check("verboseexceptions"))
System.err.println(e);
return null;
}
} } | public class class_name {
static PublicKey
parseRecord(int alg, byte [] data) {
ByteArrayInputStream bytes = new ByteArrayInputStream(data);
DataInputStream in = new DataInputStream(bytes);
try {
switch (alg) {
case DNSSEC.RSAMD5:
case DNSSEC.RSASHA1:
case DNSSEC.RSA_NSEC3_SHA1:
return parseRSA(in);
case DNSSEC.DH:
return parseDH(in);
case DNSSEC.DSA:
case DNSSEC.DSA_NSEC3_SHA1:
return parseDSA(in);
default:
return null;
}
}
catch (IOException e) {
if (Options.check("verboseexceptions"))
System.err.println(e);
return null;
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
public boolean handles(String command) {
if (command.startsWith(this.tree.getTopNode().getData())) {
return true;
}
return false;
} } | public class class_name {
@Override
public boolean handles(String command) {
if (command.startsWith(this.tree.getTopNode().getData())) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public void marshall(ListTagOptionsFilters listTagOptionsFilters, ProtocolMarshaller protocolMarshaller) {
if (listTagOptionsFilters == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTagOptionsFilters.getKey(), KEY_BINDING);
protocolMarshaller.marshall(listTagOptionsFilters.getValue(), VALUE_BINDING);
protocolMarshaller.marshall(listTagOptionsFilters.getActive(), ACTIVE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(ListTagOptionsFilters listTagOptionsFilters, ProtocolMarshaller protocolMarshaller) {
if (listTagOptionsFilters == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listTagOptionsFilters.getKey(), KEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listTagOptionsFilters.getValue(), VALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listTagOptionsFilters.getActive(), ACTIVE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String copy(String str, int count) {
if (str == null) {
throw new NullPointerException("原始字符串不能为null");
}
if (count <= 0) {
throw new IllegalArgumentException("次数必须大于0");
}
if (count == 1) {
return str;
}
if (count == 2) {
return str + str;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
sb.append(str);
}
return sb.toString();
} } | public class class_name {
public static String copy(String str, int count) {
if (str == null) {
throw new NullPointerException("原始字符串不能为null");
}
if (count <= 0) {
throw new IllegalArgumentException("次数必须大于0");
}
if (count == 1) {
return str; // depends on control dependency: [if], data = [none]
}
if (count == 2) {
return str + str; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < count; i++) {
sb.append(str); // depends on control dependency: [for], data = [none]
}
return sb.toString();
} } |
public class class_name {
@Override
protected void doPost(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
LOG.debug("Entering");
final AtomHandler handler = createAtomRequestHandler(req, res);
final String userName = handler.getAuthenticatedUsername();
if (userName != null) {
final AtomRequest areq = new AtomRequestImpl(req);
try {
if (handler.isCollectionURI(areq)) {
if (req.getContentType().startsWith("application/atom+xml")) {
// parse incoming entry
final Entry entry = Atom10Parser.parseEntry(new BufferedReader(new InputStreamReader(req.getInputStream(), "UTF-8")), null, Locale.US);
// call handler to post it
final Entry newEntry = handler.postEntry(areq, entry);
// set Location and Content-Location headers
for (final Object element : newEntry.getOtherLinks()) {
final Link link = (Link) element;
if ("edit".equals(link.getRel())) {
res.addHeader("Location", link.getHrefResolved());
break;
}
}
for (final Object element : newEntry.getAlternateLinks()) {
final Link link = (Link) element;
if ("alternate".equals(link.getRel())) {
res.addHeader("Content-Location", link.getHrefResolved());
break;
}
}
// write entry back out to response
res.setStatus(HttpServletResponse.SC_CREATED);
res.setContentType("application/atom+xml; type=entry; charset=utf-8");
final Writer writer = res.getWriter();
Atom10Generator.serializeEntry(newEntry, writer);
writer.close();
} else if (req.getContentType() != null) {
// get incoming title and slug from HTTP header
final String title = areq.getHeader("Title");
// create new entry for resource, set title and type
final Entry resource = new Entry();
resource.setTitle(title);
final Content content = new Content();
content.setType(areq.getContentType());
resource.setContents(Collections.singletonList(content));
// hand input stream off to hander to post file
final Entry newEntry = handler.postMedia(areq, resource);
// set Location and Content-Location headers
for (final Object element : newEntry.getOtherLinks()) {
final Link link = (Link) element;
if ("edit".equals(link.getRel())) {
res.addHeader("Location", link.getHrefResolved());
break;
}
}
for (final Object element : newEntry.getAlternateLinks()) {
final Link link = (Link) element;
if ("alternate".equals(link.getRel())) {
res.addHeader("Content-Location", link.getHrefResolved());
break;
}
}
res.setStatus(HttpServletResponse.SC_CREATED);
res.setContentType("application/atom+xml; type=entry; charset=utf-8");
final Writer writer = res.getWriter();
Atom10Generator.serializeEntry(newEntry, writer);
writer.close();
} else {
res.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "No content-type specified in request");
}
} else {
res.sendError(HttpServletResponse.SC_NOT_FOUND, "Invalid collection specified in request");
}
} catch (final AtomException ae) {
res.sendError(ae.getStatus(), ae.getMessage());
LOG.debug("An error occured while processing POST", ae);
} catch (final Exception e) {
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
LOG.debug("An error occured while processing POST", e);
}
} else {
res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\"");
res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
}
LOG.debug("Exiting");
} } | public class class_name {
@Override
protected void doPost(final HttpServletRequest req, final HttpServletResponse res) throws ServletException, IOException {
LOG.debug("Entering");
final AtomHandler handler = createAtomRequestHandler(req, res);
final String userName = handler.getAuthenticatedUsername();
if (userName != null) {
final AtomRequest areq = new AtomRequestImpl(req);
try {
if (handler.isCollectionURI(areq)) {
if (req.getContentType().startsWith("application/atom+xml")) {
// parse incoming entry
final Entry entry = Atom10Parser.parseEntry(new BufferedReader(new InputStreamReader(req.getInputStream(), "UTF-8")), null, Locale.US);
// call handler to post it
final Entry newEntry = handler.postEntry(areq, entry);
// set Location and Content-Location headers
for (final Object element : newEntry.getOtherLinks()) {
final Link link = (Link) element;
if ("edit".equals(link.getRel())) {
res.addHeader("Location", link.getHrefResolved()); // depends on control dependency: [if], data = [none]
break;
}
}
for (final Object element : newEntry.getAlternateLinks()) {
final Link link = (Link) element;
if ("alternate".equals(link.getRel())) {
res.addHeader("Content-Location", link.getHrefResolved()); // depends on control dependency: [if], data = [none]
break;
}
}
// write entry back out to response
res.setStatus(HttpServletResponse.SC_CREATED); // depends on control dependency: [if], data = [none]
res.setContentType("application/atom+xml; type=entry; charset=utf-8"); // depends on control dependency: [if], data = [none]
final Writer writer = res.getWriter();
Atom10Generator.serializeEntry(newEntry, writer); // depends on control dependency: [if], data = [none]
writer.close(); // depends on control dependency: [if], data = [none]
} else if (req.getContentType() != null) {
// get incoming title and slug from HTTP header
final String title = areq.getHeader("Title");
// create new entry for resource, set title and type
final Entry resource = new Entry();
resource.setTitle(title); // depends on control dependency: [if], data = [none]
final Content content = new Content();
content.setType(areq.getContentType()); // depends on control dependency: [if], data = [none]
resource.setContents(Collections.singletonList(content)); // depends on control dependency: [if], data = [none]
// hand input stream off to hander to post file
final Entry newEntry = handler.postMedia(areq, resource);
// set Location and Content-Location headers
for (final Object element : newEntry.getOtherLinks()) {
final Link link = (Link) element;
if ("edit".equals(link.getRel())) {
res.addHeader("Location", link.getHrefResolved()); // depends on control dependency: [if], data = [none]
break;
}
}
for (final Object element : newEntry.getAlternateLinks()) {
final Link link = (Link) element;
if ("alternate".equals(link.getRel())) {
res.addHeader("Content-Location", link.getHrefResolved()); // depends on control dependency: [if], data = [none]
break;
}
}
res.setStatus(HttpServletResponse.SC_CREATED); // depends on control dependency: [if], data = [none]
res.setContentType("application/atom+xml; type=entry; charset=utf-8"); // depends on control dependency: [if], data = [none]
final Writer writer = res.getWriter();
Atom10Generator.serializeEntry(newEntry, writer); // depends on control dependency: [if], data = [none]
writer.close(); // depends on control dependency: [if], data = [none]
} else {
res.sendError(HttpServletResponse.SC_UNSUPPORTED_MEDIA_TYPE, "No content-type specified in request"); // depends on control dependency: [if], data = [none]
}
} else {
res.sendError(HttpServletResponse.SC_NOT_FOUND, "Invalid collection specified in request"); // depends on control dependency: [if], data = [none]
}
} catch (final AtomException ae) {
res.sendError(ae.getStatus(), ae.getMessage());
LOG.debug("An error occured while processing POST", ae);
} catch (final Exception e) {
res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e.getMessage());
LOG.debug("An error occured while processing POST", e);
}
} else {
res.setHeader("WWW-Authenticate", "BASIC realm=\"AtomPub\"");
res.sendError(HttpServletResponse.SC_UNAUTHORIZED);
}
LOG.debug("Exiting");
} } |
public class class_name {
public void mergeContinuousNsIntoOne()
{
for (int row = 0; row < vertexes.length - 1; ++row)
{
List<Vertex> vertexListFrom = vertexes[row];
ListIterator<Vertex> listIteratorFrom = vertexListFrom.listIterator();
while (listIteratorFrom.hasNext())
{
Vertex from = listIteratorFrom.next();
if (from.getNature() == Nature.ns)
{
int toIndex = row + from.realWord.length();
ListIterator<Vertex> listIteratorTo = vertexes[toIndex].listIterator();
while (listIteratorTo.hasNext())
{
Vertex to = listIteratorTo.next();
if (to.getNature() == Nature.ns)
{
// 我们不能直接改,因为很多条线路在公用指针
// from.realWord += to.realWord;
logger.info("合并【" + from.realWord + "】和【" + to.realWord + "】");
listIteratorFrom.set(Vertex.newAddressInstance(from.realWord + to.realWord));
// listIteratorTo.remove();
break;
}
}
}
}
}
} } | public class class_name {
public void mergeContinuousNsIntoOne()
{
for (int row = 0; row < vertexes.length - 1; ++row)
{
List<Vertex> vertexListFrom = vertexes[row];
ListIterator<Vertex> listIteratorFrom = vertexListFrom.listIterator();
while (listIteratorFrom.hasNext())
{
Vertex from = listIteratorFrom.next();
if (from.getNature() == Nature.ns)
{
int toIndex = row + from.realWord.length();
ListIterator<Vertex> listIteratorTo = vertexes[toIndex].listIterator();
while (listIteratorTo.hasNext())
{
Vertex to = listIteratorTo.next();
if (to.getNature() == Nature.ns)
{
// 我们不能直接改,因为很多条线路在公用指针
// from.realWord += to.realWord;
logger.info("合并【" + from.realWord + "】和【" + to.realWord + "】"); // depends on control dependency: [if], data = [none]
listIteratorFrom.set(Vertex.newAddressInstance(from.realWord + to.realWord)); // depends on control dependency: [if], data = [none]
// listIteratorTo.remove();
break;
}
}
}
}
}
} } |
public class class_name {
public static String getExtension(String fileName) {
if (fileName.contains(".")) {
return fileName.substring(fileName.lastIndexOf(".") + 1);
}
return "png";
} } | public class class_name {
public static String getExtension(String fileName) {
if (fileName.contains(".")) {
return fileName.substring(fileName.lastIndexOf(".") + 1); // depends on control dependency: [if], data = [none]
}
return "png";
} } |
public class class_name {
public EndpointConfig resolveEndpointConfig() {
final String endpointClassName = getEndpointClassName();
// 1) default values
//String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
String configName = endpointClassName;
String configFile = EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE;
boolean specifiedConfig = false;
// 2) annotation contribution
if (isEndpointClassAnnotated(org.jboss.ws.api.annotation.EndpointConfig.class))
{
final String cfgName = getEndpointConfigNameFromAnnotation();
if (cfgName != null && !cfgName.isEmpty())
{
configName = cfgName;
}
final String cfgFile = getEndpointConfigFileFromAnnotation();
if (cfgFile != null && !cfgFile.isEmpty())
{
configFile = cfgFile;
}
specifiedConfig = true;
}
// 3) descriptor overrides (jboss-webservices.xml or web.xml)
final String epCfgNameOverride = getEndpointConfigNameOverride();
if (epCfgNameOverride != null && !epCfgNameOverride.isEmpty())
{
configName = epCfgNameOverride;
specifiedConfig = true;
}
final String epCfgFileOverride = getEndpointConfigFileOverride();
if (epCfgFileOverride != null && !epCfgFileOverride.isEmpty())
{
configFile = epCfgFileOverride;
}
// 4) setup of configuration
if (configFile != EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE) {
//look for provided endpoint config file
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(getConfigFile(configFile));
EndpointConfig config = configRoot.getEndpointConfigByName(configName);
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
if (config != null) {
return config;
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
}
}
else
{
EndpointConfig config = null;
URL url = getDefaultConfigFile(configFile);
if (url != null) {
//the default file exists
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(url);
config = configRoot.getEndpointConfigByName(configName);
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
}
}
if (config == null) {
//use endpoint configs from AS domain
ServerConfig sc = getServerConfig();
config = sc.getEndpointConfig(configName);
if (config == null && !specifiedConfig) {
config = sc.getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG);
}
if (config == null && specifiedConfig) {
throw Messages.MESSAGES.couldNotFindEndpointConfigName(configName);
}
}
if (config != null) {
return config;
}
}
return null;
} } | public class class_name {
public EndpointConfig resolveEndpointConfig() {
final String endpointClassName = getEndpointClassName();
// 1) default values
//String configName = org.jboss.wsf.spi.metadata.config.EndpointConfig.STANDARD_ENDPOINT_CONFIG;
String configName = endpointClassName;
String configFile = EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE;
boolean specifiedConfig = false;
// 2) annotation contribution
if (isEndpointClassAnnotated(org.jboss.ws.api.annotation.EndpointConfig.class))
{
final String cfgName = getEndpointConfigNameFromAnnotation();
if (cfgName != null && !cfgName.isEmpty())
{
configName = cfgName; // depends on control dependency: [if], data = [none]
}
final String cfgFile = getEndpointConfigFileFromAnnotation();
if (cfgFile != null && !cfgFile.isEmpty())
{
configFile = cfgFile; // depends on control dependency: [if], data = [none]
}
specifiedConfig = true; // depends on control dependency: [if], data = [none]
}
// 3) descriptor overrides (jboss-webservices.xml or web.xml)
final String epCfgNameOverride = getEndpointConfigNameOverride();
if (epCfgNameOverride != null && !epCfgNameOverride.isEmpty())
{
configName = epCfgNameOverride; // depends on control dependency: [if], data = [none]
specifiedConfig = true; // depends on control dependency: [if], data = [none]
}
final String epCfgFileOverride = getEndpointConfigFileOverride();
if (epCfgFileOverride != null && !epCfgFileOverride.isEmpty())
{
configFile = epCfgFileOverride; // depends on control dependency: [if], data = [none]
}
// 4) setup of configuration
if (configFile != EndpointConfig.DEFAULT_ENDPOINT_CONFIG_FILE) {
//look for provided endpoint config file
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(getConfigFile(configFile));
EndpointConfig config = configRoot.getEndpointConfigByName(configName);
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG); // depends on control dependency: [if], data = [none]
}
if (config != null) {
return config; // depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
} // depends on control dependency: [catch], data = [none]
}
else
{
EndpointConfig config = null;
URL url = getDefaultConfigFile(configFile);
if (url != null) {
//the default file exists
try
{
ConfigRoot configRoot = ConfigMetaDataParser.parse(url);
config = configRoot.getEndpointConfigByName(configName); // depends on control dependency: [try], data = [none]
if (config == null && !specifiedConfig) {
config = configRoot.getEndpointConfigByName(EndpointConfig.STANDARD_ENDPOINT_CONFIG); // depends on control dependency: [if], data = [none]
}
}
catch (IOException e)
{
throw Messages.MESSAGES.couldNotReadConfigFile(configFile);
} // depends on control dependency: [catch], data = [none]
}
if (config == null) {
//use endpoint configs from AS domain
ServerConfig sc = getServerConfig();
config = sc.getEndpointConfig(configName); // depends on control dependency: [if], data = [(config]
if (config == null && !specifiedConfig) {
config = sc.getEndpointConfig(EndpointConfig.STANDARD_ENDPOINT_CONFIG); // depends on control dependency: [if], data = [none]
}
if (config == null && specifiedConfig) {
throw Messages.MESSAGES.couldNotFindEndpointConfigName(configName);
}
}
if (config != null) {
return config; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public boolean isValid() {
if (PluggableTaskConfigStore.store().preferenceFor(pluginConfiguration.getId()) == null) {
addError(TYPE, String.format("Could not find plugin for given pluggable id:[%s].", pluginConfiguration.getId()));
}
configuration.validateTree();
return (errors.isEmpty() && !configuration.hasErrors());
} } | public class class_name {
public boolean isValid() {
if (PluggableTaskConfigStore.store().preferenceFor(pluginConfiguration.getId()) == null) {
addError(TYPE, String.format("Could not find plugin for given pluggable id:[%s].", pluginConfiguration.getId())); // depends on control dependency: [if], data = [none]
}
configuration.validateTree();
return (errors.isEmpty() && !configuration.hasErrors());
} } |
public class class_name {
@Override
public void setManagedConnection(ManagedConnection newMC) {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "setManagedConnection");
}
if (state == MCWrapper.STATE_NEW || state == MCWrapper.STATE_INACTIVE) {
mc = newMC;
createdTimeStamp = java.lang.System.currentTimeMillis();
unusedTimeStamp = createdTimeStamp;
eventListener = new com.ibm.ejs.j2c.ConnectionEventListener(this);
mc.addConnectionEventListener(eventListener);
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Connection created time " + createdTimeStamp + " for mcw " + this.toString());
}
/*
* Put the mc and mcw in the hash map
*/
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Adding mc and mcw to hashMap " + mc + " in pool manager " + pm.hashCode());
}
pm.putMcToMCWMap(mc, this); // moved here from MCWrapperPool.java
} else {
IllegalStateException e = new IllegalStateException("setManagedConnection: illegal state exception. State = " + getStateString() + " MCW = "
+ mcWrapperObject_hexString);
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", "setManagedConnection", e);
throw e;
}
state = MCWrapper.STATE_ACTIVE_FREE;
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "setManagedConnection");
}
} } | public class class_name {
@Override
public void setManagedConnection(ManagedConnection newMC) {
final boolean isTracingEnabled = TraceComponent.isAnyTracingEnabled();
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.entry(this, tc, "setManagedConnection"); // depends on control dependency: [if], data = [none]
}
if (state == MCWrapper.STATE_NEW || state == MCWrapper.STATE_INACTIVE) {
mc = newMC; // depends on control dependency: [if], data = [none]
createdTimeStamp = java.lang.System.currentTimeMillis(); // depends on control dependency: [if], data = [none]
unusedTimeStamp = createdTimeStamp; // depends on control dependency: [if], data = [none]
eventListener = new com.ibm.ejs.j2c.ConnectionEventListener(this); // depends on control dependency: [if], data = [none]
mc.addConnectionEventListener(eventListener); // depends on control dependency: [if], data = [none]
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Connection created time " + createdTimeStamp + " for mcw " + this.toString()); // depends on control dependency: [if], data = [none]
}
/*
* Put the mc and mcw in the hash map
*/
if (isTracingEnabled && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Adding mc and mcw to hashMap " + mc + " in pool manager " + pm.hashCode()); // depends on control dependency: [if], data = [none]
}
pm.putMcToMCWMap(mc, this); // moved here from MCWrapperPool.java // depends on control dependency: [if], data = [none]
} else {
IllegalStateException e = new IllegalStateException("setManagedConnection: illegal state exception. State = " + getStateString() + " MCW = "
+ mcWrapperObject_hexString);
Tr.error(tc, "ILLEGAL_STATE_EXCEPTION_J2CA0079", "setManagedConnection", e); // depends on control dependency: [if], data = [none]
throw e;
}
state = MCWrapper.STATE_ACTIVE_FREE;
if (isTracingEnabled && tc.isEntryEnabled()) {
Tr.exit(this, tc, "setManagedConnection"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void log(String fullTemplateName, long startTime, long stopTime, long contentLength, Object[] params) {
//System.out.println(fullTemplateName + ", " + (stopTime-startTime) + ", " + contentLength);
TemplateStats stats = (TemplateStats) mStatsMap.get(fullTemplateName);
if (stats == null) {
stats = new TemplateStats(fullTemplateName, mRawWindowSize, mAggregateWindowSize);
mStatsMap.put(fullTemplateName, stats);
}
stats.log(startTime, stopTime, contentLength, params);
} } | public class class_name {
public void log(String fullTemplateName, long startTime, long stopTime, long contentLength, Object[] params) {
//System.out.println(fullTemplateName + ", " + (stopTime-startTime) + ", " + contentLength);
TemplateStats stats = (TemplateStats) mStatsMap.get(fullTemplateName);
if (stats == null) {
stats = new TemplateStats(fullTemplateName, mRawWindowSize, mAggregateWindowSize); // depends on control dependency: [if], data = [none]
mStatsMap.put(fullTemplateName, stats); // depends on control dependency: [if], data = [none]
}
stats.log(startTime, stopTime, contentLength, params);
} } |
public class class_name {
@Override
public void removeQueue(final String queueName, final boolean all) {
if (queueName == null || "".equals(queueName)) {
throw new IllegalArgumentException("queueName must not be null or empty: " + queueName);
}
if (all) { // Remove all instances
boolean tryAgain = true;
while (tryAgain) {
tryAgain = this.queueNames.remove(queueName);
}
} else { // Only remove one instance
this.queueNames.remove(queueName);
}
} } | public class class_name {
@Override
public void removeQueue(final String queueName, final boolean all) {
if (queueName == null || "".equals(queueName)) {
throw new IllegalArgumentException("queueName must not be null or empty: " + queueName);
}
if (all) { // Remove all instances
boolean tryAgain = true;
while (tryAgain) {
tryAgain = this.queueNames.remove(queueName); // depends on control dependency: [while], data = [none]
}
} else { // Only remove one instance
this.queueNames.remove(queueName); // depends on control dependency: [if], data = [none]
}
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.