auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void getValue_givenLocationId_shouldCallDeserializeWithLocationUuid() throws Exception { List<Location> locations = Context.getLocationService().getAllLocations(); Location testedLocation = locations.get(0); final String locationId = String.valueOf(testedLocation.getLocationId()); final String formFieldName = "id"; MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter(formFieldName, locationId); LocationDatatype datatype = mock(LocationDatatype.class); SerializingFieldGenDatatypeHandler handler = new MockLocationFieldGenDatatypeHandler(); handler.getValue(datatype, request, formFieldName); verify(datatype).deserialize(eq(testedLocation.getUuid())); }

Target:
public void getValue_givenLocationId_shouldCallDeserializeWithLocationUuid() throws Exception { Location testedLocation = Context.getLocationService().getLocation(1); final String locationId = String.valueOf(testedLocation.getLocationId()); final String formFieldName = "id"; MockHttpServletRequest request = new MockHttpServletRequest(); request.setParameter(formFieldName, locationId); LocationDatatype datatype = mock(LocationDatatype.class); SerializingFieldGenDatatypeHandler handler = new MockLocationFieldGenDatatypeHandler(); handler.getValue(datatype, request, formFieldName); verify(datatype).deserialize(eq(testedLocation.getUuid())); }
Source:
public void testCustomColumnNames() throws Exception { final String firstColumnName = "first"; final String secondColumnName = "second"; final String thirdColumnName = "third"; final String fourthColumnName = "fourth"; final ColumnType firstColumnType = ColumnType.STRING; final ColumnType secondColumnType = ColumnType.STRING; final ColumnType thirdColumnType = ColumnType.STRING; final ColumnType fourthColumnType = ColumnType.NUMBER; final CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, new CustomColumnNamingStrategy(firstColumnName, secondColumnName, thirdColumnName, fourthColumnName), new CustomColumnTypingStrategy(firstColumnType, secondColumnType, thirdColumnType, fourthColumnType), FileHelper.DEFAULT_ENCODING, CsvConfiguration.DEFAULT_SEPARATOR_CHAR, CsvConfiguration.DEFAULT_QUOTE_CHAR, CsvConfiguration.DEFAULT_ESCAPE_CHAR, false, true); final DataContext dataContext = new CsvDataContext(new File("src/test/resources/csv_people.csv"), configuration); final Table table = dataContext.getDefaultSchema().getTable(0); assertNotNull(table.getColumnByName(firstColumnName)); assertNotNull(table.getColumnByName(secondColumnName)); assertNotNull(table.getColumnByName(thirdColumnName)); assertNotNull(table.getColumnByName(fourthColumnName)); }

Target:
public void testCustomColumnNames() throws Exception { final String firstColumnName = "first"; final String secondColumnName = "second"; final String thirdColumnName = "third"; final String fourthColumnName = "fourth"; final CsvConfiguration configuration = new CsvConfiguration(CsvConfiguration.DEFAULT_COLUMN_NAME_LINE, new CustomColumnNamingStrategy(firstColumnName, secondColumnName, thirdColumnName, fourthColumnName), new CustomColumnTypingStrategy(ColumnType.STRING, ColumnType.STRING, ColumnType.STRING, ColumnType.NUMBER), FileHelper.DEFAULT_ENCODING, CsvConfiguration.DEFAULT_SEPARATOR_CHAR, CsvConfiguration.DEFAULT_QUOTE_CHAR, CsvConfiguration.DEFAULT_ESCAPE_CHAR, false, true); final DataContext dataContext = new CsvDataContext(new File("src/test/resources/csv_people.csv"), configuration); final Table table = dataContext.getDefaultSchema().getTable(0); assertNotNull(table.getColumnByName(firstColumnName)); assertNotNull(table.getColumnByName(secondColumnName)); assertNotNull(table.getColumnByName(thirdColumnName)); assertNotNull(table.getColumnByName(fourthColumnName)); }
Source:
public List<Object> getAttributeAsList(String key) { Object o = getAttribute(key); if( o == null) return Collections.emptyList(); if( o instanceof List ) return (List<Object>)o; if( o.getClass().isArray() ) { return Arrays.asList( (Object[])o ); } return Collections.singletonList(o); }

Target:
public List<Object> getAttributeAsList(String key) { Object o = getAttribute(key); if ( o == null ) return Collections.emptyList(); if ( o instanceof List ) return (List<Object>)o; if ( o.getClass().isArray() ) return Arrays.asList((Object[])o); return Collections.singletonList(o); }
Source:
public static boolean isUpToDate(Host host, DomainGroup domainGroup, Domain domain) throws IOException { if (domain == null || domain.getVersions() == null) { return false; } Set<DomainAndVersion> domainAndVersion = new HashSet<>(); for (DomainAndVersion d : domainGroup.getDomainVersions()) { if (d.getDomain().equals(domain)) domainAndVersion.add(d); } if (!allPartitionsUpToDate(host, domainAndVersion, false)) { return false; } if (isAssignedDeletablePartition(host)) { return false; } return true; }

Target:
public static boolean isUpToDate(Host host, DomainGroup domainGroup, Domain domain) throws IOException { if (domain == null || domain.getVersions() == null) { return false; } Set<DomainAndVersion> domainAndVersion = new HashSet<>(); domainAndVersion.add(domainGroup.getDomainVersion(domain)); return isUpToDateOrMoreRecent(host, domainAndVersion); }
Source:
protected void executeQueryCommand() { if (getParameters().getConfigurationType() == null) { log.info("received invalid configuration type: null"); return; } switch(getParameters().getConfigurationType()) { case OVF: try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOvf(getParameters().getVmConfiguration()).getVm()); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; case OVA: String ovfString = getParameters().getVmConfiguration(); ovfString = ovfString .replaceAll("[\r\n]+", "") .replaceAll("xmlns=[^-\\s]*", ""); try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOva(ovfString)); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; } }

