auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void initializeTest() { ActivityController<? extends CourseBaseActivity> controller = Robolectric.buildActivity(getActivityClass()).withIntent(getIntent()); CourseBaseActivity activity = controller.get(); controller.create(); <START> assertNotNull(activity.findViewById(R.id.last_accessed_bar)); <END> controller.postCreate(null).resume().postResume().visible(); }</code><technical_language>This line deleted</technical_language>

Target:
public void initializeTest() { ActivityController<? extends CourseBaseActivity> controller = Robolectric.buildActivity(getActivityClass()).withIntent(getIntent()); CourseBaseActivity activity = controller.get(); controller.create(); controller.postCreate(null).resume().postResume().visible(); }
Source:
<code>public <T> boolean parse(T param, HttpServletRequest req, HttpServletResponse res) throws IOException { <START> return parse(param, req, res, new ArrayList<String>()); <END> }</code><technical_language>Collections.<String> emptySet()</technical_language>

Target:
public <T> boolean parse(T param, HttpServletRequest req, HttpServletResponse res) throws IOException { return parse(param, req, res, Collections.<String>emptySet()); }
Source:
<code>public void publishWorkflowAndTestDiscourseTopicCreation() { final ApiClient curatorApiClient = getWebClient(CURATOR_USERNAME); EntriesApi curatorEntriesApi = new EntriesApi(curatorApiClient); final ApiClient userApiClient = getWebClient(USER_2_USERNAME); WorkflowsApi userWorkflowsApi = new WorkflowsApi(userApiClient); String workflowName = Long.toString(Instant.now().toEpochMilli()); userWorkflowsApi.manualRegister("github", "DockstoreTestUser2/gdc-dnaseq-cwl", "/workflows/dnaseq/transform.cwl", workflowName, "cwl", "/workflows/dnaseq/transform.cwl.json"); final Workflow workflowByPathGithub = userWorkflowsApi.getWorkflowByPath(DOCKSTORE_TEST_USER2_GDC_DNASEQ_CWL_WORKFLOW + "/" + workflowName, null); final Workflow workflow = userWorkflowsApi.refresh(workflowByPathGithub.getId()); userWorkflowsApi.publish(workflow.getId(), new PublishRequest(){ public Boolean isPublish() { return true;} }); boolean thrownException = false; Integer wrongCategoryId = 3; try { <START> curatorEntriesApi.setDiscourseTopic(workflow.getId(), wrongCategoryId, ""); <END> } catch (ApiException ex) { thrownException = true; } assertTrue("Should fail creating a topic in category 3.", thrownException); Integer correctCategoryId = 9; thrownException = false; try { curatorEntriesApi.setDiscourseTopic(workflow.getId(), correctCategoryId, ""); } catch (ApiException ex) { thrownException = true; } assertTrue("Should fail creating another topic for a workflow that has one.", thrownException); }</code><technical_language>stick a fail() this avoid boolean</technical_language>

Target:
public void publishWorkflowAndTestDiscourseTopicCreation() { final ApiClient curatorApiClient = getWebClient(CURATOR_USERNAME); EntriesApi curatorEntriesApi = new EntriesApi(curatorApiClient); final ApiClient userApiClient = getWebClient(USER_2_USERNAME); WorkflowsApi userWorkflowsApi = new WorkflowsApi(userApiClient); String workflowName = Long.toString(Instant.now().toEpochMilli()); userWorkflowsApi.manualRegister("github", "DockstoreTestUser2/gdc-dnaseq-cwl", "/workflows/dnaseq/transform.cwl", workflowName, "cwl", "/workflows/dnaseq/transform.cwl.json"); final Workflow workflowByPathGithub = userWorkflowsApi.getWorkflowByPath(DOCKSTORE_TEST_USER2_GDC_DNASEQ_CWL_WORKFLOW + "/" + workflowName, null); final Workflow workflow = userWorkflowsApi.refresh(workflowByPathGithub.getId()); userWorkflowsApi.publish(workflow.getId(), new PublishRequest(){ public Boolean isPublish() { return true;} }); Integer wrongCategoryId = 3; try { curatorEntriesApi.setDiscourseTopic(workflow.getId(), wrongCategoryId); fail("Should not be able to set discourse topic."); } catch (ApiException ex) { } Integer correctCategoryId = 9; try { curatorEntriesApi.setDiscourseTopic(workflow.getId(), correctCategoryId); fail("Should still not be able to set discourse topic."); } catch (ApiException ex) { } }
Source:
<code>public List<Diagnosis> getPrimaryDiagnoses(Encounter encounter) { List<Diagnosis> diagnoses = new ArrayList<Diagnosis>(); if (encounter != null && !encounter.getVoided()) { for (Diagnosis diagnosis : encounter.getDiagnoses()) { <START> if (diagnosis.getRank() == 2) { <END> diagnoses.add(diagnosis); } } } return diagnoses; }</code><technical_language>magic number 2 mean</technical_language>

Target:
public List<Diagnosis> getPrimaryDiagnoses(Encounter encounter) { return diagnosisDAO.getPrimaryDiagnoses(encounter); }
Source:
<code>public void onXFormResult(final int requestCode, final int resultCode, final Intent data) { final FormRequest request = popFormRequest(requestCode); if (request == null) { LOG.e("Unknown form request code: " + requestCode); return; } final boolean isSubmissionCanceled = (resultCode == Activity.RESULT_CANCELED); Utils.logUserAction(isSubmissionCanceled ? "form_discard_pressed" : "form_save_pressed", "form", request.formUuid, "patient_uuid", request.patientUuid); <START> if(isSubmissionCanceled) return; <END> final boolean isSubmittingForm = mOdkResultSender.sendOdkResultToServer(request.patientUuid, resultCode, data); mUi.showFormSubmissionDialog(isSubmittingForm); }</code><technical_language>checking this here, remove parameter check OdkResultSender#sendOdkResultToServer. Thanks for this, more readable</technical_language>

