auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void archiveHeadAllFilesTgzTimestamps() throws Exception { try (Git git = new Git(db)) { writeTrashFile("file_1.txt", "content_1_1"); git.add().addFilepattern("file_1.txt").call(); git.commit().setMessage("create file").call(); writeTrashFile("file_1.txt", "content_1_2"); writeTrashFile("file_2.txt", "content_2_2"); git.add().addFilepattern(".").call(); git.commit().setMessage("updated file").call(); File archive = new File(getTemporaryDirectory(), "archive.tgz"); git.archive().setOutputStream(new FileOutputStream(archive)) .setFormat("tgz") .setTree(git.getRepository().resolve("HEAD")).call(); <START> <END> try (InputStream fi = Files.newInputStream(archive.toPath()); InputStream bi = new BufferedInputStream(fi); InputStream gzi = new GzipCompressorInputStream(bi); ArchiveInputStream o = new TarArchiveInputStream(gzi)) { ArchiveEntry e; int n = 0; while ((e = o.getNextEntry()) != null) { n++; assertEquals( "expected lastModified mocked by MockSystemReader " + "truncated to 1 second", (1250379778668L / 1000L) * 1000L, e.getLastModifiedDate().getTime()); } assertEquals(UNEXPECTED_ARCHIVE_SIZE, 2, n); } } }</code><technical_language>test get hash of created archive, do hashes same</technical_language>

Target:
public void archiveHeadAllFilesTgzTimestamps() throws Exception { try (Git git = new Git(db)) { createTestContent(git); String fmt = "tgz"; File archive = new File(getTemporaryDirectory(), "archive." + fmt); archive(git, archive, fmt); ObjectId hash1 = ObjectId.fromRaw(IO.readFully(archive)); try (InputStream fi = Files.newInputStream(archive.toPath()); InputStream bi = new BufferedInputStream(fi); InputStream gzi = new GzipCompressorInputStream(bi); ArchiveInputStream o = new TarArchiveInputStream(gzi)) { assertEntries(o); } Thread.sleep(2000); archive(git, archive, fmt); assertEquals(UNEXPECTED_DIFFERENT_HASH, hash1, ObjectId.fromRaw(IO.readFully(archive))); } }
Source:
<code>protected void addListeners() { this.resourceSetListener = new UpdateTableContentListener(getTableManager(), this); <START> getTableEditingDomain().addResourceSetListener(this.resourceSetListener); <END> }</code><technical_language>removing NPE check</technical_language>

Target:
protected void addListeners() { this.resourceSetListener = new UpdateTableContentListener(getTableManager(), this); if (getTableEditingDomain() != null) { getTableEditingDomain().addResourceSetListener(this.resourceSetListener); } }
Source:
<code>private void createCase(File outputDir, ReportProgressPanel progressPanel) { String caseName = currentCase.getDisplayName() + " (Portable)"; caseFolder = Paths.get(outputDir.toString(), caseName).toFile(); if (caseFolder.exists()) { handleError("Case folder " + caseFolder.toString() + " already exists", Bundle.CreatePortableCaseModule_createCase_caseDirExists(caseFolder.toString()), null, progressPanel); return; } try { skCase = currentCase.createPortableCase(caseName, caseFolder); } catch (TskCoreException ex) { handleError("Error creating case " + caseName + " in folder " + caseFolder.toString(), Bundle.CreatePortableCaseModule_createCase_errorCreatingCase(), ex, progressPanel); return; } copiedFilesFolder = Paths.get(caseFolder.toString(), FILE_FOLDER_NAME).toFile(); <START> copiedFilesFolder.mkdir(); <END> for (FileTypeCategory cat:FILE_TYPE_CATEGORIES) { Paths.get(copiedFilesFolder.toString(), cat.getDisplayName()).toFile().mkdir(); } Paths.get(copiedFilesFolder.toString(), UNKNOWN_FILE_TYPE_FOLDER).toFile().mkdir(); }</code><technical_language>checking return argument here? mkdir() returns true/false</technical_language>

Target:
private void createCase(File outputDir, ReportProgressPanel progressPanel) { String caseName = currentCase.getDisplayName() + " (Portable)"; caseFolder = Paths.get(outputDir.toString(), caseName).toFile(); if (caseFolder.exists()) { handleError("Case folder " + caseFolder.toString() + " already exists", Bundle.CreatePortableCaseModule_createCase_caseDirExists(caseFolder.toString()), null, progressPanel); return; } try { skCase = currentCase.createPortableCase(caseName, caseFolder); } catch (TskCoreException ex) { handleError("Error creating case " + caseName + " in folder " + caseFolder.toString(), Bundle.CreatePortableCaseModule_createCase_errorCreatingCase(), ex, progressPanel); return; } copiedFilesFolder = Paths.get(caseFolder.toString(), FILE_FOLDER_NAME).toFile(); if (! copiedFilesFolder.mkdir()) { handleError("Error creating folder " + copiedFilesFolder.toString(), Bundle.CreatePortableCaseModule_createCase_errorCreatingFolder(copiedFilesFolder.toString()), null, progressPanel); return; } for (FileTypeCategory cat:FILE_TYPE_CATEGORIES) { File subFolder = Paths.get(copiedFilesFolder.toString(), cat.getDisplayName()).toFile(); if (! subFolder.mkdir()) { handleError("Error creating folder " + subFolder.toString(), Bundle.CreatePortableCaseModule_createCase_errorCreatingFolder(subFolder.toString()), null, progressPanel); return; } } File unknownTypeFolder = Paths.get(copiedFilesFolder.toString(), UNKNOWN_FILE_TYPE_FOLDER).toFile(); if (! unknownTypeFolder.mkdir()) { handleError("Error creating folder " + unknownTypeFolder.toString(), Bundle.CreatePortableCaseModule_createCase_errorCreatingFolder(unknownTypeFolder.toString()), null, progressPanel); return; } }
Source:
<code>public String toString() { <START> return "CloudReplica[" + getDataNodeId().getHostname() + ":" + getDataNodeId().getPort() + ":" + getReplicaPath() <END> + "]"; }</code><technical_language>Minor: simpler cloudDataNode</technical_language>

