auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected int getMaxIndexKeys() throws SQLException { if (INDEX_MAX_KEYS == 0) { String sql; if (connection.haveMinimumServerVersion(ServerVersion.v8_0)) { sql = "SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'"; } else { String from; if (connection.haveMinimumServerVersion(ServerVersion.v7_3)) { from = "pg_catalog.pg_namespace n, pg_catalog.pg_type t1, pg_catalog.pg_type t2 WHERE t1.typnamespace=n.oid AND n.nspname='pg_catalog' AND "; } else { from = "pg_type t1, pg_type t2 WHERE "; } sql = "SELECT t1.typlen/t2.typlen FROM " + from + " t1.typelem=t2.oid AND t1.typname='oidvector'"; } Statement stmt = null; try { stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql); if (!rs.next()) { <START> stmt.close(); <END> throw new PSQLException( GT.tr( "Unable to determine a value for MaxIndexKeys due to missing system catalog data."), PSQLState.UNEXPECTED_ERROR); } INDEX_MAX_KEYS = rs.getInt(1); } finally { if(stmt != null) { stmt.close(); } } } return INDEX_MAX_KEYS; }</code><technical_language>please remove this explicit close (it closed in finally)</technical_language>

Target:
protected int getMaxIndexKeys() throws SQLException { if (INDEX_MAX_KEYS == 0) { String sql; if (connection.haveMinimumServerVersion(ServerVersion.v8_0)) { sql = "SELECT setting FROM pg_catalog.pg_settings WHERE name='max_index_keys'"; } else { String from; if (connection.haveMinimumServerVersion(ServerVersion.v7_3)) { from = "pg_catalog.pg_namespace n, pg_catalog.pg_type t1, pg_catalog.pg_type t2 WHERE t1.typnamespace=n.oid AND n.nspname='pg_catalog' AND "; } else { from = "pg_type t1, pg_type t2 WHERE "; } sql = "SELECT t1.typlen/t2.typlen FROM " + from + " t1.typelem=t2.oid AND t1.typname='oidvector'"; } Statement stmt = null; try { stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(sql); if (!rs.next()) { throw new PSQLException( GT.tr( "Unable to determine a value for MaxIndexKeys due to missing system catalog data."), PSQLState.UNEXPECTED_ERROR); } INDEX_MAX_KEYS = rs.getInt(1); } finally { if (stmt != null) { stmt.close(); } } } return INDEX_MAX_KEYS; }
Source:
<code>public boolean redirectTeleportTo(EntityEnderman entityEnderman, double x, double y, double z) { <START> Sponge.getCauseStackManager().addContext(EventContextKeys.TELEPORT_TYPE, TeleportTypes.ENTITY_TELEPORT); <END> boolean flag = attemptTeleport(x, y, z); Sponge.getCauseStackManager().removeContext(EventContextKeys.TELEPORT_TYPE); return flag; }</code><technical_language>here, wrap in a CauseStackFrame</technical_language>

Target:
public boolean redirectTeleportTo(EntityEnderman entityEnderman, double x, double y, double z) { try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame()) { frame.addContext(EventContextKeys.TELEPORT_TYPE, TeleportTypes.ENTITY_TELEPORT); return attemptTeleport(x, y, z); } }
Source:
<code>public void migrateExternalIdentifier() throws Exception { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, SUBSTUDY_ID, true)) .thenReturn(Substudy.create()); ExternalIdentifier extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); when(externalIdDao.getExternalId(TestConstants.TEST_STUDY, ID)) .thenReturn(extId); Account account = Account.create(); account.setId(USER_ID); AccountId accountId = AccountId.forExternalId(TestConstants.TEST_STUDY_IDENTIFIER, ID); when(accountDao.getAccount(accountId)).thenReturn(account); externalIdService.migrateExternalIdentifier(study, ID, SUBSTUDY_ID); assertEquals(SUBSTUDY_ID, extId.getSubstudyId()); <START> assertEquals(1, account.getAccountSubstudies().size()); <END> AccountSubstudy acctSubstudy = Iterables.getFirst(account.getAccountSubstudies(), null); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, acctSubstudy.getStudyId()); assertEquals(ID, acctSubstudy.getExternalId()); assertEquals(SUBSTUDY_ID, acctSubstudy.getSubstudyId()); verify(externalIdDao).createExternalId(extId); verify(accountDao).updateAccount(account, null); }</code><technical_language>verify set external ID account</technical_language>

Target:
public void migrateExternalIdentifier() throws Exception { when(substudyService.getSubstudy(TestConstants.TEST_STUDY, SUBSTUDY_ID, true)) .thenReturn(Substudy.create()); ExternalIdentifier extId = ExternalIdentifier.create(TestConstants.TEST_STUDY, ID); when(externalIdDao.getExternalId(TestConstants.TEST_STUDY, ID)) .thenReturn(extId); Account account = Account.create(); account.setId(USER_ID); AccountId accountId = AccountId.forExternalId(TestConstants.TEST_STUDY_IDENTIFIER, ID); when(accountDao.getAccount(accountId)).thenReturn(account); externalIdService.migrateExternalIdentifier(study, ID, SUBSTUDY_ID); assertEquals(SUBSTUDY_ID, extId.getSubstudyId()); assertEquals(1, account.getAccountSubstudies().size()); assertEquals(ID, account.getExternalId()); AccountSubstudy acctSubstudy = Iterables.getFirst(account.getAccountSubstudies(), null); assertEquals(TestConstants.TEST_STUDY_IDENTIFIER, acctSubstudy.getStudyId()); assertEquals(ID, acctSubstudy.getExternalId()); assertEquals(SUBSTUDY_ID, acctSubstudy.getSubstudyId()); verify(externalIdDao).createExternalId(extId); verify(accountDao).updateAccount(account, null); }
Source:
<code>public void setup() { <START> NoopApiReporter apiReporter = new NoopApiReporter(); <END> manager = new CoreQueryManager(Features.empty(), async, cluster, parser, queryCache, aggregations, OptionalLimit.empty(), apiReporter); }</code><technical_language>a mock</technical_language>