Target:
public void onXFormResult(final int requestCode, final int resultCode, final Intent data) { final FormRequest request = popFormRequest(requestCode); if (request == null) { LOG.e("Unknown form request code: " + requestCode); return; } final boolean isSubmissionCanceled = (resultCode == Activity.RESULT_CANCELED); Utils.logUserAction(isSubmissionCanceled ? "form_discard_pressed" : "form_save_pressed", "form", request.formUuid, "patient_uuid", request.patientUuid); if(isSubmissionCanceled) return; final boolean isSubmittingForm = mOdkResultSender.sendOdkResultToServer(request.patientUuid, data); mUi.showFormSubmissionDialog(isSubmittingForm); }
Source:
<code>public void leaseShouldStartBeforeRefreshTime() { <START> setTimeDynamic(NanoTime::now); <END> LockToken t1 = lockSync(REQUEST_ID); LockToken t2 = lockSync(REQUEST_ID_2); Set<LockToken> tokens = ImmutableSet.of(t1, t2); Leased<Set<LockToken>> refreshResult = heldLocksCollection.refresh(tokens); NanoTime t1RefreshTime = heldLocksCollection.heldLocksById.get(t1.getRequestId()).get().lastRefreshTime(); NanoTime t2RefreshTime = heldLocksCollection.heldLocksById.get(t2.getRequestId()).get().lastRefreshTime(); NanoTime minRefreshTime = t1RefreshTime.isBefore(t2RefreshTime) ? t1RefreshTime : t2RefreshTime; assertThat(refreshResult.lease().leaderTime().currentTime()).isLessThan(minRefreshTime); }</code><technical_language>set supplier new AtomicLong(123)::getAndIncrement</technical_language>

Target:
public void leaseShouldStartBeforeRefreshTime() { LockToken t1 = lockSync(REQUEST_ID); LockToken t2 = lockSync(REQUEST_ID_2); Set<LockToken> tokens = ImmutableSet.of(t1, t2); Leased<Set<LockToken>> refreshResult = heldLocksCollection.refresh(tokens); NanoTime t1RefreshTime = heldLocksCollection.heldLocksById.get(t1.getRequestId()).get().lastRefreshTime(); NanoTime t2RefreshTime = heldLocksCollection.heldLocksById.get(t2.getRequestId()).get().lastRefreshTime(); NanoTime minRefreshTime = t1RefreshTime.isBefore(t2RefreshTime) ? t1RefreshTime : t2RefreshTime; assertThat(refreshResult.lease().leaderTime().currentTime()).isLessThan(minRefreshTime); }
Source:
<code>private List<Class<?>> getVersionableWhitelist() { <START> List<Class<?>> whitelist = new ArrayList<>(); <END> whitelist.add(Container.class); whitelist.add(Template.class); whitelist.add(File.class); whitelist.add(HTMLPage.class); return whitelist; }</code><technical_language>if want CollectionsUtils, list(Container.class, Template.class....); a java.util.Set, contains faster a java.util.List</technical_language>

Target:
private Set<Class<?>> getVersionableWhitelist() { return set(Container.class, Template.class, File.class, HTMLPage.class); }
Source:
<code>public void describeTo(Description description) { <START> description.appendText("Editor that title contins text: " + fileName); <END> }</code><technical_language>'contains'</technical_language>

