auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Object readResolve() { JiraSite jiraSite; if (credentialsId == null && userName != null && password != null) { jiraSite = new JiraSite(url, alternativeUrl, userName, password.getPlainText(), supportsWikiStyleComment, recordScmChanges, userPattern, updateJiraIssueForAllStatus, groupVisibility, roleVisibility, useHTTPAuth); } else { jiraSite = new JiraSite( url, alternativeUrl, credentialsId, supportsWikiStyleComment, recordScmChanges, userPattern, updateJiraIssueForAllStatus, groupVisibility, roleVisibility, useHTTPAuth, timeout, readTimeout, threadExecutorNumber ); } jiraSite.setAppendChangeTimestamp( appendChangeTimestamp ); jiraSite.setDisableChangelogAnnotations( disableChangelogAnnotations ); jiraSite.setDateTimePattern( dateTimePattern ); jiraSite.setSendAssigneeAsName(sendAssigneeAsName); return jiraSite; }

Target:
protected Object readResolve() { JiraSite jiraSite; if (credentialsId == null && userName != null && password != null) { jiraSite = new JiraSite(url, alternativeUrl, userName, password.getPlainText(), supportsWikiStyleComment, recordScmChanges, userPattern, updateJiraIssueForAllStatus, groupVisibility, roleVisibility, useHTTPAuth); } else { jiraSite = new JiraSite( url, alternativeUrl, credentialsId, supportsWikiStyleComment, recordScmChanges, userPattern, updateJiraIssueForAllStatus, groupVisibility, roleVisibility, useHTTPAuth, timeout, readTimeout, threadExecutorNumber ); } jiraSite.setAppendChangeTimestamp( appendChangeTimestamp ); jiraSite.setDisableChangelogAnnotations( disableChangelogAnnotations ); jiraSite.setDateTimePattern( dateTimePattern ); return jiraSite; }
Source:
public void systemConditionChanged() { checkConditionsAndDisplayFirstIAMQueued(); }

Target:
public void systemConditionChanged() { attemptToShowInAppMessage(); }
Source:
private ThreadWrapper createObjects(int objectsCount, boolean asyncTransaction) { if (asyncTransaction) { return createTaskInHandlerThread((realm, success) -> { RealmLog.error("Creating objects (async): " + Thread.currentThread().getName()); realm.executeTransactionAsync(bgRealm -> populateTestRealm(bgRealm, objectsCount), success::countDown); }); } else { return createTaskInThread((realm) -> { RealmLog.error("Creating objects: " + Thread.currentThread().getName()); populateTestRealm(realm, objectsCount); }); } }

Target:
private Runnable createObjects(int objectsCount, boolean asyncTransaction) { if (asyncTransaction) { return createTaskInHandlerThread((realm, success) -> { RealmLog.info("Creating objects (async): " + Thread.currentThread().getName()); realm.executeTransactionAsync(bgRealm -> populateTestRealm(bgRealm, objectsCount), success::countDown); }); } else { return createTaskInThread((realm) -> { RealmLog.info("Creating objects: " + Thread.currentThread().getName()); populateTestRealm(realm, objectsCount); }); } }
Source:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = super.onCreateViewHelper(inflater, container, savedInstanceState, R.layout.all_episodes_fragment); ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) { AllEpisodesRecycleAdapter.Holder holder = (AllEpisodesRecycleAdapter.Holder)viewHolder; Log.d(TAG, "remove(" + holder.getItemId() + ")"); if (subscription != null) { subscription.unsubscribe(); } FeedItem item = holder.getFeedItem(); if (item != null) { DBWriter.removeFavoriteItem(item); Snackbar snackbar = Snackbar.make(root, getString(R.string.removed_item), Snackbar.LENGTH_LONG); snackbar.setAction(getString(R.string.undo), v -> { DBWriter.addFavoriteItem(item); }); snackbar.show(); } } }; ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback); itemTouchHelper.attachToRecyclerView(listView); return root; }

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View root = super.onCreateViewHelper(inflater, container, savedInstanceState, R.layout.all_episodes_fragment); ItemTouchHelper.SimpleCallback simpleItemTouchCallback = new ItemTouchHelper.SimpleCallback(0, ItemTouchHelper.LEFT | ItemTouchHelper.RIGHT) { @Override public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) { return false; } @Override public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) { AllEpisodesRecycleAdapter.Holder holder = (AllEpisodesRecycleAdapter.Holder)viewHolder; Log.d(TAG, "remove(" + holder.getItemId() + ")"); if (subscription != null) { subscription.unsubscribe(); } FeedItem item = holder.getFeedItem(); if (item != null) { DBWriter.removeFavoriteItem(item); Snackbar snackbar = Snackbar.make(root, getString(R.string.removed_item), Snackbar.LENGTH_LONG); snackbar.setAction(getString(R.string.undo), v -> { DBWriter.addFavoriteItem(item); }); snackbar.show(); } } }; ItemTouchHelper itemTouchHelper = new ItemTouchHelper(simpleItemTouchCallback); itemTouchHelper.attachToRecyclerView(recyclerView); return root; }
Source:
public ShowEmptyRowsAction() { super(org.eclipse.tracecompass.internal.tmf.ui.views.timegraph.Messages.AbstractTimeGraphView_ShowRowsActionName, IAction.AS_PUSH_BUTTON); setToolTipText(org.eclipse.tracecompass.internal.tmf.ui.views.timegraph.Messages.AbstractTimeGraphView_ShowRowsActionTooltip); setImageDescriptor(SHOW_EMPTY_ROWS); setChecked(true); }

Target:
public ShowEmptyRowsAction() { super(org.eclipse.tracecompass.internal.tmf.ui.views.timegraph.Messages.AbstractTimeGraphView_ShowRowsActionName, IAction.AS_CHECK_BOX); setToolTipText(org.eclipse.tracecompass.internal.tmf.ui.views.timegraph.Messages.AbstractTimeGraphView_ShowRowsActionTooltip); setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(ITmfImageConstants.IMG_UI_SHOW_ROWS_BUTTON)); setChecked(true); }
Source:
public ItemStack decrStackSize(int i, int j) { try { ItemStack stack = (ItemStack) getItem.invoke(this.tile); if(stack.stackSize > this.hide) { stack.stackSize -= 1; setItem.invoke(this.tile, stack); ItemStack ret = stack.copy(); ret.stackSize = 1; return ret; } } catch (Exception e) return null; }

