auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void retryGetMediaError() throws Exception { fakeService.setGetMediaException( Status.fromCode(Status.Code.INTERNAL) .withDescription("Custom error message.") .asException()); GoogleCloudStorageGrpcReadChannel readChannel = newReadChannel(); ByteBuffer buffer = ByteBuffer.allocate(10); IOException thrown = assertThrows(IOException.class, () -> readChannel.read(buffer)); <START> assertThat(thrown.getCause()).hasMessageThat().contains("Retrying failed to complete"); <END> }</code><technical_language>hasCauseThat() (or similar method): java assertThat(thrown).hasCauseThat().hasMessageThat().contains("Retrying failed complete")</technical_language>

Target:
public void retryGetMediaError() throws Exception { fakeService.setGetMediaException( Status.fromCode(Status.Code.INTERNAL) .withDescription("Custom error message.") .asException()); GoogleCloudStorageGrpcReadChannel readChannel = newReadChannel(); ByteBuffer buffer = ByteBuffer.allocate(10); IOException thrown = assertThrows(IOException.class, () -> readChannel.read(buffer)); assertThat(thrown).hasCauseThat().hasMessageThat().contains("Retrying failed to complete"); }
Source:
<code>public TextAnnotation next() { ArrayList<String> lines; try { lines = LineIO.read(currentfile); } catch (FileNotFoundException e1) { error = e1; e1.printStackTrace(); return null; } try { TextAnnotation ta = parseLines(lines); return ta; } catch (AnnotatorException e) { error = e; <START> System.err.println("Skipping "+this.currentfile+", message : "+e.getLocalizedMessage()); <END> return null; } }</code><technical_language>is a generateReport() method somewhere, overriding abstract method in AnnotationReader class. Please generate a list count of files add report generated in this method</technical_language>

Target:
public TextAnnotation next() { ArrayList<String> lines; try { lines = LineIO.read(currentfile); } catch (FileNotFoundException e1) { error = e1; e1.printStackTrace(); return null; } try { TextAnnotation ta = parseLines(lines); return ta; } catch (AnnotatorException e) { error = e; this.badFiles.add(this.currentfile); return null; } }
Source:
<code>public boolean hasNoGroupBy(){ <START> if (groupByList == null) <END> return true; if (groupByList.size() != 1 || !(groupByList.elementAt(0) instanceof GroupByColumn)) return false; GroupByColumn groupByColumn = (GroupByColumn)groupByList.elementAt(0); if ( !(groupByColumn.getColumnExpression() instanceof NumericConstantNode)) return false; return true; }</code><technical_language>is "if (gorupByList == null || groupByList.isEmpty())"</technical_language>

Target:
public boolean hasNoGroupBy(){ if (groupByList == null || groupByList.isEmpty()) return true; if (groupByList.size() != 1 || !(groupByList.elementAt(0) instanceof GroupByColumn)) return false; GroupByColumn groupByColumn = (GroupByColumn)groupByList.elementAt(0); if ( !(groupByColumn.getColumnExpression() instanceof NumericConstantNode)) return false; return true; }
Source:
<code>protected void insertIntoEntryTable(List<BibEntry> entries) { try { StringBuilder insertEntryQuery = new StringBuilder() .append("INSERT ALL"); for (BibEntry entry : entries) { insertEntryQuery.append(" INTO ") .append(escape("ENTRY")) .append(" (") .append(escape("TYPE")) .append(") VALUES (?)"); } insertEntryQuery.append(" SELECT * FROM DUAL"); LOGGER.info(insertEntryQuery.toString()); try (PreparedStatement preparedEntryStatement = connection.prepareStatement(insertEntryQuery.toString(), <START> new String[]{"SHARED_ID"})) { <END> for (int i = 0; i < entries.size(); i++) { preparedEntryStatement.setString(i + 1, entries.get(i).getType().getName()); } preparedEntryStatement.executeUpdate(); try (ResultSet generatedKeys = preparedEntryStatement.getGeneratedKeys()) { for (BibEntry entry : entries) { generatedKeys.next(); entry.getSharedBibEntryData().setSharedID(generatedKeys.getInt(1)); } if (generatedKeys.next()) { LOGGER.error("Error: Some shared IDs left unassigned"); } } } } catch (SQLException e) { LOGGER.error("SQL Error: ", e); } }</code><technical_language>I sure, this odd String[]</technical_language>

Target:
protected void insertIntoEntryTable(List<BibEntry> entries) { try { for (BibEntry entry : entries) { String insertIntoEntryQuery = "INSERT INTO " + escape("ENTRY") + "(" + escape("TYPE") + ") VALUES(?)"; try (PreparedStatement preparedEntryStatement = connection.prepareStatement(insertIntoEntryQuery, new String[]{"SHARED_ID"})) { preparedEntryStatement.setString(1, entry.getType().getName()); preparedEntryStatement.executeUpdate(); try (ResultSet generatedKeys = preparedEntryStatement.getGeneratedKeys()) { if (generatedKeys.next()) { entry.getSharedBibEntryData().setSharedID(generatedKeys.getInt(1)); } } } } } catch (SQLException e) { LOGGER.error("SQL Error: ", e); } }
Source:
<code><START> public void testQueryType() { <END> Assert.assertTrue(query.getVdcQueryType() != VdcQueryType.Unknown); }</code><technical_language>Consider user assertNotSame - more readable. Aslo, static import method Assert</technical_language>

Target:
public void testQueryType() throws IllegalArgumentException, IllegalAccessException { assertNotSame(VdcQueryType.Unknown, TestHelperQueriesCommandType.getQueryTypeFieldValue(query)); }
Source:
<code>private void fetchVmsStatus(Guid storageDomainId, List<StorageOvfExtraData> storageExtraData, Map<String, Object> diskDescriptionMap) { Map<String, String> vmsStatus = (Map<String, String>) diskDescriptionMap.get(OvfInfoFileConstants.VmStatus); if (vmsStatus == null) { log.error("VMs status could not be fetched from metadata json file for storage id '{}'.", storageDomainId); } else { <START> Iterator vmsStatusIter = vmsStatus.keySet().iterator(); <END> while (vmsStatusIter.hasNext()) { String vmId = (String) vmsStatusIter.next(); log.debug("VM '{}' fetched from metadata json file with status '{}' for storage domain id '{}.", vmId, vmsStatus.get(vmId), storageDomainId); storageExtraData.add(new StorageOvfExtraData(storageDomainId, VdcObjectType.VM, storageDomainId, vmsStatus.get(vmId))); } } }</code><technical_language>a stream here? Map#forEach</technical_language>

