auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Response updateContentTypeFieldByVar(@PathParam("typeId") final String typeId, @PathParam("fieldVar") final String fieldVar, final String fieldJson, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, false, req, false, null); final User user = initData.getUser(); Response response = null; try { Field field = new JsonFieldTransformer(fieldJson).from(); if (!UtilMethods.isSet(field.id())) { response = ExceptionMapperUtil.createResponse(null, "Field 'id' should be set"); } else { final Field currentField = fieldAPI.byContentTypeIdAndVar(typeId, fieldVar); if (!currentField.id().equals(field.id())) { <START> throw new DotDataValidationException("Field var '"+ fieldVar +"' does not match a field with id '"+ field.id() +"'"); <END> } else { field = fieldAPI.save(field, user); response = Response.ok(new ResponseEntityView(new JsonFieldTransformer(field).mapObject())).build(); } } } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }</code><technical_language>fix this message other one: "Field id '"+ fieldId +"' match a field id '"+ field.id() +"'"</technical_language>

Target:
public Response updateContentTypeFieldByVar(@PathParam("typeId") final String typeId, @PathParam("fieldVar") final String fieldVar, final String fieldJson, @Context final HttpServletRequest req) throws DotDataException, DotSecurityException { final InitDataObject initData = this.webResource.init(null, false, req, false, null); final User user = initData.getUser(); Response response = null; try { Field field = new JsonFieldTransformer(fieldJson).from(); if (!UtilMethods.isSet(field.id())) { response = ExceptionMapperUtil.createResponse(null, "Field 'id' should be set"); } else { final Field currentField = fieldAPI.byContentTypeIdAndVar(typeId, fieldVar); if (!currentField.id().equals(field.id())) { throw new DotDataValidationException("Field id '"+ field.id() +"' does not match a field with id '"+ currentField.id() +"'"); } else { field = fieldAPI.save(field, user); response = Response.ok(new ResponseEntityView(new JsonFieldTransformer(field).mapObject())).build(); } } } catch (Exception e) { response = ResponseUtil.mapExceptionResponse(e); } return response; }
Source:
<code>void save(CallbackGroup group) { if (pendingGroup != null) { pendingGroup.addListener(group); return; } String message = editArea.getValue().trim(); if (message.length() == 0) { return; } CommentInfo input = CommentInfo.copy(comment); input.message(message); enableEdit(false); pendingGroup = group; GerritCallback<CommentInfo> cb = new GerritCallback<CommentInfo>() { @Override public void onSuccess(CommentInfo result) { enableEdit(true); pendingGroup = null; set(result); setEdit(false); if (autoClosed) { setOpen(false); } getCommentManager().setUnsaved(DraftBox.this, false); } @Override public void onFailure(Throwable e) { enableEdit(true); pendingGroup = null; super.onFailure(e); } }; if (input.id() == null) { CommentApi.createDraft(psId, input, group.add(cb)); } else { CommentApi.updateDraft(psId, input.id(), input, group.add(cb)); } CodeMirror cm = getCm(); <START> cm.setOption("keyMap", "vim_ro"); <END> cm.focus(); }</code><technical_language>Is this standard exit visual mode? CodeMirror internally calls 'exitVisualMode(cm)' for keystrokes esc, do a less</technical_language>

Target:
void save(CallbackGroup group) { if (pendingGroup != null) { pendingGroup.addListener(group); return; } String message = editArea.getValue().trim(); if (message.length() == 0) { return; } CommentInfo input = CommentInfo.copy(comment); input.message(message); enableEdit(false); pendingGroup = group; GerritCallback<CommentInfo> cb = new GerritCallback<CommentInfo>() { @Override public void onSuccess(CommentInfo result) { enableEdit(true); pendingGroup = null; set(result); setEdit(false); if (autoClosed) { setOpen(false); } getCommentManager().setUnsaved(DraftBox.this, false); } @Override public void onFailure(Throwable e) { enableEdit(true); pendingGroup = null; super.onFailure(e); } }; if (input.id() == null) { CommentApi.createDraft(psId, input, group.add(cb)); } else { CommentApi.updateDraft(psId, input.id(), input, group.add(cb)); } CodeMirror cm = getCm(); cm.vim().handleKey("<Esc>"); cm.focus(); }
Source:
<code>public TextFlow getDescription() { List<String> words = new SentenceAnalyzer(query).getWords(); String firstWord = words.isEmpty() ? "" : words.get(0); String temp = regExp ? Localization.lang( "This search contains entries in which any field contains the regular expression <b>%0</b>") : Localization.lang("This search contains entries in which any field contains the term <b>%0</b>"); List<Text> textList = TooltipTextUtil.formatToTexts(temp, new TooltipTextUtil.TextReplacement("<b>%0</b>", firstWord, TooltipTextUtil.TextType.BOLD)); if (words.size() > 1) { List<String> unprocessedWords = words.subList(1, words.size()); for (String word : unprocessedWords) { textList.add(TooltipTextUtil.createText(String.format(" %s ", Localization.lang("and")), TooltipTextUtil.TextType.NORMAL)); textList.add(TooltipTextUtil.createText(word, TooltipTextUtil.TextType.BOLD)); } } textList.add(getCaseSensitiveDescription()); <START> textList.add(TooltipTextUtil.createText("\n\nHint: To search specific fields only, enter for example:\n")); <END> textList.add(TooltipTextUtil.createText("author=smith and title=electrical")); TextFlow searchDescription = new TextFlow(); searchDescription.getChildren().setAll(textList); return searchDescription; }</code><technical_language>this localized</technical_language>