Target:
public String toString() { return "CloudReplica[" + dataNodeId.getHostname() + ":" + dataNodeId.getPort() + ":" + getReplicaPath() + "]"; }
Source:
<code>public ThreadedHistoryTreeBackend(@NonNull String ssid, File newStateFile, int providerVersion, long startTime, int queueSize, int blockSize, int maxChildren) throws IOException { super(ssid, newStateFile, providerVersion, startTime, blockSize, maxChildren); intervalQueue = new BufferedBlockingQueue<>(queueSize / 100, <START> 100); <END> shtThread = new Thread(this, "History Tree Thread"); shtThread.start(); }</code><technical_language>magic number</technical_language>

Target:
public ThreadedHistoryTreeBackend(@NonNull String ssid, File newStateFile, int providerVersion, long startTime, int queueSize, int blockSize, int maxChildren) throws IOException { super(ssid, newStateFile, providerVersion, startTime, blockSize, maxChildren); intervalQueue = new BufferedBlockingQueue<>(queueSize / CHUNK_SIZE, CHUNK_SIZE); shtThread = new Thread(this, "History Tree Thread"); shtThread.start(); }
Source:
<code>private void validateThenCreateAccount() { clearErrors(); ValidateResult result = validateInput(getText(usernameInput), getText(passwordInput), getText(passwordRepeatInput), getText(emailInput)); switch (result) { case INVALID_USERNAME: usernameInput.requestFocus(); usernameInput.setError(getString(R.string.create_account_username_error)); return; case INVALID_PASSWORD: passwordInput.requestFocus(); passwordInput.setError(getString(R.string.create_account_password_error)); return; case PASSWORD_MISMATCH: passwordRepeatInput.requestFocus(); passwordRepeatInput.setError(getString(R.string.create_account_passwords_mismatch_error)); return; case INVALID_EMAIL: emailInput.requestFocus(); emailInput.setError(getString(R.string.create_account_email_error)); return; case NO_EMAIL: new AlertDialog.Builder(this) .setCancelable(false) .setTitle(R.string.email_recommendation_dialog_title) .setMessage(StringUtil.fromHtml(getResources().getString(R.string.email_recommendation_dialog_message))) .setPositiveButton(R.string.email_recommendation_dialog_create_without_email_action, (dialogInterface, i) -> { <START> dialogInterface.dismiss(); <END> createAccount(); }) .setNegativeButton(R.string.email_recommendation_dialog_create_with_email_action, (dialogInterface, i) -> { dialogInterface.dismiss(); emailInput.requestFocus(); }) .show(); break; case SUCCESS: createAccount(); default: break; } }</code><technical_language>Calling dismiss() is necessary; done automatically</technical_language>

Target:
private void validateThenCreateAccount() { clearErrors(); ValidateResult result = validateInput(getText(usernameInput), getText(passwordInput), getText(passwordRepeatInput), getText(emailInput)); switch (result) { case INVALID_USERNAME: usernameInput.requestFocus(); usernameInput.setError(getString(R.string.create_account_username_error)); return; case INVALID_PASSWORD: passwordInput.requestFocus(); passwordInput.setError(getString(R.string.create_account_password_error)); return; case PASSWORD_MISMATCH: passwordRepeatInput.requestFocus(); passwordRepeatInput.setError(getString(R.string.create_account_passwords_mismatch_error)); return; case INVALID_EMAIL: emailInput.requestFocus(); emailInput.setError(getString(R.string.create_account_email_error)); return; case NO_EMAIL: new AlertDialog.Builder(this) .setCancelable(false) .setTitle(R.string.email_recommendation_dialog_title) .setMessage(StringUtil.fromHtml(getResources().getString(R.string.email_recommendation_dialog_message))) .setPositiveButton(R.string.email_recommendation_dialog_create_without_email_action, (dialogInterface, i) -> { createAccount(); }) .setNegativeButton(R.string.email_recommendation_dialog_create_with_email_action, (dialogInterface, i) -> { emailInput.requestFocus(); }) .show(); break; case SUCCESS: createAccount(); default: break; } }
Source:
<code>public void helpEmailScreen(String email) { launchHelpshift(null, email, <START> HelpshiftHelper.chooseHelpshiftLoginTag(getLoginMode() == LoginMode.JETPACK_STATS, true)); <END> }</code><technical_language>chooseHelpshiftLoginTag return wpcom, Jetpack self-hosted. For tag is correct one, do sense add a 4th tag called "Unknown" something</technical_language>

Target:
public void helpEmailScreen(String email) { launchHelpshift(null, email, true); }
Source:
<code>private MongoCredential createCredential(Map<String, String> properties) { MongoCredential credential = null; String authenticationType = properties.get(DBConstants.MongoDB.AUTHENTICATION_TYPE); String username = properties.get(DBConstants.MongoDB.USERNAME); String password = properties.get(DBConstants.MongoDB.PASSWORD); String database = properties.get(DBConstants.MongoDB.DATABASE); switch (authenticationType) { <START> case "PLAIN": <END> credential = MongoCredential.createPlainCredential(username, database, password.toCharArray()); break; case "SCRAM-SHA-1": credential = MongoCredential.createScramSha1Credential(username, database, password.toCharArray()); break; case "MONGODB-CR": credential = MongoCredential.createMongoCRCredential(username, database, password.toCharArray()); break; case "GSSAPI": credential = MongoCredential.createGSSAPICredential(username); break; case "MONGODB-X509": credential = MongoCredential.createMongoX509Credential(username); break; } return credential; }</code><technical_language>Create string constants for authentication types here</technical_language>