Target:
private void fetchVmsStatus(Guid storageDomainId, List<StorageOvfExtraData> storageExtraData, Map<String, Object> diskDescriptionMap) { Map<String, String> vmsStatus = (Map<String, String>) diskDescriptionMap.get(OvfInfoFileConstants.VmStatus); if (vmsStatus == null) { log.error("VMs status could not be fetched from metadata json file for storage id '{}'.", storageDomainId); } else { for (Map.Entry<String, String> entry : vmsStatus.entrySet()) { log.debug("VM '{}' fetched from metadata json file with status '{}' for storage domain id '{}.", entry.getKey(), entry.getValue(), storageDomainId); storageExtraData.add(new StorageOvfExtraData(storageDomainId, VdcObjectType.VM, storageDomainId, vmsStatus.get(entry.getKey()))); } } }
Source:
<code>public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"apple", "appleay"}, {"ear", "earay"}, {"igloo", "iglooay"}, {"object", "objectay"}, {"under", "underay"}, {"equal", "equalay"}, {"pig", "igpay"}, {"koala", "oalakay"}, {"xenon", "enonxay"}, {"qat", "atqay"}, {"chair", "airchay"}, {"queen", "eenquay"}, {"square", "aresquay"}, {"therapy", "erapythay"}, {"thrush", "ushthray"}, {"school", "oolschay"}, {"yttria", "yttriaay"}, {"xray", "xrayay"}, {"yellow", "ellowyay"}, <START> {"rhythm", "hythmray"}, <END> {"my", "ymay"}, {"quick fast run", "ickquay astfay unray"} }); }</code><technical_language>This map "ythmrhay". If build pass do need update reference solution maps correctly. sense</technical_language>

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"apple", "appleay"}, {"ear", "earay"}, {"igloo", "iglooay"}, {"object", "objectay"}, {"under", "underay"}, {"equal", "equalay"}, {"pig", "igpay"}, {"koala", "oalakay"}, {"xenon", "enonxay"}, {"qat", "atqay"}, {"chair", "airchay"}, {"queen", "eenquay"}, {"square", "aresquay"}, {"therapy", "erapythay"}, {"thrush", "ushthray"}, {"school", "oolschay"}, {"yttria", "yttriaay"}, {"xray", "xrayay"}, {"yellow", "ellowyay"}, {"rhythm", "ythmrhay"}, {"my", "ymay"}, {"quick fast run", "ickquay astfay unray"} }); }
Source:
<code>private boolean parseTimeRange() { <START> try { <END> long startTimeValue = TIMESTAMP_FORMAT.parseValue(fStartTimeRangeText.getText()); long endTimeValue = TIMESTAMP_FORMAT.parseValue(fEndTimeRangeText.getText()); fStartTimestamp = TmfTimestamp.fromNanos(startTimeValue); fEndTimestamp = TmfTimestamp.fromNanos(endTimeValue); return true; } catch (ParseException e) { return false; } }</code><technical_language>need add line timezone: TIMESTAMP_FORMAT.setTimeZone(TmfTimestampFormat.getDefaulTimeFormat().getTimeZone()); In Windows a difference for text logs</technical_language>

Target:
private boolean parseTimeRange() { try { TIMESTAMP_FORMAT.setTimeZone(TmfTimestampFormat.getDefaulTimeFormat().getTimeZone()); long startTimeValue = TIMESTAMP_FORMAT.parseValue(fStartTimeRangeText.getText()); long endTimeValue = TIMESTAMP_FORMAT.parseValue(fEndTimeRangeText.getText()); if(startTimeValue < endTimeValue) { fStartTimestamp = TmfTimestamp.fromNanos(startTimeValue); fEndTimestamp = TmfTimestamp.fromNanos(endTimeValue); } else { fStartTimestamp = TmfTimestamp.fromNanos(endTimeValue); fEndTimestamp = TmfTimestamp.fromNanos(startTimeValue); } return true; } catch (ParseException e) { return false; } }
Source:
<code>NotesMigration(@GerritServerConfig Config cfg) { write = cfg.getBoolean("notedb", null, "write", false); readPatchSetApprovals = <START> cfg.getBoolean("notedb", "patchSetApprovals", "read", false); <END> }</code><technical_language>I check this for misconfiguration fail loud and/or override it, e. g.: if (!write) { if (readFoo || readBar || readBaz || ...) { log.error("notedb.write enabled of readFoo enabled"); write = true; } }</technical_language>

Target:
NotesMigration(@GerritServerConfig Config cfg) { write = cfg.getBoolean("notedb", null, "write", false); readPatchSetApprovals = cfg.getBoolean("notedb", "patchSetApprovals", "read", false); checkArgument(!readPatchSetApprovals, "notedb.readPatchSetApprovals not yet supported"); }
Source:
<code>public ParquetMetadataConverter() { <START> this.useSignedStringMinMax = false; <END> }</code><technical_language>a default here</technical_language>

Target:
public ParquetMetadataConverter() { this(false); }
Source:
<code>public ContinueUrlBuilder appendForceSameDeviceBit(@NonNull boolean forceSameDevice) { String bit = forceSameDevice ? "1" : "0"; <START> addQueryParam(FORCE_SAME_DEVICE_IDENTIFIER, String.valueOf(bit)); <END> return this; }</code><technical_language>nit: String.valueOf a string..</technical_language>

