auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void testBySearch() throws Exception { SubClass testClass = new SubClass(); testClass.setName( "John Doe" ); FullTextSession s = Search.getFullTextSession( openSession() ); Transaction tx = s.beginTransaction(); s.persist( testClass ); tx.commit(); tx = s.beginTransaction(); QueryParser parser = new QueryParser( "name", TestConstants.keywordAnalyzer ); org.apache.lucene.search.Query luceneQuery = parser.parse( "name:John" ); FullTextQuery query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 1, query.getResultSize() ); <START> luceneQuery = parser.parse( "name:Doe" ); <END> query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 1, query.getResultSize() ); luceneQuery = parser.parse( "name:foo" ); query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 0, query.getResultSize() ); tx.commit(); s.close(); }</code><technical_language>a bit worried this change. StandardAnalyzer default exact behavior. I analyzer filtering ASCII characters is better. I feasible, it</technical_language>

Target:
public void testBySearch() throws Exception { SubClass testClass = new SubClass(); testClass.setName( "I\u0307stanbul" ); FullTextSession s = Search.getFullTextSession( openSession() ); Transaction tx = s.beginTransaction(); s.persist( testClass ); tx.commit(); tx = s.beginTransaction(); QueryParser parser = new QueryParser( "name", TestConstants.keywordAnalyzer ); org.apache.lucene.search.Query luceneQuery = parser.parse( "name:istanbul" ); FullTextQuery query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 1, query.getResultSize() ); luceneQuery = parser.parse( "name:foo" ); query = s.createFullTextQuery( luceneQuery, SubClass.class ); assertEquals( 0, query.getResultSize() ); tx.commit(); s.close(); }
Source:
<code>default void bulkIndex(List<IndexQuery> queries) { <START> this.bulkIndex(queries, null); <END> }</code><technical_language>need for this IMO</technical_language>

Target:
default void bulkIndex(List<IndexQuery> queries) { bulkIndex(queries, BulkOptions.defaultOptions()); }
Source:
<code>private boolean hasSelectedMilestone(List<PickerMilestone> milestoneList) { return milestoneList.stream() <START> .filter(milestone -> milestone.isSelected()) <END> .findAny() .isPresent(); }</code><technical_language>~~milestone::isSelected~~ PickerLabel::isSelected</technical_language>

Target:
private boolean hasSelectedMilestone(List<PickerMilestone> milestoneList) { return milestoneList.stream() .filter(PickerMilestone::isSelected) .findAny() .isPresent(); }
Source:
<code>private CorfuRuntime(@Nonnull CorfuRuntimeParameters parameters) { this.parameters = parameters; bootstrapLayoutServers = parameters.getLayoutServers().stream() .map(NodeLocator::toString) .collect(Collectors.toList()); layoutServers = new ArrayList<>(bootstrapLayoutServers); clusterId = parameters.getClusterId(); nettyEventLoop = parameters.nettyEventLoop == null ? getNewEventLoopGroup() : parameters.nettyEventLoop; nodeRouterPool = new NodeRouterPool(getRouterFunction); MetricsUtils.metricsReportingSetup(defaultMetrics); if (parameters.getPrometheusMetricsPort() != MetricsUtils.NO_METRICS_PORT) { MetricsUtils.metricsReportingSetup( defaultMetrics, parameters.getPrometheusMetricsPort()); } CorfuRuntimeParameters.MicroMeterRuntimeConfig microMeterRuntimeConfig = this.parameters.getMicroMeterRuntimeConfig(); if (microMeterRuntimeConfig.metricsEnabled) { <START> LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); registry = Optional.ofNullable(loggerContext.exists(microMeterRuntimeConfig.configuredLoggerName)) .map(logger -> MeterRegistryProvider.MeterRegistryInitializer.newInstance(logger, <END> microMeterRuntimeConfig.loggingInterval, parameters.clientId)); } else { registry = Optional.empty(); } log.info("Corfu runtime version initialized.", getVersionString()); }</code><technical_language>If metricsEnabled = true logger print a warning message</technical_language>

Target:
private CorfuRuntime(@Nonnull CorfuRuntimeParameters parameters) { this.parameters = parameters; bootstrapLayoutServers = parameters.getLayoutServers().stream() .map(NodeLocator::toString) .collect(Collectors.toList()); layoutServers = new ArrayList<>(bootstrapLayoutServers); clusterId = parameters.getClusterId(); nettyEventLoop = parameters.nettyEventLoop == null ? getNewEventLoopGroup() : parameters.nettyEventLoop; nodeRouterPool = new NodeRouterPool(getRouterFunction); MetricsUtils.metricsReportingSetup(defaultMetrics); if (parameters.getPrometheusMetricsPort() != MetricsUtils.NO_METRICS_PORT) { MetricsUtils.metricsReportingSetup( defaultMetrics, parameters.getPrometheusMetricsPort()); } CorfuRuntimeParameters.MicroMeterRuntimeConfig microMeterRuntimeConfig = this.parameters.getMicroMeterRuntimeConfig(); if (microMeterRuntimeConfig.metricsEnabled) { registry = Optional.ofNullable(LoggerFactory.getLogger(microMeterRuntimeConfig.configuredLoggerName)) .map(logger -> MeterRegistryProvider.MeterRegistryInitializer .newInstance(logger, microMeterRuntimeConfig.loggingInterval, parameters.clientId)); if (!registry.isPresent()) { log.warn("Configured logger could not be found."); } } else { registry = Optional.empty(); } fetchLayoutTimer = registry.map(r -> Timer.builder("runtime.fetch_layout.timer") .publishPercentileHistogram(true).publishPercentiles(0.50, 0.95, 0.99).register(r)); log.info("Corfu runtime version initialized.", getVersionString()); }
Source:
<code>public CompletableFuture<Void> hostGame(NewGameInfo newGameInfo) { if (isRunning()) { logger.debug("Game is running, ignoring host request"); return completedFuture(null); } <START> newGameInfo.setMap("NeroxisMapGenerator_1_0.0.1-prealpha"); <END> stopSearchLadder1v1(); return updateGameIfNecessary(newGameInfo.getFeaturedMod(), null, emptyMap(), newGameInfo.getSimMods()) .thenCompose(aVoid -> downloadMapIfNecessary(newGameInfo.getMap())) .thenCompose(aVoid -> fafService.requestHostGame(newGameInfo)) .thenAccept(gameLaunchMessage -> startGame(gameLaunchMessage, null, RatingMode.GLOBAL)); }</code><technical_language>This t debug code please delete</technical_language>