Target:
private MongoCredential createCredential(Map<String, String> properties) { MongoCredential credential = null; String authenticationType = properties.get(DBConstants.MongoDB.AUTHENTICATION_TYPE); String username = properties.get(DBConstants.MongoDB.USERNAME); String password = properties.get(DBConstants.MongoDB.PASSWORD); String database = properties.get(DBConstants.MongoDB.DATABASE); switch (authenticationType) { case DBConstants.MongoDB.MongoAuthenticationTypes.PLAIN: credential = MongoCredential.createPlainCredential(username, database, password.toCharArray()); break; case DBConstants.MongoDB.MongoAuthenticationTypes.SCRAM_SHA_1: credential = MongoCredential.createScramSha1Credential(username, database, password.toCharArray()); break; case DBConstants.MongoDB.MongoAuthenticationTypes.MONGODB_CR: credential = MongoCredential.createMongoCRCredential(username, database, password.toCharArray()); break; case DBConstants.MongoDB.MongoAuthenticationTypes.GSSAPI: credential = MongoCredential.createGSSAPICredential(username); break; case DBConstants.MongoDB.MongoAuthenticationTypes.MONGODB_X509: credential = MongoCredential.createMongoX509Credential(username); break; } return credential; }
Source:
<code>public void handleRequest(HttpServerExchange exchange) throws Exception { try { handler.handleRequest(exchange); } catch (Throwable throwable) { <START> for (ExceptionHandlerHolder<?> holder : exceptionHandlers) { <END> if (holder.getClazz().isInstance(throwable)) { holder.getHandler().handleRequest(exchange); break; } } } }</code><technical_language>If is match exception discarded, some kind of fallback handler for exception type is explicitly listed</technical_language>

Target:
public void handleRequest(HttpServerExchange exchange) throws Exception { try { handler.handleRequest(exchange); } catch (Throwable throwable) { for (ExceptionHandlerHolder<?> holder : exceptionHandlers) { if (holder.getClazz().isInstance(throwable)) { exchange.putAttachment(THROWABLE, throwable); holder.getHandler().handleRequest(exchange); return; } } throw throwable; } }
Source:
<code>public static Media from(MwQueryPage page) { ImageInfo imageInfo = page.imageInfo(); if (imageInfo == null) { return null; } ExtMetadata metadata = imageInfo.getMetadata(); if (metadata == null) { Media media = new Media(null, imageInfo.getOriginalUrl(), <START> page.title(), "", 0, null, null, null, null); <END> if (!StringUtils.isBlank(imageInfo.getThumbUrl())) { media.setThumbUrl(imageInfo.getThumbUrl()); } return media; } Media media = new Media(null, imageInfo.getOriginalUrl(), page.title(), "", 0, safeParseDate(metadata.dateTime()), safeParseDate(metadata.dateTime()), getArtist(metadata), imageInfo.getUser() ); if (!StringUtils.isBlank(imageInfo.getThumbUrl())) { media.setThumbUrl(imageInfo.getThumbUrl()); } String language = Locale.getDefault().getLanguage(); if (StringUtils.isBlank(language)) { language = "default"; } media.setDescriptions(Collections.singletonMap(language, metadata.imageDescription())); media.setCategories(MediaDataExtractorUtil.extractCategoriesFromList(metadata.getCategories())); String latitude = metadata.getGpsLatitude(); String longitude = metadata.getGpsLongitude(); if (!StringUtils.isBlank(latitude) && !StringUtils.isBlank(longitude)) { LatLng latLng = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude), 0); media.setCoordinates(latLng); } media.setLicenseInformation(metadata.licenseShortName(), metadata.licenseUrl()); return media; }</code><technical_language>ImageInfo a user if metaData is null</technical_language>

Target:
public static Media from(MwQueryPage page) { ImageInfo imageInfo = page.imageInfo(); if (imageInfo == null) { return null; } ExtMetadata metadata = imageInfo.getMetadata(); if (metadata == null) { Media media = new Media(null, imageInfo.getOriginalUrl(), page.title(), "", 0, null, null, null, imageInfo.getUser()); if (!StringUtils.isBlank(imageInfo.getThumbUrl())) { media.setThumbUrl(imageInfo.getThumbUrl()); } return media; } Media media = new Media(null, imageInfo.getOriginalUrl(), page.title(), "", 0, safeParseDate(metadata.dateTime()), safeParseDate(metadata.dateTime()), getArtist(metadata), imageInfo.getUser() ); if (!StringUtils.isBlank(imageInfo.getThumbUrl())) { media.setThumbUrl(imageInfo.getThumbUrl()); } String language = Locale.getDefault().getLanguage(); if (StringUtils.isBlank(language)) { language = "default"; } media.setDescriptions(Collections.singletonMap(language, metadata.imageDescription())); media.setCategories(MediaDataExtractorUtil.extractCategoriesFromList(metadata.getCategories())); String latitude = metadata.getGpsLatitude(); String longitude = metadata.getGpsLongitude(); if (!StringUtils.isBlank(latitude) && !StringUtils.isBlank(longitude)) { LatLng latLng = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude), 0); media.setCoordinates(latLng); } media.setLicenseInformation(metadata.licenseShortName(), metadata.licenseUrl()); return media; }
Source:
<code>public Unifier<T> getUnifier() { if (outputPort != null) { return outputPort.getUnifier(); } <START> return null; <END> }</code><technical_language>return outputPort != null ? outputPort.getUnifier() : null; Similar changes other places</technical_language>

Target:
public Unifier<T> getUnifier() { return outputPort == null ? null : outputPort.getUnifier(); }
Source:
<code>private void executeTruncationChecks( int truncateTable1, int truncateTable2, int truncateTable3, int truncateTable4) { if (truncateTable1 != 0) { voltQueueSQL(validatebase1); } if (truncateTable2 != 0) { voltQueueSQL(validatebase2); } if (truncateTable3 != 0) { voltQueueSQL(validatebase3); } if (truncateTable4 != 0) { voltQueueSQL(validatebase4); } <START> voltExecuteSQL(); <END> }</code><technical_language>Is this method supposed examine results produced queued SQL statements</technical_language>