Target:
public ContinueUrlBuilder appendForceSameDeviceBit(@NonNull boolean forceSameDevice) { String bit = forceSameDevice ? "1" : "0"; addQueryParam(FORCE_SAME_DEVICE_IDENTIFIER, bit); return this; }
Source:
<code>private void populateRibbonViews(final View view) { setText(view, R.id.ribbon_title, AwardStringMap.get(award.getRibbon().getRibbonAward().getUniqueName())); <START> setAlpha(view, R.id.award_ribbon_container, award.getRibbon().isTaken() ? 1f : 0.5f); <END> setImage(view, R.id.award_ribbon, RibbonImagesMap.get(award.getRibbonCode())); setText(view, R.id.ribbon_requirement, AwardStringMap.get(award.getRibbon().getRibbonAward().getDescriptionId())); setText(view, R.id.ribbons_count, String.format("x%d", award.getRibbon().getTimesTaken())); }</code><technical_language>This adjusting alpha image, for medals - currently card is a bit opaque. :-)</technical_language>

Target:
private void populateRibbonViews(final View view) { setText(view, R.id.ribbon_title, AwardStringMap.get(award.getRibbon().getRibbonAward().getUniqueName())); setImage(view, R.id.award_ribbon, RibbonImagesMap.get(award.getRibbonCode())); setAlpha(view, R.id.award_ribbon, award.getRibbon().isTaken() ? 1f : 0.5f); setText(view, R.id.ribbon_requirement, AwardStringMap.get(award.getRibbon().getRibbonAward().getDescriptionId())); setText(view, R.id.ribbons_count, String.format("x%d", award.getRibbon().getTimesTaken())); }
Source:
<code><START> public void setI18n(Map<String, String> i18n) { <END> this.i18n = i18n; }</code><technical_language>Do need this setter next getter? provides internal access data. If is for testing package private annotate @VisbleForTesting remove those</technical_language>

Target:
void setI18n(Map<String, String> i18n) { this.i18n = i18n; }
Source:
<code>public void getStyledTextForADeploymentConfigWithLongNames(){ IDeploymentConfig config = givenAResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG); <START> Map<String, String> selector = new HashMap<String, String>(); <END> selector.put("name", "foo01234567890123456789012345678901234567890123456789"); selector.put("deployment", "bar01234567890123456789012345678901234567890123456789"); when(config.getReplicaSelector()).thenReturn(selector ); assertEquals(config.getName() + " selector: deployment=bar01234567890123456789012345678901234567890123456789,name=foo01234567890123456789012345678...", provider.getStyledText(config).getString()); }</code><technical_language>new HashMap<>(2)</technical_language>

Target:
public void getStyledTextForADeploymentConfigWithLongNames(){ provider.setLabelLimit(120); IDeploymentConfig config = givenAResource(IDeploymentConfig.class, ResourceKind.DEPLOYMENT_CONFIG); Map<String, String> selector = new HashMap<>(); selector.put("name", "foo01234567890123456789012345678901234567890123456789"); selector.put("deployment", "bar01234567890123456789012345678901234567890123456789"); when(config.getReplicaSelector()).thenReturn(selector ); assertEquals("someName selector: deployment=bar0123456789012345678901234567890...=foo01234567890123456789012345678901234567890123456789", provider.getStyledText(config).getString()); }
Source:
<code>public void testSourceStatusWithNonConfiguredService()throws Exception{ <START> Source NonConfiguredServiceSource = mock(Source.class); <END> when(helper.getSources()).thenReturn(CollectionUtils.asList(NonConfiguredServiceSource)); assertThat(poller.sourceStatus(CONFIG_PID), is(false)); }</code><technical_language>nonConfiguredServiceSource</technical_language>

Target:
public void testSourceStatusWithNonConfiguredService() throws Exception { Source nonConfiguredServiceSource = mock(Source.class); when(helper.getSources()).thenReturn(CollectionUtils.asList(nonConfiguredServiceSource)); assertThat(poller.sourceStatus(CONFIG_PID), is(0)); }
Source:
<code>public Response labelsPost(LabelDTO body) { Label label = null; try { APIAdmin apiAdmin = new APIAdminImpl(); String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); label = LabelMappingUtil.labelDTOToLabel(body); LabelDTO labelDTO = LabelMappingUtil. fromLabelToLabelDTO(apiAdmin.addLabel(tenantDomain, label)); URI location = new URI(RestApiConstants.RESOURCE_PATH_LABEL + "/" + labelDTO.getId()); return Response.created(location).entity(labelDTO).build(); } catch (APIManagementException | URISyntaxException e) { <START> String errorMessage = "Error while adding new Label for API : " <END> + body.getName() + "-" + e.getMessage() ; RestApiUtil.handleInternalServerError(errorMessage, log); } return null; }</code><technical_language>suggestion String errorMessage = "Error while adding new label API : "</technical_language>

Target:
public Response labelsPost(LabelDTO body) { Label label = null; try { APIAdmin apiAdmin = new APIAdminImpl(); String tenantDomain = RestApiUtil.getLoggedInUserTenantDomain(); label = LabelMappingUtil.labelDTOToLabel(body); LabelDTO labelDTO = LabelMappingUtil. fromLabelToLabelDTO(apiAdmin.addLabel(tenantDomain, label)); URI location = new URI(RestApiConstants.RESOURCE_PATH_LABEL + "/" + labelDTO.getId()); return Response.created(location).entity(labelDTO).build(); } catch (APIManagementException | URISyntaxException e) { String errorMessage = "Error while adding new a label to API : " + body.getName() + "-" + e.getMessage() ; RestApiUtil.handleInternalServerError(errorMessage, e, log); } return null; }
Source:
<code>public static void waitTillInstancesAreCreated(ColoHelper coloHelper, String entity, int bundleSeqNo, int totalMinutesToWait ) throws JAXBException, OozieClientException { int sleep = totalMinutesToWait * 60 / 20; String entityName = Util.readEntityName(entity); ENTITY_TYPE type = Util.getEntityType(entity); <START> String bundleID = getSequenceBundleID(coloHelper,entityName,type, <END> bundleSeqNo); String coordID = getDefaultCoordIDFromBundle(coloHelper, bundleID); for (int sleepCount = 0; sleepCount < sleep; sleepCount++) { CoordinatorJob coordInfo = coloHelper.getProcessHelper().getOozieClient() .getCoordJobInfo(coordID); if(coordInfo.getActions().size() > 0) break; System.out.println("Coord "+ coordInfo.getId() + " still dosent have " + "instance created on oozie: " + coloHelper.getProcessHelper() .getOozieClient().getOozieUrl()); try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } }</code><technical_language>bundle id is retrieved else is a oozie related code. Create a method in oozie util takes a coord id loops method here</technical_language>