Target:
public void setup() { ApiReporter apiReporter = mock(ApiReporter.class); long smallQueryThreshold = 0; manager = new CoreQueryManager(Features.empty(), async, cluster, parser, queryCache, aggregations, OptionalLimit.empty(), smallQueryThreshold, apiReporter); }
Source:
<code>public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException { String cmd = getGDBPath(configuration).toOSString() + " --version"; Process process = null; try { process = ProcessFactory.getFactory().exec(cmd, getLaunchEnvironment(configuration)); String streamOutput = readStreamForVersion(process, true); String gdbVersion = getGDBVersionFromText(streamOutput); if (gdbVersion == null || gdbVersion.isEmpty()) { Exception detailedException = null; if (!streamOutput.isEmpty()) { detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); } else { streamOutput = readStreamForVersion(process, false); if (!streamOutput.isEmpty()) { detailedException = new Exception(streamOutput); } } throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, <START> "Could not determine GDB version after sending: " + cmd, END> detailedException)); } return gdbVersion; } catch (IOException e) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error while launching command: " + cmd, e)); } finally { if (process != null) { process.destroy(); } } }</code><technical_language>I "sending" is right word here. "launching" consistent other message? sound: "Could determine GDB version launching command:"</technical_language>

Target:
public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException { String cmd = getGDBPath(configuration).toOSString() + " --version"; Process process = null; Job timeoutJob = null; try { process = ProcessFactory.getFactory().exec(cmd, getLaunchEnvironment(configuration)); final Process finalProc = process; timeoutJob = new Job("GDB version timeout job") { { setSystem(true); } @Override protected IStatus run(IProgressMonitor arg) { finalProc.destroy(); return Status.OK_STATUS; } }; timeoutJob.schedule(10000); String streamOutput = readStream(process.getInputStream()); String gdbVersion = getGDBVersionFromText(streamOutput); if (gdbVersion == null || gdbVersion.isEmpty()) { Exception detailedException = null; if (!streamOutput.isEmpty()) { detailedException = new Exception("Unexpected output format: \n\n" + streamOutput); } else { streamOutput = readStream(process.getErrorStream()); if (!streamOutput.isEmpty()) { detailedException = new Exception(streamOutput); } } throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Could not determine GDB version using command: " + cmd, detailedException)); } return gdbVersion; } catch (IOException e) { throw new DebugException(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, DebugException.REQUEST_FAILED, "Error with command: " + cmd, e)); } finally { if (timeoutJob != null) { timeoutJob.cancel(); } if (process != null) { process.destroy(); } } }
Source:
<code>public String extractGender(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7Parser201305Utils.ExtractGender method..."); String genderCode = null; if (CollectionUtils.isNotEmpty(params.getLivingSubjectAdministrativeGender()) <START> && params.getLivingSubjectAdministrativeGender().get(0) != null) { <END> PRPAMT201306UV02LivingSubjectAdministrativeGender gender = params.getLivingSubjectAdministrativeGender() .get(0); if (CollectionUtils.isNotEmpty(gender.getValue()) && gender.getValue().get(0) != null) { CE administrativeGenderCode = gender.getValue().get(0); LOG.info("Found gender in query parameters = " + administrativeGenderCode.getCode()); genderCode = administrativeGenderCode.getCode(); } else { LOG.info("query does not contain a gender code"); } } else { LOG.info("query does not contain a gender code"); } LOG.trace("Exiting HL7Parser201305Utils.ExtractGender method..."); return genderCode; }</code><technical_language>Sound checking params.getLivingSubjectAdministrativeGender().get(0) != null is redundancy calling CollectionUtils.isNotEmpty(params.getLivingSubjectAdministrativeGender())</technical_language>

Target:
public String extractGender(PRPAMT201306UV02ParameterList params) { LOG.trace("Entering HL7Parser201305Utils.ExtractGender method..."); String genderCode = null; if (CollectionUtils.isNotEmpty(params.getLivingSubjectAdministrativeGender())) { PRPAMT201306UV02LivingSubjectAdministrativeGender gender = params.getLivingSubjectAdministrativeGender() .get(0); if (CollectionUtils.isNotEmpty(gender.getValue()) && gender.getValue().get(0) != null) { CE administrativeGenderCode = gender.getValue().get(0); LOG.info("Found gender in query parameters = ", administrativeGenderCode.getCode()); genderCode = administrativeGenderCode.getCode(); } else { LOG.info("query does not contain a gender code"); } } else { LOG.info("query does not contain a gender code"); } LOG.trace("Exiting HL7Parser201305Utils.ExtractGender method..."); return genderCode; }
Source:
<code>public void testIsInternalClass() { assertTrue(DataTypeUtils.isInternal(DataTypes.INT())); assertTrue(DataTypeUtils.isInternal(DataTypes.INT().notNull().bridgedTo(int.class))); assertTrue(DataTypeUtils.isInternal(DataTypes.ROW().bridgedTo(RowData.class))); <START> assertTrue(DataTypeUtils.isInternal(DataTypes.ROW().bridgedTo(RowData.class))); <END> assertFalse(DataTypeUtils.isInternal(DataTypes.ROW())); }</code><technical_language>Duplicated row... StructuredType chance</technical_language>

Target:
public void testIsInternalClass() { assertTrue(DataTypeUtils.isInternal(DataTypes.INT())); assertTrue(DataTypeUtils.isInternal(DataTypes.INT().notNull().bridgedTo(int.class))); assertTrue(DataTypeUtils.isInternal(DataTypes.ROW().bridgedTo(RowData.class))); assertFalse(DataTypeUtils.isInternal(DataTypes.ROW())); }
Source:
<code>protected boolean canDoAction() { boolean retValue = true; if (disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } retValue = retValue && (disk.getDiskStorageType() != DiskStorageType.IMAGE || canRemoveDiskBasedOnImageStorageCheck()); <START> <END> if (retValue) { buildSharedLockMap(); retValue = acquireLockInternal(); } return retValue; }</code><technical_language>luck of understanding of locking mechanism</technical_language>

Target:
protected boolean canDoAction() { boolean retValue = true; if (disk == null) { retValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_VM_IMAGE_DOES_NOT_EXIST); } if (retValue) { buildSharedLockMap(); retValue = acquireLockInternal(); } retValue = retValue && (disk.getDiskStorageType() != DiskStorageType.IMAGE || canRemoveDiskBasedOnImageStorageCheck()); return retValue; }
Source:
<code>public void setValue(String str) { <START> this.string = str; <END> }</code><technical_language>.. accessing class need "this." for example fString = string this.string = string</technical_language>

Target:
public void setValue(String str) { fString = str; }
Source:
<code>private VdcReturnValueBase removeCinderDisk(Guid cinderDiskId, Guid storageDomainId) { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, buildChildCommandParameters(cinderDiskId), null, new SubjectEntity(VdcObjectType.Storage, storageDomainId)); try { return future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Fail to revert disk id '{}'", cinderDiskId); <START> e.printStackTrace(); <END> return null; } }</code><technical_language>meant log.error("Exception: ", e);</technical_language>

Target:
private void removeCinderDisk(Guid cinderDiskId, Guid storageDomainId) { Future<VdcReturnValueBase> future = CommandCoordinatorUtil.executeAsyncCommand( VdcActionType.RemoveCinderDisk, buildChildCommandParameters(cinderDiskId), null, new SubjectEntity(VdcObjectType.Storage, storageDomainId)); try { future.get(); } catch (InterruptedException | ExecutionException e) { log.error("Fail to revert disk id '{}'.", cinderDiskId); log.error("Exception: ", e); } }
Source:
<code>public ModulePath resolveJsModule( String moduleAddress, String sourcename, int lineno, int colno) { String loadAddress = null; switch (resolutionMode) { case LEGACY: <START> loadAddress = resolveJsModuleFile(moduleAddress); <END> break; case BROWSER: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFile(moduleAddress); } break; case NODE: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFileOrDirectory(moduleAddress); } else { loadAddress = resolveJsModuleFromRegistry(moduleAddress); } break; } if (loadAddress != null) { return new ModulePath(loadAddress); } if (errorHandler != null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, LOAD_WARNING, moduleAddress)); } return null; }</code><technical_language>@ChadKillingsworth, expect LEGACY preserve behavior prior this change, this is not. I I change this if/else statement above</technical_language>

