code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public String getSQLState() { String state = null; try { state = new String(m_sqlState, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } return state; } }
public class class_name { public String getSQLState() { String state = null; try { state = new String(m_sqlState, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } // depends on control dependency: [catch], data = [none] return state; } }
public class class_name { public T _get(long seqno) { lock.lock(); try { int row_index=computeRow(seqno); if(row_index < 0 || row_index >= matrix.length) return null; T[] row=matrix[row_index]; if(row == null) return null; int index=computeIndex(seqno); return index >= 0? row[index] : null; } finally { lock.unlock(); } } }
public class class_name { public T _get(long seqno) { lock.lock(); try { int row_index=computeRow(seqno); if(row_index < 0 || row_index >= matrix.length) return null; T[] row=matrix[row_index]; if(row == null) return null; int index=computeIndex(seqno); return index >= 0? row[index] : null; // depends on control dependency: [try], data = [none] } finally { lock.unlock(); } } }
public class class_name { public static double bytes_to_double(byte[] bytes, int offset) { try { long result = bytes[0+offset] & 0xff; result <<= 8; result |= bytes[1+offset] & 0xff; result <<= 8; result |= bytes[2+offset] & 0xff; result <<= 8; result |= bytes[3+offset] & 0xff; result <<= 8; result |= bytes[4+offset] & 0xff; result <<= 8; result |= bytes[5+offset] & 0xff; result <<= 8; result |= bytes[6+offset] & 0xff; result <<= 8; result |= bytes[7+offset] & 0xff; return Double.longBitsToDouble(result); } catch (IndexOutOfBoundsException x) { throw new PickleException("decoding double: too few bytes"); } } }
public class class_name { public static double bytes_to_double(byte[] bytes, int offset) { try { long result = bytes[0+offset] & 0xff; result <<= 8; // depends on control dependency: [try], data = [none] result |= bytes[1+offset] & 0xff; // depends on control dependency: [try], data = [none] result <<= 8; // depends on control dependency: [try], data = [none] result |= bytes[2+offset] & 0xff; // depends on control dependency: [try], data = [none] result <<= 8; // depends on control dependency: [try], data = [none] result |= bytes[3+offset] & 0xff; // depends on control dependency: [try], data = [none] result <<= 8; // depends on control dependency: [try], data = [none] result |= bytes[4+offset] & 0xff; // depends on control dependency: [try], data = [none] result <<= 8; // depends on control dependency: [try], data = [none] result |= bytes[5+offset] & 0xff; // depends on control dependency: [try], data = [none] result <<= 8; // depends on control dependency: [try], data = [none] result |= bytes[6+offset] & 0xff; // depends on control dependency: [try], data = [none] result <<= 8; // depends on control dependency: [try], data = [none] result |= bytes[7+offset] & 0xff; // depends on control dependency: [try], data = [none] return Double.longBitsToDouble(result); // depends on control dependency: [try], data = [none] } catch (IndexOutOfBoundsException x) { throw new PickleException("decoding double: too few bytes"); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public JBBPTextWriter Bin(final Object... objs) throws IOException { if (this.mappedClassObserver == null) { this.mappedClassObserver = new MappedObjectLogger(); } ensureNewLineMode(); for (final Object obj : objs) { if (obj == null) { write("<NULL>"); } else { if (obj instanceof JBBPAbstractField) { printAbstractFieldObject(null, (JBBPAbstractField) obj); } else { this.mappedClassObserver.init(); this.mappedClassObserver.processObject(obj); } } } return this; } }
public class class_name { public JBBPTextWriter Bin(final Object... objs) throws IOException { if (this.mappedClassObserver == null) { this.mappedClassObserver = new MappedObjectLogger(); // depends on control dependency: [if], data = [none] } ensureNewLineMode(); for (final Object obj : objs) { if (obj == null) { write("<NULL>"); } else { if (obj instanceof JBBPAbstractField) { printAbstractFieldObject(null, (JBBPAbstractField) obj); // depends on control dependency: [if], data = [none] } else { this.mappedClassObserver.init(); // depends on control dependency: [if], data = [none] this.mappedClassObserver.processObject(obj); // depends on control dependency: [if], data = [none] } } } return this; } }
public class class_name { private static int readStringLength(DataInputView source) throws IOException { int len = source.readByte() & 0xFF; if (len >= HIGH_BIT) { int shift = 7; int curr; len = len & 0x7F; while ((curr = source.readByte() & 0xFF) >= HIGH_BIT) { len |= (curr & 0x7F) << shift; shift += 7; } len |= curr << shift; } return len; } }
public class class_name { private static int readStringLength(DataInputView source) throws IOException { int len = source.readByte() & 0xFF; if (len >= HIGH_BIT) { int shift = 7; int curr; len = len & 0x7F; while ((curr = source.readByte() & 0xFF) >= HIGH_BIT) { len |= (curr & 0x7F) << shift; // depends on control dependency: [while], data = [none] shift += 7; // depends on control dependency: [while], data = [none] } len |= curr << shift; } return len; } }
public class class_name { public void useFolder(final String folderName) { closeFolderIfOpened(folder); try { this.folderName = folderName; this.folder = getService().getFolder(folderName); try { folder.open(Folder.READ_WRITE); } catch (final MailException ignore) { folder.open(Folder.READ_ONLY); } } catch (final MessagingException msgexc) { throw new MailException("Failed to connect to folder: " + folderName, msgexc); } } }
public class class_name { public void useFolder(final String folderName) { closeFolderIfOpened(folder); try { this.folderName = folderName; // depends on control dependency: [try], data = [none] this.folder = getService().getFolder(folderName); // depends on control dependency: [try], data = [none] try { folder.open(Folder.READ_WRITE); // depends on control dependency: [try], data = [none] } catch (final MailException ignore) { folder.open(Folder.READ_ONLY); } // depends on control dependency: [catch], data = [none] } catch (final MessagingException msgexc) { throw new MailException("Failed to connect to folder: " + folderName, msgexc); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void marshall(ResourceChangeDetail resourceChangeDetail, ProtocolMarshaller protocolMarshaller) { if (resourceChangeDetail == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceChangeDetail.getTarget(), TARGET_BINDING); protocolMarshaller.marshall(resourceChangeDetail.getEvaluation(), EVALUATION_BINDING); protocolMarshaller.marshall(resourceChangeDetail.getCausingEntity(), CAUSINGENTITY_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ResourceChangeDetail resourceChangeDetail, ProtocolMarshaller protocolMarshaller) { if (resourceChangeDetail == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(resourceChangeDetail.getTarget(), TARGET_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceChangeDetail.getEvaluation(), EVALUATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(resourceChangeDetail.getCausingEntity(), CAUSINGENTITY_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 { protected final MtasDataCollector add(boolean increaseSourceNumber) throws IOException { if (!closed) { if (!collectorType.equals(DataCollector.COLLECTOR_TYPE_DATA)) { throw new IOException( "collector should be " + DataCollector.COLLECTOR_TYPE_DATA); } else { if (newPosition > 0) { newCurrentExisting = true; } else if (position < getSize()) { // copy newKeyList[0] = keyList[0]; newSourceNumberList[0] = sourceNumberList[0]; if (increaseSourceNumber) { newSourceNumberList[0]++; } newErrorNumber[0] = errorNumber[0]; newErrorList[0] = errorList[0]; if (hasSub) { newSubCollectorNextLevel = subCollectorNextLevel; } copyToNew(0, 0); newPosition = 1; position = 1; newCurrentExisting = true; } else { // add key newKeyList[0] = DataCollector.COLLECTOR_TYPE_DATA; newSourceNumberList[0] = 1; newErrorNumber[0] = 0; newErrorList[0] = new HashMap<>(); newPosition = 1; newCurrentPosition = newPosition - 1; newCurrentExisting = false; // ready, only handle sub if (hasSub) { newSubCollectorNextLevel = DataCollector.getCollector( subCollectorTypes[0], subDataTypes[0], subStatsTypes[0], subStatsItems[0], subSortTypes[0], subSortDirections[0], subStart[0], subNumber[0], newSubCollectorTypes, newSubDataTypes, newSubStatsTypes, newSubStatsItems, newSubSortTypes, newSubSortDirections, newSubStart, newSubNumber, segmentRegistration, null); } else { newSubCollectorNextLevel = null; } } return newSubCollectorNextLevel; } } else { throw new IOException("already closed"); } } }
public class class_name { protected final MtasDataCollector add(boolean increaseSourceNumber) throws IOException { if (!closed) { if (!collectorType.equals(DataCollector.COLLECTOR_TYPE_DATA)) { throw new IOException( "collector should be " + DataCollector.COLLECTOR_TYPE_DATA); } else { if (newPosition > 0) { newCurrentExisting = true; // depends on control dependency: [if], data = [none] } else if (position < getSize()) { // copy newKeyList[0] = keyList[0]; // depends on control dependency: [if], data = [none] newSourceNumberList[0] = sourceNumberList[0]; // depends on control dependency: [if], data = [none] if (increaseSourceNumber) { newSourceNumberList[0]++; // depends on control dependency: [if], data = [none] } newErrorNumber[0] = errorNumber[0]; // depends on control dependency: [if], data = [none] newErrorList[0] = errorList[0]; // depends on control dependency: [if], data = [none] if (hasSub) { newSubCollectorNextLevel = subCollectorNextLevel; // depends on control dependency: [if], data = [none] } copyToNew(0, 0); // depends on control dependency: [if], data = [none] newPosition = 1; // depends on control dependency: [if], data = [none] position = 1; // depends on control dependency: [if], data = [none] newCurrentExisting = true; // depends on control dependency: [if], data = [none] } else { // add key newKeyList[0] = DataCollector.COLLECTOR_TYPE_DATA; // depends on control dependency: [if], data = [none] newSourceNumberList[0] = 1; // depends on control dependency: [if], data = [none] newErrorNumber[0] = 0; // depends on control dependency: [if], data = [none] newErrorList[0] = new HashMap<>(); // depends on control dependency: [if], data = [none] newPosition = 1; // depends on control dependency: [if], data = [none] newCurrentPosition = newPosition - 1; // depends on control dependency: [if], data = [none] newCurrentExisting = false; // depends on control dependency: [if], data = [none] // ready, only handle sub if (hasSub) { newSubCollectorNextLevel = DataCollector.getCollector( subCollectorTypes[0], subDataTypes[0], subStatsTypes[0], subStatsItems[0], subSortTypes[0], subSortDirections[0], subStart[0], subNumber[0], newSubCollectorTypes, newSubDataTypes, newSubStatsTypes, newSubStatsItems, newSubSortTypes, newSubSortDirections, newSubStart, newSubNumber, segmentRegistration, null); // depends on control dependency: [if], data = [none] } else { newSubCollectorNextLevel = null; // depends on control dependency: [if], data = [none] } } return newSubCollectorNextLevel; } } else { throw new IOException("already closed"); } } }
public class class_name { public UnixPath normalize() { List<String> parts = new ArrayList<>(); boolean mutated = false; int resultLength = 0; int mark = 0; int index; do { index = path.indexOf(SEPARATOR, mark); String part = path.substring(mark, index == -1 ? path.length() : index + 1); switch (part) { case CURRENT_DIR: case CURRENT_DIR + SEPARATOR: mutated = true; break; case PARENT_DIR: case PARENT_DIR + SEPARATOR: mutated = true; if (!parts.isEmpty()) { resultLength -= parts.remove(parts.size() - 1).length(); } break; default: if (index != mark || index == 0) { parts.add(part); resultLength = part.length(); } else { mutated = true; } } mark = index + 1; } while (index != -1); if (!mutated) { return this; } StringBuilder result = new StringBuilder(resultLength); for (String part : parts) { result.append(part); } return new UnixPath(permitEmptyComponents, result.toString()); } }
public class class_name { public UnixPath normalize() { List<String> parts = new ArrayList<>(); boolean mutated = false; int resultLength = 0; int mark = 0; int index; do { index = path.indexOf(SEPARATOR, mark); String part = path.substring(mark, index == -1 ? path.length() : index + 1); switch (part) { case CURRENT_DIR: case CURRENT_DIR + SEPARATOR: mutated = true; break; case PARENT_DIR: case PARENT_DIR + SEPARATOR: mutated = true; if (!parts.isEmpty()) { resultLength -= parts.remove(parts.size() - 1).length(); // depends on control dependency: [if], data = [none] } break; default: if (index != mark || index == 0) { parts.add(part); // depends on control dependency: [if], data = [none] resultLength = part.length(); // depends on control dependency: [if], data = [none] } else { mutated = true; // depends on control dependency: [if], data = [none] } } mark = index + 1; } while (index != -1); if (!mutated) { return this; // depends on control dependency: [if], data = [none] } StringBuilder result = new StringBuilder(resultLength); for (String part : parts) { result.append(part); // depends on control dependency: [for], data = [part] } return new UnixPath(permitEmptyComponents, result.toString()); } }
public class class_name { public void marshall(GetMLModelRequest getMLModelRequest, ProtocolMarshaller protocolMarshaller) { if (getMLModelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getMLModelRequest.getMLModelId(), MLMODELID_BINDING); protocolMarshaller.marshall(getMLModelRequest.getVerbose(), VERBOSE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(GetMLModelRequest getMLModelRequest, ProtocolMarshaller protocolMarshaller) { if (getMLModelRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(getMLModelRequest.getMLModelId(), MLMODELID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(getMLModelRequest.getVerbose(), VERBOSE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static int lenIonTimestamp(Timestamp di) { if (di == null) return 0; int len = 0; switch (di.getPrecision()) { case FRACTION: case SECOND: { BigDecimal fraction = di.getFractionalSecond(); if (fraction != null) { assert fraction.signum() >=0 && ! fraction.equals(BigDecimal.ZERO) : "Bad timestamp fraction: " + fraction; // Since the fraction is not 0d0, at least one subfield of the // exponent and mantissa is non-zero, so this will always write at // least one byte. int fracLen = IonBinary.lenIonDecimal(fraction); assert fracLen > 0; len += fracLen; } len++; // len of seconds < 60 } case MINUTE: len += 2; // len of hour and minutes (both < 127) case DAY: len += 1; // len of month and day (both < 127) case MONTH: len += 1; // len of month and day (both < 127) case YEAR: len += IonBinary.lenVarUInt(di.getZYear()); } Integer offset = di.getLocalOffset(); if (offset == null) { len++; // room for the -0 (i.e. offset is "no specified offset") } else if (offset == 0) { len++; } else { len += IonBinary.lenVarInt(offset.longValue()); } return len; } }
public class class_name { public static int lenIonTimestamp(Timestamp di) { if (di == null) return 0; int len = 0; switch (di.getPrecision()) { case FRACTION: case SECOND: { BigDecimal fraction = di.getFractionalSecond(); if (fraction != null) { assert fraction.signum() >=0 && ! fraction.equals(BigDecimal.ZERO) : "Bad timestamp fraction: " + fraction; // Since the fraction is not 0d0, at least one subfield of the // exponent and mantissa is non-zero, so this will always write at // least one byte. int fracLen = IonBinary.lenIonDecimal(fraction); assert fracLen > 0; len += fracLen; // depends on control dependency: [if], data = [none] } len++; // len of seconds < 60 } case MINUTE: len += 2; // len of hour and minutes (both < 127) case DAY: len += 1; // len of month and day (both < 127) case MONTH: len += 1; // len of month and day (both < 127) case YEAR: len += IonBinary.lenVarUInt(di.getZYear()); } Integer offset = di.getLocalOffset(); if (offset == null) { len++; // room for the -0 (i.e. offset is "no specified offset") } else if (offset == 0) { len++; } else { len += IonBinary.lenVarInt(offset.longValue()); } return len; } }
public class class_name { public static QName valueOf(String qNameAsString) { // null is not valid if (qNameAsString == null) { throw new IllegalArgumentException( "cannot create QName from \"null\" or \"\" String"); } // "" local part is valid to preserve compatible behavior with QName 1.0 if (qNameAsString.length() == 0) { return new QName( "", qNameAsString, ""); } // local part only? int colon = qNameAsString.lastIndexOf(":"); if (colon == -1) { return new QName( "", qNameAsString, ""); } // Namespace URI and local part specified return new QName( qNameAsString.substring(0, colon), qNameAsString.substring(colon + 1), ""); } }
public class class_name { public static QName valueOf(String qNameAsString) { // null is not valid if (qNameAsString == null) { throw new IllegalArgumentException( "cannot create QName from \"null\" or \"\" String"); } // "" local part is valid to preserve compatible behavior with QName 1.0 if (qNameAsString.length() == 0) { return new QName( "", qNameAsString, ""); // depends on control dependency: [if], data = [none] } // local part only? int colon = qNameAsString.lastIndexOf(":"); if (colon == -1) { return new QName( "", qNameAsString, ""); // depends on control dependency: [if], data = [none] } // Namespace URI and local part specified return new QName( qNameAsString.substring(0, colon), qNameAsString.substring(colon + 1), ""); } }
public class class_name { public boolean createSqlTableFrom(Connection connection, String tableToClone) { long startTime = System.currentTimeMillis(); try { Statement statement = connection.createStatement(); // Drop target table to avoid a conflict. String dropSql = String.format("drop table if exists %s", name); LOG.info(dropSql); statement.execute(dropSql); if (tableToClone.endsWith("stop_times")) { normalizeAndCloneStopTimes(statement, name, tableToClone); } else { // Adding the unlogged keyword gives about 12 percent speedup on loading, but is non-standard. // FIXME: Which create table operation is more efficient? String createTableAsSql = String.format("create table %s as table %s", name, tableToClone); // Create table in the image of the table we're copying (indexes are not included). LOG.info(createTableAsSql); statement.execute(createTableAsSql); } applyAutoIncrementingSequence(statement); // FIXME: Is there a need to add primary key constraint here? if (usePrimaryKey) { // Add primary key to ID column for any tables that require it. String addPrimaryKeySql = String.format("ALTER TABLE %s ADD PRIMARY KEY (id)", name); LOG.info(addPrimaryKeySql); statement.execute(addPrimaryKeySql); } return true; } catch (SQLException ex) { LOG.error("Error cloning table {}: {}", name, ex.getSQLState()); LOG.error("details: ", ex); try { connection.rollback(); // It is likely that if cloning the table fails, the reason was that the table did not already exist. // Try to create the table here from scratch. // FIXME: Maybe we should check that the reason the clone failed was that the table already exists. createSqlTable(connection, true); return true; } catch (SQLException e) { e.printStackTrace(); return false; } } finally { LOG.info("Cloned table {} as {} in {} ms", tableToClone, name, System.currentTimeMillis() - startTime); } } }
public class class_name { public boolean createSqlTableFrom(Connection connection, String tableToClone) { long startTime = System.currentTimeMillis(); try { Statement statement = connection.createStatement(); // Drop target table to avoid a conflict. String dropSql = String.format("drop table if exists %s", name); LOG.info(dropSql); statement.execute(dropSql); if (tableToClone.endsWith("stop_times")) { normalizeAndCloneStopTimes(statement, name, tableToClone); // depends on control dependency: [if], data = [none] } else { // Adding the unlogged keyword gives about 12 percent speedup on loading, but is non-standard. // FIXME: Which create table operation is more efficient? String createTableAsSql = String.format("create table %s as table %s", name, tableToClone); // Create table in the image of the table we're copying (indexes are not included). LOG.info(createTableAsSql); // depends on control dependency: [if], data = [none] statement.execute(createTableAsSql); // depends on control dependency: [if], data = [none] } applyAutoIncrementingSequence(statement); // FIXME: Is there a need to add primary key constraint here? if (usePrimaryKey) { // Add primary key to ID column for any tables that require it. String addPrimaryKeySql = String.format("ALTER TABLE %s ADD PRIMARY KEY (id)", name); LOG.info(addPrimaryKeySql); // depends on control dependency: [if], data = [none] statement.execute(addPrimaryKeySql); // depends on control dependency: [if], data = [none] } return true; } catch (SQLException ex) { LOG.error("Error cloning table {}: {}", name, ex.getSQLState()); LOG.error("details: ", ex); try { connection.rollback(); // depends on control dependency: [try], data = [none] // It is likely that if cloning the table fails, the reason was that the table did not already exist. // Try to create the table here from scratch. // FIXME: Maybe we should check that the reason the clone failed was that the table already exists. createSqlTable(connection, true); // depends on control dependency: [try], data = [none] return true; // depends on control dependency: [try], data = [none] } catch (SQLException e) { e.printStackTrace(); return false; } // depends on control dependency: [catch], data = [none] } finally { LOG.info("Cloned table {} as {} in {} ms", tableToClone, name, System.currentTimeMillis() - startTime); } } }
public class class_name { public String getInputBody() { if (m_requestEntity.length == 0 || !m_bEntityCompressed) { return Utils.toString(m_requestEntity); } else { try { return Utils.toString(Utils.decompressGZIP(m_requestEntity)); } catch (IOException e) { throw new IllegalArgumentException("Error decompressing input: " + e.toString()); } } } }
public class class_name { public String getInputBody() { if (m_requestEntity.length == 0 || !m_bEntityCompressed) { return Utils.toString(m_requestEntity); // depends on control dependency: [if], data = [none] } else { try { return Utils.toString(Utils.decompressGZIP(m_requestEntity)); // depends on control dependency: [try], data = [none] } catch (IOException e) { throw new IllegalArgumentException("Error decompressing input: " + e.toString()); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { public static <T> Collection<T> filter(Collection<T> data, Filter<T> filter) { if (!Utils.isEmpty(data)) { Iterator<T> iterator = data.iterator(); while (iterator.hasNext()) { T item = iterator.next(); if (!filter.accept(item)) { iterator.remove(); } } } return data; } }
public class class_name { public static <T> Collection<T> filter(Collection<T> data, Filter<T> filter) { if (!Utils.isEmpty(data)) { Iterator<T> iterator = data.iterator(); while (iterator.hasNext()) { T item = iterator.next(); if (!filter.accept(item)) { iterator.remove(); // depends on control dependency: [if], data = [none] } } } return data; } }
public class class_name { protected String determineTargetUrl(HttpServletRequest request, HttpServletResponse response) { if (isAlwaysUseDefaultTargetUrl()) { return defaultTargetUrl; } // Check for the parameter and use that if available String targetUrl = null; if (targetUrlParameter != null) { targetUrl = request.getParameter(targetUrlParameter); if (StringUtils.hasText(targetUrl)) { logger.debug("Found targetUrlParameter in request: " + targetUrl); return targetUrl; } } if (useReferer && !StringUtils.hasLength(targetUrl)) { targetUrl = request.getHeader("Referer"); logger.debug("Using Referer header: " + targetUrl); } if (!StringUtils.hasText(targetUrl)) { targetUrl = defaultTargetUrl; logger.debug("Using default Url: " + targetUrl); } return targetUrl; } }
public class class_name { protected String determineTargetUrl(HttpServletRequest request, HttpServletResponse response) { if (isAlwaysUseDefaultTargetUrl()) { return defaultTargetUrl; // depends on control dependency: [if], data = [none] } // Check for the parameter and use that if available String targetUrl = null; if (targetUrlParameter != null) { targetUrl = request.getParameter(targetUrlParameter); // depends on control dependency: [if], data = [(targetUrlParameter] if (StringUtils.hasText(targetUrl)) { logger.debug("Found targetUrlParameter in request: " + targetUrl); // depends on control dependency: [if], data = [none] return targetUrl; // depends on control dependency: [if], data = [none] } } if (useReferer && !StringUtils.hasLength(targetUrl)) { targetUrl = request.getHeader("Referer"); // depends on control dependency: [if], data = [none] logger.debug("Using Referer header: " + targetUrl); // depends on control dependency: [if], data = [none] } if (!StringUtils.hasText(targetUrl)) { targetUrl = defaultTargetUrl; // depends on control dependency: [if], data = [none] logger.debug("Using default Url: " + targetUrl); // depends on control dependency: [if], data = [none] } return targetUrl; } }
public class class_name { public int getWidthWeight() { int ret = 1; if (!isFixedWidth() && hasProperty(UIFormFieldProperty.WIDTH)) { ret = Integer.valueOf(getProperty(UIFormFieldProperty.WIDTH)); } return ret; } }
public class class_name { public int getWidthWeight() { int ret = 1; if (!isFixedWidth() && hasProperty(UIFormFieldProperty.WIDTH)) { ret = Integer.valueOf(getProperty(UIFormFieldProperty.WIDTH)); // depends on control dependency: [if], data = [none] } return ret; } }
public class class_name { public static void byteBufferToOutputStream(ByteBuffer in, OutputStream out) throws IOException { final int BUF_SIZE = 8192; if (in.hasArray()) { out.write(in.array(), in.arrayOffset() + in.position(), in.remaining()); } else { final byte[] b = new byte[Math.min(in.remaining(), BUF_SIZE)]; while (in.remaining() > 0) { int bytesToRead = Math.min(in.remaining(), BUF_SIZE); in.get(b, 0, bytesToRead); out.write(b, 0, bytesToRead); } } } }
public class class_name { public static void byteBufferToOutputStream(ByteBuffer in, OutputStream out) throws IOException { final int BUF_SIZE = 8192; if (in.hasArray()) { out.write(in.array(), in.arrayOffset() + in.position(), in.remaining()); } else { final byte[] b = new byte[Math.min(in.remaining(), BUF_SIZE)]; while (in.remaining() > 0) { int bytesToRead = Math.min(in.remaining(), BUF_SIZE); in.get(b, 0, bytesToRead); // depends on control dependency: [while], data = [none] out.write(b, 0, bytesToRead); // depends on control dependency: [while], data = [none] } } } }
public class class_name { public int delete(CMALocale locale) { final String id = getResourceIdOrThrow(locale, "locale"); final String spaceId = getSpaceIdOrThrow(locale, "locale"); final String environmentId = locale.getEnvironmentId(); final CMASystem sys = locale.getSystem(); locale.setSystem(null); try { final Response<Void> response = service.delete(spaceId, environmentId, id).blockingFirst(); return response.code(); } finally { locale.setSystem(sys); } } }
public class class_name { public int delete(CMALocale locale) { final String id = getResourceIdOrThrow(locale, "locale"); final String spaceId = getSpaceIdOrThrow(locale, "locale"); final String environmentId = locale.getEnvironmentId(); final CMASystem sys = locale.getSystem(); locale.setSystem(null); try { final Response<Void> response = service.delete(spaceId, environmentId, id).blockingFirst(); return response.code(); // depends on control dependency: [try], data = [none] } finally { locale.setSystem(sys); } } }
public class class_name { @Override public ODocument toStream() { document.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING); try { serializeToStream(); } finally { document.setInternalStatus(ORecordElement.STATUS.LOADED); } return document; } }
public class class_name { @Override public ODocument toStream() { document.setInternalStatus(ORecordElement.STATUS.UNMARSHALLING); try { serializeToStream(); // depends on control dependency: [try], data = [none] } finally { document.setInternalStatus(ORecordElement.STATUS.LOADED); } return document; } }
public class class_name { @TaskAction public void stopAction() { DevServer server = devServers.newDevAppServer(CloudSdkOperations.getDefaultHandler(getLogger())); try { server.stop(runConfig.toStopConfiguration()); } catch (AppEngineException ex) { getLogger().error("Failed to stop server: " + ex.getMessage()); } } }
public class class_name { @TaskAction public void stopAction() { DevServer server = devServers.newDevAppServer(CloudSdkOperations.getDefaultHandler(getLogger())); try { server.stop(runConfig.toStopConfiguration()); // depends on control dependency: [try], data = [none] } catch (AppEngineException ex) { getLogger().error("Failed to stop server: " + ex.getMessage()); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public CreateDevicePoolRequest withRules(Rule... rules) { if (this.rules == null) { setRules(new java.util.ArrayList<Rule>(rules.length)); } for (Rule ele : rules) { this.rules.add(ele); } return this; } }
public class class_name { public CreateDevicePoolRequest withRules(Rule... rules) { if (this.rules == null) { setRules(new java.util.ArrayList<Rule>(rules.length)); // depends on control dependency: [if], data = [none] } for (Rule ele : rules) { this.rules.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private void addUserRolesLimitCriteria( QueryWhere queryWhere, String userId, List<String> groupIds ) { List<QueryCriteria> newBaseCriteriaList = new ArrayList<QueryCriteria>(2); // user role limiting criteria QueryCriteria userRolesLimitingCriteria = new QueryCriteria( QueryParameterIdentifiers.TASK_USER_ROLES_LIMIT_LIST, false, QueryCriteriaType.NORMAL, 2); userRolesLimitingCriteria.setFirst(true); userRolesLimitingCriteria.getValues().add(userId); userRolesLimitingCriteria.getValues().add(groupIds); newBaseCriteriaList.add(userRolesLimitingCriteria); // original criteria list in a new group if( ! queryWhere.getCriteria().isEmpty() ) { QueryCriteria originalBaseCriteriaGroup = new QueryCriteria(false); originalBaseCriteriaGroup.setCriteria(queryWhere.getCriteria()); newBaseCriteriaList.add(originalBaseCriteriaGroup); } queryWhere.setCriteria(newBaseCriteriaList); } }
public class class_name { private void addUserRolesLimitCriteria( QueryWhere queryWhere, String userId, List<String> groupIds ) { List<QueryCriteria> newBaseCriteriaList = new ArrayList<QueryCriteria>(2); // user role limiting criteria QueryCriteria userRolesLimitingCriteria = new QueryCriteria( QueryParameterIdentifiers.TASK_USER_ROLES_LIMIT_LIST, false, QueryCriteriaType.NORMAL, 2); userRolesLimitingCriteria.setFirst(true); userRolesLimitingCriteria.getValues().add(userId); userRolesLimitingCriteria.getValues().add(groupIds); newBaseCriteriaList.add(userRolesLimitingCriteria); // original criteria list in a new group if( ! queryWhere.getCriteria().isEmpty() ) { QueryCriteria originalBaseCriteriaGroup = new QueryCriteria(false); originalBaseCriteriaGroup.setCriteria(queryWhere.getCriteria()); // depends on control dependency: [if], data = [none] newBaseCriteriaList.add(originalBaseCriteriaGroup); // depends on control dependency: [if], data = [none] } queryWhere.setCriteria(newBaseCriteriaList); } }
public class class_name { @NonNull protected List<LayoutHelper> transformCards(@Nullable List<L> cards, final @NonNull List<C> data, @NonNull List<Pair<Range<Integer>, L>> rangeCards) { if (cards == null || cards.size() == 0) { return new LinkedList<>(); } int lastPos = data.size(); List<LayoutHelper> helpers = new ArrayList<>(cards.size()); for (int i = 0, size = cards.size(); i < size; i++) { L card = cards.get(i); if (card == null) continue; final String ctype = getCardStringType(card); List<C> items = getItems(card); if (items == null) { // skip card null continue; } data.addAll(items); // calculate offset to set ranges int offset = lastPos; lastPos += items.size(); // include [x, x) for empty range, upper are not included in range rangeCards.add(Pair.create(Range.create(offset, lastPos), card)); // get layoutHelper for this card LayoutBinder<L> binder = mCardBinderResolver.create(ctype); LayoutHelper helper = binder.getHelper(ctype, card); if (helper != null) { helper.setItemCount(items.size()); helpers.add(helper); } } return helpers; } }
public class class_name { @NonNull protected List<LayoutHelper> transformCards(@Nullable List<L> cards, final @NonNull List<C> data, @NonNull List<Pair<Range<Integer>, L>> rangeCards) { if (cards == null || cards.size() == 0) { return new LinkedList<>(); // depends on control dependency: [if], data = [none] } int lastPos = data.size(); List<LayoutHelper> helpers = new ArrayList<>(cards.size()); for (int i = 0, size = cards.size(); i < size; i++) { L card = cards.get(i); if (card == null) continue; final String ctype = getCardStringType(card); List<C> items = getItems(card); if (items == null) { // skip card null continue; } data.addAll(items); // depends on control dependency: [for], data = [none] // calculate offset to set ranges int offset = lastPos; lastPos += items.size(); // depends on control dependency: [for], data = [none] // include [x, x) for empty range, upper are not included in range rangeCards.add(Pair.create(Range.create(offset, lastPos), card)); // depends on control dependency: [for], data = [none] // get layoutHelper for this card LayoutBinder<L> binder = mCardBinderResolver.create(ctype); LayoutHelper helper = binder.getHelper(ctype, card); if (helper != null) { helper.setItemCount(items.size()); // depends on control dependency: [if], data = [none] helpers.add(helper); // depends on control dependency: [if], data = [(helper] } } return helpers; } }
public class class_name { public static Type createInstance(String name, int min, int max) { // Ensure that min is less than or equal to max. if (min > max) { throw new IllegalArgumentException("'min' must be less than or equal to 'max'."); } synchronized (INT_RANGE_TYPES) { // Add the newly created type to the map of all types. IntRangeType newType = new IntRangeType(name, min, max); // Ensure that the named type does not already exist, unless it has an identical definition already, in which // case the old definition can be re-used and the new one discarded. IntRangeType oldType = INT_RANGE_TYPES.get(name); if ((oldType != null) && !oldType.equals(newType)) { throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined."); } else if ((oldType != null) && oldType.equals(newType)) { return oldType; } else { INT_RANGE_TYPES.put(name, newType); return newType; } } } }
public class class_name { public static Type createInstance(String name, int min, int max) { // Ensure that min is less than or equal to max. if (min > max) { throw new IllegalArgumentException("'min' must be less than or equal to 'max'."); } synchronized (INT_RANGE_TYPES) { // Add the newly created type to the map of all types. IntRangeType newType = new IntRangeType(name, min, max); // Ensure that the named type does not already exist, unless it has an identical definition already, in which // case the old definition can be re-used and the new one discarded. IntRangeType oldType = INT_RANGE_TYPES.get(name); if ((oldType != null) && !oldType.equals(newType)) { throw new IllegalArgumentException("The type '" + name + "' already exists and cannot be redefined."); } else if ((oldType != null) && oldType.equals(newType)) { return oldType; // depends on control dependency: [if], data = [none] } else { INT_RANGE_TYPES.put(name, newType); // depends on control dependency: [if], data = [none] return newType; // depends on control dependency: [if], data = [none] } } } }
public class class_name { void resize(int size, byte value) { if (size > _capacity) { resizeBuf(size); } while (_size < size) { _buf[_size++] = value; } } }
public class class_name { void resize(int size, byte value) { if (size > _capacity) { resizeBuf(size); // depends on control dependency: [if], data = [(size] } while (_size < size) { _buf[_size++] = value; // depends on control dependency: [while], data = [none] } } }
public class class_name { public static <T> String toJson(T obj) { StringWriter writer = new StringWriter(); String jsonStr = ""; JsonGenerator gen = null; try { gen = getJsonFactory().createGenerator(writer); getMapper().writeValue(gen, obj); writer.flush(); jsonStr = writer.toString(); } catch (IOException e) { log.error("{}", e.getMessage(), e); } finally { if (gen != null) { try { gen.close(); } catch (IOException e) { } } } return jsonStr; } }
public class class_name { public static <T> String toJson(T obj) { StringWriter writer = new StringWriter(); String jsonStr = ""; JsonGenerator gen = null; try { gen = getJsonFactory().createGenerator(writer); // depends on control dependency: [try], data = [none] getMapper().writeValue(gen, obj); // depends on control dependency: [try], data = [none] writer.flush(); // depends on control dependency: [try], data = [none] jsonStr = writer.toString(); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.error("{}", e.getMessage(), e); } finally { // depends on control dependency: [catch], data = [none] if (gen != null) { try { gen.close(); // depends on control dependency: [try], data = [none] } catch (IOException e) { } // depends on control dependency: [catch], data = [none] } } return jsonStr; } }
public class class_name { public void debug(Object format, Object... msg) { if (logger.isDebugEnabled()) { // check if the first message contains variables variables if (format.toString().contains("{")) { logger.debug(format.toString(), msg); } else { logger.debug(format.toString().concat(" ").concat(JKStringUtil.concat(msg))); } } } }
public class class_name { public void debug(Object format, Object... msg) { if (logger.isDebugEnabled()) { // check if the first message contains variables variables if (format.toString().contains("{")) { logger.debug(format.toString(), msg); // depends on control dependency: [if], data = [none] } else { logger.debug(format.toString().concat(" ").concat(JKStringUtil.concat(msg))); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Object createJsonpProvider() { JsonProvider jsonProvider = AccessController.doPrivileged(new PrivilegedAction<JsonProvider>(){ @Override public JsonProvider run() { try { Bundle b = FrameworkUtil.getBundle(ProviderFactory.class); if(b != null) { BundleContext bc = b.getBundleContext(); ServiceReference<JsonProvider> sr = bc.getServiceReference(JsonProvider.class); return (JsonProvider)bc.getService(sr); } } catch (NoClassDefFoundError ncdfe) { // ignore - return null } return null; }}); return new JsonPProvider(jsonProvider); } }
public class class_name { public static Object createJsonpProvider() { JsonProvider jsonProvider = AccessController.doPrivileged(new PrivilegedAction<JsonProvider>(){ @Override public JsonProvider run() { try { Bundle b = FrameworkUtil.getBundle(ProviderFactory.class); if(b != null) { BundleContext bc = b.getBundleContext(); ServiceReference<JsonProvider> sr = bc.getServiceReference(JsonProvider.class); return (JsonProvider)bc.getService(sr); // depends on control dependency: [if], data = [none] } } catch (NoClassDefFoundError ncdfe) { // ignore - return null } // depends on control dependency: [catch], data = [none] return null; }}); return new JsonPProvider(jsonProvider); } }
public class class_name { private void notifyMessageReceived(QueueData queueData) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "notifyMessageReceived", queueData); long messageLength = queueData.getMessageLength(); if (trackBytes) { bytesReceivedSinceLastRequestForMsgs += messageLength; } // Update the message arrival time queueData.updateArrivalTime(approxTimeThread.getApproxTime()); messagesReceived++; currentBytesOnQueue += messageLength; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "notifyMessageReceived"); } }
public class class_name { private void notifyMessageReceived(QueueData queueData) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "notifyMessageReceived", queueData); long messageLength = queueData.getMessageLength(); if (trackBytes) { bytesReceivedSinceLastRequestForMsgs += messageLength; // depends on control dependency: [if], data = [none] } // Update the message arrival time queueData.updateArrivalTime(approxTimeThread.getApproxTime()); messagesReceived++; currentBytesOnQueue += messageLength; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "notifyMessageReceived"); } }
public class class_name { public Object parsePropertyValue(Element ele, BeanDefinition bd, String propertyName) { String elementName = (propertyName != null) ? "<property> element for property '" + propertyName + "'" : "<constructor-arg> element"; // Should only have one child element: ref, value, list, etc. NodeList nl = ele.getChildNodes(); Element subElement = null; for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element && !nodeNameEquals(node, DESCRIPTION_ELEMENT) && !nodeNameEquals(node, META_ELEMENT)) { // Child element is what we're looking for. if (subElement != null) error(elementName + " must not contain more than one sub-element", ele); else subElement = (Element) node; } } boolean hasRefAttribute = ele.hasAttribute(REF_ATTRIBUTE); boolean hasValueAttribute = ele.hasAttribute(VALUE_ATTRIBUTE); if ((hasRefAttribute && hasValueAttribute) || ((hasRefAttribute || hasValueAttribute) && subElement != null)) { error( elementName + " is only allowed to contain either 'ref' attribute OR 'value' attribute OR sub-element", ele); } if (hasRefAttribute) { String refName = ele.getAttribute(REF_ATTRIBUTE); if (!StringUtils.hasText(refName)) error(elementName + " contains empty 'ref' attribute", ele); RuntimeBeanReference ref = new RuntimeBeanReference(refName); ref.setSource(extractSource(ele)); return ref; } else if (hasValueAttribute) { TypedStringValue valueHolder = new TypedStringValue(ele.getAttribute(VALUE_ATTRIBUTE)); valueHolder.setSource(extractSource(ele)); return valueHolder; } else if (subElement != null) { return parsePropertySubElement(subElement, bd); } else { // Neither child element nor "ref" or "value" attribute found. error(elementName + " must specify a ref or value", ele); return null; } } }
public class class_name { public Object parsePropertyValue(Element ele, BeanDefinition bd, String propertyName) { String elementName = (propertyName != null) ? "<property> element for property '" + propertyName + "'" : "<constructor-arg> element"; // Should only have one child element: ref, value, list, etc. NodeList nl = ele.getChildNodes(); Element subElement = null; for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element && !nodeNameEquals(node, DESCRIPTION_ELEMENT) && !nodeNameEquals(node, META_ELEMENT)) { // Child element is what we're looking for. if (subElement != null) error(elementName + " must not contain more than one sub-element", ele); else subElement = (Element) node; } } boolean hasRefAttribute = ele.hasAttribute(REF_ATTRIBUTE); boolean hasValueAttribute = ele.hasAttribute(VALUE_ATTRIBUTE); if ((hasRefAttribute && hasValueAttribute) || ((hasRefAttribute || hasValueAttribute) && subElement != null)) { error( elementName + " is only allowed to contain either 'ref' attribute OR 'value' attribute OR sub-element", ele); // depends on control dependency: [if], data = [none] } if (hasRefAttribute) { String refName = ele.getAttribute(REF_ATTRIBUTE); if (!StringUtils.hasText(refName)) error(elementName + " contains empty 'ref' attribute", ele); RuntimeBeanReference ref = new RuntimeBeanReference(refName); ref.setSource(extractSource(ele)); // depends on control dependency: [if], data = [none] return ref; // depends on control dependency: [if], data = [none] } else if (hasValueAttribute) { TypedStringValue valueHolder = new TypedStringValue(ele.getAttribute(VALUE_ATTRIBUTE)); valueHolder.setSource(extractSource(ele)); // depends on control dependency: [if], data = [none] return valueHolder; // depends on control dependency: [if], data = [none] } else if (subElement != null) { return parsePropertySubElement(subElement, bd); // depends on control dependency: [if], data = [(subElement] } else { // Neither child element nor "ref" or "value" attribute found. error(elementName + " must specify a ref or value", ele); // depends on control dependency: [if], data = [none] return null; // depends on control dependency: [if], data = [none] } } }
public class class_name { private Optional<Icon> getSplash(String splashHash) { if (splashHash == null) { return Optional.empty(); } try { return Optional.of(new IconImpl(getApi(), new URL("https://cdn.discordapp.com/splashs/" + getServer().getIdAsString() + "/" + splashHash + ".png"))); } catch (MalformedURLException e) { logger.warn("Seems like the url of the splash is malformed! Please contact the developer!", e); return Optional.empty(); } } }
public class class_name { private Optional<Icon> getSplash(String splashHash) { if (splashHash == null) { return Optional.empty(); // depends on control dependency: [if], data = [none] } try { return Optional.of(new IconImpl(getApi(), new URL("https://cdn.discordapp.com/splashs/" + getServer().getIdAsString() + "/" + splashHash + ".png"))); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { logger.warn("Seems like the url of the splash is malformed! Please contact the developer!", e); return Optional.empty(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static List<ModelServiceInstance> filter(ServiceInstanceQuery query, List<ModelServiceInstance> list) { if (list == null || list.size() == 0) { return Collections.emptyList(); } List<QueryCriterion> criteria = query.getCriteria(); if (criteria == null || criteria.size() == 0) { return list; } List<ModelServiceInstance> instances = new ArrayList<ModelServiceInstance>(); for (ModelServiceInstance instance : list) { boolean passed = true; for (QueryCriterion criterion : criteria) { if (criterion.isMatch(instance.getMetadata()) == false) { passed = false; break; } } if (passed) { instances.add(instance); } } return instances; } }
public class class_name { public static List<ModelServiceInstance> filter(ServiceInstanceQuery query, List<ModelServiceInstance> list) { if (list == null || list.size() == 0) { return Collections.emptyList(); // depends on control dependency: [if], data = [none] } List<QueryCriterion> criteria = query.getCriteria(); if (criteria == null || criteria.size() == 0) { return list; // depends on control dependency: [if], data = [none] } List<ModelServiceInstance> instances = new ArrayList<ModelServiceInstance>(); for (ModelServiceInstance instance : list) { boolean passed = true; for (QueryCriterion criterion : criteria) { if (criterion.isMatch(instance.getMetadata()) == false) { passed = false; // depends on control dependency: [if], data = [none] break; } } if (passed) { instances.add(instance); // depends on control dependency: [if], data = [none] } } return instances; } }
public class class_name { public UnicodeSet complement() { checkFrozen(); if (list[0] == LOW) { System.arraycopy(list, 1, list, 0, len-1); --len; } else { ensureCapacity(len+1); System.arraycopy(list, 0, list, 1, len); list[0] = LOW; ++len; } pat = null; return this; } }
public class class_name { public UnicodeSet complement() { checkFrozen(); if (list[0] == LOW) { System.arraycopy(list, 1, list, 0, len-1); // depends on control dependency: [if], data = [none] --len; // depends on control dependency: [if], data = [none] } else { ensureCapacity(len+1); // depends on control dependency: [if], data = [none] System.arraycopy(list, 0, list, 1, len); // depends on control dependency: [if], data = [none] list[0] = LOW; // depends on control dependency: [if], data = [none] ++len; // depends on control dependency: [if], data = [none] } pat = null; return this; } }
public class class_name { private void clearArt(DeviceAnnouncement announcement) { final int player = announcement.getNumber(); // Iterate over a copy to avoid concurrent modification issues for (DeckReference deck : new HashSet<DeckReference>(hotCache.keySet())) { if (deck.player == player) { hotCache.remove(deck); if (deck.hotCue == 0) { deliverAlbumArtUpdate(player, null); // Inform listeners that the artwork is gone. } } } // Again iterate over a copy to avoid concurrent modification issues for (DataReference art : new HashSet<DataReference>(artCache.keySet())) { if (art.player == player) { artCache.remove(art); } } } }
public class class_name { private void clearArt(DeviceAnnouncement announcement) { final int player = announcement.getNumber(); // Iterate over a copy to avoid concurrent modification issues for (DeckReference deck : new HashSet<DeckReference>(hotCache.keySet())) { if (deck.player == player) { hotCache.remove(deck); // depends on control dependency: [if], data = [none] if (deck.hotCue == 0) { deliverAlbumArtUpdate(player, null); // Inform listeners that the artwork is gone. // depends on control dependency: [if], data = [none] } } } // Again iterate over a copy to avoid concurrent modification issues for (DataReference art : new HashSet<DataReference>(artCache.keySet())) { if (art.player == player) { artCache.remove(art); // depends on control dependency: [if], data = [none] } } } }
public class class_name { @DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{alertId}") @Description("Deletes the alert having the given ID along with all its triggers and notifications.") public Response deleteAlert(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId) { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Alert alert = alertService.findAlertByPrimaryKey(alertId); if (alert != null) { validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req)); alertService.markAlertForDeletion(alert); return Response.status(Status.OK).build(); } throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } }
public class class_name { @DELETE @Produces(MediaType.APPLICATION_JSON) @Path("/{alertId}") @Description("Deletes the alert having the given ID along with all its triggers and notifications.") public Response deleteAlert(@Context HttpServletRequest req, @PathParam("alertId") BigInteger alertId) { if (alertId == null || alertId.compareTo(BigInteger.ZERO) < 1) { throw new WebApplicationException("Alert Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST); } Alert alert = alertService.findAlertByPrimaryKey(alertId); if (alert != null) { validateResourceAuthorization(req, alert.getOwner(), getRemoteUser(req)); // depends on control dependency: [if], data = [none] alertService.markAlertForDeletion(alert); // depends on control dependency: [if], data = [(alert] return Response.status(Status.OK).build(); // depends on control dependency: [if], data = [none] } throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND); } }
public class class_name { @Override public Collection<ConfigAttribute> getAllConfigAttributes() { Set<ConfigAttribute> allAttributes = new HashSet<>(); for (List<ConfigAttribute> attributeList : methodMap.values()) { allAttributes.addAll(attributeList); } return allAttributes; } }
public class class_name { @Override public Collection<ConfigAttribute> getAllConfigAttributes() { Set<ConfigAttribute> allAttributes = new HashSet<>(); for (List<ConfigAttribute> attributeList : methodMap.values()) { allAttributes.addAll(attributeList); // depends on control dependency: [for], data = [attributeList] } return allAttributes; } }
public class class_name { @Override public Authentication doLogin(Authentication authentication) { Authentication result = null; try { result = getAuthenticationManager().authenticate(authentication); } catch (AuthenticationException e) { logger.info("authentication failed: " + e.getMessage()); // Fire application event to advise of failed login getApplicationConfig().applicationContext().publishEvent(new AuthenticationFailedEvent( authentication, e)); // rethrow the exception throw e; } // Handle success or failure of the authentication attempt if (logger.isDebugEnabled()) { logger.debug("successful login - update context holder and fire event"); } // Commit the successful Authentication object to the secure // ContextHolder SecurityContextHolder.getContext().setAuthentication(result); setAuthentication(result); // Fire application events to advise of new login getApplicationConfig().applicationContext().publishEvent(new AuthenticationEvent(result)); getApplicationConfig().applicationContext().publishEvent(new LoginEvent(result)); return result; } }
public class class_name { @Override public Authentication doLogin(Authentication authentication) { Authentication result = null; try { result = getAuthenticationManager().authenticate(authentication); // depends on control dependency: [try], data = [none] } catch (AuthenticationException e) { logger.info("authentication failed: " + e.getMessage()); // Fire application event to advise of failed login getApplicationConfig().applicationContext().publishEvent(new AuthenticationFailedEvent( authentication, e)); // rethrow the exception throw e; } // depends on control dependency: [catch], data = [none] // Handle success or failure of the authentication attempt if (logger.isDebugEnabled()) { logger.debug("successful login - update context holder and fire event"); // depends on control dependency: [if], data = [none] } // Commit the successful Authentication object to the secure // ContextHolder SecurityContextHolder.getContext().setAuthentication(result); setAuthentication(result); // Fire application events to advise of new login getApplicationConfig().applicationContext().publishEvent(new AuthenticationEvent(result)); getApplicationConfig().applicationContext().publishEvent(new LoginEvent(result)); return result; } }
public class class_name { public void handleValueChange(int valueIndex, String value) { changeEntityValue(value, valueIndex); CmsUndoRedoHandler handler = CmsUndoRedoHandler.getInstance(); if (handler.isIntitalized()) { handler.addChange(m_entity.getId(), m_attributeName, valueIndex, ChangeType.value); } } }
public class class_name { public void handleValueChange(int valueIndex, String value) { changeEntityValue(value, valueIndex); CmsUndoRedoHandler handler = CmsUndoRedoHandler.getInstance(); if (handler.isIntitalized()) { handler.addChange(m_entity.getId(), m_attributeName, valueIndex, ChangeType.value); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void parseRules(String description) { // (the number of elements in the description list isn't necessarily // the number of rules-- some descriptions may expend into two rules) List<NFRule> tempRules = new ArrayList<NFRule>(); // we keep track of the rule before the one we're currently working // on solely to support >>> substitutions NFRule predecessor = null; // Iterate through the rules. The rules // are separated by semicolons (there's no escape facility: ALL // semicolons are rule delimiters) int oldP = 0; int descriptionLen = description.length(); int p; do { p = description.indexOf(';', oldP); if (p < 0) { p = descriptionLen; } // makeRules (a factory method on NFRule) will return either // a single rule or an array of rules. Either way, add them // to our rule vector NFRule.makeRules(description.substring(oldP, p), this, predecessor, owner, tempRules); if (!tempRules.isEmpty()) { predecessor = tempRules.get(tempRules.size() - 1); } oldP = p + 1; } while (oldP < descriptionLen); // for rules that didn't specify a base value, their base values // were initialized to 0. Make another pass through the list and // set all those rules' base values. We also remove any special // rules from the list and put them into their own member variables long defaultBaseValue = 0; for (NFRule rule : tempRules) { long baseValue = rule.getBaseValue(); if (baseValue == 0) { // if the rule's base value is 0, fill in a default // base value (this will be 1 plus the preceding // rule's base value for regular rule sets, and the // same as the preceding rule's base value in fraction // rule sets) rule.setBaseValue(defaultBaseValue); } else { // if it's a regular rule that already knows its base value, // check to make sure the rules are in order, and update // the default base value for the next rule if (baseValue < defaultBaseValue) { throw new IllegalArgumentException("Rules are not in order, base: " + baseValue + " < " + defaultBaseValue); } defaultBaseValue = baseValue; } if (!isFractionRuleSet) { ++defaultBaseValue; } } // finally, we can copy the rules from the vector into a // fixed-length array rules = new NFRule[tempRules.size()]; tempRules.toArray(rules); } }
public class class_name { public void parseRules(String description) { // (the number of elements in the description list isn't necessarily // the number of rules-- some descriptions may expend into two rules) List<NFRule> tempRules = new ArrayList<NFRule>(); // we keep track of the rule before the one we're currently working // on solely to support >>> substitutions NFRule predecessor = null; // Iterate through the rules. The rules // are separated by semicolons (there's no escape facility: ALL // semicolons are rule delimiters) int oldP = 0; int descriptionLen = description.length(); int p; do { p = description.indexOf(';', oldP); if (p < 0) { p = descriptionLen; // depends on control dependency: [if], data = [none] } // makeRules (a factory method on NFRule) will return either // a single rule or an array of rules. Either way, add them // to our rule vector NFRule.makeRules(description.substring(oldP, p), this, predecessor, owner, tempRules); if (!tempRules.isEmpty()) { predecessor = tempRules.get(tempRules.size() - 1); // depends on control dependency: [if], data = [none] } oldP = p + 1; } while (oldP < descriptionLen); // for rules that didn't specify a base value, their base values // were initialized to 0. Make another pass through the list and // set all those rules' base values. We also remove any special // rules from the list and put them into their own member variables long defaultBaseValue = 0; for (NFRule rule : tempRules) { long baseValue = rule.getBaseValue(); if (baseValue == 0) { // if the rule's base value is 0, fill in a default // base value (this will be 1 plus the preceding // rule's base value for regular rule sets, and the // same as the preceding rule's base value in fraction // rule sets) rule.setBaseValue(defaultBaseValue); // depends on control dependency: [if], data = [none] } else { // if it's a regular rule that already knows its base value, // check to make sure the rules are in order, and update // the default base value for the next rule if (baseValue < defaultBaseValue) { throw new IllegalArgumentException("Rules are not in order, base: " + baseValue + " < " + defaultBaseValue); } defaultBaseValue = baseValue; // depends on control dependency: [if], data = [none] } if (!isFractionRuleSet) { ++defaultBaseValue; // depends on control dependency: [if], data = [none] } } // finally, we can copy the rules from the vector into a // fixed-length array rules = new NFRule[tempRules.size()]; tempRules.toArray(rules); } }
public class class_name { public void marshall(ListObjectParentPathsRequest listObjectParentPathsRequest, ProtocolMarshaller protocolMarshaller) { if (listObjectParentPathsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listObjectParentPathsRequest.getDirectoryArn(), DIRECTORYARN_BINDING); protocolMarshaller.marshall(listObjectParentPathsRequest.getObjectReference(), OBJECTREFERENCE_BINDING); protocolMarshaller.marshall(listObjectParentPathsRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listObjectParentPathsRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListObjectParentPathsRequest listObjectParentPathsRequest, ProtocolMarshaller protocolMarshaller) { if (listObjectParentPathsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listObjectParentPathsRequest.getDirectoryArn(), DIRECTORYARN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listObjectParentPathsRequest.getObjectReference(), OBJECTREFERENCE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listObjectParentPathsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listObjectParentPathsRequest.getMaxResults(), MAXRESULTS_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 void setDatasourceParams(JdbcDatabase database, com.mysql.jdbc.jdbc2.optional.MysqlDataSource dataSource) { String strURL = database.getProperty(SQLParams.JDBC_URL_PARAM); if ((strURL == null) || (strURL.length() == 0)) strURL = database.getProperty(SQLParams.DEFAULT_JDBC_URL_PARAM); // Default String strServer = database.getProperty(SQLParams.DB_SERVER_PARAM); if ((strServer == null) || (strServer.length() == 0)) strServer = database.getProperty(SQLParams.DEFAULT_DB_SERVER_PARAM); // Default if ((strServer == null) || (strServer.length() == 0)) strServer = "localhost"; //this.getProperty(DBParams.SERVER); // ?? String strDatabaseName = database.getDatabaseName(true); if (strURL != null) { if (strServer != null) strURL = Utility.replace(strURL, "{dbserver}", strServer); strURL = Utility.replace(strURL, "{dbname}", strDatabaseName); } String strUsername = database.getProperty(SQLParams.USERNAME_PARAM); if ((strUsername == null) || (strUsername.length() == 0)) strUsername = database.getProperty(SQLParams.DEFAULT_USERNAME_PARAM); // Default String strPassword = database.getProperty(SQLParams.PASSWORD_PARAM); if ((strPassword == null) || (strPassword.length() == 0)) strPassword = database.getProperty(SQLParams.DEFAULT_PASSWORD_PARAM); // Default dataSource.setDatabaseName(strDatabaseName); if (strServer != null) dataSource.setServerName(strServer); else dataSource.setURL(strURL); dataSource.setUser (strUsername); dataSource.setPassword (strPassword); } }
public class class_name { public void setDatasourceParams(JdbcDatabase database, com.mysql.jdbc.jdbc2.optional.MysqlDataSource dataSource) { String strURL = database.getProperty(SQLParams.JDBC_URL_PARAM); if ((strURL == null) || (strURL.length() == 0)) strURL = database.getProperty(SQLParams.DEFAULT_JDBC_URL_PARAM); // Default String strServer = database.getProperty(SQLParams.DB_SERVER_PARAM); if ((strServer == null) || (strServer.length() == 0)) strServer = database.getProperty(SQLParams.DEFAULT_DB_SERVER_PARAM); // Default if ((strServer == null) || (strServer.length() == 0)) strServer = "localhost"; //this.getProperty(DBParams.SERVER); // ?? String strDatabaseName = database.getDatabaseName(true); if (strURL != null) { if (strServer != null) strURL = Utility.replace(strURL, "{dbserver}", strServer); strURL = Utility.replace(strURL, "{dbname}", strDatabaseName); // depends on control dependency: [if], data = [(strURL] } String strUsername = database.getProperty(SQLParams.USERNAME_PARAM); if ((strUsername == null) || (strUsername.length() == 0)) strUsername = database.getProperty(SQLParams.DEFAULT_USERNAME_PARAM); // Default String strPassword = database.getProperty(SQLParams.PASSWORD_PARAM); if ((strPassword == null) || (strPassword.length() == 0)) strPassword = database.getProperty(SQLParams.DEFAULT_PASSWORD_PARAM); // Default dataSource.setDatabaseName(strDatabaseName); if (strServer != null) dataSource.setServerName(strServer); else dataSource.setURL(strURL); dataSource.setUser (strUsername); dataSource.setPassword (strPassword); } }
public class class_name { @Nullable public static SSLSession findSslSession(@Nullable Channel channel, SessionProtocol sessionProtocol) { if (!sessionProtocol.isTls()) { return null; } return findSslSession(channel); } }
public class class_name { @Nullable public static SSLSession findSslSession(@Nullable Channel channel, SessionProtocol sessionProtocol) { if (!sessionProtocol.isTls()) { return null; // depends on control dependency: [if], data = [none] } return findSslSession(channel); } }
public class class_name { boolean isHorizontalSeparator() { if (isAttribute(Chunk.SEPARATOR)) { Object[] o = (Object[])getAttribute(Chunk.SEPARATOR); return !((Boolean)o[1]).booleanValue(); } return false; } }
public class class_name { boolean isHorizontalSeparator() { if (isAttribute(Chunk.SEPARATOR)) { Object[] o = (Object[])getAttribute(Chunk.SEPARATOR); return !((Boolean)o[1]).booleanValue(); // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { protected void handleSqlCount(ActionRuntime runtime) { final CallbackContext context = CallbackContext.getCallbackContextOnThread(); if (context == null) { return; } final SqlStringFilter filter = context.getSqlStringFilter(); if (filter == null || !(filter instanceof ExecutedSqlCounter)) { return; } final ExecutedSqlCounter counter = ((ExecutedSqlCounter) filter); final int sqlExecutionCountLimit = getSqlExecutionCountLimit(runtime); if (sqlExecutionCountLimit >= 0 && counter.getTotalCountOfSql() > sqlExecutionCountLimit) { // minus means no check here, by-annotation cannot specify it, can only as default limit // if it needs to specify it by-annotation, enough to set large size handleTooManySqlExecution(runtime, counter, sqlExecutionCountLimit); } saveRequestedSqlCount(counter); } }
public class class_name { protected void handleSqlCount(ActionRuntime runtime) { final CallbackContext context = CallbackContext.getCallbackContextOnThread(); if (context == null) { return; // depends on control dependency: [if], data = [none] } final SqlStringFilter filter = context.getSqlStringFilter(); if (filter == null || !(filter instanceof ExecutedSqlCounter)) { return; // depends on control dependency: [if], data = [none] } final ExecutedSqlCounter counter = ((ExecutedSqlCounter) filter); final int sqlExecutionCountLimit = getSqlExecutionCountLimit(runtime); if (sqlExecutionCountLimit >= 0 && counter.getTotalCountOfSql() > sqlExecutionCountLimit) { // minus means no check here, by-annotation cannot specify it, can only as default limit // if it needs to specify it by-annotation, enough to set large size handleTooManySqlExecution(runtime, counter, sqlExecutionCountLimit); // depends on control dependency: [if], data = [none] } saveRequestedSqlCount(counter); } }
public class class_name { @Override @SuppressWarnings("unchecked") public void collectParameters(Object pojo, List<Object> parameters) { F facetValue = getFacetValue(pojo); if (facetValue == null) { parameters.add(nullColumnValue()); } else { parameters.add(toColumnValue(facetValue)); } } }
public class class_name { @Override @SuppressWarnings("unchecked") public void collectParameters(Object pojo, List<Object> parameters) { F facetValue = getFacetValue(pojo); if (facetValue == null) { parameters.add(nullColumnValue()); // depends on control dependency: [if], data = [none] } else { parameters.add(toColumnValue(facetValue)); // depends on control dependency: [if], data = [(facetValue] } } }
public class class_name { public static base_responses update(nitro_service client, nshostname resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nshostname updateresources[] = new nshostname[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nshostname(); updateresources[i].hostname = resources[i].hostname; updateresources[i].ownernode = resources[i].ownernode; } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { public static base_responses update(nitro_service client, nshostname resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { nshostname updateresources[] = new nshostname[resources.length]; for (int i=0;i<resources.length;i++){ updateresources[i] = new nshostname(); // depends on control dependency: [for], data = [i] updateresources[i].hostname = resources[i].hostname; // depends on control dependency: [for], data = [i] updateresources[i].ownernode = resources[i].ownernode; // depends on control dependency: [for], data = [i] } result = update_bulk_request(client, updateresources); } return result; } }
public class class_name { Scroll scroll(String scrollId, ScrollReader reader) throws IOException { InputStream scroll = client.scroll(scrollId); try { return reader.read(scroll); } finally { if (scroll instanceof StatsAware) { stats.aggregate(((StatsAware) scroll).stats()); } } } }
public class class_name { Scroll scroll(String scrollId, ScrollReader reader) throws IOException { InputStream scroll = client.scroll(scrollId); try { return reader.read(scroll); } finally { if (scroll instanceof StatsAware) { stats.aggregate(((StatsAware) scroll).stats()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static void rank1UpdateMultL(DMatrixRMaj A , double u[] , double gamma , int colA0, int w0 , int w1 ) { for( int i = colA0; i < A.numRows; i++ ) { int startIndex = i*A.numCols+w0; double sum = 0; int rowIndex = startIndex; for( int j = w0; j < w1; j++ ) { sum += A.data[rowIndex++]*u[j]; } sum = -gamma*sum; rowIndex = startIndex; for( int j = w0; j < w1; j++ ) { A.data[rowIndex++] += sum*u[j]; } } } }
public class class_name { public static void rank1UpdateMultL(DMatrixRMaj A , double u[] , double gamma , int colA0, int w0 , int w1 ) { for( int i = colA0; i < A.numRows; i++ ) { int startIndex = i*A.numCols+w0; double sum = 0; int rowIndex = startIndex; for( int j = w0; j < w1; j++ ) { sum += A.data[rowIndex++]*u[j]; // depends on control dependency: [for], data = [j] } sum = -gamma*sum; // depends on control dependency: [for], data = [none] rowIndex = startIndex; // depends on control dependency: [for], data = [none] for( int j = w0; j < w1; j++ ) { A.data[rowIndex++] += sum*u[j]; // depends on control dependency: [for], data = [j] } } } }
public class class_name { @Nullable @Override public R findCounterExample(A automaton, Collection<? extends I> inputs, P property) { if (automaton.size() > size) { counterExamples.clear(); } size = automaton.size(); return counterExamples.computeIfAbsent( Pair.of(inputs, property), key -> Optional.ofNullable(modelChecker.findCounterExample(automaton, inputs, property))).orElse(null); } }
public class class_name { @Nullable @Override public R findCounterExample(A automaton, Collection<? extends I> inputs, P property) { if (automaton.size() > size) { counterExamples.clear(); // depends on control dependency: [if], data = [none] } size = automaton.size(); return counterExamples.computeIfAbsent( Pair.of(inputs, property), key -> Optional.ofNullable(modelChecker.findCounterExample(automaton, inputs, property))).orElse(null); } }
public class class_name { public <T> Class<T> isAssignableFrom(final Class<?> superType, final Class<T> type, final String message) { if (!superType.isAssignableFrom(type)) { fail(message); } return type; } }
public class class_name { public <T> Class<T> isAssignableFrom(final Class<?> superType, final Class<T> type, final String message) { if (!superType.isAssignableFrom(type)) { fail(message); // depends on control dependency: [if], data = [none] } return type; } }
public class class_name { private static long lcm(long x, long y) { // binary gcd algorithm from Knuth, "The Art of Computer Programming," // vol. 2, 1st ed., pp. 298-299 long x1 = x; long y1 = y; int p2 = 0; while ((x1 & 1) == 0 && (y1 & 1) == 0) { ++p2; x1 >>= 1; y1 >>= 1; } long t; if ((x1 & 1) == 1) { t = -y1; } else { t = x1; } while (t != 0) { while ((t & 1) == 0) { t >>= 1; } if (t > 0) { x1 = t; } else { y1 = -t; } t = x1 - y1; } long gcd = x1 << p2; // x * y == gcd(x, y) * lcm(x, y) return x / gcd * y; } }
public class class_name { private static long lcm(long x, long y) { // binary gcd algorithm from Knuth, "The Art of Computer Programming," // vol. 2, 1st ed., pp. 298-299 long x1 = x; long y1 = y; int p2 = 0; while ((x1 & 1) == 0 && (y1 & 1) == 0) { ++p2; // depends on control dependency: [while], data = [none] x1 >>= 1; // depends on control dependency: [while], data = [none] y1 >>= 1; // depends on control dependency: [while], data = [none] } long t; if ((x1 & 1) == 1) { t = -y1; // depends on control dependency: [if], data = [none] } else { t = x1; // depends on control dependency: [if], data = [none] } while (t != 0) { while ((t & 1) == 0) { t >>= 1; // depends on control dependency: [while], data = [none] } if (t > 0) { x1 = t; // depends on control dependency: [if], data = [none] } else { y1 = -t; // depends on control dependency: [if], data = [none] } t = x1 - y1; // depends on control dependency: [while], data = [none] } long gcd = x1 << p2; // x * y == gcd(x, y) * lcm(x, y) return x / gcd * y; } }
public class class_name { public void setCycleInterval(float newCycleInterval) { if ( (this.cycleInterval != newCycleInterval) && (newCycleInterval > 0) ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { //TODO Cannot easily change the GVRAnimation's GVRChannel once set. } this.cycleInterval = newCycleInterval; } } }
public class class_name { public void setCycleInterval(float newCycleInterval) { if ( (this.cycleInterval != newCycleInterval) && (newCycleInterval > 0) ) { for (GVRNodeAnimation gvrKeyFrameAnimation : gvrKeyFrameAnimations) { //TODO Cannot easily change the GVRAnimation's GVRChannel once set. } this.cycleInterval = newCycleInterval; // depends on control dependency: [if], data = [none] } } }
public class class_name { public static HostAndPort fromString(String hostPort, int defaultPort) { if (hostPort == null) throw new NullPointerException("hostPort == null"); String host = hostPort; int endHostIndex = hostPort.length(); if (hostPort.startsWith("[")) { // Bracketed IPv6 endHostIndex = hostPort.lastIndexOf(']') + 1; host = hostPort.substring(1, endHostIndex == 0 ? 1 : endHostIndex - 1); if (!Endpoint.newBuilder().parseIp(host)) { // reuse our IPv6 validator throw new IllegalArgumentException(hostPort + " contains an invalid IPv6 literal"); } } else { int colonIndex = hostPort.indexOf(':'), nextColonIndex = hostPort.lastIndexOf(':'); if (colonIndex >= 0) { if (colonIndex == nextColonIndex) { // only 1 colon host = hostPort.substring(0, colonIndex); endHostIndex = colonIndex; } else if (!Endpoint.newBuilder().parseIp(hostPort)) { // reuse our IPv6 validator throw new IllegalArgumentException(hostPort + " is an invalid IPv6 literal"); } } } if (host.isEmpty()) throw new IllegalArgumentException(hostPort + " has an empty host"); if (endHostIndex + 1 < hostPort.length() && hostPort.charAt(endHostIndex) == ':') { return new HostAndPort(host, validatePort(hostPort.substring(endHostIndex + 1), hostPort)); } return new HostAndPort(host, defaultPort); } }
public class class_name { public static HostAndPort fromString(String hostPort, int defaultPort) { if (hostPort == null) throw new NullPointerException("hostPort == null"); String host = hostPort; int endHostIndex = hostPort.length(); if (hostPort.startsWith("[")) { // Bracketed IPv6 endHostIndex = hostPort.lastIndexOf(']') + 1; // depends on control dependency: [if], data = [none] host = hostPort.substring(1, endHostIndex == 0 ? 1 : endHostIndex - 1); // depends on control dependency: [if], data = [none] if (!Endpoint.newBuilder().parseIp(host)) { // reuse our IPv6 validator throw new IllegalArgumentException(hostPort + " contains an invalid IPv6 literal"); } } else { int colonIndex = hostPort.indexOf(':'), nextColonIndex = hostPort.lastIndexOf(':'); if (colonIndex >= 0) { if (colonIndex == nextColonIndex) { // only 1 colon host = hostPort.substring(0, colonIndex); // depends on control dependency: [if], data = [none] endHostIndex = colonIndex; // depends on control dependency: [if], data = [none] } else if (!Endpoint.newBuilder().parseIp(hostPort)) { // reuse our IPv6 validator throw new IllegalArgumentException(hostPort + " is an invalid IPv6 literal"); } } } if (host.isEmpty()) throw new IllegalArgumentException(hostPort + " has an empty host"); if (endHostIndex + 1 < hostPort.length() && hostPort.charAt(endHostIndex) == ':') { return new HostAndPort(host, validatePort(hostPort.substring(endHostIndex + 1), hostPort)); // depends on control dependency: [if], data = [none] } return new HostAndPort(host, defaultPort); } }
public class class_name { public void validate() { synchronized (mSharedMapsLock) { // Compute block lock reference counts based off of lock records ConcurrentMap<Long, AtomicInteger> blockLockReferenceCounts = new ConcurrentHashMap<>(); for (LockRecord record : mLockIdToRecordMap.values()) { blockLockReferenceCounts.putIfAbsent(record.getBlockId(), new AtomicInteger(0)); blockLockReferenceCounts.get(record.getBlockId()).incrementAndGet(); } // Check that the reference count for each block lock matches the lock record counts. for (Entry<Long, ClientRWLock> entry : mLocks.entrySet()) { long blockId = entry.getKey(); ClientRWLock lock = entry.getValue(); Integer recordCount = blockLockReferenceCounts.get(blockId).get(); Integer referenceCount = lock.getReferenceCount(); if (!Objects.equal(recordCount, referenceCount)) { throw new IllegalStateException("There are " + recordCount + " lock records for block" + " id " + blockId + ", but the reference count is " + referenceCount); } } // Check that if a lock id is mapped to by a session id, the lock record for that lock id // contains that session id. for (Entry<Long, Set<Long>> entry : mSessionIdToLockIdsMap.entrySet()) { for (Long lockId : entry.getValue()) { LockRecord record = mLockIdToRecordMap.get(lockId); if (record.getSessionId() != entry.getKey()) { throw new IllegalStateException("The session id map contains lock id " + lockId + "under session id " + entry.getKey() + ", but the record for that lock id (" + record + ")" + " doesn't contain that session id"); } } } } } }
public class class_name { public void validate() { synchronized (mSharedMapsLock) { // Compute block lock reference counts based off of lock records ConcurrentMap<Long, AtomicInteger> blockLockReferenceCounts = new ConcurrentHashMap<>(); for (LockRecord record : mLockIdToRecordMap.values()) { blockLockReferenceCounts.putIfAbsent(record.getBlockId(), new AtomicInteger(0)); // depends on control dependency: [for], data = [record] blockLockReferenceCounts.get(record.getBlockId()).incrementAndGet(); // depends on control dependency: [for], data = [record] } // Check that the reference count for each block lock matches the lock record counts. for (Entry<Long, ClientRWLock> entry : mLocks.entrySet()) { long blockId = entry.getKey(); ClientRWLock lock = entry.getValue(); Integer recordCount = blockLockReferenceCounts.get(blockId).get(); Integer referenceCount = lock.getReferenceCount(); if (!Objects.equal(recordCount, referenceCount)) { throw new IllegalStateException("There are " + recordCount + " lock records for block" + " id " + blockId + ", but the reference count is " + referenceCount); } } // Check that if a lock id is mapped to by a session id, the lock record for that lock id // contains that session id. for (Entry<Long, Set<Long>> entry : mSessionIdToLockIdsMap.entrySet()) { for (Long lockId : entry.getValue()) { LockRecord record = mLockIdToRecordMap.get(lockId); if (record.getSessionId() != entry.getKey()) { throw new IllegalStateException("The session id map contains lock id " + lockId + "under session id " + entry.getKey() + ", but the record for that lock id (" + record + ")" + " doesn't contain that session id"); } } } } } }
public class class_name { public static void setGlobalSplineApproximationRatio(Double distance) { if (distance == null || Double.isNaN(distance.doubleValue())) { globalSplineApproximation = GeomConstants.SPLINE_APPROXIMATION_RATIO; } else { globalSplineApproximation = Math.max(0, distance); } } }
public class class_name { public static void setGlobalSplineApproximationRatio(Double distance) { if (distance == null || Double.isNaN(distance.doubleValue())) { globalSplineApproximation = GeomConstants.SPLINE_APPROXIMATION_RATIO; // depends on control dependency: [if], data = [none] } else { globalSplineApproximation = Math.max(0, distance); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void or(final Roaring64NavigableMap x2) { boolean firstBucket = true; for (Entry<Integer, BitmapDataProvider> e2 : x2.highToBitmap.entrySet()) { // Keep object to prevent auto-boxing Integer high = e2.getKey(); BitmapDataProvider lowBitmap1 = this.highToBitmap.get(high); BitmapDataProvider lowBitmap2 = e2.getValue(); // TODO Reviewers: is it a good idea to rely on BitmapDataProvider except in methods // expecting an actual MutableRoaringBitmap? // TODO This code may lead to closing a buffer Bitmap in current Navigable even if current is // not on buffer if ((lowBitmap1 == null || lowBitmap1 instanceof RoaringBitmap) && lowBitmap2 instanceof RoaringBitmap) { if (lowBitmap1 == null) { // Clone to prevent future modification of this modifying the input Bitmap RoaringBitmap lowBitmap2Clone = ((RoaringBitmap) lowBitmap2).clone(); pushBitmapForHigh(high, lowBitmap2Clone); } else { ((RoaringBitmap) lowBitmap1).or((RoaringBitmap) lowBitmap2); } } else if ((lowBitmap1 == null || lowBitmap1 instanceof MutableRoaringBitmap) && lowBitmap2 instanceof MutableRoaringBitmap) { if (lowBitmap1 == null) { // Clone to prevent future modification of this modifying the input Bitmap BitmapDataProvider lowBitmap2Clone = ((MutableRoaringBitmap) lowBitmap2).clone(); pushBitmapForHigh(high, lowBitmap2Clone); } else { ((MutableRoaringBitmap) lowBitmap1).or((MutableRoaringBitmap) lowBitmap2); } } else { throw new UnsupportedOperationException( ".or is not between " + this.getClass() + " and " + lowBitmap2.getClass()); } if (firstBucket) { firstBucket = false; // Invalidate the lowest high as lowest not valid firstHighNotValid = Math.min(firstHighNotValid, high); allValid = false; } } } }
public class class_name { public void or(final Roaring64NavigableMap x2) { boolean firstBucket = true; for (Entry<Integer, BitmapDataProvider> e2 : x2.highToBitmap.entrySet()) { // Keep object to prevent auto-boxing Integer high = e2.getKey(); BitmapDataProvider lowBitmap1 = this.highToBitmap.get(high); BitmapDataProvider lowBitmap2 = e2.getValue(); // TODO Reviewers: is it a good idea to rely on BitmapDataProvider except in methods // expecting an actual MutableRoaringBitmap? // TODO This code may lead to closing a buffer Bitmap in current Navigable even if current is // not on buffer if ((lowBitmap1 == null || lowBitmap1 instanceof RoaringBitmap) && lowBitmap2 instanceof RoaringBitmap) { if (lowBitmap1 == null) { // Clone to prevent future modification of this modifying the input Bitmap RoaringBitmap lowBitmap2Clone = ((RoaringBitmap) lowBitmap2).clone(); pushBitmapForHigh(high, lowBitmap2Clone); // depends on control dependency: [if], data = [none] } else { ((RoaringBitmap) lowBitmap1).or((RoaringBitmap) lowBitmap2); // depends on control dependency: [if], data = [none] } } else if ((lowBitmap1 == null || lowBitmap1 instanceof MutableRoaringBitmap) && lowBitmap2 instanceof MutableRoaringBitmap) { if (lowBitmap1 == null) { // Clone to prevent future modification of this modifying the input Bitmap BitmapDataProvider lowBitmap2Clone = ((MutableRoaringBitmap) lowBitmap2).clone(); pushBitmapForHigh(high, lowBitmap2Clone); // depends on control dependency: [if], data = [none] } else { ((MutableRoaringBitmap) lowBitmap1).or((MutableRoaringBitmap) lowBitmap2); // depends on control dependency: [if], data = [none] } } else { throw new UnsupportedOperationException( ".or is not between " + this.getClass() + " and " + lowBitmap2.getClass()); } if (firstBucket) { firstBucket = false; // depends on control dependency: [if], data = [none] // Invalidate the lowest high as lowest not valid firstHighNotValid = Math.min(firstHighNotValid, high); // depends on control dependency: [if], data = [none] allValid = false; // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static Set<String> parseServiceSPIExtensionFile(Resource metaInfServicesEntry) { Set<String> serviceClazz = new HashSet<String>(); URL metaInfServicesUrl = metaInfServicesEntry == null ? null : metaInfServicesEntry.getURL(); if (metaInfServicesUrl != null) { InputStream is = null; BufferedReader bfReader = null; InputStreamReader isReader = null; try { is = metaInfServicesUrl.openStream(); bfReader = new BufferedReader(isReader = new InputStreamReader(is, "UTF-8")); String line; while ((line = bfReader.readLine()) != null) { line = line.trim(); if (!line.isEmpty() && !(line.startsWith("#"))) { //just to strip off # int hashPos = line.indexOf("#"); if (hashPos != -1) { line = line.substring(0, hashPos); } serviceClazz.add(line); } } } catch (IOException e) { throw new CDIRuntimeException(e); } finally { try { if (is != null) { is.close(); } if (isReader != null) { isReader.close(); } if (bfReader != null) { bfReader.close(); } } catch (IOException e) { throw new CDIRuntimeException(e); } } } return serviceClazz; } }
public class class_name { public static Set<String> parseServiceSPIExtensionFile(Resource metaInfServicesEntry) { Set<String> serviceClazz = new HashSet<String>(); URL metaInfServicesUrl = metaInfServicesEntry == null ? null : metaInfServicesEntry.getURL(); if (metaInfServicesUrl != null) { InputStream is = null; BufferedReader bfReader = null; InputStreamReader isReader = null; try { is = metaInfServicesUrl.openStream(); // depends on control dependency: [try], data = [none] bfReader = new BufferedReader(isReader = new InputStreamReader(is, "UTF-8")); // depends on control dependency: [try], data = [none] String line; while ((line = bfReader.readLine()) != null) { line = line.trim(); // depends on control dependency: [while], data = [none] if (!line.isEmpty() && !(line.startsWith("#"))) { //just to strip off # int hashPos = line.indexOf("#"); if (hashPos != -1) { line = line.substring(0, hashPos); // depends on control dependency: [if], data = [none] } serviceClazz.add(line); // depends on control dependency: [if], data = [none] } } } catch (IOException e) { throw new CDIRuntimeException(e); } finally { // depends on control dependency: [catch], data = [none] try { if (is != null) { is.close(); // depends on control dependency: [if], data = [none] } if (isReader != null) { isReader.close(); // depends on control dependency: [if], data = [none] } if (bfReader != null) { bfReader.close(); // depends on control dependency: [if], data = [none] } } catch (IOException e) { throw new CDIRuntimeException(e); } // depends on control dependency: [catch], data = [none] } } return serviceClazz; } }
public class class_name { public DescribeTimeBasedAutoScalingResult withTimeBasedAutoScalingConfigurations(TimeBasedAutoScalingConfiguration... timeBasedAutoScalingConfigurations) { if (this.timeBasedAutoScalingConfigurations == null) { setTimeBasedAutoScalingConfigurations(new com.amazonaws.internal.SdkInternalList<TimeBasedAutoScalingConfiguration>( timeBasedAutoScalingConfigurations.length)); } for (TimeBasedAutoScalingConfiguration ele : timeBasedAutoScalingConfigurations) { this.timeBasedAutoScalingConfigurations.add(ele); } return this; } }
public class class_name { public DescribeTimeBasedAutoScalingResult withTimeBasedAutoScalingConfigurations(TimeBasedAutoScalingConfiguration... timeBasedAutoScalingConfigurations) { if (this.timeBasedAutoScalingConfigurations == null) { setTimeBasedAutoScalingConfigurations(new com.amazonaws.internal.SdkInternalList<TimeBasedAutoScalingConfiguration>( timeBasedAutoScalingConfigurations.length)); // depends on control dependency: [if], data = [none] } for (TimeBasedAutoScalingConfiguration ele : timeBasedAutoScalingConfigurations) { this.timeBasedAutoScalingConfigurations.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public ValidationResult check(Entry entry) { result = new ValidationResult(); if (entry.isDelete()) { reportMessage(Severity.FIX, entry.getOrigin(), FIX_ID, entry.getPrimaryAccession()); } return result; } }
public class class_name { public ValidationResult check(Entry entry) { result = new ValidationResult(); if (entry.isDelete()) { reportMessage(Severity.FIX, entry.getOrigin(), FIX_ID, entry.getPrimaryAccession()); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException { if (((View) example).getDefinition() != null) { return example; } Database database = snapshot.getDatabase(); Schema schema = example.getSchema(); List<CachedRow> viewsMetadataRs = null; try { viewsMetadataRs = ((JdbcDatabaseSnapshot) snapshot).getMetaDataFromCache().getViews(((AbstractJdbcDatabase) database).getJdbcCatalogName(schema), ((AbstractJdbcDatabase) database).getJdbcSchemaName(schema), example.getName()); if (!viewsMetadataRs.isEmpty()) { CachedRow row = viewsMetadataRs.get(0); String rawViewName = row.getString("TABLE_NAME"); String rawSchemaName = StringUtil.trimToNull(row.getString("TABLE_SCHEM")); String rawCatalogName = StringUtil.trimToNull(row.getString("TABLE_CAT")); String remarks = row.getString("REMARKS"); if (remarks != null) { remarks = remarks.replace("''", "'"); //come back escaped sometimes } View view = new View().setName(cleanNameFromDatabase(rawViewName, database)); view.setRemarks(remarks); CatalogAndSchema schemaFromJdbcInfo = ((AbstractJdbcDatabase) database).getSchemaFromJdbcInfo(rawCatalogName, rawSchemaName); view.setSchema(new Schema(schemaFromJdbcInfo.getCatalogName(), schemaFromJdbcInfo.getSchemaName())); try { String definition = database.getViewDefinition(schemaFromJdbcInfo, view.getName()); if (definition.startsWith("FULL_DEFINITION: ")) { definition = definition.replaceFirst("^FULL_DEFINITION: ", ""); view.setContainsFullDefinition(true); } // remove strange zero-termination seen on some Oracle view definitions int length = definition.length(); if (definition.charAt(length-1) == 0) { definition = definition.substring(0, length-1); } if (database instanceof InformixDatabase) { // Cleanup definition = definition.trim(); definition = definition.replaceAll("\\s*,\\s*", ", "); definition = definition.replaceAll("\\s*;", ""); // Strip the schema definition because it can optionally be included in the tag attribute definition = definition.replaceAll("(?i)\""+view.getSchema().getName()+"\"\\.", ""); } view.setDefinition(definition); } catch (DatabaseException e) { throw new DatabaseException("Error getting " + database.getConnection().getURL() + " view with " + new GetViewDefinitionStatement(view.getSchema().getCatalogName(), view.getSchema().getName(), rawViewName), e); } return view; } else { return null; } } catch (SQLException e) { throw new DatabaseException(e); } } }
public class class_name { @Override protected DatabaseObject snapshotObject(DatabaseObject example, DatabaseSnapshot snapshot) throws DatabaseException { if (((View) example).getDefinition() != null) { return example; } Database database = snapshot.getDatabase(); Schema schema = example.getSchema(); List<CachedRow> viewsMetadataRs = null; try { viewsMetadataRs = ((JdbcDatabaseSnapshot) snapshot).getMetaDataFromCache().getViews(((AbstractJdbcDatabase) database).getJdbcCatalogName(schema), ((AbstractJdbcDatabase) database).getJdbcSchemaName(schema), example.getName()); if (!viewsMetadataRs.isEmpty()) { CachedRow row = viewsMetadataRs.get(0); String rawViewName = row.getString("TABLE_NAME"); String rawSchemaName = StringUtil.trimToNull(row.getString("TABLE_SCHEM")); String rawCatalogName = StringUtil.trimToNull(row.getString("TABLE_CAT")); String remarks = row.getString("REMARKS"); if (remarks != null) { remarks = remarks.replace("''", "'"); //come back escaped sometimes // depends on control dependency: [if], data = [none] } View view = new View().setName(cleanNameFromDatabase(rawViewName, database)); view.setRemarks(remarks); // depends on control dependency: [if], data = [none] CatalogAndSchema schemaFromJdbcInfo = ((AbstractJdbcDatabase) database).getSchemaFromJdbcInfo(rawCatalogName, rawSchemaName); view.setSchema(new Schema(schemaFromJdbcInfo.getCatalogName(), schemaFromJdbcInfo.getSchemaName())); // depends on control dependency: [if], data = [none] try { String definition = database.getViewDefinition(schemaFromJdbcInfo, view.getName()); if (definition.startsWith("FULL_DEFINITION: ")) { definition = definition.replaceFirst("^FULL_DEFINITION: ", ""); // depends on control dependency: [if], data = [none] view.setContainsFullDefinition(true); // depends on control dependency: [if], data = [none] } // remove strange zero-termination seen on some Oracle view definitions int length = definition.length(); if (definition.charAt(length-1) == 0) { definition = definition.substring(0, length-1); // depends on control dependency: [if], data = [none] } if (database instanceof InformixDatabase) { // Cleanup definition = definition.trim(); // depends on control dependency: [if], data = [none] definition = definition.replaceAll("\\s*,\\s*", ", "); // depends on control dependency: [if], data = [none] definition = definition.replaceAll("\\s*;", ""); // depends on control dependency: [if], data = [none] // Strip the schema definition because it can optionally be included in the tag attribute definition = definition.replaceAll("(?i)\""+view.getSchema().getName()+"\"\\.", ""); // depends on control dependency: [if], data = [none] } view.setDefinition(definition); // depends on control dependency: [try], data = [none] } catch (DatabaseException e) { throw new DatabaseException("Error getting " + database.getConnection().getURL() + " view with " + new GetViewDefinitionStatement(view.getSchema().getCatalogName(), view.getSchema().getName(), rawViewName), e); } // depends on control dependency: [catch], data = [none] return view; // depends on control dependency: [if], data = [none] } else { return null; // depends on control dependency: [if], data = [none] } } catch (SQLException e) { throw new DatabaseException(e); } } }
public class class_name { @Override public void endElement(String uri, String localName, String qName) throws SAXException { // <context-param> if (elements("web-app", "context-param")) { if (currentName != null && currentValue != null) { entries.put(currentName, currentValue); } } // remove the element from the stack String removedName = stack.pop(); // check if the removed name is the expected one if (!removedName.equals(localName)) { throw new IllegalStateException("Found '" + removedName + "' but expected '" + localName + "' on the stack!"); } } }
public class class_name { @Override public void endElement(String uri, String localName, String qName) throws SAXException { // <context-param> if (elements("web-app", "context-param")) { if (currentName != null && currentValue != null) { entries.put(currentName, currentValue); // depends on control dependency: [if], data = [(currentName] } } // remove the element from the stack String removedName = stack.pop(); // check if the removed name is the expected one if (!removedName.equals(localName)) { throw new IllegalStateException("Found '" + removedName + "' but expected '" + localName + "' on the stack!"); } } }
public class class_name { private int urlType(String urlPattern) { String pattern = urlPattern.toString(); if (pattern.startsWith("*.")) { //extension return EXTENSION_PATTERN; //0 } else if (pattern.startsWith("/") && pattern.endsWith("/*")) { // path prefix return PATHPREFIX_PATTERN; //1 } else if (pattern.equals("/")) { return DEFAULT_PATTERN; //3 } return EXACT_PATTERN; //2 } }
public class class_name { private int urlType(String urlPattern) { String pattern = urlPattern.toString(); if (pattern.startsWith("*.")) { //extension return EXTENSION_PATTERN; //0 // depends on control dependency: [if], data = [none] } else if (pattern.startsWith("/") && pattern.endsWith("/*")) { // path prefix return PATHPREFIX_PATTERN; //1 // depends on control dependency: [if], data = [none] } else if (pattern.equals("/")) { return DEFAULT_PATTERN; //3 // depends on control dependency: [if], data = [none] } return EXACT_PATTERN; //2 } }
public class class_name { private void clearBeatGrids(DeviceAnnouncement announcement) { final int player = announcement.getNumber(); // Iterate over a copy to avoid concurrent modification issues for (DeckReference deck : new HashSet<DeckReference>(hotCache.keySet())) { if (deck.player == player) { hotCache.remove(deck); if (deck.hotCue == 0) { deliverBeatGridUpdate(player, null); // Inform listeners the beat grid is gone. } } } } }
public class class_name { private void clearBeatGrids(DeviceAnnouncement announcement) { final int player = announcement.getNumber(); // Iterate over a copy to avoid concurrent modification issues for (DeckReference deck : new HashSet<DeckReference>(hotCache.keySet())) { if (deck.player == player) { hotCache.remove(deck); // depends on control dependency: [if], data = [none] if (deck.hotCue == 0) { deliverBeatGridUpdate(player, null); // Inform listeners the beat grid is gone. // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public boolean canResolve(QualifiedName name) { if (!this.name.isPresent()) { return false; } // TODO: need to know whether the qualified name and the name of this field were quoted return matchesPrefix(name.getPrefix()) && this.name.get().equalsIgnoreCase(name.getSuffix()); } }
public class class_name { public boolean canResolve(QualifiedName name) { if (!this.name.isPresent()) { return false; // depends on control dependency: [if], data = [none] } // TODO: need to know whether the qualified name and the name of this field were quoted return matchesPrefix(name.getPrefix()) && this.name.get().equalsIgnoreCase(name.getSuffix()); } }
public class class_name { protected void beforeSend(RpcInternalContext context, SofaRequest request) { currentRequests.incrementAndGet(); context.getStopWatch().tick().read(); context.setLocalAddress(localAddress()); if (EventBus.isEnable(ClientBeforeSendEvent.class)) { EventBus.post(new ClientBeforeSendEvent(request)); } } }
public class class_name { protected void beforeSend(RpcInternalContext context, SofaRequest request) { currentRequests.incrementAndGet(); context.getStopWatch().tick().read(); context.setLocalAddress(localAddress()); if (EventBus.isEnable(ClientBeforeSendEvent.class)) { EventBus.post(new ClientBeforeSendEvent(request)); // depends on control dependency: [if], data = [none] } } }
public class class_name { void positionPopup() { if (m_popup.isShowing()) { int width = m_popup.getOffsetWidth(); int openerHeight = CmsDomUtil.getCurrentStyleInt(m_opener.getElement(), CmsDomUtil.Style.height); int popupHeight = getPopupHeight(); int dx = 0; if (width > (m_opener.getOffsetWidth())) { int spaceOnTheRight = (Window.getClientWidth() + Window.getScrollLeft()) - m_opener.getAbsoluteLeft() - width; dx = spaceOnTheRight < 0 ? spaceOnTheRight : 0; } // Calculate top position for the popup int top = m_opener.getAbsoluteTop(); // Make sure scrolling is taken into account, since // box.getAbsoluteTop() takes scrolling into account. int windowTop = Window.getScrollTop(); int windowBottom = Window.getScrollTop() + Window.getClientHeight(); // Distance from the top edge of the window to the top edge of the // text box int distanceFromWindowTop = top - windowTop; // Distance from the bottom edge of the window to the bottom edge of // the text box int distanceToWindowBottom = windowBottom - (top + m_opener.getOffsetHeight()); boolean displayAbove = displayingAbove(); // in case there is not enough space, add a scroll panel to the selector popup if ((displayAbove && (distanceFromWindowTop < popupHeight)) || (!displayAbove && (distanceToWindowBottom < popupHeight))) { setScrollingSelector((displayAbove ? distanceFromWindowTop : distanceToWindowBottom) - 10); popupHeight = m_popup.getOffsetHeight(); } if (displayAbove) { // Position above the text box CmsDomUtil.positionElement(m_popup.getElement(), m_panel.getElement(), dx, -(popupHeight - 2)); m_selectBoxState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerBottom()); m_selectorState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerTop()); } else { CmsDomUtil.positionElement(m_popup.getElement(), m_panel.getElement(), dx, openerHeight - 1); m_selectBoxState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerTop()); m_selectorState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerBottom()); } } } }
public class class_name { void positionPopup() { if (m_popup.isShowing()) { int width = m_popup.getOffsetWidth(); int openerHeight = CmsDomUtil.getCurrentStyleInt(m_opener.getElement(), CmsDomUtil.Style.height); int popupHeight = getPopupHeight(); int dx = 0; if (width > (m_opener.getOffsetWidth())) { int spaceOnTheRight = (Window.getClientWidth() + Window.getScrollLeft()) - m_opener.getAbsoluteLeft() - width; dx = spaceOnTheRight < 0 ? spaceOnTheRight : 0; // depends on control dependency: [if], data = [none] } // Calculate top position for the popup int top = m_opener.getAbsoluteTop(); // Make sure scrolling is taken into account, since // box.getAbsoluteTop() takes scrolling into account. int windowTop = Window.getScrollTop(); int windowBottom = Window.getScrollTop() + Window.getClientHeight(); // Distance from the top edge of the window to the top edge of the // text box int distanceFromWindowTop = top - windowTop; // Distance from the bottom edge of the window to the bottom edge of // the text box int distanceToWindowBottom = windowBottom - (top + m_opener.getOffsetHeight()); boolean displayAbove = displayingAbove(); // in case there is not enough space, add a scroll panel to the selector popup if ((displayAbove && (distanceFromWindowTop < popupHeight)) || (!displayAbove && (distanceToWindowBottom < popupHeight))) { setScrollingSelector((displayAbove ? distanceFromWindowTop : distanceToWindowBottom) - 10); // depends on control dependency: [if], data = [none] popupHeight = m_popup.getOffsetHeight(); // depends on control dependency: [if], data = [none] } if (displayAbove) { // Position above the text box CmsDomUtil.positionElement(m_popup.getElement(), m_panel.getElement(), dx, -(popupHeight - 2)); // depends on control dependency: [if], data = [none] m_selectBoxState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerBottom()); // depends on control dependency: [if], data = [none] m_selectorState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerTop()); // depends on control dependency: [if], data = [none] } else { CmsDomUtil.positionElement(m_popup.getElement(), m_panel.getElement(), dx, openerHeight - 1); // depends on control dependency: [if], data = [none] m_selectBoxState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerTop()); // depends on control dependency: [if], data = [none] m_selectorState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerBottom()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void visitActionFieldList(ActionInsertFact afl) { String factType = afl.getFactType(); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey(var)) { vars.put(var, vars.size()); } } } }
public class class_name { private void visitActionFieldList(ActionInsertFact afl) { String factType = afl.getFactType(); for (ActionFieldValue afv : afl.getFieldValues()) { InterpolationVariable var = new InterpolationVariable(afv.getValue(), afv.getType(), factType, afv.getField()); if (afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.containsKey(var)) { vars.put(var, vars.size()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public T background(int id) { if (view != null) { if (id != 0) { view.setBackgroundResource(id); } else { if (Build.VERSION.SDK_INT<9) { view.setBackgroundDrawable(null); } else view.setBackground(null); } } return self(); } }
public class class_name { public T background(int id) { if (view != null) { if (id != 0) { view.setBackgroundResource(id); // depends on control dependency: [if], data = [(id] } else { if (Build.VERSION.SDK_INT<9) { view.setBackgroundDrawable(null); // depends on control dependency: [if], data = [none] } else view.setBackground(null); } } return self(); } }
public class class_name { public void setLocale(final Locale locale) { if (!equals(this.locale, locale)) { this.locale = locale; super.setValue(toString(locale)); i18nBundleProvider.reloadBundles(locale); } } }
public class class_name { public void setLocale(final Locale locale) { if (!equals(this.locale, locale)) { this.locale = locale; // depends on control dependency: [if], data = [none] super.setValue(toString(locale)); // depends on control dependency: [if], data = [none] i18nBundleProvider.reloadBundles(locale); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Deprecated public static String addSmallestScreenWidth(String qualifiers, int smallestScreenWidth) { int qualifiersSmallestScreenWidth = Qualifiers.getSmallestScreenWidth(qualifiers); if (qualifiersSmallestScreenWidth == -1) { if (qualifiers.length() > 0) { qualifiers += "-"; } qualifiers += "sw" + smallestScreenWidth + "dp"; } return qualifiers; } }
public class class_name { @Deprecated public static String addSmallestScreenWidth(String qualifiers, int smallestScreenWidth) { int qualifiersSmallestScreenWidth = Qualifiers.getSmallestScreenWidth(qualifiers); if (qualifiersSmallestScreenWidth == -1) { if (qualifiers.length() > 0) { qualifiers += "-"; // depends on control dependency: [if], data = [none] } qualifiers += "sw" + smallestScreenWidth + "dp"; // depends on control dependency: [if], data = [none] } return qualifiers; } }
public class class_name { public static boolean isPure(SyntacticItem item) { // Examine expression to determine whether this expression is impure. if (item instanceof Expr.StaticVariableAccess || item instanceof Expr.Dereference || item instanceof Expr.New) { return false; } else if (item instanceof Expr.Invoke) { Expr.Invoke e = (Expr.Invoke) item; Decl.Link<Decl.Callable> l = e.getLink(); if (l.getTarget() instanceof Decl.Method) { // This expression is definitely not pure return false; } } else if (item instanceof Expr.IndirectInvoke) { Expr.IndirectInvoke e = (Expr.IndirectInvoke) item; // FIXME: need to do something here. internalFailure("purity checking currently does not support indirect invocation", item); } // Recursively examine any subexpressions. The uniform nature of // syntactic items makes this relatively easy. boolean result = true; // for (int i = 0; i != item.size(); ++i) { result &= isPure(item.get(i)); } return result; } }
public class class_name { public static boolean isPure(SyntacticItem item) { // Examine expression to determine whether this expression is impure. if (item instanceof Expr.StaticVariableAccess || item instanceof Expr.Dereference || item instanceof Expr.New) { return false; // depends on control dependency: [if], data = [none] } else if (item instanceof Expr.Invoke) { Expr.Invoke e = (Expr.Invoke) item; Decl.Link<Decl.Callable> l = e.getLink(); if (l.getTarget() instanceof Decl.Method) { // This expression is definitely not pure return false; // depends on control dependency: [if], data = [none] } } else if (item instanceof Expr.IndirectInvoke) { Expr.IndirectInvoke e = (Expr.IndirectInvoke) item; // FIXME: need to do something here. internalFailure("purity checking currently does not support indirect invocation", item); // depends on control dependency: [if], data = [none] } // Recursively examine any subexpressions. The uniform nature of // syntactic items makes this relatively easy. boolean result = true; // for (int i = 0; i != item.size(); ++i) { result &= isPure(item.get(i)); // depends on control dependency: [for], data = [i] } return result; } }
public class class_name { public static LinkedHashMap<String, String> getSearchWidgetMapping() { LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); for (SearchWidgetCreator swc : REGISTRY.values()) { map.put(swc.getSearchWidgetId(), swc.getSearchWidgetName()); } return map; } }
public class class_name { public static LinkedHashMap<String, String> getSearchWidgetMapping() { LinkedHashMap<String, String> map = new LinkedHashMap<String, String>(); for (SearchWidgetCreator swc : REGISTRY.values()) { map.put(swc.getSearchWidgetId(), swc.getSearchWidgetName()); // depends on control dependency: [for], data = [swc] } return map; } }
public class class_name { protected int interpretInfo(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; } String[] lines = StringUtils.split(content, "\n"); String info = null; for(String s : lines){ if(s.startsWith("//**")){ info = StringUtils.substringAfter(s, "//**"); break; } } if(info!=null){ mm.report(MessageMgr.createInfoMessage("script {} - info: {}", new Object[]{fileName, info})); // Skb_Console.conInfo("{}: script {} - info: {}", new Object[]{shell.getPromptName(), fileName, info}); } return 0; } }
public class class_name { protected int interpretInfo(LineParser lp, MessageMgr mm){ String fileName = this.getFileName(lp); String content = this.getContent(fileName, mm); if(content==null){ return 1; // depends on control dependency: [if], data = [none] } String[] lines = StringUtils.split(content, "\n"); String info = null; for(String s : lines){ if(s.startsWith("//**")){ info = StringUtils.substringAfter(s, "//**"); break; } } if(info!=null){ mm.report(MessageMgr.createInfoMessage("script {} - info: {}", new Object[]{fileName, info})); // Skb_Console.conInfo("{}: script {} - info: {}", new Object[]{shell.getPromptName(), fileName, info}); } return 0; } }
public class class_name { @Override public GeoPackageTile getTile(int x, int y, int zoom) { GeoPackageTile tile = null; TileRow tileRow = retrieveTileRow(x, y, zoom); if (tileRow != null) { TileMatrix tileMatrix = tileDao.getTileMatrix(zoom); int tileWidth = (int) tileMatrix.getTileWidth(); int tileHeight = (int) tileMatrix.getTileHeight(); tile = new GeoPackageTile(tileWidth, tileHeight, tileRow.getTileData()); } return tile; } }
public class class_name { @Override public GeoPackageTile getTile(int x, int y, int zoom) { GeoPackageTile tile = null; TileRow tileRow = retrieveTileRow(x, y, zoom); if (tileRow != null) { TileMatrix tileMatrix = tileDao.getTileMatrix(zoom); int tileWidth = (int) tileMatrix.getTileWidth(); int tileHeight = (int) tileMatrix.getTileHeight(); tile = new GeoPackageTile(tileWidth, tileHeight, tileRow.getTileData()); // depends on control dependency: [if], data = [none] } return tile; } }
public class class_name { public void marshall(ListHandshakesForOrganizationRequest listHandshakesForOrganizationRequest, ProtocolMarshaller protocolMarshaller) { if (listHandshakesForOrganizationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listHandshakesForOrganizationRequest.getFilter(), FILTER_BINDING); protocolMarshaller.marshall(listHandshakesForOrganizationRequest.getNextToken(), NEXTTOKEN_BINDING); protocolMarshaller.marshall(listHandshakesForOrganizationRequest.getMaxResults(), MAXRESULTS_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListHandshakesForOrganizationRequest listHandshakesForOrganizationRequest, ProtocolMarshaller protocolMarshaller) { if (listHandshakesForOrganizationRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listHandshakesForOrganizationRequest.getFilter(), FILTER_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listHandshakesForOrganizationRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listHandshakesForOrganizationRequest.getMaxResults(), MAXRESULTS_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 { protected static String getResource(Uri uri) { if (!isAPIUri(uri)) { return null; } String scheme = uri.getScheme(); String apiScheme = getBaseUri().getScheme(); // Strip out the protocol and store the result in the "remainder" variable String remainder = uri.toString().substring(scheme.length()); // Strip out the protocol from the base URI String apiRemainder = getBaseUri().toString().substring(apiScheme.length()); // Check that the remainder starts with the apiRemainder if (!remainder.startsWith(apiRemainder)) { return null; } // Return the path, stripped out of the base uri's path return uri.getPath().substring(getBaseUri().getPath().length()); } }
public class class_name { protected static String getResource(Uri uri) { if (!isAPIUri(uri)) { return null; // depends on control dependency: [if], data = [none] } String scheme = uri.getScheme(); String apiScheme = getBaseUri().getScheme(); // Strip out the protocol and store the result in the "remainder" variable String remainder = uri.toString().substring(scheme.length()); // Strip out the protocol from the base URI String apiRemainder = getBaseUri().toString().substring(apiScheme.length()); // Check that the remainder starts with the apiRemainder if (!remainder.startsWith(apiRemainder)) { return null; // depends on control dependency: [if], data = [none] } // Return the path, stripped out of the base uri's path return uri.getPath().substring(getBaseUri().getPath().length()); } }
public class class_name { public List<Rankable> getRankings() { List<Rankable> copy = Lists.newLinkedList(); for (Rankable r : rankedItems) { copy.add(r.copy()); } return ImmutableList.copyOf(copy); } }
public class class_name { public List<Rankable> getRankings() { List<Rankable> copy = Lists.newLinkedList(); for (Rankable r : rankedItems) { copy.add(r.copy()); // depends on control dependency: [for], data = [r] } return ImmutableList.copyOf(copy); } }
public class class_name { @Override public void onEnd(boolean result, BaseSliderView target) { if(target.isErrorDisappear() == false || result == true){ return; } for (BaseSliderView slider: mImageContents){ if(slider.equals(target)){ removeSlider(target); break; } } } }
public class class_name { @Override public void onEnd(boolean result, BaseSliderView target) { if(target.isErrorDisappear() == false || result == true){ return; // depends on control dependency: [if], data = [none] } for (BaseSliderView slider: mImageContents){ if(slider.equals(target)){ removeSlider(target); // depends on control dependency: [if], data = [none] break; } } } }
public class class_name { private void publishEvent(WSJobExecution jobEx, String topicToPublish, String correlationId) { if (eventsPublisher != null) { eventsPublisher.publishJobExecutionEvent(jobEx, topicToPublish, correlationId); } } }
public class class_name { private void publishEvent(WSJobExecution jobEx, String topicToPublish, String correlationId) { if (eventsPublisher != null) { eventsPublisher.publishJobExecutionEvent(jobEx, topicToPublish, correlationId); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public boolean add(T newElement) { elements[lastIndex] = newElement; lastIndex = incrementIndex(lastIndex, 0); if (isEmpty()) { // First element firstIndex = 0; size = 1; } else if (isFull()) { // Reuse space firstIndex = lastIndex; } else { size = incrementIndex(size, elements.length); } return true; } }
public class class_name { @Override public boolean add(T newElement) { elements[lastIndex] = newElement; lastIndex = incrementIndex(lastIndex, 0); if (isEmpty()) { // First element firstIndex = 0; // depends on control dependency: [if], data = [none] size = 1; // depends on control dependency: [if], data = [none] } else if (isFull()) { // Reuse space firstIndex = lastIndex; // depends on control dependency: [if], data = [none] } else { size = incrementIndex(size, elements.length); // depends on control dependency: [if], data = [none] } return true; } }
public class class_name { public static String getAbsoluteParent(String path, int level) { int idx = 0; int len = path.length(); while (level >= 0 && idx < len) { idx = path.indexOf('/', idx + 1); if (idx < 0) { idx = len; } level--; } return level >= 0 ? "" : path.substring(0, idx); } }
public class class_name { public static String getAbsoluteParent(String path, int level) { int idx = 0; int len = path.length(); while (level >= 0 && idx < len) { idx = path.indexOf('/', idx + 1); // depends on control dependency: [while], data = [none] if (idx < 0) { idx = len; // depends on control dependency: [if], data = [none] } level--; // depends on control dependency: [while], data = [none] } return level >= 0 ? "" : path.substring(0, idx); } }
public class class_name { @SuppressWarnings("unchecked") public static String map2JsonString(Map<String, Object> map) { IStringBuffer sb = new IStringBuffer(); sb.append('{'); for ( Map.Entry<String, Object> entry : map.entrySet() ) { sb.append('"').append(entry.getKey().toString()).append("\": "); Object obj = entry.getValue(); if ( obj instanceof List<?> ) { sb.append(list2JsonString((List<Object>)obj)).append(','); } else if (obj instanceof Object[]) { sb.append(vector2JsonString((Object[])obj)).append(','); } else if (obj instanceof Map<?,?>) { sb.append(map2JsonString((Map<String, Object>)obj)).append(','); } else if ((obj instanceof Boolean) || (obj instanceof Byte) || (obj instanceof Short) || (obj instanceof Integer) || (obj instanceof Long) || (obj instanceof Float) || (obj instanceof Double)) { sb.append(obj.toString()).append(','); } else { String v = obj.toString(); int last = v.length() - 1; if ( v.length() > 1 && ( (v.charAt(0) == '{' && v.charAt(last) == '}' ) || (v.charAt(0) == '[' && v.charAt(last) == ']' ) ) ) { sb.append(v).append(','); } else { sb.append('"').append(v).append("\","); } } } if ( sb.length() > 1 ) { sb.deleteCharAt(sb.length()-1); } sb.append('}'); return sb.toString(); } }
public class class_name { @SuppressWarnings("unchecked") public static String map2JsonString(Map<String, Object> map) { IStringBuffer sb = new IStringBuffer(); sb.append('{'); for ( Map.Entry<String, Object> entry : map.entrySet() ) { sb.append('"').append(entry.getKey().toString()).append("\": "); // depends on control dependency: [for], data = [entry] Object obj = entry.getValue(); if ( obj instanceof List<?> ) { sb.append(list2JsonString((List<Object>)obj)).append(','); // depends on control dependency: [if], data = [)] } else if (obj instanceof Object[]) { sb.append(vector2JsonString((Object[])obj)).append(','); // depends on control dependency: [if], data = [none] } else if (obj instanceof Map<?,?>) { sb.append(map2JsonString((Map<String, Object>)obj)).append(','); // depends on control dependency: [if], data = [)] } else if ((obj instanceof Boolean) || (obj instanceof Byte) || (obj instanceof Short) || (obj instanceof Integer) || (obj instanceof Long) || (obj instanceof Float) || (obj instanceof Double)) { sb.append(obj.toString()).append(','); // depends on control dependency: [if], data = [none] } else { String v = obj.toString(); int last = v.length() - 1; if ( v.length() > 1 && ( (v.charAt(0) == '{' && v.charAt(last) == '}' ) || (v.charAt(0) == '[' && v.charAt(last) == ']' ) ) ) { sb.append(v).append(','); // depends on control dependency: [if], data = [] } else { sb.append('"').append(v).append("\","); // depends on control dependency: [if], data = [] } } } if ( sb.length() > 1 ) { sb.deleteCharAt(sb.length()-1); // depends on control dependency: [if], data = [none] } sb.append('}'); return sb.toString(); } }
public class class_name { public RhinoScriptBuilder evaluateChain(final InputStream stream, final String sourceName) throws IOException { notNull(stream); try { getContext().evaluateReader(scope, new InputStreamReader(stream), sourceName, 1, null); return this; } catch(final RhinoException e) { if (e instanceof RhinoException) { LOG.error("RhinoException: {}", RhinoUtils.createExceptionMessage(e)); } throw e; } catch (final RuntimeException e) { LOG.error("Exception caught", e); throw e; } finally { stream.close(); } } }
public class class_name { public RhinoScriptBuilder evaluateChain(final InputStream stream, final String sourceName) throws IOException { notNull(stream); try { getContext().evaluateReader(scope, new InputStreamReader(stream), sourceName, 1, null); return this; } catch(final RhinoException e) { if (e instanceof RhinoException) { LOG.error("RhinoException: {}", RhinoUtils.createExceptionMessage(e)); // depends on control dependency: [if], data = [none] } throw e; } catch (final RuntimeException e) { LOG.error("Exception caught", e); throw e; } finally { stream.close(); } } }
public class class_name { public int[] getPixelValues(byte[] imageBytes) { PngReaderInt reader = new PngReaderInt(new ByteArrayInputStream(imageBytes)); validateImageType(reader); int[] pixels = new int[reader.imgInfo.cols * reader.imgInfo.rows]; int rowNumber = 0; while (reader.hasMoreRows()) { ImageLineInt row = reader.readRowInt(); int[] rowValues = row.getScanline(); System.arraycopy(rowValues, 0, pixels, rowNumber * reader.imgInfo.cols, rowValues.length); rowNumber++; } reader.close(); return pixels; } }
public class class_name { public int[] getPixelValues(byte[] imageBytes) { PngReaderInt reader = new PngReaderInt(new ByteArrayInputStream(imageBytes)); validateImageType(reader); int[] pixels = new int[reader.imgInfo.cols * reader.imgInfo.rows]; int rowNumber = 0; while (reader.hasMoreRows()) { ImageLineInt row = reader.readRowInt(); int[] rowValues = row.getScanline(); System.arraycopy(rowValues, 0, pixels, rowNumber * reader.imgInfo.cols, rowValues.length); // depends on control dependency: [while], data = [none] rowNumber++; // depends on control dependency: [while], data = [none] } reader.close(); return pixels; } }
public class class_name { public boolean unsuspendCassandraHost(CassandraHost cassandraHost) { HClientPool pool = suspendedHostPools.remove(cassandraHost); boolean readded = pool != null; if ( readded ) { boolean alreadyThere = hostPools.putIfAbsent(cassandraHost, pool) != null; if ( alreadyThere ) { log.error("Unsuspend called on a pool that was already active for CassandraHost {}", cassandraHost); pool.shutdown(); } } listenerHandler.fireOnUnSuspendHost(cassandraHost, readded); log.info("UN-Suspend operation status was {} for CassandraHost {}", readded, cassandraHost); return readded; } }
public class class_name { public boolean unsuspendCassandraHost(CassandraHost cassandraHost) { HClientPool pool = suspendedHostPools.remove(cassandraHost); boolean readded = pool != null; if ( readded ) { boolean alreadyThere = hostPools.putIfAbsent(cassandraHost, pool) != null; if ( alreadyThere ) { log.error("Unsuspend called on a pool that was already active for CassandraHost {}", cassandraHost); // depends on control dependency: [if], data = [none] pool.shutdown(); // depends on control dependency: [if], data = [none] } } listenerHandler.fireOnUnSuspendHost(cassandraHost, readded); log.info("UN-Suspend operation status was {} for CassandraHost {}", readded, cassandraHost); return readded; } }
public class class_name { protected void process(String text, Map params, Writer writer){ try{ Template t = new Template("temp", new StringReader(text), FreeMarkerTL.getEnvironment().getConfiguration()); t.process(params, writer); }catch(Exception e){ throw new ViewException(e); } } }
public class class_name { protected void process(String text, Map params, Writer writer){ try{ Template t = new Template("temp", new StringReader(text), FreeMarkerTL.getEnvironment().getConfiguration()); t.process(params, writer); // depends on control dependency: [try], data = [none] }catch(Exception e){ throw new ViewException(e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private void applyUpdates(DBTransaction dbTran) { Map<String, Map<String, List<DColumn>>> colUpdatesMap = dbTran.getColumnUpdatesMap(); for (String storeName : colUpdatesMap.keySet()) { updateTableColumnUpdates(storeName, colUpdatesMap.get(storeName)); } Map<String, Map<String, List<String>>> colDeletesMap = dbTran.getColumnDeletesMap(); for (String storeName : colDeletesMap.keySet()) { updateTableColumnDeletes(storeName, colDeletesMap.get(storeName)); } Map<String, List<String>> rowDeletesMap = dbTran.getRowDeletesMap(); for (String storeName : rowDeletesMap.keySet()) { for (String rowKey : rowDeletesMap.get(storeName)) { Map<String, AttributeValue> key = DynamoDBService.makeDDBKey(rowKey); m_service.deleteRow(storeName, key); } } } }
public class class_name { private void applyUpdates(DBTransaction dbTran) { Map<String, Map<String, List<DColumn>>> colUpdatesMap = dbTran.getColumnUpdatesMap(); for (String storeName : colUpdatesMap.keySet()) { updateTableColumnUpdates(storeName, colUpdatesMap.get(storeName)); // depends on control dependency: [for], data = [storeName] } Map<String, Map<String, List<String>>> colDeletesMap = dbTran.getColumnDeletesMap(); for (String storeName : colDeletesMap.keySet()) { updateTableColumnDeletes(storeName, colDeletesMap.get(storeName)); // depends on control dependency: [for], data = [storeName] } Map<String, List<String>> rowDeletesMap = dbTran.getRowDeletesMap(); for (String storeName : rowDeletesMap.keySet()) { for (String rowKey : rowDeletesMap.get(storeName)) { Map<String, AttributeValue> key = DynamoDBService.makeDDBKey(rowKey); m_service.deleteRow(storeName, key); // depends on control dependency: [for], data = [none] } } } }
public class class_name { public static List<String> readFileFrom(String _fileName, Charset _charset, SearchOrder... _searchOrder) { InputStream stream = openInputStreamForFile(_fileName, _searchOrder); if (stream != null) { return readTextFileFromStream(stream, _charset, true); } return null; } }
public class class_name { public static List<String> readFileFrom(String _fileName, Charset _charset, SearchOrder... _searchOrder) { InputStream stream = openInputStreamForFile(_fileName, _searchOrder); if (stream != null) { return readTextFileFromStream(stream, _charset, true); // depends on control dependency: [if], data = [(stream] } return null; } }
public class class_name { @Override public void initializeFromFile(TreeIndexHeader header, PageFile<FlatRStarTreeNode> file) { super.initializeFromFile(header, file); // reconstruct root int nextPageID = file.getNextPageID(); dirCapacity = nextPageID; root = createNewDirectoryNode(); for(int i = 1; i < nextPageID; i++) { FlatRStarTreeNode node = getNode(i); root.addDirectoryEntry(createNewDirectoryEntry(node)); } if(LOG.isDebugging()) { LOG.debugFine("root: " + root + " with " + nextPageID + " leafNodes."); } } }
public class class_name { @Override public void initializeFromFile(TreeIndexHeader header, PageFile<FlatRStarTreeNode> file) { super.initializeFromFile(header, file); // reconstruct root int nextPageID = file.getNextPageID(); dirCapacity = nextPageID; root = createNewDirectoryNode(); for(int i = 1; i < nextPageID; i++) { FlatRStarTreeNode node = getNode(i); root.addDirectoryEntry(createNewDirectoryEntry(node)); // depends on control dependency: [for], data = [none] } if(LOG.isDebugging()) { LOG.debugFine("root: " + root + " with " + nextPageID + " leafNodes."); // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings({"unused", "WeakerAccess"}) public synchronized void pushInstallReferrer(String source, String medium, String campaign) { if (source == null && medium == null && campaign == null) return; try { // If already pushed, don't send it again int status = StorageHelper.getInt(context, "app_install_status", 0); if (status != 0) { Logger.d("Install referrer has already been set. Will not override it"); return; } StorageHelper.putInt(context, "app_install_status", 1); if (source != null) source = Uri.encode(source); if (medium != null) medium = Uri.encode(medium); if (campaign != null) campaign = Uri.encode(campaign); String uriStr = "wzrk://track?install=true"; if (source != null) uriStr += "&utm_source=" + source; if (medium != null) uriStr += "&utm_medium=" + medium; if (campaign != null) uriStr += "&utm_campaign=" + campaign; Uri uri = Uri.parse(uriStr); pushDeepLink(uri, true); } catch (Throwable t) { Logger.v("Failed to push install referrer", t); } } }
public class class_name { @SuppressWarnings({"unused", "WeakerAccess"}) public synchronized void pushInstallReferrer(String source, String medium, String campaign) { if (source == null && medium == null && campaign == null) return; try { // If already pushed, don't send it again int status = StorageHelper.getInt(context, "app_install_status", 0); if (status != 0) { Logger.d("Install referrer has already been set. Will not override it"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } StorageHelper.putInt(context, "app_install_status", 1); // depends on control dependency: [try], data = [none] if (source != null) source = Uri.encode(source); if (medium != null) medium = Uri.encode(medium); if (campaign != null) campaign = Uri.encode(campaign); String uriStr = "wzrk://track?install=true"; if (source != null) uriStr += "&utm_source=" + source; if (medium != null) uriStr += "&utm_medium=" + medium; if (campaign != null) uriStr += "&utm_campaign=" + campaign; Uri uri = Uri.parse(uriStr); pushDeepLink(uri, true); // depends on control dependency: [try], data = [none] } catch (Throwable t) { Logger.v("Failed to push install referrer", t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static void injectTargetIntoWrapper(final Object target, final Object wrapper, final String targetFieldName) { try { final Field field = wrapper.getClass().getField(targetFieldName); field.setAccessible(true); field.set(wrapper, target); } catch (Exception ex) { throw new ProxettaException(ex); } } }
public class class_name { public static void injectTargetIntoWrapper(final Object target, final Object wrapper, final String targetFieldName) { try { final Field field = wrapper.getClass().getField(targetFieldName); field.setAccessible(true); // depends on control dependency: [try], data = [none] field.set(wrapper, target); // depends on control dependency: [try], data = [none] } catch (Exception ex) { throw new ProxettaException(ex); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public Object read(Object object) { if(object == null) { String msg = "Can not evaluate the identifier \"" + _identifier + "\" on a null object."; LOGGER.error(msg); throw new RuntimeException(msg); } if(TRACE_ENABLED) LOGGER.trace("Read property " + _identifier + " on object of type " + object.getClass().getName()); if(object instanceof Map) return mapLookup((Map)object, _identifier); else if(object instanceof List) { int i = parseIndex(_identifier); return listLookup((List)object, i); } else if(object.getClass().isArray()) { int i = parseIndex(_identifier); return arrayLookup(object, i); } else return beanLookup(object, _identifier); } }
public class class_name { public Object read(Object object) { if(object == null) { String msg = "Can not evaluate the identifier \"" + _identifier + "\" on a null object."; // depends on control dependency: [if], data = [none] LOGGER.error(msg); // depends on control dependency: [if], data = [none] throw new RuntimeException(msg); } if(TRACE_ENABLED) LOGGER.trace("Read property " + _identifier + " on object of type " + object.getClass().getName()); if(object instanceof Map) return mapLookup((Map)object, _identifier); else if(object instanceof List) { int i = parseIndex(_identifier); return listLookup((List)object, i); // depends on control dependency: [if], data = [none] } else if(object.getClass().isArray()) { int i = parseIndex(_identifier); return arrayLookup(object, i); // depends on control dependency: [if], data = [none] } else return beanLookup(object, _identifier); } }
public class class_name { @Override public Object map(Object input) { String orig = input.toString(); if (map.containsKey(orig)) { return map.get(orig); } if (input instanceof String) return input; else return orig; } }
public class class_name { @Override public Object map(Object input) { String orig = input.toString(); if (map.containsKey(orig)) { return map.get(orig); // depends on control dependency: [if], data = [none] } if (input instanceof String) return input; else return orig; } }
public class class_name { private static Object[] resolveUrl(String str) { String scheme = "http", host = "localhost", uri = "/"; int port = 80; Object[] obj = new Object[2]; try { if (str.length() >= 10) { String temp = str.substring(0, str.indexOf(":")); if (!CommUtil.isBlank(temp)) { if (temp.equalsIgnoreCase("HTTP") || temp.equalsIgnoreCase("HTTPS")) { scheme = temp; String temp1 = str.substring(temp.length() + 3); if (temp1.indexOf("/") > 0) { String temp2 = temp1.substring(0, temp1.indexOf("/")); if (temp2.indexOf(":") > 0) { String[] temp3 = temp2.split(":"); if (temp3.length > 1 && temp3[1].matches("[0-9]*")) { port = Integer.parseInt(temp3[1]); host = temp3[0]; } } else { host = temp2; if (temp.equalsIgnoreCase("HTTP")) { port = 80; } else if (temp.equalsIgnoreCase("HTTPS")) { port = 443; } } uri = temp1.substring(temp2.length()); } else { if (temp1.indexOf(":") > 0) { String[] temp3 = temp1.split(":"); if (temp3[1].matches("[0-9]*")) { port = Integer.parseInt(temp3[1]); host = temp3[0]; } } else { host = temp1; if (temp.equalsIgnoreCase("HTTP")) { port = 80; } else if (temp.equalsIgnoreCase("HTTPS")) { port = 443; } } uri = "/"; } } } } } catch (Exception e) { log.error("{}", e.getMessage(), e); } HttpHost targetHost = new HttpHost(host, port, scheme); obj[0] = targetHost; obj[1] = uri; log.debug("The parsed Object Array {}", Arrays.toString(obj)); return obj; } }
public class class_name { private static Object[] resolveUrl(String str) { String scheme = "http", host = "localhost", uri = "/"; int port = 80; Object[] obj = new Object[2]; try { if (str.length() >= 10) { String temp = str.substring(0, str.indexOf(":")); if (!CommUtil.isBlank(temp)) { if (temp.equalsIgnoreCase("HTTP") || temp.equalsIgnoreCase("HTTPS")) { scheme = temp; // depends on control dependency: [if], data = [none] String temp1 = str.substring(temp.length() + 3); if (temp1.indexOf("/") > 0) { String temp2 = temp1.substring(0, temp1.indexOf("/")); if (temp2.indexOf(":") > 0) { String[] temp3 = temp2.split(":"); if (temp3.length > 1 && temp3[1].matches("[0-9]*")) { port = Integer.parseInt(temp3[1]); // depends on control dependency: [if], data = [1] host = temp3[0]; // depends on control dependency: [if], data = [none] } } else { host = temp2; // depends on control dependency: [if], data = [none] if (temp.equalsIgnoreCase("HTTP")) { port = 80; // depends on control dependency: [if], data = [none] } else if (temp.equalsIgnoreCase("HTTPS")) { port = 443; // depends on control dependency: [if], data = [none] } } uri = temp1.substring(temp2.length()); // depends on control dependency: [if], data = [none] } else { if (temp1.indexOf(":") > 0) { String[] temp3 = temp1.split(":"); if (temp3[1].matches("[0-9]*")) { port = Integer.parseInt(temp3[1]); // depends on control dependency: [if], data = [none] host = temp3[0]; // depends on control dependency: [if], data = [none] } } else { host = temp1; // depends on control dependency: [if], data = [none] if (temp.equalsIgnoreCase("HTTP")) { port = 80; // depends on control dependency: [if], data = [none] } else if (temp.equalsIgnoreCase("HTTPS")) { port = 443; // depends on control dependency: [if], data = [none] } } uri = "/"; // depends on control dependency: [if], data = [none] } } } } } catch (Exception e) { log.error("{}", e.getMessage(), e); } // depends on control dependency: [catch], data = [none] HttpHost targetHost = new HttpHost(host, port, scheme); obj[0] = targetHost; obj[1] = uri; log.debug("The parsed Object Array {}", Arrays.toString(obj)); return obj; } }
public class class_name { public JdbcConnectionDescriptor addDescriptor(String jcdAlias, String jdbcDriver, String jdbcConnectionUrl, String username, String password) { JdbcConnectionDescriptor jcd = new JdbcConnectionDescriptor(); HashMap props = utils.parseConnectionUrl(jdbcConnectionUrl); jcd.setJcdAlias(jcdAlias); jcd.setProtocol((String)props.get(JdbcMetadataUtils.PROPERTY_PROTOCOL)); jcd.setSubProtocol((String)props.get(JdbcMetadataUtils.PROPERTY_SUBPROTOCOL)); jcd.setDbAlias((String)props.get(JdbcMetadataUtils.PROPERTY_DBALIAS)); String platform = utils.findPlatformFor(jcd.getSubProtocol(), jdbcDriver); jcd.setDbms(platform); jcd.setJdbcLevel(2.0); jcd.setDriver(jdbcDriver); if (username != null) { jcd.setUserName(username); jcd.setPassWord(password); } if ("default".equals(jcdAlias)) { jcd.setDefaultConnection(true); // arminw: MM will search for the default key // MetadataManager.getInstance().setDefaultPBKey(jcd.getPBKey()); } addDescriptor(jcd); return jcd; } }
public class class_name { public JdbcConnectionDescriptor addDescriptor(String jcdAlias, String jdbcDriver, String jdbcConnectionUrl, String username, String password) { JdbcConnectionDescriptor jcd = new JdbcConnectionDescriptor(); HashMap props = utils.parseConnectionUrl(jdbcConnectionUrl); jcd.setJcdAlias(jcdAlias); jcd.setProtocol((String)props.get(JdbcMetadataUtils.PROPERTY_PROTOCOL)); jcd.setSubProtocol((String)props.get(JdbcMetadataUtils.PROPERTY_SUBPROTOCOL)); jcd.setDbAlias((String)props.get(JdbcMetadataUtils.PROPERTY_DBALIAS)); String platform = utils.findPlatformFor(jcd.getSubProtocol(), jdbcDriver); jcd.setDbms(platform); jcd.setJdbcLevel(2.0); jcd.setDriver(jdbcDriver); if (username != null) { jcd.setUserName(username); // depends on control dependency: [if], data = [(username] jcd.setPassWord(password); // depends on control dependency: [if], data = [none] } if ("default".equals(jcdAlias)) { jcd.setDefaultConnection(true); // depends on control dependency: [if], data = [none] // arminw: MM will search for the default key // MetadataManager.getInstance().setDefaultPBKey(jcd.getPBKey()); } addDescriptor(jcd); return jcd; } }
public class class_name { private String encodeUrl(String text) { if (urlEncoding) { try { return URLEncoder.encode(text, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new ValidationException("UTF-8 encoding is not supported on this platform"); } } else { // When encoding is disabled, we accept any character except '/' final String INVALID_CHAR = "/"; if (text.contains(INVALID_CHAR)) { throw new ValidationException( "Invalid character \"" + INVALID_CHAR + "\" in path section \"" + text + "\"."); } return text; } } }
public class class_name { private String encodeUrl(String text) { if (urlEncoding) { try { return URLEncoder.encode(text, "UTF-8"); // depends on control dependency: [try], data = [none] } catch (UnsupportedEncodingException e) { throw new ValidationException("UTF-8 encoding is not supported on this platform"); } // depends on control dependency: [catch], data = [none] } else { // When encoding is disabled, we accept any character except '/' final String INVALID_CHAR = "/"; if (text.contains(INVALID_CHAR)) { throw new ValidationException( "Invalid character \"" + INVALID_CHAR + "\" in path section \"" + text + "\"."); } return text; // depends on control dependency: [if], data = [none] } } }
public class class_name { public boolean shouldDoInitialLoad() { if (role.is(Role.SENDER_BACKUP)) { // was backup. become primary sender role.next(Role.SENDER); if (state.is(State.LOADING)) { // previous loading was in progress. cancel and start from scratch state.next(State.NOT_LOADED); keyLoadFinished.setResult(false); } } return state.is(State.NOT_LOADED); } }
public class class_name { public boolean shouldDoInitialLoad() { if (role.is(Role.SENDER_BACKUP)) { // was backup. become primary sender role.next(Role.SENDER); // depends on control dependency: [if], data = [none] if (state.is(State.LOADING)) { // previous loading was in progress. cancel and start from scratch state.next(State.NOT_LOADED); // depends on control dependency: [if], data = [none] keyLoadFinished.setResult(false); // depends on control dependency: [if], data = [none] } } return state.is(State.NOT_LOADED); } }
public class class_name { private void calculateAccessibilityGraph(Iterable<BeanDeploymentArchiveImpl> beanDeploymentArchives) { for (BeanDeploymentArchiveImpl from : beanDeploymentArchives) { for (BeanDeploymentArchiveImpl target : beanDeploymentArchives) { if (from.isAccessible(target)) { from.addBeanDeploymentArchive(target); } } } } }
public class class_name { private void calculateAccessibilityGraph(Iterable<BeanDeploymentArchiveImpl> beanDeploymentArchives) { for (BeanDeploymentArchiveImpl from : beanDeploymentArchives) { for (BeanDeploymentArchiveImpl target : beanDeploymentArchives) { if (from.isAccessible(target)) { from.addBeanDeploymentArchive(target); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { @Override public void unbind(final Name dn, boolean recursive) { if (!recursive) { doUnbind(dn); } else { doUnbindRecursively(dn); } } }
public class class_name { @Override public void unbind(final Name dn, boolean recursive) { if (!recursive) { doUnbind(dn); // depends on control dependency: [if], data = [none] } else { doUnbindRecursively(dn); // depends on control dependency: [if], data = [none] } } }