Target:
public static void waitTillInstancesAreCreated(ColoHelper coloHelper, String entity, int bundleSeqNo, int totalMinutesToWait ) throws JAXBException, OozieClientException { int sleep = totalMinutesToWait * 60 / 20; String entityName = Util.readEntityName(entity); ENTITY_TYPE type = Util.getEntityType(entity); String bundleID = getSequenceBundleID(coloHelper,entityName,type, bundleSeqNo); String coordID = getDefaultCoordIDFromBundle(coloHelper, bundleID); for (int sleepCount = 0; sleepCount < sleep; sleepCount++) { CoordinatorJob coordInfo = coloHelper.getProcessHelper().getOozieClient() .getCoordJobInfo(coordID); if(coordInfo.getActions().size() > 0) break; logger.info("Coord "+ coordInfo.getId() + " still dosent have " + "instance created on oozie: " + coloHelper.getProcessHelper() .getOozieClient().getOozieUrl()); try { Thread.sleep(20000); } catch (InterruptedException e) { logger.error(e.getMessage()); } } }
Source:
<code>public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { <START> OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId); <END> try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (VdcBLLException e) { AuditLogableBase loggable = new AuditLogableBase(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }</code><technical_language>If null method getFromStorageDomainId return null ever..</technical_language>

Target:
public void activateCinderDomain(Guid storageDomainId, Guid storagePoolId) { OpenStackVolumeProviderProxy proxy = OpenStackVolumeProviderProxy.getFromStorageDomainId(storageDomainId); if (proxy == null) { log.error("Couldn't create an OpenStackVolumeProviderProxy for storage domain ID: {}", storageDomainId); return; } try { proxy.testConnection(); updateCinderDomainStatus(storageDomainId, storagePoolId, StorageDomainStatus.Active); } catch (VdcBLLException e) { AuditLogableBase loggable = new AuditLogableBase(); loggable.addCustomValue("CinderException", e.getCause().getCause() != null ? e.getCause().getCause().getMessage() : e.getCause().getMessage()); new AuditLogDirector().log(loggable, AuditLogType.CINDER_PROVIDER_ERROR); throw e; } }
Source:
<code>private Pair<File, File> validateFiles(File npmFolder) throws ExecutionFailedException { assert port == 0; File webpack = new File(npmFolder, WEBPACK_SERVER); File webpackConfig = new File(npmFolder, FrontendUtils.WEBPACK_CONFIG); if (!npmFolder.exists()) { getLogger().warn("No project folder'{}' exists", npmFolder); throw new ExecutionFailedException( <START> "Couldn't start dev server because " <END> + "the target execution folder doesn't exist."); } if (!webpack.exists()) { getLogger().warn("'{}' doesn't exist. Did you run `npm install`?", webpack); throw new ExecutionFailedException( "Couldn't start dev server because " + "'{}' doesn't exist. `npm install` has not been executed most likely."); } else if (!webpack.canExecute()) { getLogger().warn( "'{}' is not an executable. Did you run `npm install`?", webpack); throw new ExecutionFailedException( "Couldn't start dev server because " + "'{}' is not an executable. `npm install` has not been executed most likely."); } if (!webpackConfig.canRead()) { getLogger().warn( "Webpack configuration '{}' is not found or is not readable.", webpackConfig); throw new ExecutionFailedException( "Couldn't start dev server because " + "'{}' doesn't exist or is not readable."); } return new Pair<>(webpack, webpackConfig); }</code><technical_language>![CRITICAL](<LINK_0> 'Severity: CRITICAL') Define a constant instead of duplicating this literal "Couldn't start dev server " 4 times. [![rule](<LINK_1>](<LINK_2></technical_language>

Target:
private Pair<File, File> validateFiles(File npmFolder) throws ExecutionFailedException { assert port == 0; File webpack = new File(npmFolder, WEBPACK_SERVER); File webpackConfig = new File(npmFolder, FrontendUtils.WEBPACK_CONFIG); if (!npmFolder.exists()) { getLogger().warn("No project folder '{}' exists", npmFolder); throw new ExecutionFailedException( "Couldn't start dev server because " + "the target execution folder doesn't exist."); } if (!webpack.exists()) { getLogger().warn("'{}' doesn't exist. Did you run `npm install`?", webpack); throw new ExecutionFailedException(String.format( "Couldn't start dev server because " + "'%s' doesn't exist. `npm install` has not been executed most likely.", webpack)); } else if (!webpack.canExecute()) { getLogger().warn( "'{}' is not an executable. Did you run `npm install`?", webpack); throw new ExecutionFailedException(String.format( "Couldn't start dev server because " + "'%s' is not an executable. `npm install` has not been executed most likely.", webpack)); } if (!webpackConfig.canRead()) { getLogger().warn( "Webpack configuration '{}' is not found or is not readable.", webpackConfig); throw new ExecutionFailedException(String.format( "Couldn't start dev server because " + "'%s' doesn't exist or is not readable.", webpackConfig)); } return new Pair<>(webpack, webpackConfig); }
Source:
<code>public PermissionBlueprint populate(ModelTranslator modelTranslator, PermissionBlueprintDTO source, PermissionBlueprint destination) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (destination == null) { throw new IllegalArgumentException("destination is null"); } destination.setId(source.getId()); destination.setType(source.getType() == null ? null : <START> PermissionFactory.PermissionType.valueOf(source.getType())); <END> destination.setAccess(source.getAccess() == null ? null : Access.valueOf(source.getAccess())); if (modelTranslator != null) { destination.setOwner(modelTranslator.translate(source.getOwner(), Owner.class)); } else { destination.setOwner(null); } return destination; }</code><technical_language>created/updated fields need translated</technical_language>

Target:
public PermissionBlueprint populate(ModelTranslator modelTranslator, PermissionBlueprintDTO source, PermissionBlueprint destination) { if (source == null) { throw new IllegalArgumentException("source is null"); } if (destination == null) { throw new IllegalArgumentException("destination is null"); } destination.setCreated(source.getCreated() != null ? new Date(source.getCreated().toInstant().toEpochMilli()) : null); destination.setUpdated(source.getUpdated() != null ? new Date(source.getUpdated().toInstant().toEpochMilli()) : null); destination.setId(source.getId()); destination.setType(source.getType() == null ? null : PermissionFactory.PermissionType.valueOf(source.getType())); destination.setAccess(source.getAccess() == null ? null : Access.valueOf(source.getAccess())); if (modelTranslator != null) { destination.setOwner(modelTranslator.translate(source.getOwner(), Owner.class)); } else { destination.setOwner(null); } return destination; }
Source:
<code>public void testShowNoCustomItemsMessageWhenThereIsNoCustomItem() { view.setupListItems(new ArrayList<>()); <START> verify(listItemsNo.classList).remove(HIDDEN_CSS_CLASS); <END> }</code><technical_language>verify(listItems.classList).add(HIDDEN_CSS_CLASS)</technical_language>

Target:
public void testShowNoCustomItemsMessageWhenThereIsNoCustomItem() { view.setupListItems(new ArrayList<>()); verify(listItemsNo.classList).remove(HIDDEN_CSS_CLASS); verify(listItems.classList).add(HIDDEN_CSS_CLASS); }
Source:
<code>private void scheduleSessionFlushes() { sessionExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { <START> Thread nonDeamonThread = new Thread(new Runnable() { <END> @Override public void run() { sessionTracker.flushSessions(new Date()); } }); nonDeamonThread.setDaemon(false); nonDeamonThread.start(); } }, SESSION_TRACKING_PERIOD_MS, SESSION_TRACKING_PERIOD_MS, TimeUnit.MILLISECONDS); }</code><technical_language>a cached executor e.g. Executors.newSingleThreadExecutor() creating a new thread time this is invoked</technical_language>