Target:
private void executeTruncationChecks( int truncateTable1, int truncateTable2, int truncateTable3, int truncateTable4) { voltQueueSQL(validateview1); voltQueueSQL(validateview2); voltQueueSQL(validateview3); voltQueueSQL(validateview4); if (truncateTable1 != 0) { voltQueueSQL(validatebase1); } if (truncateTable2 != 0) { voltQueueSQL(validatebase2); } if (truncateTable3 != 0) { voltQueueSQL(validatebase3); } if (truncateTable4 != 0) { voltQueueSQL(validatebase4); } VoltTable[] empties = voltExecuteSQL(); int jj = 1; for (VoltTable cleared : empties) { if (cleared.asScalarLong() != 0) { System.out.println( "DEBUG Truncate failed to delete all rows of table/view " + jj + " of " + empties.length + ", leaving: " + cleared.asScalarLong()); } ++jj; } }
Source:
<code>public final List<A> sort(final Ord<A> o) { if (isEmpty()) return nil(); else if (tail().isEmpty()) return this; else { final class Merge { List<A> merge(List<A> xs, List<A> ys, final Ord<A> o) { final Buffer<A> buf = empty(); while (true) { if (xs.isEmpty()) { buf.append(ys); break; } if (ys.isEmpty()) { buf.append(xs); break; } final A x = xs.head(); final A y = ys.head(); <START> if (o.isLessThan(x, y) || o.eq(x, y)) { <END> buf.snoc(x); xs = xs.tail(); } else { buf.snoc(y); ys = ys.tail(); } } return buf.toList(); } } final P2<List<A>, List<A>> s = splitAt(length() / 2); return new Merge().merge(s._1().sort(o), s._2().sort(o), o); } }</code><technical_language>Adding a isLessThanOrEqualTo Ord useful avoid comparison twice</technical_language>

Target:
public final List<A> sort(final Ord<A> o) { if (isEmpty()) return nil(); else if (tail().isEmpty()) return this; else { final class Merge { List<A> merge(List<A> xs, List<A> ys, final Ord<A> o) { final Buffer<A> buf = empty(); while (true) { if (xs.isEmpty()) { buf.append(ys); break; } if (ys.isEmpty()) { buf.append(xs); break; } final A x = xs.head(); final A y = ys.head(); if (o.isLessThanOrEqualTo(x, y)) { buf.snoc(x); xs = xs.tail(); } else { buf.snoc(y); ys = ys.tail(); } } return buf.toList(); } } final P2<List<A>, List<A>> s = splitAt(length() / 2); return new Merge().merge(s._1().sort(o), s._2().sort(o), o); } }
Source:
<code>public void persist(final Runnable commitRunnable) { final List<Pair<FireHydrant, Interval>> indexesToPersist = Lists.newArrayList(); for (Sink sink : sinks.values()) { if (sink.swappable()) { indexesToPersist.add(Pair.of(sink.swap(), sink.getInterval())); } } log.info("Submitting persist runnable for dataSource[%s]", schema.getDataSource()); <START> if (persistExecutor.getQueue().size() >= config.getMaxPendingPersists()) { <END> log.warn( "Persists pending[%,d] >= maxPendingPersists[%,d]. Ingestion may be throttled.", persistExecutor.getQueue().size(), config.getMaxPendingPersists() ); } persistExecutor.execute( new ThreadRenamingRunnable(String.format("%s-incremental-persist", schema.getDataSource())) { @Override public void doRun() { for (Pair<FireHydrant, Interval> pair : indexesToPersist) { metrics.incrementRowOutputCount(persistHydrant(pair.lhs, schema, pair.rhs)); } commitRunnable.run(); } } ); }</code><technical_language>This useful in default configuration maxPendingPersists = 0. print warning a persist is submitted, if throttled. A "possibly throttled" detection need check if a persist is running right submit a new persistExecutor. is racey fine check is emit a warning</technical_language>

Target:
public void persist(final Runnable commitRunnable) { final List<Pair<FireHydrant, Interval>> indexesToPersist = Lists.newArrayList(); for (Sink sink : sinks.values()) { if (sink.swappable()) { indexesToPersist.add(Pair.of(sink.swap(), sink.getInterval())); } } log.info("Submitting persist runnable for dataSource[%s]", schema.getDataSource()); final Stopwatch runExecStopwatch = Stopwatch.createStarted(); final Stopwatch persistStopwatch = Stopwatch.createStarted(); persistExecutor.execute( new ThreadRenamingRunnable(String.format("%s-incremental-persist", schema.getDataSource())) { @Override public void doRun() { try { for (Pair<FireHydrant, Interval> pair : indexesToPersist) { metrics.incrementRowOutputCount(persistHydrant(pair.lhs, schema, pair.rhs)); } commitRunnable.run(); } finally { metrics.incrementNumPersists(); metrics.incrementPersistTimeMillis(persistStopwatch.elapsed(TimeUnit.MILLISECONDS)); persistStopwatch.stop(); } } } ); final long startDelay = runExecStopwatch.elapsed(TimeUnit.MILLISECONDS); metrics.incrementPersistBackPressureMillis(startDelay); if (startDelay > WARN_DELAY) { log.warn("Ingestion was throttled for [%,d] millis because persists were pending.", startDelay); } runExecStopwatch.stop(); }
Source:
<code>public void testObjLitRedefinedInLocalScope() { test("var a = {}; a.b = {c: 0}; function d() { a.b = {c: 1}; } e(a.b.c);", "var a$b = {c: 0}; function d() { a$b = {c: 1}; } e(a$b.c);"); test("var a = {}; a.b = {c: 0}; " + "function d() { a.b = {c: 1}; } e(a.b.c);", <START> "var a = {}; a.b = {c: 0}; function d() { a.b = {c: 1}; } e(a.b.c);"); <END> test("var a = {}; a.b = {c: 0}; " + "function d() { a.b = { c: 1}; } e(a.b.c);", "var a$b = {c: 0}; function d() { a$b = {c: 1}; } e(a$b.c);"); }</code><technical_language>testSame? In general, tests a $ in output code testSame</technical_language>