Target:
public void describeTo(Description description) { description.appendText("Editor that title contains text: " + fileName); }
Source:
<code>public <T> T verify(T mock, VerificationMode mode) { MockingProgress mockingProgress = mockingProgress(); VerificationMode actualMode = mockingProgress.maybeVerifyLazily(mode); Set<VerificationListener> listeners = mockingProgress.verificationListeners(); try { if (mock == null) { throw nullPassedToVerify(); } if (!isMock(mock)) { throw notAMockPassedToVerify(mock.getClass()); } mockingProgress.verificationStarted(new MockAwareVerificationMode(mock, actualMode, listeners)); return mock; } catch (MockitoException e) { for (VerificationListener listener : listeners) { listener.onVerificationException(mock, actualMode, e); <START> } <END> throw e; } }</code><technical_language>instead of looping ([1](<LINK_0>, [2](<LINK_1>, I propose internal listener do for loop, this easier test too. Thoughts</technical_language>

Target:
public <T> T verify(T mock, VerificationMode mode) { if (mock == null) { throw nullPassedToVerify(); } if (!isMock(mock)) { throw notAMockPassedToVerify(mock.getClass()); } MockingProgress mockingProgress = mockingProgress(); VerificationMode actualMode = mockingProgress.maybeVerifyLazily(mode); mockingProgress.verificationStarted(new MockAwareVerificationMode(mock, actualMode, mockingProgress.verificationListeners())); return mock; }
Source:
<code>public DeviceManager(DataManager dataManager) { this.dataManager = dataManager; this.config = Context.getConfig(); dataRefreshDelay = config.getLong("database.refreshDelay", DEFAULT_REFRESH_DELAY) * 1000; if (dataManager != null) { try { updateDeviceCache(true); <START> updateGroupCache(true); <END> for (Position position : dataManager.getLatestPositions()) { positions.put(position.getDeviceId(), position); } } catch (SQLException error) { Log.warning(error); } } }</code><technical_language>init group cache first? devices reference it..</technical_language>

Target:
public DeviceManager(DataManager dataManager) { this.dataManager = dataManager; this.config = Context.getConfig(); dataRefreshDelay = config.getLong("database.refreshDelay", DEFAULT_REFRESH_DELAY) * 1000; if (dataManager != null) { try { updateGroupCache(true); updateDeviceCache(true); for (Position position : dataManager.getLatestPositions()) { positions.put(position.getDeviceId(), position); } } catch (SQLException error) { Log.warning(error); } } }
Source:
<code>public void addsCookieToResponse() throws IOException { MatcherAssert.assertThat( new RsPrint( new PsCookie( new CcPlain(), "foo", 1L ).exit(new RsEmpty(), new Identity.Simple("urn:test:99")) ).print(), Matchers.allOf( Matchers.containsString( "Set-Cookie: foo=urn%3Atest%3A99;Path=/;" ), <START> Matchers.containsString(";HttpOnly") <END> ) ); }</code><technical_language>@dmzaytsev incorporate this string - need for Matchers.allOf java Matchers.containsString( "Set-Cookie: foo=urn%3Atest%3A99;Path=/;HttpsOnly" )</technical_language>

Target:
public void addsCookieToResponse() throws IOException { MatcherAssert.assertThat( new RsPrint( new PsCookie( new CcPlain(), "foo", 1L ).exit(new RsEmpty(), new Identity.Simple("urn:test:99")) ).print(), Matchers.containsString( "Set-Cookie: foo=urn%3Atest%3A99;Path=/;HttpOnly;" ) ); }
Source:
<code>public void testListSecurityGroups() throws RunNodesException, InterruptedException, ExecutionException { skipIfSecurityGroupsNotSupported(); ComputeService computeService = view.getComputeService(); Optional<SecurityGroupExtension> securityGroupExtension = computeService.getSecurityGroupExtension(); assertTrue(securityGroupExtension.isPresent(), "security extension was not present"); Set<SecurityGroup> groups = securityGroupExtension.get().listSecurityGroups(); System.out.println(groups.size()); for (SecurityGroup group : groups) { <START> System.out.println(group); <END> } }</code><technical_language>assertions instead of sout, please</technical_language>

Target:
public void testListSecurityGroups() throws Exception { skipIfSecurityGroupsNotSupported(); final long begin = new Date().getTime(); ComputeService computeService = view.getComputeService(); Optional<SecurityGroupExtension> securityGroupExtension = computeService.getSecurityGroupExtension(); assertTrue(securityGroupExtension.isPresent(), "security extension was not present"); logger.info("Loading security groups"); final SecurityGroupExtension security = securityGroupExtension.get(); Set<SecurityGroup> beforeAdd = security.listSecurityGroups(); int countBeforeAdd = beforeAdd.size(); logger.info("Found %d security groups", countBeforeAdd); String someUnlikelyName = String.valueOf(new Random().nextInt(1000000) + 1000000); logger.info("Adding security group %s", someUnlikelyName); final SecurityGroup testGroup = security.createSecurityGroup(someUnlikelyName, getNodeTemplate().getLocation()); try { verifyAndDeleteSecurityGroup(security, countBeforeAdd, testGroup); } catch (Exception e) { logger.error(e, "Exception caught, live test leaking security group %s", testGroup.getName()); throw e; } final long end = new Date().getTime(); assertTrue(end - begin < TimeUnit.MINUTES.toMillis(5)); }
Source:
<code>public LocalRangeCacheManager(CacheConfig cacheConfig, CacheStats stats, ExecutorService cacheFlushExecutor, ExecutorService cacheRemovalExecutor) { requireNonNull(cacheConfig, "directory is null"); this.cacheFlushExecutor = cacheFlushExecutor; this.cacheRemovalExecutor = cacheRemovalExecutor; this.cache = CacheBuilder.newBuilder() .maximumSize(cacheConfig.getMaxCachedEntries()) .expireAfterAccess(cacheConfig.getCacheTtl().toMillis(), MILLISECONDS) .removalListener(new CacheRemovalListener()) .recordStats() <START> .build(); <END> this.stats = requireNonNull(stats, "stats is null"); this.directory = new Path(cacheConfig.getDirectory()); checkArgument(cacheConfig.getMaxInMemoryCacheSize().toBytes() >= 0, "maxInflightBytes is negative"); this.maxInflightBytes = cacheConfig.getMaxInMemoryCacheSize().toBytes(); File target = new File(directory.toUri()); if (!target.exists()) { try { Files.createDirectories(target.toPath()); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "cannot create cache directory " + target, e); } } else { File[] files = target.listFiles(); if (files == null) { return; } this.cacheRemovalExecutor.submit(() -> Arrays.stream(files).forEach(file -> { try { Files.delete(file.toPath()); } catch (IOException e) { } })); } }</code><technical_language>able set maximumWeight() weigher() evict based cached bytes cache entry count</technical_language>

Target:
public LocalRangeCacheManager(CacheConfig cacheConfig, CacheStats stats, ExecutorService cacheFlushExecutor, ExecutorService cacheRemovalExecutor) { requireNonNull(cacheConfig, "directory is null"); this.cacheFlushExecutor = cacheFlushExecutor; this.cacheRemovalExecutor = cacheRemovalExecutor; this.cache = CacheBuilder.newBuilder() .maximumSize(cacheConfig.getMaxCachedEntries()) .expireAfterAccess(cacheConfig.getCacheTtl().toMillis(), MILLISECONDS) .removalListener(new CacheRemovalListener()) .recordStats() .build(); this.stats = requireNonNull(stats, "stats is null"); this.baseDirectory = new Path(cacheConfig.getBaseDirectory()); checkArgument(cacheConfig.getMaxInMemoryCacheSize().toBytes() >= 0, "maxInflightBytes is negative"); this.maxInflightBytes = cacheConfig.getMaxInMemoryCacheSize().toBytes(); File target = new File(baseDirectory.toUri()); if (!target.exists()) { try { Files.createDirectories(target.toPath()); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "cannot create cache directory " + target, e); } } else { File[] files = target.listFiles(); if (files == null) { return; } this.cacheRemovalExecutor.submit(() -> Arrays.stream(files).forEach(file -> { try { Files.delete(file.toPath()); } catch (IOException e) { } })); } }
Source:
<code><START> public TechResponse add(TechResponse entrada) { <END> TechnologySample entity = new TechnologySample(); entity.setName(entrada.getName()); Key<TechnologySample> key = dao.add(entity); List<Key<RecommendationSample>> listKeyRec = null; if (entrada.getRecommendationsResponse() != null) { listKeyRec = new ArrayList<Key<RecommendationSample>>(); for (RecResponse recResponse : entrada.getRecommendationsResponse()) { RecommendationSample rec = new RecommendationSample(); rec.setScore(recResponse.getScore()); rec.setTechnology(key); Key<RecommendationSample> keyRecAtual = recService.add(rec); listKeyRec.add(keyRecAtual); } } entity.setRecommendations(listKeyRec); dao.update(entity); entrada.setId(entity.getId()); return entrada; }</code><technical_language>Please English for variables</technical_language>

Target:
public TechResponse add(TechResponse entrada) { Technology entity = new Technology(); entity.setName(entrada.getName()); Key<Technology> key = dao.add(entity); List<Key<Recommendation>> listKeyRec = null; if (entrada.getRecommendationsResponse() != null) { listKeyRec = new ArrayList<Key<Recommendation>>(); for (RecResponse recResponse : entrada.getRecommendationsResponse()) { Recommendation rec = new Recommendation(); rec.setScore(recResponse.getScore()); rec.setTechnology(key); Key<Recommendation> keyRecAtual = recService.add(rec); listKeyRec.add(keyRecAtual); } } entity.setRecommendations(listKeyRec); dao.update(entity); entrada.setId(entity.getId()); return entrada; }
Source:
<code>public void visit(final MavenProject project) { if (JavadocMojo.this.sourceTypes.contains(project.getPackaging())) { <START> this.manifestFiles.add(new File(project.getBasedir().getPath() + File.separator + "META-INF" + File.separator + "MANIFEST.MF")); <END> } }</code><technical_language>file path handling brittle relies basedir a trailing slash. new File(new File(project.getBasedir(), "META-INF/MANIFEST.MF") I think</technical_language>

Target:
public void visit(final MavenProject project) { if (JavadocMojo.this.sourceTypes.contains(project.getPackaging())) { this.manifestFiles.add(new File(project.getBasedir(), "META-INF/MANIFEST.MF")); } }
Source:
<code>private List<Date> daysIn(Interval interval) { return StreamSupport.stream(new ScheduleIntervalDates(interval).spliterator(), false) <START> .map(localDate -> localDate.toDateTimeAtStartOfDay(DateTimeZone.UTC).toDate()) <END> .collect(Collectors.toList()); }</code><technical_language>return a List<LocalDate>. This in need of fixing for a while now</technical_language>

Target:
private List<LocalDate> daysIn(Interval interval) { return StreamSupport.stream(new ScheduleIntervalDates(interval).spliterator(), false) .collect(Collectors.toList()); }
Source:
<code><START> protected FloatsColumn(final ColumnarFloats column) <END> { this.column = column; }</code><technical_language>Please align Double (no protected)</technical_language>

Target:
FloatsColumn(final ColumnarFloats column) { this.column = column; }
Source:
<code>public ThreadedModelResolver() { this.dependencyGraph = new Graph<URI>(); this.lock = new ReentrantLock(true); this.notResolving = lock.newCondition(); this.resolutionEnd = lock.newCondition(); this.currentlyResolving = new HashSet<URI>(); this.shutdownInProgress = new AtomicBoolean(false); <START> this.dependencySpecifierManager = new DependencySpecifierManager(); <END> }</code><technical_language>This sould retrieved plugin, instantiated here. plugin instantiate this class (which called ModelDependencyProviderRegistry)</technical_language>

Target:
public ThreadedModelResolver() { this.dependencyGraph = new Graph<URI>(); this.lock = new ReentrantLock(true); this.notResolving = lock.newCondition(); this.resolutionEnd = lock.newCondition(); this.currentlyResolving = new HashSet<URI>(); this.shutdownInProgress = new AtomicBoolean(false); this.dependencyProviderRegistry = EMFCompareIDEUIPlugin.getDefault() .getModelDependencyProviderRegistry(); }
Source:
<code>protected boolean canDoAction() { AuditLog event = DbFacade.getInstance().getAuditLogDao().get(getParameters().getId()); if (event == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_NOT_FOUND); } if (OVIRT.equalsIgnoreCase(event.getOrigin())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); } <START> if (!event.getseverity().equals(AuditLogSeverity.ALERT)) { <END> return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLRGAL_OPERATION); } return true; }</code><technical_language>Highly happen Engine assumes normal severity in case log severity explicitly defined, I guess a slight possibility event severity null, checked I !AuditLogSeverity.ALERT.equals(event.getseverity())</technical_language>