Target:
private void scheduleSessionFlushes() { sessionExecutorService.scheduleAtFixedRate(new Runnable() { @Override public void run() { sessionFlusherService.submit(new Runnable() { @Override public void run() { sessionTracker.flushSessions(new Date()); } }); } }, SESSION_TRACKING_PERIOD_MS, SESSION_TRACKING_PERIOD_MS, TimeUnit.MILLISECONDS); }
Source:
<code>public void update(CruiseConfig preprocessedConfig) throws Exception { EnvironmentsConfig environments = preprocessedConfig.getEnvironments(); EnvironmentConfig oldEnvironmentConfig = preprocessedConfig.getEnvironments().find(new CaseInsensitiveString(oldEnvironmentName)); int index = environments.indexOf(oldEnvironmentConfig); environments.remove(index); <START> environments.add(index, newEnvironmentConfig); <END> }</code><technical_language>Interesting usage, add BaseCollection.replace(old, new)</technical_language>

Target:
public void update(CruiseConfig preprocessedConfig) throws Exception { EnvironmentsConfig environments = preprocessedConfig.getEnvironments(); EnvironmentConfig oldEnvironmentConfig = preprocessedConfig.getEnvironments().find(oldEnvironmentName); environments.replace(oldEnvironmentConfig, newEnvironmentConfig); }
Source:
<code>public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody @Valid Loan loan) { Loan oldLoan = loanDao.findOne(id); if (oldLoan == null) { throw new NotFoundException("Loan not found"); } loan.setId(id); <START> loanDao.saveAndFlush(loan); <END> return new ResponseEntity<>("Loan updated", HttpStatus.NO_CONTENT); }</code><technical_language>check if Loan updated belongs logged AppUser</technical_language>

Target:
public ResponseEntity<String> update(@PathVariable("id") Long id, @RequestBody @Valid Loan loan) { Loan oldLoan = loanDao.findOne(id); if (oldLoan == null) { throw new NotFoundException("Loan not found"); } AppUser appUser = userUtil.extractLoggedAppUserFromDatabase(); if(appUser.getUserId() != oldLoan.getUser().getUserId()){ throw new BadRequestException("Bad request"); } if(loan.getCounterparty().getId() == 0){ counterpartyDao.saveAndFlush(loan.getCounterparty()); } loan.setUser(appUser); loan.setId(id); loanDao.saveAndFlush(loan); return new ResponseEntity<>("Loan updated", HttpStatus.NO_CONTENT); }
Source:
<code>private void loadTrace() { synchronized (fEntryListMap) { fEntryList = fEntryListMap.get(fTrace); if (fEntryList == null) { <START> fStartTime = <END> Long.MAX_VALUE; fEndTime = Long.MIN_VALUE; refresh(); synchronized (fBuildThreadMap) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) { trace = checkNotNull(trace); BuildThread buildThread = new BuildThread(trace, fTrace); fBuildThreadMap.put(trace, buildThread); buildThread.start(); } } } else { fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); refresh(); } } }</code><technical_language>this set SWT.DEFAULT right away? set else in refresh() asyncExec, fields read that</technical_language>

Target:
private void loadTrace() { synchronized (fEntryListMap) { fEntryList = fEntryListMap.get(fTrace); if (fEntryList == null) { fStartTime = SWT.DEFAULT; fEndTime = SWT.DEFAULT; refresh(); synchronized (fBuildThreadMap) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(fTrace)) { trace = checkNotNull(trace); BuildThread buildThread = new BuildThread(trace, fTrace); fBuildThreadMap.put(trace, buildThread); buildThread.start(); } } } else { fStartTime = fTrace.getStartTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); fEndTime = fTrace.getEndTime().normalize(0, ITmfTimestamp.NANOSECOND_SCALE).getValue(); refresh(); } } }
Source:
<code>void shouldReturnEmptyDisplayNameString() { final Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); String actualDisplayName = statistics.getDisplayName(""); assertThat(actualDisplayName).isEmpty(); <START> } <END></code><technical_language>s.o</technical_language>

Target:
void shouldReturnEmptyDisplayNameString() { Issues<Issue> issues = new Issues<>(); IssueBuilder builder = new IssueBuilder(); PropertyStatistics statistics = new PropertyStatistics(issues, "category", Function.identity()); String actualDisplayName = statistics.getDisplayName(""); assertThat(actualDisplayName).isEmpty(); }
Source:
<code><START> public Properties getJdbcProperties() throws Exception { <END> String user = userPassword.userId.getStringValue(); String password = userPassword.password.getStringValue(); String loginTimeout = String.valueOf(this.loginTimeout.getValue()); Properties properties = new Properties(); if (user != null) { properties.put("user", user); } if (AuthenticationType.BASIC == authenticationType.getValue()) { if (password != null) { properties.put("password", password); } } else { if (keyAlias.getValue() != null) { properties.put("privateKey", getPrivateKey()); } } if (loginTimeout != null) { properties.put("loginTimeout", String.valueOf(this.loginTimeout.getValue())); } return properties; }</code><technical_language>throws exception now</technical_language>