Target:
public void testObjLitRedefinedInLocalScope() { test("var a = {}; a.b = {c: 0}; function d() { a.b = {c: 1}; } e(a.b.c);", "var a$b = {c: 0}; function d() { a$b = {c: 1}; } e(a$b.c);"); testSame("var a = {}; a.b = {c: 0}; " + "function d() { a.b = {c: 1}; } e(a.b.c);"); test("var a = {}; a.b = {c: 0}; " + "function d() { a.b = { c: 1}; } e(a.b.c);", "var a$b = {c: 0}; function d() { a$b = {c: 1}; } e(a$b.c);"); }
Source:
<code>private void logHostFailToRespond(VDSNetworkException ex, long timeoutToFence) { log.info( "Server failed to respond, vds_id='{}', vds_name='{}', vm_count={}, " + "spm_status='{}', non-responsive_timeout (seconds)={}, error: {}", cachedVds.getId(), cachedVds.getName(), cachedVds.getVmCount(), cachedVds.getSpmStatus(), TimeUnit.MILLISECONDS.toSeconds(timeoutToFence), ex.getMessage()); AuditLogableBase logable; logable = new AuditLogableBase(cachedVds.getId()); logable.updateCallStackFromThrowable(ex); <START> if (ex.getCause() instanceof java.net.UnknownHostException) <END> auditLogDirector.log(logable, AuditLogType.VDS_UNKNOWN_HOST); else auditLogDirector.log(logable, AuditLogType.VDS_FAILURE); }</code><technical_language>please surround brackets if () { ... } else { ... }</technical_language>

Target:
private void logHostFailToRespond(VDSNetworkException ex, long timeoutToFence) { log.info( "Server failed to respond, vds_id='{}', vds_name='{}', vm_count={}, " + "spm_status='{}', non-responsive_timeout (seconds)={}, error: {}", cachedVds.getId(), cachedVds.getName(), cachedVds.getVmCount(), cachedVds.getSpmStatus(), TimeUnit.MILLISECONDS.toSeconds(timeoutToFence), ex.getMessage()); AuditLogableBase logable; logable = new AuditLogableBase(cachedVds.getId()); logable.updateCallStackFromThrowable(ex); if (ex.getCause() instanceof java.net.UnknownHostException){ auditLogDirector.log(logable, AuditLogType.VDS_UNKNOWN_HOST); } else { auditLogDirector.log(logable, AuditLogType.VDS_FAILURE); } }
Source:
<code>public List<Double> resolveValues(List<SchedulePeriod> periods) { int size = periods.size(); double[] result = new double[size]; if (steps.size() == 0) { Arrays.fill(result, initialValue); } else { <START> ValueAdjustment[] expandedSteps = new ValueAdjustment[size]; <END> for (ValueStep step : steps) { int index = step.findIndex(periods); if (index == 0) { throw new IllegalArgumentException("ValueStep is not allowed at the start of the schedule"); } if (expandedSteps[index] != null && expandedSteps[index].equals(step.getValue()) == false) { throw new IllegalArgumentException("Two ValueStep instances resolve to the same schedule period"); } expandedSteps[index] = step.getValue(); } double value = initialValue; for (int i = 0; i < size; i++) { if (expandedSteps[i] != null) { value = expandedSteps[i].adjust(value); } result[i] = value; } } return Doubles.asList(result); }</code><technical_language>array of reference types? ArrayList work efficient</technical_language>

Target:
public List<Double> resolveValues(List<SchedulePeriod> periods) { int size = periods.size(); double[] result = new double[size]; if (steps.size() == 0) { Arrays.fill(result, initialValue); } else { ValueAdjustment[] expandedSteps = new ValueAdjustment[size]; for (ValueStep step : steps) { int index = step.findIndex(periods); if (index == 0) { throw new IllegalArgumentException("ValueStep is not allowed at the start of the schedule"); } if (expandedSteps[index] != null && !expandedSteps[index].equals(step.getValue())) { throw new IllegalArgumentException("Two ValueStep instances resolve to the same schedule period"); } expandedSteps[index] = step.getValue(); } double value = initialValue; for (int i = 0; i < size; i++) { if (expandedSteps[i] != null) { value = expandedSteps[i].adjust(value); } result[i] = value; } } return Doubles.asList(result); }
Source:
<code>private Bitmap doFileInBackground() { Bitmap thumbnail = null; final String imageKey = String.valueOf(mFile.hashCode()); thumbnail = getBitmapFromDiskCache(imageKey); if (thumbnail == null) { int px = getThumbnailDimension(); Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile( <START> ((File)mFile).getAbsolutePath(), px, px); <END> if (bitmap != null) { thumbnail = addThumbnailToCache(imageKey, bitmap, ((File)mFile).getPath(), px); } } return thumbnail; }</code><technical_language>here, casting mFile</technical_language>

Target:
private Bitmap doFileInBackground() { Bitmap thumbnail = null; File file = (File)mFile; final String imageKey = String.valueOf(file.hashCode()); thumbnail = getBitmapFromDiskCache(imageKey); if (thumbnail == null) { int px = getThumbnailDimension(); Bitmap bitmap = BitmapUtils.decodeSampledBitmapFromFile( file.getAbsolutePath(), px, px); if (bitmap != null) { thumbnail = addThumbnailToCache(imageKey, bitmap, file.getPath(), px); } } return thumbnail; }
Source:
<code>protected boolean shouldUpdatedItemRemainInList(FeedItem item) { SharedPreferences prefs = getActivity().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); FeedItemFilter feedItemFilter = new FeedItemFilter(prefs.getString(PREF_FILTER, "")); <START> if (feedItemFilter.isShowDownloaded()) { <END> return false; } return true; }</code><technical_language>Items updated for other reasons, too. This line is missing a check if item is longer downloaded</technical_language>

Target:
protected boolean shouldUpdatedItemRemainInList(FeedItem item) { SharedPreferences prefs = getActivity().getSharedPreferences(PREF_NAME, Context.MODE_PRIVATE); FeedItemFilter feedItemFilter = new FeedItemFilter(prefs.getString(PREF_FILTER, "")); if (feedItemFilter.isShowDownloaded() && (!item.hasMedia() || !item.getMedia().isDownloaded())) { return false; } return true; }
Source:
<code>public String getScroller() { <START> return scroller == null ? DEFAULT_SCROLLER : scroller; <END> }</code><technical_language>wdyt if replace return Objects.requireNonNullElse(scroller, DEFAULT_SCROLLER) if agree some adaptation 10.10 (java 8)</technical_language>