Target:
public ModulePath resolveJsModule( String moduleAddress, String sourcename, int lineno, int colno) { String loadAddress = null; switch (resolutionMode) { case LEGACY: loadAddress = resolveJsModuleLegacy(moduleAddress, sourcename, lineno, colno); break; case BROWSER: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFile(moduleAddress); } break; case NODE: if (isAbsoluteIdentifier(moduleAddress) || isRelativeIdentifier(moduleAddress)) { loadAddress = resolveJsModuleFileOrDirectory(moduleAddress); } else { loadAddress = resolveJsModuleFromRegistry(moduleAddress); } break; } if (loadAddress != null) { return new ModulePath(loadAddress); } if (errorHandler != null) { errorHandler.report( CheckLevel.WARNING, JSError.make(sourcename, lineno, colno, LOAD_WARNING, moduleAddress)); } return null; }
Source:
<code>private void setBackgroundImage(Path filepath) { Image image; <START> if (filepath != null && !filepath.toString().isEmpty()) { <END> image = noCatch(() -> new Image(filepath.toUri().toURL().toExternalForm())); mainRoot.setBackground(new Background(new BackgroundImage( image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT ))); } }</code><technical_language>else overwrite a user remove image</technical_language>

Target:
private void setBackgroundImage(Path filepath) { Image image; if (filepath != null && Files.exists(filepath)) { image = noCatch(() -> new Image(filepath.toUri().toURL().toExternalForm())); mainRoot.setBackground(new Background(new BackgroundImage( image, BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, BackgroundSize.DEFAULT ))); } else { mainRoot.setBackground(EMPTY); } }
Source:
<code>public void shouldSetTempImagesPathAsCompleteDirectory() { URI path = URI.create("/pages/newImagesTemp/"); ConfigCore.setImagesPath(URI.create("/pages/newImagesTemp/")); <START> System.out.println(ConfigCore.getTempImagesPathAsCompleteDirectory()); <END> assertEquals("Temp images path was set incorrectly!", path, URI.create("/pages/newImagesTemp/")); }</code><technical_language>add this System.out.println() call? a logger is a solution</technical_language>

Target:
public void shouldSetTempImagesPathAsCompleteDirectory() { URI path = URI.create("/pages/newImagesTemp/"); ConfigCore.setImagesPath(URI.create("/pages/newImagesTemp/")); assertEquals("Temp images path was set incorrectly!", path, URI.create("/pages/newImagesTemp/")); }
Source:
<code>@Override public RuntimeTestResultSummary runTest( Object objectUnderTest ) { try { hadoopConfigurationBootstrap.getProvider(); String activeConfigurationId = hadoopConfigurationBootstrap.getActiveConfigurationId(); return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.INFO, messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_DESC, activeConfigurationId ), messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_MESSAGE, activeConfigurationId ), ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( NoShimSpecifiedException e ) { <START> e.printStackTrace(); <END> return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_NO_SHIM_SPECIFIED_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( ConfigurationException e ) { e.printStackTrace(); return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_UNABLE_TO_LOAD_SHIM_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } }</code><technical_language>printstacktrace? logger using? This place logs exceptions end of tests - <LINK_0> print exception detailed level set</technical_language>