Target:
protected boolean canDoAction() { AuditLog event = DbFacade.getInstance().getAuditLogDao().get(getParameters().getId()); if (event == null) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_NOT_FOUND); } if (OVIRT.equalsIgnoreCase(event.getOrigin())) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLEGAL_ORIGIN); } if (event.getseverity() == AuditLogSeverity.ALERT) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_EXTERNAL_EVENT_ILLRGAL_OPERATION); } return true; }
Source:
<code>public void execute(ExecutionRequest request) { EngineExecutionListener engineExecutionListener = request.getEngineExecutionListener(); VintageEngineDescriptor engineDescriptor = (VintageEngineDescriptor) request.getRootTestDescriptor(); engineExecutionListener.executionStarted(engineDescriptor); RunnerExecutor runnerExecutor = new RunnerExecutor(engineExecutionListener, engineDescriptor.getTestSourceProvider()); <START> final ConfigurationParameters configurationParameters = request.getConfigurationParameters(); <END> final boolean parallelExecutionEnabled = configurationParameters.getBoolean(PARALLEL_ENABLED_CONFIG).orElse( false); try (CloseableExecutor executor = parallelExecutionEnabled ? new ParallelExecutor(configurationParameters) : new SerialExecutor()) { executeAllChildren(executor, runnerExecutor, engineDescriptor); } catch (final InterruptedException e) { throw new JUnitException("Error executing tests for engine " + getId() + ": " + e.getMessage(), e); } engineExecutionListener.executionFinished(engineDescriptor, successful()); }</code><technical_language>final for local variables method parameters. Please remove those</technical_language>

Target:
public void execute(ExecutionRequest request) { EngineExecutionListener engineExecutionListener = request.getEngineExecutionListener(); VintageEngineDescriptor engineDescriptor = (VintageEngineDescriptor) request.getRootTestDescriptor(); engineExecutionListener.executionStarted(engineDescriptor); RunnerExecutor runnerExecutor = new RunnerExecutor(engineExecutionListener, engineDescriptor.getTestSourceProvider()); try (CloseableExecutor executor = createExecutor(request)) { executeAllChildren(executor, runnerExecutor, engineDescriptor); } catch (InterruptedException e) { throw new JUnitException("Error executing tests for engine " + getId() + ": " + e.getMessage(), e); } engineExecutionListener.executionFinished(engineDescriptor, successful()); }
Source:
<code>public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(this); proxy.construct(event); File configFile = event.getSuggestedConfigurationFile(); Configurations.configExists = configFile.exists(); Configurations.config = new Configuration(configFile); Configurations.config.load(); Configurations.refreshConfig(); <START> CraftingHelper.register(new ResourceLocation(Reference.MOD_ID, "feature"), new JsonFeatureFactory()); <END> MinecraftForge.EVENT_BUS.register(PerChunkData.INSTANCE); MinecraftForge.EVENT_BUS.register(ChiselController.class); GameRegistry.registerWorldGenerator(GenerationHandler.INSTANCE, 2); MinecraftForge.EVENT_BUS.register(GenerationHandler.INSTANCE); MinecraftForge.TERRAIN_GEN_BUS.register(GenerationHandler.INSTANCE); NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler()); proxy.preInit(event); }</code><technical_language>This removed</technical_language>