Target:
public String getScroller() { return scroller; }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((actionType == null) ? 0 : actionType.hashCode()); result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode()); result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + (isVisible ? 1231 : 1237); result = prime * result + ((jobSubjectEntities == null) ? 0 : jobSubjectEntities.hashCode()); result = prime * result + ((lastUpdateTime == null) ? 0 : lastUpdateTime.hashCode()); result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((steps == null) ? 0 : steps.hashCode()); <START> result = prime * result + (isExternal ? 1231 : 1237); <END> return result; }</code><technical_language>need include autoCleared in equals hashmap</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((actionType == null) ? 0 : actionType.hashCode()); result = prime * result + ((correlationId == null) ? 0 : correlationId.hashCode()); result = prime * result + ((endTime == null) ? 0 : endTime.hashCode()); result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + (isVisible ? 1231 : 1237); result = prime * result + ((jobSubjectEntities == null) ? 0 : jobSubjectEntities.hashCode()); result = prime * result + ((lastUpdateTime == null) ? 0 : lastUpdateTime.hashCode()); result = prime * result + ((ownerId == null) ? 0 : ownerId.hashCode()); result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); result = prime * result + ((status == null) ? 0 : status.hashCode()); result = prime * result + ((steps == null) ? 0 : steps.hashCode()); result = prime * result + (external ? 1231 : 1237); return result; }
Source:
<code>public void queueEvent(NotificationContext context, ClusterEventType eventType, HelixConstants.ChangeType changeType) { ClusterEvent event = new ClusterEvent(_clusterName, eventType); event.addAttribute(AttributeName.helixmanager.name(), context.getManager()); event.addAttribute(AttributeName.changeContext.name(), context); <START> event.addAttribute(AttributeName.ChangeType.name(), changeType); <END> queueEvent(event); _monitor.increaseCallbackCounters(_eventQueue.size()); }</code><technical_language>type included in context</technical_language>

Target:
public void queueEvent(NotificationContext context, ClusterEventType eventType, HelixConstants.ChangeType changeType) { ClusterEvent event = new ClusterEvent(_clusterName, eventType); event.addAttribute(AttributeName.helixmanager.name(), context.getManager()); event.addAttribute(AttributeName.changeContext.name(), context); queueEvent(event); _monitor.increaseCallbackCounters(_eventQueue.size()); }
Source:
<code>public void shouldAlwaysGenerateTheSameValueForTheSameSeed() { <START> FloatRangeRandomizer bloatRangeRandomizer = aNewFloatRangeRandomizer(min, max, SEED); <END> Float f = bloatRangeRandomizer.getRandomValue(); then(f).isEqualTo(7F); }</code><technical_language>I floatRangeRandomizer</technical_language>

Target:
public void shouldAlwaysGenerateTheSameValueForTheSameSeed() { FloatRangeRandomizer floatRangeRandomizer = aNewFloatRangeRandomizer(min, max, SEED); Float f = floatRangeRandomizer.getRandomValue(); then(f).isEqualTo(7F); }
Source:
<code>public void unselectsSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Listen").select(); bot.button("Clear").click(); tree = bot.treeInGroup("Tree"); tree.select(new int[] { 1 }); SWTBotText text = bot.textInGroup("Listeners"); bot.button("Clear").click(); tree.unselect(); assertEquals(0, tree.selectionCount()); <START> assertEventMatches(text, "Selection [13]: SelectionEvent{Tree time=-550222256 data=null item=TreeItem {Node 2} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); <END> assertEventMatches(text, "MouseDown [3]: MouseEvent{Tree time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Tree time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); }</code><technical_language>Selection MouseDown</technical_language>

Target:
public void unselectsSelection() throws Exception { bot.radio("SWT.MULTI").click(); bot.checkBox("Listen").select(); bot.button("Clear").click(); tree = bot.treeInGroup("Tree"); tree.select(new int[] { 1 }); SWTBotText text = bot.textInGroup("Listeners"); bot.button("Clear").click(); tree.unselect(); assertEquals(0, tree.selectionCount()); assertEventMatches(text, "MouseDown [3]: MouseEvent{Tree time=-550222259 data=null button=1 stateMask=0x40000 x=0 y=0 count=1}"); assertEventMatches(text, "Selection [13]: SelectionEvent{Tree time=-550222256 data=null item=TreeItem {Node 2} detail=0 x=0 y=0 width=0 height=0 stateMask=0xc0000 text=null doit=true}"); assertEventMatches(text, "MouseUp [4]: MouseEvent{Tree time=-550222255 data=null button=1 stateMask=0xc0000 x=0 y=0 count=1}"); tree.select(new int[] { 1, 2 }); assertEquals(2, tree.selectionCount()); tree.select(new int[] {}); assertEquals(0, tree.selectionCount()); tree.select(new String[] { "Node 2", "Node 4" }); assertEquals(2, tree.selectionCount()); tree.select(new int[] {}); assertEquals(0, tree.selectionCount()); }
Source:
<code>public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> argumentsTypes, boolean staticOnly) { List<ResolvedMethodDeclaration> candidates = new ArrayList<>(); Predicate<CtMethod> staticOnlyCheck = m -> !staticOnly || (staticOnly && Modifier.isStatic(m.getModifiers())); for (CtMethod method : ctClass.getDeclaredMethods()) { boolean isSynthetic = method.getMethodInfo().getAttribute(SyntheticAttribute.tag) != null; boolean isNotBridge = (method.getMethodInfo().getAccessFlags() & AccessFlag.BRIDGE) == 0; if (method.getName().equals(name) && !isSynthetic && isNotBridge && staticOnlyCheck.test(method)) { candidates.add(new JavassistMethodDeclaration(method, typeSolver)); } } <START> SymbolReference<ResolvedMethodDeclaration> superClassMethodRef = MethodResolutionLogic.solveMethodInFQN <END> (getSuperclassFQN(), name, argumentsTypes, staticOnly, typeSolver); if (superClassMethodRef.isSolved()) { candidates.add(superClassMethodRef.getCorrespondingDeclaration()); } for (String interfaceFQN : getInterfaceFQNs()) { SymbolReference<ResolvedMethodDeclaration> interfaceMethodRef = MethodResolutionLogic.solveMethodInFQN (interfaceFQN, name, argumentsTypes, staticOnly, typeSolver); if (interfaceMethodRef.isSolved()) { candidates.add(interfaceMethodRef.getCorrespondingDeclaration()); } } return MethodResolutionLogic.findMostApplicable(candidates, name, argumentsTypes, typeSolver); }</code><technical_language>check if method is null</technical_language>