Target:
protected void executeQueryCommand() { if (getParameters().getConfigurationType() == null) { log.error("received invalid configuration type: null"); return; } switch(getParameters().getConfigurationType()) { case OVF: try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOvf(getParameters().getVmConfiguration()).getVm()); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; case OVA: try { getQueryReturnValue().setReturnValue(ovfHelper.readVmFromOva(getParameters().getVmConfiguration())); getQueryReturnValue().setSucceeded(true); } catch (OvfReaderException e) { log.debug("failed to parse a given ovf configuration: \n" + getParameters().getVmConfiguration(), e); getQueryReturnValue().setExceptionString("failed to parse a given ovf configuration " + e.getMessage()); } break; } }
Source:
public void testQuerySysJobsLogReturnsLogEntriesRelevantToUser() { executeAsSuperuser("select 2"); executeAsSuperuser("select 3"); execute("select 1", null, testUserSession()); String stmt = "select username, stmt " + "from sys.jobs_log " + "where stmt in ('select 1', 'select 2', 'select 3') " + "order by stmt"; executeAsSuperuser(stmt); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n" + "crate| select 2\n" + "crate| select 3\n")); executeAsSuperuser("grant dql on table sys.jobs_log to " + TEST_USERNAME); execute(stmt, null, testUserSession()); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n")); }

Target:
public void testQuerySysJobsLogReturnsLogEntriesRelevantToUser() { executeAsSuperuser("grant dql on table sys.jobs_log to " + TEST_USERNAME); executeAsSuperuser("select 2"); executeAsSuperuser("select 3"); execute("select 1", null, testUserSession()); String stmt = "select username, stmt " + "from sys.jobs_log " + "where stmt in ('select 1', 'select 2', 'select 3') " + "order by stmt"; executeAsSuperuser(stmt); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n" + "crate| select 2\n" + "crate| select 3\n")); execute(stmt, null, testUserSession()); assertThat(printedTable(response.rows()), is("privileges_test_user| select 1\n")); }
Source:
public int selectPartition(Object key, int partitionCount) { int hashCode = key.hashCode(); if (hashCode == Integer.MIN_VALUE) { hashCode = 0; } return Math.abs(hashCode) % partitionCount; }

Target:
public int selectPartition(Object key, int partitionCount) { int hashCode = key.hashCode(); if (hashCode == Integer.MIN_VALUE) { hashCode = 0; } return Math.abs(hashCode); }
Source:
public ConstraintMatchTotal deserialize(JsonParser parser, DeserializationContext context) throws IOException { ObjectMapper mapper = new ObjectMapper(); JsonNode tree = parser.getCodec().readTree(parser); String constraintPackage = tree.get("constraintPackage").asText(); String constraintName = tree.get("constraintName").asText(); Score<?> scoreTotal = DeserializationUtils.deserializePolymorphicProperty(parser, context, tree, "scoreTotal"); ConstraintMatchTotal out = new ConstraintMatchTotal(constraintPackage, constraintName, scoreTotal); Set<ConstraintMatch> constraintMatchSet = new HashSet<>(); for (JsonNode t : tree.get("constraintMatchSet")) { constraintMatchSet.add(constraintMatchDeserializer.deserialize(mapper.getFactory().createParser(t .toString()), context)); } out.getConstraintMatchSet().addAll(constraintMatchSet); return out; }

Target:
public ConstraintMatchTotal deserialize(JsonParser parser, DeserializationContext context) throws IOException { JsonNode tree = parser.getCodec().readTree(parser); String constraintPackage = tree.get("constraintPackage").asText(); String constraintName = tree.get("constraintName").asText(); Score<?> scoreTotal = DeserializationUtils.deserializePolymorphicProperty(parser, context, tree, "scoreTotal"); ConstraintMatchTotal out = new ConstraintMatchTotal(constraintPackage, constraintName, scoreTotal); Set<ConstraintMatch> constraintMatchSet = new HashSet<>(); for (JsonNode t : tree.get("constraintMatchSet")) { constraintMatchSet.add(constraintMatchDeserializer.deserialize(parser.getCodec().getFactory().createParser(t .toString()), context)); } out.getConstraintMatchSet().addAll(constraintMatchSet); return out; }
Source:
public static ArrayList<ShortcutRecord> getShortcuts(Context context, String packageName) { ArrayList<ShortcutRecord> records = new ArrayList<>(); SQLiteDatabase db = getDatabase(context); Cursor cursor = db.query("shortcuts", new String[]{"name", "package", "icon", "intent_uri", "icon_blob"}, "package LIKE ?", new String[]{"%" + packageName + "%"}, null, null, null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { ShortcutRecord entry = new ShortcutRecord(); entry.name = cursor.getString(0); entry.packageName = cursor.getString(1); entry.iconResource = cursor.getString(2); entry.intentUri = cursor.getString(3); entry.icon_blob = cursor.getBlob(4); records.add(entry); cursor.moveToNext(); } cursor.close(); return records; }

Target:
public static ArrayList<ShortcutRecord> getShortcuts(Context context, String packageName) { ArrayList<ShortcutRecord> records = new ArrayList<>(); SQLiteDatabase db = getDatabase(context); Cursor cursor = db.query("shortcuts", new String[]{"name", "package", "icon", "intent_uri", "icon_blob"}, "package = ?", new String[]{packageName}, null, null, null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { ShortcutRecord entry = new ShortcutRecord(); entry.name = cursor.getString(0); entry.packageName = cursor.getString(1); entry.iconResource = cursor.getString(2); entry.intentUri = cursor.getString(3); entry.icon_blob = cursor.getBlob(4); records.add(entry); cursor.moveToNext(); } cursor.close(); return records; }
Source:
private void initUI() { VBox assigneeDialogBox = new VBox(); assignedAssigneePane = createAssignedAssigneeGroup(); matchingAssigneesBox = createMatchingAssigneeBox(); matchingAssigneePane = createMatchingAssigneePane(); textField = createTextField(); assigneeDialogBox.getChildren().add(new Label(ASSIGNED_ASSIGNEE)); assigneeDialogBox.getChildren().add(assignedAssigneePane); assigneeDialogBox.getChildren().add(textField); assigneeDialogBox.getChildren().add(new Label(ALL_ASSIGNEES)); assigneeDialogBox.getChildren().add(matchingAssigneePane); getDialogPane().setContent(assigneeDialogBox); refreshUI(state); Platform.runLater(textField::requestFocus); }

Target:
private void initUI() { VBox assigneeDialogBox = new VBox(); assignedUserPane = createAssignedUserPane(); matchingUsersBox = createMatchingUsersBox(); ScrollPane matchingUsersPane = createMatchingUsersPane(); textField = createTextField(); assigneeDialogBox.getChildren().addAll(new Label(TITLE_ASSIGNED_USER), assignedUserPane, textField, new Label(TITLE_ALL_USERS), matchingUsersPane); getDialogPane().setContent(assigneeDialogBox); refreshUI(state); Platform.runLater(textField::requestFocus); }
Source:
public static List<String> extractValues(Collection<StructuredProperty> source, FieldApprover fieldApprover) { return source.stream() .filter(x -> fieldApprover.approve(x.getDataInfo())) .map(StructuredProperty::getValue) .filter(Objects::nonNull) .collect(Collectors.toList()); }

Target:
public static List<String> extractValues(Collection<StructuredProperty> source, FieldApprover fieldApprover) { return source.stream() .filter(x -> fieldApprover.approve(x.getDataInfo())) .map(StructuredProperty::getValue) .filter(StringUtils::isNotBlank) .collect(Collectors.toList()); }
Source:
private boolean branchMatchWithFilter(String branch, String filter) { if (filter.startsWith("^")) { Pattern pattern = Pattern.compile(filter); return pattern.matcher(branch).matches(); } else if (filter.endsWith("/*")) { return branch.startsWith(filter.substring(0, filter.length() - 1)); } else { return branch.equals(filter); } }

Target:
private boolean branchMatchWithFilter(String branch, String filter) { if (filter == null) { return false; } else if (filter.equals("*")) { return true; } else if (filter.startsWith("^")) { Pattern pattern = Pattern.compile(filter); return pattern.matcher(branch).matches(); } else if (filter.endsWith("/*")) { return branch.startsWith(filter.substring(0, filter.length() - 1)); } else { return branch.equals(filter); } }
Source:
public void addColumn(Column column) { ArrayList<Column> columnsToAdd = this.columnsToAdd; if (columnsToAdd == null) { this.columnsToAdd = columnsToAdd = New.arrayList(); } columnsToAdd.add(column); }

Target:
public void addColumn(Column column) { if (columnsToAdd == null) { columnsToAdd = New.arrayList(); } columnsToAdd.add(column); }
Source:
private static void removeQuestionsAndResponsesWithoutComments( FeedbackResponseCommentSearchResultBundle frCommentSearchResults) { Iterator<Entry<String, List<FeedbackQuestionAttributes>>> fqsIter = frCommentSearchResults.questions.entrySet().iterator(); while (fqsIter.hasNext()) { fqsIter.next().getValue().removeIf(fq -> frCommentSearchResults.responses.get(fq.getId()).isEmpty()); } }

Target:
private static void removeQuestionsAndResponsesWithoutComments( FeedbackResponseCommentSearchResultBundle frCommentSearchResults) { frCommentSearchResults.questions.forEach((fsName, questionList) -> questionList.removeIf(fq -> frCommentSearchResults.responses.get(fq.getId()).isEmpty())); }
Source:
public boolean isContentTypeValid(HttpHeaders headers) { String contentType = headers.get(HttpHeaders.Names.CONTENT_TYPE); return (Strings.isNullOrEmpty(contentType) || contentType.contains(MEDIA_TYPE_APPLICATION_JSON)); }

Target:
public boolean isContentTypeValid(HttpHeaders headers) { String contentType = headers.get(HttpHeaders.Names.CONTENT_TYPE); return (Strings.isNullOrEmpty(contentType) || contentType.toLowerCase().contains(MEDIA_TYPE_APPLICATION_JSON)); }
Source:
private void initialize() { initializeFields(); initializeDefaultColors(); for (String[] element : fAppearanceColorListModel) { fAppearanceColorList.add(element[0]); } fAppearanceColorList.getDisplay().asyncExec(() -> { fAppearanceColorList.select(0); handleAppearanceColorListSelection(); }); fDocCommentOwnerComposite.loadValues(null); }

Target:
private void initialize() { initializeFields(); initializeDefaultColors(); for (String[] element : fAppearanceColorListModel) { fAppearanceColorList.add(element[0]); } fAppearanceColorList.getDisplay().asyncExec(() -> { fAppearanceColorList.select(0); handleAppearanceColorListSelection(); }); fDocCommentOwnerComposite.loadValues(); }
Source:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof LocationImpl)) return false; LocationImpl location = (LocationImpl)o; return (lineNumber != location.lineNumber || externalResource != location.externalResource || Objects.equals(resourcePath ,location.resourcePath) || externalResourceId != location.externalResourceId || Objects.equals(resourceProjectPath, location.resourceProjectPath) && !(target != null ? !target.equals(location.target) : location.target != null)); }