Target:
public void preInit(FMLPreInitializationEvent event) { MinecraftForge.EVENT_BUS.register(this); ChiselSounds.init(); proxy.construct(event); File configFile = event.getSuggestedConfigurationFile(); Configurations.configExists = configFile.exists(); Configurations.config = new Configuration(configFile); Configurations.config.load(); Configurations.refreshConfig(); MinecraftForge.EVENT_BUS.register(PerChunkData.INSTANCE); MinecraftForge.EVENT_BUS.register(ChiselController.class); GameRegistry.registerWorldGenerator(GenerationHandler.INSTANCE, 2); MinecraftForge.EVENT_BUS.register(GenerationHandler.INSTANCE); MinecraftForge.TERRAIN_GEN_BUS.register(GenerationHandler.INSTANCE); NetworkRegistry.INSTANCE.registerGuiHandler(this, new ChiselGuiHandler()); proxy.preInit(event); }
Source:
<code>public static Method getMethod(Class c, String name) { <START> Method[] methods = c.getDeclaredMethods(); <END> for (Method method : methods) { if (method.getName().equals(name)) { return method; } } throw new IllegalArgumentException("Unknown method '" + name + "' on " + c); }</code><technical_language>inline</technical_language>

Target:
public static Method getMethod(Class c, String name) { for (Method method : c.getDeclaredMethods()) { if (method.getName().equals(name)) { return method; } } throw new IllegalArgumentException("Unknown method '" + name + "' on " + c); }
Source:
<code>public IndexCollection(IndexCollection.Args args) throws Exception { this.args = args; LOG.info("Index path: " + args.index); LOG.info("Threads: " + args.threads); LOG.info("Keep stopwords: " + args.keepstop); LOG.info("Positions: " + args.positions); LOG.info("Store docvectors: " + args.docvectors); LOG.info("Store docs: " + (args.storeTransformedDocs ? "transformed" : <START> (args.storeRawDocs ? "raw" : "none"))); <END> LOG.info("Optimize (merge segments): " + args.optimize); this.indexPath = Paths.get(args.index); if (!Files.exists(this.indexPath)) { Files.createDirectories(this.indexPath); } collectionPath = Paths.get(args.input); if (!Files.exists(collectionPath) || !Files.isReadable(collectionPath) || !Files.isDirectory(collectionPath)) { throw new RuntimeException("Document directory " + collectionPath.toString() + " does not exist or is not readable, please check the path"); } this.transformerClass = Class.forName("io.anserini.index.generator." + args.generatorClass); this.collectionClass = Class.forName("io.anserini.collection." + args.collectionClass); collection = (Collection) this.collectionClass.newInstance(); collection.setInputDir(collectionPath); this.counters = new Counters(); }</code><technical_language>if storeTransformedDocs storeRawDocs mutually exclusive, this explained in Arguments description</technical_language>

Target:
public IndexCollection(IndexCollection.Args args) throws Exception { this.args = args; LOG.info("Index path: " + args.index); LOG.info("Threads: " + args.threads); LOG.info("Keep stopwords? " + args.keepStopwords); LOG.info("Store positions? " + args.storePositions); LOG.info("Store docvectors? " + args.storeDocvectors); LOG.info("Store transformed docs? " + args.storeTransformedDocs); LOG.info("Store raw docs?" + args.storeRawDocs); LOG.info("Optimize (merge segments)? " + args.optimize); this.indexPath = Paths.get(args.index); if (!Files.exists(this.indexPath)) { Files.createDirectories(this.indexPath); } collectionPath = Paths.get(args.input); if (!Files.exists(collectionPath) || !Files.isReadable(collectionPath) || !Files.isDirectory(collectionPath)) { throw new RuntimeException("Document directory " + collectionPath.toString() + " does not exist or is not readable, please check the path"); } this.transformerClass = Class.forName("io.anserini.index.generator." + args.generatorClass); this.collectionClass = Class.forName("io.anserini.collection." + args.collectionClass); collection = (Collection) this.collectionClass.newInstance(); collection.setInputDir(collectionPath); this.counters = new Counters(); }
Source:
<code>public void writeBytes(Slice source, int sourceIndex, int length) { if (length >= slice.length()) { if (bufferPosition > 0) { int flushLength = getFreeBufferLength(); slice.setBytes(bufferPosition, source, sourceIndex, flushLength); bufferPosition = slice.length(); flushBufferToOutputStream(); sourceIndex += flushLength; length -= flushLength; } int flushLength = length - length % CHUNK_SIZE; <START> for (int i = 0; i < flushLength / CHUNK_SIZE; i++) { <END> writeToOutputStream(source, sourceIndex, CHUNK_SIZE); sourceIndex += CHUNK_SIZE; } length = length - flushLength; bufferOffset += flushLength; } ensureWritableBytes(length); slice.setBytes(bufferPosition, source, sourceIndex, length); bufferPosition += length; }</code><technical_language>I simpler do: java while (length <= CHUNK_SIZE) { writeToOutputStream(source, sourceIndex, CHUNK_SIZE); sourceIndex += CHUNK_SIZE; length -= CHUNK_SIZE; } loop need touch length of bufferOffset</technical_language>

Target:
public void writeBytes(Slice source, int sourceIndex, int length) { if (length >= CHUNK_SIZE) { if (bufferPosition > 0) { int flushLength = getFreeBufferLength(); slice.setBytes(bufferPosition, source, sourceIndex, flushLength); bufferPosition = CHUNK_SIZE; flushBufferToOutputStream(); sourceIndex += flushLength; length -= flushLength; } while (length >= CHUNK_SIZE) { writeToOutputStream(source, sourceIndex, CHUNK_SIZE); sourceIndex += CHUNK_SIZE; length -= CHUNK_SIZE; bufferOffset += CHUNK_SIZE; } } if (length > 0) { ensureWritableBytes(length); slice.setBytes(bufferPosition, source, sourceIndex, length); bufferPosition += length; } }
Source:
<code>public PathMappedListResult list( String packageType, String type, String name, String path, boolean recursive, String fileType, int limit ) { String[] list; StoreKey storeKey = new StoreKey( packageType, StoreType.get( type ), name ); if ( recursive ) { int lmt = DEFAULT_RECURSIVE_LIST_LIMIT; if ( limit > 0 ) { lmt = limit; } list = fileManager.list( storeKey.toString(), path, true, lmt ); } else { list = fileManager.list( storeKey.toString(), path ); } if ( fileType != null && list != null ) { Arrays.stream( list ).map( s -> { if ( "all".equals( fileType ) || ( "dir".equals( fileType ) && s.endsWith( "/" ) ) || ( <START> "file".equals( fileType ) && !s.endsWith( "/" ) ) ) <END> { return s; } else { return ""; } } ).filter( s -> isNotBlank( s ) ).toArray( String[]::new ); } return new PathMappedListResult( packageType, type, name, path, list ); }</code><technical_language>this is a filter, filter(s->"all".equals( fileType ) || ( "dir".equals( fileType ) && s.endsWith( "/" ) ) || ( "file".equals( fileType ) && !s.endsWith( "/" ) )) instead of map(...)</technical_language>