Target:
@Override public RuntimeTestResultSummary runTest( Object objectUnderTest ) { try { hadoopConfigurationBootstrap.getProvider(); String activeConfigurationId = hadoopConfigurationBootstrap.getActiveConfigurationId(); return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.INFO, messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_DESC, activeConfigurationId ), messageGetter.getMessage( TEST_SHIM_LOAD_SHIM_LOADED_MESSAGE, activeConfigurationId ), ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( NoShimSpecifiedException e ) { return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_NO_SHIM_SPECIFIED_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } catch ( ConfigurationException e ) { return new RuntimeTestResultSummaryImpl( new ClusterRuntimeTestEntry( messageGetterFactory, RuntimeTestEntrySeverity.ERROR, messageGetter.getMessage( TEST_SHIM_LOAD_UNABLE_TO_LOAD_SHIM_DESC ), e.getMessage(), e, ClusterRuntimeTestEntry.DocAnchor.SHIM_LOAD ) ); } }
Source:
<code>public static Object getFor(int status, Request request, Response response) { Object customRenderer = CustomErrorPages.getInstance().customPages.get(status); Object customPage; if (customRenderer instanceof String) { customPage = customRenderer; <START> } else { <END> try { customPage = ((Route) customRenderer).handle(request, response); } catch (Exception e) { customPage = status == 400 ? NOT_FOUND : INTERNAL_ERROR; } } return customPage; }</code><technical_language>Change if(customRenderer instanceof Route)</technical_language>

Target:
public static Object getFor(int status, Request request, Response response) { Object customRenderer = CustomErrorPages.getInstance().customPages.get(status); Object customPage; customPage = status == 400 ? NOT_FOUND : INTERNAL_ERROR; if (customRenderer instanceof String) { customPage = customRenderer; } else if (customRenderer instanceof Route) { try { customPage = ((Route) customRenderer).handle(request, response); } catch (Exception e) { } } return customPage; }
Source:
<code>public void onTaskComplete(int taskTag, int resultCode) { if (resultCode == TaskFragment.STATUS_OK) { if (taskTag == DATABASE_RESYNC_TASK) { mDbResyncing = false; refreshChapterCards(); } else if (taskTag == COMPILE_CHAPTER_TASK) { ProjectDatabaseHelper db = new ProjectDatabaseHelper(ActivityChapterList.this); for (int i : mChaptersCompiled) { mAdapter.notifyItemChanged(i); <START> db.setCheckingLevel(mProject, i + 1, 0); <END> } } } }</code><technical_language>If affect anything, this is fine. I thought want set checking level notifying change</technical_language>

Target:
public void onTaskComplete(int taskTag, int resultCode) { if (resultCode == TaskFragment.STATUS_OK) { if (taskTag == DATABASE_RESYNC_TASK) { mDbResyncing = false; refreshChapterCards(); } else if (taskTag == COMPILE_CHAPTER_TASK) { ProjectDatabaseHelper db = new ProjectDatabaseHelper(ActivityChapterList.this); for (int i : mChaptersCompiled) { db.setCheckingLevel(mProject, i + 1, 0); mAdapter.notifyItemChanged(i); } } } }
Source:
<code>public void init(final SamlDeployment deployment, final ResourceLoader loader, final Properties config) { <START> String path = DEFAULT_LOCATION; <END> if (config.getProperty(PROPERTIES_LOCATION) != null) { path = config.getProperty(PROPERTIES_LOCATION); } InputStream is = loader.getResourceAsStream(path); this.roleMappings = new Properties(); boolean loaded = false; try { this.roleMappings.load(is); loaded = true; if (logger.isDebugEnabled()) { logger.debugf("Resource loader successfully loaded role mappings from %s", path); } } catch(Exception e) { if (logger.isDebugEnabled()) { logger.debugv(e, "Resource loader unable to load role mappings from %s", path); } } if (!loaded && !DEFAULT_LOCATION.equals(path)) { File file = new File(path); if (file.exists()) { try { this.roleMappings.load(new FileInputStream(file)); if (logger.isDebugEnabled()) { logger.debugf("Successfully loaded role mappings from %s", path); } } catch(Exception e) { if (logger.isDebugEnabled()) { logger.debugv(e, "Unable to load role mappings from %s", path); } } } else { if (logger.isDebugEnabled()) { logger.debugf("Unable to load role mappings from %s: file does not exist in filesystem", path); } } } }</code><technical_language>suggestion String path = config.getProperty(PROPERTIES_LOCATION, DEFAULT_LOCATION);</technical_language>

Target:
public void init(final SamlDeployment deployment, final ResourceLoader loader, final Properties config) { this.roleMappings = new Properties(); String path = config.getProperty(PROPERTIES_FILE_LOCATION); if (path != null) { File file = new File(path); if (file.exists()) { try { this.roleMappings.load(new FileInputStream(file)); logger.debugf("Successfully loaded role mappings from %s", path); } catch (Exception e) { logger.debugv(e, "Unable to load role mappings from %s", path); } } else { throw new RuntimeException("Unable to load role mappings from " + path + ": file does not exist in filesystem"); } } else { path = config.getProperty(PROPERTIES_RESOURCE_LOCATION, DEFAULT_RESOURCE_LOCATION); InputStream is = loader.getResourceAsStream(path); if (is != null) { try { this.roleMappings.load(is); logger.debugf("Resource loader successfully loaded role mappings from %s", path); } catch (Exception e) { logger.debugv(e, "Resource loader unable to load role mappings from %s", path); } } else { throw new RuntimeException("Unable to load role mappings from " + path + ": file does not exist in the resource"); } } }
Source:
<code>public void evaluate_shouldReturnAllPatientsTakingAnyDrugWithinADateRange() throws Exception { cohortDefinition.setActivatedOnOrAfter(DateUtil.getDateTime(2008, 8, 1)); cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 8)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); <START> System.out.println("Taking Drugs in date range " + cohort.getMemberIds() + " " + cohortDefinition); <END> Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(7)); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(3, cohort.size()); }</code><technical_language>a this? <LINK_0></technical_language>