Target:
public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof LocationImpl)) return false; LocationImpl location = (LocationImpl)o; return lineNumber == location.lineNumber && externalResourceId == location.externalResourceId && externalResource == location.externalResource && Objects.equals(resourcePath ,location.resourcePath) && Objects.equals(resourceProjectPath, location.resourceProjectPath) && !(target != null ? !target.equals(location.target) : location.target != null); }
Source:
public int clear() { int numOfEntriesDeleted = 0; int numOfValuesDeleted = 0; Collection<Data> locks = lockStore != null ? lockStore.getLockedKeys() : Collections.<Data>emptySet(); for (Data key : multiMapValues.keySet()) { if (!locks.contains(key)) { MultiMapValue value = multiMapValues.remove(key); if (value != null) { numOfEntriesDeleted++; numOfValuesDeleted += value.size(); } } } decrementSize(numOfValuesDeleted); return numOfEntriesDeleted; }

Target:
public int clear() { Collection<Data> locks = lockStore != null ? lockStore.getLockedKeys() : Collections.<Data>emptySet(); Map<Data, MultiMapValue> lockedKeys = createHashMap(locks.size()); int lockedValuesSize = 0; for (Data key : locks) { MultiMapValue multiMapValue = multiMapValues.get(key); if (multiMapValue != null) { lockedKeys.put(key, multiMapValue); lockedValuesSize += multiMapValue.size(); } } int numberOfAffectedEntries = multiMapValues.size() - lockedKeys.size(); multiMapValues.clear(); multiMapValues.putAll(lockedKeys); size = lockedValuesSize; return numberOfAffectedEntries; }
Source:
public Builder addAnnotations(Collection<AnnotationSpec> annotationSpecs) { checkArgument(annotationSpecs != null, "field annotations must not be null."); this.annotations.addAll(annotationSpecs); return this; }