Target:
public Properties getJdbcProperties() throws IOException { String user = userPassword.userId.getStringValue(); String password = userPassword.password.getStringValue(); String loginTimeout = String.valueOf(this.loginTimeout.getValue()); Properties properties = new Properties(); if (user != null) { properties.put("user", user); } if (AuthenticationType.BASIC == authenticationType.getValue()) { ofNullable(password).ifPresent(p -> properties.put("password", p)); } else if (keyAlias.getValue() != null) { properties.put("privateKey", getPrivateKey()); } if (loginTimeout != null) { properties.put("loginTimeout", loginTimeout); } return properties; }
Source:
<code>public String toString() { <START> return String.format("{map[%s] : key field = %s, value field = %s}", mapName, keyName, valueName); <END> }</code><technical_language>reason auto generated IntelliJ style</technical_language>

Target:
public String toString() { return "KeyValueMap{" + "mapName='" + mapName + '\'' + ", keyColumn='" + keyColumn + '\'' + ", valueColumn='" + valueColumn + '\'' + '}'; }
Source:
<code>public void run() { if (!running) { return; } try { TaskQueue queue = new TaskQueue(); queue.thenRun(1, () -> setPistonState(pistons[0], true)); queue.thenRun(3, () -> setPistonState(pistons[0], false)); queue.thenRun(1, () -> setPistonState(pistons[1], true)); queue.thenRun(3, () -> setPistonState(pistons[1], false)); queue.thenRun(() -> { Block furnace = chest.getRelative(BlockFace.DOWN); furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, Material.STONE); for (int y = height; y > 0; y--) { Block b = start.getWorld().getBlockAt(x, y, z); if (!SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(owner), b, ProtectableAction.BREAK_BLOCK)) { stop("machines.INDUSTRIAL_MINER.no-permission"); return; } if (miner.canMine(b.getType()) && push(miner.getOutcome(b.getType()))) { furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, b.getType()); furnace.getWorld().playSound(furnace.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.2F, 1F); b.setType(Material.AIR); fuel--; ores++; Slimefun.runSync(this, 4); return; } } nextColumn(); }); queue.execute(SlimefunPlugin.instance); } catch (Exception e) { <START> Slimefun.getLogger().log(Level.SEVERE, "An Error occured while running an Industrial Miner", e); <END> stop(); } }</code><technical_language>post location info in cargo. yet, a util method in ErrorCatcher handle for us. post coords if possible, server owners need depending issue</technical_language>

Target:
public void run() { if (!running) { return; } TaskQueue queue = new TaskQueue(); queue.thenRun(1, () -> setPistonState(pistons[0], true)); queue.thenRun(3, () -> setPistonState(pistons[0], false)); queue.thenRun(1, () -> setPistonState(pistons[1], true)); queue.thenRun(3, () -> setPistonState(pistons[1], false)); queue.thenRun(() -> { try { Block furnace = chest.getRelative(BlockFace.DOWN); furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, Material.STONE); for (int y = height; y > 0; y--) { Block b = start.getWorld().getBlockAt(x, y, z); if (!SlimefunPlugin.getProtectionManager().hasPermission(Bukkit.getOfflinePlayer(owner), b, ProtectableAction.BREAK_BLOCK)) { stop("machines.INDUSTRIAL_MINER.no-permission"); return; } if (miner.canMine(b.getType()) && push(miner.getOutcome(b.getType()))) { furnace.getWorld().playEffect(furnace.getLocation(), Effect.STEP_SOUND, b.getType()); furnace.getWorld().playSound(furnace.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 0.2F, 1F); b.setType(Material.AIR); fuel--; ores++; Slimefun.runSync(this, 4); return; } } nextColumn(); } catch (Exception e) { Slimefun.getLogger().log(Level.SEVERE, e, () -> "An Error occured while running an Industrial Miner at " + new BlockPosition(chest)); stop(); } }); queue.execute(SlimefunPlugin.instance); }
Source:
<code>protected abstract ActionResult execute() throws EntityDoesNotExistException; public String getLogMessage() { UserType currUser = gateKeeper.getCurrentUser(); String url = HttpRequestHelper.getRequestedUrl(request); <START> Map<String, String[]> params = HttpRequestHelper.getParameterMap(request); <END> return new LogMessageGenerator().generatePageActionLogMessage(url, params, currUser, account, student, statusToAdmin); }</code><technical_language>Is a reason requestUrl requestParameters used</technical_language>

Target:
protected abstract ActionResult execute() throws EntityDoesNotExistException; public String getLogMessage() { UserType currUser = gateKeeper.getCurrentUser(); return new LogMessageGenerator().generatePageActionLogMessage(requestUrl, requestParameters, currUser, account, student, statusToAdmin); }
Source:
<code>private Map<String, Set<String>> getPolicy(ShareableMetacardImpl shareableMetacard) { return Stream.of( <START> getSharingSecurityTag(), <END> getOwnerPermission(shareableMetacard), getGroupPermission(shareableMetacard), getIndividualPermission(shareableMetacard)) .map(Map::entrySet) .flatMap(Collection::stream) .filter(entry -> !entry.getValue().isEmpty()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Sets::union)); }</code><technical_language>a substitute for tagging since, this stuff moves core, result in a lot of unnecessary state</technical_language>

Target:
private Map<String, Set<String>> getPolicy(ShareableMetacardImpl shareableMetacard) { return Stream.of( getShareablePermissions(), getOwnerPermission(shareableMetacard), getGroupPermission(shareableMetacard), getIndividualPermission(shareableMetacard)) .map(Map::entrySet) .flatMap(Collection::stream) .filter(entry -> !entry.getValue().isEmpty()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, Sets::union)); }
Source:
<code>public void encode(ActiveMQBuffer buffer) { buffer.writeLong(queueID); buffer.writeLong(pageID); <START> buffer.writeLong(persistentSize); <END> }</code><technical_language>OIC.. implemented it.. I a compatibility test validating that.. a journal test new compatibility testsuite already... paging.. validating counters... If a do it.. great.. I do it</technical_language>