Target:
public CompletableFuture<Void> hostGame(NewGameInfo newGameInfo) { if (isRunning()) { logger.debug("Game is running, ignoring host request"); return completedFuture(null); } stopSearchLadder1v1(); return updateGameIfNecessary(newGameInfo.getFeaturedMod(), null, emptyMap(), newGameInfo.getSimMods()) .thenCompose(aVoid -> downloadMapIfNecessary(newGameInfo.getMap())) .thenCompose(aVoid -> fafService.requestHostGame(newGameInfo)) .thenAccept(gameLaunchMessage -> startGame(gameLaunchMessage, null, RatingMode.GLOBAL)); }
Source:
<code>public final Object getData(String sessionId, String key, boolean refresh) { Date now = new Date(); SessionInfo sessionInfo = getSessionInfo(sessionId); Object value = null; if (sessionInfo != null) { if (refresh) { synchronized (sessionInfo) { Date softLimit = (Date) sessionInfo.sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; sessionInfo.sessionMap.put(LAST_REFRESH, softLimit); } long minutesSinceLastRefresh = (now.getTime() - ((Date) sessionInfo.sessionMap.get(LAST_REFRESH)).getTime()) / 60000; int numberOfIntervalsToAdd = (int) minutesSinceLastRefresh / Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval); softLimit = DateUtils.addMinutes(softLimit, (numberOfIntervalsToAdd > 2 ? 2 : numberOfIntervalsToAdd) * Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); sessionInfo.sessionMap.put(SOFT_LIMIT_PARAMETER_NAME, softLimit); sessionInfo.sessionMap.put(LAST_REFRESH, now); } } value = sessionInfo.sessionMap.get(key); } <START> return value; <END> }</code><technical_language>this I do understand all... please explain in words... like: if (refresh) { if (softLimit != null) { softLimit = + interval; } } is complex? do need LAST_REFRESH? BTW: I remove *2 keeping session alive disconnecting</technical_language>

Target:
public final Object getData(String sessionId, String key, boolean refresh) { Date now = new Date(); SessionInfo sessionInfo = getSessionInfo(sessionId); Object value = null; if (sessionInfo != null) { if (refresh) { synchronized (sessionInfo) { Date softLimit = (Date) sessionInfo.sessionMap.get(SOFT_LIMIT_PARAMETER_NAME); if (softLimit == null) { softLimit = now; } softLimit = DateUtils.addMinutes(softLimit, 2 * Config.<Integer> getValue(ConfigValues.UserSessionTimeOutInterval)); sessionInfo.sessionMap.put(SOFT_LIMIT_PARAMETER_NAME, softLimit); } } value = sessionInfo.sessionMap.get(key); } return value; }
Source:
<code>String write(@NonNull T streamable) { if (storeDirectory == null) { return null; } File exceptionDir = new File(storeDirectory); if (exceptionDir.isDirectory()) { File[] files = exceptionDir.listFiles(); if (files != null && files.length >= maxStoreCount) { Arrays.sort(files, comparator); Logger.warn(String.format("Discarding oldest error as stored " + "error limit reached (%s)", files[0].getPath())); if (!files[0].delete()) { files[0].deleteOnExit(); } } } String filename = getFilename(streamable); Writer out = null; try { FileOutputStream fos = new FileOutputStream(filename); <START> out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); <END> JsonStream stream = new JsonStream(out); stream.value(streamable); stream.close(); Logger.info(String.format("Saved unsent payload to disk (%s) ", filename)); return filename; } catch (Exception exception) { Logger.warn(String.format("Couldn't save unsent payload to disk (%s) ", filename), exception); } finally { IOUtils.closeQuietly(out); } return null; }</code><technical_language>do of objects need closing</technical_language>

Target:
String write(@NonNull T streamable) { if (storeDirectory == null) { return null; } File exceptionDir = new File(storeDirectory); if (exceptionDir.isDirectory()) { File[] files = exceptionDir.listFiles(); if (files != null && files.length >= maxStoreCount) { Arrays.sort(files, comparator); for (int k = 0; k < files.length && files.length >= maxStoreCount; k++) { File oldestFile = files[k]; if (!queuedFiles.contains(oldestFile)) { Logger.warn(String.format("Discarding oldest error as stored " + "error limit reached (%s)", oldestFile.getPath())); deleteStoredFiles(Collections.singleton(oldestFile)); } } } } String filename = getFilename(streamable); JsonStream stream = null; lock.lock(); try { FileOutputStream fos = new FileOutputStream(filename); Writer out = new BufferedWriter(new OutputStreamWriter(fos, "UTF-8")); stream = new JsonStream(out); stream.value(streamable); Logger.info(String.format("Saved unsent payload to disk (%s) ", filename)); return filename; } catch (Exception exception) { Logger.warn(String.format("Couldn't save unsent payload to disk (%s) ", filename), exception); } finally { IOUtils.closeQuietly(stream); lock.unlock(); } return null; }
Source:
<code>public long getVolume() { <START> return (long) Math.floor(radius.getX() * radius.getZ() * Math.PI * getHeight()); <END> }</code><technical_language>I prefer accuracy speed here, a BigDecimal for calculations. noticeably slower (I is calling this frame op!), allow provide guarantees results of method</technical_language>