Target:
public TextFlow getDescription() { List<String> words = new SentenceAnalyzer(query).getWords(); String firstWord = words.isEmpty() ? "" : words.get(0); String temp = regExp ? Localization.lang( "This search contains entries in which any field contains the regular expression <b>%0</b>") : Localization.lang("This search contains entries in which any field contains the term <b>%0</b>"); List<Text> textList = TooltipTextUtil.formatToTexts(temp, new TooltipTextUtil.TextReplacement("<b>%0</b>", firstWord, TooltipTextUtil.TextType.BOLD)); if (words.size() > 1) { List<String> unprocessedWords = words.subList(1, words.size()); for (String word : unprocessedWords) { textList.add(TooltipTextUtil.createText(String.format(" %s ", Localization.lang("and")), TooltipTextUtil.TextType.NORMAL)); textList.add(TooltipTextUtil.createText(word, TooltipTextUtil.TextType.BOLD)); } } textList.add(getCaseSensitiveDescription()); textList.add(TooltipTextUtil.createText("\n\n" + Localization.lang("Hint: To search specific fields only, enter for example:"))); textList.add(TooltipTextUtil.createText(" author=smith and title=electrical", TooltipTextUtil.TextType.MONOSPACED)); TextFlow searchDescription = new TextFlow(); searchDescription.getChildren().setAll(textList); return searchDescription; }
Source:
<code>public void handleChildChange(String parentPath, List<String> currentChilds) { if (logger.isDebugEnabled()) { logger.debug("Data change callback: child changed, path: , current child count: {}", parentPath, currentChilds == null ? 0 : currentChilds.size()); } try { updateNotificationTime(System.nanoTime()); if (parentPath != null && parentPath.startsWith(_path)) { if (currentChilds == null && parentPath.equals(_path)) { _manager.removeListener(_propertyKey, _listener); } else { NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.CALLBACK); changeContext.setPathChanged(parentPath); changeContext.setChangeType(_changeType); <START> if (!isReady()) { return; } <END> subscribeForChanges(changeContext.getType(), _path, _watchChild); enqueueTask(changeContext); } } } catch (Exception e) { String msg = "exception in handling child-change. instance: " + _manager.getInstanceName() + ", parentPath: " + parentPath + ", listener: " + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }</code><technical_language>careful this changes subscribe current behavior, i,e, handle event all</technical_language>

Target:
public void handleChildChange(String parentPath, List<String> currentChilds) { if (logger.isDebugEnabled()) { logger.debug("Data change callback: child changed, path: , current child count: {}", parentPath, currentChilds == null ? 0 : currentChilds.size()); } try { updateNotificationTime(System.nanoTime()); if (parentPath != null && parentPath.startsWith(_path)) { if (currentChilds == null && parentPath.equals(_path)) { _manager.removeListener(_propertyKey, _listener); } else { if (!isReady()) { logger.info("Callbackhandler with path is in reset state. Stop subscription to ZK client to avoid leaking", this, parentPath); return; } NotificationContext changeContext = new NotificationContext(_manager); changeContext.setType(NotificationContext.Type.CALLBACK); changeContext.setPathChanged(parentPath); changeContext.setChangeType(_changeType); subscribeForChanges(changeContext.getType(), _path, _watchChild); enqueueTask(changeContext); } } } catch (Exception e) { String msg = "exception in handling child-change. instance: " + _manager.getInstanceName() + ", parentPath: " + parentPath + ", listener: " + _listener; ZKExceptionHandler.getInstance().handle(msg, e); } }
Source:
<code>private void getNotModifiedBlobAndVerify(String blobId) throws Exception { HttpHeaders headers = new DefaultHttpHeaders(); <START> SimpleDateFormat dateFormat = new SimpleDateFormat(RestUtils.HTTP_DATE_FORMAT, Locale.US); <END> Date date = new Date(System.currentTimeMillis()); String dateStr = dateFormat.format(date); headers.add(RestUtils.Headers.IF_MODIFIED_SINCE, dateStr); FullHttpRequest httpRequest = buildRequest(HttpMethod.GET, blobId, headers, null); Queue<HttpObject> responseParts = nettyClient.sendRequest(httpRequest, null, null).get(); HttpResponse response = (HttpResponse) responseParts.poll(); assertEquals("Unexpected response status", HttpResponseStatus.NOT_MODIFIED, response.getStatus()); assertTrue("No Date header", response.headers().get(RestUtils.Headers.DATE) != null); assertNull("No Last-Modified header expected", response.headers().get("Last-Modified")); assertNull(RestUtils.Headers.BLOB_SIZE + " should have been null ", response.headers().get(RestUtils.Headers.BLOB_SIZE)); assertNull("Content-Type should have been null", response.headers().get(RestUtils.Headers.CONTENT_TYPE)); assertNoContent(responseParts); }</code><technical_language>I netty provides APIs set date headers i.e. simply do headers.add(RestUtils.Headers.IF_MODIFIED_SINCE, new Date(System.currentTimeMillis())); this is required</technical_language>

Target:
private void getNotModifiedBlobAndVerify(String blobId) throws Exception { HttpHeaders headers = new DefaultHttpHeaders(); headers.add(RestUtils.Headers.IF_MODIFIED_SINCE, new Date()); FullHttpRequest httpRequest = buildRequest(HttpMethod.GET, blobId, headers, null); Queue<HttpObject> responseParts = nettyClient.sendRequest(httpRequest, null, null).get(); HttpResponse response = (HttpResponse) responseParts.poll(); assertEquals("Unexpected response status", HttpResponseStatus.NOT_MODIFIED, response.getStatus()); assertTrue("No Date header", response.headers().get(RestUtils.Headers.DATE) != null); assertNull("No Last-Modified header expected", response.headers().get("Last-Modified")); assertNull(RestUtils.Headers.BLOB_SIZE + " should have been null ", response.headers().get(RestUtils.Headers.BLOB_SIZE)); assertNull("Content-Type should have been null", response.headers().get(RestUtils.Headers.CONTENT_TYPE)); assertNoContent(responseParts); }
Source:
<code>public void shouldApiResponseRepresentationReturnApiResponseWithValidNameAndJsonFormat() throws Exception { ApiResponse apiResponse = usernamePasswordAuthenticationCredentials.getApiResponseRepresentation(); JSON jsonRepresentation = apiResponse.toJSON(); assertThat(apiResponse, notNullValue()); assertThat(apiResponse.getName(), equalToIgnoringCase("credentials")); assertThat(jsonRepresentation.toString(), containsString("myUsername")); assertThat(jsonRepresentation.toString(), containsString("myPassword")); <START> assertThat(jsonRepresentation.toString(), containsString("type")); <END> }</code><technical_language>Is worth assigning jsonRepresentation.toString() a String variable instead of converting 3 times</technical_language>