Target:
public Builder addAnnotations(Collection<AnnotationSpec> annotationSpecs) { checkArgument(annotationSpecs != null, "annotationSpecs == null"); this.annotations.addAll(annotationSpecs); return this; }
Source:
public void registered(Object service, Map serviceProperties) { if (service instanceof ChannelService && tracker == null) { LOGGER.info("The ChannelService is registered, starting TasksBlueprintApplicationContextTracker"); ChannelService channelService = (ChannelService) service; tracker = new TasksBlueprintApplicationContextTracker(bundleContext, channelService); tracker.open(true); } }

Target:
public void registered(Object service, Map serviceProperties) { if (service instanceof ChannelService && tracker == null) { LOGGER.info("ChannelService registered, starting TasksBlueprintApplicationContextTracker"); ChannelService channelService = (ChannelService) service; tracker = new TasksBlueprintApplicationContextTracker(bundleContext, channelService); tracker.open(true); } }
Source:
public void recognizeEntitiesTooManyDocuments() { recognizeEntitiesTooManyDocumentsRunner(inputs -> { StepVerifier.create(client.recognizeEntitiesBatch(inputs)) .verifyErrorSatisfies(ex -> assertEquals(HttpResponseException.class, ex.getClass())); }); }

Target:
public void recognizeEntitiesTooManyDocuments() { recognizeEntitiesTooManyDocumentsRunner(inputs -> { StepVerifier.create(client.recognizeEntitiesBatch(inputs)) .verifyErrorSatisfies(ex -> { HttpResponseException exception = (HttpResponseException) ex; assertEquals(HttpResponseException.class, exception.getClass()); assertEquals(EXCEEDED_ALLOWED_DOCUMENTS_LIMITS_MESSAGE, exception.getMessage()); assertEquals(INVALID_DOCUMENT_BATCH, exception.getValue().toString()); }); }); }
Source:
public TopologyServiceMultiRetryStrategy( long delayInMillis, long retries, LogProvider logProvider ) { super( delayInMillis, retries, logProvider, millis -> { try { Thread.sleep( millis ); } catch ( InterruptedException e ) { throw new RuntimeException( e ); } } ); }

Target:
public TopologyServiceMultiRetryStrategy( long delayInMillis, long retries, LogProvider logProvider ) { super( delayInMillis, retries, logProvider, TopologyServiceMultiRetryStrategy::sleep ); }
Source:
public void dragFinished(DragSourceEvent event) { super.dragFinished(event); handleSwtDragFinished(); }

Target:
public void dragFinished(DragSourceEvent event) { super.dragFinished(event); handleSwtDragFinished(); m_swtTransferables = null; }
Source:
public PersistedStreamingMap(@NonNull Path dataPath, @NonNull Options options, @NonNull ISerializer serializer, @NonNull CorfuRuntime corfuRuntime) { try { FileUtils.deleteDirectory(dataPath.toFile()); this.rocksDb = RocksDB.open(options, dataPath.toFile().getAbsolutePath()); } catch (RocksDBException | IOException e) { throw new UnrecoverableCorfuError(e); } this.serializer = serializer; this.corfuRuntime = corfuRuntime; }

Target:
public PersistedStreamingMap(@NonNull Path dataPath, @NonNull Options options, @NonNull ISerializer serializer, @NonNull CorfuRuntime corfuRuntime) { try { RocksDB.destroyDB(dataPath.toFile().getAbsolutePath(), options); this.rocksDb = RocksDB.open(options, dataPath.toFile().getAbsolutePath()); } catch (RocksDBException e) { throw new UnrecoverableCorfuError(e); } this.serializer = serializer; this.corfuRuntime = corfuRuntime; }
Source:
private boolean hasClientServerSocket() { if (!config.getAdvancedNetworkConfig().isEnabled()) { return true; } Map<EndpointQualifier, EndpointConfig> endpointConfigs = config.getAdvancedNetworkConfig().getEndpointConfigs(); EndpointConfig clientEndpointConfig = endpointConfigs.get(CLIENT); return clientEndpointConfig instanceof ServerSocketEndpointConfig; }

Target:
private boolean hasClientServerSocket() { if (!config.getAdvancedNetworkConfig().isEnabled()) { return true; } Map<EndpointQualifier, EndpointConfig> endpointConfigs = config.getAdvancedNetworkConfig().getEndpointConfigs(); EndpointConfig clientEndpointConfig = endpointConfigs.get(CLIENT); return clientEndpointConfig != null; }
Source:
public void bindView(View view, Context context, Cursor cursor) { final ThemeViewHolder themeViewHolder = (ThemeViewHolder) view.getTag(); final String screenshotURL = cursor.getString(cursor.getColumnIndex("screenshot")); final String name = cursor.getString(cursor.getColumnIndex("name")); final String price = cursor.getString(cursor.getColumnIndex("price")); themeViewHolder.nameView.setText(name); themeViewHolder.priceView.setText(price); ScreenshotHolder urlHolder = (ScreenshotHolder) themeViewHolder.imageView.getTag(); if (urlHolder == null) { urlHolder = new ScreenshotHolder(); urlHolder.requestURL = screenshotURL; themeViewHolder.imageView.setTag(urlHolder); } if (!urlHolder.requestURL.equals(screenshotURL)) { themeViewHolder.imageView.setImageBitmap(null); urlHolder.requestURL = screenshotURL; } themeViewHolder.imageView.setImageUrl(screenshotURL + "?w=" + 500, WordPress.imageLoader); }