Target:
public long getVolume() { return BigDecimal.valueOf(radius.getX()) .multiply(BigDecimal.valueOf(radius.getZ())) .multiply(PI) .multiply(BigDecimal.valueOf(getHeight())) .setScale(0, RoundingMode.FLOOR) .longValue(); }
Source:
<code>protected void executeCommand() { updateQuotaCache(); if (_oldStoragePool.getstatus() == StoragePoolStatus.Up) { if (!StringHelper.EqOp(_oldStoragePool.getname(), getStoragePool().getname())) { runVdsCommand(VDSCommandType.SetStoragePoolDescription, new SetStoragePoolDescriptionVDSCommandParameters( getStoragePool().getId(), getStoragePool().getname()) ); } } <START> updateNewStoragePoolEntity(getStoragePool(), _oldStoragePool); <END> getStoragePoolDAO().updatePartial(getStoragePool()); updateStoragePoolFormatType(); setSucceeded(true); }</code><technical_language>name intuitive, IMHO. copyUnchangedStoragePoolProperties(), lines</technical_language>

Target:
protected void executeCommand() { updateQuotaCache(); if (_oldStoragePool.getstatus() == StoragePoolStatus.Up) { if (!StringHelper.EqOp(_oldStoragePool.getname(), getStoragePool().getname())) { runVdsCommand(VDSCommandType.SetStoragePoolDescription, new SetStoragePoolDescriptionVDSCommandParameters( getStoragePool().getId(), getStoragePool().getname()) ); } } copyUnchangedStoragePoolProperties(getStoragePool(), _oldStoragePool); getStoragePoolDAO().updatePartial(getStoragePool()); updateStoragePoolFormatType(); setSucceeded(true); }
Source:
<code>public Enumeration<Object> elements() { <START> throw new RuntimeException("Method elements is not supported in LinkedProperties class"); <END> }</code><technical_language>return java.util.Collections.enumeration(linkMap.values()) is done for keys()</technical_language>

Target:
public Enumeration<Object> elements() { return Collections.enumeration(linkMap.values()); }
Source:
<code>public void run() { List<SurveyDB> surveys = SurveyDB.getAllCompletedUnsentSurveys(); for (SurveyDB survey : surveys) { survey.setStatus(SURVEY_SENT); survey.save(); } <START> mMainExecutor.run(new Runnable() { <END> @Override public void run() { mCallback.onPushFinished(); } }); }</code><technical_language>Extract notification method notify..</technical_language>

Target:
public void run() { List<SurveyDB> surveys = SurveyDB.getAllCompletedUnsentSurveys(); for (SurveyDB survey : surveys) { survey.setStatus(SURVEY_SENT); survey.save(); } notifyOnPushFinished(); }
Source:
<code>public static String decrypt(String message) throws InvalidParametersException { try { SecretKeySpec sks = new SecretKeySpec(hexStringToByteArray(Config.ENCRYPTION_KEY), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, sks); byte[] decrypted = cipher.doFinal(hexStringToByteArray(message)); return new String(decrypted); } catch (NumberFormatException | IllegalBlockSizeException | BadPaddingException e) { log.warning("Attempted to decrypt invalid ciphertext: " + message); <START> throw new InvalidParametersException(e.getMessage()); END> } catch (Exception e) { throw new RuntimeException(e); } }</code><technical_language>I e.getMessage() stack trace. Is do InvalidParametersException(e) instead</technical_language>