Target:
public PathMappedListResult list( String packageType, String type, String name, String path, boolean recursive, String fileType, int limit ) { PathDB.FileType fType = PathDB.FileType.all; if ( isNotBlank( fileType ) ) { fType = PathDB.FileType.valueOf( fileType ); } String[] list; StoreKey storeKey = new StoreKey( packageType, StoreType.get( type ), name ); if ( recursive ) { int lmt = DEFAULT_RECURSIVE_LIST_LIMIT; if ( limit > 0 ) { lmt = limit; } list = fileManager.list( storeKey.toString(), path, true, lmt, fType ); } else { list = fileManager.list( storeKey.toString(), path, fType ); } return new PathMappedListResult( packageType, type, name, path, list ); }
Source:
<code>private boolean goToFirstOccurrenceOfEarlierDate(Cursor cursor, Date furthestDate) throws CacheDatabaseException { boolean done = false; boolean retValue = false; while(!done) { try { String dateAsString = cursor.getString(cursor.getColumnIndex(KEY_MESSAGE_DATE)); <START> DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); <END> Date date = dateFormat.parse(dateAsString); if(date.compareTo(furthestDate) <= 0){ done = true; retValue = true; } else if(!cursor.moveToNext()) { done = true; retValue = false; } } catch (ParseException e) { throw new CacheDatabaseException("Unable to retrieve Message !"); } } return retValue; }</code><technical_language>date format defined loop</technical_language>

Target:
private boolean goToFirstOccurrenceOfEarlierDate(Cursor cursor, Date furthestDate) throws CacheDatabaseException { boolean done = false; boolean retValue = false; while(!done) { try { String dateAsString = cursor.getString(cursor.getColumnIndex(KEY_MESSAGE_DATE)); Date date = DateSerialization.toDateForCache(dateAsString); if(date.compareTo(furthestDate) <= 0){ done = true; retValue = true; } else if(!cursor.moveToNext()) { done = true; retValue = false; } } catch (ParseException e) { throw new CacheDatabaseException("Unable to retrieve Message !"); } } return retValue; }
Source:
<code><START> protected void parsePackagesSheet( <END> Repository<Entity> repo, IntermediateParseResults intermediateResults) { if (repo == null) return; int rowIndex = 1; for (Entity packageEntity : resolvePackages(repo)) { rowIndex++; parseSinglePackage(intermediateResults, rowIndex, packageEntity); } }</code><technical_language>IntelliJ tells this private gives</technical_language>

