code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { public void marshall(SqlStatementResult sqlStatementResult, ProtocolMarshaller protocolMarshaller) { if (sqlStatementResult == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(sqlStatementResult.getNumberOfRecordsUpdated(), NUMBEROFRECORDSUPDATED_BINDING); protocolMarshaller.marshall(sqlStatementResult.getResultFrame(), RESULTFRAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(SqlStatementResult sqlStatementResult, ProtocolMarshaller protocolMarshaller) { if (sqlStatementResult == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(sqlStatementResult.getNumberOfRecordsUpdated(), NUMBEROFRECORDSUPDATED_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(sqlStatementResult.getResultFrame(), RESULTFRAME_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 with(@javax.annotation.Nonnull final java.util.function.Consumer<T> f, final Predicate<T> filter) { final T prior = currentValue.get(); if (null != prior) { f.accept(prior); } else { final T poll = get(filter); try { currentValue.set(poll); f.accept(poll); } finally { this.pool.add(poll); currentValue.remove(); } } } }
public class class_name { public void with(@javax.annotation.Nonnull final java.util.function.Consumer<T> f, final Predicate<T> filter) { final T prior = currentValue.get(); if (null != prior) { f.accept(prior); // depends on control dependency: [if], data = [prior)] } else { final T poll = get(filter); try { currentValue.set(poll); // depends on control dependency: [try], data = [none] f.accept(poll); // depends on control dependency: [try], data = [none] } finally { this.pool.add(poll); currentValue.remove(); } } } }
public class class_name { private void checkTypeDeprecation(NodeTraversal t, Node n) { if (!shouldEmitDeprecationWarning(t, n)) { return; } ObjectType instanceType = n.getJSType().toMaybeFunctionType().getInstanceType(); String deprecationInfo = getTypeDeprecationInfo(instanceType); if (deprecationInfo == null) { return; } DiagnosticType message = deprecationInfo.isEmpty() ? DEPRECATED_CLASS : DEPRECATED_CLASS_REASON; compiler.report(JSError.make(n, message, instanceType.toString(), deprecationInfo)); } }
public class class_name { private void checkTypeDeprecation(NodeTraversal t, Node n) { if (!shouldEmitDeprecationWarning(t, n)) { return; // depends on control dependency: [if], data = [none] } ObjectType instanceType = n.getJSType().toMaybeFunctionType().getInstanceType(); String deprecationInfo = getTypeDeprecationInfo(instanceType); if (deprecationInfo == null) { return; // depends on control dependency: [if], data = [none] } DiagnosticType message = deprecationInfo.isEmpty() ? DEPRECATED_CLASS : DEPRECATED_CLASS_REASON; compiler.report(JSError.make(n, message, instanceType.toString(), deprecationInfo)); } }
public class class_name { public DfuServiceController start(@NonNull final Context context, @NonNull final Class<? extends DfuBaseService> service) { if (fileType == -1) throw new UnsupportedOperationException("You must specify the firmware file before starting the service"); final Intent intent = new Intent(context, service); intent.putExtra(DfuBaseService.EXTRA_DEVICE_ADDRESS, deviceAddress); intent.putExtra(DfuBaseService.EXTRA_DEVICE_NAME, deviceName); intent.putExtra(DfuBaseService.EXTRA_DISABLE_NOTIFICATION, disableNotification); intent.putExtra(DfuBaseService.EXTRA_FOREGROUND_SERVICE, startAsForegroundService); intent.putExtra(DfuBaseService.EXTRA_FILE_MIME_TYPE, mimeType); intent.putExtra(DfuBaseService.EXTRA_FILE_TYPE, fileType); intent.putExtra(DfuBaseService.EXTRA_FILE_URI, fileUri); intent.putExtra(DfuBaseService.EXTRA_FILE_PATH, filePath); intent.putExtra(DfuBaseService.EXTRA_FILE_RES_ID, fileResId); intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_URI, initFileUri); intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_PATH, initFilePath); intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_RES_ID, initFileResId); intent.putExtra(DfuBaseService.EXTRA_KEEP_BOND, keepBond); intent.putExtra(DfuBaseService.EXTRA_RESTORE_BOND, restoreBond); intent.putExtra(DfuBaseService.EXTRA_FORCE_DFU, forceDfu); intent.putExtra(DfuBaseService.EXTRA_DISABLE_RESUME, disableResume); intent.putExtra(DfuBaseService.EXTRA_MAX_DFU_ATTEMPTS, numberOfRetries); intent.putExtra(DfuBaseService.EXTRA_MBR_SIZE, mbrSize); if (mtu > 0) intent.putExtra(DfuBaseService.EXTRA_MTU, mtu); intent.putExtra(DfuBaseService.EXTRA_CURRENT_MTU, currentMtu); intent.putExtra(DfuBaseService.EXTRA_UNSAFE_EXPERIMENTAL_BUTTONLESS_DFU, enableUnsafeExperimentalButtonlessDfu); //noinspection StatementWithEmptyBody if (packetReceiptNotificationsEnabled != null) { intent.putExtra(DfuBaseService.EXTRA_PACKET_RECEIPT_NOTIFICATIONS_ENABLED, packetReceiptNotificationsEnabled); intent.putExtra(DfuBaseService.EXTRA_PACKET_RECEIPT_NOTIFICATIONS_VALUE, numberOfPackets); } else { // For backwards compatibility: // If the setPacketsReceiptNotificationsEnabled(boolean) has not been called, the PRN state and value are taken from // SharedPreferences the way they were read in DFU Library in 1.0.3 and before, or set to default values. // Default values: PRNs enabled on Android 4.3 - 5.1 and disabled starting from Android 6.0. Default PRN value is 12. } if (legacyDfuUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_LEGACY_DFU, legacyDfuUuids); if (secureDfuUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_SECURE_DFU, secureDfuUuids); if (experimentalButtonlessDfuUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_EXPERIMENTAL_BUTTONLESS_DFU, experimentalButtonlessDfuUuids); if (buttonlessDfuWithoutBondSharingUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_BUTTONLESS_DFU_WITHOUT_BOND_SHARING, buttonlessDfuWithoutBondSharingUuids); if (buttonlessDfuWithBondSharingUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_BUTTONLESS_DFU_WITH_BOND_SHARING, buttonlessDfuWithBondSharingUuids); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && startAsForegroundService) { // On Android Oreo and above the service must be started as a foreground service to make it accessible from // a killed application. context.startForegroundService(intent); } else { context.startService(intent); } return new DfuServiceController(context); } }
public class class_name { public DfuServiceController start(@NonNull final Context context, @NonNull final Class<? extends DfuBaseService> service) { if (fileType == -1) throw new UnsupportedOperationException("You must specify the firmware file before starting the service"); final Intent intent = new Intent(context, service); intent.putExtra(DfuBaseService.EXTRA_DEVICE_ADDRESS, deviceAddress); intent.putExtra(DfuBaseService.EXTRA_DEVICE_NAME, deviceName); intent.putExtra(DfuBaseService.EXTRA_DISABLE_NOTIFICATION, disableNotification); intent.putExtra(DfuBaseService.EXTRA_FOREGROUND_SERVICE, startAsForegroundService); intent.putExtra(DfuBaseService.EXTRA_FILE_MIME_TYPE, mimeType); intent.putExtra(DfuBaseService.EXTRA_FILE_TYPE, fileType); intent.putExtra(DfuBaseService.EXTRA_FILE_URI, fileUri); intent.putExtra(DfuBaseService.EXTRA_FILE_PATH, filePath); intent.putExtra(DfuBaseService.EXTRA_FILE_RES_ID, fileResId); intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_URI, initFileUri); intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_PATH, initFilePath); intent.putExtra(DfuBaseService.EXTRA_INIT_FILE_RES_ID, initFileResId); intent.putExtra(DfuBaseService.EXTRA_KEEP_BOND, keepBond); intent.putExtra(DfuBaseService.EXTRA_RESTORE_BOND, restoreBond); intent.putExtra(DfuBaseService.EXTRA_FORCE_DFU, forceDfu); intent.putExtra(DfuBaseService.EXTRA_DISABLE_RESUME, disableResume); intent.putExtra(DfuBaseService.EXTRA_MAX_DFU_ATTEMPTS, numberOfRetries); intent.putExtra(DfuBaseService.EXTRA_MBR_SIZE, mbrSize); if (mtu > 0) intent.putExtra(DfuBaseService.EXTRA_MTU, mtu); intent.putExtra(DfuBaseService.EXTRA_CURRENT_MTU, currentMtu); intent.putExtra(DfuBaseService.EXTRA_UNSAFE_EXPERIMENTAL_BUTTONLESS_DFU, enableUnsafeExperimentalButtonlessDfu); //noinspection StatementWithEmptyBody if (packetReceiptNotificationsEnabled != null) { intent.putExtra(DfuBaseService.EXTRA_PACKET_RECEIPT_NOTIFICATIONS_ENABLED, packetReceiptNotificationsEnabled); // depends on control dependency: [if], data = [none] intent.putExtra(DfuBaseService.EXTRA_PACKET_RECEIPT_NOTIFICATIONS_VALUE, numberOfPackets); // depends on control dependency: [if], data = [none] } else { // For backwards compatibility: // If the setPacketsReceiptNotificationsEnabled(boolean) has not been called, the PRN state and value are taken from // SharedPreferences the way they were read in DFU Library in 1.0.3 and before, or set to default values. // Default values: PRNs enabled on Android 4.3 - 5.1 and disabled starting from Android 6.0. Default PRN value is 12. } if (legacyDfuUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_LEGACY_DFU, legacyDfuUuids); if (secureDfuUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_SECURE_DFU, secureDfuUuids); if (experimentalButtonlessDfuUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_EXPERIMENTAL_BUTTONLESS_DFU, experimentalButtonlessDfuUuids); if (buttonlessDfuWithoutBondSharingUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_BUTTONLESS_DFU_WITHOUT_BOND_SHARING, buttonlessDfuWithoutBondSharingUuids); if (buttonlessDfuWithBondSharingUuids != null) intent.putExtra(DfuBaseService.EXTRA_CUSTOM_UUIDS_FOR_BUTTONLESS_DFU_WITH_BOND_SHARING, buttonlessDfuWithBondSharingUuids); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && startAsForegroundService) { // On Android Oreo and above the service must be started as a foreground service to make it accessible from // a killed application. context.startForegroundService(intent); // depends on control dependency: [if], data = [none] } else { context.startService(intent); // depends on control dependency: [if], data = [none] } return new DfuServiceController(context); } }
public class class_name { @Override public String tagKey(String key) { String sanitized = StringEscapeUtils.escapeJson(delegate.tagKey(key)); if (Character.isDigit(sanitized.charAt(0))) { sanitized = "m." + sanitized; } return sanitized; } }
public class class_name { @Override public String tagKey(String key) { String sanitized = StringEscapeUtils.escapeJson(delegate.tagKey(key)); if (Character.isDigit(sanitized.charAt(0))) { sanitized = "m." + sanitized; // depends on control dependency: [if], data = [none] } return sanitized; } }
public class class_name { public java.util.List<HostReservation> getHostReservationSet() { if (hostReservationSet == null) { hostReservationSet = new com.amazonaws.internal.SdkInternalList<HostReservation>(); } return hostReservationSet; } }
public class class_name { public java.util.List<HostReservation> getHostReservationSet() { if (hostReservationSet == null) { hostReservationSet = new com.amazonaws.internal.SdkInternalList<HostReservation>(); // depends on control dependency: [if], data = [none] } return hostReservationSet; } }
public class class_name { public void marshall(Edge edge, ProtocolMarshaller protocolMarshaller) { if (edge == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(edge.getReferenceId(), REFERENCEID_BINDING); protocolMarshaller.marshall(edge.getStartTime(), STARTTIME_BINDING); protocolMarshaller.marshall(edge.getEndTime(), ENDTIME_BINDING); protocolMarshaller.marshall(edge.getSummaryStatistics(), SUMMARYSTATISTICS_BINDING); protocolMarshaller.marshall(edge.getResponseTimeHistogram(), RESPONSETIMEHISTOGRAM_BINDING); protocolMarshaller.marshall(edge.getAliases(), ALIASES_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(Edge edge, ProtocolMarshaller protocolMarshaller) { if (edge == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(edge.getReferenceId(), REFERENCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(edge.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(edge.getEndTime(), ENDTIME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(edge.getSummaryStatistics(), SUMMARYSTATISTICS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(edge.getResponseTimeHistogram(), RESPONSETIMEHISTOGRAM_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(edge.getAliases(), ALIASES_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { private Optional<Long> getMaybeTaskLogReadOffset(final String slaveHostname, final String fullPath, final Long logLength, Optional<SingularityTask> task) { long offset = 0; long maxOffset = smtpConfiguration.get().getMaxTaskLogSearchOffset(); Optional<Pattern> maybePattern = getLogErrorRegex(task); Pattern pattern; if (maybePattern.isPresent()) { pattern = maybePattern.get(); } else { LOG.trace("Could not get regex pattern. Reading from bottom of file instead."); return getMaybeTaskLogEndOfFileOffset(slaveHostname, fullPath, logLength); } long length = logLength + pattern.toString().length(); // Get extra so that we can be sure to find the error Optional<MesosFileChunkObject> logChunkObject; Optional<MesosFileChunkObject> previous = Optional.absent(); while (offset <= maxOffset) { try { logChunkObject = sandboxManager.read(slaveHostname, fullPath, Optional.of(offset), Optional.of(length)); } catch (RuntimeException e) { LOG.error("Sandboxmanager failed to read {} on slave {}", fullPath, slaveHostname, e); return Optional.absent(); } if (logChunkObject.isPresent()) { if (logChunkObject.get().getData().equals("")) { // Passed end of file if (previous.isPresent()) { // If there was any log, get the bottom bytes of it long end = previous.get().getOffset() + previous.get().getData().length(); return Optional.of(end - logLength); } return Optional.absent(); } Matcher matcher = pattern.matcher(logChunkObject.get().getData()); if (matcher.find()) { return Optional.of(offset + matcher.start()); } else { offset += logLength; } } else { // Couldn't read anything LOG.error("Failed to read log file {}", fullPath); return Optional.absent(); } previous = logChunkObject; } LOG.trace("Searched through the first {} bytes of file {} and didn't find an error. Tailing bottom of file instead", maxOffset, fullPath); return getMaybeTaskLogEndOfFileOffset(slaveHostname, fullPath, logLength); } }
public class class_name { private Optional<Long> getMaybeTaskLogReadOffset(final String slaveHostname, final String fullPath, final Long logLength, Optional<SingularityTask> task) { long offset = 0; long maxOffset = smtpConfiguration.get().getMaxTaskLogSearchOffset(); Optional<Pattern> maybePattern = getLogErrorRegex(task); Pattern pattern; if (maybePattern.isPresent()) { pattern = maybePattern.get(); // depends on control dependency: [if], data = [none] } else { LOG.trace("Could not get regex pattern. Reading from bottom of file instead."); // depends on control dependency: [if], data = [none] return getMaybeTaskLogEndOfFileOffset(slaveHostname, fullPath, logLength); // depends on control dependency: [if], data = [none] } long length = logLength + pattern.toString().length(); // Get extra so that we can be sure to find the error Optional<MesosFileChunkObject> logChunkObject; Optional<MesosFileChunkObject> previous = Optional.absent(); while (offset <= maxOffset) { try { logChunkObject = sandboxManager.read(slaveHostname, fullPath, Optional.of(offset), Optional.of(length)); // depends on control dependency: [try], data = [none] } catch (RuntimeException e) { LOG.error("Sandboxmanager failed to read {} on slave {}", fullPath, slaveHostname, e); return Optional.absent(); } // depends on control dependency: [catch], data = [none] if (logChunkObject.isPresent()) { if (logChunkObject.get().getData().equals("")) { // Passed end of file if (previous.isPresent()) { // If there was any log, get the bottom bytes of it long end = previous.get().getOffset() + previous.get().getData().length(); return Optional.of(end - logLength); // depends on control dependency: [if], data = [none] } return Optional.absent(); // depends on control dependency: [if], data = [none] } Matcher matcher = pattern.matcher(logChunkObject.get().getData()); if (matcher.find()) { return Optional.of(offset + matcher.start()); // depends on control dependency: [if], data = [none] } else { offset += logLength; // depends on control dependency: [if], data = [none] } } else { // Couldn't read anything LOG.error("Failed to read log file {}", fullPath); // depends on control dependency: [if], data = [none] return Optional.absent(); // depends on control dependency: [if], data = [none] } previous = logChunkObject; // depends on control dependency: [while], data = [none] } LOG.trace("Searched through the first {} bytes of file {} and didn't find an error. Tailing bottom of file instead", maxOffset, fullPath); return getMaybeTaskLogEndOfFileOffset(slaveHostname, fullPath, logLength); } }
public class class_name { public int countBySQL(String sql, List<?> params) { Object[] args = null; if (params == null) { args = new Object[0]; } else { args = params.toArray(new Object[params.size()]); } return jdbcTemplate.queryForObject(sql, Integer.class, args); } }
public class class_name { public int countBySQL(String sql, List<?> params) { Object[] args = null; if (params == null) { args = new Object[0]; // depends on control dependency: [if], data = [none] } else { args = params.toArray(new Object[params.size()]); // depends on control dependency: [if], data = [none] } return jdbcTemplate.queryForObject(sql, Integer.class, args); } }
public class class_name { public static String encodeZeroPadding(int number, int maxNumDigits) { String integerString = Integer.toString(number); int numZeroes = maxNumDigits - integerString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + integerString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); } strBuffer.append(integerString); return strBuffer.toString(); } }
public class class_name { public static String encodeZeroPadding(int number, int maxNumDigits) { String integerString = Integer.toString(number); int numZeroes = maxNumDigits - integerString.length(); StringBuffer strBuffer = new StringBuffer(numZeroes + integerString.length()); for (int i = 0; i < numZeroes; i++) { strBuffer.insert(i, '0'); // depends on control dependency: [for], data = [i] } strBuffer.append(integerString); return strBuffer.toString(); } }
public class class_name { public CalendarYear plus(Years<CalendarUnit> years) { if (years.isEmpty()) { return this; } return CalendarYear.of(MathUtils.safeAdd(this.year, years.getAmount())); } }
public class class_name { public CalendarYear plus(Years<CalendarUnit> years) { if (years.isEmpty()) { return this; // depends on control dependency: [if], data = [none] } return CalendarYear.of(MathUtils.safeAdd(this.year, years.getAmount())); } }
public class class_name { protected URI doPostCreateMultipart(String path, FormDataMultiPart formDataMultiPart) throws ClientException { this.readLock.lock(); try { ClientResponse response = getResourceWrapper() .rewritten(path, HttpMethod.POST) .type(Boundary.addBoundary(MediaType.MULTIPART_FORM_DATA_TYPE)) .accept(MediaType.TEXT_PLAIN) .post(ClientResponse.class, formDataMultiPart); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED); try { return response.getLocation(); } finally { response.close(); } } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } } }
public class class_name { protected URI doPostCreateMultipart(String path, FormDataMultiPart formDataMultiPart) throws ClientException { this.readLock.lock(); try { ClientResponse response = getResourceWrapper() .rewritten(path, HttpMethod.POST) .type(Boundary.addBoundary(MediaType.MULTIPART_FORM_DATA_TYPE)) .accept(MediaType.TEXT_PLAIN) .post(ClientResponse.class, formDataMultiPart); errorIfStatusNotEqualTo(response, ClientResponse.Status.OK, ClientResponse.Status.CREATED); try { return response.getLocation(); // depends on control dependency: [try], data = [none] } finally { response.close(); } } catch (ClientHandlerException ex) { throw new ClientException(ClientResponse.Status.INTERNAL_SERVER_ERROR, ex.getMessage()); } finally { this.readLock.unlock(); } } }
public class class_name { public int getPositionForView(View view) { View listItem = view; try { View v; while (!(v = (View) listItem.getParent()).equals(this)) { listItem = v; } } catch (ClassCastException e) { // We made it up to the window without find this list view return INVALID_POSITION; } // Search the children for the list item final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { if (getChildAt(i).equals(listItem)) { return mFirstPosition + i; } } // Child not found! return INVALID_POSITION; } }
public class class_name { public int getPositionForView(View view) { View listItem = view; try { View v; while (!(v = (View) listItem.getParent()).equals(this)) { listItem = v; // depends on control dependency: [while], data = [none] } } catch (ClassCastException e) { // We made it up to the window without find this list view return INVALID_POSITION; } // depends on control dependency: [catch], data = [none] // Search the children for the list item final int childCount = getChildCount(); for (int i = 0; i < childCount; i++) { if (getChildAt(i).equals(listItem)) { return mFirstPosition + i; // depends on control dependency: [if], data = [none] } } // Child not found! return INVALID_POSITION; } }
public class class_name { public void setTranEnlistmentNotNeeded(int reason) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "MEF.setTranEnlistmentNotNeeded for enterprise class " + beanMetaData.enterpriseBeanName + ", reason = " + reason); } ivEnlistNotNeeded = true; ivEnlistNotNeededReason = reason; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "MEF.setTranEnlistmentNotNeeded for enterprise class " + beanMetaData.enterpriseBeanName); } } }
public class class_name { public void setTranEnlistmentNotNeeded(int reason) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "MEF.setTranEnlistmentNotNeeded for enterprise class " + beanMetaData.enterpriseBeanName + ", reason = " + reason); // depends on control dependency: [if], data = [none] } ivEnlistNotNeeded = true; ivEnlistNotNeededReason = reason; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "MEF.setTranEnlistmentNotNeeded for enterprise class " + beanMetaData.enterpriseBeanName); // depends on control dependency: [if], data = [none] } } }
public class class_name { static protected void resolveUsingExpressions(List<VoltXMLElement> elements, RangeVariable[] rvs) throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException { for (VoltXMLElement element : elements) { String table = null; String tableAlias = null; boolean isFullJoin = false; assert(element.hasValue("optype", "operator_case_when")); String column = element.attributes.get("column"); for (RangeVariable rv : rvs) { if (!rv.getTable().columnList.containsKey(column)) { // The column is not from this table. Skip it continue; } // If there is an OUTER join we need to pick the outer table if (rv.isRightJoin == true) { if (rv.isLeftJoin == true) { // this is a full join. No need to do anything isFullJoin = true; } else { // this is the outer table. no need to search // further. table = rv.getTable().getName().name; if (rv.tableAlias != null) { tableAlias = rv.tableAlias.name; } else { tableAlias = null; } } break; } else if (rv.isLeftJoin == false) { // it's the inner join. we found the table but still need to iterate // just in case there is an outer table we haven't seen yet. table = rv.getTable().getName().name; if (rv.tableAlias != null) { tableAlias = rv.tableAlias.name; } else { tableAlias = null; } } } if (isFullJoin) { continue; } if (table != null) { collapseCoalesceExpression(element, table, tableAlias); } } } }
public class class_name { static protected void resolveUsingExpressions(List<VoltXMLElement> elements, RangeVariable[] rvs) throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException { for (VoltXMLElement element : elements) { String table = null; String tableAlias = null; boolean isFullJoin = false; assert(element.hasValue("optype", "operator_case_when")); String column = element.attributes.get("column"); for (RangeVariable rv : rvs) { if (!rv.getTable().columnList.containsKey(column)) { // The column is not from this table. Skip it continue; } // If there is an OUTER join we need to pick the outer table if (rv.isRightJoin == true) { if (rv.isLeftJoin == true) { // this is a full join. No need to do anything isFullJoin = true; // depends on control dependency: [if], data = [none] } else { // this is the outer table. no need to search // further. table = rv.getTable().getName().name; // depends on control dependency: [if], data = [none] if (rv.tableAlias != null) { tableAlias = rv.tableAlias.name; // depends on control dependency: [if], data = [none] } else { tableAlias = null; // depends on control dependency: [if], data = [none] } } break; } else if (rv.isLeftJoin == false) { // it's the inner join. we found the table but still need to iterate // just in case there is an outer table we haven't seen yet. table = rv.getTable().getName().name; // depends on control dependency: [if], data = [none] if (rv.tableAlias != null) { tableAlias = rv.tableAlias.name; // depends on control dependency: [if], data = [none] } else { tableAlias = null; // depends on control dependency: [if], data = [none] } } } if (isFullJoin) { continue; } if (table != null) { collapseCoalesceExpression(element, table, tableAlias); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void fatal(final Object message, final Throwable t) { if (MINIMUM_LEVEL_COVERS_ERROR) { provider.log(STACKTRACE_DEPTH, null, org.tinylog.Level.ERROR, t, message == t ? null : message, (Object[]) null); } } }
public class class_name { public void fatal(final Object message, final Throwable t) { if (MINIMUM_LEVEL_COVERS_ERROR) { provider.log(STACKTRACE_DEPTH, null, org.tinylog.Level.ERROR, t, message == t ? null : message, (Object[]) null); // depends on control dependency: [if], data = [none] } } }
public class class_name { private long addStopwatchSplit(Stopwatch stopwatch) { Split split = stopwatch.start(); try { randomWait(50, 150); } finally { split.stop(); } return split.runningFor() / SimonClock.NANOS_IN_MILLIS; } }
public class class_name { private long addStopwatchSplit(Stopwatch stopwatch) { Split split = stopwatch.start(); try { randomWait(50, 150); // depends on control dependency: [try], data = [none] } finally { split.stop(); } return split.runningFor() / SimonClock.NANOS_IN_MILLIS; } }
public class class_name { public E poll() { Object owner; if (transactional) { owner = TxManager.getCurrentSession(); } else { owner = null; } // Attempt to acquire an available element from the queue for the current transaction. return pollAccept(owner); } }
public class class_name { public E poll() { Object owner; if (transactional) { owner = TxManager.getCurrentSession(); // depends on control dependency: [if], data = [none] } else { owner = null; // depends on control dependency: [if], data = [none] } // Attempt to acquire an available element from the queue for the current transaction. return pollAccept(owner); } }
public class class_name { public static AccessToken createFromExistingAccessToken(String accessToken, Date expirationTime, Date lastRefreshTime, AccessTokenSource accessTokenSource, List<String> permissions) { if (expirationTime == null) { expirationTime = DEFAULT_EXPIRATION_TIME; } if (lastRefreshTime == null) { lastRefreshTime = DEFAULT_LAST_REFRESH_TIME; } if (accessTokenSource == null) { accessTokenSource = DEFAULT_ACCESS_TOKEN_SOURCE; } return new AccessToken(accessToken, expirationTime, permissions, null, accessTokenSource, lastRefreshTime); } }
public class class_name { public static AccessToken createFromExistingAccessToken(String accessToken, Date expirationTime, Date lastRefreshTime, AccessTokenSource accessTokenSource, List<String> permissions) { if (expirationTime == null) { expirationTime = DEFAULT_EXPIRATION_TIME; // depends on control dependency: [if], data = [none] } if (lastRefreshTime == null) { lastRefreshTime = DEFAULT_LAST_REFRESH_TIME; // depends on control dependency: [if], data = [none] } if (accessTokenSource == null) { accessTokenSource = DEFAULT_ACCESS_TOKEN_SOURCE; // depends on control dependency: [if], data = [none] } return new AccessToken(accessToken, expirationTime, permissions, null, accessTokenSource, lastRefreshTime); } }
public class class_name { void showVariationsWindow(String resource) { final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max); CmsVariationsDialog variationsDialog = new CmsVariationsDialog(resource, new Runnable() { public void run() { window.close(); } }, Mode.ImageCache); try { CmsResource resourceObject = getRootCms().readResource(resource); variationsDialog.displayResourceInfo(Collections.singletonList(resourceObject)); } catch (CmsException e) { // } window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_VIEW_FLEX_VARIATIONS_1, resource)); window.setContent(variationsDialog); A_CmsUI.get().addWindow(window); window.center(); } }
public class class_name { void showVariationsWindow(String resource) { final Window window = CmsBasicDialog.prepareWindow(DialogWidth.max); CmsVariationsDialog variationsDialog = new CmsVariationsDialog(resource, new Runnable() { public void run() { window.close(); } }, Mode.ImageCache); try { CmsResource resourceObject = getRootCms().readResource(resource); variationsDialog.displayResourceInfo(Collections.singletonList(resourceObject)); // depends on control dependency: [try], data = [none] } catch (CmsException e) { // } // depends on control dependency: [catch], data = [none] window.setCaption(CmsVaadinUtils.getMessageText(Messages.GUI_CACHE_VIEW_FLEX_VARIATIONS_1, resource)); window.setContent(variationsDialog); A_CmsUI.get().addWindow(window); window.center(); } }
public class class_name { public static void checkOptional(OptionSet options, List<String> opts) throws VoldemortException { List<String> optCopy = Lists.newArrayList(); for(String opt: opts) { if(options.has(opt)) { optCopy.add(opt); } } if(optCopy.size() > 1) { System.err.println("Conflicting options:"); for(String opt: optCopy) { System.err.println("--" + opt); } throw new VoldemortException("Conflicting options detected."); } } }
public class class_name { public static void checkOptional(OptionSet options, List<String> opts) throws VoldemortException { List<String> optCopy = Lists.newArrayList(); for(String opt: opts) { if(options.has(opt)) { optCopy.add(opt); // depends on control dependency: [if], data = [none] } } if(optCopy.size() > 1) { System.err.println("Conflicting options:"); for(String opt: optCopy) { System.err.println("--" + opt); } throw new VoldemortException("Conflicting options detected."); } } }
public class class_name { void addToSubroutine(final long id, final int nbSubroutines) { if ((status & VISITED) == 0) { status |= VISITED; srcAndRefPositions = new int[nbSubroutines / 32 + 1]; } srcAndRefPositions[(int) (id >>> 32)] |= (int) id; } }
public class class_name { void addToSubroutine(final long id, final int nbSubroutines) { if ((status & VISITED) == 0) { status |= VISITED; // depends on control dependency: [if], data = [none] srcAndRefPositions = new int[nbSubroutines / 32 + 1]; // depends on control dependency: [if], data = [none] } srcAndRefPositions[(int) (id >>> 32)] |= (int) id; } }
public class class_name { public CommonsQueryCountLoggingServletFilter buildCommonsFilter(CommonsLogLevel logLevel) { if (logLevel != null) { this.commonsLogLevel = logLevel; } CommonsQueryCountLoggingServletFilter filter = new CommonsQueryCountLoggingServletFilter(); if (this.commonsLogLevel != null) { filter.setLogLevel(this.commonsLogLevel); } filter.setWriteAsJson(this.writeAsJson); return filter; } }
public class class_name { public CommonsQueryCountLoggingServletFilter buildCommonsFilter(CommonsLogLevel logLevel) { if (logLevel != null) { this.commonsLogLevel = logLevel; // depends on control dependency: [if], data = [none] } CommonsQueryCountLoggingServletFilter filter = new CommonsQueryCountLoggingServletFilter(); if (this.commonsLogLevel != null) { filter.setLogLevel(this.commonsLogLevel); // depends on control dependency: [if], data = [(this.commonsLogLevel] } filter.setWriteAsJson(this.writeAsJson); return filter; } }
public class class_name { public void addIgnoreFieldAnnotation( Class annotationClass ) { if( annotationClass != null && !ignoreFieldAnnotations.contains( annotationClass.getName() )) { ignoreFieldAnnotations.add(annotationClass.getName()); } } }
public class class_name { public void addIgnoreFieldAnnotation( Class annotationClass ) { if( annotationClass != null && !ignoreFieldAnnotations.contains( annotationClass.getName() )) { ignoreFieldAnnotations.add(annotationClass.getName()); // depends on control dependency: [if], data = [none] } } }
public class class_name { private Object evalInternal( Selector sel, MatchSpaceKey bind, EvalCache cache, Object contextValue, boolean permissive) throws BadMessageFormatMatchingException { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "evalInternal", new Object[] { sel, bind, cache, contextValue, new Boolean(permissive) }); Object theReturn = null; // If sel is a literal, its value is simply the literal's value if (sel instanceof Literal) { if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector is a literal"); theReturn = ((Literal) sel).getValue(); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } // If sel is an Identifier, we let the MatchSpaceKey evaluate it. The MatchSpaceKey is // given explicit type information unless the evaluation mode is permissive, in which // case the value is retrieved regardless and the permissive casts are applied. if (sel instanceof Identifier) { if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector is an Identifier"); Identifier id = (Identifier) sel; if (permissive && id.getType() != Selector.UNKNOWN) { // Result may require permissive mode casts. First, get the value, whatever it // is. boolean returnList = true; if(id.getType() == Selector.BOOLEAN) returnList = false; Object idVal = bind.getIdentifierValue(id, true, contextValue, returnList); // true means return a nodelist if (idVal == null) { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } // Perform permissive casts switch (id.getType()) { case Selector.NUMERIC : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is numeric"); if (idVal instanceof Number) // was NumericValue { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", idVal); return idVal; } else { if(idVal instanceof ArrayList) { theReturn = castToNumberList((ArrayList)idVal); } else theReturn = castToNumber(idVal); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } case Selector.STRING : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is string"); if (idVal instanceof String) { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", idVal); return idVal; } else { if(idVal instanceof ArrayList) { theReturn = castToStringList((ArrayList)idVal); } else theReturn = idVal.toString(); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } case Selector.BOOLEAN : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is boolean"); if (idVal instanceof Boolean) // was BooleanValue { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", idVal); return idVal; } else { theReturn = castToBoolean(idVal); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } default : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is default"); // Normally, permissive mode evaluation would not apply to TOPIC and OBJECT // Identifiers. But, in any case, there are no valid casts to those types. if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } } else { // not permissive, or the type is UNKNOWN so no permissive mode casts apply boolean returnList = true; if(id.getType() == Selector.BOOLEAN) returnList = false; theReturn = bind.getIdentifierValue(id, false, contextValue, returnList); // true means return a nodelist if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } } // Otherwise, it's an Operator Operator op = (Operator) sel; if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector is an operator"); // Evaluate the operands to obtain the values needed to evaluate the operator Object val0 = eval(op.getOperands()[0], bind, cache, contextValue, permissive); // was false Object val1 = (op.getOperands().length == 1) ? null : eval(op.getOperands()[1], bind, cache, contextValue, permissive); // was false // Evaluate according to the operator switch (op.getOp()) { case Selector.NOT : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is NOT"); if (val0 instanceof Boolean) { theReturn = not((Boolean) val0); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } else if (permissive && val0 != null) { theReturn = not(castToBoolean(val0)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } else { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } case Selector.NEG : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is NEG"); if (!(val0 instanceof Number)) // was NumericValue if (permissive && val0 != null) { val0 = castToNumber(val0); if (val0 == null) { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } } else { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } // val0 is now definitely a Number return neg((Number)val0); case Selector.ISNULL : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type ISNULL"); theReturn = Boolean.valueOf(val0 == null); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.LIKE : case Selector.TOPIC_LIKE: if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is LIKE"); if (!(val0 instanceof String)) if (permissive && val0 != null) val0 = val0.toString(); else { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } // val0 is a String theReturn = Boolean.valueOf(((LikeOperatorImpl) op) .getInternalPattern().match((String) val0)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.NE : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is NE"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, false); else theReturn = not(compare(val0, val1, false, permissive)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.EQ : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is EQ"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, true); else theReturn = compare(val0, val1, false, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.GT : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is GT"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, true); else theReturn = compare(val1, val0, true, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.LT : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is LT"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, true); else theReturn = compare(val0, val1, true, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.GE : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is GE"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, false); else theReturn = not(compare(val0, val1, true, permissive)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.LE : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is LE"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, false); else theReturn = not(compare(val1, val0, true, permissive)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.PLUS : case Selector.MINUS : case Selector.TIMES : case Selector.DIV : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is ARITHMETIC"); theReturn = promoteAndEvaluate(op.getOp(), val0, val1, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.AND : case Selector.OR : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is ANDOR"); if (!(val0 instanceof Boolean)) // was BooleanValue if (permissive && val0 != null) val0 = castToBoolean(val0); if (!(val1 instanceof Boolean)) // was BooleanValue if (permissive && val1 != null) val1 = castToBoolean(val1); if (op.getOp() == Operator.AND) theReturn = and((Boolean) val0, (Boolean) val1); else theReturn = or((Boolean) val0, (Boolean) val1); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; default : // Should not occur if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is DEFAULT"); throw new IllegalStateException(); } } }
public class class_name { private Object evalInternal( Selector sel, MatchSpaceKey bind, EvalCache cache, Object contextValue, boolean permissive) throws BadMessageFormatMatchingException { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.entry(cclass, "evalInternal", new Object[] { sel, bind, cache, contextValue, new Boolean(permissive) }); Object theReturn = null; // If sel is a literal, its value is simply the literal's value if (sel instanceof Literal) { if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector is a literal"); theReturn = ((Literal) sel).getValue(); // depends on control dependency: [if], data = [none] if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; // depends on control dependency: [if], data = [none] } // If sel is an Identifier, we let the MatchSpaceKey evaluate it. The MatchSpaceKey is // given explicit type information unless the evaluation mode is permissive, in which // case the value is retrieved regardless and the permissive casts are applied. if (sel instanceof Identifier) { if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector is an Identifier"); Identifier id = (Identifier) sel; if (permissive && id.getType() != Selector.UNKNOWN) { // Result may require permissive mode casts. First, get the value, whatever it // is. boolean returnList = true; if(id.getType() == Selector.BOOLEAN) returnList = false; Object idVal = bind.getIdentifierValue(id, true, contextValue, returnList); // true means return a nodelist if (idVal == null) { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; // depends on control dependency: [if], data = [none] } // Perform permissive casts switch (id.getType()) { case Selector.NUMERIC : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is numeric"); if (idVal instanceof Number) // was NumericValue { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", idVal); return idVal; // depends on control dependency: [if], data = [none] } else { if(idVal instanceof ArrayList) { theReturn = castToNumberList((ArrayList)idVal); // depends on control dependency: [if], data = [none] } else theReturn = castToNumber(idVal); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; // depends on control dependency: [if], data = [none] } case Selector.STRING : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is string"); if (idVal instanceof String) { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", idVal); return idVal; // depends on control dependency: [if], data = [none] } else { if(idVal instanceof ArrayList) { theReturn = castToStringList((ArrayList)idVal); // depends on control dependency: [if], data = [none] } else theReturn = idVal.toString(); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; // depends on control dependency: [if], data = [none] } case Selector.BOOLEAN : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is boolean"); if (idVal instanceof Boolean) // was BooleanValue { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", idVal); return idVal; // depends on control dependency: [if], data = [none] } else { theReturn = castToBoolean(idVal); // depends on control dependency: [if], data = [none] if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; // depends on control dependency: [if], data = [none] } default : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is default"); // Normally, permissive mode evaluation would not apply to TOPIC and OBJECT // Identifiers. But, in any case, there are no valid casts to those types. if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; // depends on control dependency: [if], data = [none] } } else { // not permissive, or the type is UNKNOWN so no permissive mode casts apply boolean returnList = true; if(id.getType() == Selector.BOOLEAN) returnList = false; theReturn = bind.getIdentifierValue(id, false, contextValue, returnList); // true means return a nodelist // depends on control dependency: [if], data = [none] if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; // depends on control dependency: [if], data = [none] } } // Otherwise, it's an Operator Operator op = (Operator) sel; if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector is an operator"); // Evaluate the operands to obtain the values needed to evaluate the operator Object val0 = eval(op.getOperands()[0], bind, cache, contextValue, permissive); // was false Object val1 = (op.getOperands().length == 1) ? null : eval(op.getOperands()[1], bind, cache, contextValue, permissive); // was false // Evaluate according to the operator switch (op.getOp()) { case Selector.NOT : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is NOT"); if (val0 instanceof Boolean) { theReturn = not((Boolean) val0); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } else if (permissive && val0 != null) { theReturn = not(castToBoolean(val0)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; } else { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } case Selector.NEG : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is NEG"); if (!(val0 instanceof Number)) // was NumericValue if (permissive && val0 != null) { val0 = castToNumber(val0); if (val0 == null) { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; // depends on control dependency: [if], data = [none] } } else { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } // val0 is now definitely a Number return neg((Number)val0); case Selector.ISNULL : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type ISNULL"); theReturn = Boolean.valueOf(val0 == null); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.LIKE : case Selector.TOPIC_LIKE: if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is LIKE"); if (!(val0 instanceof String)) if (permissive && val0 != null) val0 = val0.toString(); else { if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", null); return null; } // val0 is a String theReturn = Boolean.valueOf(((LikeOperatorImpl) op) .getInternalPattern().match((String) val0)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.NE : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is NE"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, false); else theReturn = not(compare(val0, val1, false, permissive)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.EQ : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is EQ"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, true); else theReturn = compare(val0, val1, false, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.GT : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is GT"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, true); else theReturn = compare(val1, val0, true, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.LT : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is LT"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, true); else theReturn = compare(val0, val1, true, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.GE : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is GE"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, false); else theReturn = not(compare(val0, val1, true, permissive)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.LE : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is LE"); if(val0 instanceof ArrayList) theReturn = compareList((ArrayList)val0, val1, false, permissive, false); else theReturn = not(compare(val1, val0, true, permissive)); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.PLUS : case Selector.MINUS : case Selector.TIMES : case Selector.DIV : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is ARITHMETIC"); theReturn = promoteAndEvaluate(op.getOp(), val0, val1, permissive); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; case Selector.AND : case Selector.OR : if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is ANDOR"); if (!(val0 instanceof Boolean)) // was BooleanValue if (permissive && val0 != null) val0 = castToBoolean(val0); if (!(val1 instanceof Boolean)) // was BooleanValue if (permissive && val1 != null) val1 = castToBoolean(val1); if (op.getOp() == Operator.AND) theReturn = and((Boolean) val0, (Boolean) val1); else theReturn = or((Boolean) val0, (Boolean) val1); if (tc.isAnyTracingEnabled() && tc.isEntryEnabled()) tc.exit(cclass, "evalInternal", theReturn); return theReturn; default : // Should not occur if (tc.isAnyTracingEnabled() && tc.isDebugEnabled()) tc.debug(cclass, "Selector type is DEFAULT"); throw new IllegalStateException(); } } }
public class class_name { private ListenerTarget getLinearTarget(final Listener listener) { ListenerTarget target = targets.get(listener); if (target == null) { target = new ListenerTarget(listener); targets.put(listener, target); } return target; } }
public class class_name { private ListenerTarget getLinearTarget(final Listener listener) { ListenerTarget target = targets.get(listener); if (target == null) { target = new ListenerTarget(listener); // depends on control dependency: [if], data = [none] targets.put(listener, target); // depends on control dependency: [if], data = [none] } return target; } }
public class class_name { public Map<String, String> getUriVariablesForCorpNotes(Integer clientCorporationID, Set<String> fieldSet, CorpNotesParams params) { if (params == null) { params = ParamFactory.corpNotesParams(); } Map<String, String> uriVariables = params.getParameterMap(); String bhRestToken = bullhornApiRest.getBhRestToken(); uriVariables.put(BH_REST_TOKEN, bhRestToken); String fields = this.convertFieldSetToString(fieldSet); uriVariables.put(FIELDS, fields); uriVariables.put(CLIENT_CORP_ID, clientCorporationID.toString()); return uriVariables; } }
public class class_name { public Map<String, String> getUriVariablesForCorpNotes(Integer clientCorporationID, Set<String> fieldSet, CorpNotesParams params) { if (params == null) { params = ParamFactory.corpNotesParams(); // depends on control dependency: [if], data = [none] } Map<String, String> uriVariables = params.getParameterMap(); String bhRestToken = bullhornApiRest.getBhRestToken(); uriVariables.put(BH_REST_TOKEN, bhRestToken); String fields = this.convertFieldSetToString(fieldSet); uriVariables.put(FIELDS, fields); uriVariables.put(CLIENT_CORP_ID, clientCorporationID.toString()); return uriVariables; } }
public class class_name { public static Cells getCellFromJson(JSONObject Json, String tableName) throws IllegalAccessException, InstantiationException, InvocationTargetException { Cells cells = tableName != null ? new Cells(tableName) : new Cells(); Set<String> entrySet = Json.keySet(); for (String key : entrySet) { try { Object value = Json.get(key); if (List.class.isAssignableFrom(value.getClass())) { List<Cells> innerCell = new ArrayList<>(); for (JSONObject innerBson : (List<JSONObject>) value) { innerCell.add(getCellFromJson(innerBson, null)); } cells.add(Cell.create(key, innerCell)); } else if (JSONObject.class.isAssignableFrom(value.getClass())) { Cells innerCells = getCellFromJson((JSONObject) value, null); cells.add(Cell.create(key, innerCells)); } else { if (key.equalsIgnoreCase("id")) { cells.add(Cell.create(key, value, true)); } else { cells.add(Cell.create(key, value)); } } } catch (IllegalAccessException | InstantiationException | InvocationTargetException | IllegalArgumentException e) { LOG.error("impossible to create a java cell from Json field:"+key); } } return cells; } }
public class class_name { public static Cells getCellFromJson(JSONObject Json, String tableName) throws IllegalAccessException, InstantiationException, InvocationTargetException { Cells cells = tableName != null ? new Cells(tableName) : new Cells(); Set<String> entrySet = Json.keySet(); for (String key : entrySet) { try { Object value = Json.get(key); if (List.class.isAssignableFrom(value.getClass())) { List<Cells> innerCell = new ArrayList<>(); for (JSONObject innerBson : (List<JSONObject>) value) { innerCell.add(getCellFromJson(innerBson, null)); // depends on control dependency: [for], data = [innerBson] } cells.add(Cell.create(key, innerCell)); // depends on control dependency: [if], data = [none] } else if (JSONObject.class.isAssignableFrom(value.getClass())) { Cells innerCells = getCellFromJson((JSONObject) value, null); cells.add(Cell.create(key, innerCells)); // depends on control dependency: [if], data = [none] } else { if (key.equalsIgnoreCase("id")) { cells.add(Cell.create(key, value, true)); // depends on control dependency: [if], data = [none] } else { cells.add(Cell.create(key, value)); // depends on control dependency: [if], data = [none] } } } catch (IllegalAccessException | InstantiationException | InvocationTargetException | IllegalArgumentException e) { LOG.error("impossible to create a java cell from Json field:"+key); } // depends on control dependency: [catch], data = [none] } return cells; } }
public class class_name { public boolean addVersion(String cluster, String user, String appId, String version, long timestamp) throws IOException { boolean updated = false; // check if the version already exists byte[] rowKey = getRowKey(cluster, user, appId); byte[] versionCol = Bytes.toBytes(version); int attempts = 0; // retry up to this many times for checkAndPut failures int maxAttempts = 3; boolean checkForUpdate = true; while (checkForUpdate && attempts < maxAttempts) { attempts++; // values for conditional update Put p = null; byte[] expectedValue = null; Get get = new Get(rowKey); get.addColumn(Constants.INFO_FAM_BYTES, versionCol); Table versionsTable = null; try { versionsTable = hbaseConnection .getTable(TableName.valueOf(Constants.HISTORY_APP_VERSION_TABLE)); Result r = versionsTable.get(get); if (r != null && !r.isEmpty()) { byte[] storedValue = r.getValue(Constants.INFO_FAM_BYTES, versionCol); long storedTS = Bytes.toLong(storedValue); if (timestamp < storedTS) { // update the stored timestamp to our earlier value p = new Put(rowKey); p.addColumn(Constants.INFO_FAM_BYTES, versionCol, Bytes.toBytes(timestamp)); expectedValue = storedValue; } else { // version exists and exceeds our value, no update necessary checkForUpdate = false; } } else { // no stored value p = new Put(rowKey); p.addColumn(Constants.INFO_FAM_BYTES, versionCol, Bytes.toBytes(timestamp)); } if (p != null) { // we have an updated value to add updated = versionsTable.checkAndPut(rowKey, Constants.INFO_FAM_BYTES, versionCol, expectedValue, p); checkForUpdate = !updated; if (!updated) { LOG.warn("Update of cluster=" + cluster + ", user=" + user + ", app=" + appId + ", version=" + version + " to timestamp " + timestamp + " failed because currently set value changed!" + " (attempt " + attempts + " of " + maxAttempts + ")"); } } } finally { if (versionsTable != null) { versionsTable.close(); } } } return updated; } }
public class class_name { public boolean addVersion(String cluster, String user, String appId, String version, long timestamp) throws IOException { boolean updated = false; // check if the version already exists byte[] rowKey = getRowKey(cluster, user, appId); byte[] versionCol = Bytes.toBytes(version); int attempts = 0; // retry up to this many times for checkAndPut failures int maxAttempts = 3; boolean checkForUpdate = true; while (checkForUpdate && attempts < maxAttempts) { attempts++; // values for conditional update Put p = null; byte[] expectedValue = null; Get get = new Get(rowKey); get.addColumn(Constants.INFO_FAM_BYTES, versionCol); Table versionsTable = null; try { versionsTable = hbaseConnection .getTable(TableName.valueOf(Constants.HISTORY_APP_VERSION_TABLE)); Result r = versionsTable.get(get); if (r != null && !r.isEmpty()) { byte[] storedValue = r.getValue(Constants.INFO_FAM_BYTES, versionCol); long storedTS = Bytes.toLong(storedValue); if (timestamp < storedTS) { // update the stored timestamp to our earlier value p = new Put(rowKey); // depends on control dependency: [if], data = [none] p.addColumn(Constants.INFO_FAM_BYTES, versionCol, Bytes.toBytes(timestamp)); // depends on control dependency: [if], data = [none] expectedValue = storedValue; // depends on control dependency: [if], data = [none] } else { // version exists and exceeds our value, no update necessary checkForUpdate = false; // depends on control dependency: [if], data = [none] } } else { // no stored value p = new Put(rowKey); // depends on control dependency: [if], data = [(r] p.addColumn(Constants.INFO_FAM_BYTES, versionCol, Bytes.toBytes(timestamp)); // depends on control dependency: [if], data = [none] } if (p != null) { // we have an updated value to add updated = versionsTable.checkAndPut(rowKey, Constants.INFO_FAM_BYTES, versionCol, expectedValue, p); checkForUpdate = !updated; if (!updated) { LOG.warn("Update of cluster=" + cluster + ", user=" + user + ", app=" + appId + ", version=" + version + " to timestamp " + timestamp + " failed because currently set value changed!" + " (attempt " + attempts + " of " + maxAttempts + ")"); } } } finally { if (versionsTable != null) { versionsTable.close(); } } } return updated; } }
public class class_name { public static File createFileBalancingDirectoryDescriptor(File workingDirectory, String fileName, int depth, int cellWidth) { if (depth < 0) { throw new IllegalArgumentException("depth must be greater or equal to 0"); } if (cellWidth < 1) { throw new IllegalArgumentException("cellWidth must be greater or equal to 1"); } if (fileName.length() < (depth * cellWidth)) { throw new IllegalArgumentException("fileName must be at least " + (depth * cellWidth) + " chars, has only " + fileName.length() + " [" + fileName + "]."); } int _subNameLength = cellWidth; File _targetFile = workingDirectory; for (int _level = 0; _level < depth; _level++) { _targetFile = new File(_targetFile, fileName.substring(0, _subNameLength)); _subNameLength += cellWidth; } return _targetFile; } }
public class class_name { public static File createFileBalancingDirectoryDescriptor(File workingDirectory, String fileName, int depth, int cellWidth) { if (depth < 0) { throw new IllegalArgumentException("depth must be greater or equal to 0"); } if (cellWidth < 1) { throw new IllegalArgumentException("cellWidth must be greater or equal to 1"); } if (fileName.length() < (depth * cellWidth)) { throw new IllegalArgumentException("fileName must be at least " + (depth * cellWidth) + " chars, has only " + fileName.length() + " [" + fileName + "]."); } int _subNameLength = cellWidth; File _targetFile = workingDirectory; for (int _level = 0; _level < depth; _level++) { _targetFile = new File(_targetFile, fileName.substring(0, _subNameLength)); // depends on control dependency: [for], data = [none] _subNameLength += cellWidth; // depends on control dependency: [for], data = [none] } return _targetFile; } }
public class class_name { private boolean isGetterOrSetter(Method method) { try { String methodName = method.getName(); return methodName.startsWith("get") || methodName.startsWith("is") || methodName.startsWith("set") || "clearWarnings".equals(methodName); } catch (Exception ex) { return false; // just in case, better be safe than sorry } } }
public class class_name { private boolean isGetterOrSetter(Method method) { try { String methodName = method.getName(); return methodName.startsWith("get") || methodName.startsWith("is") || methodName.startsWith("set") || "clearWarnings".equals(methodName); // depends on control dependency: [try], data = [none] } catch (Exception ex) { return false; // just in case, better be safe than sorry } // depends on control dependency: [catch], data = [none] } }
public class class_name { private <T> Map<String, Object> digMaps(Class<T> requiredType) { Map<String, Object> all = new HashMap<String, Object>(); Set<Class> keys = services.keySet(); for (Class serviceClass : keys) { if (requiredType.isAssignableFrom(serviceClass)) { //如果出现子类型中的服务与已有存在的冲突了怎么办? Map<String, Object> map = services.get(serviceClass); for (String key : map.keySet()) { Object service = map.get(key); Object exist = all.get(key); if (exist != null) { int n = 1; String newKey; do { newKey = key + "#" + n++; } while (all.containsKey(newKey)); all.put(newKey, service); } else { all.put(key, service); } } } } return all; } }
public class class_name { private <T> Map<String, Object> digMaps(Class<T> requiredType) { Map<String, Object> all = new HashMap<String, Object>(); Set<Class> keys = services.keySet(); for (Class serviceClass : keys) { if (requiredType.isAssignableFrom(serviceClass)) { //如果出现子类型中的服务与已有存在的冲突了怎么办? Map<String, Object> map = services.get(serviceClass); for (String key : map.keySet()) { Object service = map.get(key); Object exist = all.get(key); if (exist != null) { int n = 1; String newKey; do { newKey = key + "#" + n++; } while (all.containsKey(newKey)); all.put(newKey, service); // depends on control dependency: [if], data = [none] } else { all.put(key, service); // depends on control dependency: [if], data = [none] } } } } return all; } }
public class class_name { public final void annotationMethodRest() throws RecognitionException { int annotationMethodRest_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 77) ) { return; } // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:6: ( Identifier '(' ')' ( defaultValue )? ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:8: Identifier '(' ')' ( defaultValue )? { match(input,Identifier,FOLLOW_Identifier_in_annotationMethodRest2669); if (state.failed) return; match(input,36,FOLLOW_36_in_annotationMethodRest2671); if (state.failed) return; match(input,37,FOLLOW_37_in_annotationMethodRest2673); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:27: ( defaultValue )? int alt103=2; int LA103_0 = input.LA(1); if ( (LA103_0==74) ) { alt103=1; } switch (alt103) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:28: defaultValue { pushFollow(FOLLOW_defaultValue_in_annotationMethodRest2676); defaultValue(); state._fsp--; if (state.failed) return; } break; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 77, annotationMethodRest_StartIndex); } } } }
public class class_name { public final void annotationMethodRest() throws RecognitionException { int annotationMethodRest_StartIndex = input.index(); try { if ( state.backtracking>0 && alreadyParsedRule(input, 77) ) { return; } // depends on control dependency: [if], data = [none] // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:6: ( Identifier '(' ')' ( defaultValue )? ) // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:8: Identifier '(' ')' ( defaultValue )? { match(input,Identifier,FOLLOW_Identifier_in_annotationMethodRest2669); if (state.failed) return; match(input,36,FOLLOW_36_in_annotationMethodRest2671); if (state.failed) return; match(input,37,FOLLOW_37_in_annotationMethodRest2673); if (state.failed) return; // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:27: ( defaultValue )? int alt103=2; int LA103_0 = input.LA(1); if ( (LA103_0==74) ) { alt103=1; // depends on control dependency: [if], data = [none] } switch (alt103) { case 1 : // src/main/resources/org/drools/compiler/semantics/java/parser/Java.g:668:28: defaultValue { pushFollow(FOLLOW_defaultValue_in_annotationMethodRest2676); defaultValue(); state._fsp--; if (state.failed) return; } break; } } } catch (RecognitionException re) { reportError(re); recover(input,re); } finally { // do for sure before leaving if ( state.backtracking>0 ) { memoize(input, 77, annotationMethodRest_StartIndex); } // depends on control dependency: [if], data = [none] } } }
public class class_name { private void cleanClusters() { //System.out.println("Clean Clusters"); Iterator<GridCluster> clusIter = this.cluster_list.iterator(); ArrayList<GridCluster> toRem = new ArrayList<GridCluster>(); // Check to see if there are any empty clusters while(clusIter.hasNext()) { GridCluster c = clusIter.next(); if(c.getWeight() == 0) toRem.add(c); } // Remove empty clusters if (!toRem.isEmpty()) { clusIter = toRem.iterator(); while(clusIter.hasNext()) { this.cluster_list.remove(clusIter.next()); } } // Adjust remaining clusters as necessary clusIter = this.cluster_list.iterator(); while(clusIter.hasNext()) { GridCluster c = clusIter.next(); int index = this.cluster_list.indexOf(c); c.setClusterLabel(index); this.cluster_list.set(index, c); Iterator<Map.Entry<DensityGrid, Boolean>> gridsOfClus = c.getGrids().entrySet().iterator(); while(gridsOfClus.hasNext()) { DensityGrid dg = gridsOfClus.next().getKey(); CharacteristicVector cv = this.grid_list.get(dg); if(cv == null) { System.out.println("Warning, cv is null for "+dg.toString()+" from cluster "+index+"."); printGridList(); printGridClusters(); } //System.out.println("Cluster "+index+": "+dg.toString()+" is here."); cv.setLabel(index); this.grid_list.put(dg, cv); } } } }
public class class_name { private void cleanClusters() { //System.out.println("Clean Clusters"); Iterator<GridCluster> clusIter = this.cluster_list.iterator(); ArrayList<GridCluster> toRem = new ArrayList<GridCluster>(); // Check to see if there are any empty clusters while(clusIter.hasNext()) { GridCluster c = clusIter.next(); if(c.getWeight() == 0) toRem.add(c); } // Remove empty clusters if (!toRem.isEmpty()) { clusIter = toRem.iterator(); // depends on control dependency: [if], data = [none] while(clusIter.hasNext()) { this.cluster_list.remove(clusIter.next()); // depends on control dependency: [while], data = [none] } } // Adjust remaining clusters as necessary clusIter = this.cluster_list.iterator(); while(clusIter.hasNext()) { GridCluster c = clusIter.next(); int index = this.cluster_list.indexOf(c); c.setClusterLabel(index); // depends on control dependency: [while], data = [none] this.cluster_list.set(index, c); // depends on control dependency: [while], data = [none] Iterator<Map.Entry<DensityGrid, Boolean>> gridsOfClus = c.getGrids().entrySet().iterator(); while(gridsOfClus.hasNext()) { DensityGrid dg = gridsOfClus.next().getKey(); CharacteristicVector cv = this.grid_list.get(dg); if(cv == null) { System.out.println("Warning, cv is null for "+dg.toString()+" from cluster "+index+"."); // depends on control dependency: [if], data = [none] printGridList(); // depends on control dependency: [if], data = [none] printGridClusters(); // depends on control dependency: [if], data = [none] } //System.out.println("Cluster "+index+": "+dg.toString()+" is here."); cv.setLabel(index); // depends on control dependency: [while], data = [none] this.grid_list.put(dg, cv); // depends on control dependency: [while], data = [none] } } } }
public class class_name { public static <T> T fill(T destination, Object source) { if (destination != source) { Class<?> stype = source.getClass(); for (Field field: destination.getClass().getFields()) { try { Object value = field.get(destination); if (value == null) { field.set(destination, stype.getField(field.getName()).get(source)); } } catch (Exception x) { } } } return destination; } }
public class class_name { public static <T> T fill(T destination, Object source) { if (destination != source) { Class<?> stype = source.getClass(); for (Field field: destination.getClass().getFields()) { try { Object value = field.get(destination); if (value == null) { field.set(destination, stype.getField(field.getName()).get(source)); // depends on control dependency: [if], data = [none] } } catch (Exception x) { } // depends on control dependency: [catch], data = [none] } } return destination; } }
public class class_name { public static void main(String[] args) { // determine if a valid log4j config exists and initialize a default logger if not if (System.getProperty("log4j.configuration") == null) { Logger root = Logger.getRootLogger(); root.removeAllAppenders(); PatternLayout layout = new PatternLayout("%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n"); ConsoleAppender appender = new ConsoleAppender(layout, "System.err"); root.addAppender(appender); root.setLevel(Level.INFO); } JobManager jobManager; try { jobManager = initialize(args); // Start info server for jobmanager jobManager.startInfoServer(); } catch (Exception e) { LOG.fatal(e.getMessage(), e); System.exit(FAILURE_RETURN_CODE); } // Clean up is triggered through a shutdown hook // freeze this thread to keep the JVM alive (the job manager threads are daemon threads) Object w = new Object(); synchronized (w) { try { w.wait(); } catch (InterruptedException e) {} } } }
public class class_name { public static void main(String[] args) { // determine if a valid log4j config exists and initialize a default logger if not if (System.getProperty("log4j.configuration") == null) { Logger root = Logger.getRootLogger(); root.removeAllAppenders(); // depends on control dependency: [if], data = [none] PatternLayout layout = new PatternLayout("%d{HH:mm:ss,SSS} %-5p %-60c %x - %m%n"); ConsoleAppender appender = new ConsoleAppender(layout, "System.err"); root.addAppender(appender); root.setLevel(Level.INFO); } JobManager jobManager; try { jobManager = initialize(args); // depends on control dependency: [try], data = [none] // Start info server for jobmanager jobManager.startInfoServer(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.fatal(e.getMessage(), e); System.exit(FAILURE_RETURN_CODE); } // depends on control dependency: [catch], data = [none] // Clean up is triggered through a shutdown hook // freeze this thread to keep the JVM alive (the job manager threads are daemon threads) Object w = new Object(); synchronized (w) { try { w.wait(); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) {} // depends on control dependency: [catch], data = [none] } } }
public class class_name { static File findSystemTempDir(String[] candidates) { for(String candidate : candidates) { File f = new File(candidate); if(f.exists() && f.canRead() && f.canWrite()) return f; if(f.mkdirs()) // Try to create the path return f; } // As a last resort use the java temp file mechanism try { File tempfile = File.createTempFile("tmp", "tmp"); File tempdir = tempfile.getParentFile(); if(!tempdir.canWrite() || !tempdir.canRead()) return null; return tempdir; } catch (IOException e) { return null; } } }
public class class_name { static File findSystemTempDir(String[] candidates) { for(String candidate : candidates) { File f = new File(candidate); if(f.exists() && f.canRead() && f.canWrite()) return f; if(f.mkdirs()) // Try to create the path return f; } // As a last resort use the java temp file mechanism try { File tempfile = File.createTempFile("tmp", "tmp"); File tempdir = tempfile.getParentFile(); if(!tempdir.canWrite() || !tempdir.canRead()) return null; return tempdir; // depends on control dependency: [try], data = [none] } catch (IOException e) { return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void deselectByIdentifier(final long identifier) { mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.getIdentifier() == identifier) { deselect(item, position, null); return true; } return false; } }, true); } }
public class class_name { public void deselectByIdentifier(final long identifier) { mFastAdapter.recursive(new AdapterPredicate<Item>() { @Override public boolean apply(@NonNull IAdapter<Item> lastParentAdapter, int lastParentPosition, Item item, int position) { if (item.getIdentifier() == identifier) { deselect(item, position, null); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } return false; } }, true); } }
public class class_name { public <T> I addPageNames(Supplier<Collection<T>> webPagesSupplier, Function<T, String> mapper) { for (T element : webPagesSupplier.get()) { addPage(WebPage.of(mapper.apply(element))); } return getThis(); } }
public class class_name { public <T> I addPageNames(Supplier<Collection<T>> webPagesSupplier, Function<T, String> mapper) { for (T element : webPagesSupplier.get()) { addPage(WebPage.of(mapper.apply(element))); // depends on control dependency: [for], data = [element] } return getThis(); } }
public class class_name { public DescribeFileSystemsResult withFileSystems(FileSystemDescription... fileSystems) { if (this.fileSystems == null) { setFileSystems(new com.amazonaws.internal.SdkInternalList<FileSystemDescription>(fileSystems.length)); } for (FileSystemDescription ele : fileSystems) { this.fileSystems.add(ele); } return this; } }
public class class_name { public DescribeFileSystemsResult withFileSystems(FileSystemDescription... fileSystems) { if (this.fileSystems == null) { setFileSystems(new com.amazonaws.internal.SdkInternalList<FileSystemDescription>(fileSystems.length)); // depends on control dependency: [if], data = [none] } for (FileSystemDescription ele : fileSystems) { this.fileSystems.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { public void launchPollingThread(long mountId, long txId) { LOG.debug("launch polling thread for mount id {}, txId {}", mountId, txId); if (!mPollerMap.containsKey(mountId)) { try (CloseableResource<UnderFileSystem> ufsClient = mMountTable.getUfsClient(mountId).acquireUfsResource()) { ufsClient.get().startActiveSyncPolling(txId); } catch (IOException e) { LOG.warn("IO Exception trying to launch Polling thread {}", e); } ActiveSyncer syncer = new ActiveSyncer(mFileSystemMaster, this, mMountTable, mountId); Future<?> future = getExecutor().submit( new HeartbeatThread(HeartbeatContext.MASTER_ACTIVE_UFS_SYNC, syncer, (int) ServerConfiguration.getMs(PropertyKey.MASTER_ACTIVE_UFS_SYNC_INTERVAL), ServerConfiguration.global())); mPollerMap.put(mountId, future); } } }
public class class_name { public void launchPollingThread(long mountId, long txId) { LOG.debug("launch polling thread for mount id {}, txId {}", mountId, txId); if (!mPollerMap.containsKey(mountId)) { try (CloseableResource<UnderFileSystem> ufsClient = mMountTable.getUfsClient(mountId).acquireUfsResource()) { ufsClient.get().startActiveSyncPolling(txId); } catch (IOException e) { // depends on control dependency: [if], data = [none] LOG.warn("IO Exception trying to launch Polling thread {}", e); } ActiveSyncer syncer = new ActiveSyncer(mFileSystemMaster, this, mMountTable, mountId); Future<?> future = getExecutor().submit( new HeartbeatThread(HeartbeatContext.MASTER_ACTIVE_UFS_SYNC, syncer, (int) ServerConfiguration.getMs(PropertyKey.MASTER_ACTIVE_UFS_SYNC_INTERVAL), ServerConfiguration.global())); mPollerMap.put(mountId, future); // depends on control dependency: [if], data = [none] } } }
public class class_name { public long onIdle(final long timeNs, final long senderLimit, final long senderPosition, final boolean isEos) { if (isEos && shouldLinger) { if (lastPosition >= senderPosition || ((timeOfLastStatusMessage + RECEIVER_TIMEOUT_NS) - timeNs < 0)) { shouldLinger = false; } } return senderLimit; } }
public class class_name { public long onIdle(final long timeNs, final long senderLimit, final long senderPosition, final boolean isEos) { if (isEos && shouldLinger) { if (lastPosition >= senderPosition || ((timeOfLastStatusMessage + RECEIVER_TIMEOUT_NS) - timeNs < 0)) { shouldLinger = false; // depends on control dependency: [if], data = [none] } } return senderLimit; } }
public class class_name { VoltXMLElement voltGetXML(SimpleColumnContext context, String realAlias) throws HSQLParseException { // The voltXML representations of expressions tends to be driven much more by the expression's opType // than its Expression class. int exprOp = getType(); // The opType value of "SIMPLE_COLUMN" is a special case that spans Expression classes and seems to // need to use the Expression's exact class to be able to correctly determine its VoltXMLElement // representation. // Last minute "SIMPLE_COLUMN" substitutions can blast a new opType into an Expression of a class // other than ExpressionColumn as an optimization for duplicated expressions. // VoltDB currently uses "alias" matching to navigate to the correct (duplicate) expression structure // typically an ExpressionAggregate. // The prototypes dictionary is set up to handle a SIMPLE_COLUMN of any class EXCEPT ExpressionColumn. // A SIMPLE_COLUMN ExpressionColumn can be treated as a normal "COLUMN" ExpressionColumn. // That case gets explicitly enabled here by fudging the opType from SIMPLE_COLUMN to COLUMN. if (exprOp == OpTypes.SIMPLE_COLUMN) { VoltXMLElement asResolved = context.resolveSimpleColumn(this); if (asResolved != null) { return asResolved; } // ENG-10429 moved the following two lines here. See fix note https://issues.voltdb.com/browse/ENG-10429. // convert the SIMPLE_COLUMN into a COLUMN opType = OpTypes.COLUMN; exprOp = OpTypes.COLUMN; } // Use the opType to find a pre-initialized prototype VoltXMLElement with the correct // name and any required hard-coded values pre-set. VoltXMLElement exp = prototypes.get(exprOp); if (exp == null) { // Must have found an unsupported opType. throwForUnsupportedExpression(exprOp); } // Duplicate the prototype and add any expression particulars needed for the specific opType value, // as well as a unique identifier, a possible alias, and child nodes. exp = exp.duplicate(); exp.attributes.put("id", getUniqueId(context.m_session)); if (realAlias != null) { exp.attributes.put("alias", realAlias); } else if ((alias != null) && (getAlias().length() > 0)) { exp.attributes.put("alias", getAlias()); } // Add expression sub type if (exprSubType == OpTypes.ANY_QUANTIFIED) { exp.attributes.put("opsubtype", "any"); } else if (exprSubType == OpTypes.ALL_QUANTIFIED) { exp.attributes.put("opsubtype", "all"); } for (Expression expr : nodes) { if (expr != null) { VoltXMLElement vxmle = expr.voltGetXML(context, null); exp.children.add(vxmle); assert(vxmle != null); } } // Few opTypes need additional special case detailing or special case error detection. // Very few need access to members defined on specific Expression classes, but they // can usually be accessed via down-casting. // Even fewer need private members, and they are accessed by delegation to a // class-specific voltAnnotate... member function that directly manipulates the // VoltXMLElement. switch (exprOp) { case OpTypes.VALUE: // Apparently at this stage, all valid non-NULL values must have a // type determined by HSQL. // (I'm not sure why this MUST be the case --paul.) if (valueData == null) { String valueType = (dataType == null) ? "NULL" : Types.getTypeName(dataType.typeCode); exp.attributes.put("valuetype", valueType); return exp; } exp.attributes.put("valuetype", Types.getTypeName(dataType.typeCode)); if (valueData instanceof TimestampData) { // When we get the default from the DDL, // it gets jammed into a TimestampData object. If we // don't do this, we get a Java class/reference // string in the output schema for the DDL. // EL HACKO: I'm just adding in the timezone seconds // at the moment, hope this is right --izzy TimestampData time = (TimestampData) valueData; exp.attributes.put("value", Long.toString(Math.round((time.getSeconds() + time.getZone()) * 1e6) + time.getNanos() / 1000)); return exp; } // convert binary values to hex if (valueData instanceof BinaryData) { BinaryData bd = (BinaryData) valueData; exp.attributes.put("value", hexEncode(bd.getBytes())); return exp; } // Otherwise just string format the value. if (dataType instanceof NumberType && ! dataType.isIntegralType()) { // remove the scentific exponent notation exp.attributes.put("value", new BigDecimal(valueData.toString()).toPlainString()); return exp; } exp.attributes.put("value", valueData.toString()); return exp; case OpTypes.COLUMN: ExpressionColumn ec = (ExpressionColumn)this; return ec.voltAnnotateColumnXML(exp); case OpTypes.COALESCE: return convertUsingColumnrefToCoaleseExpression(context.m_session, exp, dataType); case OpTypes.SQL_FUNCTION: FunctionSQL fn = (FunctionSQL)this; return fn.voltAnnotateFunctionXML(exp); case OpTypes.COUNT: case OpTypes.SUM: case OpTypes.AVG: if (((ExpressionAggregate)this).isDistinctAggregate) { exp.attributes.put("distinct", "true"); } return exp; case OpTypes.ORDER_BY: if (((ExpressionOrderBy)this).isDescending()) { exp.attributes.put("desc", "true"); } return exp; case OpTypes.CAST: if (dataType == null) { throw new HSQLParseException( "VoltDB could not determine the type in a CAST operation"); } exp.attributes.put("valuetype", dataType.getNameString()); return exp; case OpTypes.TABLE_SUBQUERY: if (subQuery == null || subQuery.queryExpression == null) { throw new HSQLParseException("VoltDB could not determine the subquery"); } ExpressionColumn parameters[] = new ExpressionColumn[0]; exp.children.add(StatementQuery.voltGetXMLExpression(subQuery.queryExpression, parameters, context.m_session)); return exp; case OpTypes.ALTERNATIVE: assert(nodes.length == 2); // If with ELSE clause, pad NULL with it. if (nodes[RIGHT] instanceof ExpressionValue) { ExpressionValue val = (ExpressionValue) nodes[RIGHT]; if (val.valueData == null && val.dataType == Type.SQL_ALL_TYPES) { exp.children.get(RIGHT).attributes.put("valuetype", dataType.getNameString()); } } case OpTypes.CASEWHEN: // Hsql has check dataType can not be null. assert(dataType != null); exp.attributes.put("valuetype", dataType.getNameString()); return exp; case OpTypes.WINDOWED_RANK: case OpTypes.WINDOWED_DENSE_RANK: case OpTypes.WINDOWED_ROW_NUMBER: case OpTypes.WINDOWED_COUNT: case OpTypes.WINDOWED_MIN: case OpTypes.WINDOWED_MAX: case OpTypes.WINDOWED_SUM: assert(dataType != null); assert(this instanceof ExpressionWindowed); exp.attributes.put("valuetype", dataType.getNameString()); ExpressionWindowed erank = (ExpressionWindowed) this; return erank.voltAnnotateWindowedAggregateXML(exp, context); default: return exp; } } }
public class class_name { VoltXMLElement voltGetXML(SimpleColumnContext context, String realAlias) throws HSQLParseException { // The voltXML representations of expressions tends to be driven much more by the expression's opType // than its Expression class. int exprOp = getType(); // The opType value of "SIMPLE_COLUMN" is a special case that spans Expression classes and seems to // need to use the Expression's exact class to be able to correctly determine its VoltXMLElement // representation. // Last minute "SIMPLE_COLUMN" substitutions can blast a new opType into an Expression of a class // other than ExpressionColumn as an optimization for duplicated expressions. // VoltDB currently uses "alias" matching to navigate to the correct (duplicate) expression structure // typically an ExpressionAggregate. // The prototypes dictionary is set up to handle a SIMPLE_COLUMN of any class EXCEPT ExpressionColumn. // A SIMPLE_COLUMN ExpressionColumn can be treated as a normal "COLUMN" ExpressionColumn. // That case gets explicitly enabled here by fudging the opType from SIMPLE_COLUMN to COLUMN. if (exprOp == OpTypes.SIMPLE_COLUMN) { VoltXMLElement asResolved = context.resolveSimpleColumn(this); if (asResolved != null) { return asResolved; // depends on control dependency: [if], data = [none] } // ENG-10429 moved the following two lines here. See fix note https://issues.voltdb.com/browse/ENG-10429. // convert the SIMPLE_COLUMN into a COLUMN opType = OpTypes.COLUMN; exprOp = OpTypes.COLUMN; } // Use the opType to find a pre-initialized prototype VoltXMLElement with the correct // name and any required hard-coded values pre-set. VoltXMLElement exp = prototypes.get(exprOp); if (exp == null) { // Must have found an unsupported opType. throwForUnsupportedExpression(exprOp); } // Duplicate the prototype and add any expression particulars needed for the specific opType value, // as well as a unique identifier, a possible alias, and child nodes. exp = exp.duplicate(); exp.attributes.put("id", getUniqueId(context.m_session)); if (realAlias != null) { exp.attributes.put("alias", realAlias); } else if ((alias != null) && (getAlias().length() > 0)) { exp.attributes.put("alias", getAlias()); } // Add expression sub type if (exprSubType == OpTypes.ANY_QUANTIFIED) { exp.attributes.put("opsubtype", "any"); } else if (exprSubType == OpTypes.ALL_QUANTIFIED) { exp.attributes.put("opsubtype", "all"); } for (Expression expr : nodes) { if (expr != null) { VoltXMLElement vxmle = expr.voltGetXML(context, null); exp.children.add(vxmle); assert(vxmle != null); } } // Few opTypes need additional special case detailing or special case error detection. // Very few need access to members defined on specific Expression classes, but they // can usually be accessed via down-casting. // Even fewer need private members, and they are accessed by delegation to a // class-specific voltAnnotate... member function that directly manipulates the // VoltXMLElement. switch (exprOp) { case OpTypes.VALUE: // Apparently at this stage, all valid non-NULL values must have a // type determined by HSQL. // (I'm not sure why this MUST be the case --paul.) if (valueData == null) { String valueType = (dataType == null) ? "NULL" : Types.getTypeName(dataType.typeCode); exp.attributes.put("valuetype", valueType); return exp; } exp.attributes.put("valuetype", Types.getTypeName(dataType.typeCode)); if (valueData instanceof TimestampData) { // When we get the default from the DDL, // it gets jammed into a TimestampData object. If we // don't do this, we get a Java class/reference // string in the output schema for the DDL. // EL HACKO: I'm just adding in the timezone seconds // at the moment, hope this is right --izzy TimestampData time = (TimestampData) valueData; exp.attributes.put("value", Long.toString(Math.round((time.getSeconds() + time.getZone()) * 1e6) + time.getNanos() / 1000)); return exp; } // convert binary values to hex if (valueData instanceof BinaryData) { BinaryData bd = (BinaryData) valueData; exp.attributes.put("value", hexEncode(bd.getBytes())); return exp; } // Otherwise just string format the value. if (dataType instanceof NumberType && ! dataType.isIntegralType()) { // remove the scentific exponent notation exp.attributes.put("value", new BigDecimal(valueData.toString()).toPlainString()); return exp; } exp.attributes.put("value", valueData.toString()); return exp; case OpTypes.COLUMN: ExpressionColumn ec = (ExpressionColumn)this; return ec.voltAnnotateColumnXML(exp); case OpTypes.COALESCE: return convertUsingColumnrefToCoaleseExpression(context.m_session, exp, dataType); case OpTypes.SQL_FUNCTION: FunctionSQL fn = (FunctionSQL)this; return fn.voltAnnotateFunctionXML(exp); case OpTypes.COUNT: case OpTypes.SUM: case OpTypes.AVG: if (((ExpressionAggregate)this).isDistinctAggregate) { exp.attributes.put("distinct", "true"); } return exp; case OpTypes.ORDER_BY: if (((ExpressionOrderBy)this).isDescending()) { exp.attributes.put("desc", "true"); } return exp; case OpTypes.CAST: if (dataType == null) { throw new HSQLParseException( "VoltDB could not determine the type in a CAST operation"); } exp.attributes.put("valuetype", dataType.getNameString()); return exp; case OpTypes.TABLE_SUBQUERY: if (subQuery == null || subQuery.queryExpression == null) { throw new HSQLParseException("VoltDB could not determine the subquery"); } ExpressionColumn parameters[] = new ExpressionColumn[0]; exp.children.add(StatementQuery.voltGetXMLExpression(subQuery.queryExpression, parameters, context.m_session)); return exp; case OpTypes.ALTERNATIVE: assert(nodes.length == 2); // If with ELSE clause, pad NULL with it. if (nodes[RIGHT] instanceof ExpressionValue) { ExpressionValue val = (ExpressionValue) nodes[RIGHT]; if (val.valueData == null && val.dataType == Type.SQL_ALL_TYPES) { exp.children.get(RIGHT).attributes.put("valuetype", dataType.getNameString()); } } case OpTypes.CASEWHEN: // Hsql has check dataType can not be null. assert(dataType != null); exp.attributes.put("valuetype", dataType.getNameString()); return exp; case OpTypes.WINDOWED_RANK: case OpTypes.WINDOWED_DENSE_RANK: case OpTypes.WINDOWED_ROW_NUMBER: case OpTypes.WINDOWED_COUNT: case OpTypes.WINDOWED_MIN: case OpTypes.WINDOWED_MAX: case OpTypes.WINDOWED_SUM: assert(dataType != null); assert(this instanceof ExpressionWindowed); exp.attributes.put("valuetype", dataType.getNameString()); ExpressionWindowed erank = (ExpressionWindowed) this; return erank.voltAnnotateWindowedAggregateXML(exp, context); default: return exp; } } }
public class class_name { public void startTimeoutTimer(int iDelayMS) { if (m_timeouttimer == null) { m_timeouttimer = new Timer(iDelayMS, this); m_timeouttimer.setRepeats(false); m_timeouttimer.start(); } else m_timeouttimer.restart(); } }
public class class_name { public void startTimeoutTimer(int iDelayMS) { if (m_timeouttimer == null) { m_timeouttimer = new Timer(iDelayMS, this); // depends on control dependency: [if], data = [none] m_timeouttimer.setRepeats(false); // depends on control dependency: [if], data = [none] m_timeouttimer.start(); // depends on control dependency: [if], data = [none] } else m_timeouttimer.restart(); } }
public class class_name { void markAllProxies() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "markAllProxies"); final Enumeration enu = iProxies.elements(); // Cycle through each of the proxies while (enu.hasMoreElements()) { final MESubscription sub = (MESubscription) enu.nextElement(); // Mark the subscription. sub.mark(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "markAllProxies"); } }
public class class_name { void markAllProxies() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "markAllProxies"); final Enumeration enu = iProxies.elements(); // Cycle through each of the proxies while (enu.hasMoreElements()) { final MESubscription sub = (MESubscription) enu.nextElement(); // Mark the subscription. sub.mark(); // depends on control dependency: [while], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "markAllProxies"); } }
public class class_name { public void pack() { // we must clone, since we want to iterate only over the original list final Object[] clone = this.children.toArray(); for (Object aClone : clone) { // if child is also a group element, there may be // some possible clean up / optimizations to be done if (aClone instanceof GroupElement) { final GroupElement childGroup = (GroupElement) aClone; childGroup.pack(this); } } // if after packing, this is an AND or OR GE with a single // child GE, then clone child into current node eliminating child if ( (this.isAnd() || this.isOr()) && (this.children.size() == 1) ) { final Object child = this.getChildren().get( 0 ); if ( child instanceof GroupElement ) { mergeGroupElements( this, (GroupElement) child ); } } // if after packing, this is a NOT GE with an EXISTS child // or this is an EXISTS GE with a NOT child, eliminate the redundant // child and make this a NOT GE if ( this.isNot() && this.children.size() == 1 && this.getChildren().get( 0 ) instanceof GroupElement ) { final GroupElement child = (GroupElement) this.getChildren().get( 0 ); if ( child.isExists() ) { this.children.clear(); this.children.addAll( child.getChildren() ); } } if ( this.isExists() && this.children.size() == 1 && this.getChildren().get( 0 ) instanceof GroupElement ) { final GroupElement child = (GroupElement) this.getChildren().get( 0 ); if ( child.isNot() ) { this.setType( NOT ); this.children.clear(); this.children.addAll( child.getChildren() ); } } } }
public class class_name { public void pack() { // we must clone, since we want to iterate only over the original list final Object[] clone = this.children.toArray(); for (Object aClone : clone) { // if child is also a group element, there may be // some possible clean up / optimizations to be done if (aClone instanceof GroupElement) { final GroupElement childGroup = (GroupElement) aClone; childGroup.pack(this); // depends on control dependency: [if], data = [none] } } // if after packing, this is an AND or OR GE with a single // child GE, then clone child into current node eliminating child if ( (this.isAnd() || this.isOr()) && (this.children.size() == 1) ) { final Object child = this.getChildren().get( 0 ); if ( child instanceof GroupElement ) { mergeGroupElements( this, (GroupElement) child ); // depends on control dependency: [if], data = [none] } } // if after packing, this is a NOT GE with an EXISTS child // or this is an EXISTS GE with a NOT child, eliminate the redundant // child and make this a NOT GE if ( this.isNot() && this.children.size() == 1 && this.getChildren().get( 0 ) instanceof GroupElement ) { final GroupElement child = (GroupElement) this.getChildren().get( 0 ); if ( child.isExists() ) { this.children.clear(); // depends on control dependency: [if], data = [none] this.children.addAll( child.getChildren() ); // depends on control dependency: [if], data = [none] } } if ( this.isExists() && this.children.size() == 1 && this.getChildren().get( 0 ) instanceof GroupElement ) { final GroupElement child = (GroupElement) this.getChildren().get( 0 ); if ( child.isNot() ) { this.setType( NOT ); // depends on control dependency: [if], data = [none] this.children.clear(); // depends on control dependency: [if], data = [none] this.children.addAll( child.getChildren() ); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private String getTableDataValue( Element tdNode ) { //return tdNode.html(); StringBuffer buf = new StringBuffer(); List<Node> childNodes = tdNode.childNodes(); for ( Node tdChild : childNodes ) { if ( tdChild instanceof TextNode ) { buf.append( ( (TextNode) tdChild ).text() ); } else if ( tdChild instanceof Element ) { Element tdChildElement = (Element) tdChild; if ( "br".equals( tdChildElement.tagName() ) ) { buf.append( "<br />" ); } } } return buf.toString(); } }
public class class_name { private String getTableDataValue( Element tdNode ) { //return tdNode.html(); StringBuffer buf = new StringBuffer(); List<Node> childNodes = tdNode.childNodes(); for ( Node tdChild : childNodes ) { if ( tdChild instanceof TextNode ) { buf.append( ( (TextNode) tdChild ).text() ); // depends on control dependency: [if], data = [none] } else if ( tdChild instanceof Element ) { Element tdChildElement = (Element) tdChild; if ( "br".equals( tdChildElement.tagName() ) ) { buf.append( "<br />" ); // depends on control dependency: [if], data = [none] } } } return buf.toString(); } }
public class class_name { @VisibleForTesting final List<ClientInterceptor> getEffectiveInterceptors() { List<ClientInterceptor> effectiveInterceptors = new ArrayList<>(this.interceptors); temporarilyDisableRetry = false; if (statsEnabled) { temporarilyDisableRetry = true; CensusStatsModule censusStats = this.censusStatsOverride; if (censusStats == null) { censusStats = new CensusStatsModule( GrpcUtil.STOPWATCH_SUPPLIER, true, recordStartedRpcs, recordFinishedRpcs, recordRealTimeMetrics); } // First interceptor runs last (see ClientInterceptors.intercept()), so that no // other interceptor can override the tracer factory we set in CallOptions. effectiveInterceptors.add(0, censusStats.getClientInterceptor()); } if (tracingEnabled) { temporarilyDisableRetry = true; CensusTracingModule censusTracing = new CensusTracingModule(Tracing.getTracer(), Tracing.getPropagationComponent().getBinaryFormat()); effectiveInterceptors.add(0, censusTracing.getClientInterceptor()); } return effectiveInterceptors; } }
public class class_name { @VisibleForTesting final List<ClientInterceptor> getEffectiveInterceptors() { List<ClientInterceptor> effectiveInterceptors = new ArrayList<>(this.interceptors); temporarilyDisableRetry = false; if (statsEnabled) { temporarilyDisableRetry = true; // depends on control dependency: [if], data = [none] CensusStatsModule censusStats = this.censusStatsOverride; if (censusStats == null) { censusStats = new CensusStatsModule( GrpcUtil.STOPWATCH_SUPPLIER, true, recordStartedRpcs, recordFinishedRpcs, recordRealTimeMetrics); // depends on control dependency: [if], data = [none] } // First interceptor runs last (see ClientInterceptors.intercept()), so that no // other interceptor can override the tracer factory we set in CallOptions. effectiveInterceptors.add(0, censusStats.getClientInterceptor()); // depends on control dependency: [if], data = [none] } if (tracingEnabled) { temporarilyDisableRetry = true; // depends on control dependency: [if], data = [none] CensusTracingModule censusTracing = new CensusTracingModule(Tracing.getTracer(), Tracing.getPropagationComponent().getBinaryFormat()); effectiveInterceptors.add(0, censusTracing.getClientInterceptor()); // depends on control dependency: [if], data = [none] } return effectiveInterceptors; } }
public class class_name { public String getMessage(Constraint constraint) { String objectName = null; if (constraint instanceof PropertyConstraint) { objectName = ((PropertyConstraint) constraint).getPropertyName(); } String message = buildMessage(objectName, null, constraint); return message; } }
public class class_name { public String getMessage(Constraint constraint) { String objectName = null; if (constraint instanceof PropertyConstraint) { objectName = ((PropertyConstraint) constraint).getPropertyName(); // depends on control dependency: [if], data = [none] } String message = buildMessage(objectName, null, constraint); return message; } }
public class class_name { public static Report loadConvertedReport(String xml) { XStream xstream = XStreamFactory.createXStream(); try { return (Report) xstream.fromXML(xml); } catch (Exception e) { LOG.error(e.getMessage(), e); e.printStackTrace(); return null; } } }
public class class_name { public static Report loadConvertedReport(String xml) { XStream xstream = XStreamFactory.createXStream(); try { return (Report) xstream.fromXML(xml); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.error(e.getMessage(), e); e.printStackTrace(); return null; } // depends on control dependency: [catch], data = [none] } }
public class class_name { public HandleErrorResult primaryFail(Method method, Object[] args, boolean killCmd) { boolean alreadyClosed = masterProtocol == null || !masterProtocol.isConnected(); boolean inTransaction = masterProtocol != null && masterProtocol.inTransaction(); //in case of SocketTimeoutException due to having set socketTimeout, must force connection close if (masterProtocol != null && masterProtocol.isConnected()) { masterProtocol.close(); } //fail on slave if parameter permit so if (urlParser.getOptions().failOnReadOnly && !isSecondaryHostFail()) { try { if (this.secondaryProtocol != null && this.secondaryProtocol.ping()) { //switching to secondary connection proxy.lock.lock(); try { if (masterProtocol != null) { syncConnection(masterProtocol, this.secondaryProtocol); } currentProtocol = this.secondaryProtocol; } finally { proxy.lock.unlock(); } FailoverLoop.addListener(this); try { return relaunchOperation(method, args); } catch (Exception e) { //relaunchOperation failed } return new HandleErrorResult(); } } catch (Exception e) { if (setSecondaryHostFail()) { blackListAndCloseConnection(this.secondaryProtocol); } } } try { reconnectFailedConnection(new SearchFilter(true, urlParser.getOptions().failOnReadOnly)); handleFailLoop(); if (currentProtocol != null) { if (killCmd) { return new HandleErrorResult(true, false); } if (currentReadOnlyAsked || alreadyClosed || !inTransaction && isQueryRelaunchable(method, args)) { //connection was not in transaction //can relaunch query logger.info("Connection to master lost, new master {}, conn={} found" + ", query type permit to be re-execute on new server without throwing exception", currentProtocol.getHostAddress(), currentProtocol.getServerThreadId()); return relaunchOperation(method, args); } //throw Exception because must inform client, even if connection is reconnected return new HandleErrorResult(true); } else { setMasterHostFail(); FailoverLoop.removeListener(this); return new HandleErrorResult(); } } catch (Exception e) { //we will throw a Connection exception that will close connection if (e.getCause() != null && proxy.hasToHandleFailover((SQLException) e.getCause()) && currentProtocol != null && currentProtocol.isConnected()) { currentProtocol.close(); } setMasterHostFail(); FailoverLoop.removeListener(this); return new HandleErrorResult(); } } }
public class class_name { public HandleErrorResult primaryFail(Method method, Object[] args, boolean killCmd) { boolean alreadyClosed = masterProtocol == null || !masterProtocol.isConnected(); boolean inTransaction = masterProtocol != null && masterProtocol.inTransaction(); //in case of SocketTimeoutException due to having set socketTimeout, must force connection close if (masterProtocol != null && masterProtocol.isConnected()) { masterProtocol.close(); // depends on control dependency: [if], data = [none] } //fail on slave if parameter permit so if (urlParser.getOptions().failOnReadOnly && !isSecondaryHostFail()) { try { if (this.secondaryProtocol != null && this.secondaryProtocol.ping()) { //switching to secondary connection proxy.lock.lock(); // depends on control dependency: [if], data = [none] try { if (masterProtocol != null) { syncConnection(masterProtocol, this.secondaryProtocol); // depends on control dependency: [if], data = [(masterProtocol] } currentProtocol = this.secondaryProtocol; // depends on control dependency: [try], data = [none] } finally { proxy.lock.unlock(); } FailoverLoop.addListener(this); // depends on control dependency: [if], data = [none] try { return relaunchOperation(method, args); // depends on control dependency: [try], data = [none] } catch (Exception e) { //relaunchOperation failed } // depends on control dependency: [catch], data = [none] return new HandleErrorResult(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { if (setSecondaryHostFail()) { blackListAndCloseConnection(this.secondaryProtocol); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] } try { reconnectFailedConnection(new SearchFilter(true, urlParser.getOptions().failOnReadOnly)); // depends on control dependency: [try], data = [none] handleFailLoop(); // depends on control dependency: [try], data = [none] if (currentProtocol != null) { if (killCmd) { return new HandleErrorResult(true, false); // depends on control dependency: [if], data = [none] } if (currentReadOnlyAsked || alreadyClosed || !inTransaction && isQueryRelaunchable(method, args)) { //connection was not in transaction //can relaunch query logger.info("Connection to master lost, new master {}, conn={} found" + ", query type permit to be re-execute on new server without throwing exception", currentProtocol.getHostAddress(), currentProtocol.getServerThreadId()); // depends on control dependency: [if], data = [none] return relaunchOperation(method, args); // depends on control dependency: [if], data = [none] } //throw Exception because must inform client, even if connection is reconnected return new HandleErrorResult(true); // depends on control dependency: [if], data = [none] } else { setMasterHostFail(); // depends on control dependency: [if], data = [none] FailoverLoop.removeListener(this); // depends on control dependency: [if], data = [none] return new HandleErrorResult(); // depends on control dependency: [if], data = [none] } } catch (Exception e) { //we will throw a Connection exception that will close connection if (e.getCause() != null && proxy.hasToHandleFailover((SQLException) e.getCause()) && currentProtocol != null && currentProtocol.isConnected()) { currentProtocol.close(); // depends on control dependency: [if], data = [none] } setMasterHostFail(); FailoverLoop.removeListener(this); return new HandleErrorResult(); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public static boolean checkReaderWriterCompatibility(Schema readerSchema, Schema writerSchema, boolean ignoreNamespace) { if (ignoreNamespace) { List<Schema.Field> fields = deepCopySchemaFields(readerSchema); readerSchema = Schema.createRecord(writerSchema.getName(), writerSchema.getDoc(), writerSchema.getNamespace(), readerSchema.isError()); readerSchema.setFields(fields); } return SchemaCompatibility.checkReaderWriterCompatibility(readerSchema, writerSchema).getType().equals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE); } }
public class class_name { public static boolean checkReaderWriterCompatibility(Schema readerSchema, Schema writerSchema, boolean ignoreNamespace) { if (ignoreNamespace) { List<Schema.Field> fields = deepCopySchemaFields(readerSchema); readerSchema = Schema.createRecord(writerSchema.getName(), writerSchema.getDoc(), writerSchema.getNamespace(), readerSchema.isError()); // depends on control dependency: [if], data = [none] readerSchema.setFields(fields); // depends on control dependency: [if], data = [none] } return SchemaCompatibility.checkReaderWriterCompatibility(readerSchema, writerSchema).getType().equals(SchemaCompatibility.SchemaCompatibilityType.COMPATIBLE); } }
public class class_name { public String[] getMinors(String major) { prepareDetailedVersions(); if (majors.containsKey(major)) { return majors.get(major).toArray(new String[]{}); } return null; } }
public class class_name { public String[] getMinors(String major) { prepareDetailedVersions(); if (majors.containsKey(major)) { return majors.get(major).toArray(new String[]{}); // depends on control dependency: [if], data = [none] } return null; } }
public class class_name { public static void setDefaultTableEditorsClicks(JTable table, int clickCountToStart) { TableCellEditor editor; editor = table.getDefaultEditor(Object.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } editor = table.getDefaultEditor(Number.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } editor = table.getDefaultEditor(Boolean.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); } } }
public class class_name { public static void setDefaultTableEditorsClicks(JTable table, int clickCountToStart) { TableCellEditor editor; editor = table.getDefaultEditor(Object.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); // depends on control dependency: [if], data = [none] } editor = table.getDefaultEditor(Number.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); // depends on control dependency: [if], data = [none] } editor = table.getDefaultEditor(Boolean.class); if (editor instanceof DefaultCellEditor) { ((DefaultCellEditor) editor).setClickCountToStart(clickCountToStart); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void flushCloseDown(SSLEngine engine, WsByteBuffer outputBuffer, SSLConnectionLink xConnLink) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "flushCloseDown"); } TCPWriteRequestContext deviceWriteInterface = xConnLink.getDeviceWriteInterface(); int configuredTimeoutValue = xConnLink.getChannel().getTimeoutValueInSSLClosingHandshake(); long timeoutTimestamp = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(configuredTimeoutValue); try { Status status = null; do { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "before wrap: \r\n\tbuf: " + getBufferTraceInfo(outputBuffer)); } // Note: there is no fear of the netBuffers being too big for JSSE. // Allow SSL engine to flush out close down information to the caller. SSLEngineResult result = engine.wrap(emptyBuffer, outputBuffer.getWrappedByteBuffer()); int amountToWrite = result.bytesProduced(); long amountWritten = 0; if (0 < amountToWrite) { outputBuffer.flip(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "after wrap: \r\n\tbuf: " + getBufferTraceInfo(outputBuffer) + "\r\n\tstatus=" + result.getStatus() + " consumed=" + result.bytesConsumed() + " produced=" + result.bytesProduced()); } if (0 < amountToWrite) { // Inform the device side of the new buffer to write. deviceWriteInterface.setBuffer(outputBuffer); while (amountWritten < amountToWrite) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "want to write bytes: " + amountToWrite); } // Write the buffer to the device side channel. need to return immediately so we don't hang this write. // Update the amount of bytes that have been written out in our internal instance. amountWritten += deviceWriteInterface.write(0, TCPRequestContext.USE_CHANNEL_TIMEOUT); if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "bytes written: " + amountWritten); } if (xConnLink.getChannel().getstop0Called()) { // don't hold up stopping the channel for this write handshake to complete, since it may never complete. break; } if (configuredTimeoutValue > -1 && timeoutTimestamp <= System.currentTimeMillis()) { // don't hold up stopping the channel if the custom property is not set to indefinite and the // designated timeout point has been reached. break; } else if (configuredTimeoutValue > -1 && amountWritten == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Did not write anything, sleeping thread before trying again."); } try { Thread.sleep(1000); } catch (InterruptedException e) { // do nothing - continue trying to write until counter reaches the defined amount. } } else if (amountWritten == 0) { // if we didn't write anything, don't hard loop, but let other threads run before trying again. Thread.yield(); } } // after the sync write, clear the buffer in case there was a // buffer overflow condition we need to account for, and therefore // another write will be need. outputBuffer.clear(); } // Extract the status to see if more must be written. status = result.getStatus(); if ((Status.OK == status && 0 == amountToWrite) || xConnLink.getChannel().getstop0Called()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Did not produce anything, quit now"); Tr.debug(tc, "status: " + status + " amountToWrite: " + amountToWrite + " amountWritten: " + amountWritten + " stop0Called: " + xConnLink.getChannel().getstop0Called()); } break; // out of while } else if (configuredTimeoutValue > -1 && timeoutTimestamp <= System.currentTimeMillis()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Closing handshake write timeout amount in SSL Channel met. Quit now."); } break; //out of while } } while (status != Status.CLOSED); } catch (Exception e) { // No FFDC needed. // Exception from doing write. Nothing more can be done. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception caught closing down, " + e); } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "flushCloseDown"); } } }
public class class_name { private static void flushCloseDown(SSLEngine engine, WsByteBuffer outputBuffer, SSLConnectionLink xConnLink) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "flushCloseDown"); // depends on control dependency: [if], data = [none] } TCPWriteRequestContext deviceWriteInterface = xConnLink.getDeviceWriteInterface(); int configuredTimeoutValue = xConnLink.getChannel().getTimeoutValueInSSLClosingHandshake(); long timeoutTimestamp = System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(configuredTimeoutValue); try { Status status = null; do { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "before wrap: \r\n\tbuf: " + getBufferTraceInfo(outputBuffer)); // depends on control dependency: [if], data = [none] } // Note: there is no fear of the netBuffers being too big for JSSE. // Allow SSL engine to flush out close down information to the caller. SSLEngineResult result = engine.wrap(emptyBuffer, outputBuffer.getWrappedByteBuffer()); int amountToWrite = result.bytesProduced(); long amountWritten = 0; if (0 < amountToWrite) { outputBuffer.flip(); // depends on control dependency: [if], data = [none] } if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "after wrap: \r\n\tbuf: " + getBufferTraceInfo(outputBuffer) + "\r\n\tstatus=" + result.getStatus() + " consumed=" + result.bytesConsumed() + " produced=" + result.bytesProduced()); // depends on control dependency: [if], data = [none] } if (0 < amountToWrite) { // Inform the device side of the new buffer to write. deviceWriteInterface.setBuffer(outputBuffer); // depends on control dependency: [if], data = [none] while (amountWritten < amountToWrite) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "want to write bytes: " + amountToWrite); // depends on control dependency: [if], data = [none] } // Write the buffer to the device side channel. need to return immediately so we don't hang this write. // Update the amount of bytes that have been written out in our internal instance. amountWritten += deviceWriteInterface.write(0, TCPRequestContext.USE_CHANNEL_TIMEOUT); // depends on control dependency: [while], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "bytes written: " + amountWritten); // depends on control dependency: [if], data = [none] } if (xConnLink.getChannel().getstop0Called()) { // don't hold up stopping the channel for this write handshake to complete, since it may never complete. break; } if (configuredTimeoutValue > -1 && timeoutTimestamp <= System.currentTimeMillis()) { // don't hold up stopping the channel if the custom property is not set to indefinite and the // designated timeout point has been reached. break; } else if (configuredTimeoutValue > -1 && amountWritten == 0) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Did not write anything, sleeping thread before trying again."); // depends on control dependency: [if], data = [none] } try { Thread.sleep(1000); // depends on control dependency: [try], data = [none] } catch (InterruptedException e) { // do nothing - continue trying to write until counter reaches the defined amount. } // depends on control dependency: [catch], data = [none] } else if (amountWritten == 0) { // if we didn't write anything, don't hard loop, but let other threads run before trying again. Thread.yield(); // depends on control dependency: [if], data = [none] } } // after the sync write, clear the buffer in case there was a // buffer overflow condition we need to account for, and therefore // another write will be need. outputBuffer.clear(); // depends on control dependency: [if], data = [none] } // Extract the status to see if more must be written. status = result.getStatus(); if ((Status.OK == status && 0 == amountToWrite) || xConnLink.getChannel().getstop0Called()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Did not produce anything, quit now"); // depends on control dependency: [if], data = [none] Tr.debug(tc, "status: " + status + " amountToWrite: " + amountToWrite + " amountWritten: " + amountWritten + " stop0Called: " + xConnLink.getChannel().getstop0Called()); // depends on control dependency: [if], data = [none] } break; // out of while } else if (configuredTimeoutValue > -1 && timeoutTimestamp <= System.currentTimeMillis()) { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Closing handshake write timeout amount in SSL Channel met. Quit now."); // depends on control dependency: [if], data = [none] } break; //out of while } } while (status != Status.CLOSED); } catch (Exception e) { // No FFDC needed. // Exception from doing write. Nothing more can be done. if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Exception caught closing down, " + e); // depends on control dependency: [if], data = [none] } } // depends on control dependency: [catch], data = [none] if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "flushCloseDown"); // depends on control dependency: [if], data = [none] } } }
public class class_name { protected final int initApplicationDir(){ this.applicationDir = this.optionAppHome.getValue(); if(this.applicationDir==null){ System.err.println(this.getAppName() + ": no application directory set"); return -1; } return 0; } }
public class class_name { protected final int initApplicationDir(){ this.applicationDir = this.optionAppHome.getValue(); if(this.applicationDir==null){ System.err.println(this.getAppName() + ": no application directory set"); // depends on control dependency: [if], data = [none] return -1; // depends on control dependency: [if], data = [none] } return 0; } }
public class class_name { @Override public void setContract(Contract c) { super.setContract(c); for (Function f : functions) { f.setContract(c); } } }
public class class_name { @Override public void setContract(Contract c) { super.setContract(c); for (Function f : functions) { f.setContract(c); // depends on control dependency: [for], data = [f] } } }
public class class_name { public void marshall(DescribeThingRequest describeThingRequest, ProtocolMarshaller protocolMarshaller) { if (describeThingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeThingRequest.getThingName(), THINGNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DescribeThingRequest describeThingRequest, ProtocolMarshaller protocolMarshaller) { if (describeThingRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(describeThingRequest.getThingName(), THINGNAME_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public String getOutputName() { if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) { return "dependency-check-report"; } else if ("XML".equalsIgnoreCase(this.format)) { return "dependency-check-report.xml"; } else if ("JUNIT".equalsIgnoreCase(this.format)) { return "dependency-check-junit.xml"; } else if ("JSON".equalsIgnoreCase(this.format)) { return "dependency-check-report.json"; } else if ("CSV".equalsIgnoreCase(this.format)) { return "dependency-check-report.csv"; } else { getLog().warn("Unknown report format used during site generation."); return "dependency-check-report"; } } }
public class class_name { @Override public String getOutputName() { if ("HTML".equalsIgnoreCase(this.format) || "ALL".equalsIgnoreCase(this.format)) { return "dependency-check-report"; // depends on control dependency: [if], data = [none] } else if ("XML".equalsIgnoreCase(this.format)) { return "dependency-check-report.xml"; // depends on control dependency: [if], data = [none] } else if ("JUNIT".equalsIgnoreCase(this.format)) { return "dependency-check-junit.xml"; // depends on control dependency: [if], data = [none] } else if ("JSON".equalsIgnoreCase(this.format)) { return "dependency-check-report.json"; // depends on control dependency: [if], data = [none] } else if ("CSV".equalsIgnoreCase(this.format)) { return "dependency-check-report.csv"; // depends on control dependency: [if], data = [none] } else { getLog().warn("Unknown report format used during site generation."); // depends on control dependency: [if], data = [none] return "dependency-check-report"; // depends on control dependency: [if], data = [none] } } }
public class class_name { public void unsetAsynchConsumer(boolean stoppable) //SIB0115d.comms throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIErrorException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unsetAsynchConsumer"); if (sessionId == 0) { // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow // to the server as we do not know which session to instruct the server to use. SIErrorException e = new SIErrorException( nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".unsetAsyncConsumer", CommsConstants.CONVERSATIONHELPERIMPL_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); throw e; } CommsByteBuffer request = getCommsByteBuffer(); // Connection object id request.putShort(connectionObjectId); // Consumer session id request.putShort(sessionId); // Pass on call to server CommsByteBuffer reply = null; try { reply = jfapExchange(request, (stoppable ? JFapChannelConstants.SEG_DEREGISTER_STOPPABLE_ASYNC_CONSUMER : JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER), //SIB0115d.comms JFapChannelConstants.PRIORITY_MEDIUM, true); } catch (SIConnectionLostException e) { // No FFDC Code needed // Converting this to a connection dropped as that is all we can throw if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection was lost", e); throw new SIConnectionDroppedException(e.getMessage(), e); } // Confirm appropriate data returned try { short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER_R); if (err != CommsConstants.SI_NO_EXCEPTION) { checkFor_SISessionUnavailableException(reply, err); checkFor_SISessionDroppedException(reply, err); checkFor_SIConnectionUnavailableException(reply, err); checkFor_SIConnectionDroppedException(reply, err); checkFor_SIIncorrectCallException(reply, err); checkFor_SIErrorException(reply, err); defaultChecker(reply, err); } } finally { if (reply != null) reply.release(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unsetAsynchConsumer"); } }
public class class_name { public void unsetAsynchConsumer(boolean stoppable) //SIB0115d.comms throws SISessionUnavailableException, SISessionDroppedException, SIConnectionUnavailableException, SIConnectionDroppedException, SIErrorException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unsetAsynchConsumer"); if (sessionId == 0) { // If the session Id = 0, then no one called setSessionId(). As such we are unable to flow // to the server as we do not know which session to instruct the server to use. SIErrorException e = new SIErrorException( nls.getFormattedMessage("SESSION_ID_HAS_NOT_BEEN_SET_SICO1043", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".unsetAsyncConsumer", CommsConstants.CONVERSATIONHELPERIMPL_01, this); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, e.getMessage(), e); throw e; } CommsByteBuffer request = getCommsByteBuffer(); // Connection object id request.putShort(connectionObjectId); // Consumer session id request.putShort(sessionId); // Pass on call to server CommsByteBuffer reply = null; try { reply = jfapExchange(request, (stoppable ? JFapChannelConstants.SEG_DEREGISTER_STOPPABLE_ASYNC_CONSUMER : JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER), //SIB0115d.comms JFapChannelConstants.PRIORITY_MEDIUM, true); } catch (SIConnectionLostException e) { // No FFDC Code needed // Converting this to a connection dropped as that is all we can throw if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Connection was lost", e); throw new SIConnectionDroppedException(e.getMessage(), e); } // Confirm appropriate data returned try { short err = reply.getCommandCompletionCode(JFapChannelConstants.SEG_DEREGISTER_ASYNC_CONSUMER_R); if (err != CommsConstants.SI_NO_EXCEPTION) { checkFor_SISessionUnavailableException(reply, err); // depends on control dependency: [if], data = [none] checkFor_SISessionDroppedException(reply, err); // depends on control dependency: [if], data = [none] checkFor_SIConnectionUnavailableException(reply, err); // depends on control dependency: [if], data = [none] checkFor_SIConnectionDroppedException(reply, err); // depends on control dependency: [if], data = [none] checkFor_SIIncorrectCallException(reply, err); // depends on control dependency: [if], data = [none] checkFor_SIErrorException(reply, err); // depends on control dependency: [if], data = [none] defaultChecker(reply, err); // depends on control dependency: [if], data = [none] } } finally { if (reply != null) reply.release(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unsetAsynchConsumer"); } }
public class class_name { @Nonnull public static String getPatternStringForSecrets(@Nonnull Collection<String> secrets) { List<String> sortedByLength = new ArrayList<>(secrets); Collections.sort(sortedByLength, stringLengthComparator); StringBuilder regexp = new StringBuilder(); for (String secret : sortedByLength) { if (!secret.isEmpty()) { if (regexp.length() > 0) { regexp.append('|'); } regexp.append(Pattern.quote(secret)); } } return regexp.toString(); } }
public class class_name { @Nonnull public static String getPatternStringForSecrets(@Nonnull Collection<String> secrets) { List<String> sortedByLength = new ArrayList<>(secrets); Collections.sort(sortedByLength, stringLengthComparator); StringBuilder regexp = new StringBuilder(); for (String secret : sortedByLength) { if (!secret.isEmpty()) { if (regexp.length() > 0) { regexp.append('|'); // depends on control dependency: [if], data = [none] } regexp.append(Pattern.quote(secret)); // depends on control dependency: [if], data = [none] } } return regexp.toString(); } }
public class class_name { public void marshall(DedicatedIp dedicatedIp, ProtocolMarshaller protocolMarshaller) { if (dedicatedIp == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dedicatedIp.getIp(), IP_BINDING); protocolMarshaller.marshall(dedicatedIp.getWarmupStatus(), WARMUPSTATUS_BINDING); protocolMarshaller.marshall(dedicatedIp.getWarmupPercentage(), WARMUPPERCENTAGE_BINDING); protocolMarshaller.marshall(dedicatedIp.getPoolName(), POOLNAME_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DedicatedIp dedicatedIp, ProtocolMarshaller protocolMarshaller) { if (dedicatedIp == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(dedicatedIp.getIp(), IP_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(dedicatedIp.getWarmupStatus(), WARMUPSTATUS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(dedicatedIp.getWarmupPercentage(), WARMUPPERCENTAGE_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(dedicatedIp.getPoolName(), POOLNAME_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 <T> T exit(T result) { if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) { FormattingTuple tp = MessageFormatter.format(EXIT_MESSAGE_1, result); ((LocationAwareLogger) logger).log(EXIT_MARKER, FQCN, LocationAwareLogger.TRACE_INT, tp.getMessage(), new Object[] { result }, tp.getThrowable()); } return result; } }
public class class_name { public <T> T exit(T result) { if (instanceofLAL && logger.isTraceEnabled(ENTRY_MARKER)) { FormattingTuple tp = MessageFormatter.format(EXIT_MESSAGE_1, result); ((LocationAwareLogger) logger).log(EXIT_MARKER, FQCN, LocationAwareLogger.TRACE_INT, tp.getMessage(), new Object[] { result }, tp.getThrowable()); // depends on control dependency: [if], data = [none] } return result; } }
public class class_name { @Override public final void handle(final Map<String, Object> pReqVars, final IRequestData pRequestData, final OutputStream pSous) throws Exception { String csvMethodIdStr = pRequestData.getParameter("csvMethod"); Long csvMethodId = Long.parseLong(csvMethodIdStr); String priceCategoryIdStr = pRequestData.getParameter("priceCategory"); Long priceCategoryId = Long.parseLong(priceCategoryIdStr); pReqVars.put("priceCategoryId", priceCategoryId); String unavailablePriceStr = pRequestData.getParameter("unavailablePrice"); if (unavailablePriceStr != null && !"".equals(unavailablePriceStr)) { BigDecimal unavailablePrice = new BigDecimal(unavailablePriceStr); if (unavailablePrice.compareTo(BigDecimal.ZERO) != 0) { pReqVars.put("unavailablePrice", unavailablePrice); } } String optimisticQuantityStr = pRequestData .getParameter("optimisticQuantity"); if (optimisticQuantityStr != null && !"".equals(optimisticQuantityStr)) { BigDecimal optimisticQuantity = new BigDecimal(optimisticQuantityStr); pReqVars.put("optimisticQuantity", optimisticQuantity); } CsvMethod csvMethod = null; List<List<Object>> data = null; ICsvDataRetriever ret = null; try { this.srvDatabase.setIsAutocommit(false); this.srvDatabase. setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); csvMethod = getSrvOrm().retrieveEntityById(pReqVars, CsvMethod.class, csvMethodId); List<CsvColumn> cols = getSrvOrm() .retrieveListWithConditions(pReqVars, CsvColumn.class, "where ITSOWNER=" + csvMethod.getItsId()); csvMethod.setColumns(cols); ret = this.retrievers.get(csvMethod.getRetrieverName()); if (ret == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "Can't find retriever " + csvMethod.getRetrieverName()); } data = ret.retrieveData(pReqVars); this.srvDatabase.commitTransaction(); } catch (Exception ex) { this.srvDatabase.rollBackTransaction(); throw ex; } finally { this.srvDatabase.releaseResources(); } if (data != null) { this.csvWriter.write(pReqVars, data, csvMethod, pSous); } } }
public class class_name { @Override public final void handle(final Map<String, Object> pReqVars, final IRequestData pRequestData, final OutputStream pSous) throws Exception { String csvMethodIdStr = pRequestData.getParameter("csvMethod"); Long csvMethodId = Long.parseLong(csvMethodIdStr); String priceCategoryIdStr = pRequestData.getParameter("priceCategory"); Long priceCategoryId = Long.parseLong(priceCategoryIdStr); pReqVars.put("priceCategoryId", priceCategoryId); String unavailablePriceStr = pRequestData.getParameter("unavailablePrice"); if (unavailablePriceStr != null && !"".equals(unavailablePriceStr)) { BigDecimal unavailablePrice = new BigDecimal(unavailablePriceStr); if (unavailablePrice.compareTo(BigDecimal.ZERO) != 0) { pReqVars.put("unavailablePrice", unavailablePrice); // depends on control dependency: [if], data = [none] } } String optimisticQuantityStr = pRequestData .getParameter("optimisticQuantity"); if (optimisticQuantityStr != null && !"".equals(optimisticQuantityStr)) { BigDecimal optimisticQuantity = new BigDecimal(optimisticQuantityStr); pReqVars.put("optimisticQuantity", optimisticQuantity); } CsvMethod csvMethod = null; List<List<Object>> data = null; ICsvDataRetriever ret = null; try { this.srvDatabase.setIsAutocommit(false); this.srvDatabase. setTransactionIsolation(ISrvDatabase.TRANSACTION_READ_UNCOMMITTED); this.srvDatabase.beginTransaction(); csvMethod = getSrvOrm().retrieveEntityById(pReqVars, CsvMethod.class, csvMethodId); List<CsvColumn> cols = getSrvOrm() .retrieveListWithConditions(pReqVars, CsvColumn.class, "where ITSOWNER=" + csvMethod.getItsId()); csvMethod.setColumns(cols); ret = this.retrievers.get(csvMethod.getRetrieverName()); if (ret == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "Can't find retriever " + csvMethod.getRetrieverName()); } data = ret.retrieveData(pReqVars); this.srvDatabase.commitTransaction(); } catch (Exception ex) { this.srvDatabase.rollBackTransaction(); throw ex; } finally { this.srvDatabase.releaseResources(); } if (data != null) { this.csvWriter.write(pReqVars, data, csvMethod, pSous); } } }
public class class_name { private String getSourceIndent(TreeNode fragment) { int index = fragment.getStartPosition(); if (index < 1) { return ""; } TreeNode node = fragment.getParent(); while (node != null && node.getKind() != TreeNode.Kind.COMPILATION_UNIT) { node = node.getParent(); } if (node instanceof CompilationUnit) { String source = ((CompilationUnit) node).getSource(); int i = index - 1; char c; while (i >= 0 && (c = source.charAt(i)) != '\n') { if (c != '*' && !Character.isWhitespace(c)) { // Pre tag embedded in other text, so no indent. return ""; } --i; } String lineStart = source.substring(i + 1, index); i = lineStart.indexOf('*'); if (i == -1) { return lineStart; } // Indent could end with '*' instead of "* ", if there's no text after it. return (++i + 1) < lineStart.length() ? lineStart.substring(i + 1) : lineStart.substring(i); } return ""; } }
public class class_name { private String getSourceIndent(TreeNode fragment) { int index = fragment.getStartPosition(); if (index < 1) { return ""; // depends on control dependency: [if], data = [none] } TreeNode node = fragment.getParent(); while (node != null && node.getKind() != TreeNode.Kind.COMPILATION_UNIT) { node = node.getParent(); // depends on control dependency: [while], data = [none] } if (node instanceof CompilationUnit) { String source = ((CompilationUnit) node).getSource(); int i = index - 1; char c; while (i >= 0 && (c = source.charAt(i)) != '\n') { if (c != '*' && !Character.isWhitespace(c)) { // Pre tag embedded in other text, so no indent. return ""; // depends on control dependency: [if], data = [none] } --i; // depends on control dependency: [while], data = [none] } String lineStart = source.substring(i + 1, index); i = lineStart.indexOf('*'); // depends on control dependency: [if], data = [none] if (i == -1) { return lineStart; // depends on control dependency: [if], data = [none] } // Indent could end with '*' instead of "* ", if there's no text after it. return (++i + 1) < lineStart.length() ? lineStart.substring(i + 1) : lineStart.substring(i); // depends on control dependency: [if], data = [none] } return ""; } }
public class class_name { public void unknownEntry(Vector strings) { if (strings != null && strings.size() > 0) { String keyword = (String) strings.elementAt(0); catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword); } } }
public class class_name { public void unknownEntry(Vector strings) { if (strings != null && strings.size() > 0) { String keyword = (String) strings.elementAt(0); catalogManager.debug.message(2, "Unrecognized token parsing catalog", keyword); // depends on control dependency: [if], data = [none] } } }
public class class_name { public void recordSubsystemVersions(String moduleName, ModelNode subsystems) { final Map<String, SubsystemInformation> subsystemsInfo = getAvailableSubsystems(moduleName); if(subsystemsInfo != null && ! subsystemsInfo.isEmpty()) { for(final Map.Entry<String, SubsystemInformation> entry : subsystemsInfo.entrySet()) { SubsystemInformation subsystem = entry.getValue(); subsystems.add(entry.getKey(), subsystem.getManagementInterfaceMajorVersion() + "." + subsystem.getManagementInterfaceMinorVersion() + "." + subsystem.getManagementInterfaceMicroVersion()); } } } }
public class class_name { public void recordSubsystemVersions(String moduleName, ModelNode subsystems) { final Map<String, SubsystemInformation> subsystemsInfo = getAvailableSubsystems(moduleName); if(subsystemsInfo != null && ! subsystemsInfo.isEmpty()) { for(final Map.Entry<String, SubsystemInformation> entry : subsystemsInfo.entrySet()) { SubsystemInformation subsystem = entry.getValue(); subsystems.add(entry.getKey(), subsystem.getManagementInterfaceMajorVersion() + "." + subsystem.getManagementInterfaceMinorVersion() + "." + subsystem.getManagementInterfaceMicroVersion()); // depends on control dependency: [for], data = [entry] } } } }
public class class_name { @Override public String getId() { String id = null; if (isListenerFilterable()) { id = ((com.ibm.ws.artifact.ArtifactNotifierExtension.ArtifactListener) listener).getId(); } return id; } }
public class class_name { @Override public String getId() { String id = null; if (isListenerFilterable()) { id = ((com.ibm.ws.artifact.ArtifactNotifierExtension.ArtifactListener) listener).getId(); // depends on control dependency: [if], data = [none] } return id; } }
public class class_name { public void sharedUnlock() { final ReadersEntry localEntry = entry.get(); if (localEntry == null) { // ERROR: Tried to unlock a non read-locked lock throw new IllegalMonitorStateException(); } else { localEntry.state.set(SRWL_STATE_NOT_READING); return; } } }
public class class_name { public void sharedUnlock() { final ReadersEntry localEntry = entry.get(); if (localEntry == null) { // ERROR: Tried to unlock a non read-locked lock throw new IllegalMonitorStateException(); } else { localEntry.state.set(SRWL_STATE_NOT_READING); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public List<?> getResultList() { if (log.isDebugEnabled()) log.debug("JPA Query: " + getJPAQuery()); // get luence query String q = luceneQuery; if (null == q) { q = KunderaCoreUtils.getLuceneQueryFromJPAQuery(kunderaQuery, kunderaMetadata); } if (log.isDebugEnabled()) log.debug("Lucene Query: " + q); EntityMetadata m = kunderaQuery.getEntityMetadata(); Client client = persistenceDelegeator.getClient(m); handlePostEvent(); Map<String, Object> searchFilter = client.getIndexManager().search(m.getEntityClazz(), q, -1, maxResult); if (kunderaQuery.isAliasOnly()) { String[] primaryKeys = searchFilter.values().toArray(new String[] {}); return persistenceDelegeator.find(m.getEntityClazz(), primaryKeys); } else { return persistenceDelegeator.find(m.getEntityClazz(), searchFilter); } } }
public class class_name { @Override public List<?> getResultList() { if (log.isDebugEnabled()) log.debug("JPA Query: " + getJPAQuery()); // get luence query String q = luceneQuery; if (null == q) { q = KunderaCoreUtils.getLuceneQueryFromJPAQuery(kunderaQuery, kunderaMetadata); // depends on control dependency: [if], data = [none] } if (log.isDebugEnabled()) log.debug("Lucene Query: " + q); EntityMetadata m = kunderaQuery.getEntityMetadata(); Client client = persistenceDelegeator.getClient(m); handlePostEvent(); Map<String, Object> searchFilter = client.getIndexManager().search(m.getEntityClazz(), q, -1, maxResult); if (kunderaQuery.isAliasOnly()) { String[] primaryKeys = searchFilter.values().toArray(new String[] {}); return persistenceDelegeator.find(m.getEntityClazz(), primaryKeys); // depends on control dependency: [if], data = [none] } else { return persistenceDelegeator.find(m.getEntityClazz(), searchFilter); // depends on control dependency: [if], data = [none] } } }
public class class_name { @Override public void restoreState(FacesContext context, Object state) { if (_saveUIDataRowState) { if (state == null) { return; } Object values[] = (Object[]) state; super.restoreState(context, values[0]); //Object restoredRowStates = UIComponentBase.restoreAttachedState(context, values[1]); /* if (restoredRowStates == null) { if (!_rowDeltaStates.isEmpty()) { _rowDeltaStates.clear(); } } else { _rowDeltaStates = (Map<String, Map<String, Object> >) restoredRowStates; }*/ if (values.length > 2) { Object rs = UIComponentBase.restoreAttachedState(context, values[2]); if (rs == null) { if (!_rowStates.isEmpty()) { _rowStates.clear(); } } else { _rowStates = (Map<String, Collection<Object[]> >) rs; } } } else { super.restoreState(context, state); } } }
public class class_name { @Override public void restoreState(FacesContext context, Object state) { if (_saveUIDataRowState) { if (state == null) { return; // depends on control dependency: [if], data = [none] } Object values[] = (Object[]) state; super.restoreState(context, values[0]); // depends on control dependency: [if], data = [none] //Object restoredRowStates = UIComponentBase.restoreAttachedState(context, values[1]); /* if (restoredRowStates == null) { if (!_rowDeltaStates.isEmpty()) { _rowDeltaStates.clear(); } } else { _rowDeltaStates = (Map<String, Map<String, Object> >) restoredRowStates; }*/ if (values.length > 2) { Object rs = UIComponentBase.restoreAttachedState(context, values[2]); if (rs == null) { if (!_rowStates.isEmpty()) { _rowStates.clear(); // depends on control dependency: [if], data = [none] } } else { _rowStates = (Map<String, Collection<Object[]> >) rs; // depends on control dependency: [if], data = [none] } } } else { super.restoreState(context, state); // depends on control dependency: [if], data = [none] } } }
public class class_name { View createPresetsView() { View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_presets, null); shadesLayout = (LinearLayout) contentView.findViewById(R.id.shades_layout); transparencySeekBar = (SeekBar) contentView.findViewById(R.id.transparency_seekbar); transparencyPercText = (TextView) contentView.findViewById(R.id.transparency_text); GridView gridView = (GridView) contentView.findViewById(R.id.gridView); loadPresets(); if (showColorShades) { createColorShades(color); } else { shadesLayout.setVisibility(View.GONE); contentView.findViewById(R.id.shades_divider).setVisibility(View.GONE); } adapter = new ColorPaletteAdapter(new ColorPaletteAdapter.OnColorSelectedListener() { @Override public void onColorSelected(int newColor) { if (color == newColor) { // Double tab selects the color ColorPickerDialog.this.onColorSelected(color); dismiss(); return; } color = newColor; if (showColorShades) { createColorShades(color); } } }, presets, getSelectedItemPosition(), colorShape); gridView.setAdapter(adapter); if (showAlphaSlider) { setupTransparency(); } else { contentView.findViewById(R.id.transparency_layout).setVisibility(View.GONE); contentView.findViewById(R.id.transparency_title).setVisibility(View.GONE); } return contentView; } }
public class class_name { View createPresetsView() { View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_presets, null); shadesLayout = (LinearLayout) contentView.findViewById(R.id.shades_layout); transparencySeekBar = (SeekBar) contentView.findViewById(R.id.transparency_seekbar); transparencyPercText = (TextView) contentView.findViewById(R.id.transparency_text); GridView gridView = (GridView) contentView.findViewById(R.id.gridView); loadPresets(); if (showColorShades) { createColorShades(color); // depends on control dependency: [if], data = [none] } else { shadesLayout.setVisibility(View.GONE); // depends on control dependency: [if], data = [none] contentView.findViewById(R.id.shades_divider).setVisibility(View.GONE); // depends on control dependency: [if], data = [none] } adapter = new ColorPaletteAdapter(new ColorPaletteAdapter.OnColorSelectedListener() { @Override public void onColorSelected(int newColor) { if (color == newColor) { // Double tab selects the color ColorPickerDialog.this.onColorSelected(color); // depends on control dependency: [if], data = [(color] dismiss(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } color = newColor; if (showColorShades) { createColorShades(color); // depends on control dependency: [if], data = [none] } } }, presets, getSelectedItemPosition(), colorShape); gridView.setAdapter(adapter); if (showAlphaSlider) { setupTransparency(); // depends on control dependency: [if], data = [none] } else { contentView.findViewById(R.id.transparency_layout).setVisibility(View.GONE); // depends on control dependency: [if], data = [none] contentView.findViewById(R.id.transparency_title).setVisibility(View.GONE); // depends on control dependency: [if], data = [none] } return contentView; } }
public class class_name { public int andCardinality(Container x) { if (this.isEmpty()) { return 0; } else if (x.isEmpty()) { return 0; } else { if (x instanceof ArrayContainer) { return andCardinality((ArrayContainer) x); } else if (x instanceof BitmapContainer) { return andCardinality((BitmapContainer) x); } return andCardinality((RunContainer) x); } } }
public class class_name { public int andCardinality(Container x) { if (this.isEmpty()) { return 0; // depends on control dependency: [if], data = [none] } else if (x.isEmpty()) { return 0; // depends on control dependency: [if], data = [none] } else { if (x instanceof ArrayContainer) { return andCardinality((ArrayContainer) x); // depends on control dependency: [if], data = [none] } else if (x instanceof BitmapContainer) { return andCardinality((BitmapContainer) x); // depends on control dependency: [if], data = [none] } return andCardinality((RunContainer) x); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static boolean containsOnly(Stream stream, long size){ long count = 0L; Iterator it = stream.iterator(); while(it.hasNext()){ it.next(); if(++count > size) return false; } return size == count; } }
public class class_name { public static boolean containsOnly(Stream stream, long size){ long count = 0L; Iterator it = stream.iterator(); while(it.hasNext()){ it.next(); // depends on control dependency: [while], data = [none] if(++count > size) return false; } return size == count; } }
public class class_name { @Override public ISeq<Phenotype<G, N>> select( final Seq<Phenotype<G, N>> population, final int count, final Optimize opt ) { requireNonNull(population, "Population"); if (count < 0) { throw new IllegalArgumentException( "Selection count must be greater or equal then zero, but was " + count ); } if (count == 0 || population.isEmpty()) { return ISeq.empty(); } final MSeq<Phenotype<G, N>> selection = MSeq.ofLength(count); final Seq<Phenotype<G, N>> pop = _sorted ? population.asISeq().copy().sort(POPULATION_COMPARATOR) : population; final double[] probabilities = probabilities(pop, count, opt); assert pop.size() == probabilities.length; //Calculating the equally spaces random points. final double delta = 1.0/count; final double[] points = new double[count]; points[0] = RandomRegistry.getRandom().nextDouble()*delta; for (int i = 1; i < count; ++i) { points[i] = delta*i; } int j = 0; double prop = 0; for (int i = 0; i < count; ++i) { while (points[i] > prop) { prop += probabilities[j]; ++j; } selection.set(i, pop.get(j%pop.size())); } return selection.toISeq(); } }
public class class_name { @Override public ISeq<Phenotype<G, N>> select( final Seq<Phenotype<G, N>> population, final int count, final Optimize opt ) { requireNonNull(population, "Population"); if (count < 0) { throw new IllegalArgumentException( "Selection count must be greater or equal then zero, but was " + count ); } if (count == 0 || population.isEmpty()) { return ISeq.empty(); // depends on control dependency: [if], data = [none] } final MSeq<Phenotype<G, N>> selection = MSeq.ofLength(count); final Seq<Phenotype<G, N>> pop = _sorted ? population.asISeq().copy().sort(POPULATION_COMPARATOR) : population; final double[] probabilities = probabilities(pop, count, opt); assert pop.size() == probabilities.length; //Calculating the equally spaces random points. final double delta = 1.0/count; final double[] points = new double[count]; points[0] = RandomRegistry.getRandom().nextDouble()*delta; for (int i = 1; i < count; ++i) { points[i] = delta*i; // depends on control dependency: [for], data = [i] } int j = 0; double prop = 0; for (int i = 0; i < count; ++i) { while (points[i] > prop) { prop += probabilities[j]; // depends on control dependency: [while], data = [none] ++j; // depends on control dependency: [while], data = [none] } selection.set(i, pop.get(j%pop.size())); // depends on control dependency: [for], data = [i] } return selection.toISeq(); } }
public class class_name { private Icon getIcon(AbstractButton b, Icon specificIcon, Icon defaultIcon, int state) { Icon icon = specificIcon; if (icon == null) { if (defaultIcon instanceof UIResource) { icon = getSynthIcon(b, state); if (icon == null) { icon = defaultIcon; } } else { icon = defaultIcon; } } return icon; } }
public class class_name { private Icon getIcon(AbstractButton b, Icon specificIcon, Icon defaultIcon, int state) { Icon icon = specificIcon; if (icon == null) { if (defaultIcon instanceof UIResource) { icon = getSynthIcon(b, state); // depends on control dependency: [if], data = [none] if (icon == null) { icon = defaultIcon; // depends on control dependency: [if], data = [none] } } else { icon = defaultIcon; // depends on control dependency: [if], data = [none] } } return icon; } }
public class class_name { public static String decipher(String key, String cipherText, String cipherType) { if (key == null || key == "") { return cipherText; } if (cipherText == null) { return null; } if (cipherType == null || cipherType == "") { return cipherText; } else if ("1".equalsIgnoreCase(cipherType)) { byte[] keyBytes = convertKeyToByteArray(key); byte[] cipherBytes = Base64.decode(cipherText); sanityCheckOnCipherBytes(cipherText, cipherBytes); byte[] clearTextBytes = applyCipher(keyBytes, cipherBytes); return convertByteArrayToClearText(clearTextBytes); } else { throw new IllegalArgumentException("Unrecognized cipher type: '" + cipherType + "'"); } } }
public class class_name { public static String decipher(String key, String cipherText, String cipherType) { if (key == null || key == "") { return cipherText; // depends on control dependency: [if], data = [none] } if (cipherText == null) { return null; // depends on control dependency: [if], data = [none] } if (cipherType == null || cipherType == "") { return cipherText; // depends on control dependency: [if], data = [none] } else if ("1".equalsIgnoreCase(cipherType)) { byte[] keyBytes = convertKeyToByteArray(key); byte[] cipherBytes = Base64.decode(cipherText); sanityCheckOnCipherBytes(cipherText, cipherBytes); // depends on control dependency: [if], data = [none] byte[] clearTextBytes = applyCipher(keyBytes, cipherBytes); return convertByteArrayToClearText(clearTextBytes); // depends on control dependency: [if], data = [none] } else { throw new IllegalArgumentException("Unrecognized cipher type: '" + cipherType + "'"); } } }
public class class_name { public void closeRun() { if(positionChanges.isEmpty()) return; SortedMap<Integer,Integer> temp=positionChanges; //adapt old positions to new mapping while(!positionMap.isEmpty()){ Integer key=positionMap.firstKey(); Collection<Integer> modifiers=old2NewMap.headMap(key+1).values(); Integer newposition=key; for(Iterator<Integer> it=modifiers.iterator(); it.hasNext(); newposition+=it.next()){} Integer value=positionMap.get(key); if(positionChanges.containsKey(newposition)) value+=positionChanges.get(newposition); positionChanges.put(newposition, value); positionMap.remove(key); } positionChanges=positionMap; positionMap=temp; old2NewMap.clear(); accumulatedModifier=0; return; } }
public class class_name { public void closeRun() { if(positionChanges.isEmpty()) return; SortedMap<Integer,Integer> temp=positionChanges; //adapt old positions to new mapping while(!positionMap.isEmpty()){ Integer key=positionMap.firstKey(); Collection<Integer> modifiers=old2NewMap.headMap(key+1).values(); Integer newposition=key; for(Iterator<Integer> it=modifiers.iterator(); it.hasNext(); newposition+=it.next()){} Integer value=positionMap.get(key); if(positionChanges.containsKey(newposition)) value+=positionChanges.get(newposition); positionChanges.put(newposition, value); // depends on control dependency: [while], data = [none] positionMap.remove(key); // depends on control dependency: [while], data = [none] } positionChanges=positionMap; positionMap=temp; old2NewMap.clear(); accumulatedModifier=0; return; } }
public class class_name { @Override public String listPop(String listName, boolean block, int timeout) { if (!block) { return redisClient.lpop(listName); } List<String> result = redisClient.blpop(timeout, listName); return result != null && result.size() > 1 ? result.get(1) : null; } }
public class class_name { @Override public String listPop(String listName, boolean block, int timeout) { if (!block) { return redisClient.lpop(listName); // depends on control dependency: [if], data = [none] } List<String> result = redisClient.blpop(timeout, listName); return result != null && result.size() > 1 ? result.get(1) : null; } }
public class class_name { public void onChange(Widget widget) { if (widget == m_tbHexColor) { try { CmsColor color = new CmsColor(); color.setHex(m_tbHexColor.getText()); m_tbHue.setText(Integer.toString(color.getHue())); m_tbSaturation.setText(Integer.toString(color.getSaturation())); m_tbBrightness.setText(Integer.toString(color.getValue())); m_tbRed.setText(Integer.toString(color.getRed())); m_tbGreen.setText(Integer.toString(color.getGreen())); m_tbBlue.setText(Integer.toString(color.getBlue())); m_tbHexColor.setText(color.getHex()); setPreview(color.getHex()); } catch (Exception e) { // do something. } } if ((widget == m_tbRed) || (widget == m_tbGreen) || (widget == m_tbBlue)) { // Don't allow this value to overflow or underflow try { if (Integer.parseInt(((TextBox)widget).getText()) > 255) { ((TextBox)widget).setText("255"); } if (Integer.parseInt(((TextBox)widget).getText()) < 0) { ((TextBox)widget).setText("0"); } } catch (Exception e) { // do something. } m_red = Integer.parseInt(m_tbRed.getText()); m_green = Integer.parseInt(m_tbGreen.getText()); m_blue = Integer.parseInt(m_tbBlue.getText()); m_hue = Integer.parseInt(m_tbHue.getText()); m_saturation = Integer.parseInt(m_tbSaturation.getText()); m_brightness = Integer.parseInt(m_tbBrightness.getText()); try { CmsColor color = new CmsColor(); color.setRGB(m_red, m_green, m_blue); m_tbHue.setText(Integer.toString(color.getHue())); m_tbSaturation.setText(Integer.toString(color.getSaturation())); m_tbBrightness.setText(Integer.toString(color.getValue())); m_tbHexColor.setText(color.getHex()); setPreview(color.getHex()); } catch (Exception e) { // do something. } } else if ((widget == m_tbHue) || (widget == m_tbSaturation) || (widget == m_tbBrightness)) { try { if (Integer.parseInt(m_tbHue.getText()) > 359) { m_tbHue.setText("359"); } if (Integer.parseInt(m_tbSaturation.getText()) > 100) { m_tbSaturation.setText("100"); } if (Integer.parseInt(m_tbBrightness.getText()) > 100) { m_tbBrightness.setText("100"); } } catch (Exception e) { // do something. } m_red = Integer.parseInt(m_tbRed.getText()); m_green = Integer.parseInt(m_tbGreen.getText()); m_blue = Integer.parseInt(m_tbBlue.getText()); m_hue = Integer.parseInt(m_tbHue.getText()); m_saturation = Integer.parseInt(m_tbSaturation.getText()); m_brightness = Integer.parseInt(m_tbBrightness.getText()); // Figure out colors try { CmsColor color = new CmsColor(); color.setHSV(m_hue, m_saturation, m_brightness); m_tbRed.setText(Integer.toString(color.getRed())); m_tbGreen.setText(Integer.toString(color.getGreen())); m_tbBlue.setText(Integer.toString(color.getBlue())); m_tbHexColor.setText(color.getHex()); setPreview(color.getHex()); } catch (Exception e) { // do something. } } // Let the sliders know something's changed updateSliders(); } }
public class class_name { public void onChange(Widget widget) { if (widget == m_tbHexColor) { try { CmsColor color = new CmsColor(); color.setHex(m_tbHexColor.getText()); // depends on control dependency: [try], data = [none] m_tbHue.setText(Integer.toString(color.getHue())); // depends on control dependency: [try], data = [none] m_tbSaturation.setText(Integer.toString(color.getSaturation())); // depends on control dependency: [try], data = [none] m_tbBrightness.setText(Integer.toString(color.getValue())); // depends on control dependency: [try], data = [none] m_tbRed.setText(Integer.toString(color.getRed())); // depends on control dependency: [try], data = [none] m_tbGreen.setText(Integer.toString(color.getGreen())); // depends on control dependency: [try], data = [none] m_tbBlue.setText(Integer.toString(color.getBlue())); // depends on control dependency: [try], data = [none] m_tbHexColor.setText(color.getHex()); // depends on control dependency: [try], data = [none] setPreview(color.getHex()); // depends on control dependency: [try], data = [none] } catch (Exception e) { // do something. } // depends on control dependency: [catch], data = [none] } if ((widget == m_tbRed) || (widget == m_tbGreen) || (widget == m_tbBlue)) { // Don't allow this value to overflow or underflow try { if (Integer.parseInt(((TextBox)widget).getText()) > 255) { ((TextBox)widget).setText("255"); // depends on control dependency: [if], data = [none] } if (Integer.parseInt(((TextBox)widget).getText()) < 0) { ((TextBox)widget).setText("0"); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // do something. } // depends on control dependency: [catch], data = [none] m_red = Integer.parseInt(m_tbRed.getText()); // depends on control dependency: [if], data = [none] m_green = Integer.parseInt(m_tbGreen.getText()); // depends on control dependency: [if], data = [none] m_blue = Integer.parseInt(m_tbBlue.getText()); // depends on control dependency: [if], data = [none] m_hue = Integer.parseInt(m_tbHue.getText()); // depends on control dependency: [if], data = [none] m_saturation = Integer.parseInt(m_tbSaturation.getText()); // depends on control dependency: [if], data = [none] m_brightness = Integer.parseInt(m_tbBrightness.getText()); // depends on control dependency: [if], data = [none] try { CmsColor color = new CmsColor(); color.setRGB(m_red, m_green, m_blue); // depends on control dependency: [try], data = [none] m_tbHue.setText(Integer.toString(color.getHue())); // depends on control dependency: [try], data = [none] m_tbSaturation.setText(Integer.toString(color.getSaturation())); // depends on control dependency: [try], data = [none] m_tbBrightness.setText(Integer.toString(color.getValue())); // depends on control dependency: [try], data = [none] m_tbHexColor.setText(color.getHex()); // depends on control dependency: [try], data = [none] setPreview(color.getHex()); // depends on control dependency: [try], data = [none] } catch (Exception e) { // do something. } // depends on control dependency: [catch], data = [none] } else if ((widget == m_tbHue) || (widget == m_tbSaturation) || (widget == m_tbBrightness)) { try { if (Integer.parseInt(m_tbHue.getText()) > 359) { m_tbHue.setText("359"); // depends on control dependency: [if], data = [none] } if (Integer.parseInt(m_tbSaturation.getText()) > 100) { m_tbSaturation.setText("100"); // depends on control dependency: [if], data = [none] } if (Integer.parseInt(m_tbBrightness.getText()) > 100) { m_tbBrightness.setText("100"); // depends on control dependency: [if], data = [none] } } catch (Exception e) { // do something. } // depends on control dependency: [catch], data = [none] m_red = Integer.parseInt(m_tbRed.getText()); // depends on control dependency: [if], data = [none] m_green = Integer.parseInt(m_tbGreen.getText()); // depends on control dependency: [if], data = [none] m_blue = Integer.parseInt(m_tbBlue.getText()); // depends on control dependency: [if], data = [none] m_hue = Integer.parseInt(m_tbHue.getText()); // depends on control dependency: [if], data = [none] m_saturation = Integer.parseInt(m_tbSaturation.getText()); // depends on control dependency: [if], data = [none] m_brightness = Integer.parseInt(m_tbBrightness.getText()); // depends on control dependency: [if], data = [none] // Figure out colors try { CmsColor color = new CmsColor(); color.setHSV(m_hue, m_saturation, m_brightness); // depends on control dependency: [try], data = [none] m_tbRed.setText(Integer.toString(color.getRed())); // depends on control dependency: [try], data = [none] m_tbGreen.setText(Integer.toString(color.getGreen())); // depends on control dependency: [try], data = [none] m_tbBlue.setText(Integer.toString(color.getBlue())); // depends on control dependency: [try], data = [none] m_tbHexColor.setText(color.getHex()); // depends on control dependency: [try], data = [none] setPreview(color.getHex()); // depends on control dependency: [try], data = [none] } catch (Exception e) { // do something. } // depends on control dependency: [catch], data = [none] } // Let the sliders know something's changed updateSliders(); } }
public class class_name { private boolean executeEvents(final AjaxRequestTarget _target, final Map<String, String[]> _other, final List<Classification> _classifications) throws EFapsException { AjaxSubmitCloseButton.LOG.trace("entering executeEvents"); boolean ret = true; final ICmdUIObject cmdUIObject = (ICmdUIObject) getPage().getDefaultModelObject(); final TargetMode mode; if (cmdUIObject instanceof IModeObject) { mode = ((IModeObject) cmdUIObject).getMode(); } else { mode = TargetMode.UNKNOWN; } final List<Object> tuplets = new ArrayList<>(); tuplets.add(ParameterValues.OTHERS); tuplets.add(_other); tuplets.add(ParameterValues.ACCESSMODE); tuplets.add(mode); if (cmdUIObject instanceof AbstractUIPageObject) { tuplets.add(ParameterValues.OIDMAP4UI); tuplets.add(((AbstractUIPageObject) getForm().getPage().getDefaultModelObject()).getUiID2Oid()); } if (_classifications.size() > 0) { tuplets.add(ParameterValues.CLASSIFICATIONS); tuplets.add(_classifications); } final List<Return> returns = cmdUIObject.executeEvents(EventType.UI_COMMAND_EXECUTE, tuplets.toArray()); for (final Return oneReturn : returns) { if (oneReturn.get(ReturnValues.TRUE) == null && !oneReturn.isEmpty() && oneReturn.get(ReturnValues.VALUES) instanceof String) { boolean sniplett = false; String key = (String) oneReturn.get(ReturnValues.VALUES); if (key == null) { key = (String) oneReturn.get(ReturnValues.SNIPLETT); sniplett = true; } showDialog(_target, key, sniplett, false); ret = false; break; } else if (oneReturn.get(ReturnValues.TRUE) != null && !oneReturn.isEmpty() && cmdUIObject.getCommand().isTargetShowFile()) { if (oneReturn.get(ReturnValues.VALUES) instanceof File) { final File file = (File) oneReturn.get(ReturnValues.VALUES); ((EFapsSession) getSession()).setFile(file); } } if (oneReturn.get(ReturnValues.INSTANCE) != null && cmdUIObject instanceof AbstractInstanceObject) { ((AbstractInstanceObject) cmdUIObject).setInstanceKey(((Instance) oneReturn.get(ReturnValues.INSTANCE)) .getKey()); } } if (cmdUIObject instanceof AbstractUIPageObject && ((AbstractUIPageObject) cmdUIObject).isOpenedByPicker()) { final PageReference pageRef = ((AbstractContentPage) getForm().getPage()).getCalledByPageReference(); ((AbstractUIPageObject) cmdUIObject).getPicker().executeEvents(EventType.UI_COMMAND_EXECUTE, ParameterValues.OTHERS, _other); ((AbstractUIObject) pageRef.getPage().getDefaultModelObject()).setPicker( ((AbstractUIPageObject) cmdUIObject).getPicker()); } return ret; } }
public class class_name { private boolean executeEvents(final AjaxRequestTarget _target, final Map<String, String[]> _other, final List<Classification> _classifications) throws EFapsException { AjaxSubmitCloseButton.LOG.trace("entering executeEvents"); boolean ret = true; final ICmdUIObject cmdUIObject = (ICmdUIObject) getPage().getDefaultModelObject(); final TargetMode mode; if (cmdUIObject instanceof IModeObject) { mode = ((IModeObject) cmdUIObject).getMode(); } else { mode = TargetMode.UNKNOWN; } final List<Object> tuplets = new ArrayList<>(); tuplets.add(ParameterValues.OTHERS); tuplets.add(_other); tuplets.add(ParameterValues.ACCESSMODE); tuplets.add(mode); if (cmdUIObject instanceof AbstractUIPageObject) { tuplets.add(ParameterValues.OIDMAP4UI); tuplets.add(((AbstractUIPageObject) getForm().getPage().getDefaultModelObject()).getUiID2Oid()); } if (_classifications.size() > 0) { tuplets.add(ParameterValues.CLASSIFICATIONS); tuplets.add(_classifications); } final List<Return> returns = cmdUIObject.executeEvents(EventType.UI_COMMAND_EXECUTE, tuplets.toArray()); for (final Return oneReturn : returns) { if (oneReturn.get(ReturnValues.TRUE) == null && !oneReturn.isEmpty() && oneReturn.get(ReturnValues.VALUES) instanceof String) { boolean sniplett = false; String key = (String) oneReturn.get(ReturnValues.VALUES); if (key == null) { key = (String) oneReturn.get(ReturnValues.SNIPLETT); // depends on control dependency: [if], data = [none] sniplett = true; // depends on control dependency: [if], data = [none] } showDialog(_target, key, sniplett, false); // depends on control dependency: [if], data = [none] ret = false; // depends on control dependency: [if], data = [none] break; } else if (oneReturn.get(ReturnValues.TRUE) != null && !oneReturn.isEmpty() && cmdUIObject.getCommand().isTargetShowFile()) { if (oneReturn.get(ReturnValues.VALUES) instanceof File) { final File file = (File) oneReturn.get(ReturnValues.VALUES); ((EFapsSession) getSession()).setFile(file); // depends on control dependency: [if], data = [none] } } if (oneReturn.get(ReturnValues.INSTANCE) != null && cmdUIObject instanceof AbstractInstanceObject) { ((AbstractInstanceObject) cmdUIObject).setInstanceKey(((Instance) oneReturn.get(ReturnValues.INSTANCE)) .getKey()); // depends on control dependency: [if], data = [none] } } if (cmdUIObject instanceof AbstractUIPageObject && ((AbstractUIPageObject) cmdUIObject).isOpenedByPicker()) { final PageReference pageRef = ((AbstractContentPage) getForm().getPage()).getCalledByPageReference(); ((AbstractUIPageObject) cmdUIObject).getPicker().executeEvents(EventType.UI_COMMAND_EXECUTE, ParameterValues.OTHERS, _other); ((AbstractUIObject) pageRef.getPage().getDefaultModelObject()).setPicker( ((AbstractUIPageObject) cmdUIObject).getPicker()); } return ret; } }
public class class_name { @Override public String getLabel() { if (label != null) // LIGHTWEIGHT EDGE return label; else if (rawElement != null) { if (settings != null && settings.isUseClassForEdgeLabel()) { final String clsName = getRecord().getClassName(); if (!OrientEdgeType.CLASS_NAME.equals(clsName)) // RETURN THE CLASS NAME return OrientBaseGraph.decodeClassName(clsName); } setCurrentGraphInThreadLocal(); final ODocument doc = rawElement.getRecord(); if (doc == null) return null; final String label = doc.field(OrientElement.LABEL_FIELD_NAME); if (label != null) return OrientBaseGraph.decodeClassName(label); } return null; } }
public class class_name { @Override public String getLabel() { if (label != null) // LIGHTWEIGHT EDGE return label; else if (rawElement != null) { if (settings != null && settings.isUseClassForEdgeLabel()) { final String clsName = getRecord().getClassName(); if (!OrientEdgeType.CLASS_NAME.equals(clsName)) // RETURN THE CLASS NAME return OrientBaseGraph.decodeClassName(clsName); } setCurrentGraphInThreadLocal(); // depends on control dependency: [if], data = [none] final ODocument doc = rawElement.getRecord(); if (doc == null) return null; final String label = doc.field(OrientElement.LABEL_FIELD_NAME); if (label != null) return OrientBaseGraph.decodeClassName(label); } return null; } }
public class class_name { public void setSolutionStackDetails(java.util.Collection<SolutionStackDescription> solutionStackDetails) { if (solutionStackDetails == null) { this.solutionStackDetails = null; return; } this.solutionStackDetails = new com.amazonaws.internal.SdkInternalList<SolutionStackDescription>(solutionStackDetails); } }
public class class_name { public void setSolutionStackDetails(java.util.Collection<SolutionStackDescription> solutionStackDetails) { if (solutionStackDetails == null) { this.solutionStackDetails = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.solutionStackDetails = new com.amazonaws.internal.SdkInternalList<SolutionStackDescription>(solutionStackDetails); } }
public class class_name { private static JSONArray parseChildShapesRecursive(ArrayList<Shape> childShapes) throws JSONException { if (childShapes != null) { JSONArray childShapesArray = new JSONArray(); for (Shape childShape : childShapes) { JSONObject childShapeObject = new JSONObject(); childShapeObject.put("resourceId", childShape.getResourceId().toString()); childShapeObject.put("properties", parseProperties(childShape.getProperties())); childShapeObject.put("stencil", parseStencil(childShape.getStencilId())); childShapeObject.put("childShapes", parseChildShapesRecursive(childShape.getChildShapes())); childShapeObject.put("outgoing", parseOutgoings(childShape.getOutgoings())); childShapeObject.put("bounds", parseBounds(childShape.getBounds())); childShapeObject.put("dockers", parseDockers(childShape.getDockers())); if (childShape.getTarget() != null) { childShapeObject.put("target", parseTarget(childShape.getTarget())); } childShapesArray.put(childShapeObject); } return childShapesArray; } return new JSONArray(); } }
public class class_name { private static JSONArray parseChildShapesRecursive(ArrayList<Shape> childShapes) throws JSONException { if (childShapes != null) { JSONArray childShapesArray = new JSONArray(); for (Shape childShape : childShapes) { JSONObject childShapeObject = new JSONObject(); childShapeObject.put("resourceId", childShape.getResourceId().toString()); childShapeObject.put("properties", parseProperties(childShape.getProperties())); childShapeObject.put("stencil", parseStencil(childShape.getStencilId())); childShapeObject.put("childShapes", parseChildShapesRecursive(childShape.getChildShapes())); childShapeObject.put("outgoing", parseOutgoings(childShape.getOutgoings())); childShapeObject.put("bounds", parseBounds(childShape.getBounds())); childShapeObject.put("dockers", parseDockers(childShape.getDockers())); if (childShape.getTarget() != null) { childShapeObject.put("target", parseTarget(childShape.getTarget())); // depends on control dependency: [if], data = [none] } childShapesArray.put(childShapeObject); } return childShapesArray; } return new JSONArray(); } }
public class class_name { public synchronized Pool getPool(String name) { Pool pool = pools.get(name); if (pool == null) { boolean isConfiguredPool = poolNamesInAllocFile.contains(name); pool = new Pool(name, isConfiguredPool); pools.put(name, pool); } return pool; } }
public class class_name { public synchronized Pool getPool(String name) { Pool pool = pools.get(name); if (pool == null) { boolean isConfiguredPool = poolNamesInAllocFile.contains(name); pool = new Pool(name, isConfiguredPool); // depends on control dependency: [if], data = [none] pools.put(name, pool); // depends on control dependency: [if], data = [none] } return pool; } }
public class class_name { public boolean clearEncryptionKeyData() { try { SharedPreferences.Editor editor = this.prefs.edit(); editor.remove(preferenceKey); editor.commit(); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); return false; } return true; } }
public class class_name { public boolean clearEncryptionKeyData() { try { SharedPreferences.Editor editor = this.prefs.edit(); editor.remove(preferenceKey); // depends on control dependency: [try], data = [none] editor.commit(); // depends on control dependency: [try], data = [none] } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e); return false; } // depends on control dependency: [catch], data = [none] return true; } }
public class class_name { public List<ParsingResult> parseUsing( final String ddl, final String firstParserId, final String secondParserId, final String... additionalParserIds ) throws ParsingException { CheckArg.isNotEmpty(firstParserId, "firstParserId"); CheckArg.isNotEmpty(secondParserId, "secondParserId"); if (additionalParserIds != null) { CheckArg.containsNoNulls(additionalParserIds, "additionalParserIds"); } final int numParsers = ((additionalParserIds == null) ? 2 : (additionalParserIds.length + 2)); final List<DdlParser> selectedParsers = new ArrayList<DdlParser>(numParsers); { // add first parser final DdlParser parser = getParser(firstParserId); if (parser == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.unknownParser.text(firstParserId)); } selectedParsers.add(parser); } { // add second parser final DdlParser parser = getParser(secondParserId); if (parser == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.unknownParser.text(secondParserId)); } selectedParsers.add(parser); } // add remaining parsers if ((additionalParserIds != null) && (additionalParserIds.length != 0)) { for (final String id : additionalParserIds) { final DdlParser parser = getParser(id); if (parser == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.unknownParser.text(id)); } selectedParsers.add(parser); } } return parseUsing(ddl, selectedParsers); } }
public class class_name { public List<ParsingResult> parseUsing( final String ddl, final String firstParserId, final String secondParserId, final String... additionalParserIds ) throws ParsingException { CheckArg.isNotEmpty(firstParserId, "firstParserId"); CheckArg.isNotEmpty(secondParserId, "secondParserId"); if (additionalParserIds != null) { CheckArg.containsNoNulls(additionalParserIds, "additionalParserIds"); // depends on control dependency: [if], data = [(additionalParserIds] } final int numParsers = ((additionalParserIds == null) ? 2 : (additionalParserIds.length + 2)); final List<DdlParser> selectedParsers = new ArrayList<DdlParser>(numParsers); { // add first parser final DdlParser parser = getParser(firstParserId); if (parser == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.unknownParser.text(firstParserId)); } selectedParsers.add(parser); } { // add second parser final DdlParser parser = getParser(secondParserId); if (parser == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.unknownParser.text(secondParserId)); } selectedParsers.add(parser); } // add remaining parsers if ((additionalParserIds != null) && (additionalParserIds.length != 0)) { for (final String id : additionalParserIds) { final DdlParser parser = getParser(id); if (parser == null) { throw new ParsingException(Position.EMPTY_CONTENT_POSITION, DdlSequencerI18n.unknownParser.text(id)); } selectedParsers.add(parser); // depends on control dependency: [for], data = [none] } } return parseUsing(ddl, selectedParsers); } }
public class class_name { public static void setPropertySafely(Marshaller marshaller, String name, Object value) { try { marshaller.setProperty(name, value); } catch (PropertyException e) { LOGGER.warn(String.format("Can't set \"%s\" property to given marshaller", name), e); } } }
public class class_name { public static void setPropertySafely(Marshaller marshaller, String name, Object value) { try { marshaller.setProperty(name, value); // depends on control dependency: [try], data = [none] } catch (PropertyException e) { LOGGER.warn(String.format("Can't set \"%s\" property to given marshaller", name), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public <T> List<Key<T>> getKeysByRefs(final List<DBRef> refs) { final List<Key<T>> keys = new ArrayList<Key<T>>(refs.size()); for (final DBRef ref : refs) { final Key<T> testKey = refToKey(ref); keys.add(testKey); } return keys; } }
public class class_name { public <T> List<Key<T>> getKeysByRefs(final List<DBRef> refs) { final List<Key<T>> keys = new ArrayList<Key<T>>(refs.size()); for (final DBRef ref : refs) { final Key<T> testKey = refToKey(ref); keys.add(testKey); // depends on control dependency: [for], data = [none] } return keys; } }
public class class_name { public Observable<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>> updateWithServiceResponseAsync(String resourceGroupName, String jobName, String outputName, OutputInner output) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (jobName == null) { throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); } if (outputName == null) { throw new IllegalArgumentException("Parameter outputName is required and cannot be null."); } if (output == null) { throw new IllegalArgumentException("Parameter output is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(output); final String ifMatch = null; return service.update(this.client.subscriptionId(), resourceGroupName, jobName, outputName, output, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>> call(Response<ResponseBody> response) { try { ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders> clientResponse = updateDelegate(response); return Observable.just(clientResponse); } catch (Throwable t) { return Observable.error(t); } } }); } }
public class class_name { public Observable<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>> updateWithServiceResponseAsync(String resourceGroupName, String jobName, String outputName, OutputInner output) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); } if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (jobName == null) { throw new IllegalArgumentException("Parameter jobName is required and cannot be null."); } if (outputName == null) { throw new IllegalArgumentException("Parameter outputName is required and cannot be null."); } if (output == null) { throw new IllegalArgumentException("Parameter output is required and cannot be null."); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null."); } Validator.validate(output); final String ifMatch = null; return service.update(this.client.subscriptionId(), resourceGroupName, jobName, outputName, output, ifMatch, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()) .flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>>>() { @Override public Observable<ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders>> call(Response<ResponseBody> response) { try { ServiceResponseWithHeaders<OutputInner, OutputsUpdateHeaders> clientResponse = updateDelegate(response); return Observable.just(clientResponse); // depends on control dependency: [try], data = [none] } catch (Throwable t) { return Observable.error(t); } // depends on control dependency: [catch], data = [none] } }); } }
public class class_name { public void setCombiners( List<TupleCombiner> combiners) { combiners_ = new ArrayList<TupleCombiner>(); if( combiners != null) { combiners_.addAll( combiners); } } }
public class class_name { public void setCombiners( List<TupleCombiner> combiners) { combiners_ = new ArrayList<TupleCombiner>(); if( combiners != null) { combiners_.addAll( combiners); // depends on control dependency: [if], data = [( combiners] } } }
public class class_name { public static Hop resolveHostByDnsSrvLookup(Hop hop) { String host = hop.getHost(); String transport = hop.getTransport(); if(transport==null) { transport = ListeningPoint.UDP; } transport = transport.toLowerCase(); Record[] records = null; try { records = new Lookup("_sip._" + transport + "." + host, Type.SRV).run(); } catch (TextParseException e) { logger.error("Impossible to parse the parameters for dns lookup", e); } if (records == null || records.length == 0) { // SRV lookup failed, use the outbound proxy directly. if(logger.isDebugEnabled()) { logger .debug("SRV lookup for host:transport " + ""+ host + "/" + transport + " returned nothing " + "-- we are going to just use the domain name directly"); } return hop; } else { Map<String, String> cachedEntry = foundCachedEntry(host, transport, (Record[]) records); if(cachedEntry == null) { SRVRecord record = (SRVRecord) records[0]; int recordPort = record.getPort(); String resolvedName = record.getTarget().toString(); try { String hostAddress= InetAddress.getByName(resolvedName).getHostAddress(); if(logger.isDebugEnabled()) { logger.debug("Did a successful DNS SRV lookup for host:transport " + ""+ host + "/" + transport + " , Host Name = " + resolvedName + " , Host IP Address = " + hostAddress + ", Host Port = " + recordPort); } Map<String, String> entry = new HashMap<String, String>(); entry.put("hostName", resolvedName); entry.put("hostAddress", hostAddress); entry.put("hostPort", ""+recordPort); cachedLookup.putIfAbsent(host + transport, entry); return new HopImpl(hostAddress, recordPort, transport); } catch (UnknownHostException e) { logger.error("Impossible to get the host address of the resolved name, " + "we are going to just use the domain name directly" + resolvedName, e); return hop; } } else { String entryResolvedName = cachedEntry.get("hostName"); String hostAddress = cachedEntry.get("hostAddress"); String hostPort = cachedEntry.get("hostPort"); if(logger.isDebugEnabled()) { logger.debug("Reusing a previous DNS SRV lookup for host:transport " + ""+ host + "/" + transport + " , Host Name = " + entryResolvedName + " , Host IP Address = " + hostAddress + ", Host Port = " + hostPort); } return new HopImpl(hostAddress, Integer.parseInt(hostPort), transport); } } } }
public class class_name { public static Hop resolveHostByDnsSrvLookup(Hop hop) { String host = hop.getHost(); String transport = hop.getTransport(); if(transport==null) { transport = ListeningPoint.UDP; // depends on control dependency: [if], data = [none] } transport = transport.toLowerCase(); Record[] records = null; try { records = new Lookup("_sip._" + transport + "." + host, Type.SRV).run(); // depends on control dependency: [try], data = [none] } catch (TextParseException e) { logger.error("Impossible to parse the parameters for dns lookup", e); } // depends on control dependency: [catch], data = [none] if (records == null || records.length == 0) { // SRV lookup failed, use the outbound proxy directly. if(logger.isDebugEnabled()) { logger .debug("SRV lookup for host:transport " + ""+ host + "/" + transport + " returned nothing " + "-- we are going to just use the domain name directly"); // depends on control dependency: [if], data = [none] } return hop; // depends on control dependency: [if], data = [none] } else { Map<String, String> cachedEntry = foundCachedEntry(host, transport, (Record[]) records); if(cachedEntry == null) { SRVRecord record = (SRVRecord) records[0]; int recordPort = record.getPort(); String resolvedName = record.getTarget().toString(); try { String hostAddress= InetAddress.getByName(resolvedName).getHostAddress(); if(logger.isDebugEnabled()) { logger.debug("Did a successful DNS SRV lookup for host:transport " + ""+ host + "/" + transport + " , Host Name = " + resolvedName + " , Host IP Address = " + hostAddress + ", Host Port = " + recordPort); // depends on control dependency: [if], data = [none] } Map<String, String> entry = new HashMap<String, String>(); entry.put("hostName", resolvedName); // depends on control dependency: [try], data = [none] entry.put("hostAddress", hostAddress); // depends on control dependency: [try], data = [none] entry.put("hostPort", ""+recordPort); // depends on control dependency: [try], data = [none] cachedLookup.putIfAbsent(host + transport, entry); // depends on control dependency: [try], data = [none] return new HopImpl(hostAddress, recordPort, transport); // depends on control dependency: [try], data = [none] } catch (UnknownHostException e) { logger.error("Impossible to get the host address of the resolved name, " + "we are going to just use the domain name directly" + resolvedName, e); return hop; } // depends on control dependency: [catch], data = [none] } else { String entryResolvedName = cachedEntry.get("hostName"); String hostAddress = cachedEntry.get("hostAddress"); String hostPort = cachedEntry.get("hostPort"); if(logger.isDebugEnabled()) { logger.debug("Reusing a previous DNS SRV lookup for host:transport " + ""+ host + "/" + transport + " , Host Name = " + entryResolvedName + " , Host IP Address = " + hostAddress + ", Host Port = " + hostPort); // depends on control dependency: [if], data = [none] } return new HopImpl(hostAddress, Integer.parseInt(hostPort), transport); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static void checkInputFile(final String name, final File inFile) { String isFailure = null; if (inFile.isDirectory()) { isFailure = "The " + name + " file is a directory!"; } else if (!inFile.exists()) { isFailure = "The " + name + " file does not exist!"; } else if (!inFile.canRead()) { isFailure = "No permissions to read the " + name + " file!"; } if (null != isFailure) { throw new TerminateToolException(-1, isFailure + " Path: " + inFile.getAbsolutePath()); } } }
public class class_name { private static void checkInputFile(final String name, final File inFile) { String isFailure = null; if (inFile.isDirectory()) { isFailure = "The " + name + " file is a directory!"; // depends on control dependency: [if], data = [none] } else if (!inFile.exists()) { isFailure = "The " + name + " file does not exist!"; // depends on control dependency: [if], data = [none] } else if (!inFile.canRead()) { isFailure = "No permissions to read the " + name + " file!"; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none] } if (null != isFailure) { throw new TerminateToolException(-1, isFailure + " Path: " + inFile.getAbsolutePath()); } } }
public class class_name { public synchronized void setSource(Source source) { String sourceId = CollectorManagerUtils.getSourceId(source); SourceManager srcMgr = null; if (!sourceMgrs.containsKey(sourceId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Adding source to the list", source.getClass()); } srcMgr = new SourceManager(source); sourceMgrs.put(srcMgr.getSourceId(), srcMgr); /* * Obtain the conduit/bufferManager and put it in bufferManagerMap * if the source being set is message/log or trace. * * This is to make up for the prior logic where conduit/bufferManager * were created before the source was created and were set into the bufferManagerMap * * With the new logic concerning LogSource and TraceSource for JsonLogging, the LogSource * and TraceSource and their respective Conduit/BufferManager were created outside of * CollectorManager and OSGI serviceability. Thus, the following call to processInitializedConduits * retrieves the conduits/bufferManagers that were created 'outside' collectorManager's realm of * control and places them into bufferManagerMap because the following logic expects the prior * statement to be true. * * Alas, continue 'as normal' afterwards. */ processInitializedConduits(source); //Passes BufferManager onto SourceManager which will then associate a Handler to it. srcMgr.setBufferManager(bufferManagerMap.get(sourceId)); //Handle pending subscriptions for this source for (Entry<String, HandlerManager> entry : handlerMgrs.entrySet()) { HandlerManager hdlrMgr = entry.getValue(); //Check if source is in the pending subscription list for this handler if (hdlrMgr.getPendingSubscriptions().contains(sourceId)) { List<String> sourceIds = new ArrayList<String>(); sourceIds.add(sourceId); try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Handling pending subscription " + sourceId, hdlrMgr.getHandlerId()); } subscribe(hdlrMgr.getHandler(), sourceIds); } catch (Exception e) { } } } } } }
public class class_name { public synchronized void setSource(Source source) { String sourceId = CollectorManagerUtils.getSourceId(source); SourceManager srcMgr = null; if (!sourceMgrs.containsKey(sourceId)) { if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) { Tr.event(tc, "Adding source to the list", source.getClass()); // depends on control dependency: [if], data = [none] } srcMgr = new SourceManager(source); // depends on control dependency: [if], data = [none] sourceMgrs.put(srcMgr.getSourceId(), srcMgr); // depends on control dependency: [if], data = [none] /* * Obtain the conduit/bufferManager and put it in bufferManagerMap * if the source being set is message/log or trace. * * This is to make up for the prior logic where conduit/bufferManager * were created before the source was created and were set into the bufferManagerMap * * With the new logic concerning LogSource and TraceSource for JsonLogging, the LogSource * and TraceSource and their respective Conduit/BufferManager were created outside of * CollectorManager and OSGI serviceability. Thus, the following call to processInitializedConduits * retrieves the conduits/bufferManagers that were created 'outside' collectorManager's realm of * control and places them into bufferManagerMap because the following logic expects the prior * statement to be true. * * Alas, continue 'as normal' afterwards. */ processInitializedConduits(source); // depends on control dependency: [if], data = [none] //Passes BufferManager onto SourceManager which will then associate a Handler to it. srcMgr.setBufferManager(bufferManagerMap.get(sourceId)); // depends on control dependency: [if], data = [none] //Handle pending subscriptions for this source for (Entry<String, HandlerManager> entry : handlerMgrs.entrySet()) { HandlerManager hdlrMgr = entry.getValue(); //Check if source is in the pending subscription list for this handler if (hdlrMgr.getPendingSubscriptions().contains(sourceId)) { List<String> sourceIds = new ArrayList<String>(); sourceIds.add(sourceId); // depends on control dependency: [if], data = [none] try { if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, "Handling pending subscription " + sourceId, hdlrMgr.getHandlerId()); // depends on control dependency: [if], data = [none] } subscribe(hdlrMgr.getHandler(), sourceIds); // depends on control dependency: [try], data = [none] } catch (Exception e) { } // depends on control dependency: [catch], data = [none] } } } } }
public class class_name { public <T extends CharSequence> T notBlank(final T chars, final String message) { if (chars == null) { failNull(message); } if (StringUtils.isBlank(chars)) { fail(message); } return chars; } }
public class class_name { public <T extends CharSequence> T notBlank(final T chars, final String message) { if (chars == null) { failNull(message); // depends on control dependency: [if], data = [none] } if (StringUtils.isBlank(chars)) { fail(message); // depends on control dependency: [if], data = [none] } return chars; } }
public class class_name { @PostConstruct protected void startRTMAndWebSocketConnection() { slackService.connectRTM(getSlackToken()); if (slackService.getWebSocketUrl() != null) { webSocketManager = new WebSocketConnectionManager(client(), handler(), slackService.getWebSocketUrl()); webSocketManager.start(); } else { logger.error("No web socket url returned by Slack."); } } }
public class class_name { @PostConstruct protected void startRTMAndWebSocketConnection() { slackService.connectRTM(getSlackToken()); if (slackService.getWebSocketUrl() != null) { webSocketManager = new WebSocketConnectionManager(client(), handler(), slackService.getWebSocketUrl()); // depends on control dependency: [if], data = [none] webSocketManager.start(); // depends on control dependency: [if], data = [none] } else { logger.error("No web socket url returned by Slack."); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static List<Object> loadAll(Reader reader) throws IOException { Iterable<Object> iterable = getSnakeYaml().loadAll(reader); List<Object> list = new ArrayList<Object>(); for (Object object : iterable) { if (object != null) { try { list.add(modelMapper((Map<String, Object>) object)); } catch (ClassCastException ex) { logger.error("Unexpected exception while casting: " + ex); } } } return list; } }
public class class_name { public static List<Object> loadAll(Reader reader) throws IOException { Iterable<Object> iterable = getSnakeYaml().loadAll(reader); List<Object> list = new ArrayList<Object>(); for (Object object : iterable) { if (object != null) { try { list.add(modelMapper((Map<String, Object>) object)); // depends on control dependency: [try], data = [none] } catch (ClassCastException ex) { logger.error("Unexpected exception while casting: " + ex); } // depends on control dependency: [catch], data = [none] } } return list; } }
public class class_name { public static BuddhistChronology getInstance(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); } BuddhistChronology chrono = cCache.get(zone); if (chrono == null) { // First create without a lower limit. chrono = new BuddhistChronology(GJChronology.getInstance(zone, null), null); // Impose lower limit and make another BuddhistChronology. DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono); chrono = new BuddhistChronology(LimitChronology.getInstance(chrono, lowerLimit, null), ""); BuddhistChronology oldChrono = cCache.putIfAbsent(zone, chrono); if (oldChrono != null) { chrono = oldChrono; } } return chrono; } }
public class class_name { public static BuddhistChronology getInstance(DateTimeZone zone) { if (zone == null) { zone = DateTimeZone.getDefault(); // depends on control dependency: [if], data = [none] } BuddhistChronology chrono = cCache.get(zone); if (chrono == null) { // First create without a lower limit. chrono = new BuddhistChronology(GJChronology.getInstance(zone, null), null); // depends on control dependency: [if], data = [null)] // Impose lower limit and make another BuddhistChronology. DateTime lowerLimit = new DateTime(1, 1, 1, 0, 0, 0, 0, chrono); chrono = new BuddhistChronology(LimitChronology.getInstance(chrono, lowerLimit, null), ""); // depends on control dependency: [if], data = [(chrono] BuddhistChronology oldChrono = cCache.putIfAbsent(zone, chrono); if (oldChrono != null) { chrono = oldChrono; // depends on control dependency: [if], data = [none] } } return chrono; } }
public class class_name { public ByteBuffer[] split(ByteBuffer name) { List<ByteBuffer> l = new ArrayList<ByteBuffer>(); ByteBuffer bb = name.duplicate(); readIsStatic(bb); int i = 0; while (bb.remaining() > 0) { getComparator(i++, bb); l.add(ByteBufferUtil.readBytesWithShortLength(bb)); bb.get(); // skip end-of-component } return l.toArray(new ByteBuffer[l.size()]); } }
public class class_name { public ByteBuffer[] split(ByteBuffer name) { List<ByteBuffer> l = new ArrayList<ByteBuffer>(); ByteBuffer bb = name.duplicate(); readIsStatic(bb); int i = 0; while (bb.remaining() > 0) { getComparator(i++, bb); // depends on control dependency: [while], data = [none] l.add(ByteBufferUtil.readBytesWithShortLength(bb)); // depends on control dependency: [while], data = [none] bb.get(); // skip end-of-component // depends on control dependency: [while], data = [none] } return l.toArray(new ByteBuffer[l.size()]); } }
public class class_name { public void free() { if (m_pTable != null) { PDatabase pDatabase = m_pTable.getPDatabase(); m_pTable.removePTableOwner(this, true); pDatabase.removePDatabaseOwner(this, true); } m_pTable = null; super.free(); } }
public class class_name { public void free() { if (m_pTable != null) { PDatabase pDatabase = m_pTable.getPDatabase(); m_pTable.removePTableOwner(this, true); // depends on control dependency: [if], data = [none] pDatabase.removePDatabaseOwner(this, true); // depends on control dependency: [if], data = [none] } m_pTable = null; super.free(); } }