Target:
public void evaluate_shouldReturnAllPatientsTakingAnyDrugWithinADateRange() throws Exception { cohortDefinition.setActivatedOnOrAfter(DateUtil.getDateTime(2008, 8, 1)); cohortDefinition.setActivatedOnOrBefore(DateUtil.getDateTime(2008, 8, 8)); Cohort cohort = Context.getService(CohortDefinitionService.class).evaluate(cohortDefinition, null); Assert.assertTrue(cohort.contains(2)); Assert.assertTrue(cohort.contains(7)); Assert.assertTrue(cohort.contains(8)); Assert.assertTrue(cohort.contains(21)); Assert.assertTrue(cohort.contains(22)); Assert.assertEquals(5, cohort.size()); }
Source:
<code>protected int run(List<String> nonFlagArgs) throws Exception { final Random random = new Random(System.currentTimeMillis()); final List<String> nameDictionary = loadNameDictionary(mNameDictionaryFilename); final WordSynthesizer nameSynth = new WordSynthesizer(random, nameDictionary); final NGramSynthesizer fullNameSynth = new NGramSynthesizer(nameSynth, 2); final EmailSynthesizer emailSynth = new EmailSynthesizer(random, nameDictionary); getPrintStream().printf("Generating %d users on kiji table '%s'...%n", mNumUsers, mTableURI); final KijiTableWriter tableWriter = mTable.openTableWriter(); try { for (int iuser = 0; iuser < mNumUsers; iuser++) { final String fullName = fullNameSynth.synthesize(); final String email = EmailSynthesizer.formatEmail(fullName.replace(" ", "."), emailSynth.synthesizeDomain()); final EntityId entityId = mTable.getEntityId(email); tableWriter.put(entityId, "info", "name", fullName); tableWriter.put(entityId, "info", "email", email); if (iuser % 1000 == 0) { getPrintStream().printf("%d rows synthesized...%n", iuser); } } } finally { tableWriter.close(); } getPrintStream().printf("%d rows synthesized...%n", mNumUsers); getPrintStream().println("Done."); <START> return 0; END> }</code><technical_language>SUCCESS</technical_language>

Target:
protected int run(List<String> nonFlagArgs) throws Exception { final Random random = new Random(System.currentTimeMillis()); final List<String> nameDictionary = loadNameDictionary(mNameDictionaryFilename); final WordSynthesizer nameSynth = new WordSynthesizer(random, nameDictionary); final NGramSynthesizer fullNameSynth = new NGramSynthesizer(nameSynth, 2); final EmailSynthesizer emailSynth = new EmailSynthesizer(random, nameDictionary); getPrintStream().printf("Generating %d users on kiji table '%s'...%n", mNumUsers, mTableURI); final KijiTableWriter tableWriter = mTable.openTableWriter(); try { for (int iuser = 0; iuser < mNumUsers; iuser++) { final String fullName = fullNameSynth.synthesize(); final String email = EmailSynthesizer.formatEmail(fullName.replace(" ", "."), emailSynth.synthesizeDomain()); final EntityId entityId = mTable.getEntityId(email); tableWriter.put(entityId, "info", "name", fullName); tableWriter.put(entityId, "info", "email", email); if (iuser % 1000 == 0) { getPrintStream().printf("%d rows synthesized...%n", iuser); } } } finally { tableWriter.close(); } getPrintStream().printf("%d rows synthesized...%n", mNumUsers); getPrintStream().println("Done."); return SUCCESS; }
Source:
<code>public void testMulticast(Bootstrap sb, Bootstrap cb) throws Throwable { <START> sb.option(EpollChannelOption.IP_RECVORIGDSTADDR, true); <END> super.testMulticast(sb, cb); sb.option(EpollChannelOption.IP_RECVORIGDSTADDR, false); }</code><technical_language>explain</technical_language>

Target:
public void testMulticast(Bootstrap sb, Bootstrap cb) throws Throwable { super.testMulticast(sb, cb); }
Source:
<code>public static FlattrService getService(AccessToken token) { <START> if (flattrService == null) { <END> flattrService = FlattrFactory.getInstance().createFlattrService(token); } return flattrService; }</code><technical_language>needs synchronized, it</technical_language>

Target:
public synchronized static FlattrService getService(AccessToken token) { if (flattrService == null) { flattrService = FlattrFactory.getInstance().createFlattrService(token); } return flattrService; }
Source:
<code>public StudyParticipant getSelfParticipant(Study study, CriteriaContext context, boolean includeHistory) { <START> AccountId accountId = AccountId.forId(study.getIdentifier(), context.getUserId()); <END> Account account = getAccountThrowingException(accountId); StudyParticipant.Builder builder = new StudyParticipant.Builder(); SubstudyAssociations assoc = BridgeUtils.substudyAssociationsVisibleToCaller(account.getAccountSubstudies()); addAccount(builder, assoc, account); addConsentStatus(builder, account, context); if (includeHistory) { addHistory(builder, account, context); } return builder.build(); }</code><technical_language>unit tests for getSelfParticipant</technical_language>

Target:
public StudyParticipant getSelfParticipant(Study study, CriteriaContext context, boolean includeHistory) { AccountId accountId = AccountId.forId(study.getIdentifier(), context.getUserId()); Account account = getAccountThrowingException(accountId); StudyParticipant.Builder builder = new StudyParticipant.Builder(); SubstudyAssociations assoc = BridgeUtils.substudyAssociationsVisibleToCaller(account.getAccountSubstudies()); addAccount(builder, assoc, account); addConsentStatus(builder, account, context); if (includeHistory) { addHistory(builder, account, context.getStudyIdentifier()); } return builder.build(); }
Source:
<code><START> public void check(File file) throws AppException { <END> File[] files = file.listFiles(); Arrays.sort(files); if (files == null) { throw new AppException("Contest archive file is invalid."); } boolean hasContestInfo = false; Character nextProblemAlias = 'A'; for (File current : files) { if ("contestInfo.xml".equals(current.getName())) { hasContestInfo = true; } else if (current.isDirectory()) { if (!nextProblemAlias.toString().equals(current.getName())) { throw new AppException("Wrong problem alias."); } File[] filesInSubDirectory = current.listFiles(); checkProblemSubDirectory(filesInSubDirectory); nextProblemAlias ++; } else { throw new AppException("Contest information directory contains unknown type files."); } } if (!hasContestInfo) { throw new AppException("Contest archive has not contest information!"); } }</code><technical_language>check file is null. AppExceptionUtil.assertNotNull</technical_language>