Target:
public ItemStack decrStackSize(int i, int j) { try { ItemStack stack = (ItemStack) getItem.invoke(this.tile); if(stack.stackSize > this.hide) { stack.stackSize -= 1; setItem.invoke(this.tile, stack.stackSize <= 0 ? null : stack); ItemStack ret = stack.copy(); ret.stackSize = 1; return ret; } } catch (IllegalAccessException e){} catch (IllegalArgumentException e){} catch (InvocationTargetException e){} return null; }
Source:
private void reverse(final LEdge lEdge, final LGraph lGraph) { lEdge.reverse(lGraph, true); lEdge.setProperty(LayeredOptions.PRIORITY_DIRECTION, PARTITION_CONSTRAINT_EDGE_PRIORITY); }

Target:
private void reverse(final LEdge lEdge, final LGraph lGraph) { lEdge.reverse(lGraph, true); if (!lEdge.hasProperty(LayeredOptions.PRIORITY_DIRECTION)) { lEdge.setProperty(LayeredOptions.PRIORITY_DIRECTION, PARTITION_CONSTRAINT_EDGE_PRIORITY); } }
Source:
public String loadColumn(String columnName) { int pos = 1; int chunk = 256*1024; String buf = ""; while (true) { Cursor cursor = null; try { cursor = mDb.getDatabase().rawQuery( "SELECT substr(" + columnName + ", ?, ?) FROM col", new String[]{Integer.toString(pos), Integer.toString(chunk)}); if (!cursor.moveToFirst()) { return buf; } String res = cursor.getString(0); if (res.length() == 0) { break; } buf += res; if (res.length() < chunk) { break; } pos += chunk; } finally { if (cursor != null) { cursor.close(); } } } return buf; }

Target:
public String loadColumn(String columnName) { int pos = 1; int chunk = 256*1024; StringBuffer buf = new StringBuffer(""); while (true) { Cursor cursor = null; try { cursor = mDb.getDatabase().rawQuery( "SELECT substr(" + columnName + ", ?, ?) FROM col", new String[]{Integer.toString(pos), Integer.toString(chunk)}); if (!cursor.moveToFirst()) { return buf.toString(); } String res = cursor.getString(0); if (res.length() == 0) { break; } buf.append(res); if (res.length() < chunk) { break; } pos += chunk; } finally { if (cursor != null) { cursor.close(); } } } return buf.toString(); }
Source:
public boolean equals(Object obj) { WorkspaceListItem itemForCompare = (WorkspaceListItem) obj; return this.ownerName.equals(itemForCompare.ownerName) && this.workspaceName.equals(itemForCompare.workspaceName) && this.ramAmount == itemForCompare.ramAmount && this.projectsAmount == itemForCompare.projectsAmount; }

Target:
public boolean equals(Object obj) { if (obj instanceof WorkspaceListItem) { WorkspaceListItem itemForCompare = (WorkspaceListItem) obj; return this.ownerName.equals(itemForCompare.ownerName) && this.workspaceName.equals(itemForCompare.workspaceName) && this.ramAmount == itemForCompare.ramAmount && this.projectsAmount == itemForCompare.projectsAmount; } return false; }
Source:
public void creatingUserConsentsToAllRequiredConsents() { Study study = TestUtils.getValidStudy(UserAdminServiceMockTest.class); StudyParticipant participant = new StudyParticipant.Builder().withEmail("email@email.com").withPassword("password").build(); service.createUser(study, participant, null, true, true); verify(participantService).createParticipant(study, Sets.newHashSet(Roles.ADMIN), participant, false); verify(authenticationService).signIn(eq(study), contextCaptor.capture(), signInCaptor.capture()); CriteriaContext context = contextCaptor.getValue(); assertEquals(study.getStudyIdentifier(), context.getStudyIdentifier()); SignIn signIn = signInCaptor.getValue(); assertEquals(participant.getEmail(), signIn.getEmail()); assertEquals(participant.getPassword(), signIn.getPassword()); verify(consentService).getConsentStatuses(context); }

Target:
public void creatingUserConsentsToAllRequiredConsents() { Study study = TestUtils.getValidStudy(UserAdminServiceMockTest.class); StudyParticipant participant = new StudyParticipant.Builder().withEmail("email@email.com").withPassword("password").build(); Map<SubpopulationGuid,ConsentStatus> statuses = Maps.newHashMap(); statuses.put(SubpopulationGuid.create("foo1"), TestConstants.REQUIRED_SIGNED_CURRENT); statuses.put(SubpopulationGuid.create("foo2"), TestConstants.REQUIRED_SIGNED_OBSOLETE); when(consentService.getConsentStatuses(any())).thenReturn(statuses); service.createUser(study, participant, null, true, true); verify(participantService).createParticipant(study, Sets.newHashSet(Roles.ADMIN), participant, false); verify(authenticationService).signIn(eq(study), contextCaptor.capture(), signInCaptor.capture()); CriteriaContext context = contextCaptor.getValue(); assertEquals(study.getStudyIdentifier(), context.getStudyIdentifier()); verify(consentService).consentToResearch(eq(study), eq(SubpopulationGuid.create("foo1")), any(StudyParticipant.class), any(), eq(SharingScope.NO_SHARING), eq(false)); verify(consentService).consentToResearch(eq(study), eq(SubpopulationGuid.create("foo2")), any(StudyParticipant.class), any(), eq(SharingScope.NO_SHARING), eq(false)); SignIn signIn = signInCaptor.getValue(); assertEquals(participant.getEmail(), signIn.getEmail()); assertEquals(participant.getPassword(), signIn.getPassword()); verify(consentService).getConsentStatuses(context); }
Source:
public static String getAttributeValueFromString(String string) { String content = string; if (content.length() > 0) { return content; } return null; }