Target:
public void bindView(View view, Context context, Cursor cursor) { final ThemeViewHolder themeViewHolder = (ThemeViewHolder) view.getTag(); final String screenshotURL = cursor.getString(cursor.getColumnIndex("screenshot")); final String name = cursor.getString(cursor.getColumnIndex("name")); final String price = cursor.getString(cursor.getColumnIndex("price")); themeViewHolder.nameView.setText(name); themeViewHolder.priceView.setText(price); ScreenshotHolder urlHolder = (ScreenshotHolder) themeViewHolder.imageView.getTag(); if (urlHolder == null) { urlHolder = new ScreenshotHolder(); urlHolder.requestURL = screenshotURL; themeViewHolder.imageView.setDefaultImageResId(R.drawable.light_grey); themeViewHolder.imageView.setTag(urlHolder); } if (!urlHolder.requestURL.equals(screenshotURL)) { themeViewHolder.imageView.setImageBitmap(null); urlHolder.requestURL = screenshotURL; } themeViewHolder.imageView.setImageUrl(screenshotURL + "?w=" + mGridView.getWidth(), WordPress.imageLoader); }
Source:
public List<Clip> getClips(String pid, String uri) { PidReference pidReference = new PidReference(); pidReference.setPid(pid); pidReference.setHref(uri); List<Clip> clips; try { clips = clipsAdapter.clipsFor(pidReference); } catch (NitroException e) { throw Throwables.propagate(e); } return clips; }

Target:
public List<Clip> getClips(String pid, String uri) { PidReference pidReference = new PidReference(); pidReference.setPid(pid); pidReference.setHref(uri); try { return clipsAdapter.clipsFor(pidReference); } catch (NitroException e) { throw Throwables.propagate(e); } }
Source:
private void deleteObsoleteHistoryData() throws SQLException { if (prop.getInteger(NotificationProperties.DAYS_TO_KEEP_HISTORY) > 0) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.DATE, -prop.getInteger(NotificationProperties.DAYS_TO_KEEP_HISTORY)); Timestamp startDeleteFrom = new Timestamp(cal.getTimeInMillis()); Connection connection = null; PreparedStatement deleteStmt = null; int deletedRecords; try { connection = ds.getConnection(); deleteStmt = connection.prepareStatement("DELETE FROM event_notification_hist WHERE sent_at < ?"); deleteStmt.setTimestamp(1, startDeleteFrom); deletedRecords = deleteStmt.executeUpdate(); } finally { if (deleteStmt != null) { deleteStmt.close(); } if (connection != null) { connection.close(); } } if (deletedRecords > 0) { log.debug(deletedRecords + " records were deleted from \"event_notification_hist\" table."); } } }

Target:
private void deleteObsoleteHistoryData() throws SQLException { if (prop.getInteger(NotificationProperties.DAYS_TO_KEEP_HISTORY) > 0) { Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.add(Calendar.DATE, -prop.getInteger(NotificationProperties.DAYS_TO_KEEP_HISTORY)); Timestamp startDeleteFrom = new Timestamp(cal.getTimeInMillis()); Connection connection = null; PreparedStatement deleteStmt = null; int deletedRecords; try { connection = ds.getConnection(); deleteStmt = connection.prepareStatement("delete from event_notification_hist where sent_at < ?"); deleteStmt.setTimestamp(1, startDeleteFrom); deletedRecords = deleteStmt.executeUpdate(); } finally { if (deleteStmt != null) { deleteStmt.close(); } if (connection != null) { connection.close(); } } if (deletedRecords > 0) { log.debug(deletedRecords + " records were deleted from \"event_notification_hist\" table."); } } }
Source:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append(fFailedTest + ": " + fThrownException.getMessage()); return sb.toString(); }

Target:
public String toString() { return fFailedTest + ": " + fThrownException.getMessage(); }
Source:
public static void shareLink(Context context, String subject, String text) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_SUBJECT, subject); i.putExtra(Intent.EXTRA_TEXT, text); context.startActivity(Intent.createChooser(i, context.getString(R.string.share_url_label))); }

Target:
public static void shareLink(Context context, String subject, String text) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_TEXT, text); if (!TextUtils.isEmpty(subject)) { i.putExtra(Intent.EXTRA_SUBJECT, subject); } context.startActivity(Intent.createChooser(i, context.getString(R.string.share_url_label))); }
Source:
public SaslServer createSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException { final long timeout; if (props.containsKey(WildFlySasl.AUTHENTICATION_TIMEOUT)) { timeout = Long.parseLong((String) props.get(WildFlySasl.AUTHENTICATION_TIMEOUT)); } else { timeout = DEFAULT_TIMEOUT; } final NameAssignedCallbackHandler nameAssignedCallbackHandler = new NameAssignedCallbackHandler(cbh); final SaslServer delegateSaslServer = delegate.createSaslServer(mechanism, protocol, serverName, props, nameAssignedCallbackHandler); return delegateSaslServer == null ? null : new AbstractDelegatingSaslServer(delegateSaslServer) { private final AtomicBoolean complete = new AtomicBoolean(); private final AtomicBoolean nameAssigned = new AtomicBoolean(); private volatile ScheduledThreadPoolExecutor executor; private volatile ScheduledFuture<Void> timeoutTask; @Override public byte[] evaluateResponse(final byte[] response) throws SaslException { try { final byte[] challenge = delegate.evaluateResponse(response); if (nameAssignedCallbackHandler.isNameAssigned() && nameAssigned.compareAndSet(false, true)) { executor = createExecutor(); timeoutTask = executor.schedule(() -> { dispose(); return null; }, timeout, TimeUnit.SECONDS); } if (isComplete() && complete.compareAndSet(false, true)) { cancelTimeoutTask(); } return challenge; } catch (SaslException | RuntimeException | Error e) { if (isComplete() && complete.compareAndSet(false, true)) { cancelTimeoutTask(); } throw e; } } @Override public void dispose() throws SaslException { try { super.dispose(); } finally { ScheduledThreadPoolExecutor stpe = executor; executor = null; timeoutTask = null; if (stpe != null) { stpe.shutdownNow(); } } } private ScheduledThreadPoolExecutor createExecutor() { ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1); executor.setRemoveOnCancelPolicy(true); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); return executor; } private void cancelTimeoutTask() { if (timeoutTask != null) { timeoutTask.cancel(true); } } }; }