Target:
public void encode(ActiveMQBuffer buffer) { buffer.writeLong(queueID); buffer.writeLong(pageID); }
Source:
<code>public void testPreHandle_zero() throws Exception { testTarget.setApplicationContext(new StaticApplicationContext()); testTarget.afterPropertiesSet(); <START> boolean expectedReturnValue = testTarget.preHandle(mockRequest, mockResponse, null); <END> assertThat(mockRequest.getAttributeNames().hasMoreElements(), is(false)); assertThat(expectedReturnValue, is(true)); }</code><technical_language>Please change a actualReturnValue</technical_language>

Target:
public void testPreHandle_zero() throws Exception { testTarget.setApplicationContext(new StaticApplicationContext()); testTarget.afterPropertiesSet(); boolean actualReturnValue = testTarget.preHandle(mockRequest, mockResponse, null); assertThat(mockRequest.getAttributeNames().hasMoreElements(), is(false)); assertThat(actualReturnValue, is(true)); }
Source:
<code>public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = Integer.min(topIndex + countPerPage() + 1, items.length); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); for (DeferredEntry entry : fPostDrawEntries) { entry.draw(fTimeGraphProvider, gc); } for (DeferredLine line : fLines) { line.draw(gc); } <START> for(DeferredSegment <END> seg: fPoints) { seg.draw(gc); } Color prev = gc.getForeground(); gc.setForeground(fBlack); int prevAA = gc.getAntialias(); gc.setAntialias(SWT.OFF); int prevLineWidth = gc.getLineWidth(); gc.setLineWidth(1); for (DeferredSegment seg : fPoints) { seg.draw(gc); } gc.setLineWidth(prevLineWidth); gc.setAntialias(prevAA); for (Rectangle rectangle : fSelectedRectangles) { int arc = Math.min(rectangle.height + 1, rectangle.width) / 2; gc.drawRoundRectangle(rectangle.x - 1, rectangle.y - 1, rectangle.width, rectangle.height + 1, arc, arc); } gc.setForeground(prev); }</code><technical_language>space</technical_language>

Target:
public void drawItems(Rectangle bounds, ITimeDataProvider timeProvider, Item[] items, int topIndex, int nameSpace, GC gc) { int bottomIndex = Integer.min(topIndex + countPerPage() + 1, items.length); for (int i = topIndex; i < bottomIndex; i++) { Item item = items[i]; drawItem(item, bounds, timeProvider, i, nameSpace, gc); } TraceCompassLogUtils.traceCounter(LOGGER, Level.FINER, fDrawItemsCountLabel, bottomIndex - topIndex); for (DeferredEntry entry : fPostDrawEntries) { entry.draw(fTimeGraphProvider, gc); } for (DeferredLine line : fLines) { line.draw(gc); } Color prev = gc.getForeground(); gc.setForeground(fBlack); int prevAA = gc.getAntialias(); gc.setAntialias(SWT.OFF); int prevLineWidth = gc.getLineWidth(); gc.setLineWidth(1); for (DeferredSegment seg : fPoints) { seg.draw(gc); } gc.setLineWidth(prevLineWidth); gc.setAntialias(prevAA); for (Rectangle rectangle : fSelectedRectangles) { int arc = Math.min(rectangle.height + 1, rectangle.width) / 2; gc.drawRoundRectangle(rectangle.x - 1, rectangle.y - 1, rectangle.width, rectangle.height + 1, arc, arc); } gc.setForeground(prev); }
Source:
<code>public LdapFindUserByUidCommand(LdapContext ldapContext, String ldapSearchBase, String uid) { super(HystrixCommand.Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(GROUPKEY)). andCommandKey(HystrixCommandKey.Factory.asKey(GROUPKEY + ":" + LdapFindUserByUidCommand.class.getSimpleName()))); if(Strings.isNullOrEmpty(uid)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "uid")); } else if(Strings.isNullOrEmpty(ldapSearchBase)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapSearchBase")); } else if(ldapContext == null) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapContext")); } <START> this.cacheKey = new LDAPCacheKey(uid, ldapContext, ldapSearchBase, "(uid=" + uid + ")"); <END> }</code><technical_language>Logic for creating a new cache key is duplicated. a static method LDAPCacheKey takes uid, ldapContext, ldapSearchBase arguments creates a new instance good. constructor protected</technical_language>

Target:
public LdapFindUserByUidCommand(LdapContext ldapContext, String ldapSearchBase, String uid) { super(HystrixCommand.Setter.withGroupKey(HystrixCommandGroupKey.Factory.asKey(GROUPKEY)). andCommandKey(HystrixCommandKey.Factory.asKey(GROUPKEY + ":" + LdapFindUserByUidCommand.class.getSimpleName()))); if (Strings.isNullOrEmpty(uid)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "uid")); } else if (Strings.isNullOrEmpty(ldapSearchBase)) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapSearchBase")); } else if (ldapContext == null) { throw new IllegalArgumentException(String.format(INVALID_PARAM, "ldapContext")); } this.cacheKey = new LDAPCacheKey(uid, ldapContext, ldapSearchBase, "(uid=" + uid + ")", SearchControls.SUBTREE_SCOPE); }
Source:
<code>protected void executeCommand() { GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); SchedulerUtil scheduler = SchedulerUtilQuartzDBImpl.getInstance(); scheduler.deleteJob(jobId); String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); <START> String newJobId = scheduler.scheduleACronJob(GlusterSnapshotScheduleJob.class, <END> "onTimer", new Class[] { Guid.class, Guid.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId(), volumeId, schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression); schedule.setJobId(newJobId); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); }</code><technical_language>need a catch block handle log exceptions</technical_language>