Target:
public static String getAttributeValueFromString(String string) { if (string != null && string.length() > 0) { return string; } return null; }
Source:
public void shutdown() { try { logger.info("shutdown started"); if (jmxServer != null) jmxServer.stop(); if (jvmMetrics != null) jvmMetrics.stop(); if (reporters != null) for (Map.Entry<String, MetricsReporter> reporterEntry : reporters.entrySet()) reporterEntry.getValue().stop(); if(networkServer != null) networkServer.shutdown(); if(requestHandlerPool != null) requestHandlerPool.shutdown(); if (scheduler != null) { scheduler.shutdown(); } if (storeManager != null) { storeManager.shutdown(); } shutdownLatch.countDown(); logger.info("shutdown completed"); } catch (Exception e) { logger.error("Error while shutting down server {}", e); } }

Target:
public void shutdown() { try { logger.info("shutdown started"); if (jmxServer != null) jmxServer.stop(); if (jvmMetrics != null) jvmMetrics.stop(); if (reporters != null) for (Map.Entry<String, MetricsReporter> reporterEntry : reporters.entrySet()) reporterEntry.getValue().stop(); if(networkServer != null) networkServer.shutdown(); if(requestHandlerPool != null) requestHandlerPool.shutdown(); if (scheduler != null) { scheduler.shutdown(); } if (storeManager != null) { storeManager.shutdown(); } logger.info("shutdown completed"); } catch (Exception e) { logger.error("Error while shutting down server {}", e); } finally { shutdownLatch.countDown(); } }
Source:
public boolean isMiscellaneous() { return miscellaneous; }

Target:
public boolean isMiscellaneous() { return this.miscellaneous; }
Source:
public MicrometerMetricsCaptor(MeterRegistry meterRegistry) { Assert.notNull(meterRegistry, "meterRgistry cannot be null"); this.meterRegistry = meterRegistry; }

Target:
public MicrometerMetricsCaptor(MeterRegistry meterRegistry) { Assert.notNull(meterRegistry, "meterRegistry cannot be null"); this.meterRegistry = meterRegistry; }
Source:
public void addScenario(Scenario s, Mission m) { int id; if (s.getId() == Scenario.S_DEFAULT_ID) { id = ++lastScenarioId; s.setId(id); } else { id = s.getId(); } m.addScenario(s); scenarios.put(id, s); addReport(String.format("New scenario '%s' will occur on %s.", s.getName(), MekHQ.getMekHQOptions().getDisplayFormattedDate(s.getDate()))); MekHQ.triggerEvent(new ScenarioNewEvent(s)); }

Target:
public void addScenario(Scenario s, Mission m) { int id; if (s.getId() == Scenario.S_DEFAULT_ID) { id = ++lastScenarioId; s.setId(id); } else { id = s.getId(); } m.addScenario(s); scenarios.put(id, s); addReport(MessageFormat.format( resources.getString("newAtBMission.format"), s.getName(), MekHQ.getMekHQOptions().getDisplayFormattedDate(s.getDate()))); MekHQ.triggerEvent(new ScenarioNewEvent(s)); }
Source:
public void testClientIsInstrumentedWithTracer() throws InterruptedException { server.enqueue(new MockResponse().setBody("\"server\"")); String parentSpanId = Tracer.startSpan("").getSpanId(); String traceId = Tracer.getTraceId(); List<String> spanIds = Lists.newArrayList(); List<Span> spans = Lists.newArrayList(); Tracer.subscribe(TracerTest.class.getName(), span -> { spanIds.add(span.getSpanId()); spans.add(span); }); service.param("somevalue"); Tracer.unsubscribe(TracerTest.class.getName()); assertThat(spans).containsExactly( span(spans.get(0), traceId, spanIds.get(2), SpanType.LOCAL, "OkHttp: limiter-enqueue"), span(spans.get(1), traceId, spanIds.get(2), SpanType.LOCAL, "OkHttp: limiter-run"), span(spans.get(2), traceId, parentSpanId, SpanType.LOCAL, "OkHttp: enqueue"), span(spans.get(3), traceId, spanIds.get(4), SpanType.CLIENT_OUTGOING, "OkHttp: GET /{param}"), span(spans.get(4), traceId, spanIds.get(1), SpanType.LOCAL, "OkHttp: dispatcher")); RecordedRequest request = server.takeRequest(); assertThat(request.getHeader(TraceHttpHeaders.TRACE_ID)).isEqualTo(traceId); assertThat(request.getHeader(TraceHttpHeaders.SPAN_ID)).isNotEqualTo(parentSpanId); }

Target:
public void testClientIsInstrumentedWithTracer() throws InterruptedException { server.enqueue(new MockResponse().setBody("\"server\"")); String parentSpanId = Tracer.startSpan("").getSpanId(); String traceId = Tracer.getTraceId(); List<String> spanIds = Lists.newArrayList(); List<Span> spans = Lists.newArrayList(); Tracer.subscribe(TracerTest.class.getName(), span -> { spanIds.add(span.getSpanId()); spans.add(span); }); service.param("somevalue"); Tracer.unsubscribe(TracerTest.class.getName()); assertThat(spans).containsExactly( span(spans.get(0), traceId, spanIds.get(2), SpanType.LOCAL, "OkHttp: limiter-enqueue"), span(spans.get(1), traceId, spanIds.get(2), SpanType.LOCAL, "OkHttp: limiter-run"), span(spans.get(2), traceId, parentSpanId, SpanType.LOCAL, "OkHttp: enqueue"), span(spans.get(3), traceId, spanIds.get(4), SpanType.CLIENT_OUTGOING, "OkHttp: GET /{param}"), span(spans.get(4), traceId, spanIds.get(2), SpanType.LOCAL, "OkHttp: dispatcher")); RecordedRequest request = server.takeRequest(); assertThat(request.getHeader(TraceHttpHeaders.TRACE_ID)).isEqualTo(traceId); assertThat(request.getHeader(TraceHttpHeaders.SPAN_ID)).isNotEqualTo(parentSpanId); }
Source:
private com.jcabi.http.Request request(final Request req, final String dest) throws IOException { final String method = new RqMethod.Base(req).method(); com.jcabi.http.Request proxied = new JdkRequest(dest) .method(method); final RqHeaders.Base headers = new RqHeaders.Base(req); for (final String name : headers.names()) { if ("content-length".equals(name.toLowerCase(Locale.ENGLISH))) { continue; } if (isHost(name)) { proxied = proxied.header(name, this.host); continue; } for (final String value : headers.header(name)) { proxied = proxied.header(name, value); } } if (Arrays.asList("POST", "PUT").contains(method)) { final ByteArrayOutputStream output = new ByteArrayOutputStream(); new RqPrint(new RqLengthAware(req)).printBody(output); proxied = proxied.body().set(output.toByteArray()).back(); } return proxied; }