Target:
public void check(File file) throws AppException { AppExceptionUtil.assertNotNull(file); File[] files = file.listFiles(); Arrays.sort(files); boolean hasContestInfo = false; for (File current : files) { if ("contestInfo.xml".equals(current.getName())) { hasContestInfo = true; } else if (current.isDirectory()) { checkProblemSubDirectory(current); } else { throw new AppException("Contest information directory contains unknown type files."); } } if (!hasContestInfo) { throw new AppException("Contest archive has not contest information!"); } }
Source:
<code>public void swaptionNegativeStrike() { double prIrs2Neg = IRS_R_2.accept(PRDC, MULTICURVE_NEG); MultipleCurrencyAmount pvIrs2Neg = IRS_R_2.accept(PVDC, MULTICURVE_NEG); MultipleCurrencyAmount pvSwpt2NegNorm = SWPT_R_L_2.accept(PVNSC, MULTICURVE_NEG_NORMAL); MultipleCurrencyParameterSensitivity pvcsIrs2Neg = MQSBDC.fromInstrument(IRS_R_2, MULTICURVE_NEG, BLOCK_STD).multipliedBy(BP1); MultipleCurrencyParameterSensitivity pvcsSwpt2NegNorm = MQSBNSC.fromInstrument(SWPT_R_L_2, MULTICURVE_NEG_NORMAL, BLOCK_STD).multipliedBy(BP1); PresentValueSwaptionSurfaceSensitivity pvvs2NegNorm = METHOD_SWPT_NORMAL.presentValueVolatilitySensitivity(SWPT_R_L_2, MULTICURVE_NEG_NORMAL); PresentValueSwaptionSurfaceSensitivity pvnns = SSSNC.calculateNodeSensitivities(pvvs2NegNorm, MULTICURVE_NEG_NORMAL); <START> int t = 0; <END> }</code><technical_language>Remove this variable</technical_language>

Target:
public void swaptionNegativeStrike() { double prIrs2Neg = IRS_R_2.accept(PRDC, MULTICURVE_NEG); MultipleCurrencyAmount pvIrs2Neg = IRS_R_2.accept(PVDC, MULTICURVE_NEG); MultipleCurrencyAmount pvSwpt2NegNorm = SWPT_R_L_2.accept(PVNSC, MULTICURVE_NEG_NORMAL); MultipleCurrencyParameterSensitivity pvcsIrs2Neg = MQSBDC.fromInstrument(IRS_R_2, MULTICURVE_NEG, BLOCK_STD).multipliedBy(BP1); MultipleCurrencyParameterSensitivity pvcsSwpt2NegNorm = MQSBNSC.fromInstrument(SWPT_R_L_2, MULTICURVE_NEG_NORMAL, BLOCK_STD).multipliedBy(BP1); PresentValueSwaptionSurfaceSensitivity pvvs2NegNorm = METHOD_SWPT_NORMAL.presentValueVolatilitySensitivity(SWPT_R_L_2, MULTICURVE_NEG_NORMAL); PresentValueSwaptionSurfaceSensitivity pvnns = SSSNC.calculateNodeSensitivities(pvvs2NegNorm, MULTICURVE_NEG_NORMAL); }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + (id == null ? 0 : id.hashCode()); <START> return result; <END> }</code><technical_language>return (id == null ? 0 : id.hashCode());</technical_language>

Target:
public int hashCode() { return id.hashCode(); }
Source:
<code>private void optionDecl() throws QueryException { skipWS(); final QNm name = eQName(QNAMEINV, URICHECK); final byte[] val = stringLiteral(); if(ctx.sc.xquery3() && eq(name.prefix(), OUTPUT)) { final String key = string(name.local()); if(module != null) error(MODOUT); if(ctx.serProp == null) ctx.serProp = new SerializerProp(); if(ctx.serProp.get(key) == null) error(OUTWHICH, key); if(serial.contains(key)) error(OUTDUPL, key); ctx.serProp.set(key, string(val)); serial.add(key); } else if(eq(name.prefix(), DB)) { final String key = string(uc(name.local())); final Object obj = ctx.context.prop.get(key); if(obj == null) error(BASX_OPTIONS, key); ctx.globalOpt.put(key, obj); ctx.dbOptions.add(key); ctx.dbOptions.add(string(val)); <START> } else if(eq(name.prefix(), QUERY)) { <END> if(eq(name.local(), READ_LOCK)) for (String lock : string(val).split("\\s*,\\s*")) ctx.userReadLocks.add(DBLocking.USER_PREFIX + lock); else if(eq(name.local(), WRITE_LOCK)) { for (String lock : string(val).split("\\s*,\\s*")) ctx.userWriteLocks.add(DBLocking.USER_PREFIX + lock); } else error(BASX_OPTIONS, string(name.local())); } }</code><technical_language>This compare URIs, prefixes</technical_language>