Target:
public void shouldApiResponseRepresentationReturnApiResponseWithValidNameAndJsonFormat() { ApiResponse apiResponse = usernamePasswordAuthenticationCredentials.getApiResponseRepresentation(); JSON jsonRepresentation = apiResponse.toJSON(); assertThat(apiResponse, notNullValue()); assertThat(apiResponse.getName(), equalToIgnoringCase("credentials")); assertThat(jsonRepresentation.toString(), allOf( containsString("username"), containsString(username), containsString("password"), containsString(password), containsString("type"), containsString("UsernamePasswordAuthenticationCredentials"))); }
Source:
<code>private void updateSync(SyncState sync, SyncState.Status status, int progress, SyncUpdateCallback callback) { try { sync.setStatus(status); if (progress != UNCHANGED) { sync.setProgress(progress); } switch (status) { case NEW: break; case RUNNING: runningSyncIds.add(sync.getId()); break; case DONE: case FAILED: int totalSize = sync.getTotalSize(); final JSONObject attributes = new JSONObject(); try { if (totalSize > 0) { attributes.put("numRecords", totalSize); } attributes.put("syncId", sync.getId()); attributes.put("syncTarget", sync.getTarget().getClass().getName()); if (sync.getEndTime() > 0 && sync.getStartTime() > 0) { <START> attributes.put("runTime", sync.getEndTime() - sync.getStartTime()); <END> } } catch (JSONException e) { SmartSyncLogger.e(TAG, "Exception thrown while building attributes", e); } EventBuilderHelper.createAndStoreEvent(sync.getType().name(), null, TAG, attributes); runningSyncIds.remove(sync.getId()); break; } sync.save(smartStore); } catch (JSONException e) { SmartSyncLogger.e(TAG, "Unexpected JSON error for sync: " + sync.getId(), e); } catch (SmartStoreException e) { SmartSyncLogger.e(TAG, "Unexpected smart store error for sync: " + sync.getId(), e); } finally { callback.onUpdate(sync); } }</code><technical_language>put this in attributes. attributes part of payload is for free-form JSON well-defined fields in schema for additional information. In this case, a duration field in schema is automatically extracted in Splunk, making easy up. library 2 fields - [startTime](<LINK_3> [endTime](<LINK_1> automatically compute duration put in payload [here](<LINK_2>, if endTime is available, endTime is optional field. For this case, I suggest tweak implementation of [this](<LINK_0> helper method extract startTime endTime attributes payload put in respective fields of event if exist. this line change put startTime endTime in attributes</technical_language>

Target:
private void updateSync(SyncState sync, SyncState.Status status, int progress, SyncUpdateCallback callback) { try { sync.setStatus(status); if (progress != UNCHANGED) { sync.setProgress(progress); } switch (status) { case NEW: break; case RUNNING: runningSyncIds.add(sync.getId()); break; case DONE: case FAILED: int totalSize = sync.getTotalSize(); final JSONObject attributes = new JSONObject(); try { if (totalSize > 0) { attributes.put("numRecords", totalSize); } attributes.put("syncId", sync.getId()); attributes.put("syncTarget", sync.getTarget().getClass().getName()); attributes.put(EventBuilderHelper.START_TIME, sync.getStartTime()); attributes.put(EventBuilderHelper.END_TIME, sync.getEndTime()); } catch (JSONException e) { SmartSyncLogger.e(TAG, "Exception thrown while building attributes", e); } EventBuilderHelper.createAndStoreEvent(sync.getType().name(), null, TAG, attributes); runningSyncIds.remove(sync.getId()); break; } sync.save(smartStore); } catch (JSONException e) { SmartSyncLogger.e(TAG, "Unexpected JSON error for sync: " + sync.getId(), e); } catch (SmartStoreException e) { SmartSyncLogger.e(TAG, "Unexpected smart store error for sync: " + sync.getId(), e); } finally { callback.onUpdate(sync); } }
Source:
<code>private void rebuildRules() { final InputStream inputStream; try { inputStream = newClassPathResource("drools/TaupageBuildRuleTemplate.drt") .getInputStream(); } catch (final IOException ex) { throw new ApplicationContextException("Couldn't find the rules template resource!", ex); } final List<RuleEntity> ruleEntities = ruleEntityRepository.findAll(); final RuleDataProvider ruleDataProvider = new RuleDataProvider(ruleEntities); final String droolsFile = new DataProviderCompiler().compile(ruleDataProvider, inputStream); LOG.info("Processed drools file: "); LOG.info(droolsFile); final KieFileSystem kieFileSystem = kieServices.newKieFileSystem(); <START> kieFileSystem.write("src/main/resources/drools/TestRule.drl", droolsFile); <END> kieServices.newKieBuilder(kieFileSystem).buildAll(); }</code><technical_language>plz remove Test name :smiley:</technical_language>

Target:
private void rebuildRules() { final InputStream inputStream; try { inputStream = newClassPathResource("drools/TaupageBuildRuleTemplate.drt") .getInputStream(); } catch (final IOException ex) { throw new ApplicationContextException("Couldn't find the rules template resource!", ex); } final List<RuleEntity> ruleEntities = ruleEntityRepository.findAll(); final RuleDataProvider ruleDataProvider = new RuleDataProvider(ruleEntities); final String droolsFile = new DataProviderCompiler().compile(ruleDataProvider, inputStream); final KieFileSystem kieFileSystem = kieServices.newKieFileSystem(); kieFileSystem.write("src/main/resources/drools/TaupageBuildRuleTemplate.drl", droolsFile); kieServices.newKieBuilder(kieFileSystem).buildAll(); }
Source:
<code><START> public List<EncounterTransaction.DrugOrder> getDrugOrders(Encounter encounter) { <END> final OrderType drugOrderType = orderService.getOrderTypeByName(EmrApiConstants.DRUG_ORDER_TYPE); final List<Order> drugOrders = orderService.getOrders(encounter.getPatient(), null, drugOrderType, false); List<EncounterTransaction.DrugOrder> orders = new ArrayList<EncounterTransaction.DrugOrder>(); for (Order drugOrder : drugOrders) { orders.add(drugOrderMapper.map((DrugOrder) drugOrder)); } return orders; }</code><technical_language>This get orders for patient. method signature(name parameter) suggest that. a patient patient uuid instead</technical_language>

Target:
public List<EncounterTransaction.DrugOrder> getDrugOrders(Encounter encounter) { OrderType drugOrderType = orderService.getOrderTypeByName(EmrApiConstants.DRUG_ORDER_TYPE); List<EncounterTransaction.DrugOrder> orders = new ArrayList<EncounterTransaction.DrugOrder>(); for (Order order : encounter.getOrders()) { if (drugOrderType.equals(order.getOrderType())) { orders.add(drugOrderMapper.map((DrugOrder) order)); } } return orders; }
Source:
<code>private void addNotification(EmailActionsData data, final AbstractWorkflowArtifact awa, OseeNotificationManager oseeNotificationManager) throws OseeCoreException { Collection<User> recipients = getRecipients(data.getEmailRecipient(), awa); Collection<User> activeEmailUsers = EmailUtil.getActiveEmailUsers(recipients); if (recipients.isEmpty()) { logf("No active " + data.getEmailRecipient() + " for workflow [%s].", awa.toStringWithId()); return; } List<String> emailAddresses = new ArrayList<String>(); for (User basicUser : activeEmailUsers) { if (EmailUtil.isEmailValid(basicUser.getEmail())) { emailAddresses.add(basicUser.getEmail()); } } if (emailAddresses.isEmpty()) { logf("No valid emails for workflow [%s].", awa.toStringWithId()); return; } if (!EmailUtil.isEmailValid(AtsClientService.get().getUserAdmin().getCurrentOseeUser())) { logf("Can't email from user account [%s] cause email not valid.", AtsClientService.get().getUserAdmin().getCurrentUser()); return; } oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(recipients, getIdString(awa), data.getEmailRecipient().name(), String.format( <START> "You are the " + data.getEmailRecipient().name() + " of [%s] in state [%s] titled [%s] created on [%s]", <END> awa.getArtifactTypeName(), awa.getStateMgr().getCurrentStateName(), awa.getName(), DateUtil.get(awa.getCreatedDate(), DateUtil.MMDDYYHHMM)))); }</code><technical_language>if String.format is need + operator... change another %s</technical_language>

Target:
private void addNotification(EmailActionsData data, final AbstractWorkflowArtifact awa, OseeNotificationManager oseeNotificationManager) throws OseeCoreException { Collection<User> recipients = getRecipients(data.getEmailRecipient(), awa); Collection<User> activeEmailUsers = EmailUtil.getActiveEmailUsers(recipients); if (recipients.isEmpty()) { logf("No active " + data.getEmailRecipient() + " for workflow [%s].", awa.toStringWithId()); return; } List<String> emailAddresses = new ArrayList<String>(); for (User basicUser : activeEmailUsers) { if (EmailUtil.isEmailValid(basicUser.getEmail())) { emailAddresses.add(basicUser.getEmail()); } } if (emailAddresses.isEmpty()) { logf("No valid emails for workflow [%s].", awa.toStringWithId()); return; } if (!EmailUtil.isEmailValid(AtsClientService.get().getUserAdmin().getCurrentOseeUser())) { logf("Can't email from user account [%s] cause email not valid.", AtsClientService.get().getUserAdmin().getCurrentUser()); return; } oseeNotificationManager.addNotificationEvent(new OseeNotificationEvent(recipients, getIdString(awa), data.getEmailRecipient().name(), String.format( "You are the %s of [%s] in state [%s] titled [%s] created on [%s]", data.getEmailRecipient().name(), awa.getArtifactTypeName(), awa.getStateMgr().getCurrentStateName(), awa.getName(), DateUtil.get(awa.getCreatedDate(), DateUtil.MMDDYYHHMM)))); }
Source:
<code>public void testFindWorkingVersionContentlet() throws Exception{ Structure testStructure = APILocator.getStructureAPI().findByVarName("webPageContent", user); Contentlet cont=new Contentlet(); cont.setStructureInode(testStructure.getInode()); cont.setStringProperty("title", "Testing Working"); cont.setStringProperty("body", "TESTING"); cont.setStringProperty("contentHost", host.getIdentifier()); cont.setReviewInterval( "1m" ); cont.setStructureInode( testStructure.getInode() ); cont.setHost( host.getIdentifier() ); <START> cont = APILocator.getContentletAPI().checkin(cont, user, false); <END> Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(cont.getIdentifier(), user, false); }</code><technical_language>code 173 181 replaced with: Contentlet contentlet = new ContentletDataGen(testStructure.getInode()).nextPersisted();</technical_language>

Target:
public void testFindWorkingVersionContentlet() throws Exception{ Structure structure = new StructureDataGen().nextPersisted(); Contentlet contentlet = new ContentletDataGen(structure.getInode()).nextPersisted(); Versionable verAPI = APILocator.getVersionableAPI().findWorkingVersion(contentlet.getIdentifier(), user, false); }
Source:
<code>public MethodOutcome updatePersonByName(@ResourceParam Person person, @IdParam IdDt theId, @ConditionalUrlParam String theConditional) { MethodOutcome methodOutcome = new MethodOutcome(); String name = null; if (theConditional != null) { int startIndex = theConditional.lastIndexOf('='); name = theConditional.substring(startIndex + 1); List<Person> personList = personResource.searchPersons(name, null, null); if (personList != null) { if (personList.size() == 0) { personResource.updateFHIRPerson(person, null); } else if (personList.size() == 1) { personResource.updateFHIRPerson(person, personList.get(0).getId().getIdPart()); } else { throw new PreconditionFailedException("There are more then one person for the given name"); } } } else { updatePersonConditional(person, theId); } <START> return new MethodOutcome(); <END> }</code><technical_language>successfully updates method outcome</technical_language>

Target:
public MethodOutcome updatePersonByName(@ResourceParam Person person, @IdParam IdDt theId, @ConditionalUrlParam String theConditional) { MethodOutcome methodOutcome = new MethodOutcome(); String name = null; if (theConditional != null) { int startIndex = theConditional.lastIndexOf('='); name = theConditional.substring(startIndex + 1); List<Person> personList = personResource.searchPersons(name, null, null); if (personList != null) { if (personList.size() == 0) { methodOutcome = updatePersonConditional(person, null); } else if (personList.size() == 1) { IdDt id = new IdDt(); id.setValue(personList.get(0).getId().getIdPart()); methodOutcome = updatePersonConditional(person, id); } else { throw new PreconditionFailedException("There are more than one person for the given name"); } } } else { methodOutcome = updatePersonConditional(person, theId); } return methodOutcome; }
Source:
<code><START> public static String generateFingerPrint(final Certificate cert) { <END> final char[] HEX = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; final StringBuilder buffer = new StringBuilder(60); try { final MessageDigest md = MessageDigest.getInstance("SHA-1"); final byte[] data = md.digest(cert.getEncoded()); for (final byte element : data) { if (buffer.length() > 0) { buffer.append(":"); } buffer.append(HEX[(0xF0 & element) >>> 4]); buffer.append(HEX[0x0F & element]); } } catch (final CertificateEncodingException e) { throw new CloudRuntimeException("Bad certificate encoding"); } catch (final NoSuchAlgorithmException e) { throw new CloudRuntimeException("Bad certificate algorithm"); } return buffer.toString(); }</code><technical_language>Please consider adding a Preconditions.checkArgumentcheck verify cert is null</technical_language>

Target:
public static String generateFingerPrint(final Certificate cert) { Preconditions.checkNotNull(cert, "Certificate cannot be null"); final char[] HEX = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; final StringBuilder buffer = new StringBuilder(60); try { final MessageDigest md = MessageDigest.getInstance("SHA-256"); final byte[] data = md.digest(cert.getEncoded()); for (final byte element : data) { if (buffer.length() > 0) { buffer.append(":"); } buffer.append(HEX[(0xF0 & element) >>> 4]); buffer.append(HEX[0x0F & element]); } } catch (final CertificateEncodingException e) { throw new IllegalStateException("Bad certificate encoding"); } catch (final NoSuchAlgorithmException e) { throw new IllegalStateException("Bad certificate algorithm"); } return buffer.toString(); }
Source:
<code>public void testTimestamp() throws InvalidParametersException, EntityAlreadyExistsException, EntityDoesNotExistException { ______TS("success : created"); FeedbackQuestionAttributes fq = getNewFeedbackQuestionAttributes(); fqDb.deleteEntity(fq); fqDb.createEntity(fq); verifyPresentInDatastore(fq); String feedbackSessionName = fq.feedbackSessionName; String courseId = fq.courseId; int questionNumber = fq.questionNumber; FeedbackQuestionAttributes feedbackQuestion = fqDb.getFeedbackQuestion(feedbackSessionName, courseId, questionNumber); AssertHelper.assertInstantIsNow(feedbackQuestion.getCreatedAt()); AssertHelper.assertInstantIsNow(feedbackQuestion.getUpdatedAt()); ______TS("success : update lastUpdated"); feedbackQuestion.questionNumber++; fqDb.updateFeedbackQuestion(feedbackQuestion); FeedbackQuestionAttributes updatedFq = fqDb.getFeedbackQuestion(feedbackSessionName, courseId, feedbackQuestion.questionNumber); assertFalse(feedbackQuestion.getUpdatedAt().equals(updatedFq.getUpdatedAt())); AssertHelper.assertInstantIsNow(updatedFq.getUpdatedAt()); <START> ______TS("success : keep lastUpdated"); <END> feedbackQuestion.questionNumber++; fqDb.updateFeedbackQuestion(feedbackQuestion); FeedbackQuestionAttributes updatedFqTwo = fqDb.getFeedbackQuestion(feedbackSessionName, courseId, feedbackQuestion.questionNumber); assertNotEquals(updatedFq.getUpdatedAt(), updatedFqTwo.getUpdatedAt()); }</code><technical_language>remove/or change description of test case</technical_language>

Target:
public void testTimestamp() throws InvalidParametersException, EntityAlreadyExistsException, EntityDoesNotExistException { ______TS("success : created"); FeedbackQuestionAttributes fq = getNewFeedbackQuestionAttributes(); fqDb.deleteEntity(fq); fqDb.createEntity(fq); verifyPresentInDatastore(fq); String feedbackSessionName = fq.feedbackSessionName; String courseId = fq.courseId; int questionNumber = fq.questionNumber; FeedbackQuestionAttributes feedbackQuestion = fqDb.getFeedbackQuestion(feedbackSessionName, courseId, questionNumber); AssertHelper.assertInstantIsNow(feedbackQuestion.getCreatedAt()); AssertHelper.assertInstantIsNow(feedbackQuestion.getUpdatedAt()); ______TS("success : update lastUpdated"); feedbackQuestion.questionNumber++; fqDb.updateFeedbackQuestion(feedbackQuestion); FeedbackQuestionAttributes updatedFq = fqDb.getFeedbackQuestion(feedbackSessionName, courseId, feedbackQuestion.questionNumber); assertFalse(feedbackQuestion.getUpdatedAt().equals(updatedFq.getUpdatedAt())); AssertHelper.assertInstantIsNow(updatedFq.getUpdatedAt()); }
Source:
<code>void writeLogsOnLocalAndRemote(List<StateLogComponents> servers, int startingLogSeq, int latestLogSequence) { <START> servers.stream().forEach(server -> writeLogsOnServer(server, startingLogSeq, latestLogSequence)); <END> }</code><technical_language>discussed - remove stream() suggestion servers.forEach(server -> writeLogsOnServer(server, startingLogSeq, latestLogSequence));</technical_language>

Target:
static void writeLogsOnLocalAndRemote(List<StateLogComponents> servers, int startingLogSeq, int latestLogSequence) { servers.forEach(server -> writeLogsOnServer(server, startingLogSeq, latestLogSequence)); }
Source:
<code>public Environment env() { Environment environment = new Environment( Collections.<String, List<Dispatcher>>singletonMap("foo", Collections.<Dispatcher>singletonList(new ThreadPoolExecutorDispatcher(100, 1))), new PropertiesConfigurationReader()); <START> return environment; <END> }</code><technical_language>simplified: java return new Environment().addDispatcher("foo", new ThreadPoolExecutorDispatcher(100, 1))); I reason of that, GatewayProxyFactoryBean produces Promise based defaultDispatcher, is reactor.dispatchers.default = threadPoolExecutor in properties file</technical_language>

Target:
public Environment env() { return new Environment(); }
Source:
<code>public void getStrategyQueriesKvsOnlyOnceForEachTable() { for (int i = 0; i < 5; i++) { partitioner.getStrategy(getWriteInfoWithFixedCellHash(NOTHING, i)); partitioner.getStrategy(getWriteInfoWithFixedCellHash(CONSERVATIVE, i)); } verify(mockKvs, times(1)).getMetadataForTable(NOTHING); verify(mockKvs, times(1)).getMetadataForTable(CONSERVATIVE); <START> verify(mockKvs, times(2)).getMetadataForTable(any()); <END> }</code><technical_language>cleaner verifyNoMoreInteractions(mockKvs);</technical_language>

Target:
public void getStrategyQueriesKvsOnlyOnceForEachTable() { for (int i = 0; i < 5; i++) { partitioner.getStrategy(getWriteInfoWithFixedCellHash(NOTHING, i)); partitioner.getStrategy(getWriteInfoWithFixedCellHash(CONSERVATIVE, i)); } verify(mockKvs, times(1)).getMetadataForTable(NOTHING); verify(mockKvs, times(1)).getMetadataForTable(CONSERVATIVE); verifyNoMoreInteractions(mockKvs); }
Source:
<code>public void onClick(View v) { if (context != null) { Intent intent = new Intent(context, SystemStatusResultsActivity.class); intent.putExtra(Constants.ROUTE_NAME, routeName); intent.putExtra(Constants.ROUTE_ID, routeId); intent.putExtra(Constants.TRANSIT_TYPE, transitType); intent.putExtra(statusType, Boolean.TRUE); <START> if (NextToArriveResultsActivity.class.equals(context.getClass())) { <END> AnalyticsManager.logContentViewEvent(TAG, AnalyticsManager.CONTENT_VIEW_EVENT_SYSTEM_STATUS_FROM_NTA, AnalyticsManager.CONTENT_ID_SYSTEM_STATUS, null); } else if (TransitViewResultsActivity.class.equals(context.getClass())) { AnalyticsManager.logContentViewEvent(TAG, AnalyticsManager.CONTENT_VIEW_EVENT_SYSTEM_STATUS_FROM_TRANSITVIEW, AnalyticsManager.CONTENT_ID_SYSTEM_STATUS, null); } else if (MainActivity.class.equals(context.getClass())) { AnalyticsManager.logContentViewEvent(TAG, AnalyticsManager.CONTENT_VIEW_EVENT_SYSTEM_STATUS_FROM_FAVORITES, AnalyticsManager.CONTENT_ID_SYSTEM_STATUS, null); } else { Log.e(TAG, String.format("Could not track event analytics for target class: %s", context.getClass())); } context.startActivity(intent); } }</code><technical_language>Comparing classes safe. I create a constructor a String a parameter. This string pass 2nd argument of method: logContentViewEvent</technical_language>

Target:
public void onClick(View v) { if (context != null) { Intent intent = new Intent(context, SystemStatusResultsActivity.class); intent.putExtra(Constants.ROUTE_NAME, routeName); intent.putExtra(Constants.ROUTE_ID, routeId); intent.putExtra(Constants.TRANSIT_TYPE, transitType); intent.putExtra(statusType, Boolean.TRUE); if (ActivityClass.NEXT_TO_ARRIVE.equals(origin)) { AnalyticsManager.logContentViewEvent(TAG, AnalyticsManager.CONTENT_VIEW_EVENT_SYSTEM_STATUS_FROM_NTA, AnalyticsManager.CONTENT_ID_SYSTEM_STATUS, null); } else if (ActivityClass.TRANSITVIEW.equals(origin)) { AnalyticsManager.logContentViewEvent(TAG, AnalyticsManager.CONTENT_VIEW_EVENT_SYSTEM_STATUS_FROM_TRANSITVIEW, AnalyticsManager.CONTENT_ID_SYSTEM_STATUS, null); } else if (ActivityClass.MAIN.equals(origin)) { AnalyticsManager.logContentViewEvent(TAG, AnalyticsManager.CONTENT_VIEW_EVENT_SYSTEM_STATUS_FROM_FAVORITES, AnalyticsManager.CONTENT_ID_SYSTEM_STATUS, null); } else { Log.e(TAG, String.format("Could not track event analytics for target class: %s", origin)); } context.startActivity(intent); } }
Source:
<code>public void selectCategory(int categoryId) { <START> wait.forElementVisible(wikiCategoryDropdown); <END> wikiCategoryDropdown.click(); WebElement selectedCategory = wikiCategoryList.findElement(By.id(String.valueOf(categoryId))); wait.forElementClickable(selectedCategory); String selectedCategoryText = selectedCategory.getText(); selectedCategory.click(); PageObjectLogging.log("selectCategory", "selected " + selectedCategoryText + " category", true, driver); }</code><technical_language>clickable</technical_language>

Target:
public void selectCategory(int categoryId) { wait.forElementClickable(wikiCategoryDropdown); wikiCategoryDropdown.click(); WebElement selectedCategory = wikiCategoryList.findElement(By.id(String.valueOf(categoryId))); wait.forElementClickable(selectedCategory); String selectedCategoryText = selectedCategory.getText(); selectedCategory.click(); PageObjectLogging.log("selectCategory", "selected " + selectedCategoryText + " category", true, driver); }
Source:
<code>public static void applyHyperlinkDetectorStyleRanges( ITextViewer textViewer, IHyperlinkDetector[] hyperlinkDetectors) { StyleRange[] styleRanges = getHyperlinkDetectorStyleRanges(textViewer, hyperlinkDetectors); StyledText styledText = textViewer.getTextWidget(); <START> for (StyleRange styleRange : styleRanges) { <END> styledText.setStyleRange(styleRange); } }</code><technical_language>style nit: braces</technical_language>

Target:
public static void applyHyperlinkDetectorStyleRanges( ITextViewer textViewer, IHyperlinkDetector[] hyperlinkDetectors) { StyleRange[] styleRanges = getHyperlinkDetectorStyleRanges(textViewer, hyperlinkDetectors); StyledText styledText = textViewer.getTextWidget(); for (StyleRange styleRange : styleRanges) styledText.setStyleRange(styleRange); }
Source:
<code>private void parseEventList(final EList<Event> eventList, final String eventListName, boolean isInput) throws TypeImportException, XMLStreamException { final String eventName = getEventElement(); processChildren(eventListName, name -> { if <START> (name.equals(eventName)) <END> { Event e = parseEvent(eventName); e.setIsInput(isInput); if (isInput) { inputEvents.put(e.getName(), e); } else { outputEvents.put(e.getName(), e); } eventList.add(e); return true; } return false; }); }</code><technical_language>if check eventName againt null lambda, switch equals circumvent NPEs</technical_language>

Target:
private void parseEventList(final EList<Event> eventList, final String eventListName, boolean isInput) throws TypeImportException, XMLStreamException { final String eventName = getEventElement(); processChildren(eventListName, name -> { if (eventName.equals(name)) { Event e = parseEvent(eventName); e.setIsInput(isInput); if (isInput) { inputEvents.put(e.getName(), e); } else { outputEvents.put(e.getName(), e); } eventList.add(e); return true; } return false; }); }
Source:
<code>public static Document getDocument(File file) throws IOException, ParseException { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); String path; try { path = env.getPathRelativeToSourceRoot(file); } catch (ForbiddenSymlinkException e) { LOGGER.log(Level.FINER, e.getMessage()); return null; } path = path.replace("\\", "/"); IndexReader ireader = getIndexReader(path); if (ireader == null) { return null; } <START> Document doc; <END> try { Query q = new QueryBuilder().setPath(path).build(); IndexSearcher searcher = new IndexSearcher(ireader); TopDocs top = searcher.search(q, 1); if (top.totalHits.value == 0) { return null; } doc = searcher.doc(top.scoreDocs[0].doc); String foundPath = doc.get(QueryBuilder.PATH); if (!path.equals(foundPath)) { return null; } } finally { ireader.close(); } return doc; }</code><technical_language>move return statement of try, this declaration assignment moved together</technical_language>

Target:
public static Document getDocument(File file) throws IOException, ParseException { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); String path; try { path = env.getPathRelativeToSourceRoot(file); } catch (ForbiddenSymlinkException e) { LOGGER.log(Level.FINER, e.getMessage()); return null; } path = path.replace("\\", "/"); IndexReader ireader = getIndexReader(path); if (ireader == null) { return null; } try { Document doc; Query q = new QueryBuilder().setPath(path).build(); IndexSearcher searcher = new IndexSearcher(ireader); TopDocs top = searcher.search(q, 1); if (top.totalHits.value == 0) { return null; } doc = searcher.doc(top.scoreDocs[0].doc); String foundPath = doc.get(QueryBuilder.PATH); if (!path.equals(foundPath)) { return null; } return doc; } finally { ireader.close(); } }
Source:
<code>private void notifyAboutPendingChangesIfNotInTransaction() { final Set<Changes> changesSet; if (numberOfRunningTransactions.get() == 0) { synchronized (lock) { changesSet = pendingChanges; pendingChanges = new HashSet<Changes>(5); } } else { changesSet = null; } if (changesSet != null && changesSet.size() > 0) { final Changes changesToSend; <START> if (changesSet.size() > 1) { <END> final Set<String> affectedTables = new HashSet<String>(); for (Changes change : changesSet) { affectedTables.addAll(change.affectedTables()); } changesToSend = Changes.newInstance(affectedTables); } else { changesToSend = changesSet.iterator().next(); } changesBus.onNext(changesToSend); } }</code><technical_language>remove this? overcomplicates code</technical_language>