Target:
public static String decrypt(String message) throws InvalidParametersException { try { SecretKeySpec sks = new SecretKeySpec(hexStringToByteArray(Config.ENCRYPTION_KEY), "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, sks); byte[] decrypted = cipher.doFinal(hexStringToByteArray(message)); return new String(decrypted); } catch (NumberFormatException | IllegalBlockSizeException | BadPaddingException e) { log.warning("Attempted to decrypt invalid ciphertext: " + message); throw new InvalidParametersException(e); } catch (Exception e) { throw new RuntimeException(e); } }
Source:
<code>protected void execute() { for (SallegraBindingProvider provider : providers) { Collection<String> names = provider.getItemNames(); for (String name : names) { logger.debug("Name {}", name); SallegraBindingConfig bindingConfig = provider .getBindingConfigFor(name); String deviceId = bindingConfig.getModuleName(); if (sallegraNodes.containsKey(deviceId)) { SallegraNode node = sallegraNodes.get(deviceId); String value = null; switch (bindingConfig.getCmdId()) { case RELAY: value = node.getRelay(bindingConfig.getCmdValue()); break; case DIMMER: value = node.getDimmer(bindingConfig.getCmdValue()); break; case INPUT: value = node.getInput(bindingConfig.getCmdValue()); break; default: <START> break; <END> } if (value != null) { postUpdate(provider, bindingConfig.getItem(), value); } } else { logger.error("Unknown deviceId \"{}\"", deviceId); } } } }</code><technical_language>default: break; is assumed</technical_language>

Target:
protected void execute() { for (SallegraBindingProvider provider : providers) { Collection<String> names = provider.getItemNames(); for (String name : names) { logger.debug("Name {}", name); SallegraBindingConfig bindingConfig = provider .getBindingConfigFor(name); String deviceId = bindingConfig.getModuleName(); if (sallegraNodes.containsKey(deviceId)) { SallegraNode node = sallegraNodes.get(deviceId); String value = null; switch (bindingConfig.getCmdId()) { case RELAY: value = node.getRelay(bindingConfig.getCmdValue()); break; case DIMMER: value = node.getDimmer(bindingConfig.getCmdValue()); break; case INPUT: value = node.getInput(bindingConfig.getCmdValue()); break; } if (value != null) { postUpdate(provider, bindingConfig, value); } } else { logger.error("Unknown deviceId \"{}\"", deviceId); } } } }
Source:
<code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { String swaggerSpecificationJSON = ""; try { StringBuilder baseUrl = new StringBuilder(); String scheme = request.getScheme(); int port = request.getServerPort(); baseUrl.append(scheme); baseUrl.append("://"); baseUrl.append(request.getServerName()); if ((scheme.equals("http") && port != 80) || (scheme.equals("https") && port != 443)) { baseUrl.append(':'); baseUrl.append(request.getServerPort()); } baseUrl.append(request.getContextPath()); String resourcesUrl = Context.getAdministrationService().getGlobalProperty(FHIRConstants.URI_PREFIX_GLOBAL_PROPERTY_NAME, baseUrl.toString()); String urlWithoutScheme = ""; <START> String basePath = "/openmrs/ws/fhir"; <END> if (scheme.equals("http")) { urlWithoutScheme = resourcesUrl.replace("http://", ""); } else if (scheme.equals("https")) { urlWithoutScheme = resourcesUrl.replace("https://", ""); } urlWithoutScheme = urlWithoutScheme.replace("/openmrs", ""); SwaggerSpecificationCreator creator = new SwaggerSpecificationCreator(urlWithoutScheme, basePath); swaggerSpecificationJSON = creator.buildJSON(); response.setContentType("application/json"); response.setCharacterEncoding("UTF-8"); response.getWriter().write(swaggerSpecificationJSON); } catch (Exception exception) { } }</code><technical_language>move constants</technical_language>

Target:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException { String swaggerSpecificationJSON; try { StringBuilder baseUrl = new StringBuilder(); String scheme = request.getScheme(); int port = request.getServerPort(); baseUrl.append(scheme); baseUrl.append(SwaggerDocConstants.SLASHES); baseUrl.append(request.getServerName()); if ((SwaggerDocConstants.HTTP.equals(scheme) && port != 80) || (SwaggerDocConstants.HTTPS.equals(scheme) && port != 443)) { baseUrl.append(SwaggerDocConstants.COLON); baseUrl.append(request.getServerPort()); } baseUrl.append(request.getContextPath()); String resourcesUrl = Context.getAdministrationService().getGlobalProperty(FHIRConstants.URI_PREFIX_GLOBAL_PROPERTY_NAME, baseUrl.toString()); String urlWithoutScheme = ""; String basePath = SwaggerDocConstants.SHORT_FHIR_REST_PREFIX; if (SwaggerDocConstants.HTTP.equals(scheme)) { urlWithoutScheme = resourcesUrl.replace(SwaggerDocConstants.HTTP_WITH_SLASHES, SwaggerDocConstants.STR_EMPTY); } else if (SwaggerDocConstants.HTTPS.equals(scheme)) { urlWithoutScheme = resourcesUrl.replace(SwaggerDocConstants.HTTPS_WITH_SLASHES, SwaggerDocConstants.STR_EMPTY); } urlWithoutScheme = urlWithoutScheme.replace(SwaggerDocConstants.OPENMRS_PREFIX, SwaggerDocConstants.STR_EMPTY); SwaggerSpecificationCreator creator = new SwaggerSpecificationCreator(urlWithoutScheme, basePath); swaggerSpecificationJSON = creator.buildJSON(); response.setContentType(SwaggerDocConstants.PRODUCES_JSON); response.setCharacterEncoding(SwaggerDocConstants.UTF_8); response.getWriter().write(swaggerSpecificationJSON); } catch (Exception e) { log.error("Error while processing request", e); } }
Source:
<code>public void initMainThreadHandlerCalled() { final AtomicReference<Callable<Scheduler>> schedulerRef = new AtomicReference<>(); final Scheduler newScheduler = new EmptyScheduler(); RxAndroidPlugins .setInitMainThreadSchedulerHandler(new Function<Callable<Scheduler>, Scheduler>() { @Override public Scheduler apply(Callable<Scheduler> scheduler) { schedulerRef.set(scheduler); return newScheduler; } }); Callable<Scheduler> scheduler = new Callable<Scheduler>() { @Override public Scheduler call() throws Exception { <START> return new EmptyScheduler(); <END> } }; Scheduler actual = RxAndroidPlugins.initMainThreadScheduler(scheduler); assertSame(newScheduler, actual); assertSame(scheduler, schedulerRef.get()); }</code><technical_language>java throw new AssertionError();</technical_language>

Target:
public void initMainThreadHandlerCalled() { final AtomicReference<Callable<Scheduler>> schedulerRef = new AtomicReference<>(); final Scheduler newScheduler = new EmptyScheduler(); RxAndroidPlugins .setInitMainThreadSchedulerHandler(new Function<Callable<Scheduler>, Scheduler>() { @Override public Scheduler apply(Callable<Scheduler> scheduler) { schedulerRef.set(scheduler); return newScheduler; } }); Callable<Scheduler> scheduler = new Callable<Scheduler>() { @Override public Scheduler call() throws Exception { throw new AssertionError(); } }; Scheduler actual = RxAndroidPlugins.initMainThreadScheduler(scheduler); assertSame(newScheduler, actual); assertSame(scheduler, schedulerRef.get()); }
Source:
<code>public void checkNetworkTenancyAfterRemove() throws Exception { List<NetworkTenancy> networkTenancies = given() .when() .get("/corsSites/search/findByFourCharacterId?id=ALIC") .then() .statusCode(HttpStatus.OK.value()) .extract().jsonPath().getList("networkTenancies", NetworkTenancy.class); <START> assertThat(networkTenancies.size(), is(0)); <END> }</code><technical_language>assertThat(networkTenancies).isEmpty()</technical_language>

Target:
public void checkNetworkTenancyAfterRemove() throws Exception { List<NetworkTenancy> networkTenancies = given() .when() .get("/corsSites/search/findByFourCharacterId?id=ALIC") .then() .statusCode(HttpStatus.OK.value()) .extract().jsonPath().getList("networkTenancies", NetworkTenancy.class); assertThat(networkTenancies, is(empty())); }
Source:
<code>protected void clearIndex() { indexSpec.clear(); secondaryIndexes.clear(); <START> indexGenerationFailed = true; <END> }</code><technical_language>indexGenerationFailed volatile AtomicBoolean</technical_language>

Target:
protected void clearIndex() { indexSpec.clear(); secondaryIndexes.clear(); }
Source:
<code>protected DataStoreTestHarness createHarness() { try { final String dataStoreSupplierName = System.getProperty("dataStoreHarness"); <START> System.out.println("Datastore: " + dataStoreSupplierName); <END> if (dataStoreSupplierName != null && !dataStoreSupplierName.isEmpty()) { return Class.forName(dataStoreSupplierName).asSubclass(DataStoreTestHarness.class).newInstance(); } return new InMemoryDataStoreHarness(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e) { throw new IllegalStateException(e); } }</code><technical_language>Remove</technical_language>

Target:
protected DataStoreTestHarness createHarness() { try { final String dataStoreSupplierName = System.getProperty("dataStoreHarness"); if (dataStoreSupplierName != null && !dataStoreSupplierName.isEmpty()) { return Class.forName(dataStoreSupplierName).asSubclass(DataStoreTestHarness.class).newInstance(); } return new InMemoryDataStoreHarness(); } catch (InstantiationException | IllegalAccessException | ClassNotFoundException | ClassCastException e) { throw new IllegalStateException(e); } }
Source:
<code>public void onNoteRemove(Note note) { try { notebookServer.broadcastUpdateNoteJobInfo(System.currentTimeMillis() - 5000); } catch (IOException ioe) { <START> LOG.warn("can not broadcast for job manager {}", ioe.getMessage()); <END> } try { getJobManagerService().removeNoteJobInfo(note.getId(), null, new JobManagerServiceCallback()); } catch (IOException ioe) { LOG.warn("can not broadcast for job manager {}", ioe.getMessage()); } }</code><technical_language>LOG.warn("can broadcast for job manager {}", ioe.getMessage(), ioe);</technical_language>

Target:
public void onNoteRemove(Note note) { try { notebookServer.broadcastUpdateNoteJobInfo(System.currentTimeMillis() - 5000); } catch (IOException e) { LOG.warn("can not broadcast for job manager: " + e.getMessage(), e); } try { getJobManagerService().removeNoteJobInfo(note.getId(), null, new JobManagerServiceCallback()); } catch (IOException e) { LOG.warn("can not broadcast for job manager: " + e.getMessage(), e); } }
Source:
<code>protected <T> Stream<Object> resolveEventTargets(EventMessage message, T parentEntity, Member member, ForwardingMode eventForwardingMode) { <START> Iterable<Object> fieldValue = ReflectionUtils.getMemberValue(member, parentEntity); <END> return fieldValue == null ? Stream.empty() : eventForwardingMode.filterCandidates(message, StreamSupport.stream(fieldValue.spliterator(), false)); }</code><technical_language>rename this variable memberValue</technical_language>

Target:
protected <T> Stream<Object> resolveEventTargets(EventMessage message, T parentEntity, Member member, ForwardingMode eventForwardingMode) { Iterable<Object> memberValue = ReflectionUtils.getMemberValue(member, parentEntity); return memberValue == null ? Stream.empty() : eventForwardingMode.filterCandidates(message, StreamSupport.stream(memberValue.spliterator(), false)); }
Source:
<code>public void sendRedirect(String uri) { try { <START> ((HttpServletResponse) getNativeResponse()).sendRedirect(uri != null ? getContextPath() + uri : ""); <END> setVoided(true); } catch (IOException ex) { throw new UiException(ex); } }</code><technical_language>uri encode? plz check another sendRedirect function in another class</technical_language>

Target:
public void sendRedirect(String uri) { try { ((HttpServletResponse) getNativeResponse()).sendRedirect(uri != null ? encodeURL(uri) : ""); setVoided(true); } catch (IOException ex) { throw new UiException(ex); } }
Source:
<code>public void addMessageListener(org.apache.helix.MessageListener listener, String instanceName) { addListener(listener, new Builder(_clusterName).messages(instanceName), ChangeType.MESSAGE, <START> new EventType[] { EventType.NodeChildrenChanged }, _messageRefreshTriggerInterval); <END> }</code><technical_language>optional, I guess need add support for deprecated methods. question, casting deprecated listener class newer one? maintenance-free</technical_language>

Target:
public void addMessageListener(org.apache.helix.MessageListener listener, String instanceName) { addMessageListener((MessageListener) listener, instanceName); }
Source:
<code>public void transferSuccessful() { <START> if (PullServerUtil.isNativeIOPossible() && manageOsCache && count() > 0) { <END> try { PullServerUtil.posixFadviseIfPossible(identifier, fd, position(), count(), NativeIO.POSIX.POSIX_FADV_DONTNEED); } catch (Throwable t) { LOG.warn("Failed to manage OS cache for " + identifier, t); } } }</code><technical_language>add file checking ? if (PullServerUtil.isNativeIOPossible() && manageOsCache && count() > 0 && super.isOpen()) fix "bad file descriptor" 2015-03-03 10:34:40,755 WARN org.apache.tajo.pullserver.PullServerUtil: Failed manage OS cache for /data05/tajo/data/q_1425346386770_0001/output/1/hash-shuffle/3/263 java.lang.NullPointerException sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.apache.tajo.pullserver.PullServerUtil.posixFadviseIfPossible(PullServerUtil.java:56) org.apache.tajo.pullserver.FadvisedFileRegion.transferSuccessful(FadvisedFileRegion.java:163) org.apache.tajo.pullserver.FileCloseListener.operationComplete(FileCloseListener.java:46)</technical_language>

Target:
public void transferSuccessful() { if (PullServerUtil.isNativeIOPossible() && manageOsCache && count() > 0 && super.isOpen()) { try { PullServerUtil.posixFadviseIfPossible(identifier, fd, position(), count(), NativeIO.POSIX.POSIX_FADV_DONTNEED); } catch (Throwable t) { LOG.warn("Failed to manage OS cache for " + identifier, t); } } }
Source:
<code>protected void log(final Level level, final String msg) { <START> this.logger.log(level, this.simpleName + " " + msg); <END> }</code><technical_language>warning: static field AbstractProcessor.logger accessed in a static way</technical_language>

Target:
protected void log(final Level level, final String msg) { this.LOGGER.log(level, this.simpleName + " " + msg); }
Source:
<code>public void define(Context context) { <START> System.err.println("Fake GOV WS being setup: " + actions.length); <END> NewController controller = context.createController("api/fake_gov"); Arrays.stream(actions).forEach(action -> action.define(controller)); controller.done(); }</code><technical_language>this in a Logger (so in web.log a test ?)</technical_language>

Target:
public void define(Context context) { NewController controller = context.createController("api/fake_gov"); Arrays.stream(actions).forEach(action -> action.define(controller)); controller.done(); }
Source:
<code>private void stageSchemaFiles(Configuration config){ <START> if (config.m_userSchema == null){ <END> return; } File stagedCatalogFH = new VoltFile(getStagedCatalogPath()); final boolean standalone = true; final boolean isXCDR = false; VoltCompiler compiler = new VoltCompiler(standalone, isXCDR); if (!compiler.compileFromDDL(stagedCatalogFH.getAbsolutePath(), config.m_userSchema.getAbsolutePath())){ VoltDB.crashLocalVoltDB("Could not compile specified schema " + config.m_userSchema, false, null); } }</code><technical_language>add check for trim.isEmpty()</technical_language>

Target:
private void stageSchemaFiles(Configuration config){ if (config.m_userSchema == null){ return; } assert( config.m_userSchema.isFile() ); File stagedCatalogFH = new VoltFile(getStagedCatalogPath()); assert( !stagedCatalogFH.exists() || config.m_forceVoltdbCreate ); final boolean standalone = true; final boolean isXCDR = false; VoltCompiler compiler = new VoltCompiler(standalone, isXCDR); if (!compiler.compileFromDDL(stagedCatalogFH.getAbsolutePath(), config.m_userSchema.getAbsolutePath())){ VoltDB.crashLocalVoltDB("Could not compile specified schema " + config.m_userSchema, false, null); } }
Source:
<code>public @Nonnull String getDescription() { Node node = getNode(); <START> return (node != null) ? node.getNodeDescription() : ""; <END> }</code><technical_language>return null</technical_language>

Target:
public @Nonnull String getDescription() { Node node = getNode(); return (node != null) ? node.getNodeDescription() : null; }
Source:
<code>private void loadImage(String mediaUri) { if (TextUtils.isEmpty(mediaUri)) { showLoadingError(); return; } mImageView.setVisibility(View.VISIBLE); if (mSite == null || SiteUtils.isPhotonCapable(mSite)) { int maxWidth = Math.max(DisplayUtils.getDisplayPixelWidth(getActivity()), DisplayUtils.getDisplayPixelHeight(getActivity())); mediaUri = PhotonUtils.getPhotonImageUrl(mediaUri, maxWidth, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, mediaUri, ScaleType.CENTER, new RequestListener() { @Override public void onResourceReady(@Nullable Drawable resource) { if (isAdded()) { if (resource != null) { PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView); attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { @Override public void onViewTap(View view, float x, float y) { if (mMediaTapListener != null) { mMediaTapListener.onMediaTapped(); } } }); showProgress(false); <START> } else { <END> AppLog.e(T.MEDIA, "Loading media preview failed - resource is null."); } } } @Override public void onLoadFailed(@Nullable Exception e) { if (isAdded()) { AppLog.e(T.MEDIA, e); showProgress(false); showLoadingError(); } } }); }</code><technical_language>implement this else similar onLoadFailed? Do want show loading error in this case user's standpoint a loading error? More importantly, move showProgress(false) of if/else triggered in this else resource is loading? P.S: I tested assumptions, reading code :)</technical_language>

Target:
private void loadImage(String mediaUri) { if (TextUtils.isEmpty(mediaUri)) { showLoadingError(); return; } mImageView.setVisibility(View.VISIBLE); if (mSite == null || SiteUtils.isPhotonCapable(mSite)) { int maxWidth = Math.max(DisplayUtils.getDisplayPixelWidth(getActivity()), DisplayUtils.getDisplayPixelHeight(getActivity())); mediaUri = PhotonUtils.getPhotonImageUrl(mediaUri, maxWidth, 0); } showProgress(true); mImageManager.load(mImageView, ImageType.FULLSCREEN_PHOTO, mediaUri, ScaleType.CENTER, new RequestListener() { @Override public void onResourceReady(@NotNull Drawable resource) { if (isAdded()) { PhotoViewAttacher attacher = new PhotoViewAttacher(mImageView); attacher.setOnViewTapListener(new PhotoViewAttacher.OnViewTapListener() { @Override public void onViewTap(View view, float x, float y) { if (mMediaTapListener != null) { mMediaTapListener.onMediaTapped(); } } }); showProgress(false); } } @Override public void onLoadFailed(@Nullable Exception e) { if (isAdded()) { AppLog.e(T.MEDIA, e); showProgress(false); showLoadingError(); } } }); }
Source:
<code>public static @Nullable ITmfEvent getPreviousEventMatching(ITmfTrace trace, long startRank, Predicate<ITmfEvent> predicate) { final int step = <START> 100; <END> long currentRank = startRank; try { while (currentRank > 0) { currentRank = Math.max(currentRank - step, 0); EventMatchingRequest req = new EventMatchingRequest(currentRank, step, predicate, true); trace.sendRequest(req); req.waitForCompletion(); ITmfEvent event = req.getFoundEvent(); if (event != null) { return event; } } } catch (InterruptedException e) { return null; } return null; }</code><technical_language>trace's cache size</technical_language>

Target:
public static @Nullable ITmfEvent getPreviousEventMatching(ITmfTrace trace, long startRank, Predicate<ITmfEvent> predicate) { final int targetStep = 100; int step = (startRank < targetStep ? (int) startRank : targetStep); long currentRank = startRank; try { while (currentRank > 0) { currentRank = Math.max(currentRank - step, 0); EventMatchingRequest req = new EventMatchingRequest(currentRank, step, predicate, true); trace.sendRequest(req); req.waitForCompletion(); ITmfEvent event = req.getFoundEvent(); if (event != null) { return event; } } } catch (InterruptedException e) { return null; } return null; }
Source:
<code>private Set<String> toDirSet(String dirs) { <START> if (dirs == null || dirs.length() == 0) <END> return Collections.emptySet(); Set<String> configuredStrings = new HashSet<String>(); StringTokenizer tok = new StringTokenizer(dirs, File.pathSeparator); while (tok.hasMoreTokens()) { configuredStrings .add(workspacePath.resolve(tok.nextToken()).toString()); } return configuredStrings; }</code><technical_language>While touching this, add missing braces? dirs.isEmpty()</technical_language>

Target:
private Set<String> toDirSet(String dirs) { if (dirs == null || dirs.isEmpty()) { return Collections.emptySet(); } Set<String> configuredStrings = new HashSet<String>(); StringTokenizer tok = new StringTokenizer(dirs, File.pathSeparator); while (tok.hasMoreTokens()) { configuredStrings .add(workspacePath.resolve(tok.nextToken()).toString()); } return configuredStrings; }
Source:
<code>public Map<AccountGroup.UUID, GroupMembersList> getUnresolvedGroups( final boolean recursive) { if (!recursive) { if (isResolved()) { return Collections.emptyMap(); <START> } else { <END> return Collections.singletonMap(getGroup().getGroupUUID(), this); } } else { return getAllUnresolvedGroups(new HashSet<AccountGroup.Id>()); } }</code><technical_language>Nit: pref eliminate unneeded elses (117,120) returns</technical_language>

Target:
public Map<AccountGroup.UUID, GroupMembersList> getUnresolvedGroups( final boolean recursive) { if (!recursive) { if (isResolved()) { return Collections.emptyMap(); } return Collections.singletonMap(getGroup().getGroupUUID(), this); } return getAllUnresolvedGroups(new HashSet<AccountGroup.Id>()); }
Source:
<code>public String getTitle() { <START> return I18N.tr("Simple Style Editor - ") + layer.getName(); <END> }</code><technical_language>Good catch :-D</technical_language>

Target:
public String getTitle() { return I18N.tr("Simple Style Editor - {0}", layer.getName()); }
Source:
<code>private void expandInboundRelationships(List<SnomedConcept> results, final Set<String> conceptIds) { if (!expand().containsKey(SnomedConcept.Expand.INBOUND_RELATIONSHIPS)) { return; } final Options expandOptions = expand().get(SnomedConcept.Expand.INBOUND_RELATIONSHIPS, Options.class); final int relationshipSearchLimit = getLimit(expandOptions); <START> final SnomedRelationships inboundRelationships = SnomedRequests.prepareSearchRelationship() <END> .setLimit(relationshipSearchLimit) .filterByActive(expandOptions.containsKey("active") ? expandOptions.getBoolean("active") : null) .filterByCharacteristicType(expandOptions.containsKey("characteristicType") ? expandOptions.getString("characteristicType") : null) .filterByDestination(conceptIds) .setExpand(expandOptions.get("expand", Options.class)) .setLocales(locales()) .build() .execute(context()); final ListMultimap<String, SnomedRelationship> inboundRelationshipsByConceptId = Multimaps.index(inboundRelationships, inboundRelationship -> inboundRelationship.getDestinationId()); for (SnomedConcept concept : results) { final List<SnomedRelationship> conceptInboundRelationships = inboundRelationshipsByConceptId.get(concept.getId()); concept.setInboundRelationships(new SnomedRelationships(conceptInboundRelationships, null, null, conceptInboundRelationships.size(), conceptInboundRelationships.size())); } }</code><technical_language>Please, add support for filtering inbound relationships typeId sourceId</technical_language>

Target:
private void expandInboundRelationships(List<SnomedConcept> results, final Set<String> conceptIds) { if (!expand().containsKey(SnomedConcept.Expand.INBOUND_RELATIONSHIPS)) { return; } final Options expandOptions = expand().get(SnomedConcept.Expand.INBOUND_RELATIONSHIPS, Options.class); final int relationshipSearchLimit = getLimit(expandOptions); final SnomedRelationships inboundRelationships = SnomedRequests.prepareSearchRelationship() .setLimit(relationshipSearchLimit) .filterByType(expandOptions.containsKey("typeId") ? expandOptions.getCollection("typeId", String.class) : null) .filterBySource(expandOptions.containsKey("sourceId") ? expandOptions.getCollection("sourceId", String.class) : null) .filterByActive(expandOptions.containsKey("active") ? expandOptions.getBoolean("active") : null) .filterByCharacteristicType(expandOptions.containsKey("characteristicType") ? expandOptions.getString("characteristicType") : null) .filterByDestination(conceptIds) .setExpand(expandOptions.get("expand", Options.class)) .setLocales(locales()) .build() .execute(context()); final ListMultimap<String, SnomedRelationship> inboundRelationshipsByConceptId = Multimaps.index(inboundRelationships, inboundRelationship -> inboundRelationship.getDestinationId()); for (SnomedConcept concept : results) { final List<SnomedRelationship> conceptInboundRelationships = inboundRelationshipsByConceptId.get(concept.getId()); concept.setInboundRelationships(new SnomedRelationships(conceptInboundRelationships, null, null, conceptInboundRelationships.size(), conceptInboundRelationships.size())); } }
Source:
<code>protected void handleEvent(PullRequestEvent event) { if (settingsService.getSettings(event.getPullRequest().getToRef() .getRepository()) == null) { return; } <START> String strRef = event.getPullRequest().getFromRef().toString().split(":", 2)[1]; <END> String strSha1 = event.getPullRequest().getFromRef().getLatestChangeset(); EventContext context = new EventContext(event, event.getPullRequest().getToRef().getRepository(), event.getUser().getName()); if (filterChain.shouldDeliverNotification(context)) notifier.notifyBackground(context.getRepository(), strRef, strSha1); }</code><technical_language>I a short description of string manipulation here. E.g. string split+index it</technical_language>

Target:
protected void handleEvent(PullRequestEvent event) { }
Source:
<code>public CosemDateTimeDto getDaylightSavingsEnd() { <START> return new CosemDateTimeDto(this.daylightSavingsEnd); <END> }</code><technical_language>I CosemDateTimeDto is immutable, is need create a new protect field in this class changes outside</technical_language>

Target:
public CosemDateTimeDto getDaylightSavingsEnd() { return this.daylightSavingsEnd; }
Source:
<code>public void VideosPageTest_002() { SpecialVideosPageObject specialVideos = new SpecialVideosPageObject(driver); YoutubeVideo video = YoutubeVideoProvider.getLatestVideoForQuery(VIDEO_QUERY); specialVideos.addVideoViaAjax(video.getUrl()); specialVideos.isNewVideoAdded(); <START> ADDED_VIDEO_TITLE = specialVideos.getNewestVideoTitle(); <END> specialVideos.deleteNewestVideo(); Assertion.assertTrue(specialVideos.getBannerNotifications().isNotificationMessageVisible(), "Banner notification is not visible"); Assertion.assertTrue(specialVideos.getBannerNotificationText().contains(ADDED_VIDEO_TITLE), "Banner notification text doesn't contains video title"); }</code><technical_language>Local method variable enough (instead of a static class member)</technical_language>

Target:
public void VideosPageTest_002() { SpecialVideosPageObject specialVideos = new SpecialVideosPageObject(driver); YoutubeVideo video = YoutubeVideoProvider.getLatestVideoForQuery(VIDEO_QUERY); specialVideos.addVideoViaAjax(video.getUrl()); specialVideos.isNewVideoAdded(); String addedVideoTitle = specialVideos.getNewestVideoTitle(); specialVideos.deleteNewestVideo(); Assertion.assertTrue(specialVideos.getBannerNotifications().isNotificationMessageVisible(), "Banner notification is not visible"); Assertion.assertTrue(specialVideos.getBannerNotificationText().contains(addedVideoTitle), "Banner notification text doesn't contains video title"); }
Source:
<code>private static FileAppender getFileAppender() { <START> Enumeration e = LogManager.getRootLogger().getAllAppenders(); <END> FileAppender fileAppender = null; while (e.hasMoreElements()) { Appender appender = (Appender)e.nextElement(); if (appender instanceof FileAppender) { if (fileAppender == null) { fileAppender = (FileAppender)appender; } else { return null; } } } return fileAppender; }</code><technical_language>Enumeration<Appender> avoid casting</technical_language>

Target:
private static FileAppender getFileAppender() { Enumeration<Appender> e = LogManager.getRootLogger().getAllAppenders(); FileAppender fileAppender = null; while (e.hasMoreElements()) { Appender appender = e.nextElement(); if (appender instanceof FileAppender) { if (fileAppender == null) { fileAppender = (FileAppender)appender; } else { return null; } } } return fileAppender; }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { RevCommit commit = getSelectedItem(RevCommit.class, event); if (commit == null) return null; Repository repo = getSelectedItem(Repository.class, event); if (repo == null) return null; Shell shell = getPart(event).getSite().getShell(); String newMessage = promptCommitMessage(shell, commit); if (newMessage == null) return null; final RewordCommitOperation op = new RewordCommitOperation(repo, commit, newMessage); <START> Job job = new Job(MessageFormat.format(UIText.RewordHandler_JobName, <END> commit.name())) { @Override protected IStatus run(IProgressMonitor monitor) { try { op.execute(monitor); } catch (CoreException e) { Activator.logError(UIText.RewordHandler_InternalError, e); } return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (JobFamilies.CHERRY_PICK.equals(family)) return true; return super.belongsTo(family); } }; job.setUser(true); job.setRule(op.getSchedulingRule()); job.schedule(); return null; }</code><technical_language>I a WorkspaceJob in order ensure resource change events triggered rebase moves HEAD batched end of job execution</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RevCommit commit = getSelectedItem(RevCommit.class, event); if (commit == null) return null; Repository repo = getSelectedItem(Repository.class, event); if (repo == null) return null; Shell shell = getPart(event).getSite().getShell(); String newMessage = promptCommitMessage(shell, commit); if (newMessage == null) return null; final RewordCommitOperation op = new RewordCommitOperation(repo, commit, newMessage); Job job = new WorkspaceJob(MessageFormat.format( UIText.RewordHandler_JobName, commit.name())) { @Override public IStatus runInWorkspace(IProgressMonitor monitor) { try { op.execute(monitor); } catch (CoreException e) { Activator.logError(UIText.RewordHandler_InternalError, e); } return Status.OK_STATUS; } @Override public boolean belongsTo(Object family) { if (JobFamilies.REWORD.equals(family)) return true; return super.belongsTo(family); } }; job.setUser(true); job.setRule(op.getSchedulingRule()); job.schedule(); return null; }
Source:
<code>public boolean isTrue(State state, String[] params) { if (this.subgoal == null) { return false; } <START> if (this.subgoal.getGoal().getClassName().equals(AffordanceCreator.CONTAINERGREASED_PF)) { <END> if (!this.subgoal.goalCompleted(state)) { return true; } } for (BakingSubgoal precondition : this.subgoal.getPreconditions()) { if (precondition.getGoal().getClassName().equals(AffordanceCreator.CONTAINERGREASED_PF)) { if (!precondition.goalCompleted(state)) { return true; } } } return false; }</code><technical_language>This if statement spread out lines</technical_language>

Target:
public boolean isTrue(State state, String[] params) { if (this.subgoal == null) { return false; } String subgoalClassName = this.subgoal.getGoal().getClassName(); if (subgoalClassName.equals(AffordanceCreator.CONTAINERGREASED_PF)) { if (!this.subgoal.goalCompleted(state)) { return true; } } List<BakingSubgoal> preconditions = this.subgoal.getPreconditions(); for (BakingSubgoal precondition : preconditions) { String preconditionClassName = precondition.getGoal().getClassName(); if (preconditionClassName.equals(AffordanceCreator.CONTAINERGREASED_PF)) { if (!precondition.goalCompleted(state)) { return true; } } } return false; }