Target:
private void optionDecl() throws QueryException { skipWS(); final QNm name = eQName(QNAMEINV, URICHECK); final byte[] val = stringLiteral(); if(ctx.sc.xquery3() && eq(name.uri(), OUTPUTURI)) { final String key = string(name.local()); if(module != null) error(MODOUT); if(ctx.serProp == null) ctx.serProp = new SerializerProp(); if(ctx.serProp.get(key) == null) error(OUTWHICH, key); if(serial.contains(key)) error(OUTDUPL, key); ctx.serProp.set(key, string(val)); serial.add(key); } else if(eq(name.uri(), DBURI)) { final String key = string(uc(name.local())); final Object obj = ctx.context.prop.get(key); if(obj == null) error(BASX_OPTIONS, key); ctx.globalOpt.put(key, obj); ctx.dbOptions.add(key); ctx.dbOptions.add(string(val)); } else if(eq(name.uri(), QUERYURI)) { if(eq(name.local(), READ_LOCK)) for (String lock : string(val).split("\\s*,\\s*")) ctx.userReadLocks.add(DBLocking.USER_PREFIX + lock); else if(eq(name.local(), WRITE_LOCK)) { for (String lock : string(val).split("\\s*,\\s*")) ctx.userWriteLocks.add(DBLocking.USER_PREFIX + lock); } else error(BASX_OPTIONS, string(name.local())); } }
Source:
<code><START> HttpResponse doGetContent(String spaceId, String contentId, Long startByte, Long endByte) <END> throws ContentStoreException { String task = "get content"; String url = buildContentURL(spaceId, contentId); try { final boolean hasRange = !(startByte == 0l && endByte == null); final HttpResponse response; if (!hasRange) { response = restHelper.get(url); } else { Map<String, String> headers = new HashMap<>(); headers.put("Range", "bytes=" + startByte + "-" + (endByte != null ? endByte : "")); response = restHelper.get(url, headers); } checkResponse(response, hasRange ? HttpStatus.SC_PARTIAL_CONTENT : HttpStatus.SC_OK); return response; } catch (NotFoundException e) { throw new NotFoundException(task, spaceId, contentId, e); } catch (UnauthorizedException e) { throw new UnauthorizedException(task, spaceId, contentId, e); } catch (Exception e) { throw new ContentStoreException(task, spaceId, contentId, e); } }</code><technical_language>explicit scope suggestion protected HttpResponse doGetContent(String spaceId, String contentId, Long startByte, Long endByte)</technical_language>

Target:
protected HttpResponse doGetContent(String spaceId, String contentId, Long startByte, Long endByte) throws ContentStoreException { String task = "get content"; String url = buildContentURL(spaceId, contentId); try { final boolean hasRange = !(startByte == 0l && endByte == null); final HttpResponse response; if (!hasRange) { response = restHelper.get(url); } else { Map<String, String> headers = new HashMap<>(); headers.put("Range", "bytes=" + startByte + "-" + (endByte != null ? endByte : "")); response = restHelper.get(url, headers); } checkResponse(response, hasRange ? HttpStatus.SC_PARTIAL_CONTENT : HttpStatus.SC_OK); return response; } catch (NotFoundException e) { throw new NotFoundException(task, spaceId, contentId, e); } catch (UnauthorizedException e) { throw new UnauthorizedException(task, spaceId, contentId, e); } catch (Exception e) { throw new ContentStoreException(task, spaceId, contentId, e); } }
Source:
<code>public void setRetryAnalyzerClass(Class<? extends IRetryAnalyzer> clazz) { m_retryAnalyzerClass = clazz; <START> if (isRetryAnalyzerNotTestNGInjected(clazz)) { <END> m_retryAnalyzer = ClassHelper.newInstance(clazz); } }</code><technical_language>If remove condition, retry analyzer instance null. Better: DisabledRetryAnalyzer default if clazz == null null is important</technical_language>

Target:
public void setRetryAnalyzerClass(Class<? extends IRetryAnalyzer> clazz) { m_retryAnalyzerClass = clazz == null ? DisabledRetryAnalyzer.class : clazz; m_retryAnalyzer = ClassHelper.newInstance(m_retryAnalyzerClass); }
Source:
<code>protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (root != null) { return root; } root = new DiffNode(Differencer.NO_CHANGE); for (IReviewItem item : items.getItems()) { if (!(item instanceof IFileItem)) { continue; <START> } else if (item instanceof IFileItem && ((IFileItem) item).getBase().getContent() != null) { <END> FileItemNode node = new FileItemNode(behavior, (IFileItem) item, monitor); DiffNode parent = findNode(root, node.getPath()); parent.add(node); } } for (IDiffElement child : root.getChildren()) { if (child instanceof FileItemNode) { flattenTree((FileItemNode) child); } } return root; }</code><technical_language>line 61 'continue' need 'else if' - "if", "item instanceof IFileItem" part (since established in line 60). add "IFileItem fileItem = (IFileItem) item;" this "if" need casting in "if" line 63</technical_language>

Target:
protected Object prepareInput(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { if (root != null) { return root; } root = new DiffNode(Differencer.NO_CHANGE); for (IReviewItem item : items.getItems()) { if (!(item instanceof IFileItem)) { continue; } IFileItem fileItem = (IFileItem) item; if (fileItem.getBase().getContent() != null) { FileItemNode node = new FileItemNode(behavior, fileItem, monitor); DiffNode parent = findNode(root, node.getPath()); parent.add(node); } } for (IDiffElement child : root.getChildren()) { if (child instanceof FileItemNode) { flattenTree((FileItemNode) child); } } return root; }
Source:
<code>public void shouldReturnEmptyListWhenWrongLookupNameForProgramEnrollment() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_DEFAULT_NAME); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, "wrongLookupName", lookupFields); assertTrue(object instanceof ProgramEnrollmentListResult); ProgramEnrollmentListResult actual = (ProgramEnrollmentListResult) object; <START> assertEquals(0, actual.getResults().size()); <END> verifyZeroInteractions(programEnrollmentService); }</code><technical_language>check if list of results is empty property ('numberOfPrograms') returns 0</technical_language>

Target:
public void shouldReturnEmptyListWhenWrongLookupNameForProgramEnrollment() { String className = ProgramEnrollment.class.getSimpleName(); Map<String, String> lookupFields = new HashMap<>(); lookupFields.put(PATIENT_UUID, DEFAULT_UUID); lookupFields.put(PROGRAM_NAME, PROGRAM_DEFAULT_NAME); Object object = taskDataProvider.lookup(className + '-' + CONFIG_NAME, "wrongLookupName", lookupFields); assertTrue(object instanceof ProgramEnrollmentListResult); ProgramEnrollmentListResult actual = (ProgramEnrollmentListResult) object; assertTrue(actual.getResults().isEmpty()); assertEquals(0, actual.getNumberOfPrograms()); verifyZeroInteractions(programEnrollmentService); }
Source:
<code>public void handleMemoryChange(BigInteger address) { <START> int addressesLength = fLength/fWordSize; <END> BigInteger fEndAddress = fBlockAddress.add(BigInteger.valueOf(addressesLength)); if (address.equals(BigInteger.ZERO) || ((fBlockAddress.compareTo(address) != 1) && (fEndAddress.compareTo(address) == 1))) { DebugEvent debugEvent = new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT); DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent }); } }</code><technical_language>I fWordSize directly. getAddressableSize() done in case overridden</technical_language>

