code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { void setSecurityLevel(final int securityLevel) throws InvalidArgumentException { logger.trace(format("setSecurityLevel to %d", securityLevel)); if (securityCurveMapping.isEmpty()) { throw new InvalidArgumentException("Security curve mapping has no entries."); } if (!securityCurveMapping.containsKey(securityLevel)) { StringBuilder sb = new StringBuilder(); String sp = ""; for (int x : securityCurveMapping.keySet()) { sb.append(sp).append(x); sp = ", "; } throw new InvalidArgumentException(format("Illegal security level: %d. Valid values are: %s", securityLevel, sb.toString())); } String lcurveName = securityCurveMapping.get(securityLevel); logger.debug(format("Mapped curve strength %d to %s", securityLevel, lcurveName)); X9ECParameters params = ECNamedCurveTable.getByName(lcurveName); //Check if can match curve name to requested strength. if (params == null) { InvalidArgumentException invalidArgumentException = new InvalidArgumentException( format("Curve %s defined for security strength %d was not found.", curveName, securityLevel)); logger.error(invalidArgumentException); throw invalidArgumentException; } curveName = lcurveName; this.securityLevel = securityLevel; } }
public class class_name { void setSecurityLevel(final int securityLevel) throws InvalidArgumentException { logger.trace(format("setSecurityLevel to %d", securityLevel)); if (securityCurveMapping.isEmpty()) { throw new InvalidArgumentException("Security curve mapping has no entries."); } if (!securityCurveMapping.containsKey(securityLevel)) { StringBuilder sb = new StringBuilder(); String sp = ""; for (int x : securityCurveMapping.keySet()) { sb.append(sp).append(x); // depends on control dependency: [for], data = [x] sp = ", "; // depends on control dependency: [for], data = [none] } throw new InvalidArgumentException(format("Illegal security level: %d. Valid values are: %s", securityLevel, sb.toString())); } String lcurveName = securityCurveMapping.get(securityLevel); logger.debug(format("Mapped curve strength %d to %s", securityLevel, lcurveName)); X9ECParameters params = ECNamedCurveTable.getByName(lcurveName); //Check if can match curve name to requested strength. if (params == null) { InvalidArgumentException invalidArgumentException = new InvalidArgumentException( format("Curve %s defined for security strength %d was not found.", curveName, securityLevel)); logger.error(invalidArgumentException); throw invalidArgumentException; } curveName = lcurveName; this.securityLevel = securityLevel; } }
public class class_name { private static PropertyChangeListener createAncestorPropertyChangeListener(final JTable table) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) { table.getParent().repaint(); } } }; } }
public class class_name { private static PropertyChangeListener createAncestorPropertyChangeListener(final JTable table) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (table.getParent() instanceof JViewport && table.getParent().getParent() instanceof JScrollPane) { table.getParent().repaint(); // depends on control dependency: [if], data = [none] } } }; } }
public class class_name { private static void multiplyAxB(final double[] aBlock, final double[] bBlock, final double[] cBlock, final int step) { final int blockStripeMini = step % 3; final int blockStripeMaxi = step / 3; final int blockArea = step * step; for (int iL = 0; iL < blockArea; iL += step) { int rc = iL; for (int kL = 0; kL < blockArea; kL += step) { int ra = iL; int rb = kL; double sum = 0.0d; for (int jL = blockStripeMini; --jL >= 0;) { sum += aBlock[ra++] * bBlock[rb++]; } // loop unrolling for (int jL = blockStripeMaxi; --jL >= 0;) { sum += aBlock[ra++] * bBlock[rb++] // + aBlock[ra++] * bBlock[rb++] // + aBlock[ra++] * bBlock[rb++]; } cBlock[rc++] += sum; } } } }
public class class_name { private static void multiplyAxB(final double[] aBlock, final double[] bBlock, final double[] cBlock, final int step) { final int blockStripeMini = step % 3; final int blockStripeMaxi = step / 3; final int blockArea = step * step; for (int iL = 0; iL < blockArea; iL += step) { int rc = iL; for (int kL = 0; kL < blockArea; kL += step) { int ra = iL; int rb = kL; double sum = 0.0d; for (int jL = blockStripeMini; --jL >= 0;) { sum += aBlock[ra++] * bBlock[rb++]; // depends on control dependency: [for], data = [none] } // loop unrolling for (int jL = blockStripeMaxi; --jL >= 0;) { sum += aBlock[ra++] * bBlock[rb++] // + aBlock[ra++] * bBlock[rb++] // + aBlock[ra++] * bBlock[rb++]; // depends on control dependency: [for], data = [none] } cBlock[rc++] += sum; // depends on control dependency: [for], data = [none] } } } }
public class class_name { private static void forEachParameter(SQLiteModelMethod method, OnMethodParameterListener listener) { for (VariableElement p : method.getElement().getParameters()) { listener.onMethodParameter(p); } } }
public class class_name { private static void forEachParameter(SQLiteModelMethod method, OnMethodParameterListener listener) { for (VariableElement p : method.getElement().getParameters()) { listener.onMethodParameter(p); // depends on control dependency: [for], data = [p] } } }
public class class_name { private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) { String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER); Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header"); String[] origins = originHeader.split(" "); for (String origin : origins) { Constraint.ensureTrue(config.isOriginAllowed(origin), String.format("The specified origin is not allowed: '%s'", origin)); } return originHeader; } }
public class class_name { private String checkOriginHeader(HttpServletRequest request, JCorsConfig config) { String originHeader = request.getHeader(CorsHeaders.ORIGIN_HEADER); Constraint.ensureNotEmpty(originHeader, "Cross-Origin requests must specify an Origin Header"); String[] origins = originHeader.split(" "); for (String origin : origins) { Constraint.ensureTrue(config.isOriginAllowed(origin), String.format("The specified origin is not allowed: '%s'", origin)); // depends on control dependency: [for], data = [origin] } return originHeader; } }
public class class_name { public static ILogger getLogger(String name) { // try the fast path first LoggerFactory existingFactory = loggerFactory; if (existingFactory != null) { return existingFactory.getLogger(name); } synchronized (FACTORY_LOCK) { existingFactory = loggerFactory; if (existingFactory != null) { return existingFactory.getLogger(name); } LoggerFactory createdFactory = null; final String loggingClass = System.getProperty("hazelcast.logging.class"); if (!StringUtil.isNullOrEmpty(loggingClass)) { createdFactory = tryToCreateLoggerFactory(loggingClass); } if (createdFactory != null) { // hazelcast.logging.class property overrides everything, so it's safe to store the factory for reuse loggerFactory = createdFactory; loggerFactoryClassOrType = loggingClass; } else { final String loggingType = System.getProperty("hazelcast.logging.type"); createdFactory = createLoggerFactory(loggingType); if (!StringUtil.isNullOrEmpty(loggingType)) { // hazelcast.logging.type property is the recommended way of configuring the logging, in most setups // the configured value should match with the value passed to newLoggerFactory(), so we store the created // factory for reuse loggerFactory = createdFactory; loggerFactoryClassOrType = loggingType; } } return createdFactory.getLogger(name); } } }
public class class_name { public static ILogger getLogger(String name) { // try the fast path first LoggerFactory existingFactory = loggerFactory; if (existingFactory != null) { return existingFactory.getLogger(name); // depends on control dependency: [if], data = [none] } synchronized (FACTORY_LOCK) { existingFactory = loggerFactory; if (existingFactory != null) { return existingFactory.getLogger(name); // depends on control dependency: [if], data = [none] } LoggerFactory createdFactory = null; final String loggingClass = System.getProperty("hazelcast.logging.class"); if (!StringUtil.isNullOrEmpty(loggingClass)) { createdFactory = tryToCreateLoggerFactory(loggingClass); // depends on control dependency: [if], data = [none] } if (createdFactory != null) { // hazelcast.logging.class property overrides everything, so it's safe to store the factory for reuse loggerFactory = createdFactory; // depends on control dependency: [if], data = [none] loggerFactoryClassOrType = loggingClass; // depends on control dependency: [if], data = [none] } else { final String loggingType = System.getProperty("hazelcast.logging.type"); createdFactory = createLoggerFactory(loggingType); // depends on control dependency: [if], data = [none] if (!StringUtil.isNullOrEmpty(loggingType)) { // hazelcast.logging.type property is the recommended way of configuring the logging, in most setups // the configured value should match with the value passed to newLoggerFactory(), so we store the created // factory for reuse loggerFactory = createdFactory; // depends on control dependency: [if], data = [none] loggerFactoryClassOrType = loggingType; // depends on control dependency: [if], data = [none] } } return createdFactory.getLogger(name); } } }
public class class_name { public void setCustomerDnsIps(java.util.Collection<String> customerDnsIps) { if (customerDnsIps == null) { this.customerDnsIps = null; return; } this.customerDnsIps = new com.amazonaws.internal.SdkInternalList<String>(customerDnsIps); } }
public class class_name { public void setCustomerDnsIps(java.util.Collection<String> customerDnsIps) { if (customerDnsIps == null) { this.customerDnsIps = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.customerDnsIps = new com.amazonaws.internal.SdkInternalList<String>(customerDnsIps); } }
public class class_name { private void putValue(EsRequest doc, EsIndexColumn column, Object value) { Object columnValue = column.columnValue(value); String stringValue = column.stringValue(value); doc.put(column.getName(), columnValue); if (!(value instanceof ModeShapeDateTime || value instanceof Long || value instanceof Boolean)) { doc.put(column.getLowerCaseFieldName(), stringValue.toLowerCase()); doc.put(column.getUpperCaseFieldName(), stringValue.toUpperCase()); } doc.put(column.getLengthFieldName(), stringValue.length()); } }
public class class_name { private void putValue(EsRequest doc, EsIndexColumn column, Object value) { Object columnValue = column.columnValue(value); String stringValue = column.stringValue(value); doc.put(column.getName(), columnValue); if (!(value instanceof ModeShapeDateTime || value instanceof Long || value instanceof Boolean)) { doc.put(column.getLowerCaseFieldName(), stringValue.toLowerCase()); // depends on control dependency: [if], data = [none] doc.put(column.getUpperCaseFieldName(), stringValue.toUpperCase()); // depends on control dependency: [if], data = [none] } doc.put(column.getLengthFieldName(), stringValue.length()); } }
public class class_name { protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) { Iterator<Node> path = violation.getPropertyPath().iterator(); Node method = path.next(); logger.debug("Constraint violation on method {}: {}", method, violation); StringBuilder cat = new StringBuilder(); cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName());// parameter name while (path.hasNext()) { cat.append(".").append(path.next()); } return cat.toString(); } }
public class class_name { protected String extractCategory(ValuedParameter[] params, ConstraintViolation<Object> violation) { Iterator<Node> path = violation.getPropertyPath().iterator(); Node method = path.next(); logger.debug("Constraint violation on method {}: {}", method, violation); StringBuilder cat = new StringBuilder(); cat.append(params[path.next().as(ParameterNode.class).getParameterIndex()].getName());// parameter name while (path.hasNext()) { cat.append(".").append(path.next()); // depends on control dependency: [while], data = [none] } return cat.toString(); } }
public class class_name { protected String fetchMarkdownTagletDescriptionFile(String resourceName) { final URL url = this.getClass().getResource(resourceName); if( url!=null ) { try { return FileUtils.readFileToString(new File(url.toURI())); } catch (Exception e) { e.printStackTrace(); } } return ""; } }
public class class_name { protected String fetchMarkdownTagletDescriptionFile(String resourceName) { final URL url = this.getClass().getResource(resourceName); if( url!=null ) { try { return FileUtils.readFileToString(new File(url.toURI())); // depends on control dependency: [try], data = [none] } catch (Exception e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } return ""; } }
public class class_name { public ServiceCall<UtteranceAnalyses> toneChat(ToneChatOptions toneChatOptions) { Validator.notNull(toneChatOptions, "toneChatOptions cannot be null"); String[] pathSegments = { "v3/tone_chat" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("tone_analyzer", "v3", "toneChat"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); } builder.header("Accept", "application/json"); if (toneChatOptions.contentLanguage() != null) { builder.header("Content-Language", toneChatOptions.contentLanguage()); } if (toneChatOptions.acceptLanguage() != null) { builder.header("Accept-Language", toneChatOptions.acceptLanguage()); } final JsonObject contentJson = new JsonObject(); contentJson.add("utterances", GsonSingleton.getGson().toJsonTree(toneChatOptions.utterances())); builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(UtteranceAnalyses.class)); } }
public class class_name { public ServiceCall<UtteranceAnalyses> toneChat(ToneChatOptions toneChatOptions) { Validator.notNull(toneChatOptions, "toneChatOptions cannot be null"); String[] pathSegments = { "v3/tone_chat" }; RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments)); builder.query("version", versionDate); Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("tone_analyzer", "v3", "toneChat"); for (Entry<String, String> header : sdkHeaders.entrySet()) { builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header] } builder.header("Accept", "application/json"); if (toneChatOptions.contentLanguage() != null) { builder.header("Content-Language", toneChatOptions.contentLanguage()); // depends on control dependency: [if], data = [none] } if (toneChatOptions.acceptLanguage() != null) { builder.header("Accept-Language", toneChatOptions.acceptLanguage()); // depends on control dependency: [if], data = [none] } final JsonObject contentJson = new JsonObject(); contentJson.add("utterances", GsonSingleton.getGson().toJsonTree(toneChatOptions.utterances())); builder.bodyJson(contentJson); return createServiceCall(builder.build(), ResponseConverterUtils.getObject(UtteranceAnalyses.class)); } }
public class class_name { public void marshall(RenewalSummary renewalSummary, ProtocolMarshaller protocolMarshaller) { if (renewalSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(renewalSummary.getRenewalStatus(), RENEWALSTATUS_BINDING); protocolMarshaller.marshall(renewalSummary.getDomainValidationOptions(), DOMAINVALIDATIONOPTIONS_BINDING); protocolMarshaller.marshall(renewalSummary.getRenewalStatusReason(), RENEWALSTATUSREASON_BINDING); protocolMarshaller.marshall(renewalSummary.getUpdatedAt(), UPDATEDAT_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(RenewalSummary renewalSummary, ProtocolMarshaller protocolMarshaller) { if (renewalSummary == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(renewalSummary.getRenewalStatus(), RENEWALSTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(renewalSummary.getDomainValidationOptions(), DOMAINVALIDATIONOPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(renewalSummary.getRenewalStatusReason(), RENEWALSTATUSREASON_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(renewalSummary.getUpdatedAt(), UPDATEDAT_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static Number asNumber(Object value) { Number num = null; if (value == null) { num = null; } else if (value instanceof Number) { num = (Number) value; } else if (value instanceof Boolean) { num = ((Boolean) value) ? 1 : 0; } return num; } }
public class class_name { private static Number asNumber(Object value) { Number num = null; if (value == null) { num = null; // depends on control dependency: [if], data = [none] } else if (value instanceof Number) { num = (Number) value; // depends on control dependency: [if], data = [none] } else if (value instanceof Boolean) { num = ((Boolean) value) ? 1 : 0; // depends on control dependency: [if], data = [none] } return num; } }
public class class_name { @Override public void set_timeout_millis(final int timeout, final boolean fwd) throws DevFailed { synchronized (this) { final Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e instanceof GroupDeviceElement || fwd) { e.set_timeout_millis(timeout, fwd); } } } } }
public class class_name { @Override public void set_timeout_millis(final int timeout, final boolean fwd) throws DevFailed { synchronized (this) { final Iterator it = elements.iterator(); while (it.hasNext()) { final GroupElement e = (GroupElement) it.next(); if (e instanceof GroupDeviceElement || fwd) { e.set_timeout_millis(timeout, fwd); // depends on control dependency: [if], data = [fwd)] } } } } }
public class class_name { public static void removeChild(Node parent, Node node) { if (isTryFinallyNode(parent, node)) { if (NodeUtil.hasCatchHandler(getCatchBlock(parent))) { // A finally can only be removed if there is a catch. parent.removeChild(node); } else { // Otherwise, only its children can be removed. node.detachChildren(); } } else if (node.isCatch()) { // The CATCH can can only be removed if there is a finally clause. Node tryNode = node.getGrandparent(); checkState(NodeUtil.hasFinally(tryNode)); node.detach(); } else if (isTryCatchNodeContainer(node)) { // The container node itself can't be removed, but the contained CATCH // can if there is a 'finally' clause Node tryNode = node.getParent(); checkState(NodeUtil.hasFinally(tryNode)); node.detachChildren(); } else if (node.isBlock()) { // Simply empty the block. This maintains source location and // "synthetic"-ness. node.detachChildren(); } else if (isStatementBlock(parent) || isSwitchCase(node) || node.isMemberFunctionDef()) { // A statement in a block or a member function can simply be removed parent.removeChild(node); } else if (isNameDeclaration(parent) || parent.isExprResult()) { if (parent.hasMoreThanOneChild()) { parent.removeChild(node); } else { // Remove the node from the parent, so it can be reused. parent.removeChild(node); // This would leave an empty VAR, remove the VAR itself. removeChild(parent.getParent(), parent); } } else if (parent.isLabel() && node == parent.getLastChild()) { // Remove the node from the parent, so it can be reused. parent.removeChild(node); // A LABEL without children can not be referred to, remove it. removeChild(parent.getParent(), parent); } else if (parent.isVanillaFor()) { // Only Token.FOR can have an Token.EMPTY other control structure // need something for the condition. Others need to be replaced // or the structure removed. parent.replaceChild(node, IR.empty()); } else if (parent.isObjectPattern()) { // Remove the name from the object pattern parent.removeChild(node); } else if (parent.isArrayPattern()) { if (node == parent.getLastChild()) { parent.removeChild(node); } else { parent.replaceChild(node, IR.empty()); } } else if (parent.isDestructuringLhs()) { // Destructuring is empty so we should remove the node parent.removeChild(node); if (parent.getParent().hasChildren()) { // removing the destructuring could leave an empty variable declaration node, so we would // want to remove it from the AST removeChild(parent.getParent(), parent); } } else if (parent.isRest()) { // Rest params can only ever have one child node parent.detach(); } else if (parent.isParamList()) { parent.removeChild(node); } else if (parent.isImport()) { // An import node must always have three child nodes. Only the first can be safely removed. if (node == parent.getFirstChild()) { parent.replaceChild(node, IR.empty()); } else { throw new IllegalStateException("Invalid attempt to remove: " + node + " from " + parent); } } else { throw new IllegalStateException("Invalid attempt to remove node: " + node + " of " + parent); } } }
public class class_name { public static void removeChild(Node parent, Node node) { if (isTryFinallyNode(parent, node)) { if (NodeUtil.hasCatchHandler(getCatchBlock(parent))) { // A finally can only be removed if there is a catch. parent.removeChild(node); // depends on control dependency: [if], data = [none] } else { // Otherwise, only its children can be removed. node.detachChildren(); // depends on control dependency: [if], data = [none] } } else if (node.isCatch()) { // The CATCH can can only be removed if there is a finally clause. Node tryNode = node.getGrandparent(); checkState(NodeUtil.hasFinally(tryNode)); // depends on control dependency: [if], data = [none] node.detach(); // depends on control dependency: [if], data = [none] } else if (isTryCatchNodeContainer(node)) { // The container node itself can't be removed, but the contained CATCH // can if there is a 'finally' clause Node tryNode = node.getParent(); checkState(NodeUtil.hasFinally(tryNode)); // depends on control dependency: [if], data = [none] node.detachChildren(); // depends on control dependency: [if], data = [none] } else if (node.isBlock()) { // Simply empty the block. This maintains source location and // "synthetic"-ness. node.detachChildren(); // depends on control dependency: [if], data = [none] } else if (isStatementBlock(parent) || isSwitchCase(node) || node.isMemberFunctionDef()) { // A statement in a block or a member function can simply be removed parent.removeChild(node); // depends on control dependency: [if], data = [none] } else if (isNameDeclaration(parent) || parent.isExprResult()) { if (parent.hasMoreThanOneChild()) { parent.removeChild(node); // depends on control dependency: [if], data = [none] } else { // Remove the node from the parent, so it can be reused. parent.removeChild(node); // depends on control dependency: [if], data = [none] // This would leave an empty VAR, remove the VAR itself. removeChild(parent.getParent(), parent); // depends on control dependency: [if], data = [none] } } else if (parent.isLabel() && node == parent.getLastChild()) { // Remove the node from the parent, so it can be reused. parent.removeChild(node); // depends on control dependency: [if], data = [none] // A LABEL without children can not be referred to, remove it. removeChild(parent.getParent(), parent); // depends on control dependency: [if], data = [none] } else if (parent.isVanillaFor()) { // Only Token.FOR can have an Token.EMPTY other control structure // need something for the condition. Others need to be replaced // or the structure removed. parent.replaceChild(node, IR.empty()); // depends on control dependency: [if], data = [none] } else if (parent.isObjectPattern()) { // Remove the name from the object pattern parent.removeChild(node); // depends on control dependency: [if], data = [none] } else if (parent.isArrayPattern()) { if (node == parent.getLastChild()) { parent.removeChild(node); // depends on control dependency: [if], data = [(node] } else { parent.replaceChild(node, IR.empty()); // depends on control dependency: [if], data = [(node] } } else if (parent.isDestructuringLhs()) { // Destructuring is empty so we should remove the node parent.removeChild(node); // depends on control dependency: [if], data = [none] if (parent.getParent().hasChildren()) { // removing the destructuring could leave an empty variable declaration node, so we would // want to remove it from the AST removeChild(parent.getParent(), parent); // depends on control dependency: [if], data = [none] } } else if (parent.isRest()) { // Rest params can only ever have one child node parent.detach(); // depends on control dependency: [if], data = [none] } else if (parent.isParamList()) { parent.removeChild(node); // depends on control dependency: [if], data = [none] } else if (parent.isImport()) { // An import node must always have three child nodes. Only the first can be safely removed. if (node == parent.getFirstChild()) { parent.replaceChild(node, IR.empty()); // depends on control dependency: [if], data = [(node] } else { throw new IllegalStateException("Invalid attempt to remove: " + node + " from " + parent); } } else { throw new IllegalStateException("Invalid attempt to remove node: " + node + " of " + parent); } } }
public class class_name { private static String joinSetAndGetValue(List<Field> fields, List<Object> values, Object obj, boolean withNull) { StringBuilder sb = new StringBuilder(); int fieldSize = fields.size(); for(int i = 0; i < fieldSize; i++) { Column column = fields.get(i).getAnnotation(Column.class); Object value = DOInfoReader.getValue(fields.get(i), obj); if(column.casVersion()) { if(value == null) { throw new CasVersionNotMatchException("casVersion column value is null"); } Long _v = null; if(value instanceof Long) { _v = (Long) value; } else if (value instanceof Integer) { _v = ((Integer) value).longValue(); } else { throw new CasVersionNotMatchException("casVersion column type must be Integer or Long"); } sb.append(getColumnName(column)).append("=").append(_v + 1).append(","); } else { if(value != null && column.isJSON()) { value = JSON.toJson(value); } if(withNull || value != null) { sb.append(getColumnName(column)).append("=?,"); values.add(value); } } } return sb.length() == 0 ? "" : sb.substring(0, sb.length() - 1); } }
public class class_name { private static String joinSetAndGetValue(List<Field> fields, List<Object> values, Object obj, boolean withNull) { StringBuilder sb = new StringBuilder(); int fieldSize = fields.size(); for(int i = 0; i < fieldSize; i++) { Column column = fields.get(i).getAnnotation(Column.class); Object value = DOInfoReader.getValue(fields.get(i), obj); if(column.casVersion()) { if(value == null) { throw new CasVersionNotMatchException("casVersion column value is null"); } Long _v = null; if(value instanceof Long) { _v = (Long) value; // depends on control dependency: [if], data = [none] } else if (value instanceof Integer) { _v = ((Integer) value).longValue(); // depends on control dependency: [if], data = [none] } else { throw new CasVersionNotMatchException("casVersion column type must be Integer or Long"); } sb.append(getColumnName(column)).append("=").append(_v + 1).append(","); // depends on control dependency: [if], data = [none] } else { if(value != null && column.isJSON()) { value = JSON.toJson(value); // depends on control dependency: [if], data = [(value] } if(withNull || value != null) { sb.append(getColumnName(column)).append("=?,"); // depends on control dependency: [if], data = [none] values.add(value); // depends on control dependency: [if], data = [none] } } } return sb.length() == 0 ? "" : sb.substring(0, sb.length() - 1); } }
public class class_name { @SuppressWarnings("unchecked") protected Map<String, BeanData> getSessionMap(final HttpSession session) { SessionBeans sessionBeans = (SessionBeans) session.getAttribute(SESSION_BEANS_NAME); if (sessionBeans == null) { return null; } return sessionBeans.getBeanMap(); } }
public class class_name { @SuppressWarnings("unchecked") protected Map<String, BeanData> getSessionMap(final HttpSession session) { SessionBeans sessionBeans = (SessionBeans) session.getAttribute(SESSION_BEANS_NAME); if (sessionBeans == null) { return null; // depends on control dependency: [if], data = [none] } return sessionBeans.getBeanMap(); } }
public class class_name { public void end(Xid xid, int flags) throws XAException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(this, tc, "end", new Object[] { ivManagedConnection, AdapterUtil.toString(xid), AdapterUtil.getXAResourceEndFlagString(flags) }); // if the MC marked Stale, it means the user requested a purge pool with an immediate option // so don't allow any work to continue. In this case, we throw XAER_RMFAIL xa error // which indicates that the resource manager is not available if (ivManagedConnection._mcStale) { XAException x = new XAException(XAException.XAER_RMFAIL);; Tr.error(tc, "INVALID_CONNECTION"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", new Object[] { "MC is stale throwing XAER_RMFAIL", ivManagedConnection }); throw x; } if (!xid.equals(ivXid)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Xid does not match.", new Object[] { "XAResource.start: ", AdapterUtil.toString(ivXid), "XAResource.end: ", AdapterUtil.toString(xid) }); XAException xaX = AdapterUtil.createXAException( "XID_MISMATCH", new Object[] { AdapterUtil.toString(ivXid), "end", AdapterUtil.toString(xid) }, XAException.XAER_NOTA); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", xaX); throw xaX; } try { ivStateManager.setState(WSStateManager.XA_END); ivXaRes.end(xid, flags); if (ivManagedConnection.helper.xaEndResetsAutoCommit) ivManagedConnection.refreshCachedAutoCommit(); } catch (TransactionException te) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.end", "228", this); Tr.error(tc, "INVALID_TX_STATE", new Object[] { "XAResource.end()", ivManagedConnection.getTransactionStateAsString() }); try { ivXaRes.rollback(xid); } catch (XAException eatXA) { FFDCFilter.processException(eatXA, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.end", "236", this); traceXAException(eatXA, currClass); //eat the exception because we will throw the next one } XAException xae = AdapterUtil.createXAException( "INVALID_TX_STATE", new Object[] { "XAResource.end", ivManagedConnection.getTransactionStateAsString() }, XAException.XA_RBROLLBACK); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String cId = null; try { cId = ivManagedConnection.mcf.getCorrelator(ivManagedConnection); } catch (SQLException x) { // will just log the exception here and ignore it since its in trace Tr.debug(this, tc, "got an exception trying to get the correlator in rollback during xa end fails, exception is: ", x); } if (cId != null) { StringBuffer stbuf = new StringBuffer(200); stbuf.append("Correlator: DB2, ID: "); stbuf.append(cId); stbuf.append("Transaction ID : "); stbuf.append(xid); stbuf.append("ROLLBACK"); Tr.debug(this, tc, stbuf.toString()); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", "Exception"); throw xae; } catch (XAException xae) { FFDCFilter.processException(xae, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.end", "438", this); checkXAException(xae); // - deferred setting of state because this is not a normal case try { ivStateManager.setState(WSStateManager.XA_END_FAIL); } catch (TransactionException te1) { Tr.warning(tc, "DSA_INTERNAL_ERROR", new Object[] { "Error setting the state to XA_END_FAIL from ", ivManagedConnection.getTransactionStateAsString(), te1 }); } traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", xae); throw xae; // @HMP ,moved the throw here to avoid throwing if TMFAIL } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end"); } }
public class class_name { public void end(Xid xid, int flags) throws XAException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(this, tc, "end", new Object[] { ivManagedConnection, AdapterUtil.toString(xid), AdapterUtil.getXAResourceEndFlagString(flags) }); // if the MC marked Stale, it means the user requested a purge pool with an immediate option // so don't allow any work to continue. In this case, we throw XAER_RMFAIL xa error // which indicates that the resource manager is not available if (ivManagedConnection._mcStale) { XAException x = new XAException(XAException.XAER_RMFAIL);; Tr.error(tc, "INVALID_CONNECTION"); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", new Object[] { "MC is stale throwing XAER_RMFAIL", ivManagedConnection }); throw x; } if (!xid.equals(ivXid)) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) Tr.debug(this, tc, "Xid does not match.", new Object[] { "XAResource.start: ", AdapterUtil.toString(ivXid), "XAResource.end: ", AdapterUtil.toString(xid) }); XAException xaX = AdapterUtil.createXAException( "XID_MISMATCH", new Object[] { AdapterUtil.toString(ivXid), "end", AdapterUtil.toString(xid) }, XAException.XAER_NOTA); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", xaX); throw xaX; } try { ivStateManager.setState(WSStateManager.XA_END); ivXaRes.end(xid, flags); if (ivManagedConnection.helper.xaEndResetsAutoCommit) ivManagedConnection.refreshCachedAutoCommit(); } catch (TransactionException te) { //Exception means setState failed because it was invalid to set the state in this case FFDCFilter.processException(te, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.end", "228", this); Tr.error(tc, "INVALID_TX_STATE", new Object[] { "XAResource.end()", ivManagedConnection.getTransactionStateAsString() }); try { ivXaRes.rollback(xid); // depends on control dependency: [try], data = [none] } catch (XAException eatXA) { FFDCFilter.processException(eatXA, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.end", "236", this); traceXAException(eatXA, currClass); //eat the exception because we will throw the next one } // depends on control dependency: [catch], data = [none] XAException xae = AdapterUtil.createXAException( "INVALID_TX_STATE", new Object[] { "XAResource.end", ivManagedConnection.getTransactionStateAsString() }, XAException.XA_RBROLLBACK); traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { String cId = null; try { cId = ivManagedConnection.mcf.getCorrelator(ivManagedConnection); // depends on control dependency: [try], data = [none] } catch (SQLException x) { // will just log the exception here and ignore it since its in trace Tr.debug(this, tc, "got an exception trying to get the correlator in rollback during xa end fails, exception is: ", x); } // depends on control dependency: [catch], data = [none] if (cId != null) { StringBuffer stbuf = new StringBuffer(200); stbuf.append("Correlator: DB2, ID: "); // depends on control dependency: [if], data = [none] stbuf.append(cId); // depends on control dependency: [if], data = [(cId] stbuf.append("Transaction ID : "); // depends on control dependency: [if], data = [none] stbuf.append(xid); // depends on control dependency: [if], data = [none] stbuf.append("ROLLBACK"); // depends on control dependency: [if], data = [none] Tr.debug(this, tc, stbuf.toString()); // depends on control dependency: [if], data = [none] } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", "Exception"); throw xae; } catch (XAException xae) { FFDCFilter.processException(xae, "com.ibm.ws.rsadapter.spi.WSRdbXaResourceImpl.end", "438", this); checkXAException(xae); // - deferred setting of state because this is not a normal case try { ivStateManager.setState(WSStateManager.XA_END_FAIL); // depends on control dependency: [try], data = [none] } catch (TransactionException te1) { Tr.warning(tc, "DSA_INTERNAL_ERROR", new Object[] { "Error setting the state to XA_END_FAIL from ", ivManagedConnection.getTransactionStateAsString(), te1 }); } // depends on control dependency: [catch], data = [none] traceXAException(xae, currClass); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end", xae); throw xae; // @HMP ,moved the throw here to avoid throwing if TMFAIL } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(this, tc, "end"); } }
public class class_name { public void marshall(UpdateElasticsearchDomainConfigRequest updateElasticsearchDomainConfigRequest, ProtocolMarshaller protocolMarshaller) { if (updateElasticsearchDomainConfigRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getDomainName(), DOMAINNAME_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getElasticsearchClusterConfig(), ELASTICSEARCHCLUSTERCONFIG_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getEBSOptions(), EBSOPTIONS_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getSnapshotOptions(), SNAPSHOTOPTIONS_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getVPCOptions(), VPCOPTIONS_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getCognitoOptions(), COGNITOOPTIONS_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getAdvancedOptions(), ADVANCEDOPTIONS_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getAccessPolicies(), ACCESSPOLICIES_BINDING); protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getLogPublishingOptions(), LOGPUBLISHINGOPTIONS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateElasticsearchDomainConfigRequest updateElasticsearchDomainConfigRequest, ProtocolMarshaller protocolMarshaller) { if (updateElasticsearchDomainConfigRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getElasticsearchClusterConfig(), ELASTICSEARCHCLUSTERCONFIG_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getEBSOptions(), EBSOPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getSnapshotOptions(), SNAPSHOTOPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getVPCOptions(), VPCOPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getCognitoOptions(), COGNITOOPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getAdvancedOptions(), ADVANCEDOPTIONS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getAccessPolicies(), ACCESSPOLICIES_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateElasticsearchDomainConfigRequest.getLogPublishingOptions(), LOGPUBLISHINGOPTIONS_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 Config getAndRemoveConfigWithName(List<Config> configs, String name) { final Config config = getConfigWithName(configs, name); if (config != null) { configs.remove(config); } return config; } }
public class class_name { public static Config getAndRemoveConfigWithName(List<Config> configs, String name) { final Config config = getConfigWithName(configs, name); if (config != null) { configs.remove(config); // depends on control dependency: [if], data = [(config] } return config; } }
public class class_name { public int getOrdinal() { String configOrdinal = getValue(CONFIG_ORDINAL); if (configOrdinal != null) { try { return Integer.parseInt(configOrdinal); } catch (NumberFormatException ignored) { // Ignored } } return DEFAULT_ORDINAL; } }
public class class_name { public int getOrdinal() { String configOrdinal = getValue(CONFIG_ORDINAL); if (configOrdinal != null) { try { return Integer.parseInt(configOrdinal); // depends on control dependency: [try], data = [none] } catch (NumberFormatException ignored) { // Ignored } // depends on control dependency: [catch], data = [none] } return DEFAULT_ORDINAL; } }
public class class_name { public void encode(final MiniSatStyleSolver s, final LNGIntVector lits) { assert lits.size() != 0; if (lits.size() == 1) addUnitClause(s, lits.get(0)); else { final LNGIntVector seqAuxiliary = new LNGIntVector(); for (int i = 0; i < lits.size() - 1; i++) { seqAuxiliary.push(mkLit(s.nVars(), false)); MaxSAT.newSATVariable(s); } for (int i = 0; i < lits.size(); i++) { if (i == 0) { addBinaryClause(s, lits.get(i), not(seqAuxiliary.get(i))); addBinaryClause(s, not(lits.get(i)), seqAuxiliary.get(i)); } else if (i == lits.size() - 1) { addBinaryClause(s, lits.get(i), seqAuxiliary.get(i - 1)); addBinaryClause(s, not(lits.get(i)), not(seqAuxiliary.get(i - 1))); } else { addBinaryClause(s, not(seqAuxiliary.get(i - 1)), seqAuxiliary.get(i)); addTernaryClause(s, lits.get(i), not(seqAuxiliary.get(i)), seqAuxiliary.get(i - 1)); addBinaryClause(s, not(lits.get(i)), seqAuxiliary.get(i)); addBinaryClause(s, not(lits.get(i)), not(seqAuxiliary.get(i - 1))); } } } } }
public class class_name { public void encode(final MiniSatStyleSolver s, final LNGIntVector lits) { assert lits.size() != 0; if (lits.size() == 1) addUnitClause(s, lits.get(0)); else { final LNGIntVector seqAuxiliary = new LNGIntVector(); for (int i = 0; i < lits.size() - 1; i++) { seqAuxiliary.push(mkLit(s.nVars(), false)); // depends on control dependency: [for], data = [none] MaxSAT.newSATVariable(s); // depends on control dependency: [for], data = [none] } for (int i = 0; i < lits.size(); i++) { if (i == 0) { addBinaryClause(s, lits.get(i), not(seqAuxiliary.get(i))); // depends on control dependency: [if], data = [(i] addBinaryClause(s, not(lits.get(i)), seqAuxiliary.get(i)); // depends on control dependency: [if], data = [(i] } else if (i == lits.size() - 1) { addBinaryClause(s, lits.get(i), seqAuxiliary.get(i - 1)); // depends on control dependency: [if], data = [(i] addBinaryClause(s, not(lits.get(i)), not(seqAuxiliary.get(i - 1))); // depends on control dependency: [if], data = [(i] } else { addBinaryClause(s, not(seqAuxiliary.get(i - 1)), seqAuxiliary.get(i)); // depends on control dependency: [if], data = [(i] addTernaryClause(s, lits.get(i), not(seqAuxiliary.get(i)), seqAuxiliary.get(i - 1)); // depends on control dependency: [if], data = [(i] addBinaryClause(s, not(lits.get(i)), seqAuxiliary.get(i)); // depends on control dependency: [if], data = [(i] addBinaryClause(s, not(lits.get(i)), not(seqAuxiliary.get(i - 1))); // depends on control dependency: [if], data = [(i] } } } } }
public class class_name { public <T> T copy (T object) { if (object == null) return null; if (copyShallow) return object; copyDepth++; try { if (originalToCopy == null) originalToCopy = new IdentityMap(); Object existingCopy = originalToCopy.get(object); if (existingCopy != null) return (T)existingCopy; if (copyReferences) needsCopyReference = object; Object copy; if (object instanceof KryoCopyable) copy = ((KryoCopyable)object).copy(this); else copy = getSerializer(object.getClass()).copy(this, object); if (needsCopyReference != null) reference(copy); if (TRACE || (DEBUG && copyDepth == 1)) log("Copy", copy, -1); return (T)copy; } finally { if (--copyDepth == 0) reset(); } } }
public class class_name { public <T> T copy (T object) { if (object == null) return null; if (copyShallow) return object; copyDepth++; try { if (originalToCopy == null) originalToCopy = new IdentityMap(); Object existingCopy = originalToCopy.get(object); if (existingCopy != null) return (T)existingCopy; if (copyReferences) needsCopyReference = object; Object copy; if (object instanceof KryoCopyable) copy = ((KryoCopyable)object).copy(this); else copy = getSerializer(object.getClass()).copy(this, object); if (needsCopyReference != null) reference(copy); if (TRACE || (DEBUG && copyDepth == 1)) log("Copy", copy, -1); return (T)copy; // depends on control dependency: [try], data = [none] } finally { if (--copyDepth == 0) reset(); } } }
public class class_name { private boolean cancelActiveAction(final Long actionId) { if (actionId != null) { try { deploymentManagement.cancelAction(actionId); return true; } catch (final CancelActionNotAllowedException e) { LOG.info("Cancel action not allowed exception :{}", e); return false; } } return false; } }
public class class_name { private boolean cancelActiveAction(final Long actionId) { if (actionId != null) { try { deploymentManagement.cancelAction(actionId); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (final CancelActionNotAllowedException e) { LOG.info("Cancel action not allowed exception :{}", e); return false; } // depends on control dependency: [catch], data = [none] } return false; } }
public class class_name { public Future<GoodwillSchema> getSchema(final String schemaName) { try { return client.prepareGet(String.format("%s/%s", url, schemaName)).addHeader("Accept", "application/json").execute(new AsyncCompletionHandler<GoodwillSchema>() { @Override public GoodwillSchema onCompleted(final Response response) throws Exception { if (response.getStatusCode() != 200) { return null; } final InputStream in = response.getResponseBodyAsStream(); try { return mapper.readValue(in, GoodwillSchema.class); } finally { closeStream(in); } } @Override public void onThrowable(final Throwable t) { log.warn("Got exception looking up the schema", t); } }); } catch (IOException e) { log.warn("Got exception looking up the schema", e); return null; } } }
public class class_name { public Future<GoodwillSchema> getSchema(final String schemaName) { try { return client.prepareGet(String.format("%s/%s", url, schemaName)).addHeader("Accept", "application/json").execute(new AsyncCompletionHandler<GoodwillSchema>() { @Override public GoodwillSchema onCompleted(final Response response) throws Exception { if (response.getStatusCode() != 200) { return null; } final InputStream in = response.getResponseBodyAsStream(); // depends on control dependency: [try], data = [none] try { return mapper.readValue(in, GoodwillSchema.class); // depends on control dependency: [try], data = [none] } finally { closeStream(in); } } @Override public void onThrowable(final Throwable t) { log.warn("Got exception looking up the schema", t); } }); } catch (IOException e) { log.warn("Got exception looking up the schema", e); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private boolean loopShortcutNecessary(int node, int firstOrigEdge, int lastOrigEdge, double loopWeight) { EdgeIterator inIter = loopAvoidanceInEdgeExplorer.setBaseNode(node); while (inIter.next()) { EdgeIterator outIter = loopAvoidanceOutEdgeExplorer.setBaseNode(node); double inTurnCost = getTurnCost(inIter.getEdge(), node, firstOrigEdge); while (outIter.next()) { double totalLoopCost = inTurnCost + loopWeight + getTurnCost(lastOrigEdge, node, outIter.getEdge()); double directTurnCost = getTurnCost(inIter.getEdge(), node, outIter.getEdge()); if (totalLoopCost < directTurnCost) { return true; } } } LOGGER.trace("Loop avoidance -> no shortcut"); return false; } }
public class class_name { private boolean loopShortcutNecessary(int node, int firstOrigEdge, int lastOrigEdge, double loopWeight) { EdgeIterator inIter = loopAvoidanceInEdgeExplorer.setBaseNode(node); while (inIter.next()) { EdgeIterator outIter = loopAvoidanceOutEdgeExplorer.setBaseNode(node); double inTurnCost = getTurnCost(inIter.getEdge(), node, firstOrigEdge); while (outIter.next()) { double totalLoopCost = inTurnCost + loopWeight + getTurnCost(lastOrigEdge, node, outIter.getEdge()); double directTurnCost = getTurnCost(inIter.getEdge(), node, outIter.getEdge()); if (totalLoopCost < directTurnCost) { return true; // depends on control dependency: [if], data = [none] } } } LOGGER.trace("Loop avoidance -> no shortcut"); return false; } }
public class class_name { public static Fault naturalize(Throwable ex) { while (ex instanceof InvocationTargetException || ex instanceof UndeclaredThrowableException) { ex = ex.getCause(); } if (ex instanceof Fault) { return Fault.class.cast(ex); } return Fault.create(FaultCode.create(ex.getClass()), ex, ex.getMessage()); } }
public class class_name { public static Fault naturalize(Throwable ex) { while (ex instanceof InvocationTargetException || ex instanceof UndeclaredThrowableException) { ex = ex.getCause(); // depends on control dependency: [while], data = [none] } if (ex instanceof Fault) { return Fault.class.cast(ex); // depends on control dependency: [if], data = [none] } return Fault.create(FaultCode.create(ex.getClass()), ex, ex.getMessage()); } }
public class class_name { public String toRemote(final String host, final File localFile) { if (this.remoteName != null && (this.hosts == null || this.hosts.contains(host))) { try { final String canonical = localFile.getCanonicalPath(); if (canonical.startsWith(this.canonicalPath) && isActive()) { return this.remoteName + canonical.substring(this.canonicalPath.length()).replace(File.separatorChar, this.remoteSeparator); } } catch (final IOException ex) { return null; } } return null; } }
public class class_name { public String toRemote(final String host, final File localFile) { if (this.remoteName != null && (this.hosts == null || this.hosts.contains(host))) { try { final String canonical = localFile.getCanonicalPath(); if (canonical.startsWith(this.canonicalPath) && isActive()) { return this.remoteName + canonical.substring(this.canonicalPath.length()).replace(File.separatorChar, this.remoteSeparator); // depends on control dependency: [if], data = [none] } } catch (final IOException ex) { return null; } // depends on control dependency: [catch], data = [none] } return null; } }
public class class_name { public void clean() { log.debug("[clean] Cleaning world"); for (Robot bot : robotsPosition.keySet()) { bot.die("World cleanup"); if (robotsPosition.containsKey(bot)) { log.warn("[clean] Robot did not unregister itself. Removing it"); remove(bot); } } } }
public class class_name { public void clean() { log.debug("[clean] Cleaning world"); for (Robot bot : robotsPosition.keySet()) { bot.die("World cleanup"); // depends on control dependency: [for], data = [bot] if (robotsPosition.containsKey(bot)) { log.warn("[clean] Robot did not unregister itself. Removing it"); // depends on control dependency: [if], data = [none] remove(bot); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public Path getTranslatedInstance (int x, int y) { if (_source == null) { return new LinePath(null, new Point(_dest.x + x, _dest.y + y), _duration); } else { return new LinePath(_source.x + x, _source.y + y, _dest.x + x, _dest.y + y, _duration); } } }
public class class_name { public Path getTranslatedInstance (int x, int y) { if (_source == null) { return new LinePath(null, new Point(_dest.x + x, _dest.y + y), _duration); // depends on control dependency: [if], data = [none] } else { return new LinePath(_source.x + x, _source.y + y, _dest.x + x, _dest.y + y, _duration); // depends on control dependency: [if], data = [(_source] } } }
public class class_name { private boolean processError(ByteBuf in) { int length = lineLength(in); if (length == -1) { return false; } in.skipBytes(length); return true; } }
public class class_name { private boolean processError(ByteBuf in) { int length = lineLength(in); if (length == -1) { return false; // depends on control dependency: [if], data = [none] } in.skipBytes(length); return true; } }
public class class_name { public CmsSearchParameters restrict(CmsSearchParameters restriction) { // append queries StringBuffer query = new StringBuffer(256); if (getQuery() != null) { // don't blow up unnecessary closures (if CmsSearch is reused and restricted several times) boolean closure = !getQuery().startsWith("+("); if (closure) { query.append("+("); } query.append(getQuery()); if (closure) { query.append(")"); } } if (restriction.getQuery() != null) { // don't let Lucene max terms be exceeded in case someone reuses a CmsSearch and continuously restricts // query with the same restrictions... if (query.indexOf(restriction.getQuery()) < 0) { query.append(" +("); query.append(restriction.getQuery()); query.append(")"); } } // restrict fields List<String> fields = null; if ((m_fields != null) && (m_fields.size() > 0)) { if ((restriction.getFields() != null) && (restriction.getFields().size() > 0)) { fields = ListUtils.intersection(m_fields, restriction.getFields()); } else { fields = m_fields; } } else { fields = restriction.getFields(); } // restrict roots List<String> roots = null; if ((m_roots != null) && (m_roots.size() > 0)) { if ((restriction.getRoots() != null) && (restriction.getRoots().size() > 0)) { roots = ListUtils.intersection(m_roots, restriction.getRoots()); // TODO: This only works if there are equal paths in both parameter sets - for two distinct sets // all root restrictions are dropped with an empty list. } else { roots = m_roots; } } else { roots = restriction.getRoots(); } // restrict categories List<String> categories = null; if ((m_categories != null) && (m_categories.size() > 0)) { if ((restriction.getCategories() != null) && (restriction.getCategories().size() > 0)) { categories = ListUtils.intersection(m_categories, restriction.getCategories()); } else { categories = m_categories; } } else { categories = restriction.getCategories(); } // restrict resource types List<String> resourceTypes = null; if ((m_resourceTypes != null) && (m_resourceTypes.size() > 0)) { if ((restriction.getResourceTypes() != null) && (restriction.getResourceTypes().size() > 0)) { resourceTypes = ListUtils.intersection(m_resourceTypes, restriction.getResourceTypes()); } else { resourceTypes = m_resourceTypes; } } else { resourceTypes = restriction.getResourceTypes(); } // create the new search parameters CmsSearchParameters result = new CmsSearchParameters( query.toString(), fields, roots, categories, resourceTypes, m_calculateCategories, m_sort); result.setIndex(getIndex()); return result; } }
public class class_name { public CmsSearchParameters restrict(CmsSearchParameters restriction) { // append queries StringBuffer query = new StringBuffer(256); if (getQuery() != null) { // don't blow up unnecessary closures (if CmsSearch is reused and restricted several times) boolean closure = !getQuery().startsWith("+("); if (closure) { query.append("+("); // depends on control dependency: [if], data = [none] } query.append(getQuery()); // depends on control dependency: [if], data = [(getQuery()] if (closure) { query.append(")"); // depends on control dependency: [if], data = [none] } } if (restriction.getQuery() != null) { // don't let Lucene max terms be exceeded in case someone reuses a CmsSearch and continuously restricts // query with the same restrictions... if (query.indexOf(restriction.getQuery()) < 0) { query.append(" +("); // depends on control dependency: [if], data = [none] query.append(restriction.getQuery()); // depends on control dependency: [if], data = [none] query.append(")"); // depends on control dependency: [if], data = [none] } } // restrict fields List<String> fields = null; if ((m_fields != null) && (m_fields.size() > 0)) { if ((restriction.getFields() != null) && (restriction.getFields().size() > 0)) { fields = ListUtils.intersection(m_fields, restriction.getFields()); // depends on control dependency: [if], data = [none] } else { fields = m_fields; // depends on control dependency: [if], data = [none] } } else { fields = restriction.getFields(); // depends on control dependency: [if], data = [none] } // restrict roots List<String> roots = null; if ((m_roots != null) && (m_roots.size() > 0)) { if ((restriction.getRoots() != null) && (restriction.getRoots().size() > 0)) { roots = ListUtils.intersection(m_roots, restriction.getRoots()); // depends on control dependency: [if], data = [none] // TODO: This only works if there are equal paths in both parameter sets - for two distinct sets // all root restrictions are dropped with an empty list. } else { roots = m_roots; // depends on control dependency: [if], data = [none] } } else { roots = restriction.getRoots(); // depends on control dependency: [if], data = [none] } // restrict categories List<String> categories = null; if ((m_categories != null) && (m_categories.size() > 0)) { if ((restriction.getCategories() != null) && (restriction.getCategories().size() > 0)) { categories = ListUtils.intersection(m_categories, restriction.getCategories()); // depends on control dependency: [if], data = [none] } else { categories = m_categories; // depends on control dependency: [if], data = [none] } } else { categories = restriction.getCategories(); // depends on control dependency: [if], data = [none] } // restrict resource types List<String> resourceTypes = null; if ((m_resourceTypes != null) && (m_resourceTypes.size() > 0)) { if ((restriction.getResourceTypes() != null) && (restriction.getResourceTypes().size() > 0)) { resourceTypes = ListUtils.intersection(m_resourceTypes, restriction.getResourceTypes()); // depends on control dependency: [if], data = [none] } else { resourceTypes = m_resourceTypes; // depends on control dependency: [if], data = [none] } } else { resourceTypes = restriction.getResourceTypes(); // depends on control dependency: [if], data = [none] } // create the new search parameters CmsSearchParameters result = new CmsSearchParameters( query.toString(), fields, roots, categories, resourceTypes, m_calculateCategories, m_sort); result.setIndex(getIndex()); return result; } }
public class class_name { @Deprecated public Map<String, HashSet<String>> match(Map<String, IndexedNodeType> aamModules, Map<String, NodeTemplate> offerings){ Map<String, HashSet<String>> mathedOfferings = new HashMap<>(); for(String moduleName: aamModules.keySet()){ IndexedNodeType module = aamModules.get(moduleName); mathedOfferings.put(moduleName, new HashSet<String>()); for(String offerName: offerings.keySet()){ NodeTemplate offer = offerings.get(offerName); if(match(module, offer)){ mathedOfferings.get(moduleName).add(offerName); } } } return mathedOfferings; } }
public class class_name { @Deprecated public Map<String, HashSet<String>> match(Map<String, IndexedNodeType> aamModules, Map<String, NodeTemplate> offerings){ Map<String, HashSet<String>> mathedOfferings = new HashMap<>(); for(String moduleName: aamModules.keySet()){ IndexedNodeType module = aamModules.get(moduleName); mathedOfferings.put(moduleName, new HashSet<String>()); // depends on control dependency: [for], data = [moduleName] for(String offerName: offerings.keySet()){ NodeTemplate offer = offerings.get(offerName); if(match(module, offer)){ mathedOfferings.get(moduleName).add(offerName); // depends on control dependency: [if], data = [none] } } } return mathedOfferings; } }
public class class_name { public Husband addHusbandToFamily(final Family family, final Person person) { if (family == null || person == null) { return new Husband(); } final FamS famS = new FamS(person, "FAMS", new ObjectId(family.getString())); final Husband husband = new Husband(family, "Husband", new ObjectId(person.getString())); family.insert(husband); person.insert(famS); return husband; } }
public class class_name { public Husband addHusbandToFamily(final Family family, final Person person) { if (family == null || person == null) { return new Husband(); // depends on control dependency: [if], data = [none] } final FamS famS = new FamS(person, "FAMS", new ObjectId(family.getString())); final Husband husband = new Husband(family, "Husband", new ObjectId(person.getString())); family.insert(husband); person.insert(famS); return husband; } }
public class class_name { private <Message extends PMessage<Message, Field>, Field extends PField> Message parseMessage(ThriftTokenizer tokenizer, PMessageDescriptor<Message, Field> type) throws IOException { PMessageBuilder<Message, Field> builder = type.builder(); if (tokenizer.peek("checking for empty").isSymbol(Token.kMessageEnd)) { tokenizer.next(); return builder.build(); } while (true) { Token token = tokenizer.expect("message field name", t -> t.isStringLiteral() || t.strEquals(ThriftTokenizer.kBlockCommentStart) || t.strEquals(ThriftTokenizer.kLineCommentStart)); if (token.strEquals(ThriftTokenizer.kLineCommentStart)) { int c; while ((c = tokenizer.read()) >= 0) { if (c == '\n') break; } continue; } else if (token.strEquals(ThriftTokenizer.kBlockCommentStart)) { int c; while ((c = tokenizer.read()) >= 0) { if (c == '*') { c = tokenizer.read(); if (c == '/') { break; } } } continue; } Field field = type.findFieldByName(token.decodeLiteral(true)); if (field == null) { throw tokenizer.failure(token, "No such field in " + type.getQualifiedName() + ": " + token.decodeLiteral(true)); } tokenizer.expectSymbol("message key-value sep", Token.kKeyValueSep); builder.set(field.getId(), parseTypedValue(tokenizer.expect("parsing field value"), tokenizer, field.getDescriptor(), false)); token = tokenizer.peek("optional line sep or message end"); if (token.isSymbol(Token.kLineSep1) || token.isSymbol(Token.kLineSep2)) { tokenizer.next(); token = tokenizer.peek("optional message end"); } if (token.isSymbol(Token.kMessageEnd)) { tokenizer.next(); break; } } return builder.build(); } }
public class class_name { private <Message extends PMessage<Message, Field>, Field extends PField> Message parseMessage(ThriftTokenizer tokenizer, PMessageDescriptor<Message, Field> type) throws IOException { PMessageBuilder<Message, Field> builder = type.builder(); if (tokenizer.peek("checking for empty").isSymbol(Token.kMessageEnd)) { tokenizer.next(); return builder.build(); } while (true) { Token token = tokenizer.expect("message field name", t -> t.isStringLiteral() || t.strEquals(ThriftTokenizer.kBlockCommentStart) || t.strEquals(ThriftTokenizer.kLineCommentStart)); if (token.strEquals(ThriftTokenizer.kLineCommentStart)) { int c; while ((c = tokenizer.read()) >= 0) { if (c == '\n') break; } continue; } else if (token.strEquals(ThriftTokenizer.kBlockCommentStart)) { int c; while ((c = tokenizer.read()) >= 0) { if (c == '*') { c = tokenizer.read(); // depends on control dependency: [if], data = [none] if (c == '/') { break; } } } continue; } Field field = type.findFieldByName(token.decodeLiteral(true)); if (field == null) { throw tokenizer.failure(token, "No such field in " + type.getQualifiedName() + ": " + token.decodeLiteral(true)); } tokenizer.expectSymbol("message key-value sep", Token.kKeyValueSep); builder.set(field.getId(), parseTypedValue(tokenizer.expect("parsing field value"), tokenizer, field.getDescriptor(), false)); token = tokenizer.peek("optional line sep or message end"); if (token.isSymbol(Token.kLineSep1) || token.isSymbol(Token.kLineSep2)) { tokenizer.next(); token = tokenizer.peek("optional message end"); } if (token.isSymbol(Token.kMessageEnd)) { tokenizer.next(); break; } } return builder.build(); } }
public class class_name { public VirtualRouterSpec withListeners(VirtualRouterListener... listeners) { if (this.listeners == null) { setListeners(new java.util.ArrayList<VirtualRouterListener>(listeners.length)); } for (VirtualRouterListener ele : listeners) { this.listeners.add(ele); } return this; } }
public class class_name { public VirtualRouterSpec withListeners(VirtualRouterListener... listeners) { if (this.listeners == null) { setListeners(new java.util.ArrayList<VirtualRouterListener>(listeners.length)); // depends on control dependency: [if], data = [none] } for (VirtualRouterListener ele : listeners) { this.listeners.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public float[] t1(float[] z, int k) { float[] result = new float[z.length]; for (int i = 0; i < z.length; i++) { result[i] = (new Transformations()).sDecept(z[i], (float) 0.35, (float) 0.001, (float) 0.05); } return result; } }
public class class_name { public float[] t1(float[] z, int k) { float[] result = new float[z.length]; for (int i = 0; i < z.length; i++) { result[i] = (new Transformations()).sDecept(z[i], (float) 0.35, (float) 0.001, (float) 0.05); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { private Map<String, ClassRef> getReferenceMap() { Map<String, ClassRef> mapping = new HashMap<String, ClassRef>(); List<ClassRef> refs = getReferences(); //It's best to have predictable order, so that we can generate uniform code. Collections.sort(refs, new Comparator<ClassRef>() { @Override public int compare(ClassRef o1, ClassRef o2) { return o1.getFullyQualifiedName().compareTo(o2.getFullyQualifiedName()); } }); for (ClassRef ref : refs) { String key = ref.getDefinition().getName(); if (!mapping.containsKey(key)) { mapping.put(key, ref); } } return mapping; } }
public class class_name { private Map<String, ClassRef> getReferenceMap() { Map<String, ClassRef> mapping = new HashMap<String, ClassRef>(); List<ClassRef> refs = getReferences(); //It's best to have predictable order, so that we can generate uniform code. Collections.sort(refs, new Comparator<ClassRef>() { @Override public int compare(ClassRef o1, ClassRef o2) { return o1.getFullyQualifiedName().compareTo(o2.getFullyQualifiedName()); } }); for (ClassRef ref : refs) { String key = ref.getDefinition().getName(); if (!mapping.containsKey(key)) { mapping.put(key, ref); // depends on control dependency: [if], data = [none] } } return mapping; } }
public class class_name { public void pluginSkipped(Plugin plugin, String reason) { if (isStop()) { return; } PluginStats pluginStats = mapPluginStats.get(plugin.getId()); if (pluginStats == null || pluginStats.isSkipped() || pluginFactory.getCompleted().contains(plugin)) { return; } pluginStats.skip(); pluginStats.setSkippedReason(reason); for (Plugin dependent : pluginFactory.getDependentPlugins(plugin)) { pluginStats = mapPluginStats.get(dependent.getId()); if (pluginStats != null && !pluginStats.isSkipped() && !pluginFactory.getCompleted().contains(dependent)) { pluginStats.skip(); pluginStats.setSkippedReason( Constant.messages.getString( "ascan.progress.label.skipped.reason.dependency")); } } } }
public class class_name { public void pluginSkipped(Plugin plugin, String reason) { if (isStop()) { return; // depends on control dependency: [if], data = [none] } PluginStats pluginStats = mapPluginStats.get(plugin.getId()); if (pluginStats == null || pluginStats.isSkipped() || pluginFactory.getCompleted().contains(plugin)) { return; // depends on control dependency: [if], data = [none] } pluginStats.skip(); pluginStats.setSkippedReason(reason); for (Plugin dependent : pluginFactory.getDependentPlugins(plugin)) { pluginStats = mapPluginStats.get(dependent.getId()); if (pluginStats != null && !pluginStats.isSkipped() && !pluginFactory.getCompleted().contains(dependent)) { pluginStats.skip(); pluginStats.setSkippedReason( Constant.messages.getString( "ascan.progress.label.skipped.reason.dependency")); } } } }
public class class_name { public void withRoutes(MangooRoute... routes) { Objects.requireNonNull(routes, Required.ROUTE.toString()); for (MangooRoute route : routes) { RequestRoute requestRoute = (RequestRoute) route; requestRoute.withControllerClass(this.controllerClass); if (hasBasicAuthentication()) { requestRoute.withBasicAuthentication(this.username, this.password, this.secret); } if (hasAuthentication()) { requestRoute.withAuthentication(); } if (hasAuthorization()) { requestRoute.withAuthorization(); } if (hasBlocking()) { requestRoute.withNonBlocking(); } if (requestRoute.getLimit() == 0) { requestRoute.withRequestLimit(this.limit); } if (requestRoute.hasMultipleMethods()) { for (Http method : requestRoute.getMethods()) { requestRoute.withHttpMethod(method); Router.addRoute(requestRoute); } } else { Router.addRoute(requestRoute); } } } }
public class class_name { public void withRoutes(MangooRoute... routes) { Objects.requireNonNull(routes, Required.ROUTE.toString()); for (MangooRoute route : routes) { RequestRoute requestRoute = (RequestRoute) route; requestRoute.withControllerClass(this.controllerClass); // depends on control dependency: [for], data = [none] if (hasBasicAuthentication()) { requestRoute.withBasicAuthentication(this.username, this.password, this.secret); // depends on control dependency: [if], data = [none] } if (hasAuthentication()) { requestRoute.withAuthentication(); // depends on control dependency: [if], data = [none] } if (hasAuthorization()) { requestRoute.withAuthorization(); // depends on control dependency: [if], data = [none] } if (hasBlocking()) { requestRoute.withNonBlocking(); // depends on control dependency: [if], data = [none] } if (requestRoute.getLimit() == 0) { requestRoute.withRequestLimit(this.limit); // depends on control dependency: [if], data = [none] } if (requestRoute.hasMultipleMethods()) { for (Http method : requestRoute.getMethods()) { requestRoute.withHttpMethod(method); // depends on control dependency: [for], data = [method] Router.addRoute(requestRoute); // depends on control dependency: [for], data = [none] } } else { Router.addRoute(requestRoute); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public KeePassFile enrichNodesWithIconData(KeePassFile keePassFile) { CustomIcons iconLibrary = keePassFile.getMeta().getCustomIcons(); GroupZipper zipper = new GroupZipper(keePassFile); Iterator<Group> iter = zipper.iterator(); while (iter.hasNext()) { Group group = iter.next(); byte[] iconData = getIconData(group.getCustomIconUuid(), group.getIconId(), iconLibrary); Group groupWithIcon = new GroupBuilder(group).iconData(iconData).build(); zipper.replace(groupWithIcon); enrichEntriesWithIcons(iconLibrary, group); } return zipper.close(); } }
public class class_name { public KeePassFile enrichNodesWithIconData(KeePassFile keePassFile) { CustomIcons iconLibrary = keePassFile.getMeta().getCustomIcons(); GroupZipper zipper = new GroupZipper(keePassFile); Iterator<Group> iter = zipper.iterator(); while (iter.hasNext()) { Group group = iter.next(); byte[] iconData = getIconData(group.getCustomIconUuid(), group.getIconId(), iconLibrary); Group groupWithIcon = new GroupBuilder(group).iconData(iconData).build(); zipper.replace(groupWithIcon); // depends on control dependency: [while], data = [none] enrichEntriesWithIcons(iconLibrary, group); // depends on control dependency: [while], data = [none] } return zipper.close(); } }
public class class_name { private Map<String, Object> parseTSUIDsList(HttpQuery query) { final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("treeId", parseTreeId(query, true)); final String tsquery = query.getQueryStringParam("tsuids"); if (tsquery != null) { final String[] tsuids = tsquery.split(","); map.put("tsuids", Arrays.asList(tsuids)); } return map; } }
public class class_name { private Map<String, Object> parseTSUIDsList(HttpQuery query) { final HashMap<String, Object> map = new HashMap<String, Object>(); map.put("treeId", parseTreeId(query, true)); final String tsquery = query.getQueryStringParam("tsuids"); if (tsquery != null) { final String[] tsuids = tsquery.split(","); map.put("tsuids", Arrays.asList(tsuids)); // depends on control dependency: [if], data = [none] } return map; } }
public class class_name { public EEnum getFinishingFidelityStpFinEx() { if (finishingFidelityStpFinExEEnum == null) { finishingFidelityStpFinExEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(166); } return finishingFidelityStpFinExEEnum; } }
public class class_name { public EEnum getFinishingFidelityStpFinEx() { if (finishingFidelityStpFinExEEnum == null) { finishingFidelityStpFinExEEnum = (EEnum)EPackage.Registry.INSTANCE.getEPackage(AfplibPackage.eNS_URI).getEClassifiers().get(166); // depends on control dependency: [if], data = [none] } return finishingFidelityStpFinExEEnum; } }
public class class_name { private DateTime providedOrDefaultFromValue(DateTime from, DateTime to, AggregateCounterResolution resolution) { if (from != null) { return from; } switch (resolution) { case minute: return to.minusMinutes(59); case hour: return to.minusHours(23); case day: return to.minusDays(6); case month: return to.minusMonths(11); case year: return to.minusYears(4); default: throw new IllegalStateException( "Shouldn't happen. Unhandled resolution: " + resolution); } } }
public class class_name { private DateTime providedOrDefaultFromValue(DateTime from, DateTime to, AggregateCounterResolution resolution) { if (from != null) { return from; // depends on control dependency: [if], data = [none] } switch (resolution) { case minute: return to.minusMinutes(59); case hour: return to.minusHours(23); case day: return to.minusDays(6); case month: return to.minusMonths(11); case year: return to.minusYears(4); default: throw new IllegalStateException( "Shouldn't happen. Unhandled resolution: " + resolution); } } }
public class class_name { private static boolean setVTMode() { long console = GetStdHandle(STD_OUTPUT_HANDLE); int[] mode = new int[1]; if (Kernel32.GetConsoleMode(console, mode) == 0) { // No need to go further, not supported. return false; } if (Kernel32.SetConsoleMode(console, mode[0] | VIRTUAL_TERMINAL_PROCESSING) == 0) { // No need to go further, not supported. return false; } return true; } }
public class class_name { private static boolean setVTMode() { long console = GetStdHandle(STD_OUTPUT_HANDLE); int[] mode = new int[1]; if (Kernel32.GetConsoleMode(console, mode) == 0) { // No need to go further, not supported. return false; // depends on control dependency: [if], data = [none] } if (Kernel32.SetConsoleMode(console, mode[0] | VIRTUAL_TERMINAL_PROCESSING) == 0) { // No need to go further, not supported. return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public long add(long instant, long duration, int scalar) { if (duration == 0 || scalar == 0) { return instant; } long add = FieldUtils.safeMultiply(duration, scalar); return FieldUtils.safeAdd(instant, add); } }
public class class_name { public long add(long instant, long duration, int scalar) { if (duration == 0 || scalar == 0) { return instant; // depends on control dependency: [if], data = [none] } long add = FieldUtils.safeMultiply(duration, scalar); return FieldUtils.safeAdd(instant, add); } }
public class class_name { protected final Logging getLoggingSkill() { if (this.skillBufferLogging == null || this.skillBufferLogging.get() == null) { this.skillBufferLogging = $getSkill(Logging.class); } return $castSkill(Logging.class, this.skillBufferLogging); } }
public class class_name { protected final Logging getLoggingSkill() { if (this.skillBufferLogging == null || this.skillBufferLogging.get() == null) { this.skillBufferLogging = $getSkill(Logging.class); // depends on control dependency: [if], data = [none] } return $castSkill(Logging.class, this.skillBufferLogging); } }
public class class_name { public long optLong(int index, long defaultValue) { final Number val = this.optNumber(index, null); if (val == null) { return defaultValue; } return val.longValue(); } }
public class class_name { public long optLong(int index, long defaultValue) { final Number val = this.optNumber(index, null); if (val == null) { return defaultValue; // depends on control dependency: [if], data = [none] } return val.longValue(); } }
public class class_name { public static boolean hasMethod(Class<?> targetClass, String methodName, Class... parameterTypes) { try { targetClass.getMethod(methodName, parameterTypes); return true; } catch (NoSuchMethodException e) { return false; } } }
public class class_name { public static boolean hasMethod(Class<?> targetClass, String methodName, Class... parameterTypes) { try { targetClass.getMethod(methodName, parameterTypes); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { return false; } // depends on control dependency: [catch], data = [none] } }
public class class_name { private static void addLong(long input, int count, int startPos, byte[] dest) { if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : Begin"); int currentByte = startPos/8; int currentOffset = startPos%8; int bitRoom;//how many bits can be placed in current byte long upMask;//to clear upper bits(lower bits auto-cleared by L-shift int downShift;//bits to shift down, isolating top bits of input int upShift;//bits to shift up, packing byte from top. while(count > 0) { //find how many bits can be placed in current byte bitRoom = 8-currentOffset; //get those bits //i.e, take upper 'bitsNeeded' of input, put to lower part of byte. downShift = count-bitRoom; upMask = 255 >>> currentOffset; upShift = 0; if(downShift < 0) { //upMask = 255 >>> bitRoom-count; upShift = bitRoom - count; upMask = 255 >>> (currentOffset+upShift); downShift = 0; } if(DEBUG_LEV > 30) { System.err.println("count:offset:bitRoom:downShift:upShift:" + count+":"+currentOffset+":"+bitRoom+":"+downShift+":"+upShift); } long currentBits = (input >>> downShift) & (upMask); //shift bits back up to match offset currentBits = currentBits << upShift; upMask = (byte)upMask << upShift; dest[currentByte] = (byte)(dest[currentByte] & (~upMask)); //merge bytes~ dest[currentByte] = (byte)(dest[currentByte] | currentBits); //System.out.println("new currentByte: " + dest[currentByte]); count -= bitRoom; currentOffset = 0; currentByte++; } if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : End"); } }
public class class_name { private static void addLong(long input, int count, int startPos, byte[] dest) { if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : Begin"); int currentByte = startPos/8; int currentOffset = startPos%8; int bitRoom;//how many bits can be placed in current byte long upMask;//to clear upper bits(lower bits auto-cleared by L-shift int downShift;//bits to shift down, isolating top bits of input int upShift;//bits to shift up, packing byte from top. while(count > 0) { //find how many bits can be placed in current byte bitRoom = 8-currentOffset; // depends on control dependency: [while], data = [none] //get those bits //i.e, take upper 'bitsNeeded' of input, put to lower part of byte. downShift = count-bitRoom; // depends on control dependency: [while], data = [none] upMask = 255 >>> currentOffset; // depends on control dependency: [while], data = [none] upShift = 0; // depends on control dependency: [while], data = [none] if(downShift < 0) { //upMask = 255 >>> bitRoom-count; upShift = bitRoom - count; // depends on control dependency: [if], data = [none] upMask = 255 >>> (currentOffset+upShift); // depends on control dependency: [if], data = [none] downShift = 0; // depends on control dependency: [if], data = [none] } if(DEBUG_LEV > 30) { System.err.println("count:offset:bitRoom:downShift:upShift:" + count+":"+currentOffset+":"+bitRoom+":"+downShift+":"+upShift); // depends on control dependency: [if], data = [none] } long currentBits = (input >>> downShift) & (upMask); //shift bits back up to match offset currentBits = currentBits << upShift; // depends on control dependency: [while], data = [none] upMask = (byte)upMask << upShift; // depends on control dependency: [while], data = [none] dest[currentByte] = (byte)(dest[currentByte] & (~upMask)); // depends on control dependency: [while], data = [none] //merge bytes~ dest[currentByte] = (byte)(dest[currentByte] | currentBits); // depends on control dependency: [while], data = [none] //System.out.println("new currentByte: " + dest[currentByte]); count -= bitRoom; // depends on control dependency: [while], data = [none] currentOffset = 0; // depends on control dependency: [while], data = [none] currentByte++; // depends on control dependency: [while], data = [none] } if(DEBUG_LEV > 30) System.err.println("EncodedElement::addLong : End"); } }
public class class_name { void execute(@NonNull FlowVersion flowVersion) { checkState(isSupported(flowVersion), "Single sign on is not supported on the device. " + "Please install or update to the latest version of Uber app."); Intent intent = new Intent(Intent.ACTION_VIEW); final Uri deepLinkUri = createSsoUri(flowVersion); intent.setData(deepLinkUri); List<PackageInfo> validatedPackages = new ArrayList<>(); if (productFlowPriority.isEmpty()) { validatedPackages.addAll( appProtocol.getInstalledPackages(activity, UBER, getSupportedAppVersion(UBER, flowVersion))); } else { for (SupportedAppType supportedAppType : productFlowPriority) { validatedPackages.addAll(appProtocol.getInstalledPackages( activity, supportedAppType, getSupportedAppVersion(supportedAppType, flowVersion))); } } if (!validatedPackages.isEmpty()) { intent.setPackage(validatedPackages.get(0).packageName); } if (flowVersion == FlowVersion.DEFAULT) { activity.startActivityForResult(intent, requestCode); } else { activity.startActivity(intent); } } }
public class class_name { void execute(@NonNull FlowVersion flowVersion) { checkState(isSupported(flowVersion), "Single sign on is not supported on the device. " + "Please install or update to the latest version of Uber app."); Intent intent = new Intent(Intent.ACTION_VIEW); final Uri deepLinkUri = createSsoUri(flowVersion); intent.setData(deepLinkUri); List<PackageInfo> validatedPackages = new ArrayList<>(); if (productFlowPriority.isEmpty()) { validatedPackages.addAll( appProtocol.getInstalledPackages(activity, UBER, getSupportedAppVersion(UBER, flowVersion))); // depends on control dependency: [if], data = [none] } else { for (SupportedAppType supportedAppType : productFlowPriority) { validatedPackages.addAll(appProtocol.getInstalledPackages( activity, supportedAppType, getSupportedAppVersion(supportedAppType, flowVersion))); // depends on control dependency: [for], data = [none] } } if (!validatedPackages.isEmpty()) { intent.setPackage(validatedPackages.get(0).packageName); // depends on control dependency: [if], data = [none] } if (flowVersion == FlowVersion.DEFAULT) { activity.startActivityForResult(intent, requestCode); // depends on control dependency: [if], data = [none] } else { activity.startActivity(intent); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Future<Boolean> send(Email email) { try { email = buildMessage(email); if (GojaConfig.getProperty("mail.smtp", StringPool.EMPTY).equals("mock") && GojaConfig.getApplicationMode().isDev()) { Mock.send(email); return new Future<Boolean>() { @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } @Override public boolean isCancelled() { return false; } @Override public boolean isDone() { return true; } @Override public Boolean get() throws InterruptedException, ExecutionException { return true; } @Override public Boolean get(long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return true; } }; } email.setMailSession(getSession()); return sendMessage(email); } catch (EmailException ex) { throw new MailException("Cannot send email", ex); } } }
public class class_name { public static Future<Boolean> send(Email email) { try { email = buildMessage(email); // depends on control dependency: [try], data = [none] if (GojaConfig.getProperty("mail.smtp", StringPool.EMPTY).equals("mock") && GojaConfig.getApplicationMode().isDev()) { Mock.send(email); // depends on control dependency: [if], data = [none] return new Future<Boolean>() { @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } @Override public boolean isCancelled() { return false; } @Override public boolean isDone() { return true; } @Override public Boolean get() throws InterruptedException, ExecutionException { return true; } // depends on control dependency: [if], data = [none] @Override public Boolean get(long timeout, final TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { return true; } }; } email.setMailSession(getSession()); return sendMessage(email); } catch (EmailException ex) { throw new MailException("Cannot send email", ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void sendMessageToAgents(String[] agent_name, String msgtype, Object message_content, Connector connector) { HashMap<String, Object> hm = new HashMap<String, Object>(); hm.put("performative", msgtype); hm.put(SFipa.CONTENT, message_content); IComponentIdentifier[] ici = new IComponentIdentifier[agent_name.length]; for (int i = 0; i < agent_name.length; i++) { ici[i] = (IComponentIdentifier) connector.getAgentID(agent_name[i]); } ((IMessageService) connector.getMessageService()).deliverMessage(hm, "fipa", ici); } }
public class class_name { public void sendMessageToAgents(String[] agent_name, String msgtype, Object message_content, Connector connector) { HashMap<String, Object> hm = new HashMap<String, Object>(); hm.put("performative", msgtype); hm.put(SFipa.CONTENT, message_content); IComponentIdentifier[] ici = new IComponentIdentifier[agent_name.length]; for (int i = 0; i < agent_name.length; i++) { ici[i] = (IComponentIdentifier) connector.getAgentID(agent_name[i]); // depends on control dependency: [for], data = [i] } ((IMessageService) connector.getMessageService()).deliverMessage(hm, "fipa", ici); } }
public class class_name { public static List<AmendExecutionExtension> filterCompatibleExtensions( final List<AmendExecutionExtension> extensions, final Class<? extends RepositoryMethodDescriptor> descriptorType) { @SuppressWarnings("unchecked") final Class<? extends AmendExecutionExtension> supportedExtension = (Class<? extends AmendExecutionExtension>) GenericsResolver.resolve(descriptorType) .type(RepositoryMethodDescriptor.class).generic("E"); return Lists.newArrayList(Iterables.filter(extensions, new Predicate<AmendExecutionExtension>() { @Override public boolean apply(@Nonnull final AmendExecutionExtension ext) { final Class<?> rawExtType = RepositoryUtils.resolveRepositoryClass(ext); final boolean compatible = supportedExtension.isAssignableFrom(rawExtType); if (!compatible) { LOGGER.debug("Extension {} ignored, because it doesn't implement required extension " + "interface {}", rawExtType.getSimpleName(), supportedExtension.getSimpleName()); } return compatible; } })); } }
public class class_name { public static List<AmendExecutionExtension> filterCompatibleExtensions( final List<AmendExecutionExtension> extensions, final Class<? extends RepositoryMethodDescriptor> descriptorType) { @SuppressWarnings("unchecked") final Class<? extends AmendExecutionExtension> supportedExtension = (Class<? extends AmendExecutionExtension>) GenericsResolver.resolve(descriptorType) .type(RepositoryMethodDescriptor.class).generic("E"); return Lists.newArrayList(Iterables.filter(extensions, new Predicate<AmendExecutionExtension>() { @Override public boolean apply(@Nonnull final AmendExecutionExtension ext) { final Class<?> rawExtType = RepositoryUtils.resolveRepositoryClass(ext); final boolean compatible = supportedExtension.isAssignableFrom(rawExtType); if (!compatible) { LOGGER.debug("Extension {} ignored, because it doesn't implement required extension " + "interface {}", rawExtType.getSimpleName(), supportedExtension.getSimpleName()); // depends on control dependency: [if], data = [none] } return compatible; } })); } }
public class class_name { public static String fabric8ArchetypesVersion() { String version = System.getenv(ENV_FABRIC8_ARCHETYPES_VERSION); if (Strings.isNotBlank(version)) { return version; } return MavenHelpers.getVersion("io.fabric8.archetypes", "archetypes-catalog"); } }
public class class_name { public static String fabric8ArchetypesVersion() { String version = System.getenv(ENV_FABRIC8_ARCHETYPES_VERSION); if (Strings.isNotBlank(version)) { return version; // depends on control dependency: [if], data = [none] } return MavenHelpers.getVersion("io.fabric8.archetypes", "archetypes-catalog"); } }
public class class_name { @NotNull public DoubleStream doubles(long streamSize, final double randomNumberOrigin, final double randomNumberBound) { if (streamSize < 0L) throw new IllegalArgumentException(); if (streamSize == 0L) { return DoubleStream.empty(); } return doubles(randomNumberOrigin, randomNumberBound).limit(streamSize); } }
public class class_name { @NotNull public DoubleStream doubles(long streamSize, final double randomNumberOrigin, final double randomNumberBound) { if (streamSize < 0L) throw new IllegalArgumentException(); if (streamSize == 0L) { return DoubleStream.empty(); // depends on control dependency: [if], data = [none] } return doubles(randomNumberOrigin, randomNumberBound).limit(streamSize); } }
public class class_name { public String convertListToString(Object listOrString) { if (listOrString == null) { return null; } if (listOrString instanceof Collection) { List<String> list = (List<String>) listOrString; return StringUtils.join(list, ","); } return listOrString.toString(); } }
public class class_name { public String convertListToString(Object listOrString) { if (listOrString == null) { return null; // depends on control dependency: [if], data = [none] } if (listOrString instanceof Collection) { List<String> list = (List<String>) listOrString; return StringUtils.join(list, ","); // depends on control dependency: [if], data = [none] } return listOrString.toString(); } }
public class class_name { public StyleRow getStyle(String featureTable, long featureId, GeometryType geometryType, boolean tableStyle) { StyleRow styleRow = null; // Feature Style Styles styles = getStyles(featureTable, featureId); if (styles != null) { styleRow = styles.getStyle(geometryType); } if (styleRow == null && tableStyle) { // Table Style styleRow = getTableStyle(featureTable, geometryType); } return styleRow; } }
public class class_name { public StyleRow getStyle(String featureTable, long featureId, GeometryType geometryType, boolean tableStyle) { StyleRow styleRow = null; // Feature Style Styles styles = getStyles(featureTable, featureId); if (styles != null) { styleRow = styles.getStyle(geometryType); // depends on control dependency: [if], data = [none] } if (styleRow == null && tableStyle) { // Table Style styleRow = getTableStyle(featureTable, geometryType); // depends on control dependency: [if], data = [none] } return styleRow; } }
public class class_name { public static void deleteTileScalingExtension(GeoPackageCore geoPackage) { TileScalingDao tileScalingDao = geoPackage.getTileScalingDao(); ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); try { if (tileScalingDao.isTableExists()) { geoPackage.dropTable(tileScalingDao.getTableName()); } if (extensionsDao.isTableExists()) { extensionsDao .deleteByExtension(TileTableScaling.EXTENSION_NAME); } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Tile Scaling extension and table. GeoPackage: " + geoPackage.getName(), e); } } }
public class class_name { public static void deleteTileScalingExtension(GeoPackageCore geoPackage) { TileScalingDao tileScalingDao = geoPackage.getTileScalingDao(); ExtensionsDao extensionsDao = geoPackage.getExtensionsDao(); try { if (tileScalingDao.isTableExists()) { geoPackage.dropTable(tileScalingDao.getTableName()); // depends on control dependency: [if], data = [none] } if (extensionsDao.isTableExists()) { extensionsDao .deleteByExtension(TileTableScaling.EXTENSION_NAME); // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new GeoPackageException( "Failed to delete Tile Scaling extension and table. GeoPackage: " + geoPackage.getName(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void setHeadlessPadding() { if (dialogType == DialogType.INPUT_TEXT) { bodyContainer.setStyle( PreDefinedStyle.INPUT_DIALOG_HEADLESS_PADDING.getStyle()); } else if (dialogType == DialogType.EXCEPTION) { bodyContainer.setStyle( PreDefinedStyle.EXCEPTION_DIALOG_HEADLESS_PADDING.getStyle()); } else { bodyContainer.setStyle( PreDefinedStyle.HEADLESS_PADDING.getStyle()); } } }
public class class_name { private void setHeadlessPadding() { if (dialogType == DialogType.INPUT_TEXT) { bodyContainer.setStyle( PreDefinedStyle.INPUT_DIALOG_HEADLESS_PADDING.getStyle()); // depends on control dependency: [if], data = [none] } else if (dialogType == DialogType.EXCEPTION) { bodyContainer.setStyle( PreDefinedStyle.EXCEPTION_DIALOG_HEADLESS_PADDING.getStyle()); // depends on control dependency: [if], data = [none] } else { bodyContainer.setStyle( PreDefinedStyle.HEADLESS_PADDING.getStyle()); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static Profile findProfile(Model mavenModel, String profileId) { List<Profile> profiles = mavenModel.getProfiles(); if (profiles != null) { for (Profile profile : profiles) { if (Objects.equal(profile.getId(), profileId)) { return profile; } } } return null; } }
public class class_name { public static Profile findProfile(Model mavenModel, String profileId) { List<Profile> profiles = mavenModel.getProfiles(); if (profiles != null) { for (Profile profile : profiles) { if (Objects.equal(profile.getId(), profileId)) { return profile; // depends on control dependency: [if], data = [none] } } } return null; } }
public class class_name { private void sendIncrementalBlockReport(long startTime) throws Exception { // check if there are newly received blocks Block[] receivedAndDeletedBlockArray = null; int numBlocksReceivedAndDeleted = 0; int currentPendingRequests = 0; synchronized (receivedAndDeletedBlockList) { // construct the ACKs array lastDeletedReport = startTime; numBlocksReceivedAndDeleted = receivedAndDeletedBlockList.size(); if (numBlocksReceivedAndDeleted > 0) { receivedAndDeletedBlockArray = receivedAndDeletedBlockList .toArray(new Block[numBlocksReceivedAndDeleted]); receivedAndDeletedBlockList.clear(); currentPendingRequests = pendingReceivedRequests; pendingReceivedRequests = 0; } } // process received + deleted // if exception is thrown, add all blocks to the retry list if (receivedAndDeletedBlockArray != null) { long[] failed = null; try { IncrementalBlockReport ibr = new IncrementalBlockReport(receivedAndDeletedBlockArray); long rpcStartTime = 0; if (LOG.isDebugEnabled()) { rpcStartTime = System.nanoTime(); LOG.debug("sending blockReceivedAndDeletedNew " + receivedAndDeletedBlockArray.length + " blocks to " + namenodeAddress); } failed = avatarnode.blockReceivedAndDeletedNew(nsRegistration, ibr); if (LOG.isDebugEnabled()) { LOG.debug("finished blockReceivedAndDeletedNew " + "to " + namenodeAddress + " time: " + (System.nanoTime() - rpcStartTime) + " ns"); } boolean isPrimaryCached = isPrimaryServiceCached(); // if we talk to primary failed must be null // if we talk to standby failed shouldn't be null if(isPrimaryCached && failed!=null){ //this should never happen //the primary can't switch to standby throw new IOException("Primary started acting as standby"); } else if (!isPrimaryCached && failed == null) { String msg = "Received null response from standby for incremental" + " block report. "; if (clearPrimaryCommandProcessed) { LOG.info(msg + "Failover is in progress" + " - will not clear primary again"); } else { LOG.info(msg + "Standby is acting as primary. Clearing primary"); // failover - we need to refresh our knowledge this.clearPrimary(); } } } catch (Exception e) { processFailedBlocks( receivedAndDeletedBlockArray, currentPendingRequests); throw e; } if(failed != null && failed.length != 0){ processFailedReceivedDeleted(failed, receivedAndDeletedBlockArray); } } } }
public class class_name { private void sendIncrementalBlockReport(long startTime) throws Exception { // check if there are newly received blocks Block[] receivedAndDeletedBlockArray = null; int numBlocksReceivedAndDeleted = 0; int currentPendingRequests = 0; synchronized (receivedAndDeletedBlockList) { // construct the ACKs array lastDeletedReport = startTime; numBlocksReceivedAndDeleted = receivedAndDeletedBlockList.size(); if (numBlocksReceivedAndDeleted > 0) { receivedAndDeletedBlockArray = receivedAndDeletedBlockList .toArray(new Block[numBlocksReceivedAndDeleted]); // depends on control dependency: [if], data = [none] receivedAndDeletedBlockList.clear(); // depends on control dependency: [if], data = [none] currentPendingRequests = pendingReceivedRequests; // depends on control dependency: [if], data = [none] pendingReceivedRequests = 0; // depends on control dependency: [if], data = [none] } } // process received + deleted // if exception is thrown, add all blocks to the retry list if (receivedAndDeletedBlockArray != null) { long[] failed = null; try { IncrementalBlockReport ibr = new IncrementalBlockReport(receivedAndDeletedBlockArray); long rpcStartTime = 0; if (LOG.isDebugEnabled()) { rpcStartTime = System.nanoTime(); LOG.debug("sending blockReceivedAndDeletedNew " + receivedAndDeletedBlockArray.length + " blocks to " + namenodeAddress); } failed = avatarnode.blockReceivedAndDeletedNew(nsRegistration, ibr); if (LOG.isDebugEnabled()) { LOG.debug("finished blockReceivedAndDeletedNew " + "to " + namenodeAddress + " time: " + (System.nanoTime() - rpcStartTime) + " ns"); } boolean isPrimaryCached = isPrimaryServiceCached(); // if we talk to primary failed must be null // if we talk to standby failed shouldn't be null if(isPrimaryCached && failed!=null){ //this should never happen //the primary can't switch to standby throw new IOException("Primary started acting as standby"); } else if (!isPrimaryCached && failed == null) { String msg = "Received null response from standby for incremental" + " block report. "; if (clearPrimaryCommandProcessed) { LOG.info(msg + "Failover is in progress" + " - will not clear primary again"); // depends on control dependency: [if], data = [none] } else { LOG.info(msg + "Standby is acting as primary. Clearing primary"); // depends on control dependency: [if], data = [none] // failover - we need to refresh our knowledge this.clearPrimary(); // depends on control dependency: [if], data = [none] } } } catch (Exception e) { processFailedBlocks( receivedAndDeletedBlockArray, currentPendingRequests); throw e; } if(failed != null && failed.length != 0){ processFailedReceivedDeleted(failed, receivedAndDeletedBlockArray); } } } }
public class class_name { private static void genericizeftStyles( List<FeatureTypeStyle> ftStyles ) { for( FeatureTypeStyle featureTypeStyle : ftStyles ) { featureTypeStyle.featureTypeNames().clear(); featureTypeStyle.featureTypeNames().add(new NameImpl(GENERIC_FEATURE_TYPENAME)); } } }
public class class_name { private static void genericizeftStyles( List<FeatureTypeStyle> ftStyles ) { for( FeatureTypeStyle featureTypeStyle : ftStyles ) { featureTypeStyle.featureTypeNames().clear(); // depends on control dependency: [for], data = [featureTypeStyle] featureTypeStyle.featureTypeNames().add(new NameImpl(GENERIC_FEATURE_TYPENAME)); // depends on control dependency: [for], data = [featureTypeStyle] } } }
public class class_name { private IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) { // According to XEP-166 the only thing we can do is ack. IQ response = session.createAck(jingle); try { session.terminate("Closed remotely"); } catch (Exception e) { LOGGER.log(Level.WARNING, "exception", e); } return response; } }
public class class_name { private IQ receiveSessionTerminateAction(JingleSession session, Jingle jingle) { // According to XEP-166 the only thing we can do is ack. IQ response = session.createAck(jingle); try { session.terminate("Closed remotely"); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOGGER.log(Level.WARNING, "exception", e); } // depends on control dependency: [catch], data = [none] return response; } }
public class class_name { private static boolean checkChangesFilledUpTo(final FileChanges changesContainer, final long pageIndex) { if (changesContainer == null) { return true; } else if (changesContainer.isNew || changesContainer.maxNewPageIndex > -2) { return pageIndex < changesContainer.maxNewPageIndex + 1; } else return !changesContainer.truncate; } }
public class class_name { private static boolean checkChangesFilledUpTo(final FileChanges changesContainer, final long pageIndex) { if (changesContainer == null) { return true; // depends on control dependency: [if], data = [none] } else if (changesContainer.isNew || changesContainer.maxNewPageIndex > -2) { return pageIndex < changesContainer.maxNewPageIndex + 1; // depends on control dependency: [if], data = [none] } else return !changesContainer.truncate; } }
public class class_name { @Override public String handle(final Object value) { final StringBuilder s = new StringBuilder(); if (value instanceof List) { final List<?> l = (List<?>) value; for (final Object o : l) { if (s.length() > 0) { s.append(','); } s.append(o.toString()); } } else { s.append(value); } return s.toString(); } }
public class class_name { @Override public String handle(final Object value) { final StringBuilder s = new StringBuilder(); if (value instanceof List) { final List<?> l = (List<?>) value; for (final Object o : l) { if (s.length() > 0) { s.append(','); // depends on control dependency: [if], data = [none] } s.append(o.toString()); // depends on control dependency: [for], data = [o] } } else { s.append(value); // depends on control dependency: [if], data = [none] } return s.toString(); } }
public class class_name { public static BigDecimal exp (final BigDecimal x, final int scale) { // e^0 = 1 if (x.signum () == 0) { return BigDecimal.ONE; } // If x is negative, return 1/(e^-x). if (x.signum () == -1) { return BigDecimal.ONE.divide (exp (x.negate (), scale), scale, RoundingMode.HALF_EVEN); } // Compute the whole part of x. BigDecimal xWhole = x.setScale (0, RoundingMode.DOWN); // If there isn't a whole part, compute and return e^x. if (xWhole.signum () == 0) return _expTaylor (x, scale); // Compute the fraction part of x. final BigDecimal xFraction = x.subtract (xWhole); // z = 1 + fraction/whole final BigDecimal z = BigDecimal.ONE.add (xFraction.divide (xWhole, scale, RoundingMode.HALF_EVEN)); // t = e^z final BigDecimal t = _expTaylor (z, scale); final BigDecimal maxLong = BigDecimal.valueOf (Long.MAX_VALUE); BigDecimal result = BigDecimal.ONE; // Compute and return t^whole using intPower(). // If whole > Long.MAX_VALUE, then first compute products // of e^Long.MAX_VALUE. while (xWhole.compareTo (maxLong) >= 0) { result = result.multiply (intPower (t, Long.MAX_VALUE, scale)).setScale (scale, RoundingMode.HALF_EVEN); xWhole = xWhole.subtract (maxLong); Thread.yield (); } return result.multiply (intPower (t, xWhole.longValue (), scale)).setScale (scale, RoundingMode.HALF_EVEN); } }
public class class_name { public static BigDecimal exp (final BigDecimal x, final int scale) { // e^0 = 1 if (x.signum () == 0) { return BigDecimal.ONE; // depends on control dependency: [if], data = [none] } // If x is negative, return 1/(e^-x). if (x.signum () == -1) { return BigDecimal.ONE.divide (exp (x.negate (), scale), scale, RoundingMode.HALF_EVEN); // depends on control dependency: [if], data = [none] } // Compute the whole part of x. BigDecimal xWhole = x.setScale (0, RoundingMode.DOWN); // If there isn't a whole part, compute and return e^x. if (xWhole.signum () == 0) return _expTaylor (x, scale); // Compute the fraction part of x. final BigDecimal xFraction = x.subtract (xWhole); // z = 1 + fraction/whole final BigDecimal z = BigDecimal.ONE.add (xFraction.divide (xWhole, scale, RoundingMode.HALF_EVEN)); // t = e^z final BigDecimal t = _expTaylor (z, scale); final BigDecimal maxLong = BigDecimal.valueOf (Long.MAX_VALUE); BigDecimal result = BigDecimal.ONE; // Compute and return t^whole using intPower(). // If whole > Long.MAX_VALUE, then first compute products // of e^Long.MAX_VALUE. while (xWhole.compareTo (maxLong) >= 0) { result = result.multiply (intPower (t, Long.MAX_VALUE, scale)).setScale (scale, RoundingMode.HALF_EVEN); // depends on control dependency: [while], data = [none] xWhole = xWhole.subtract (maxLong); // depends on control dependency: [while], data = [none] Thread.yield (); // depends on control dependency: [while], data = [none] } return result.multiply (intPower (t, xWhole.longValue (), scale)).setScale (scale, RoundingMode.HALF_EVEN); } }
public class class_name { public Revision backward(int count) { if (count == 0) { return this; } if (count < 0) { throw new IllegalArgumentException("count " + count + " (expected: a non-negative integer)"); } return new Revision(subtract(major, count)); } }
public class class_name { public Revision backward(int count) { if (count == 0) { return this; // depends on control dependency: [if], data = [none] } if (count < 0) { throw new IllegalArgumentException("count " + count + " (expected: a non-negative integer)"); } return new Revision(subtract(major, count)); } }
public class class_name { public static void initJMXBean(JawrApplicationConfigManager appConfigMgr, ServletContext servletContext, String resourceType, String mBeanPrefix) { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); if (mbs != null) { ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType, mBeanPrefix); // register the jawrApplicationConfigManager if it's not already // done ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix); if (!mbs.isRegistered(appJawrMgrObjectName)) { mbs.registerMBean(appConfigMgr, appJawrMgrObjectName); } if (mbs.isRegistered(jawrConfigMgrObjName)) { LOGGER.warn("The MBean '" + jawrConfigMgrObjName.getCanonicalName() + "' already exists. It will be unregisterd and registered with the new JawrConfigManagerMBean."); mbs.unregisterMBean(jawrConfigMgrObjName); } JawrConfigManagerMBean configMgr = appConfigMgr.getConfigMgr(resourceType); mbs.registerMBean(configMgr, jawrConfigMgrObjName); } } catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException | InstanceNotFoundException e) { LOGGER.error("Unable to instanciate the Jawr MBean for resource type '" + resourceType + "'", e); } } }
public class class_name { public static void initJMXBean(JawrApplicationConfigManager appConfigMgr, ServletContext servletContext, String resourceType, String mBeanPrefix) { try { MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); if (mbs != null) { ObjectName jawrConfigMgrObjName = JmxUtils.getMBeanObjectName(servletContext, resourceType, mBeanPrefix); // register the jawrApplicationConfigManager if it's not already // done ObjectName appJawrMgrObjectName = JmxUtils.getAppJawrConfigMBeanObjectName(servletContext, mBeanPrefix); if (!mbs.isRegistered(appJawrMgrObjectName)) { mbs.registerMBean(appConfigMgr, appJawrMgrObjectName); // depends on control dependency: [if], data = [none] } if (mbs.isRegistered(jawrConfigMgrObjName)) { LOGGER.warn("The MBean '" + jawrConfigMgrObjName.getCanonicalName() + "' already exists. It will be unregisterd and registered with the new JawrConfigManagerMBean."); // depends on control dependency: [if], data = [none] mbs.unregisterMBean(jawrConfigMgrObjName); // depends on control dependency: [if], data = [none] } JawrConfigManagerMBean configMgr = appConfigMgr.getConfigMgr(resourceType); mbs.registerMBean(configMgr, jawrConfigMgrObjName); // depends on control dependency: [if], data = [none] } } catch (InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException | InstanceNotFoundException e) { LOGGER.error("Unable to instanciate the Jawr MBean for resource type '" + resourceType + "'", e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public CloudwatchLogsExportConfiguration withDisableLogTypes(String... disableLogTypes) { if (this.disableLogTypes == null) { setDisableLogTypes(new java.util.ArrayList<String>(disableLogTypes.length)); } for (String ele : disableLogTypes) { this.disableLogTypes.add(ele); } return this; } }
public class class_name { public CloudwatchLogsExportConfiguration withDisableLogTypes(String... disableLogTypes) { if (this.disableLogTypes == null) { setDisableLogTypes(new java.util.ArrayList<String>(disableLogTypes.length)); // depends on control dependency: [if], data = [none] } for (String ele : disableLogTypes) { this.disableLogTypes.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void animate(View view) { if (!expanded) { mIv.setImageDrawable(mSearchToBar); mSearchToBar.start(); mIv.animate().translationX(0f).setDuration(mDuration).setInterpolator(mInterp); //text.animate().alpha(1f).setStartDelay(duration - 100).setDuration(100).setInterpolator(interp); } else { mIv.setImageDrawable(mBarToSearch); mBarToSearch.start(); mIv.animate().translationX(mOffset).setDuration(mDuration).setInterpolator(mInterp); //text.setAlpha(0f); } expanded = !expanded; } }
public class class_name { @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void animate(View view) { if (!expanded) { mIv.setImageDrawable(mSearchToBar); // depends on control dependency: [if], data = [none] mSearchToBar.start(); // depends on control dependency: [if], data = [none] mIv.animate().translationX(0f).setDuration(mDuration).setInterpolator(mInterp); // depends on control dependency: [if], data = [none] //text.animate().alpha(1f).setStartDelay(duration - 100).setDuration(100).setInterpolator(interp); } else { mIv.setImageDrawable(mBarToSearch); // depends on control dependency: [if], data = [none] mBarToSearch.start(); // depends on control dependency: [if], data = [none] mIv.animate().translationX(mOffset).setDuration(mDuration).setInterpolator(mInterp); // depends on control dependency: [if], data = [none] //text.setAlpha(0f); } expanded = !expanded; } }
public class class_name { public WorkflowExecutionInfo withTagList(String... tagList) { if (this.tagList == null) { setTagList(new java.util.ArrayList<String>(tagList.length)); } for (String ele : tagList) { this.tagList.add(ele); } return this; } }
public class class_name { public WorkflowExecutionInfo withTagList(String... tagList) { if (this.tagList == null) { setTagList(new java.util.ArrayList<String>(tagList.length)); // depends on control dependency: [if], data = [none] } for (String ele : tagList) { this.tagList.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void setReferent(SNode n, long index, int value) { if (n instanceof SToken) { SToken tok = (SToken) n; if (!referentOfToken.containsKey(tok.getId())) { HashMap<Long, Integer> newlist = new HashMap<Long, Integer>(); newlist.put(index, value);//globalindex? referentOfToken.put(tok.getId(), newlist); } else { referentOfToken.get(tok.getId()).put(globalIndex, value); } } else { List<SRelation<SNode,SNode>> outEdges = n.getGraph().getOutRelations(n.getId()); if(outEdges != null) { for (SRelation<? extends SNode,? extends SNode> edge : outEdges) { if(!(edge instanceof SPointingRelation)) { if (edge.getSource() != null && edge.getTarget() != null) { setReferent(edge.getTarget(), index, value); } } } } } } }
public class class_name { private void setReferent(SNode n, long index, int value) { if (n instanceof SToken) { SToken tok = (SToken) n; if (!referentOfToken.containsKey(tok.getId())) { HashMap<Long, Integer> newlist = new HashMap<Long, Integer>(); newlist.put(index, value);//globalindex? // depends on control dependency: [if], data = [none] referentOfToken.put(tok.getId(), newlist); // depends on control dependency: [if], data = [none] } else { referentOfToken.get(tok.getId()).put(globalIndex, value); // depends on control dependency: [if], data = [none] } } else { List<SRelation<SNode,SNode>> outEdges = n.getGraph().getOutRelations(n.getId()); if(outEdges != null) { for (SRelation<? extends SNode,? extends SNode> edge : outEdges) { if(!(edge instanceof SPointingRelation)) { if (edge.getSource() != null && edge.getTarget() != null) { setReferent(edge.getTarget(), index, value); } } } } } } }
public class class_name { private void removeDeadMethods(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration) declaration; ExecutableElement elem = method.getExecutableElement(); String name = typeUtil.getReferenceName(elem); String signature = typeUtil.getReferenceSignature(elem); if (deadCodeMap.containsMethod(clazz, name, signature)) { if (method.isConstructor()) { deadCodeMap.addConstructorRemovedClass(clazz); } if (Modifier.isNative(method.getModifiers())) { removeMethodOCNI(method); } declarationsIter.remove(); } } } } }
public class class_name { private void removeDeadMethods(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration) declaration; ExecutableElement elem = method.getExecutableElement(); String name = typeUtil.getReferenceName(elem); String signature = typeUtil.getReferenceSignature(elem); if (deadCodeMap.containsMethod(clazz, name, signature)) { if (method.isConstructor()) { deadCodeMap.addConstructorRemovedClass(clazz); // depends on control dependency: [if], data = [none] } if (Modifier.isNative(method.getModifiers())) { removeMethodOCNI(method); // depends on control dependency: [if], data = [none] } declarationsIter.remove(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static ByteBuf copyShort(short... values) { if (values == null || values.length == 0) { return EMPTY_BUFFER; } ByteBuf buffer = buffer(values.length * 2); for (int v: values) { buffer.writeShort(v); } return buffer; } }
public class class_name { public static ByteBuf copyShort(short... values) { if (values == null || values.length == 0) { return EMPTY_BUFFER; // depends on control dependency: [if], data = [none] } ByteBuf buffer = buffer(values.length * 2); for (int v: values) { buffer.writeShort(v); // depends on control dependency: [for], data = [v] } return buffer; } }
public class class_name { private String getMimeType(String resource) { if (resource.endsWith(".png")) { return "image/png"; } else if (resource.endsWith(".css")) { return "text/css"; } else if (resource.endsWith(".js")) { return "application/x-javascript"; } else if (resource.endsWith(".jpg")) { return "image/jpeg"; } else if (resource.endsWith(".gif")) { return "image/gif"; } throw new WebDriverException("mime type NI" + resource); } }
public class class_name { private String getMimeType(String resource) { if (resource.endsWith(".png")) { return "image/png"; // depends on control dependency: [if], data = [none] } else if (resource.endsWith(".css")) { return "text/css"; // depends on control dependency: [if], data = [none] } else if (resource.endsWith(".js")) { return "application/x-javascript"; // depends on control dependency: [if], data = [none] } else if (resource.endsWith(".jpg")) { return "image/jpeg"; // depends on control dependency: [if], data = [none] } else if (resource.endsWith(".gif")) { return "image/gif"; // depends on control dependency: [if], data = [none] } throw new WebDriverException("mime type NI" + resource); } }
public class class_name { @PerformanceSensitive public Stack<Class<?>> getCurrentStackTrace() { // benchmarks show that using the SecurityManager is much faster than looping through getCallerClass(int) if (getSecurityManager() != null) { final Class<?>[] array = getSecurityManager().getClassContext(); final Stack<Class<?>> classes = new Stack<>(); classes.ensureCapacity(array.length); for (final Class<?> clazz : array) { classes.push(clazz); } return classes; } // slower version using getCallerClass where we cannot use a SecurityManager final Stack<Class<?>> classes = new Stack<>(); Class<?> clazz; for (int i = 1; null != (clazz = getCallerClass(i)); i++) { classes.push(clazz); } return classes; } }
public class class_name { @PerformanceSensitive public Stack<Class<?>> getCurrentStackTrace() { // benchmarks show that using the SecurityManager is much faster than looping through getCallerClass(int) if (getSecurityManager() != null) { final Class<?>[] array = getSecurityManager().getClassContext(); final Stack<Class<?>> classes = new Stack<>(); // depends on control dependency: [if], data = [none] classes.ensureCapacity(array.length); // depends on control dependency: [if], data = [none] for (final Class<?> clazz : array) { classes.push(clazz); // depends on control dependency: [for], data = [clazz] } return classes; // depends on control dependency: [if], data = [none] } // slower version using getCallerClass where we cannot use a SecurityManager final Stack<Class<?>> classes = new Stack<>(); Class<?> clazz; for (int i = 1; null != (clazz = getCallerClass(i)); i++) { classes.push(clazz); // depends on control dependency: [for], data = [none] } return classes; } }
public class class_name { public static <T extends Geometry> GeometryExpression<T> asGeometry(Expression<T> expr) { Expression<T> underlyingMixin = ExpressionUtils.extract(expr); if (underlyingMixin instanceof PathImpl) { return new GeometryPath<T>((PathImpl<T>) underlyingMixin); } else if (underlyingMixin instanceof OperationImpl) { return new GeometryOperation<T>((OperationImpl<T>) underlyingMixin); } else { return new GeometryExpression<T>(underlyingMixin) { private static final long serialVersionUID = -6714044005570420009L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; } } }
public class class_name { public static <T extends Geometry> GeometryExpression<T> asGeometry(Expression<T> expr) { Expression<T> underlyingMixin = ExpressionUtils.extract(expr); if (underlyingMixin instanceof PathImpl) { return new GeometryPath<T>((PathImpl<T>) underlyingMixin); // depends on control dependency: [if], data = [none] } else if (underlyingMixin instanceof OperationImpl) { return new GeometryOperation<T>((OperationImpl<T>) underlyingMixin); // depends on control dependency: [if], data = [none] } else { return new GeometryExpression<T>(underlyingMixin) { private static final long serialVersionUID = -6714044005570420009L; @Override public <R, C> R accept(Visitor<R, C> v, C context) { return this.mixin.accept(v, context); } }; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void dealWithFile(File file) { // Browse thru Map SelectiveFileScannerObserver specificFileScanner = selectiveFileScannerMap.get(file.getName()); if (specificFileScanner != null) { logger.debug("Launching fileScanner={} for file={}", specificFileScanner.getClass(), file.getAbsoluteFile()); specificFileScanner.scanFile(file); } // Browse thru List for (FileScannerObserver fileScanner : fileScanners) { logger.debug("Launching fileScanner={} for file={}", fileScanner.getClass(), file.getAbsoluteFile()); fileScanner.scanFile(file); } } }
public class class_name { private void dealWithFile(File file) { // Browse thru Map SelectiveFileScannerObserver specificFileScanner = selectiveFileScannerMap.get(file.getName()); if (specificFileScanner != null) { logger.debug("Launching fileScanner={} for file={}", specificFileScanner.getClass(), file.getAbsoluteFile()); // depends on control dependency: [if], data = [none] specificFileScanner.scanFile(file); // depends on control dependency: [if], data = [none] } // Browse thru List for (FileScannerObserver fileScanner : fileScanners) { logger.debug("Launching fileScanner={} for file={}", fileScanner.getClass(), file.getAbsoluteFile()); // depends on control dependency: [for], data = [fileScanner] fileScanner.scanFile(file); // depends on control dependency: [for], data = [fileScanner] } } }
public class class_name { public List<Field> getFormFields( Form formToGetFieldsForParam, boolean includeTableFieldsParam) { if (formToGetFieldsForParam != null && this.serviceTicket != null) { formToGetFieldsForParam.setServiceTicket(this.serviceTicket); } try { FormFieldListing formFieldListing = new FormFieldListing( this.postJson(formToGetFieldsForParam, WS.Path.SQLUtil.Version1.getFormFields( includeTableFieldsParam))); return formFieldListing.getListing(); } // catch (JSONException e) { throw new FluidClientException(e.getMessage(), e, FluidClientException.ErrorCode.JSON_PARSING); } } }
public class class_name { public List<Field> getFormFields( Form formToGetFieldsForParam, boolean includeTableFieldsParam) { if (formToGetFieldsForParam != null && this.serviceTicket != null) { formToGetFieldsForParam.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [none] } try { FormFieldListing formFieldListing = new FormFieldListing( this.postJson(formToGetFieldsForParam, WS.Path.SQLUtil.Version1.getFormFields( includeTableFieldsParam))); return formFieldListing.getListing(); // depends on control dependency: [try], data = [none] } // catch (JSONException e) { throw new FluidClientException(e.getMessage(), e, FluidClientException.ErrorCode.JSON_PARSING); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static long durationMS(LocalDateTime start,LocalDateTime end) { if(start == null || end == null) { return 0; } return Duration.between(start, end).toMillis(); } }
public class class_name { public static long durationMS(LocalDateTime start,LocalDateTime end) { if(start == null || end == null) { return 0; // depends on control dependency: [if], data = [none] } return Duration.between(start, end).toMillis(); } }
public class class_name { private FacetList calculateFacetList(AbstractDataTable table, String[] facetFields) { if(facetFields == null || facetFields.length == 0){ throw new NullPointerException("Facet field list empty"); } FacetList facetList = new FacetList(); for (String facetField : facetFields) { Set<String> distinctColumnValues = dataTableExtensions.getDistinctColumnValues(table, schema.getColumnIndex(facetField)); facetList.addFacetField(facetField, distinctColumnValues); } return facetList; } }
public class class_name { private FacetList calculateFacetList(AbstractDataTable table, String[] facetFields) { if(facetFields == null || facetFields.length == 0){ throw new NullPointerException("Facet field list empty"); } FacetList facetList = new FacetList(); for (String facetField : facetFields) { Set<String> distinctColumnValues = dataTableExtensions.getDistinctColumnValues(table, schema.getColumnIndex(facetField)); facetList.addFacetField(facetField, distinctColumnValues); // depends on control dependency: [for], data = [facetField] } return facetList; } }
public class class_name { public static Set<Pair<Integer, Integer>> getTopicIdsFromContentSpec(final ContentSpec contentSpec) { // Add the topics at this level to the database final Set<Pair<Integer, Integer>> topicIds = new HashSet<Pair<Integer, Integer>>(); final List<SpecTopic> specTopics = contentSpec.getSpecTopics(); for (final SpecTopic specTopic : specTopics) { if (specTopic.getDBId() != 0) { topicIds.add(new Pair<Integer, Integer>(specTopic.getDBId(), specTopic.getRevision())); } } return topicIds; } }
public class class_name { public static Set<Pair<Integer, Integer>> getTopicIdsFromContentSpec(final ContentSpec contentSpec) { // Add the topics at this level to the database final Set<Pair<Integer, Integer>> topicIds = new HashSet<Pair<Integer, Integer>>(); final List<SpecTopic> specTopics = contentSpec.getSpecTopics(); for (final SpecTopic specTopic : specTopics) { if (specTopic.getDBId() != 0) { topicIds.add(new Pair<Integer, Integer>(specTopic.getDBId(), specTopic.getRevision())); // depends on control dependency: [if], data = [(specTopic.getDBId()] } } return topicIds; } }
public class class_name { private static Level logLevelFor(DescriptorVisibilityFilter f) { Long interval = SystemProperties.getLong( DescriptorVisibilityFilter.class.getName() + ".badFilterLogWarningIntervalMinutes", 60L); // the healthy path will never see this synchronized block synchronized (ResourceHolder.BAD_FILTERS) { Long lastTime = ResourceHolder.BAD_FILTERS.get(f); if (lastTime == null || lastTime + TimeUnit.MINUTES.toMillis(interval) < System.currentTimeMillis()) { ResourceHolder.BAD_FILTERS.put(f, System.currentTimeMillis()); return Level.WARNING; } else { return Level.FINE; } } } }
public class class_name { private static Level logLevelFor(DescriptorVisibilityFilter f) { Long interval = SystemProperties.getLong( DescriptorVisibilityFilter.class.getName() + ".badFilterLogWarningIntervalMinutes", 60L); // the healthy path will never see this synchronized block synchronized (ResourceHolder.BAD_FILTERS) { Long lastTime = ResourceHolder.BAD_FILTERS.get(f); if (lastTime == null || lastTime + TimeUnit.MINUTES.toMillis(interval) < System.currentTimeMillis()) { ResourceHolder.BAD_FILTERS.put(f, System.currentTimeMillis()); // depends on control dependency: [if], data = [none] return Level.WARNING; // depends on control dependency: [if], data = [none] } else { return Level.FINE; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public final void removePointsFromAttr(final Element root, final String selector, final String attr) { final Iterable<Element> elements; // Elements to fix checkNotNull(root, "Received a null pointer as root element"); checkNotNull(selector, "Received a null pointer as selector"); checkNotNull(attr, "Received a null pointer as attribute"); // Selects and iterates over the elements elements = root.select(selector); for (final Element selected : elements) { removePointsFromAttr(selected, attr); } } }
public class class_name { public final void removePointsFromAttr(final Element root, final String selector, final String attr) { final Iterable<Element> elements; // Elements to fix checkNotNull(root, "Received a null pointer as root element"); checkNotNull(selector, "Received a null pointer as selector"); checkNotNull(attr, "Received a null pointer as attribute"); // Selects and iterates over the elements elements = root.select(selector); for (final Element selected : elements) { removePointsFromAttr(selected, attr); // depends on control dependency: [for], data = [selected] } } }
public class class_name { void connectAndRequestGoogleAccount(int signInRequestCode, int errorResolutionRequestCode) { if (client.isConnected()) { requestGoogleAccount(signInRequestCode); } else if (!client.isConnecting()) { this.signInRequestCode = signInRequestCode; this.errorResolutionRequestCode = errorResolutionRequestCode; client.connect(); } } }
public class class_name { void connectAndRequestGoogleAccount(int signInRequestCode, int errorResolutionRequestCode) { if (client.isConnected()) { requestGoogleAccount(signInRequestCode); // depends on control dependency: [if], data = [none] } else if (!client.isConnecting()) { this.signInRequestCode = signInRequestCode; // depends on control dependency: [if], data = [none] this.errorResolutionRequestCode = errorResolutionRequestCode; // depends on control dependency: [if], data = [none] client.connect(); // depends on control dependency: [if], data = [none] } } }
public class class_name { private String checkLooseEndsTableNameConflict(String clearname, int attempt) { Enumeration e = getVariables(); while (e.hasMoreElements()) { BaseType bt = (BaseType) e.nextElement(); String btName = bt.getEncodedName(); //LogStream.out.println("bt: '"+btName+"' dataset: '"+name+"'"); if (btName.equals(clearname)) { clearname = repairLooseEndsTableConflict(clearname, attempt++); clearname = checkLooseEndsTableNameConflict(clearname, attempt); } } AttributeTable at = getAttributeTable(); e = at.getNames(); while (e.hasMoreElements()) { String aName = (String) e.nextElement(); if (aName.equals(clearname)) { clearname = repairLooseEndsTableConflict(clearname, attempt++); clearname = checkLooseEndsTableNameConflict(clearname, attempt); } } return (clearname); } }
public class class_name { private String checkLooseEndsTableNameConflict(String clearname, int attempt) { Enumeration e = getVariables(); while (e.hasMoreElements()) { BaseType bt = (BaseType) e.nextElement(); String btName = bt.getEncodedName(); //LogStream.out.println("bt: '"+btName+"' dataset: '"+name+"'"); if (btName.equals(clearname)) { clearname = repairLooseEndsTableConflict(clearname, attempt++); // depends on control dependency: [if], data = [none] clearname = checkLooseEndsTableNameConflict(clearname, attempt); // depends on control dependency: [if], data = [none] } } AttributeTable at = getAttributeTable(); e = at.getNames(); while (e.hasMoreElements()) { String aName = (String) e.nextElement(); if (aName.equals(clearname)) { clearname = repairLooseEndsTableConflict(clearname, attempt++); // depends on control dependency: [if], data = [none] clearname = checkLooseEndsTableNameConflict(clearname, attempt); // depends on control dependency: [if], data = [none] } } return (clearname); } }
public class class_name { static public String canonical(String s) { if(s != null) { s = s.trim(); if(s.length() == 0) s = null; } return s; } }
public class class_name { static public String canonical(String s) { if(s != null) { s = s.trim(); // depends on control dependency: [if], data = [none] if(s.length() == 0) s = null; } return s; } }
public class class_name { private static boolean validParameter(final Parameter p) { if (p.getNamespace() == null) { return false; } if (p.getValue() == null) { return false; } return true; } }
public class class_name { private static boolean validParameter(final Parameter p) { if (p.getNamespace() == null) { return false; // depends on control dependency: [if], data = [none] } if (p.getValue() == null) { return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public static List<MimeType> parseMimeTypes(String mimeTypes) { if (!Strings.isNullOrEmpty(mimeTypes)) { return Collections.emptyList(); } String[] tokens = mimeTypes.split(",\\s*"); List<MimeType> result = new ArrayList<MimeType>(tokens.length); for (String token : tokens) { result.add(parseMimeType(token)); } return result; } }
public class class_name { public static List<MimeType> parseMimeTypes(String mimeTypes) { if (!Strings.isNullOrEmpty(mimeTypes)) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } String[] tokens = mimeTypes.split(",\\s*"); List<MimeType> result = new ArrayList<MimeType>(tokens.length); for (String token : tokens) { result.add(parseMimeType(token)); // depends on control dependency: [for], data = [token] } return result; } }
public class class_name { @Nullable private static <T> ArrayList<T> excludeObject(@Nullable ArrayList<T> list, @Nullable T target, boolean exclude) { if (target != null) { if (exclude) { list = ArrayListManager.add(list, target); } else { list = ArrayListManager.remove(list, target); } } return list; } }
public class class_name { @Nullable private static <T> ArrayList<T> excludeObject(@Nullable ArrayList<T> list, @Nullable T target, boolean exclude) { if (target != null) { if (exclude) { list = ArrayListManager.add(list, target); // depends on control dependency: [if], data = [none] } else { list = ArrayListManager.remove(list, target); // depends on control dependency: [if], data = [none] } } return list; } }
public class class_name { public static String decapitalize(String text) { if (isNullOrEmpty(text)) { return text; } char chars[] = text.toCharArray(); chars[0] = Character.toLowerCase(chars[0]); return new String(chars); } }
public class class_name { public static String decapitalize(String text) { if (isNullOrEmpty(text)) { return text; // depends on control dependency: [if], data = [none] } char chars[] = text.toCharArray(); chars[0] = Character.toLowerCase(chars[0]); return new String(chars); } }
public class class_name { public static Map<String, Object> configureObjectFieldsWithProperties( final Object object, final List<Property> properties, final Map<String, Object> inputConfig ) { HashMap<String, Object> modified = new HashMap<>(inputConfig); for (final Property property : properties) { if (null != modified.get(property.getName())) { if (setValueForProperty(property, modified.get(property.getName()), object)) { modified.remove(property.getName()); } } } return modified; } }
public class class_name { public static Map<String, Object> configureObjectFieldsWithProperties( final Object object, final List<Property> properties, final Map<String, Object> inputConfig ) { HashMap<String, Object> modified = new HashMap<>(inputConfig); for (final Property property : properties) { if (null != modified.get(property.getName())) { if (setValueForProperty(property, modified.get(property.getName()), object)) { modified.remove(property.getName()); // depends on control dependency: [if], data = [none] } } } return modified; } }
public class class_name { public static boolean isSnapshotablePersistentTableView(Database db, Table table) { Table materializer = table.getMaterializer(); if (materializer == null) { // Return false if it is not a materialized view. return false; } if (CatalogUtil.isTableExportOnly(db, materializer)) { // The view source table should not be a streamed table. return false; } if (! table.getIsreplicated() && table.getPartitioncolumn() == null) { // If the view table is implicitly partitioned (maybe was not in snapshot), // its maintenance is not turned off during the snapshot restore process. // Let it take care of its own data by itself. // Do not attempt to restore data for it. return false; } return true; } }
public class class_name { public static boolean isSnapshotablePersistentTableView(Database db, Table table) { Table materializer = table.getMaterializer(); if (materializer == null) { // Return false if it is not a materialized view. return false; // depends on control dependency: [if], data = [none] } if (CatalogUtil.isTableExportOnly(db, materializer)) { // The view source table should not be a streamed table. return false; // depends on control dependency: [if], data = [none] } if (! table.getIsreplicated() && table.getPartitioncolumn() == null) { // If the view table is implicitly partitioned (maybe was not in snapshot), // its maintenance is not turned off during the snapshot restore process. // Let it take care of its own data by itself. // Do not attempt to restore data for it. return false; // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public void realClose() { if (isClosing()) { if (buffer != null) { buffer.free(); buffer = null; } state.setState(RTMP.STATE_DISCONNECTED); pendingMessages.clear(); super.close(); } } }
public class class_name { public void realClose() { if (isClosing()) { if (buffer != null) { buffer.free(); // depends on control dependency: [if], data = [none] buffer = null; // depends on control dependency: [if], data = [none] } state.setState(RTMP.STATE_DISCONNECTED); // depends on control dependency: [if], data = [none] pendingMessages.clear(); // depends on control dependency: [if], data = [none] super.close(); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public TypedOutput toBody(final Object object) { if (object.getClass().isAnnotationPresent(DoNotConvert.class)) { return new TypedString(object.toString()); } else { return converter.toBody(object); } } }
public class class_name { @Override public TypedOutput toBody(final Object object) { if (object.getClass().isAnnotationPresent(DoNotConvert.class)) { return new TypedString(object.toString()); // depends on control dependency: [if], data = [none] } else { return converter.toBody(object); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addPostParams(final Request request) { if (status != null) { request.addPostParam("Status", status.toString()); } if (announceUrl != null) { request.addPostParam("AnnounceUrl", announceUrl.toString()); } if (announceMethod != null) { request.addPostParam("AnnounceMethod", announceMethod.toString()); } } }
public class class_name { private void addPostParams(final Request request) { if (status != null) { request.addPostParam("Status", status.toString()); // depends on control dependency: [if], data = [none] } if (announceUrl != null) { request.addPostParam("AnnounceUrl", announceUrl.toString()); // depends on control dependency: [if], data = [none] } if (announceMethod != null) { request.addPostParam("AnnounceMethod", announceMethod.toString()); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected void deliverResponse(T response) { synchronized (responseListeners) { for (RequestListener.ResponseListener responseListener : responseListeners) { responseListener.onResponse(response); } if (!this.response.intermediate) { responseListeners.clear(); } } if (!this.response.intermediate) { synchronized (errorListeners) { errorListeners.clear(); } } } }
public class class_name { protected void deliverResponse(T response) { synchronized (responseListeners) { for (RequestListener.ResponseListener responseListener : responseListeners) { responseListener.onResponse(response); // depends on control dependency: [for], data = [responseListener] } if (!this.response.intermediate) { responseListeners.clear(); // depends on control dependency: [if], data = [none] } } if (!this.response.intermediate) { synchronized (errorListeners) { // depends on control dependency: [if], data = [none] errorListeners.clear(); } } } }
public class class_name { private static void manageLifecycleAnnotation(final Component<?> component, final MultiMap<String, Method> lifecycleMethod, final Class<? extends Annotation> annotationClass) { for (final Method method : ClassUtility.getAnnotatedMethods(component.getClass(), annotationClass)) { // Add a method to the multimap entry // TODO sort lifecycleMethod.add(annotationClass.getName(), method); } } }
public class class_name { private static void manageLifecycleAnnotation(final Component<?> component, final MultiMap<String, Method> lifecycleMethod, final Class<? extends Annotation> annotationClass) { for (final Method method : ClassUtility.getAnnotatedMethods(component.getClass(), annotationClass)) { // Add a method to the multimap entry // TODO sort lifecycleMethod.add(annotationClass.getName(), method); // depends on control dependency: [for], data = [method] } } }
public class class_name { private synchronized void startTimer() { if (timer == null) { timer = new Timer("Timer thread for monitoring " + getContextName(), true); TimerTask task = new TimerTask() { public void run() { try { timerEvent(); } catch (IOException ioe) { ioe.printStackTrace(); } } }; long millis = period * 1000; timer.scheduleAtFixedRate(task, millis, millis); } } }
public class class_name { private synchronized void startTimer() { if (timer == null) { timer = new Timer("Timer thread for monitoring " + getContextName(), true); // depends on control dependency: [if], data = [none] TimerTask task = new TimerTask() { public void run() { try { timerEvent(); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { ioe.printStackTrace(); } // depends on control dependency: [catch], data = [none] } }; long millis = period * 1000; timer.scheduleAtFixedRate(task, millis, millis); // depends on control dependency: [if], data = [none] } } }