Target:
private com.jcabi.http.Request request(final Request req, final String dest) throws IOException { final String method = new RqMethod.Base(req).method(); com.jcabi.http.Request proxied = new JdkRequest(dest) .method(method); final RqHeaders.Base headers = new RqHeaders.Base(req); for (final String name : headers.names()) { if ("content-length".equals(name.toLowerCase(Locale.ENGLISH))) { continue; } if (isHost(name)) { proxied = proxied.header(name, this.host); continue; } for (final String value : headers.header(name)) { proxied = proxied.header(name, value); } } if (headers.header("Content-Length").iterator().hasNext() || headers.header("Transfer-Encoding").iterator().hasNext()) { final ByteArrayOutputStream output = new ByteArrayOutputStream(); new RqPrint(new RqLengthAware(req)).printBody(output); proxied = proxied.body().set(output.toByteArray()).back(); } return proxied; }
Source:
void roundtripWithArticleMonths() throws Exception { Path testBibtexFile = Paths.get("src/test/resources/testbib/articleWithMonths.bib"); Charset encoding = StandardCharsets.UTF_8; ParserResult result = new BibtexParser(importFormatPreferences, fileMonitor).parse(Importer.getReader(testBibtexFile, encoding)); when(preferences.getEncoding()).thenReturn(encoding); when(preferences.isSaveInOriginalOrder()).thenReturn(true); BibDatabaseContext context = new BibDatabaseContext(result.getDatabase(), result.getMetaData(), new Defaults(BibDatabaseMode.BIBTEX)); databaseWriter.savePartOfDatabase(context, result.getDatabase().getEntries()); assertEquals(Files.asCharSource(testBibtexFile.toFile(), Charsets.UTF_8).read(), stringWriter.toString()); }

Target:
void roundtripWithArticleMonths() throws Exception { Path testBibtexFile = Paths.get("src/test/resources/testbib/articleWithMonths.bib"); Charset encoding = StandardCharsets.UTF_8; ParserResult result = new BibtexParser(importFormatPreferences, fileMonitor).parse(Importer.getReader(testBibtexFile, encoding)); when(preferences.getEncoding()).thenReturn(encoding); when(preferences.isSaveInOriginalOrder()).thenReturn(true); BibDatabaseContext context = new BibDatabaseContext(result.getDatabase(), result.getMetaData(), new Defaults(BibDatabaseMode.BIBTEX)); databaseWriter.savePartOfDatabase(context, result.getDatabase().getEntries()); assertEquals(Files.readString(testBibtexFile, encoding), stringWriter.toString()); }
Source:
protected void endVmCommand() { initializeObjectState(); if (getParameters().getTaskGroupSuccess()) { getSnapshotDao().remove(getParameters().getSnapshotId()); } else { List<String> failedToRemoveDisks = new ArrayList<>(); for (VdcActionParametersBase parametersBase : getParameters().getImagesParameters()) { ImagesContainterParametersBase imagesParams = (ImagesContainterParametersBase) parametersBase; if (imagesParams.getTaskGroupSuccess()) { Snapshot snapshotWithoutImage = ImagesHandler.prepareSnapshotConfigWithoutImageSingleImage( getParameters().getSnapshotId(), imagesParams.getImageId()); getSnapshotDao().update(snapshotWithoutImage); } else { log.errorFormat("Could not delete image {0} from snapshot {1}", getParameters().getSnapshotId(), imagesParams.getImageId()); DiskImage diskImage = getDiskImageDao().getSnapshotById(imagesParams.getImageId()); failedToRemoveDisks.add(diskImage.getDiskAlias()); } } if (!failedToRemoveDisks.isEmpty()) { addCustomValue("DiskAliases", StringUtils.join(failedToRemoveDisks, ", ")); AuditLogDirector.log(this, AuditLogType.USER_REMOVE_SNAPSHOT_FINISHED_FAILURE_PARTIAL_SNAPSHOT); } getSnapshotDao().updateStatus(getParameters().getSnapshotId(), SnapshotStatus.OK); } super.endVmCommand(); }

Target:
protected void endVmCommand() { initializeObjectState(); if (getParameters().getTaskGroupSuccess()) { getSnapshotDao().remove(getParameters().getSnapshotId()); } else { List<String> failedToRemoveDisks = new ArrayList<>(); Snapshot snapshot = getSnapshotDao().get(getParameters().getSnapshotId()); for (VdcActionParametersBase parameters : getParameters().getImagesParameters()) { ImagesContainterParametersBase imagesParams = (parameters instanceof ImagesContainterParametersBase ? (ImagesContainterParametersBase) parameters : null); if (imagesParams == null) { continue; } if (imagesParams.getTaskGroupSuccess()) { snapshot = ImagesHandler.prepareSnapshotConfigWithoutImageSingleImage( snapshot, imagesParams.getImageId()); } else { log.errorFormat("Could not delete image {0} from snapshot {1}", imagesParams.getImageId(), getParameters().getSnapshotId()); DiskImage diskImage = getDiskImageDao().getSnapshotById(imagesParams.getImageId()); failedToRemoveDisks.add(diskImage.getDiskAlias()); } } snapshot.setMemoryVolume(""); getSnapshotDao().update(snapshot); if (!failedToRemoveDisks.isEmpty()) { addCustomValue("DiskAliases", StringUtils.join(failedToRemoveDisks, ", ")); AuditLogDirector.log(this, AuditLogType.USER_REMOVE_SNAPSHOT_FINISHED_FAILURE_PARTIAL_SNAPSHOT); } getSnapshotDao().updateStatus(getParameters().getSnapshotId(), SnapshotStatus.OK); } super.endVmCommand(); }
Source:
public Map<String, Object> getPropertiesAndTypeValues(String nodeId, Alien4CloudApplication toscaApplication, String requirementId, String computeName) { Optional<RelationshipTemplate> optionalRelationshipTemplate = findRelationshipRequirement(nodeId, toscaApplication, requirementId); if (optionalRelationshipTemplate.isPresent()) { RelationshipTemplate relationshipTemplate = optionalRelationshipTemplate.get(); if (relationshipTemplate.getType().equals("tosca.relationships.Configure")) { Map<String, Object> relationProperties = getRelationProperties(nodeId, computeName, toscaApplication, relationshipTemplate); return getPropertiesAndTypedValues(relationshipTemplate, relationProperties, computeName); } } return Collections.emptyMap(); }