Target:
public void handleMemoryChange(BigInteger address) { int addressableSize; try { addressableSize = getAddressableSize(); } catch (DebugException e) { addressableSize = 1; } int addressesLength = fLength/addressableSize; BigInteger fEndAddress = fBlockAddress.add(BigInteger.valueOf(addressesLength)); if (address.equals(BigInteger.ZERO) || ((fBlockAddress.compareTo(address) != 1) && (fEndAddress.compareTo(address) == 1))) { DebugEvent debugEvent = new DebugEvent(this, DebugEvent.CHANGE, DebugEvent.CONTENT); DebugPlugin.getDefault().fireDebugEventSet(new DebugEvent[] { debugEvent }); } }
Source:
<code>public void testUnits() { <START> <END> QuantityType<Length> dt2 = (QuantityType<Length>) QuantityType.valueOf("2m"); assertEquals(dt2.getDimension(), QuantityDimension.LENGTH); assertEquals(dt2.getUnit(), Units.METRE); assertEquals("2 m", dt2.toString()); QuantityType<Length> dt1 = new QuantityType<>("2.1cm"); assertEquals(dt1.getDimension(), QuantityDimension.LENGTH); assertEquals(dt1.getUnit(), tec.uom.se.unit.MetricPrefix.CENTI(Units.METRE)); assertEquals("2.1 cm", dt1.toString()); assertEquals(dt1.intValue(), dt2.intValue()); QuantityType<Length> dt3 = new QuantityType<Length>("200cm"); assertEquals(dt3.compareTo(dt2), 0); assertTrue(dt3.equals(dt2)); QuantityType dt4 = new QuantityType<>("2kg"); assertEquals("2 kg", dt4.toString()); assertFalse(dt2.equals(dt4)); try { dt2.compareTo(dt4); fail(); } catch (Exception e) { } }</code><technical_language>remove empty line</technical_language>

Target:
public void testUnits() { QuantityType<Length> dt2 = new QuantityType<>("2 m"); assertEquals(dt2.getDimension(), QuantityDimension.LENGTH); assertEquals(dt2.getUnit(), SIUnits.METRE); assertEquals("2 m", dt2.toString()); QuantityType<Length> dt1 = new QuantityType<>("2.1cm"); assertEquals(dt1.getDimension(), QuantityDimension.LENGTH); assertEquals(dt1.getUnit(), CENTI(SIUnits.METRE)); assertEquals("2.1 cm", dt1.toString()); assertEquals(dt1.intValue(), dt2.intValue()); QuantityType<Length> dt3 = new QuantityType<Length>("200cm"); assertEquals(dt3.compareTo(dt2), 0); assertTrue(dt3.equals(dt2)); QuantityType dt4 = new QuantityType<>("2kg"); assertEquals("2 kg", dt4.toString()); assertFalse(dt2.equals(dt4)); try { dt2.compareTo(dt4); fail(); } catch (Exception e) { } }
Source:
<code>private List<Product> getProductsByProductType(ProductType type, boolean getRefs) throws CatalogException { IndexSearcher searcher = null; List<Product> products = new Vector<Product>(); try { try { reader = DirectoryReader.open(indexDir); } catch (IOException e) { e.printStackTrace(); } searcher = new IndexSearcher(reader); Term productIdTerm = new Term("product_type_id", type .getProductTypeId()); org.apache.lucene.search.Query query = new TermQuery(productIdTerm); Sort sort = new Sort(new SortField("CAS.ProductReceivedTime", SortField.Type.STRING, true)); TopDocs check = searcher.search(query, 1, sort); if(check.totalHits>0) { TopDocs topDocs = searcher.search(query, check.totalHits, sort); ScoreDoc[] hits = topDocs.scoreDocs; if (hits.length > 0) { for (ScoreDoc hit : hits) { Document productDoc = searcher.doc(hit.doc); CompleteProduct prod = toCompleteProduct(productDoc, getRefs, false); products.add(prod.getProduct()); } } else { LOG.log(Level.FINEST, "Request for products by type: [" + type.getProductTypeId() + "] returned no results"); <START> return products; <END> } } } catch (IOException e) { LOG.log(Level.WARNING, "IOException when opening index directory: [" + indexFilePath + "] for search: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } finally { if (searcher != null) { try { } catch (Exception ignore) { } } } return products; }</code><technical_language>here. remove this line</technical_language>

Target:
private List<Product> getProductsByProductType(ProductType type, boolean getRefs) throws CatalogException { IndexSearcher searcher = null; List<Product> products = new Vector<Product>(); try { try { reader = DirectoryReader.open(indexDir); } catch (IOException e) { e.printStackTrace(); } searcher = new IndexSearcher(reader); Term productIdTerm = new Term("product_type_id", type .getProductTypeId()); org.apache.lucene.search.Query query = new TermQuery(productIdTerm); Sort sort = new Sort(new SortField("CAS.ProductReceivedTime", SortField.Type.STRING, true)); TopDocs check = searcher.search(query, 1, sort); if(check.totalHits>0) { TopDocs topDocs = searcher.search(query, check.totalHits, sort); ScoreDoc[] hits = topDocs.scoreDocs; if (hits.length > 0) { for (ScoreDoc hit : hits) { Document productDoc = searcher.doc(hit.doc); CompleteProduct prod = toCompleteProduct(productDoc, getRefs, false); products.add(prod.getProduct()); } } else { LOG.log(Level.FINEST, "Request for products by type: [" + type.getProductTypeId() + "] returned no results"); } } } catch (IOException e) { LOG.log(Level.WARNING, "IOException when opening index directory: [" + indexFilePath + "] for search: Message: " + e.getMessage()); throw new CatalogException(e.getMessage(), e); } finally { if (searcher != null) { try { } catch (Exception ignore) { } } } return products; }