Target:
public SaslServer createSaslServer(final String mechanism, final String protocol, final String serverName, final Map<String, ?> props, final CallbackHandler cbh) throws SaslException { final long timeout; if (props.containsKey(WildFlySasl.AUTHENTICATION_TIMEOUT)) { timeout = Long.parseLong((String) props.get(WildFlySasl.AUTHENTICATION_TIMEOUT)); } else { timeout = DEFAULT_TIMEOUT; } final SaslServer delegateSaslServer = delegate.createSaslServer(mechanism, protocol, serverName, props, cbh); return (delegateSaslServer == null) ? null : new DelegatingTimeoutSaslServer(delegateSaslServer, scheduledExecutorService, timeout); }
Source:
private void populateColumns(JsonNode propertiesNode, List<String> arrays, List<ElasticsearchColumn> columns) { StringComparator comparator = new StringComparator(); TreeMap<String, Type> fieldsMap = new TreeMap<>(comparator); for (String columnMetadata : getColumnMetadata(null, propertiesNode)) { int delimiterIndex = columnMetadata.lastIndexOf(":"); if (delimiterIndex == -1 || delimiterIndex == columnMetadata.length() - 1) { LOG.debug("Invalid column path format: %s", columnMetadata); continue; } String fieldName = columnMetadata.substring(0, delimiterIndex); String typeName = columnMetadata.substring(delimiterIndex + 1); if (!fieldName.endsWith(".type")) { LOG.debug("Ignoring column with no type info: %s", columnMetadata); continue; } String propertyName = fieldName.substring(0, fieldName.lastIndexOf('.')); String nestedName = propertyName.replaceAll("properties\\.", ""); if (nestedName.contains(".")) { fieldsMap.put(nestedName, getPrestoType(typeName)); } else { boolean newNestedColumn = columns.stream() .noneMatch(column -> column.getName().equalsIgnoreCase(nestedName)); if (newNestedColumn) { columns.add(new ElasticsearchColumn(nestedName, getPrestoType(typeName), nestedName, typeName, arrays.contains(nestedName), -1)); } } } processNestedFields(fieldsMap, columns, arrays); }

Target:
private void populateColumns(JsonNode propertiesNode, List<String> arrays, List<ElasticsearchColumn> columns) { FieldNestingComparator comparator = new FieldNestingComparator(); TreeMap<String, Type> fieldsMap = new TreeMap<>(comparator); for (String columnMetadata : getColumnMetadata(Optional.empty(), propertiesNode)) { int delimiterIndex = columnMetadata.lastIndexOf(":"); if (delimiterIndex == -1 || delimiterIndex == columnMetadata.length() - 1) { LOG.debug("Invalid column path format: %s", columnMetadata); continue; } String fieldName = columnMetadata.substring(0, delimiterIndex); String typeName = columnMetadata.substring(delimiterIndex + 1); if (!fieldName.endsWith(".type")) { LOG.debug("Ignoring column with no type info: %s", columnMetadata); continue; } String propertyName = fieldName.substring(0, fieldName.lastIndexOf('.')); String nestedName = propertyName.replaceAll("properties\\.", ""); if (nestedName.contains(".")) { fieldsMap.put(nestedName, getPrestoType(typeName)); } else { boolean newColumnFound = columns.stream() .noneMatch(column -> column.getName().equalsIgnoreCase(nestedName)); if (newColumnFound) { columns.add(new ElasticsearchColumn(nestedName, getPrestoType(typeName), nestedName, typeName, arrays.contains(nestedName), -1)); } } } processNestedFields(fieldsMap, columns, arrays); }
Source:
private static int cmdList(Context context, String[] argv) { try { for (EPerson person : ePersonService.findAll(context, EPerson.EMAIL)) { System.out.printf("%s\t%s/%s\t%s, %s\n", person.getID(), person.getEmail(), person.getNetid(), person.getLastName(), person.getFirstName()); } } catch (SQLException ex) { System.err.println(ex.getMessage()); return 1; } return 0; }

Target:
private static int cmdList(Context context, String[] argv) { try { for (EPerson person : ePersonService.findAll(context, EPerson.EMAIL)) { System.out.printf("%s\t%s/%s\t%s, %s\n", person.getID().toString(), person.getEmail(), person.getNetid(), person.getLastName(), person.getFirstName()); } } catch (SQLException ex) { System.err.println(ex.getMessage()); return 1; } return 0; }
Source:
public Set<MaterialConfig> getSchedulableDependencyMaterials() { HashSet<MaterialConfig> dependencyMaterials = new HashSet<>(); for (MaterialConfig materialConfig : getSchedulableMaterials()) { if (materialConfig instanceof DependencyMaterialConfig) { dependencyMaterials.add(materialConfig); } } return dependencyMaterials; }

Target:
public Set<DependencyMaterialConfig> getSchedulableDependencyMaterials() { HashSet<DependencyMaterialConfig> dependencyMaterials = new HashSet<>(); for (MaterialConfig materialConfig : getSchedulableMaterials()) { if (materialConfig instanceof DependencyMaterialConfig) { dependencyMaterials.add((DependencyMaterialConfig) materialConfig); } } return dependencyMaterials; }
Source:
public void moveAxis(Object elementToMove, int newIndex) { if (!isDynamic() && elementToMove instanceof IAxis) { final TransactionalEditingDomain domain = getTableEditingDomain(); if (domain == null) { return; } final List<Object> newAxisOrder = new ArrayList<Object>(getRepresentedContentProvider().getAxis()); newAxisOrder.remove(elementToMove); newAxisOrder.add(newIndex, elementToMove); domain.getCommandStack().execute(getSetNewAxisOrderCommand(newAxisOrder)); } }