Target:
public Map<String, Object> getPropertiesAndTypeValues(String nodeId, Alien4CloudApplication toscaApplication, String requirementId, String computeName) { Optional<RelationshipTemplate> optionalRelationshipTemplate = findRelationshipRequirement(nodeId, toscaApplication, requirementId); if (optionalRelationshipTemplate.isPresent()) { RelationshipTemplate relationshipTemplate = optionalRelationshipTemplate.get(); if (relationshipTemplate.getType().equals("brooklyn.relationships.Configure")) { Map<String, Object> relationProperties = getRelationProperties(nodeId, computeName, toscaApplication, relationshipTemplate); return getPropertiesAndTypedValues(relationshipTemplate, relationProperties, computeName); } } return Collections.emptyMap(); }
Source:
@Override public void onNegativeClicked(@NonNull String instanceTag) { switch (instanceTag) { case ASYNC_PROMO_DIALOG_TAG: PromoDialog promoDialog = (PromoDialog) getSupportFragmentManager().findFragmentByTag(instanceTag); if (promoDialog != null) { promoDialog.dismiss(); } break; case TAG_PUBLISH_CONFIRMATION_DIALOG: case TAG_REMOVE_FAILED_UPLOADS_DIALOG: BasicYesNoFragmentDialog basicDialog = (BasicYesNoFragmentDialog) getSupportFragmentManager() .findFragmentByTag(instanceTag); if (basicDialog != null) { basicDialog.dismiss(); } break; default: AppLog.e(T.EDITOR, "Dialog instanceTag is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }

Target:
@Override public void onNegativeClicked(@NonNull String instanceTag) { switch (instanceTag) { case ASYNC_PROMO_DIALOG_TAG: case TAG_PUBLISH_CONFIRMATION_DIALOG: case TAG_REMOVE_FAILED_UPLOADS_DIALOG: break; default: AppLog.e(T.EDITOR, "Dialog instanceTag is not recognized"); throw new UnsupportedOperationException("Dialog instanceTag is not recognized"); } }
Source:
protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { final String attrName = operation.require(ModelDescriptionConstants.NAME).asString(); ProtocolServerMetrics metric = ProtocolServerMetrics.getStat(attrName); if (metric == null) { context.getFailureDescription().set(String.format("Unknown metric %s", attrName)); } else { final ServiceController<?> controller = context.getServiceRegistry(false) .getService(EndpointUtils.getServiceName(operation, name)); ProtocolServerService service = (ProtocolServerService) controller.getService(); ModelNode result = new ModelNode(); switch (metric) { case BYTES_READ: result.set(service.getTransport().getTotalBytesRead()); break; case BYTES_WRITTEN: result.set(service.getTransport().getTotalBytesWritten()); break; case TRANSPORT_RUNNING: result.set(((AbstractProtocolServer)service.getValue()).getTransportStatus() == ComponentStatus.RUNNING); break; } context.getResult().set(result); } context.stepCompleted(); }

Target:
protected void executeRuntimeStep(OperationContext context, ModelNode operation) throws OperationFailedException { final String attrName = operation.require(ModelDescriptionConstants.NAME).asString(); ProtocolServerMetrics metric = ProtocolServerMetrics.getStat(attrName); if (metric == null) { context.getFailureDescription().set(String.format("Unknown metric %s", attrName)); } else { final ServiceController<?> controller = context.getServiceRegistry(false) .getService(EndpointUtils.getServiceName(operation, name)); ProtocolServerService service = (ProtocolServerService) controller.getService(); AbstractProtocolServer server = (AbstractProtocolServer) service.getValue(); ModelNode result = new ModelNode(); switch (metric) { case BYTES_READ: result.set(server.getTransport().getTotalBytesRead()); break; case BYTES_WRITTEN: result.set(server.getTransport().getTotalBytesWritten()); break; case TRANSPORT_RUNNING: result.set(server.getTransportStatus() == ComponentStatus.RUNNING); break; } context.getResult().set(result); } context.stepCompleted(); }
Source:
private void addViewerToSelectionProvider() { IWorkbenchPart part = getCompareConfiguration().getContainer().getWorkbenchPart(); ISelectionProvider provider = part.getSite().getSelectionProvider(); if (provider instanceof CompareEditorSelectionProvider) { EMFCompareEditorSelectionProviderWrapper compareProvider = new EMFCompareEditorSelectionProviderWrapper( (CompareEditorSelectionProvider)provider); part.getSite().setSelectionProvider(compareProvider); compareProvider.addViewers(Arrays.asList((Viewer)getViewer()), getViewer()); } }

Target:
private void addViewerToSelectionProvider() { IWorkbenchPart part = getCompareConfiguration().getContainer().getWorkbenchPart(); ISelectionProvider provider = part.getSite().getSelectionProvider(); if (provider instanceof CompareEditorSelectionProvider) { EMFCompareEditorSelectionProviderWrapper compareProvider = new EMFCompareEditorSelectionProviderWrapper( (CompareEditorSelectionProvider)provider); part.getSite().setSelectionProvider(compareProvider); compareProvider.addViewers(Arrays.asList(getViewer()), getViewer()); } }
Source:
protected ISeries addSeries(String seriesName) { if (seriesName == null) { return null; } ISeriesSet seriesSet = getSwtChart().getSeriesSet(); int seriesCount = seriesSet.getSeries().length; ICommonXAxisModel currentModel = getModel(); IYSeries ySeries = currentModel.findSeries(seriesName); if (ySeries == null) { setSeries(seriesName, new double[currentModel.getXAxis().length]); currentModel = getModel(); ySeries = currentModel.findSeries(seriesName); } if (ySeries == null) { return null; } String colorTxt = ySeries.getColor(); Color color = getColor(seriesName, colorTxt); switch (ySeries.getSeriesType()) { case IYSeries.BAR: IBarSeries barSeries = (IBarSeries) seriesSet.createSeries(SeriesType.BAR, seriesName); barSeries.enableStack(true); barSeries.setBarColor(color); barSeries.setBarPadding(0); barSeries.setVisible(true); return barSeries; default: ILineSeries lineSeries = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, seriesName); boolean isScatter = IYSeries.SCATTER.equals(ySeries.getSeriesType()); lineSeries.enableArea(IYSeries.AREA.equals(ySeries.getSeriesType())); lineSeries.setLineStyle(!isScatter ? LINE_STYLES.get(getLineStyle(ySeries.getSeriesType(), seriesCount)) : LineStyle.NONE); lineSeries.setSymbolType(isScatter ? PlotSymbolType.DIAMOND : PlotSymbolType.NONE); lineSeries.setLineColor(color); lineSeries.setVisible(true); return lineSeries; } }

Target:
protected ISeries addSeries(String seriesName) { if (seriesName == null) { return null; } ISeriesSet seriesSet = getSwtChart().getSeriesSet(); int seriesCount = seriesSet.getSeries().length; ICommonXAxisModel currentModel = getModel(); IYSeries ySeries = currentModel.findSeries(seriesName); if (ySeries == null) { setSeries(seriesName, new double[currentModel.getXAxis().length]); currentModel = getModel(); ySeries = currentModel.findSeries(seriesName); } if (ySeries == null) { return null; } String colorTxt = ySeries.getColor(); Color color = getColor(seriesName, colorTxt); if (ySeries.getSeriesType() == IYSeries.BAR) { IBarSeries barSeries = (IBarSeries) seriesSet.createSeries(SeriesType.BAR, seriesName); barSeries.enableStack(true); barSeries.setBarColor(color); barSeries.setBarPadding(0); barSeries.setVisible(true); return barSeries; } ILineSeries lineSeries = (ILineSeries) seriesSet.createSeries(SeriesType.LINE, seriesName); boolean isScatter = IYSeries.SCATTER.equals(ySeries.getSeriesType()); lineSeries.enableArea(IYSeries.AREA.equals(ySeries.getSeriesType())); lineSeries.setLineStyle(!isScatter ? LINE_STYLES.get(getLineStyle(ySeries.getSeriesType(), seriesCount)) : LineStyle.NONE); lineSeries.setSymbolType(isScatter ? PlotSymbolType.DIAMOND : PlotSymbolType.NONE); lineSeries.setLineColor(color); lineSeries.setVisible(true); return lineSeries; }
Source:
private VideoBlockModel getVideoUnit() { EnrolledCoursesResponse courseData; try { courseData = executeStrict(courseAPI.getEnrolledCourses()).get(0); } catch (Exception e) { throw new RuntimeException(e); } String courseId = courseData.getCourse().getId(); CourseStructureV1Model model; CourseComponent courseComponent; try { model = executeStrict(courseAPI.getCourseStructure(courseId)); courseComponent = (CourseComponent) CourseAPI.normalizeCourseStructure(model, courseId); } catch (Exception e) { throw new RuntimeException(e); } return (VideoBlockModel) courseComponent.getVideos().get(0); }

Target:
private VideoBlockModel getVideoUnit() { EnrolledCoursesResponse courseData; try { courseData = executeStrict(courseAPI.getEnrolledCourses()).get(0); } catch (Exception e) { throw new RuntimeException(e); } String courseId = courseData.getCourse().getId(); CourseStructureV1Model model; CourseComponent courseComponent; try { model = executeStrict(courseAPI.getCourseStructure(config.getApiUrlVersionConfig().getBlocksApiVersion(), courseId)); courseComponent = (CourseComponent) CourseAPI.normalizeCourseStructure(model, courseId); } catch (Exception e) { throw new RuntimeException(e); } return courseComponent.getVideos().get(0); }
Source:
public void addItem(CatalogItem<?> item) { log.debug("Adding manual catalog item to "+mgmt+": "+item); Preconditions.checkNotNull(item); if (manualAdditionsCatalog==null) loadManualAdditionsCatalog(); manualAdditionsCatalog.addEntry(getAbstractCatalogItem(item)); }

Target:
public void addItem(CatalogItem<?> item) { log.debug("Adding manual catalog item to "+mgmt+": "+item); Preconditions.checkNotNull(item, "item"); if (manualAdditionsCatalog==null) loadManualAdditionsCatalog(); manualAdditionsCatalog.addEntry(getAbstractCatalogItem(item)); }
Source:
public void submoduleWithNoHead() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); final RevCommit id = git.commit().setMessage("create file").call(); final String path = "sub"; DirCache cache = db.lockDirCache(); DirCacheEditor editor = cache.editor(); editor.add(new PathEdit(path) { public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.GITLINK); ent.setObjectId(id); } }); editor.commit(); assertNotNull(Git.init().setDirectory(new File(db.getWorkTree(), path)) .call().getRepository()); TreeWalk walk = new TreeWalk(db); DirCacheIterator indexIter = new DirCacheIterator(db.readDirCache()); FileTreeIterator workTreeIter = new FileTreeIterator(db); walk.addTree(indexIter); walk.addTree(workTreeIter); walk.setFilter(PathFilter.create(path)); assertTrue(walk.next()); assertFalse(indexIter.idEqual(workTreeIter)); }