Target:
public SymbolReference<ResolvedMethodDeclaration> solveMethod(String name, List<ResolvedType> argumentsTypes, boolean staticOnly) { List<ResolvedMethodDeclaration> candidates = new ArrayList<>(); Predicate<CtMethod> staticOnlyCheck = m -> !staticOnly || (staticOnly && Modifier.isStatic(m.getModifiers())); for (CtMethod method : ctClass.getDeclaredMethods()) { boolean isSynthetic = method.getMethodInfo().getAttribute(SyntheticAttribute.tag) != null; boolean isNotBridge = (method.getMethodInfo().getAccessFlags() & AccessFlag.BRIDGE) == 0; if (method.getName().equals(name) && !isSynthetic && isNotBridge && staticOnlyCheck.test(method)) { candidates.add(new JavassistMethodDeclaration(method, typeSolver)); } } SymbolReference<ResolvedMethodDeclaration> superClassMethodRef = MethodResolutionLogic .solveMethodInType(getSuperClass().getTypeDeclaration(), name, argumentsTypes, staticOnly, typeSolver); if (superClassMethodRef.isSolved()) { candidates.add(superClassMethodRef.getCorrespondingDeclaration()); } for (ResolvedReferenceType interfaceRef : getInterfaces()) { SymbolReference<ResolvedMethodDeclaration> interfaceMethodRef = MethodResolutionLogic.solveMethodInType(interfaceRef.getTypeDeclaration(), name, argumentsTypes, staticOnly, typeSolver); if (interfaceMethodRef.isSolved()) { candidates.add(interfaceMethodRef.getCorrespondingDeclaration()); } } return MethodResolutionLogic.findMostApplicable(candidates, name, argumentsTypes, typeSolver); }
Source:
<code>private void startNewConnection() { final ApnsConnection<T> connection = new ApnsConnection<T>(this.environment, this.sslContext, this.eventLoopGroup, this.configuration.getConnectionConfiguration(), this, <START> String.format("%s-connection-%d", this.name, this.connectionCounter++)); <END> connection.connect(); synchronized (this.activeConnections) { this.activeConnections.add(connection); } }</code><technical_language>++ is thread-safe, connectionCounter need changed AtomicInteger</technical_language>

Target:
private void startNewConnection() { final ApnsConnection<T> connection = new ApnsConnection<T>(this.environment, this.sslContext, this.eventLoopGroup, this.configuration.getConnectionConfiguration(), this, String.format("%s-connection-%d", this.name, this.connectionCounter.getAndIncrement())); connection.connect(); synchronized (this.activeConnections) { this.activeConnections.add(connection); } }
Source:
<code>public boolean isModified(DirCacheEntry entry, boolean forceContentCheck) { if (entry.isAssumeValid()) return false; if (entry.isUpdateNeeded()) return true; if (!entry.isSmudged() && (getEntryLength() != entry.getLength())) return true; int modeDiff = getEntryRawMode() ^ entry.getRawMode(); <START> if (modeDiff != 0 && entry.getFileMode() != FileMode.SYMLINK) { <END> if (!state.options.isFileMode()) modeDiff &= ~FileMode.EXECUTABLE_FILE.getBits(); if (modeDiff != 0) return true; } long cacheLastModified = entry.getLastModified(); long fileLastModified = getEntryLastModified(); if (cacheLastModified % 1000 == 0) fileLastModified = fileLastModified - fileLastModified % 1000; if (fileLastModified != cacheLastModified) { if (forceContentCheck) { return contentCheck(entry); } else { return true; } } else { if (entry.isSmudged()) { return contentCheck(entry); } else { return false; } } }</code><technical_language>This is more efficient: !FileMode.SYMLINK.equals(entry.getRawMode()) issue is, getFileMode() test a number of FileMode constants matches... called getRawMode() get integer value. Testing integer FileMode.SYMLINK save some compares</technical_language>

Target:
public boolean isModified(DirCacheEntry entry, boolean forceContentCheck) { if (entry.isAssumeValid()) return false; if (entry.isUpdateNeeded()) return true; if (!entry.isSmudged() && (getEntryLength() != entry.getLength())) return true; int modeDiff = getEntryRawMode() ^ entry.getRawMode(); if (modeDiff != 0 && !FileMode.SYMLINK.equals(entry.getRawMode())) { if (!state.options.isFileMode()) modeDiff &= ~FileMode.EXECUTABLE_FILE.getBits(); if (modeDiff != 0) return true; } long cacheLastModified = entry.getLastModified(); long fileLastModified = getEntryLastModified(); if (cacheLastModified % 1000 == 0) fileLastModified = fileLastModified - fileLastModified % 1000; if (fileLastModified != cacheLastModified) { if (forceContentCheck) { return contentCheck(entry); } else { return true; } } else { if (entry.isSmudged()) { return contentCheck(entry); } else { return false; } } }
Source:
<code>private Transformer getTransformer(StreamSource streamSource) { net.sf.saxon.TransformerFactoryImpl impl = new net.sf.saxon.TransformerFactoryImpl(); try { return impl.newTransformer(streamSource); } catch (TransformerConfigurationException e) { e.printStackTrace(); } <START> return null; <END> }</code><technical_language>return null :thinking: new factory instance in call? a static final</technical_language>

Target:
private Transformer getTransformer(StreamSource streamSource) throws TransformerConfigurationException { return this.transformerFactory.newTransformer(streamSource); }
Source:
<code>public void endProcessingNode() { if (nodeCount.decrementAndGet() == 0 && recorder != null) { Node node = rootNode.build(); trace.setTimestamp(node.getTimestamp()); trace.setTransaction(getTransaction()); trace.getNodes().add(node); if (checkForSamplingProperties(node)) { reportingLevel = ReportingLevel.All; } boolean sampled = sampler.isSampled(trace, reportingLevel); if (sampled && reportingLevel == null) { reportingLevel = ReportingLevel.All; } if (sampled) { recorder.report(trace); } <START> rootNode.addProperty(this.serviceName); <END> rootNode.addProperty(ENV_BUILD_STAMP); } }</code><technical_language>check application provide service name node - overwrite if provided</technical_language>