Target:
private void parsePackagesSheet( Repository<Entity> repo, IntermediateParseResults intermediateResults) { if (repo == null) return; int rowIndex = 1; for (Entity packageEntity : resolvePackages(repo)) { rowIndex++; parseSinglePackage(intermediateResults, rowIndex, packageEntity); } }
Source:
<code>private void addOperationsUsingSignatures( Path methodSignatures_file, VisibilityPredicate visibility, ReflectionPredicate reflectionPredicate) throws SignatureParseException { if (methodSignatures_file == null) { return; } try (EntryReader reader = new EntryReader(methodSignatures_file, "( for (String line : reader) { String sig = line.trim(); if (!sig.isEmpty()) { try { TypedClassOperation operation = signatureToOperation(sig, visibility, reflectionPredicate); <START> if (operation == null) { <END> continue; } if (!omitMethodsPredicate.shouldOmit(operation)) { operations.add(operation); } } catch (FailedPredicateException e) { System.out.printf("Ignoring %s that failed predicate: %s%n", sig, e.getMessage()); } } } } catch (IOException e) { throw new RandoopUsageError("Problem reading file " + methodSignatures_file, e); } }</code><technical_language>I this necessary, of refactorings</technical_language>

Target:
private void addOperationsUsingSignatures( Path methodSignatures_file, VisibilityPredicate visibility, ReflectionPredicate reflectionPredicate) throws SignatureParseException { if (methodSignatures_file == null) { return; } try (EntryReader reader = new EntryReader(methodSignatures_file, "( for (String line : reader) { String sig = line.trim(); if (!sig.isEmpty()) { try { TypedClassOperation operation = signatureToOperation(sig, visibility, reflectionPredicate); if (!omitMethodsPredicate.shouldOmit(operation)) { operations.add(operation); } } catch (FailedPredicateException e) { System.out.printf("Ignoring %s that failed predicate: %s%n", sig, e.getMessage()); } } } } catch (IOException e) { throw new RandoopUsageError("Problem reading file " + methodSignatures_file, e); } }
Source:
<code>protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { systemConfig = db.systemConfig().get(new SystemConfig.Key()); <START> Repository git = null; try { git = mgr.openRepository(allProjects); asignChangeOwnerPermissions(git); } catch (RepositoryNotFoundException e) { throw new OrmException(e); } catch (IOException e) { throw new OrmException(e); } catch (ConfigInvalidException e) { throw new OrmException(e); } finally { if (git != null) { git.close(); } } <END> }</code><technical_language>This is a horrible idiom. is a cleaner write it: Repository git; try { git = mgr.openRepository(allProjects); } catch (RepositoryNotFoundException e) { ... } try { assignChangeOwnerPermissions(git); } finally { git.close(); }</technical_language>

Target:
protected void migrateData(ReviewDb db, UpdateUI ui) throws OrmException, SQLException { Repository git; try { git = mgr.openRepository(allProjects); } catch (RepositoryNotFoundException e) { throw new OrmException(e); } catch (IOException e) { throw new OrmException(e); } try { asignChangeOwnerPermissions(git); } catch (IOException e) { throw new OrmException(e); } catch (ConfigInvalidException e) { throw new OrmException(e); } finally { if (git != null) { git.close(); } } }
Source:
<code>protected void fireTableSelectionChangeEvent() { <START> logger.info(this.getClass().toString() + " fireTableSelectionChangeEvent"); END> ErrataSelectionChangeEvent.fire(this, getSelectedItems()); }</code><technical_language>debug/trace/remove</technical_language>

Target:
protected void fireTableSelectionChangeEvent() { ErrataSelectionChangeEvent.fire(this, getSelectedItems()); }
Source:
<code>public void onMediaDeleted(String localMediaId) { <START> if (!TextUtils.isEmpty(localMediaId)) { <END> notifyMediaDeleted(Integer.valueOf(localMediaId)); } else { AppLog.w(AppLog.T.MEDIA, "onMediaDeleted event carries null localMediaId, not recognized"); } }</code><technical_language>I understand localMediaId is a string in places int, long passed a string need play safe catch potential NumberFormatException if fails parsed int. simplest do is StringUtils.stringToInt()</technical_language>

Target:
public void onMediaDeleted(String localMediaId) { if (!TextUtils.isEmpty(localMediaId)) { notifyMediaDeleted(StringUtils.stringToInt(localMediaId)); } else { AppLog.w(AppLog.T.MEDIA, "onMediaDeleted event carries null localMediaId, not recognized"); } }
Source:
<code>public void visitToken(DetailAST ast) { final FullIdent ident; final boolean isStatic; if (ast.getType() == TokenTypes.IMPORT) { ident = FullIdent.createFullIdentBelow(ast); isStatic = false; } else { ident = FullIdent.createFullIdent(ast.getFirstChild() .getNextSibling()); isStatic = true; } final boolean isStaticAndNotLastImport = isStatic && !lastImportStatic; final boolean isLastImportAndNonStatic = lastImportStatic && !isStatic; if (option == ImportOrderOption.TOP) { if (isLastImportAndNonStatic) { lastGroup = Integer.MIN_VALUE; lastImport = ""; } doVisitToken(ident, isStatic, isStaticAndNotLastImport); } else if (option == ImportOrderOption.BOTTOM) { if (isStaticAndNotLastImport) { lastGroup = Integer.MIN_VALUE; lastImport = ""; } doVisitToken(ident, isStatic, isLastImportAndNonStatic); if (isLastImportAndNonStatic) { log(ident.getLineNo(), MSG_ORDERING, ident.getText()); } <START> } <END> else if (option == ImportOrderOption.ABOVE) { doVisitToken(ident, isStatic, isStaticAndNotLastImport); } else if (option == ImportOrderOption.UNDER) { doVisitToken(ident, isStatic, isLastImportAndNonStatic); } else if (option == ImportOrderOption.INFLOW) { doVisitToken(ident, isStatic, true); } else { throw new IllegalStateException( "Unexpected option for static imports: " + option); } lastImportLine = ast.findFirstToken(TokenTypes.SEMI).getLineNo(); lastImportStatic = isStatic; beforeFirstImport = false; }</code><technical_language>Fix added option bottom. top a similar issue code similar</technical_language>

Target:
public void visitToken(DetailAST ast) { final FullIdent ident; final boolean isStatic; if (ast.getType() == TokenTypes.IMPORT) { ident = FullIdent.createFullIdentBelow(ast); isStatic = false; } else { ident = FullIdent.createFullIdent(ast.getFirstChild() .getNextSibling()); isStatic = true; } final boolean isStaticAndNotLastImport = isStatic && !lastImportStatic; final boolean isLastImportAndNonStatic = lastImportStatic && !isStatic; if (option == ImportOrderOption.TOP) { if (isLastImportAndNonStatic) { lastGroup = Integer.MIN_VALUE; lastImport = ""; } doVisitToken(ident, isStatic, isStaticAndNotLastImport); if (isStaticAndNotLastImport && !beforeFirstImport) { log(ident.getLineNo(), MSG_ORDERING, ident.getText()); } } else if (option == ImportOrderOption.BOTTOM) { if (isStaticAndNotLastImport) { lastGroup = Integer.MIN_VALUE; lastImport = ""; } doVisitToken(ident, isStatic, isLastImportAndNonStatic); if (isLastImportAndNonStatic) { log(ident.getLineNo(), MSG_ORDERING, ident.getText()); } } else if (option == ImportOrderOption.ABOVE) { doVisitToken(ident, isStatic, isStaticAndNotLastImport); } else if (option == ImportOrderOption.UNDER) { doVisitToken(ident, isStatic, isLastImportAndNonStatic); } else if (option == ImportOrderOption.INFLOW) { doVisitToken(ident, isStatic, true); } else { throw new IllegalStateException( "Unexpected option for static imports: " + option); } lastImportLine = ast.findFirstToken(TokenTypes.SEMI).getLineNo(); lastImportStatic = isStatic; beforeFirstImport = false; }
Source:
<code>private <C extends FlagAffectedCommand & TopologyAffectedCommand> CompletionStage<?> checkRemoteGetIfNeeded( InvocationContext ctx, C command, Set<Object> keys, LocalizedCacheTopology cacheTopology, boolean needsPreviousValue) { <START> List<Object> remoteKeys = new ArrayList<>(); <END> for (Object key : keys) { CacheEntry cacheEntry = ctx.lookupEntry(key); if (cacheEntry == null && cacheTopology.isWriteOwner(key)) { if (!needsPreviousValue || command.hasAnyFlag(FlagBitSets.SKIP_REMOTE_LOOKUP | FlagBitSets.CACHE_MODE_LOCAL)) { entryFactory.wrapExternalEntry(ctx, key, null, false, true); } else { remoteKeys.add(key); } } } final int size = remoteKeys.size(); if (size == 0) { return CompletableFutures.completedNull(); } return remoteGetMany(ctx, command, remoteKeys); }</code><technical_language>allocate lazily</technical_language>

Target:
private <C extends FlagAffectedCommand & TopologyAffectedCommand> CompletionStage<?> checkRemoteGetIfNeeded( InvocationContext ctx, C command, Set<Object> keys, LocalizedCacheTopology cacheTopology, boolean needsPreviousValue) { List<Object> remoteKeys = null; for (Object key : keys) { CacheEntry cacheEntry = ctx.lookupEntry(key); if (cacheEntry == null && cacheTopology.isWriteOwner(key)) { if (!needsPreviousValue || command.hasAnyFlag(FlagBitSets.SKIP_REMOTE_LOOKUP | FlagBitSets.CACHE_MODE_LOCAL)) { entryFactory.wrapExternalEntry(ctx, key, null, false, true); } else { if (remoteKeys == null) { remoteKeys = new ArrayList<>(); } remoteKeys.add(key); } } } return remoteKeys != null ? remoteGetMany(ctx, command, remoteKeys) : CompletableFutures.completedNull(); }
Source:
<code>private static boolean isCompatible(MerkleTreeConfig c1, MerkleTreeConfig c2) { boolean c1Disabled = c1 == null || !c1.isEnabled(); boolean c2Disabled = c2 == null || !c2.isEnabled(); return c1 == c2 || (c1Disabled && c2Disabled) || (c1 != null && c2 != null <START> && nullSafeEqual(c1.getDepth(), c2.getDepth())); <END> }</code><technical_language>minor: reason nullSafeEqual for int comparison (same below)</technical_language>

Target:
private static boolean isCompatible(MerkleTreeConfig c1, MerkleTreeConfig c2) { boolean c1Disabled = c1 == null || !c1.isEnabled(); boolean c2Disabled = c2 == null || !c2.isEnabled(); return c1 == c2 || (c1Disabled && c2Disabled) || (c1 != null && c2 != null && c1.getDepth() == c2.getDepth()); }
Source:
<code>public void should_have_parent_and_child_span_when_trigger_contains_span_info() throws Exception { brave.Span span = tracing.tracer().nextSpan(); JobDataMap data = new JobDataMap(); <START> try (SpanInScope spanInScope = tracing.tracer().withSpanInScope(span)) { <END> tracing.propagation() .injector((Setter<JobDataMap, String>) StringKeyDirtyFlagMap::put) .inject(tracing.currentTraceContext().get(), data); } finally { span.finish(); } Trigger trigger = newTrigger().forJob(SUCCESSFUL_JOB_KEY).usingJobData(data) .startNow().build(); runJob(trigger); Span parent = takeSpan(); Span child = takeSpan(); assertThat(parent.parentId()).isNull(); assertThat(child.parentId()).isEqualTo(parent.id()); }</code><technical_language>suppose real question is if JobDataMap is type bound consistently job. if case, stick strings in it. need some real world stuff I guess. excellent discovery</technical_language>

Target:
public void should_have_parent_and_child_span_when_trigger_contains_span_info() throws Exception { brave.Span span = tracing.tracer().nextSpan(); JobDataMap data = new JobDataMap(); addSpanToJobData(data); Trigger trigger = newTrigger().forJob(SUCCESSFUL_JOB_KEY).usingJobData(data) .startNow().build(); runJob(trigger); Span parent = takeSpan(); Span child = takeSpan(); assertThat(parent.parentId()).isNull(); assertThat(child.parentId()).isEqualTo(parent.id()); }
Source:
<code>public FileBackedInMemIFileWriter(Configuration conf, FileSystem fs, TezTaskOutput taskOutput, Class keyClass, Class valueClass, CompressionCodec codec, TezCounter writesCounter, TezCounter serializedBytesCounter, int cacheSize) throws IOException { super(conf, new FSDataOutputStream(createBoundedBuffer(cacheSize), null), keyClass, valueClass, null, writesCounter, serializedBytesCounter); this.fs = fs; this.cacheStream = (BoundedByteArrayOutputStream) this.rawOut.getWrappedStream(); this.taskOutput = taskOutput; this.bufferFull = (cacheStream == null); this.cacheSize = (cacheStream == null) ? 0 : <START> Math.max(getBaseCacheSize(), cacheStream.available()); <END> this.fileCodec = codec; }</code><technical_language>Nit: CacheSize replaced availableDataSize combines this calculation done in shouldWriteToDisk. code a easier read. return totalSize >= (cacheSize - (checksumSize + (2 * WritableUtils.getVIntSize(EOF_MARKER))));</technical_language>

Target:
public FileBackedInMemIFileWriter(Configuration conf, FileSystem fs, TezTaskOutput taskOutput, Class keyClass, Class valueClass, CompressionCodec codec, TezCounter writesCounter, TezCounter serializedBytesCounter, int cacheSize) throws IOException { super(conf, new FSDataOutputStream(createBoundedBuffer(cacheSize), null), keyClass, valueClass, null, writesCounter, serializedBytesCounter); this.fs = fs; this.cacheStream = (BoundedByteArrayOutputStream) this.rawOut.getWrappedStream(); this.taskOutput = taskOutput; this.bufferFull = (cacheStream == null); this.totalSize = getBaseCacheSize(); this.fileCodec = codec; }
Source:
<code>protected boolean addedValid(IConfigurationElement element) { int ranking = Integer.parseInt(element.getAttribute(ATT_RANKING)); IContextTester contextTester = null; if (element.getAttribute(ATT_CONTEXT) != null) { try { contextTester = (IContextTester)element.createExecutableExtension(ATT_CONTEXT); } catch (CoreException e) { <START> log(IStatus.WARNING, element, "Unable to create Context Tester '" + <END> element.getAttribute(ATT_CONTEXT) + "'."); } } RankedAdapterFactoryDescriptor descriptor = new RankedAdapterFactoryDescriptorImpl(element, ranking, contextTester); String supportedTypes = element.getAttribute(ATT_SUPPORTED_TYPES); for (StringTokenizer stringTokenizer = new StringTokenizer(supportedTypes); stringTokenizer .hasMoreTokens();) { String supportedType = stringTokenizer.nextToken(); List<Object> key = new ArrayList<Object>(); key.add(element.getAttribute(ATT_URI)); key.add(supportedType); adapterFactoryRegistry.put(key, descriptor); } return true; }</code><technical_language>externalized. Similar 'MatchEngineFactoryRegistryListener'. If want externalize remaining Strings in this class also</technical_language>

Target:
protected boolean addedValid(IConfigurationElement element) { int ranking = Integer.parseInt(element.getAttribute(ATT_RANKING)); IContextTester contextTester = null; if (element.getAttribute(ATT_CONTEXT) != null) { try { contextTester = (IContextTester)element.createExecutableExtension(ATT_CONTEXT); } catch (CoreException e) { log(IStatus.WARNING, element, EMFCompareRCPMessages.getString("malformed.extension.executable", ATT_CONTEXT, element.getAttribute(ATT_CONTEXT))); } } RankedAdapterFactoryDescriptor descriptor = new RankedAdapterFactoryDescriptorImpl(element, ranking, contextTester); String supportedTypes = element.getAttribute(ATT_SUPPORTED_TYPES); for (StringTokenizer stringTokenizer = new StringTokenizer(supportedTypes); stringTokenizer .hasMoreTokens();) { String supportedType = stringTokenizer.nextToken(); List<Object> key = new ArrayList<Object>(); key.add(element.getAttribute(ATT_URI)); key.add(supportedType); adapterFactoryRegistry.put(key, descriptor); } return true; }