Target:
public void submoduleWithNoHead() throws Exception { Git git = new Git(db); writeTrashFile("file.txt", "content"); git.add().addFilepattern("file.txt").call(); final RevCommit id = git.commit().setMessage("create file").call(); final String path = "sub"; DirCache cache = db.lockDirCache(); DirCacheEditor editor = cache.editor(); editor.add(new PathEdit(path) { public void apply(DirCacheEntry ent) { ent.setFileMode(FileMode.GITLINK); ent.setObjectId(id); } }); editor.commit(); assertNotNull(Git.init().setDirectory(new File(db.getWorkTree(), path)) .call().getRepository()); TreeWalk walk = new TreeWalk(db); DirCacheIterator indexIter = new DirCacheIterator(db.readDirCache()); FileTreeIterator workTreeIter = new FileTreeIterator(db); walk.addTree(indexIter); walk.addTree(workTreeIter); walk.setFilter(PathFilter.create(path)); assertTrue(walk.next()); assertFalse(indexIter.idEqual(workTreeIter)); assertEquals(ObjectId.zeroId(), workTreeIter.getEntryObjectId()); }
Source:
public int getPartitionId(final long dataId) { final long partitionSize = Long.MAX_VALUE / numPartitions; return (int) (dataId / partitionSize); }