Target:
public void moveAxis(Object elementToMove, int newIndex) { if (!isDynamic() && elementToMove instanceof IAxis) { final TransactionalEditingDomain domain = getTableEditingDomain(); if (null != domain) { final List<Object> newAxisOrder = new ArrayList<Object>(getRepresentedContentProvider().getAxis()); newAxisOrder.remove(elementToMove); newAxisOrder.add(newIndex, elementToMove); domain.getCommandStack().execute(getSetNewAxisOrderCommand(newAxisOrder)); } } }
Source:
public void onLifespanExecutionFinished(Iterable<Lifespan> newlyCompletelyExecutedDriverGroups) { checkState(initialScheduled); SettableFuture<?> newDriverGroupReady; synchronized (this) { for (Lifespan newlyCompletelyExecutedDriverGroup : newlyCompletelyExecutedDriverGroups) { checkArgument(!newlyCompletelyExecutedDriverGroup.isTaskWide()); availableTasks.enqueue(taskByDriverGroup[newlyCompletelyExecutedDriverGroup.getId()]); totalLifespanExecutionFinished++; int driverGroupId = newlyCompletelyExecutedDriverGroup.getId(); runningDriverGroupIdsByTask[taskByDriverGroup[driverGroupId]].remove(driverGroupId); } newDriverGroupReady = this.newDriverGroupReady; } newDriverGroupReady.set(null); }

Target:
public void onLifespanExecutionFinished(Iterable<Lifespan> newlyCompletelyExecutedDriverGroups) { checkState(initialScheduled, "onLifespanExecutionFinished should only be called after initial scheduling finished"); SettableFuture<?> newDriverGroupReady; synchronized (this) { for (Lifespan newlyCompletelyExecutedDriverGroup : newlyCompletelyExecutedDriverGroups) { checkArgument(!newlyCompletelyExecutedDriverGroup.isTaskWide()); int driverGroupId = newlyCompletelyExecutedDriverGroup.getId(); availableTasks.enqueue(taskByDriverGroup[driverGroupId]); totalLifespanExecutionFinished++; runningDriverGroupIdsByTask[taskByDriverGroup[driverGroupId]].remove(driverGroupId); } newDriverGroupReady = this.newDriverGroupReady; } newDriverGroupReady.set(null); }
Source:
public void serializeText(Text text) throws XMLStreamException { if(text != null && text.getData() != null) serializer.writeCharacters(text.getData()); }

Target:
public void serializeText(Text text) throws XMLStreamException { if(text != null) serializer.writeCharacters(text.getData()); }
Source:
boolean method1(Nums k, String string) { switch (k) { case ONE -> { Stream.of(string.split(" ")) .anyMatch(Word -> "in".equals(Word)); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); System.out.println(1); } default -> Stream.of(string.split(" ")) .anyMatch(Word -> "in".equals(Word)); } return true; }

Target:
boolean method1(Nums k, String string) { switch (k) { case ONE -> { System.out.println(2); System.out.println(3); System.out.println(4); System.out.println(5); System.out.println(6); System.out.println(7); System.out.println(8); System.out.println(9); System.out.println(10); System.out.println(11); } default -> Stream.of(string.split(" ")) .anyMatch(Word -> "in".equals(Word)); } return true; }
Source:
private void bindAttrOrRelation(AccessibleObject fieldOrMethod) { boolean isRelation = RELATIONSHIP_TYPES.stream().anyMatch(fieldOrMethod::isAnnotationPresent); String fieldName = getFieldName(fieldOrMethod); Class<?> fieldType = getFieldType(entityClass, fieldOrMethod); if (fieldName == null || "class".equals(fieldName) || OBJ_METHODS.contains(fieldOrMethod)) { return; } if (fieldOrMethod instanceof Method) { Method method = (Method) fieldOrMethod; requestScopeableMethods.put(method, isRequestScopeableMethod(method)); } if (isRelation) { bindRelation(fieldOrMethod, fieldName, fieldType); } else { bindAttr(fieldOrMethod, fieldName, fieldType); } }

Target:
private void bindAttrOrRelation(AccessibleObject fieldOrMethod) { boolean isRelation = RELATIONSHIP_TYPES.stream().anyMatch(fieldOrMethod::isAnnotationPresent); String fieldName = getFieldName(fieldOrMethod); Class<?> fieldType = getFieldType(entityClass, fieldOrMethod); if (fieldName == null || "id".equals(fieldName) || "class".equals(fieldName) || OBJ_METHODS.contains(fieldOrMethod)) { return; } if (fieldOrMethod instanceof Method) { Method method = (Method) fieldOrMethod; requestScopeableMethods.put(method, isRequestScopeableMethod(method)); } if (isRelation) { bindRelation(fieldOrMethod, fieldName, fieldType); } else { bindAttr(fieldOrMethod, fieldName, fieldType); } }
Source:
private static void migrateDB() { if(PropertyUtil.getOptional("db.flyway", true) == false) { log.warn("Skipping flyway migration! Remove 'db.flyway' property or set it to 'true' to enable migration"); return; } boolean ingoreMigrationFailures = PropertyUtil.getOptional("db.ingoreMigrationFailures", false); log.info("Oskari-map checking DB status"); try { FlywaydbMigrator.migrate(DS_HELPER.getDataSource()); log.info("Oskari core DB migrated successfully"); } catch (Exception e) { log.error("DB migration for Oskari core failed!"); if(!ingoreMigrationFailures) { throw e; } } final String[] additionalPools = DS_HELPER.getAdditionalModules(); for(String module : additionalPools) { final String poolName = DS_HELPER.getOskariDataSourceName(module); try { FlywaydbMigrator.migrate(DS_HELPER.getDataSource(poolName), module); log.info(module + " DB migrated successfully"); } catch (Exception e) { log.error("DB migration for module " + module + " failed!", e); if(!ingoreMigrationFailures) { throw e; } } } }