Target:
private void notifyAboutPendingChangesIfNotInTransaction() { final Set<Changes> changesToSend; if (numberOfRunningTransactions.get() == 0) { synchronized (lock) { changesToSend = pendingChanges; pendingChanges = new HashSet<Changes>(5); } } else { changesToSend = null; } if (changesToSend != null && changesToSend.size() > 0) { final Set<String> affectedTables = new HashSet<String>(3); for (Changes changes : changesToSend) { affectedTables.addAll(changes.affectedTables()); } changesBus.onNext(Changes.newInstance(affectedTables)); } }
Source:
<code>public Action0 clearCompletedTasks() { return new Action0() { @Override public void call() { Event<Tasks> tasksEvent = taskRelay.getValue(); Tasks value = tasksEvent.data().or(Tasks.empty()); <START> Tasks uncompletedTasks = Tasks.from(ImmutableList.copyOf(Iterables.transform(value.all(), markCompletedAsDeleted()))); <END> remoteDataSource.clearCompletedTasks() .map(asSyncedTasksNow()) .onErrorReturn(markAllAsSyncError(value)) .startWith(uncompletedTasks) .flatMap(persistTasks()) .compose(asValidatedEvent(tasksEvent.updateData(uncompletedTasks))) .subscribe(taskRelay); } }; }</code><technical_language>Tasks.from(ImmutableList.copyOf(... is in this PR only, worth extracting a new method copies input list reduce nested calls</technical_language>

Target:
public Action0 clearCompletedTasks() { return new Action0() { @Override public void call() { long actionTimestamp = clock.timeInMillis(); Event<Tasks> tasksEvent = taskRelay.getValue(); Tasks tasksFromEvent = tasksEvent.data().or(Tasks.empty()); Tasks uncompletedTasks = mapFunctionToTasks(tasksFromEvent, markCompletedAsDeleted()); remoteDataSource.clearCompletedTasks() .compose(clearLocallyThenConfirmOrRevert(tasksFromEvent, uncompletedTasks, actionTimestamp)) .flatMap(persistTasks()) .compose(asValidatedEvent(tasksEvent.updateData(uncompletedTasks))) .subscribe(taskRelay); } }; }
Source:
<code>public String getName() { <START> return NonNullUtils.checkNotNull(fModule.name()); <END> }</code><technical_language>bleep</technical_language>

Target:
public String getName() { return checkNotNull(fModule.name()); }
Source:
<code>public synchronized void close() { if (closed) { return; } closed = true; if (parentMemoryContext != null) { parentMemoryContext.updateBytes(-usedBytes); } long oldLocalUsedBytes = this.usedBytes; usedBytes = 0; if (notificationListener != null) { <START> notificationListener.memoryUsageUpdated(oldLocalUsedBytes, usedBytes); <END> } }</code><technical_language>this.usedBytes usedBytes, do consistently in a method</technical_language>

Target:
public synchronized void close() { if (closed) { return; } closed = true; if (parentMemoryContext != null) { parentMemoryContext.updateBytes(-usedBytes); usedBytes = 0; return; } if (reservationHandler != null) { reservationHandler.reserveMemory(-usedBytes); } usedBytes = 0; }
Source:
<code>private void updatePlayer(PlayerWrapper entry, long oldAddress, long newAddress) { TLongSet cubesToRemove = new TLongHashSet(); TLongSet cubesToLoad = new TLongHashSet(); TLongSet columnsToRemove = new TLongHashSet(); TLongSet columnsToLoad = new TLongHashSet(); <START> this.cubeSelector.findChanged(oldAddress, newAddress, horizontalViewDistance, cubesToRemove, cubesToLoad, columnsToRemove, columnsToLoad); <END> columnsToLoad.forEach(address -> { this.getOrCreateColumnWatcher(address).addPlayer(entry.playerEntity); return true; }); cubesToLoad.forEach(address -> { this.getOrCreateCubeWatcher(address).addPlayer(entry.playerEntity); return true; }); cubesToRemove.forEach(address -> { PlayerCubeMapEntry cubeWatcher = this.getCubeWatcher(address); if (cubeWatcher != null) { cubeWatcher.removePlayer(entry.playerEntity); } return true; }); columnsToRemove.forEach(address -> { PlayerCubeMapColumnEntry playerCubeMapColumnEntry = this.getColumnWatcher(cubeToColumn(address)); if (playerCubeMapColumnEntry != null) { playerCubeMapColumnEntry.removePlayer(entry.playerEntity); } return true; }); }</code><technical_language>is vertical view distance</technical_language>

Target:
private void updatePlayer(PlayerWrapper entry, long oldAddress, long newAddress) { TLongSet cubesToRemove = new TLongHashSet(); TLongSet cubesToLoad = new TLongHashSet(); TLongSet columnsToRemove = new TLongHashSet(); TLongSet columnsToLoad = new TLongHashSet(); this.cubeSelector.findChanged(oldAddress, newAddress, horizontalViewDistance, verticalViewDistance, cubesToRemove, cubesToLoad, columnsToRemove, columnsToLoad); columnsToLoad.forEach(address -> { this.getOrCreateColumnWatcher(address).addPlayer(entry.playerEntity); return true; }); cubesToLoad.forEach(address -> { this.getOrCreateCubeWatcher(address).addPlayer(entry.playerEntity); return true; }); cubesToRemove.forEach(address -> { PlayerCubeMapEntry cubeWatcher = this.getCubeWatcher(address); if (cubeWatcher != null) { cubeWatcher.removePlayer(entry.playerEntity); } return true; }); columnsToRemove.forEach(address -> { PlayerCubeMapColumnEntry playerCubeMapColumnEntry = this.getColumnWatcher(cubeToColumn(address)); if (playerCubeMapColumnEntry != null) { playerCubeMapColumnEntry.removePlayer(entry.playerEntity); } return true; }); }
Source:
<code>public synchronized void removeMiniThumbDataFile() { String path = randomAccessFilePath(MINI_THUMB_DATA_FILE_VERSION); File file = new File(path); <START> if (file.exists()) { <END> try { file.delete(); } catch (SecurityException ex) { } } }</code><technical_language>file.exists() throw SecurityException, too. check in place? file.delete() fail gracefully anyway</technical_language>

Target:
public synchronized void removeMiniThumbDataFile() { String path = randomAccessFilePath(MINI_THUMB_DATA_FILE_VERSION); File file = new File(path); try { file.delete(); } catch (SecurityException ex) { } }
Source:
<code>public IndexWriters(Configuration conf) { ObjectCache objectCache = ObjectCache.get(conf); synchronized (objectCache) { this.indexWriters = (HashMap<String, IndexWriterWrapper>) objectCache .getObject(IndexWriterWrapper.class.getName()); if (this.indexWriters == null) { try { ExtensionPoint point = PluginRepository.get(conf).getExtensionPoint( IndexWriter.X_POINT_ID); if (point == null) { throw new RuntimeException(IndexWriter.X_POINT_ID + " not found."); } Extension[] extensions = point.getExtensions(); HashMap<String, Extension> extensionMap = new HashMap<>(); for (Extension extension : extensions) { <START> LOG.info("Index writer " + extension.getClazz() + " identified."); <END> extensionMap.putIfAbsent(extension.getClazz(), extension); } IndexWriterConfig[] indexWriterConfigs = loadWritersConfiguration(conf); HashMap<String, IndexWriterWrapper> indexWriters = new HashMap<>(); for (IndexWriterConfig indexWriterConfig : indexWriterConfigs) { final String clazz = indexWriterConfig.getClazz(); if (extensionMap.containsKey(clazz)) { IndexWriterWrapper writerWrapper = new IndexWriterWrapper(); writerWrapper.setIndexWriterConfig(indexWriterConfig); writerWrapper.setIndexWriter((IndexWriter) extensionMap.get(clazz).getExtensionInstance()); indexWriters.put(indexWriterConfig.getId(), writerWrapper); } } objectCache.setObject(IndexWriterWrapper.class.getName(), indexWriters); } catch (PluginRuntimeException e) { throw new RuntimeException(e); } this.indexWriters = (HashMap<String, IndexWriterWrapper>) objectCache .getObject(IndexWriterWrapper.class.getName()); } } }</code><technical_language>Please parameterized logging</technical_language>

Target:
private IndexWriters(Configuration conf) { if (this.indexWriters == null) { try { ExtensionPoint point = PluginRepository.get(conf) .getExtensionPoint(IndexWriter.X_POINT_ID); if (point == null) { throw new RuntimeException(IndexWriter.X_POINT_ID + " not found."); } Extension[] extensions = point.getExtensions(); HashMap<String, Extension> extensionMap = new HashMap<>(); for (Extension extension : extensions) { LOG.info("Index writer identified.", extension.getClazz()); extensionMap.putIfAbsent(extension.getClazz(), extension); } IndexWriterConfig[] indexWriterConfigs = loadWritersConfiguration( conf); this.indexWriters = new HashMap<>(); for (IndexWriterConfig indexWriterConfig : indexWriterConfigs) { final String clazz = indexWriterConfig.getClazz(); if (extensionMap.containsKey(clazz)) { IndexWriterWrapper writerWrapper = new IndexWriterWrapper(); writerWrapper.setIndexWriterConfig(indexWriterConfig); writerWrapper.setIndexWriter( (IndexWriter) extensionMap.get(clazz).getExtensionInstance()); indexWriters.put(indexWriterConfig.getId(), writerWrapper); } } } catch (PluginRuntimeException e) { throw new RuntimeException(e); } } }