Target:
public int getPartitionId(final long dataId) { return (int) (dataId / partitionSize); }
Source:
public Collection<Class> getServices() { return Arrays.asList(new Class[] { MagicThingActionsService.class }); }

Target:
public Collection<Class<? extends ThingHandlerService>> getServices() { return Collections.singletonList(MagicThingActionsService.class); }
Source:
public Object[][] intervalsMultipleContigs(){ List<Locatable> input = Arrays.asList( new Interval("1", 10, 100), new Interval("2", 200, 300) ); List<Locatable> empty = new ArrayList<>(); List<Locatable> contig1 = Arrays.asList( new Interval("1", 10, 100) ); List<Locatable> contig2 = Arrays.asList( new Interval("2", 200, 300) ); return new Object[][]{ new Object[]{input, new Interval("1", 100, 200), contig1}, new Object[]{input, new Interval("1", 1, 5), empty}, new Object[]{input, new Interval("2", 100, 200), contig2}, new Object[]{input, new Interval("3", 100, 200), empty}, }; }

Target:
public Object[][] intervalsMultipleContigs(){ final List<Locatable> input = Arrays.asList( new Interval("1", 10, 100), new Interval("2", 200, 300) ); final List<Locatable> empty = new ArrayList<>(); final List<Locatable> contig1 = Arrays.asList( new Interval("1", 10, 100) ); final List<Locatable> contig2 = Arrays.asList( new Interval("2", 200, 300) ); return new Object[][] { new Object[] {input, new Interval("1", 100, 200), contig1}, new Object[] {input, new Interval("1", 1, 5), empty}, new Object[] {input, new Interval("2", 100, 200), contig2}, new Object[] {input, new Interval("3", 100, 200), empty}, }; }
Source:
public List<RichGroup> convertGroupsToRichGroupsWithAttributes(PerunSession sess, Member member, Resource resource, List<Group> groups, List<String> attrNames) throws InternalErrorException, GroupResourceMismatchException, MemberResourceMismatchException { List<RichGroup> richGroups = new ArrayList<>(); for(Group group: groups) { List<Attribute> attributes = new ArrayList<>(); List<String> supportedNames = attrNames.stream().filter(attrName -> attrName.startsWith(AttributesManager.NS_GROUP_RESOURCE_ATTR) || attrName.startsWith(AttributesManager.NS_GROUP_ATTR)).collect(Collectors.toList() ); attributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, resource, group, supportedNames, true)); supportedNames = attrNames.stream().filter(attrName -> attrName.startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)).collect(Collectors.toList() ); if(supportedNames.isEmpty()) { attributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, member, group)); } else { attributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, member, group, supportedNames)); } richGroups.add(new RichGroup(group, attributes)); } return richGroups; }

Target:
public List<RichGroup> convertGroupsToRichGroupsWithAttributes(PerunSession sess, Member member, Resource resource, List<Group> groups, List<String> attrNames) throws InternalErrorException, GroupResourceMismatchException, MemberResourceMismatchException { List<RichGroup> richGroups = new ArrayList<>(); List<String> groupAndGroupResourceAttrNames = new ArrayList<>(); List<String> memberGroupAttrNames = new ArrayList<>(); if(attrNames != null && !attrNames.isEmpty()) { groupAndGroupResourceAttrNames = attrNames.stream().filter(attrName -> attrName.startsWith(AttributesManager.NS_GROUP_RESOURCE_ATTR) || attrName.startsWith(AttributesManager.NS_GROUP_ATTR)).collect(Collectors.toList()); memberGroupAttrNames = attrNames.stream().filter(attrName -> attrName.startsWith(AttributesManager.NS_MEMBER_GROUP_ATTR)).collect(Collectors.toList()); } for(Group group: groups) { if(attrNames == null) { List<Attribute> attributes = new ArrayList<>(); attributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, resource, group, true)); attributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, member, group)); richGroups.add(new RichGroup(group, attributes)); } else if (attrNames.isEmpty()) { richGroups.add(new RichGroup(group, new ArrayList<>())); } else { List<Attribute> attributes = new ArrayList<>(); if (!groupAndGroupResourceAttrNames.isEmpty()) attributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, resource, group, groupAndGroupResourceAttrNames, true)); if (!memberGroupAttrNames.isEmpty()) attributes.addAll(getPerunBl().getAttributesManagerBl().getAttributes(sess, member, group, memberGroupAttrNames)); richGroups.add(new RichGroup(group, attributes)); } } return richGroups; }
Source:
private JButton createCloseButton() { final JButton closeButton = WidgetFactory.createPrimaryButton("Close", IconUtils.ACTION_SAVE_BRIGHT); closeButton .addActionListener(e -> { dispose(); }); return closeButton; }

Target:
private JButton createCloseButton() { final JButton closeButton = WidgetFactory.createPrimaryButton("Close", IconUtils.ACTION_SAVE_BRIGHT); closeButton.addActionListener(e -> { if (isParticularDateSpecified()) { updateWidget(); } dispose(); }); return closeButton; }
Source:
public static Subject fromSecurityIdentity(final SecurityIdentity securityIdentity) { Assert.checkNotNullParam("securityIdentity", securityIdentity); Subject subject = new Subject(); subject.getPrincipals().add(securityIdentity.getPrincipal()); Group rolesGroup = new SimpleGroup("Roles"); for (String role : securityIdentity.getRoles()) { rolesGroup.addMember(new NamePrincipal(role)); } subject.getPrincipals().add(rolesGroup); Group callerPrincipalGroup = new SimpleGroup("CallerPrincipal"); callerPrincipalGroup.addMember(securityIdentity.getPrincipal()); subject.getPrincipals().add(callerPrincipalGroup); IdentityCredentials publicCredentials = securityIdentity.getPublicCredentials(); PublicKeyCredential publicKeyCredential = publicCredentials.getCredential(PublicKeyCredential.class); if (publicKeyCredential != null) { subject.getPublicCredentials().add(publicKeyCredential.getPublicKey()); } return subject; }