Target:
private static void migrateDB() { if(PropertyUtil.getOptional("db.flyway", true) == false) { log.warn("Skipping flyway migration! Remove 'db.flyway' property or set it to 'true' to enable migration"); return; } boolean ignoreMigrationFailures = PropertyUtil.getOptional("db.ignoreMigrationFailures", false); log.info("Oskari-map checking DB status"); try { FlywaydbMigrator.migrate(DS_HELPER.getDataSource()); log.info("Oskari core DB migrated successfully"); } catch (Exception e) { log.error("DB migration for Oskari core failed!"); if(!ignoreMigrationFailures) { throw e; } } final String[] additionalPools = DS_HELPER.getAdditionalModules(); for(String module : additionalPools) { final String poolName = DS_HELPER.getOskariDataSourceName(module); try { FlywaydbMigrator.migrate(DS_HELPER.getDataSource(poolName), module); log.info(module + " DB migrated successfully"); } catch (Exception e) { log.error("DB migration for module " + module + " failed!", e); if(!ignoreMigrationFailures) { throw e; } } } }
Source:
protected void split() { log.trace("splitting {}", this); double width = (area.getWidth() / 2); double height = (area.getHeight() / 2); double x = area.getX(); double y = area.getY(); int childLevel = level + 1; SpatialQuadTree<N> ne = new SpatialQuadTree<>(layoutModel, childLevel, x + width, y, width, height); SpatialQuadTree<N> nw = new SpatialQuadTree<>(layoutModel, childLevel, x, y, width, height); SpatialQuadTree<N> sw = new SpatialQuadTree<>(layoutModel, childLevel, x, y + height, width, height); SpatialQuadTree<N> se = new SpatialQuadTree<>(layoutModel, childLevel, x + width, y + height, width, height); synchronized (lock) { children = new ImmutableMap.Builder<Quadrant, SpatialQuadTree<N>>() .put(NE, ne) .put(NW, nw) .put(SW, sw) .put(SE, se) .build(); } }

Target:
protected void split() { log.trace("splitting {}", this); double width = (area.getWidth() / 2); double height = (area.getHeight() / 2); double x = area.getX(); double y = area.getY(); int childLevel = level + 1; SpatialQuadTree<N> ne = new SpatialQuadTree<>(layoutModel, childLevel, x + width, y, width, height); SpatialQuadTree<N> nw = new SpatialQuadTree<>(layoutModel, childLevel, x, y, width, height); SpatialQuadTree<N> sw = new SpatialQuadTree<>(layoutModel, childLevel, x, y + height, width, height); SpatialQuadTree<N> se = new SpatialQuadTree<>(layoutModel, childLevel, x + width, y + height, width, height); synchronized (lock) { children = ImmutableMap.of(NE, ne, NW, nw, SW, sw, SE, se); } }
Source:
public static void setSslVerification(Repository repo, HttpURLConnection conn) throws IOException { if ("https".equals(conn.getURL().getProtocol())) { HttpsURLConnection httpsConn = (HttpsURLConnection) conn; if (repo.getConfig().getBoolean("http", "sslVerify", true)) { try { SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(null, trustAllCerts, null); httpsConn.setSSLSocketFactory(ctx.getSocketFactory()); httpsConn.setHostnameVerifier(trustAllHostNames); } catch (KeyManagementException e) { throw new IOException(e.getMessage()); } catch (NoSuchAlgorithmException e) { throw new IOException(e.getMessage()); } } } }

Target:
public static void setSslVerification(Repository repo, HttpURLConnection conn) throws IOException { if ("https".equals(conn.getURL().getProtocol())) { HttpsURLConnection httpsConn = (HttpsURLConnection) conn; if (!repo.getConfig().getBoolean("http", "sslVerify", true)) { try { SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(null, trustAllCerts, null); httpsConn.setSSLSocketFactory(ctx.getSocketFactory()); httpsConn.setHostnameVerifier(trustAllHostNames); } catch (KeyManagementException e) { throw new IOException(e.getMessage()); } catch (NoSuchAlgorithmException e) { throw new IOException(e.getMessage()); } } } }
Source:
public void start() { try { Map<String, MonitorConfig> monitorConfigs = getMonitorConfigs(config); for (Map.Entry<String, MonitorConfig> entry : monitorConfigs.entrySet()) { String monitorName = entry.getKey(); MonitorConfig monitorConfig = entry.getValue(); if (!Strings.isNullOrEmpty(monitorConfig.getMonitorFactoryClass())) { int schedulingIntervalInMs = monitorConfig.getSchedulingIntervalInMs(); LOGGER.info("Scheduling monitor to run every ms", monitorName, schedulingIntervalInMs); if (monitorConfig.isJitterEnabled()) { SecureRandom secureRandom = new SecureRandom(); schedulingIntervalInMs += secureRandom.nextInt(schedulingIntervalInMs + 1); } scheduler.schedule(getRunnable(instantiateMonitor(monitorName, monitorConfig, metricsRegistry)), schedulingIntervalInMs); } else { LOGGER.warn("Not scheduling the monitor: to run, since monitor factory class is not set in config.", monitorName); } } } catch (InstantiationException e) { LOGGER.error("Exception when instantiating the monitor : ", e); throw new SamzaException(e); } }

Target:
public void start() { try { Map<String, MonitorConfig> monitorConfigs = getMonitorConfigs(config); for (Map.Entry<String, MonitorConfig> entry : monitorConfigs.entrySet()) { String monitorName = entry.getKey(); MonitorConfig monitorConfig = entry.getValue(); if (!Strings.isNullOrEmpty(monitorConfig.getMonitorFactoryClass())) { int schedulingIntervalInMs = monitorConfig.getSchedulingIntervalInMs(); int monitorSchedulingJitterInMs = (int) (RANDOM.nextInt(schedulingIntervalInMs + 1) * (monitorConfig.getSchedulingJitterPercent() / 100.0)); schedulingIntervalInMs += monitorSchedulingJitterInMs; LOGGER.info("Scheduling the monitor: to run every ms.", monitorName, schedulingIntervalInMs); scheduler.schedule(getRunnable(instantiateMonitor(monitorName, monitorConfig, metricsRegistry)), schedulingIntervalInMs); } else { LOGGER.warn("Not scheduling the monitor: to run, since monitor factory class is not set in config.", monitorName); } } } catch (InstantiationException e) { LOGGER.error("Exception when instantiating the monitor : ", e); throw new SamzaException(e); } }