Target:
public void endProcessingNode() { if (nodeCount.decrementAndGet() == 0 && recorder != null) { Node node = rootNode.build(); trace.setTimestamp(node.getTimestamp()); trace.setTransaction(getTransaction()); trace.getNodes().add(node); if (checkForSamplingProperties(node)) { reportingLevel = ReportingLevel.All; } boolean sampled = sampler.isSampled(trace, reportingLevel); if (sampled && reportingLevel == null) { reportingLevel = ReportingLevel.All; } if (sampled) { recorder.report(trace); } } }
Source:
<code>public void testExportDanglingSources() throws Exception { int rowCount = 0; m_client = getClient(m_cluster); Object[] data = new Object[3]; Arrays.fill(data, 1); for (int i = 0; i < LOOP_COUNT; i++) { insertToStream(STREAM_NAME, rowCount, ROW_BATCH, m_client, data); rowCount += ROW_BATCH; } m_client.drain(); m_cluster.killSingleHost(0); m_cluster.killSingleHost(1); Thread.sleep(500); m_client = getClient(m_cluster); for (int i = 0; i < LOOP_COUNT; i++) { insertToStream(STREAM_NAME, rowCount, ROW_BATCH, m_client, data); rowCount += ROW_BATCH; } m_client.drain(); m_cluster.rejoinOne(1); Thread.sleep(500); m_cluster.recoverOne(0, null, ""); Thread.sleep(500); m_client = getClient(m_cluster); for (int i = 0; i < LOOP_COUNT; i++) { insertToStream(STREAM_NAME, rowCount, ROW_BATCH, m_client, data); rowCount += ROW_BATCH; } m_client.drain(); m_builder.addExport(true , ServerExportEnum.CUSTOM, "org.voltdb.exportclient.SocketExporter", createSocketExportProperties(STREAM_NAME, false ), TARGET_NAME); m_cluster.updateCatalog(m_builder); List<String> list = new ArrayList<>(1); list.add(STREAM_NAME); TestExportBaseSocketExport.waitForExportAllRowsDelivered(m_client, list); m_verifier.verifyRows(); <START> assertTrue(m_cluster.verifyLogMessage(0, m_logPattern) <END> || m_cluster.verifyLogMessage(1, m_logPattern) || m_cluster.verifyLogMessage(2, m_logPattern) || m_cluster.verifyLogMessage(3, m_logPattern) || m_cluster.verifyLogMessage(4, m_logPattern)); }</code><technical_language>I want anyHostHasLogMessage returns true if host log message</technical_language>

Target:
public void testExportDanglingSources() throws Exception { int rowCount = 0; m_client = getClient(m_cluster); Object[] data = new Object[] {1, 1, 1}; for (int i = 0; i < LOOP_COUNT; i++) { insertToStream(STREAM_NAME, rowCount, ROW_BATCH, m_client, data); rowCount += ROW_BATCH; } m_client.drain(); m_cluster.killSingleHost(0); m_cluster.killSingleHost(1); Thread.sleep(500); m_client = getClient(m_cluster); for (int i = 0; i < LOOP_COUNT; i++) { insertToStream(STREAM_NAME, rowCount, ROW_BATCH, m_client, data); rowCount += ROW_BATCH; } m_client.drain(); m_cluster.rejoinOne(1); Thread.sleep(500); m_cluster.recoverOne(0, null, ""); Thread.sleep(500); m_client = getClient(m_cluster); for (int i = 0; i < LOOP_COUNT; i++) { insertToStream(STREAM_NAME, rowCount, ROW_BATCH, m_client, data); rowCount += ROW_BATCH; } m_client.drain(); m_builder.addExport(true , ServerExportEnum.CUSTOM, "org.voltdb.exportclient.SocketExporter", createSocketExportProperties(STREAM_NAME, false ), TARGET_NAME); m_cluster.updateCatalog(m_builder); List<String> list = ImmutableList.of(STREAM_NAME); TestExportBaseSocketExport.waitForExportAllRowsDelivered(m_client, list); m_verifier.verifyRows(); assertTrue(m_cluster.anyHostHasLogMessage(m_logPattern)); }
Source:
<code>public int computeNumberOfFixes(CompilationUnit compilationUnit) { int result= 0; IProblem[] problems= compilationUnit.getProblems(); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_IMPORTS) && !isEnabled(CleanUpConstants.ORGANIZE_IMPORTS)) { for (int <START> i=0;i<problems.length;i++) <END> { int id= problems[i].getID(); if (id == IProblem.UnusedImport || id == IProblem.DuplicateImport || id == IProblem.ConflictingImport || id == IProblem.CannotImportPackage || id == IProblem.ImportNotFound) result++; } } if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_METHODS)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateMethod); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateConstructor); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_TYPES)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateType); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_FELDS)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateField); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_LOCAL_VARIABLES)) result+= getNumberOfProblems(problems, IProblem.LocalVariableIsNeverUsed); return result; }</code><technical_language>foreach</technical_language>

Target:
public int computeNumberOfFixes(CompilationUnit compilationUnit) { int result= 0; IProblem[] problems= compilationUnit.getProblems(); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_IMPORTS) && !isEnabled(CleanUpConstants.ORGANIZE_IMPORTS)) { for (IProblem problem : problems) { int id= problem.getID(); if (id == IProblem.UnusedImport || id == IProblem.DuplicateImport || id == IProblem.ConflictingImport || id == IProblem.CannotImportPackage || id == IProblem.ImportNotFound) result++; } } if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_METHODS)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateMethod); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_CONSTRUCTORS)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateConstructor); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_TYPES)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateType); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_MEMBERS) && isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_PRIVATE_FELDS)) result+= getNumberOfProblems(problems, IProblem.UnusedPrivateField); if (isEnabled(CleanUpConstants.REMOVE_UNUSED_CODE_LOCAL_VARIABLES)) result+= getNumberOfProblems(problems, IProblem.LocalVariableIsNeverUsed); return result; }