Target:
public static Subject fromSecurityIdentity(final SecurityIdentity securityIdentity) { Assert.checkNotNullParam("securityIdentity", securityIdentity); Subject subject = new Subject(); subject.getPrincipals().add(securityIdentity.getPrincipal()); Group rolesGroup = new SimpleGroup("Roles"); for (String role : securityIdentity.getRoles()) { rolesGroup.addMember(new NamePrincipal(role)); } subject.getPrincipals().add(rolesGroup); Group callerPrincipalGroup = new SimpleGroup("CallerPrincipal"); callerPrincipalGroup.addMember(securityIdentity.getPrincipal()); subject.getPrincipals().add(callerPrincipalGroup); for (Credential credential : securityIdentity.getPublicCredentials()) { if (credential instanceof PublicKeyCredential) { subject.getPublicCredentials().add(credential.castAs(PublicKeyCredential.class).getPublicKey()); } else if (credential instanceof X509CertificateChainPublicCredential) { subject.getPublicCredentials().add(credential.castAs(X509CertificateChainPublicCredential.class).getCertificateChain()); } else { subject.getPublicCredentials().add(credential); } } for (Credential credential : securityIdentity.getPrivateCredentials()) { if (credential instanceof PasswordCredential) { addPrivateCredential(subject, credential.castAs(PasswordCredential.class).getPassword()); } else if (credential instanceof SecretKeyCredential) { addPrivateCredential(subject, credential.castAs(SecretKeyCredential.class).getSecretKey()); } else if (credential instanceof KeyPairCredential) { addPrivateCredential(subject, credential.castAs(KeyPairCredential.class).getKeyPair()); } else if (credential instanceof X509CertificateChainPrivateCredential) { addPrivateCredential(subject, credential.castAs(X509CertificateChainPrivateCredential.class).getCertificateChain()); } else { addPrivateCredential(subject, credential); } } addPrivateCredential(subject, securityIdentity); return subject; }
Source:
protected T doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, BugzillaRestException { BufferedInputStream is = new BufferedInputStream(response.getResponseEntityAsStream()); InputStreamReader in = new InputStreamReader(is); isRestError(is, in); return parseFromJson(in); }

Target:
protected T doProcess(CommonHttpResponse response, IOperationMonitor monitor) throws IOException, BugzillaRestException { try (BufferedInputStream is = new BufferedInputStream(response.getResponseEntityAsStream())) { InputStreamReader in = new InputStreamReader(is); throwExeptionIfRestError(is, in); return parseFromJson(in); } }
Source:
private void aggreagteJobStats(JobDetails jobDetails, byte[] rowKey, Context context, AggregationConstants.AGGREGATION_TYPE aggType) throws IOException, InterruptedException { byte[] aggStatusCol = null; switch (aggType) { case DAILY: aggStatusCol = AggregationConstants.JOB_DAILY_AGGREGATION_STATUS_COL_BYTES; break; case WEEKLY: aggStatusCol = AggregationConstants.JOB_WEEKLY_AGGREGATION_STATUS_COL_BYTES; break; default: LOG.error("Unknown aggregation type " + aggType); return; } if ((reAggregationFlag == true) || ((aggregationFlag == Boolean.TRUE) && (!rawService.getStatusAgg(rowKey, aggStatusCol)))) { Boolean aggStatus = appSummaryService.aggregateJobDetails(jobDetails, aggType); context.progress(); LOG.debug("Status of aggreagting stats for " + aggType + "=" + aggStatus); if (aggStatus) { Put aggStatusPut = rawService.getAggregatedStatusPut(rowKey, aggStatusCol, aggStatus); context.write(RAW_TABLE, aggStatusPut); } } }

Target:
private void aggreagteJobStats(JobDetails jobDetails, byte[] rowKey, Context context, AggregationConstants.AGGREGATION_TYPE aggType) throws IOException, InterruptedException { byte[] aggStatusCol = null; switch (aggType) { case DAILY: aggStatusCol = AggregationConstants.JOB_DAILY_AGGREGATION_STATUS_COL_BYTES; break; case WEEKLY: aggStatusCol = AggregationConstants.JOB_WEEKLY_AGGREGATION_STATUS_COL_BYTES; break; default: LOG.error("Unknown aggregation type " + aggType); return; } boolean aggStatus = appSummaryService.aggregateJobDetails(jobDetails, aggType); context.progress(); LOG.debug("Status of aggreagting stats for " + aggType + "=" + aggStatus); if (aggStatus) { Put aggStatusPut = rawService.getAggregatedStatusPut(rowKey, aggStatusCol, aggStatus); context.write(RAW_TABLE, aggStatusPut); } }
Source:
public synchronized void initRoutingTable(final EMRoutingTable routingTable) { if (initLatch.getCount() == 0) { return; } numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToBlockIds.putAll(routingTable.getStoreIdToBlockIds()); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, Set<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } if (blockIdToStoreId.size() != numTotalBlocks || storeIdToBlockIds.size() != storeIdToEndpointId.size()) { throw new RuntimeException("Init info is invalid"); } initLatch.countDown(); LOG.log(Level.FINE, "Server resolver is initialized"); }

Target:
public synchronized void initRoutingTable(final EMRoutingTable routingTable) { if (initLatch.getCount() == 0) { return; } numTotalBlocks = routingTable.getNumTotalBlocks(); storeIdToBlockIds.putAll(routingTable.getStoreIdToBlockIds()); storeIdToEndpointId.putAll(routingTable.getStoreIdToEndpointId()); for (final Map.Entry<Integer, Set<Integer>> entry : storeIdToBlockIds.entrySet()) { final int storeId = entry.getKey(); for (final int blockId : entry.getValue()) { blockIdToStoreId.put(blockId, storeId); } } initLatch.countDown(); if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Server resolver is initialized with NumTotalBlocks: {0}, StoreIdToBlockIds: {1}", new Object[]{numTotalBlocks, storeIdToBlockIds}); } else { LOG.log(Level.INFO, "Server resolver is initialized"); } }