Target:
protected void executeCommand() { GlusterVolumeSnapshotSchedule fetchedSchedule = getGlusterVolumeSnapshotScheduleDao().getByVolumeId(volumeId); String jobId = fetchedSchedule.getJobId(); SchedulerUtil scheduler = DBSchedulerUtilQuartzImpl.getInstance(); scheduler.deleteJob(jobId); String cronExpression = GlusterUtil.getInstance().getCronExpression(schedule); String newJobId = scheduler.scheduleACronJob(new GlusterSnapshotScheduleJob(), "onTimer", new Class[] { String.class, String.class, String.class, String.class, Boolean.class }, new Object[] { upServer.getId().toString(), volumeId.toString(), schedule.getSnapshotNamePrefix(), schedule.getSnapshotDescription(), force }, cronExpression); if (newJobId != null) { setSucceeded(true); schedule.setJobId(newJobId); getGlusterVolumeSnapshotScheduleDao().updateScheduleByVolumeId(volumeId, schedule); } }
Source:
<code>public void putPreferences(IEclipsePreferences preferences, ColorThemeSetting setting) { String value = setting.getColor().asHex() + " | " <START> + defaultBackground.getHexColor() + " | " <END> + setting.isBoldEnabled() + " | " + setting.isItalicEnabled() + " | " + setting.isStrikethroughEnabled() + " | " + setting.isUnderlineEnabled(); preferences.put(pluginKey, value); }</code><technical_language>Is "null" (as a string) a special of web editor? In case, move logic here. Also, want rename method getHexColorOrNull() indicating colour is optional</technical_language>

Target:
public void putPreferences(IEclipsePreferences preferences, ColorThemeSetting setting) { String value = setting.getColor().asHex() + " | " + defaultBackground.getHexColorOrNull() + " | " + setting.isBoldEnabled() + " | " + setting.isItalicEnabled() + " | " + setting.isStrikethroughEnabled() + " | " + setting.isUnderlineEnabled(); preferences.put(pluginKey, value); }
Source:
<code>private void bind() { <START> bindingContext = new DataBindingContext(); <END> this.scriptGeneratorTable.addPropertyChangeListener("actions", e -> DISPLAY.asyncExec(() -> { this.table.setRows(this.scriptGeneratorTable.getActions()); })); }</code><technical_language>Alistair removed</technical_language>

Target:
private void bind() { this.scriptGeneratorTable.addPropertyChangeListener("actions", e -> DISPLAY.asyncExec(() -> { this.table.setRows(this.scriptGeneratorTable.getActions()); })); }
Source:
<code>private void checkObjectAccessible(Node node, QualifiedObjectName objectName) { if (!isCatalogAccessible(objectName.getCatalogName())) { throw new SemanticException(MISSING_SCHEMA, node, "Catalog '%s' does not exist", objectName.getCatalogName()); } if (!isSchemaAccessible(objectName.asCatalogSchemaName())) { throw new SemanticException(MISSING_SCHEMA, node, "Schema '%s' does not exist", objectName.getSchemaName()); } <START> if (!isViewAccessible(objectName) && !isTableAccessible(objectName)) { <END> throw new SemanticException(MISSING_TABLE, node, "Table '%s' does not exist", objectName); } }</code><technical_language>this if (!isRelationAccessible(objectName)) ? (also, "table" meaning "table view" (accessControl.filterTables ?), isTableAccessible accept views... i a fan of this approach)</technical_language>

Target:
private void checkObjectAccessible(Node node, QualifiedObjectName objectName) { if (!isCatalogAccessible(objectName.getCatalogName())) { throw new SemanticException(MISSING_SCHEMA, node, "Catalog '%s' does not exist", objectName.getCatalogName()); } if (!isSchemaAccessible(objectName.getCatalogSchemaName())) { throw new SemanticException(MISSING_SCHEMA, node, "Schema '%s' does not exist", objectName.getSchemaName()); } if (!isRelationAccessible(objectName)) { throw new SemanticException(MISSING_TABLE, node, "Table '%s' does not exist", objectName); } }
Source:
<code><START> public void methodNameTest() throws Exception { <END> Description description = Description.createTestDescription("some-class-name", methodName); assertNotNull("Method name should be not null", description.getMethodName()); assertEquals(description.getMethodName(), methodName); }</code><technical_language>This is testing slightly is in bug. test bug this way: @RunWith(JUnit.class) public class TestDescriptionMethodNameTest { @RunWith(Parameterized.class) public static class ParameterizedNamesTest { public ParameterizedNamesTest(String s) { } @Parameterized.Parameters(name = "{0}") public static Collection<Object[]> data() { return Arrays.asList( new Object[]{"\n"}, new Object[]{"\r\n"}, new Object[]{"\r"}, new Object[]{"\u0085"}, new Object[]{"\u2028"}, new Object[]{"\u2029"} ); } @Test public void test() } } @Test public void parameterizedTestsWithSpecialCharsInName() { for (Description d : Request.aClass(ParameterizedNamesTest.class).getRunner().getDescription().getChildren()) { assertEquals("test", d.getMethodName()); // note: expected } } }</technical_language>

Target:
public void methodNameTest() throws Exception { Description description = Description.createTestDescription("some-class-name", methodName); assertNotNull("Method name should be not null", description.getMethodName()); assertEquals(methodName, description.getMethodName()); }
Source:
<code>public static String writeSingleClientConfigAvro(Properties props) { String avroConfig = new String(); <START> Boolean firstProp = true; <END> for(String key: props.stringPropertyNames()) { if(firstProp) { firstProp = false; } else { avroConfig = avroConfig + ",\n"; } avroConfig = avroConfig + "\t\t\"" + key + "\": \"" + props.getProperty(key) + "\""; } if(avroConfig.isEmpty()) { return "{}"; } else { return "{\n" + avroConfig + "\n\t}"; } }</code><technical_language>specific reason for String literal here. in String avroConfig; instead of creating String object</technical_language>

Target:
public static String writeSingleClientConfigAvro(Properties props) { String avroConfig = ""; Boolean firstProp = true; for(String key: props.stringPropertyNames()) { if(firstProp) { firstProp = false; } else { avroConfig = avroConfig + ",\n"; } avroConfig = avroConfig + "\t\t\"" + key + "\": \"" + props.getProperty(key) + "\""; } if(avroConfig.isEmpty()) { return "{}"; } else { return "{\n" + avroConfig + "\n\t}"; } }