auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected void schedule(GerritCause cause, GerritTriggeredEvent event, AbstractProject project) { BadgeAction badgeAction = new BadgeAction(event); int projectbuildDelay = getBuildScheduleDelay(); if (cause instanceof GerritUserCause) { projectbuildDelay = 0; } else if (project.getHasCustomQuietPeriod() && project.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = project.getQuietPeriod(); } ParametersAction parameters = createParameters(event, project); Future build = project.scheduleBuild2( projectbuildDelay, cause, badgeAction, new RetriggerAction(cause.getContext()), new RetriggerAllAction(cause.getContext()), parameters); if (event instanceof ChangeBasedEvent) { ChangeBasedEvent changeBasedEvent = (ChangeBasedEvent)event; if (PluginImpl.getInstance().getConfig().isGerritBuildCurrentPatchesOnly()) { getRunningJobs().scheduled(changeBasedEvent, parameters, project.getName()); } if (null != changeBasedEvent.getPatchSet()) { logger.info("Project Build Scheduled: By event: {}", new Object[]{project.getName(), (build != null), changeBasedEvent.getChange().getNumber() + "/" + changeBasedEvent.getPatchSet().getNumber(), }); <START> } <END> } else if (event instanceof RefUpdated) { RefUpdated refUpdated = (RefUpdated)event; logger.info("Project Build Scheduled: By event: {}", new Object[]{project.getName(), (build != null), refUpdated.getRefUpdate().getRefName() + " " + refUpdated.getRefUpdate().getNewRev(), }); } }</code><technical_language>add a log patchset</technical_language>

Target:
protected void schedule(GerritCause cause, GerritTriggeredEvent event, AbstractProject project) { BadgeAction badgeAction = new BadgeAction(event); int projectbuildDelay = getBuildScheduleDelay(); if (cause instanceof GerritUserCause) { projectbuildDelay = 0; } else if (project.getHasCustomQuietPeriod() && project.getQuietPeriod() > projectbuildDelay) { projectbuildDelay = project.getQuietPeriod(); } ParametersAction parameters = createParameters(event, project); Future build = project.scheduleBuild2( projectbuildDelay, cause, badgeAction, new RetriggerAction(cause.getContext()), new RetriggerAllAction(cause.getContext()), parameters); if (event instanceof ChangeBasedEvent) { ChangeBasedEvent changeBasedEvent = (ChangeBasedEvent)event; if (PluginImpl.getInstance().getConfig().isGerritBuildCurrentPatchesOnly()) { getRunningJobs().scheduled(changeBasedEvent, parameters, project.getName()); } if (null != changeBasedEvent.getPatchSet()) { logger.info("Project Build Scheduled: By event: {}", new Object[]{project.getName(), (build != null), changeBasedEvent.getChange().getNumber() + "/" + changeBasedEvent.getPatchSet().getNumber(), }); } else { logger.info("Project Build Scheduled: By event: {}", new Object[]{project.getName(), (build != null), changeBasedEvent.getChange().getNumber(), }); } } else if (event instanceof RefUpdated) { RefUpdated refUpdated = (RefUpdated)event; logger.info("Project Build Scheduled: By event: {}", new Object[]{project.getName(), (build != null), refUpdated.getRefUpdate().getRefName() + " " + refUpdated.getRefUpdate().getNewRev(), }); } }
Source:
<code>public synchronized @Nonnull String version() throws IOException { if (this.version == null) { Process p = runFunc.run(ImmutableList.of(path, "-version")); InputStream stream = p.getInputStream(); try { <START> LineIterator iterator = IOUtils.lineIterator(stream, StandardCharsets.UTF_8); <END> this.version = iterator.nextLine(); FFmpegUtils.throwOnError(FFMPEG, p); } finally { p.destroy(); IOUtils.closeQuietly(stream); } } return version; }</code><technical_language>LineIterator BufferedReader</technical_language>

Target:
public synchronized @Nonnull String version() throws IOException { if (this.version == null) { Process p = runFunc.run(ImmutableList.of(path, "-version")); try (InputStream stream = p.getInputStream()) { LineIterator iterator = IOUtils.lineIterator(stream, StandardCharsets.UTF_8); this.version = iterator.nextLine(); FFmpegUtils.throwOnError(FFMPEG, p); } finally { p.destroy(); IOUtils.closeQuietly(p.getOutputStream(), p.getErrorStream()); } } return version; }
Source:
<code>private ContentSource source(AbstractTreeIterator iterator) { <START> if (iterator instanceof WorkingTreeIterator) <END> return ContentSource.create((WorkingTreeIterator) iterator); return ContentSource.create(db.newObjectReader()); }</code><technical_language>style nit: missing braces</technical_language>

Target:
private ContentSource source(AbstractTreeIterator iterator) { if (iterator instanceof WorkingTreeIterator) { return ContentSource.create((WorkingTreeIterator) iterator); } return ContentSource.create(db.newObjectReader()); }
Source:
<code>public void setMaxReadsToAccumulatePerLocus(int maxReadsToAccumulatePerLocus) { if (getMaxReadsToAccumulatePerLocus() != maxReadsToAccumulatePerLocus) { <START> throw new UnsupportedOperationException("Locus cap is not supported for " + getClass().getSimpleName() + "."); <END> } }</code><technical_language>confused. set a Cap (as picard branch this) this about</technical_language>

Target:
public void setMaxReadsToAccumulatePerLocus(int maxReadsToAccumulatePerLocus) { if (getMaxReadsToAccumulatePerLocus() != 0) { throw new UnsupportedOperationException("Locus cap is not supported for " + getClass().getSimpleName() + "."); } }
Source:
<code><START> private String parseParamDelimiter() throws ParseException { <END> int index = nextNonBlank(); if (index < 0 || expression.charAt(index) != ',') { throw new ParseException(errorMessage(PARAMETER_DELIMITER_EXPECTED_ERROR), parseIndex); } setParseIndex(index + 1); return ","; }</code><technical_language>Return of method is used</technical_language>

Target:
private void parseParamDelimiter() throws ParseException { int index = nextNonBlank(); if (index < 0 || expression.charAt(index) != ',') { throw new ParseException(errorMessage(PARAMETER_DELIMITER_EXPECTED_ERROR), parseIndex); } setParseIndex(index + 1); }
Source:
<code>public AbstractListDataView<T> updateItem(T item, SerializableFunction<T, ?> identityProvider) { Objects.requireNonNull(item, "Item cannot be null"); Objects.requireNonNull(identityProvider, "Identity provider cannot be null"); Collection<T> items = getDataProvider().getItems(); if (items instanceof List) { final Object itemIdentifier = identityProvider.apply(item); Objects.requireNonNull(itemIdentifier, "Identity Provider should not return null"); final List<T> itemList = (List<T>) items; for (int itemIndex = 0; itemIndex < itemList.size(); itemIndex++) { T nextItem = itemList.get(itemIndex); if (itemIdentifier.equals( identityProvider.apply(nextItem))) { itemList.set(itemIndex, item); getDataProvider().refreshItem(item); } } return this; } <START> throw new IllegalArgumentException( <END> String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, items.getClass().getSimpleName())); }</code><technical_language>For a List implementation if needed remove add if item is item in collection</technical_language>

Target:
public AbstractListDataView<T> updateItem(T item, SerializableFunction<T, ?> identityProvider) { Objects.requireNonNull(item, "Item cannot be null"); final ListDataProvider<T> dataProvider = getDataProvider(); Collection<T> items = dataProvider.getItems(); if (items instanceof List) { final Object itemIdentifier = getIdentifier(item, identityProvider); final List<T> itemList = (List<T>) items; int itemIndex = getItemIndex(item, identityProvider); if (itemIndex != -1) { T itemToUpdate = itemList.get(itemIndex); if (itemIdentifier.equals( getIdentifier(itemToUpdate, identityProvider))) { itemList.set(itemIndex, item); dataProvider.refreshItem(item); } } return this; } throw new IllegalArgumentException( String.format(COLLECTION_TYPE_ERROR_MESSAGE_PATTERN, items.getClass().getSimpleName())); }
Source:
<code>public void load() { reservedClasses = new ArrayList<String>(); <START> reservedClasses.addAll(reservedGateClasses); <END> reservedClasses.addAll(reservedTestClasses); CoreModule.addGeneralApplicationParser(new ApplicationHomeParser()); CoreModule.addSystemApplicationParser(new ApplicationSystemParser()); CoreModule.addLayoutToHomeTab(TimelineLayout.getInstance()); final AsyncCallback<List<AppClass>> callback = new AsyncCallback<List<AppClass>>() { @Override public void onFailure(Throwable caught) { Layout.getInstance().setWarningMessage("Unable to load classes:<br />" + caught.getMessage()); } @Override public void onSuccess(List<AppClass> result) { for (AppClass appClass : result) { if (!reservedClasses.contains(appClass.getName())) { CoreModule.addApplicationsTileGrid( new ApplicationTileGrid(appClass.getName())); } } } }; ApplicationService.Util.getInstance().getClasses(callback); CenterTabSet.getInstance().addCloseClickHandler(new CloseClickHandler() { @Override public void onCloseClick(TabCloseClickEvent event) { Tab tab = event.getTab(); try { ((AbstractSimulationTab) tab).destroy(); } catch (ClassCastException ex) { } } }); }</code><technical_language>this point is guarantee reservedGateClasses initialized: call getApletGateLab\* done in constructor in progress. This is a bug, present modifications</technical_language>

Target:
public void load() { CoreModule.addGeneralApplicationParser(new ApplicationHomeParser()); CoreModule.addSystemApplicationParser(new ApplicationSystemParser()); CoreModule.addLayoutToHomeTab(TimelineLayout.getInstance()); final AsyncCallback<List<AppClass>> callback = new AsyncCallback<List<AppClass>>() { @Override public void onFailure(Throwable caught) { Layout.getInstance().setWarningMessage("Unable to load classes:<br />" + caught.getMessage()); } @Override public void onSuccess(List<AppClass> result) { for (AppClass appClass : result) { if (!reservedClasses.keySet().contains(appClass.getName())) { CoreModule.addApplicationsTileGrid( new ApplicationTileGrid(appClass.getName())); } } } }; ApplicationService.Util.getInstance().getClasses(callback); CenterTabSet.getInstance().addCloseClickHandler(new CloseClickHandler() { @Override public void onCloseClick(TabCloseClickEvent event) { Tab tab = event.getTab(); try { ((AbstractSimulationTab) tab).destroy(); } catch (ClassCastException ex) { } } }); }
Source:
<code>public static String encodeJavaOpts(String javaOpts) { String javaOptsBase64 = DatatypeConverter.printBase64Binary( javaOpts.getBytes(StandardCharsets.UTF_8)); <START> return String.format("\"%s\"", javaOptsBase64.replace("=", "(61)").replace("=", "&equals;")); <END> }</code><technical_language>do need .replace("=", "\&equals;")) here? "=" replaced previous replace statement right</technical_language>

Target:
public static String encodeJavaOpts(String javaOpts) { String javaOptsBase64 = DatatypeConverter.printBase64Binary( javaOpts.getBytes(StandardCharsets.UTF_8)); return String.format("\"%s\"", javaOptsBase64.replace("=", "(61)")); }
Source:
<code>public static void jobSchedulerCancelAll(@NonNull Context context) { JobScheduler jobScheduler = (JobScheduler) context.getSystemService(JOB_SCHEDULER_SERVICE); if (jobScheduler != null) { List<JobInfo> jobs = getPendingJobs(jobScheduler); if (jobs != null && !jobs.isEmpty()) { for (JobInfo jobInfo : jobs) { <START> jobScheduler.cancel(jobInfo.getId()); <END> } } } }</code><technical_language>want try/catch well</technical_language>

Target:
public static void jobSchedulerCancelAll(@NonNull Context context) { JobScheduler jobScheduler = (JobScheduler) context.getSystemService(JOB_SCHEDULER_SERVICE); if (jobScheduler != null) { List<JobInfo> jobs = getPendingJobs(jobScheduler); if (jobs != null && !jobs.isEmpty()) { for (JobInfo jobInfo : jobs) { int id = jobInfo.getId(); try { jobScheduler.cancel(id); } catch (Throwable throwable) { Logger.get().error(TAG, String.format(Locale.getDefault(), "Unable to cancel Job (%d)", id), throwable); } } } } }
Source:
<code>protected SftpFileSystem(final GenericFileName rootName, final Session session, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); this.session = Objects.requireNonNull(session, "session"); this.connectTimeoutMillis = SftpFileSystemConfigBuilder.getInstance() .getConnectTimeoutMillis(fileSystemOptions); if (SftpFileSystemConfigBuilder.getInstance().isExecEnabled(fileSystemOptions)){ this.execDisabled = detectExecDisabled(); <START> } <END> else { this.execDisabled = true; } }</code><technical_language>formatting "} else {"</technical_language>

Target:
protected SftpFileSystem(final GenericFileName rootName, final Session session, final FileSystemOptions fileSystemOptions) { super(rootName, null, fileSystemOptions); this.session = Objects.requireNonNull(session, "session"); this.connectTimeoutMillis = SftpFileSystemConfigBuilder.getInstance() .getConnectTimeoutMillis(fileSystemOptions); if (SftpFileSystemConfigBuilder.getInstance().isDisableDetectExecChannel(fileSystemOptions)) { this.execDisabled = true; } else { this.execDisabled = detectExecDisabled(); } }
Source:
<code>static String parseJDBCPassword(String jdbcUrl) throws SqlException { Properties properties = ClientDriver.tokenizeURLProperties(jdbcUrl, null); <START> System.out.println(properties); <END> return properties.getProperty("password"); }</code><technical_language>Remove</technical_language>

Target:
static String parseJDBCPassword(String jdbcUrl) throws SqlException { Properties properties = ClientDriver.tokenizeURLProperties(jdbcUrl, null); return properties.getProperty("password"); }
Source:
<code>private void fetchChapters() { App.getInstance().getGdgXHub().getDirectory( <START> new Callback<Directory>() { <END> @Override public void success(final Directory directory, Response response) { addChapters(directory.getGroups()); mLoadSwitcher.setDisplayedChild(1); App.getInstance().getModelCache().putAsync( Const.CACHE_KEY_CHAPTER_LIST_HUB, directory, DateTime.now().plusDays(4), null ); } @Override public void failure(RetrofitError error) { try { Snackbar snackbar = Snackbar.make( getView(), R.string.fetch_chapters_failed, Snackbar.LENGTH_INDEFINITE ); snackbar.setAction( "Retry", new View.OnClickListener() { @Override public void onClick(View v) { fetchChapters(); } } ); ColoredSnackBar.alert(snackbar).show(); } catch (IllegalStateException exception) { Toast.makeText(getActivity(), R.string.fetch_chapters_failed, Toast.LENGTH_SHORT).show(); } Timber.e(error, "Could'nt fetch chapter list"); } } ); }</code><technical_language>I splitting this line is unnecessary becuase messes indentation a lot</technical_language>

Target:
private void fetchChapters() { App.getInstance().getGdgXHub().getDirectory().enqueue(new Callback<Directory>() { @Override public void success(Directory directory) { if (isContextValid()) { addChapters(directory.getGroups()); mLoadSwitcher.setDisplayedChild(1); } App.getInstance().getModelCache().putAsync(Const.CACHE_KEY_CHAPTER_LIST_HUB, directory, DateTime.now().plusDays(4), null); } @Override public void failure(Throwable error) { showError(R.string.fetch_chapters_failed); } @Override public void networkFailure(Throwable error) { showError(R.string.offline_alert); } }); }
Source:
<code><START> public HWNetworkStore[] getNetworks() { <END> Enumeration<NetworkInterface> interfaces; HWNetworkStore netstore; List<HWNetworkStore> result; StringBuilder sb; result = new ArrayList<>(); try { interfaces = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(interfaces)) { if (!netint.getDisplayName().equals("lo")) { netstore = new HWNetworkStore(); this.setNetworkParameters(netstore, netint); this.setNetworkStats(netstore); result.add(netstore); } } } catch (SocketException ex) { LOG.debug("Socket exception when retrieving network interfaces: " + ex.getMessage()); } return result.toArray(new HWNetworkStore[result.size()]); }</code><technical_language>This method common 3 classes. in parent setNetworkStats() method in platform-specific versions</technical_language>

Target:
public HWNetworkStore[] getNetworks() { Enumeration<NetworkInterface> interfaces; HWNetworkStore netstore; List<HWNetworkStore> result; result = new ArrayList<>(); try { interfaces = NetworkInterface.getNetworkInterfaces(); for (NetworkInterface netint : Collections.list(interfaces)) { if (!netint.isLoopback()) { netstore = new HWNetworkStore(); this.setNetworkParameters(netstore, netint); this.setNetworkStats(netstore); netstore.setMTU(netint.getMTU()); result.add(netstore); } } } catch (SocketException ex) { LOG.debug("Socket exception when retrieving network interfaces: " + ex.getMessage()); } return result.toArray(new HWNetworkStore[result.size()]); }
Source:
<code>private void validateProperties(ProcessingEnvironment env, Map<String, ExecutableElement> properties) { <START> TypeElement parcelable = env.getElementUtils().getTypeElement("android.os.Parcelable"); <END> TypeMirror serializable = TypeSimplifier.typeFromClass(env.getTypeUtils(), env.getElementUtils(), Serializable.class); for (ExecutableElement name : properties.values()) { TypeMirror type = name.getReturnType(); if (!TypeName.get(type).isPrimitive() && !TypeSimplifier.isClassOfType(env.getTypeUtils(), parcelable.asType(), type) && !TypeSimplifier.isClassOfType(env.getTypeUtils(), serializable, type)) { env.getMessager().printMessage(Diagnostic.Kind.ERROR, "AutoValue property " + name.getSimpleName() + " is not primitive, Parcelable or Serializable.", name); throw new AutoParcelException(); } } }</code><technical_language>call .asType() for parity serializable variable do loop</technical_language>

Target:
private void validateProperties(ProcessingEnvironment env, Map<String, ExecutableElement> properties) { TypeMirror parcelable = env.getElementUtils().getTypeElement("android.os.Parcelable").asType(); TypeMirror serializable = TypeSimplifier.typeFromClass(env.getTypeUtils(), env.getElementUtils(), Serializable.class); for (ExecutableElement name : properties.values()) { TypeMirror type = name.getReturnType(); if (!TypeName.get(type).isPrimitive() && !TypeSimplifier.isClassOfType(env.getTypeUtils(), parcelable, type) && !TypeSimplifier.isClassOfType(env.getTypeUtils(), serializable, type)) { env.getMessager().printMessage(Diagnostic.Kind.ERROR, "AutoValue property " + name.getSimpleName() + " is not primitive, Parcelable, or Serializable.", name); throw new AutoParcelException(); } } }
Source:
<code>default void removeCharge(Location l, int charge) { Validate.isTrue(charge > 0, "The charge to remove must be greater than zero!"); int capacity = getCapacity(); <START> if (capacity > 0) { <END> int currentCharge = getCharge(l); if (currentCharge > 0) { int newCharge = Math.max(0, currentCharge - charge); BlockStorage.addBlockInfo(l, "energy-charge", String.valueOf(newCharge), false); if (getEnergyComponentType() == EnergyNetComponentType.CAPACITOR) { SlimefunUtils.updateCapacitorTexture(l, charge, capacity); } } } }</code><technical_language>isChargeable</technical_language>

Target:
default void removeCharge(Location l, int charge) { Validate.notNull(l, "Location was null!"); Validate.isTrue(charge > 0, "The charge to remove must be greater than zero!"); int capacity = getCapacity(); if (capacity > 0) { int currentCharge = getCharge(l); if (currentCharge > 0) { int newCharge = Math.max(0, currentCharge - charge); BlockStorage.addBlockInfo(l, "energy-charge", String.valueOf(newCharge), false); if (getEnergyComponentType() == EnergyNetComponentType.CAPACITOR) { SlimefunUtils.updateCapacitorTexture(l, charge, capacity); } } } }
Source:
<code>public Set<String> getHosts(String serviceName, String componentName) { Set<String> hosts = m_topology.get(serviceName + "/" + componentName); if (null == hosts) { <START> hosts = Sets.newHashSet(); <END> } return hosts; }</code><technical_language>new HashSet<>() Collections.emptySet() is need Google collections a dependency</technical_language>

Target:
public Set<String> getHosts(String serviceName, String componentName) { Set<String> hosts = m_topology.get(serviceName + "/" + componentName); if (null == hosts) { hosts = new HashSet<>(); } return hosts; }
Source:
<code>private void createShellExecutor(String executorClassName) throws ExecutorException { <START> executor = (SqlExecutor) createInstance(executorClassName); <END> }</code><technical_language>I noticed original code handle ClassCastException. Shell crash if a user flirts configuration file, setting executor commandhandler some random class. fix here</technical_language>

Target:
private void createShellExecutor(String executorClassName) throws ExecutorException { try { executor = (SqlExecutor) createInstance(executorClassName); } catch (ClassCastException e) { String errMsg = String.format("Error trying to cast Object of class %s to SqlExecutor", executorClassName); LOG.error(errMsg); throw new ExecutorException(errMsg, e); } catch (Exception e) { LOG.error(e.getMessage()); throw new ExecutorException(e); } }
Source:
<code>private void repaintPosition(final double position) { int zoomSwitchLevel = MAX_ZOOM - diagram.getLevel(); if (zoomLevel > zoomSwitchLevel) { if (currentZoomLevel != zoomLevel || repaintNow) { Group diagramDrawing = new Group(); <START> double width = unifiedEnd * scale * VertexView.HORIZONTALSCALE; <END> int diagramLevel = zoomLevel - zoomSwitchLevel; diagramDrawing.getChildren().add( diagramView.drawDiagram(diagram, diagramLevel, width)); diagramDrawing.getChildren().add(new Rectangle(width, 0)); scrollPane.setContent(diagramDrawing); wrapper.setCenter(scrollPane); currentZoomLevel = zoomLevel; repaintNow = false; } } else { int[] bucketLocations = getStartandEndBucket(position); int startBucket = bucketLocations[0]; int endBucket = bucketLocations[1]; if (currEndPosition != endBucket && currStartPosition != startBucket || repaintNow) { Group graphDrawing = new Group(); graphDrawing.setManaged(false); graphDrawing.getChildren().add( drawGraph(startBucket, endBucket)); graphDrawing.getChildren().add( new Rectangle(unifiedEnd * scale * VertexView.HORIZONTALSCALE, 0)); scrollPane.setContent(graphDrawing); wrapper.setCenter(scrollPane); currEndPosition = endBucket; currStartPosition = startBucket; repaintNow = false; } } }</code><technical_language>Duplicate code; replace scale * VertexView.HORIZONTALSCALE scaledVertex</technical_language>

Target:
private void repaintPosition(final double position) { int zoomSwitchLevel = MAX_ZOOM - diagram.getLevel(); double scaledVertex = scale * VertexView.HORIZONTALSCALE; if (zoomLevel > zoomSwitchLevel) { if (currentZoomLevel != zoomLevel || repaintNow) { Group diagramDrawing = new Group(); double width = maxUnifiedEnd * scaledVertex; int diagramLevel = zoomLevel - zoomSwitchLevel; diagramDrawing.getChildren().addAll( diagramView.drawDiagram(diagram, diagramLevel, width), new Rectangle(width, 0)); scrollPane.setContent(diagramDrawing); wrapper.setCenter(scrollPane); currentZoomLevel = zoomLevel; repaintNow = false; } } else { int[] bucketLocations = getStartandEndBucket(position); int startBucket = bucketLocations[0]; int endBucket = bucketLocations[1]; if (currEndPosition != endBucket && currStartPosition != startBucket || repaintNow) { Group graphDrawing = new Group(); graphDrawing.setManaged(false); graphDrawing.getChildren().addAll( drawGraph(startBucket, endBucket), new Rectangle(maxUnifiedEnd * scaledVertex, 0)); scrollPane.setContent(graphDrawing); wrapper.setCenter(scrollPane); currEndPosition = endBucket; currStartPosition = startBucket; repaintNow = false; } } }
Source:
<code>private Properties getProperties() { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); final Properties properties = new Properties(); String dbType = "postgres"; <START> if (System.getProperty("databaseType")!=null){ <END> dbType = System.getProperty("databaseType"); } else if(System.getenv("databaseType")!=null){ dbType = System.getenv("databaseType"); } try (InputStream resourceStream = loader.getResourceAsStream(dbType + "-db-config.properties")) { properties.load(resourceStream); } catch (Exception e) { Logger.error(this.getClass(), "Unable to get properties from file db-config.properties", e); throw new DotRuntimeException(e); } return properties; }</code><technical_language>I guess simply call: dbType = System.getProperty("databaseType", System.getenv("databaseType"))</technical_language>

Target:
private Properties getProperties() { final ClassLoader loader = Thread.currentThread().getContextClassLoader(); final Properties properties = new Properties(); final String dbType = System.getProperty("databaseType", (System.getenv("databaseType") != null ? System.getenv("databaseType") : "postgres")); try (InputStream resourceStream = loader.getResourceAsStream(dbType + "-db-config.properties")) { properties.load(resourceStream); } catch (Exception e) { Logger.error(this.getClass(), "Unable to get properties from file db-config.properties", e); throw new DotRuntimeException(e); } return properties; }
Source:
<code>public void checkPortVisibility() throws Exception { simpleImport("resources/rt/PortModel.emx"); openEditor(); <START> rootPackage.getPackagedElements().stream() <END> .filter(Port.class::isInstance) .filter(p -> !((Port) p).isService()) .forEach(port -> assertEquals(" Port visibility Error: port should be protected", VisibilityKind.PROTECTED_LITERAL, port.getVisibility())); }</code><technical_language>This test passes apply assertion port. Ports packaged elements. features of classes</technical_language>

Target:
public void checkPortVisibility() throws Exception { simpleImport("resources/rt/PortModel.emx"); openEditor(); rootPackage.getOwnedElements().stream() .filter(Port.class::isInstance) .filter(p -> !((Port) p).isService()) .forEach(port -> assertEquals(" Port visibility Error: port should be protected", VisibilityKind.PROTECTED_LITERAL, ((Port) port).getVisibility())); }
Source:
<code>private API addSystemVersion(API api) { <START> String ProductVersion = getConfigurationValue(String.class, ConfigurationValues.ProductRPMVersion, null); <END> api.setProductInfo(new ProductInfo()); api.getProductInfo().setName("oVirt Engine"); api.getProductInfo().setVendor("ovirt.org"); api.getProductInfo().setVersion(VersionHelper.parseVersion(ProductVersion)); return api; }</code><technical_language>variable name productVersion a case p</technical_language>

Target:
private API addSystemVersion(API api) { String productVersion = getConfigurationValue(String.class, ConfigurationValues.ProductRPMVersion, null); api.setProductInfo(new ProductInfo()); api.getProductInfo().setName("oVirt Engine"); api.getProductInfo().setVendor("ovirt.org"); api.getProductInfo().setVersion(VersionHelper.parseVersion(productVersion)); return api; }
Source:
<code>public Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) { String source; if (message.getPayload() instanceof byte[]) { source = new String((byte[]) message.getPayload()); } <START> else { <END> source = (String) message.getPayload(); } return TupleBuilder.fromString(source); }</code><technical_language>protect this assert cast String</technical_language>

Target:
public Object convertFromInternal(Message<?> message, Class<?> targetClass, Object conversionHint) { String source; if (message.getPayload() instanceof byte[]) { source = new String((byte[]) message.getPayload(), Charset.forName("UTF-8")); } else { source = message.getPayload().toString(); } return TupleBuilder.fromString(source); }
Source:
<code>public ChatComponent addExtra(ChatComponent component) { if (!hasExtra(component, true)) { $lock.writeLock().lock(); <START> this.extra.add(component); <END> $lock.writeLock().unlock(); } return this; }</code><technical_language>THREAD-SAFETY need mind (lol), thread safe collection lock. Please try-finally idiom explicit locks well</technical_language>

Target:
public ChatComponent addExtra(ChatComponent component) { if (!hasExtra(component, true)) { this.extra.add(component); } return this; }
Source:
<code>public void indexQuestion(Question q) { try { SolrInputDocument doc = toDoc(q); server.add(doc); server.commit(); } catch (IOException | SolrServerException e) { <START> throw new IndexException("Could not index Question", e); <END> } }</code><technical_language>great if exception message question indexed</technical_language>

Target:
public void indexQuestion(Question q) { try { SolrInputDocument doc = toDoc(q); server.add(doc); server.commit(); } catch (IOException | SolrServerException e) { throw new IndexException("Could not index Question [" + q.getId() + "]", e); } }
Source:
<code>public void onCreate() { super.onCreate(); this.context = this; <START> ThemeHelper.init(context); <END> if (LeakCanary.isInAnalyzerProcess(this)) { return; } refWatcher = installLeakCanary(); SettingsActivity.initSettings(this); NewPipe.init(getDownloader(), org.schabi.newpipe.util.Localization.getPreferredExtractorLocal(this)); StateSaver.init(this); initNotificationChannel(); ImageLoader.getInstance().init(getImageLoaderConfigurations(10, 50)); configureRxJavaErrorHandler(); }</code><technical_language>create a member variable reference once? do ThemeHelper.init(this)? more readable, I</technical_language>

Target:
public void onCreate() { super.onCreate(); ThemeHelper.init(this); if (LeakCanary.isInAnalyzerProcess(this)) { return; } refWatcher = installLeakCanary(); app = this; SettingsActivity.initSettings(this); NewPipe.init(getDownloader(), org.schabi.newpipe.util.Localization.getPreferredExtractorLocal(this)); StateSaver.init(this); initNotificationChannel(); ImageLoader.getInstance().init(getImageLoaderConfigurations(10, 50)); configureRxJavaErrorHandler(); new CheckForNewAppVersionTask().execute(); }
Source:
<code>public ObjectId getHead() throws IOException { Repository subRepo = getRepository(); if (subRepo == null) return null; <START> ObjectId head; <END> try { head = subRepo.resolve(Constants.HEAD); } finally { subRepo.close(); } return head; }</code><technical_language>This local necessary, write: try { return subRepo.resolve(Constants.HEAD); } finally { subRepo.close(); } work correctly. for other hunks in this file</technical_language>

Target:
public ObjectId getHead() throws IOException { Repository subRepo = getRepository(); if (subRepo == null) return null; try { return subRepo.resolve(Constants.HEAD); } finally { subRepo.close(); } }
Source:
<code>public void stopQueue() { if (isStarted.compareAndSet(true, false)) { isInitialized.set(false); super.stopQueue(); <START> reaper.stop(); <END> dao.close(); dispatcher.stop(); } }</code><technical_language>if matters reaper stopped (so move entries queue is stopped)? Also, dao stop</technical_language>

Target:
public void stopQueue() { if (isStarted.compareAndSet(true, false)) { isInitialized.set(false); reaper.stop(); super.stopQueue(); dispatcher.stop(); dao.close(); } }
Source:
<code>public void test_isLeapYear_nearestEndOf(DayOfWeek dayOfWeek, Month ending) { AccountingChronology chronology = new AccountingChronologyBuilder().endsOn(dayOfWeek).nearestEndOf(ending) .withDivision(AccountingYearDivision.QUARTERS_OF_PATTERN_4_4_5_WEEKS).leapWeekInMonth(12) .toChronology(); IntFunction<LocalDate> getYearEnd = year -> { <START> return LocalDate.of(year, ending, 1).plusMonths(1).plusDays(3 - 1).with(TemporalAdjusters.previousOrSame(dayOfWeek)); <END> }; Predicate<Integer> isLeapYear = year -> { LocalDate currentYearEnd = getYearEnd.apply(year); LocalDate prevYearEnd = getYearEnd.apply(year - 1); return prevYearEnd.until(currentYearEnd, DAYS) == 371; }; for (int year = -200; year < 600; year++) { assertEquals(chronology.isLeapYear(year), isLeapYear.test(year), "Fails on " + year); } }</code><technical_language>this simpler: LocalDate.of(year, ending, 3).plusMonths(1)</technical_language>

Target:
public void test_isLeapYear_nearestEndOf(DayOfWeek dayOfWeek, Month ending) { AccountingChronology chronology = new AccountingChronologyBuilder().endsOn(dayOfWeek).nearestEndOf(ending) .withDivision(AccountingYearDivision.QUARTERS_OF_PATTERN_4_4_5_WEEKS).leapWeekInMonth(12) .toChronology(); IntFunction<LocalDate> getYearEnd = year -> { return LocalDate.of(year, ending, 3).plusMonths(1).with(TemporalAdjusters.previousOrSame(dayOfWeek)); }; Predicate<Integer> isLeapYear = year -> { LocalDate currentYearEnd = getYearEnd.apply(year); LocalDate prevYearEnd = getYearEnd.apply(year - 1); return prevYearEnd.until(currentYearEnd, DAYS) == 371; }; for (int year = -200; year < 600; year++) { assertEquals(chronology.isLeapYear(year), isLeapYear.test(year), "Fails on " + year); } }
Source:
<code>public TmfVertex(final long ts) { <START> this.fTimestamp = ts; <END> this.fId = count++; }</code><technical_language>remove thises</technical_language>

Target:
public TmfVertex(final long ts) { fTimestamp = ts; synchronized (TmfVertex.class) { fId = count++; } }
Source:
<code>private void checkEmbulkVersion() { boolean isValidVersion = true; try { String[] versionNumber = EmbulkVersion.VERSION.split("-"); if (versionNumber[0] != null) { String[] versions = versionNumber[0].split("\\."); if (versions.length == 3) { if (Integer.valueOf(versions[1]) <= 8 && Integer.valueOf(versions[2]) < 22) { isValidVersion = false; } } } } <START> catch (NoClassDefFoundError ex) { <END> isValidVersion = false; } if (!isValidVersion) { throw new ConfigException("embulk-output-td v0.4.x+ only supports Embulk v0.8.22 or higher versions"); } }</code><technical_language>ClassNotFoundException check EmbulkVersion exists not</technical_language>

Target:
private void checkEmbulkVersion() { boolean isValidVersion = true; try { Class.forName("org.embulk.EmbulkVersion"); String[] versionNumber = EmbulkVersion.VERSION.split("-"); if (versionNumber[0] != null) { String[] versions = versionNumber[0].split("\\."); if (versions.length == 3) { if (Integer.valueOf(versions[1]) <= 8 && Integer.valueOf(versions[2]) < 22) { isValidVersion = false; } } } } catch (ClassNotFoundException ex) { isValidVersion = false; } if (!isValidVersion) { throw new ConfigException("embulk-output-td v0.4.x+ only supports Embulk v0.8.22 or higher versions"); } }
Source:
<code>public Map<TopicPartition, OffsetAndMetadata> getAcknowledged() throws InterruptedException { <START> lock.writeLock().lock(); <END> try { Map<TopicPartition, OffsetAndMetadata> currentOffsets = new HashMap<>(pendingOffsets.size()); currentOffsets.putAll(pendingOffsets); return currentOffsets; } finally { lock.writeLock().unlock(); } }</code><technical_language>this in essence a reading method? do need stop writers readers for this</technical_language>

Target:
public Map<TopicPartition, OffsetAndMetadata> getAcknowledged() { Map<TopicPartition, OffsetAndMetadata> currentOffsets = new HashMap<>(offsets); return currentOffsets; }
Source:
<code>public static boolean isAnyNotEmpty(final CharSequence... css) { if (ArrayUtils.isEmpty(css)) { <START> return true; <END> } for (final CharSequence cs : css){ if (isNotEmpty(cs)) { return true; } } return false; }</code><technical_language>this return false? empty Array empty CharSequences. WDYT</technical_language>

Target:
public static boolean isAnyNotEmpty(final CharSequence... css) { if (ArrayUtils.isEmpty(css)) { return false; } for (final CharSequence cs : css){ if (isNotEmpty(cs)) { return true; } } return false; }
Source:
<code>public void testKeyWrapAndUnwrap() throws NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { Cipher keyWrapCipher = Cipher.getInstance("AESWrap/ECB/NoPadding"); SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); byte[] kek = new byte[16]; random.nextBytes(kek); byte[] randomKey = new byte[16]; random.nextBytes(randomKey); keyWrapCipher.init(Cipher.WRAP_MODE, new SecretKeySpec(kek, "AES")); Key randKey = new SecretKeySpec(randomKey, "AES"); byte[] wrappedKey = keyWrapCipher.wrap(randKey); assert (wrappedKey != null); <START> assert (wrappedKey.length == randomKey.length + 8); <END> Cipher keyUnwrapCipher = Cipher.getInstance("AESWrap/ECB/NoPadding"); keyUnwrapCipher.init(Cipher.UNWRAP_MODE, new SecretKeySpec(kek, "AES")); Key unwrappedKey = keyUnwrapCipher.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY); byte[] unwrappedKeyBytes = unwrappedKey.getEncoded(); assert (Arrays.equals(unwrappedKeyBytes, randomKey)); }</code><technical_language>I calls java assert statement default nothing. Java assertions turned on. junit assertTrue method</technical_language>

Target:
public void testKeyWrapAndUnwrap() throws NoSuchAlgorithmException, NoSuchPaddingException, NoSuchProviderException, InvalidKeyException, IllegalBlockSizeException, BadPaddingException { Cipher keyWrapCipher = Cipher.getInstance("AESWrap/ECB/NoPadding"); SecureRandom random = SecureRandom.getInstance("SHA1PRNG", "SUN"); byte[] kek = new byte[16]; random.nextBytes(kek); byte[] randomKey = new byte[16]; random.nextBytes(randomKey); keyWrapCipher.init(Cipher.WRAP_MODE, new SecretKeySpec(kek, "AES")); Key randKey = new SecretKeySpec(randomKey, "AES"); byte[] wrappedKey = keyWrapCipher.wrap(randKey); assertNotNull(wrappedKey); assertEquals(wrappedKey.length, randomKey.length + 8); Cipher keyUnwrapCipher = Cipher.getInstance("AESWrap/ECB/NoPadding"); keyUnwrapCipher.init(Cipher.UNWRAP_MODE, new SecretKeySpec(kek, "AES")); Key unwrappedKey = keyUnwrapCipher.unwrap(wrappedKey, "AES", Cipher.SECRET_KEY); byte[] unwrappedKeyBytes = unwrappedKey.getEncoded(); assertArrayEquals(unwrappedKeyBytes, randomKey); }
Source:
<code>CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientException) throwable; } else { <START> throw Exceptions.propagate(ex); <END> } } }</code><technical_language>If exception is instance of RuntimeException, i.e. a checked exception, this statement Exceptions.propagate(ex) throw ReactiveException wrapped exception. want behavior, need unwrap exception depend it. public static RuntimeException propagate(Throwable t) { throwIfFatal(t); if (t instanceof RuntimeException) { return (RuntimeException) t; } return new ReactiveException(t); }</technical_language>

Target:
CosmosItemResponse mapItemResponseAndBlock(Mono<CosmosAsyncItemResponse> itemMono) throws CosmosClientException { try { return itemMono .map(this::convertResponse) .block(); } catch (Exception ex) { final Throwable throwable = Exceptions.unwrap(ex); if (throwable instanceof CosmosClientException) { throw (CosmosClientException) throwable; } else { throw ex; } } }
Source:
<code>public FileInputFormatter create(Map<String, String> properties, @Nullable Schema schema) { if (schema != null) { Schema.Field offsetField = schema.getField("offset"); if (offsetField != null) { Schema offsetSchema = offsetField.getSchema(); Schema.Type offsetType = offsetSchema.isNullable() ? offsetSchema.getNonNullable().getType() : offsetSchema.getType(); if (offsetType != Schema.Type.LONG) { throw new IllegalArgumentException("Type of 'offset' field must be 'long', but found " + offsetType); <START> } <END> } Schema.Field bodyField = schema.getField("body"); if (bodyField == null) { throw new IllegalArgumentException("Schema for text format must have a field named 'body'"); } Schema bodySchema = bodyField.getSchema(); Schema.Type bodyType = bodySchema.isNullable() ? bodySchema.getNonNullable().getType() : bodySchema.getType(); if (bodyType != Schema.Type.STRING) { throw new IllegalArgumentException("Type of 'body' field must be 'string', but found + " + bodyType); } } if (schema == null) { schema = getSchema(properties.get("pathField")); } return new TextInputFormatter(schema); }</code><technical_language>Do need changes line 63</technical_language>

Target:
public FileInputFormatter create(Map<String, String> properties, @Nullable Schema schema) { if (schema != null) { Schema.Field offsetField = schema.getField("offset"); if (offsetField != null) { Schema offsetSchema = offsetField.getSchema(); Schema.Type offsetType = offsetSchema.isNullable() ? offsetSchema.getNonNullable().getType() : offsetSchema.getType(); if (offsetType != Schema.Type.LONG) { throw new IllegalArgumentException("Type of 'offset' field must be 'long', but found " + offsetType); } } Schema.Field bodyField = schema.getField("body"); if (bodyField == null) { throw new IllegalArgumentException("Schema for text format must have a field named 'body'"); } Schema bodySchema = bodyField.getSchema(); Schema.Type bodyType = bodySchema.isNullable() ? bodySchema.getNonNullable().getType() : bodySchema.getType(); if (bodyType != Schema.Type.STRING) { throw new IllegalArgumentException("Type of 'body' field must be 'string', but found + " + bodyType); } } if (schema == null) { schema = getDefaultSchema(properties.get("pathField")); } return new TextInputFormatter(schema); }
Source:
<code>private void initLogging() { <START> String off = "OFF"; END> IEclipsePreferences prefs = getEMFComparePreferences(); LOGGER.setLevel(Level.toLevel(prefs.get(LOG_LEVEL_KEY, off))); if (off.equals(LOGGER.getLevel().toString())) { return; } RollingFileAppender appender = (RollingFileAppender)LOGGER.getAppender(EMFC_APPENDER_NAME); String logFileName = prefs.get(LOG_FILENAME_KEY, ""); if (logFileName.length() > 0) { if (appender == null) { try { createLogAppender(logFileName); } catch (IOException e) { prefs.put(LOG_FILENAME_KEY, ""); } } else { appender.setMaxBackupIndex(prefs.getInt(LOG_BACKUP_COUNT_KEY, 10)); appender.setMaximumFileSize((prefs.getInt(LOG_FILE_MAX_SIZE_KEY, 100)) * MEGABYTE); } } preferenceChangeListener = new LoggingPreferenceChangeListener(); prefs.addPreferenceChangeListener(preferenceChangeListener); }</code><technical_language>create this constant (see below)</technical_language>

Target:
private void initLogging() { IEclipsePreferences prefs = getEMFComparePreferences(); LOGGER.setLevel(Level.toLevel(prefs.get(LOG_LEVEL_KEY, "OFF"))); if (Level.OFF.equals(LOGGER.getLevel())) { RollingFileAppender appender = (RollingFileAppender)LOGGER.getAppender(EMFC_APPENDER_NAME); String logFileName = prefs.get(LOG_FILENAME_KEY, ""); if (logFileName.length() > 0) { if (appender == null) { try { createLogAppender(logFileName); } catch (IOException e) { prefs.put(LOG_FILENAME_KEY, ""); } } else { appender.setMaxBackupIndex(prefs.getInt(LOG_BACKUP_COUNT_KEY, 10)); appender.setMaximumFileSize((prefs.getInt(LOG_FILE_MAX_SIZE_KEY, 100)) * MEGABYTE); } } } preferenceChangeListener = new LoggingPreferenceChangeListener(); prefs.addPreferenceChangeListener(preferenceChangeListener); }
Source:
<code>public int copyResource(String resource, String target) { String dest = target; if (!new File(target).isAbsolute()) { dest = getRunDir() + "/" + target; } int result = -1; if (resource.toLowerCase().matches("^https?://.*")) { result = getMachine().execCommands("download", ImmutableList.of( CommonCommands.INSTALL_CURL, <START> String.format("curl --silent --insecure %s -o %s", resource, dest))); <END> } if (result != 0) { result = getMachine().copyTo(getResource(resource), dest); } if (log.isDebugEnabled()) log.debug("Copied file for {}: to - result {}", new Object[] { entity, resource, dest, result }); return result; }</code><technical_language>want -f in curl command. a 404 returns a html page is considered a success</technical_language>

Target:
public int copyResource(String resource, String target) { return copyResource(MutableMap.of(), resource, target); }
Source:
<code>public List<String> getArchivedCourseIds(List<CourseDetailsBundle> allCourses, List<InstructorAttributes> instructorList) { <START> List<String> activeCourseIds = new ArrayList<String>(); <END> for (CourseDetailsBundle cdb : allCourses) { if (cdb.course.isArchived) { activeCourseIds.add(cdb.course.id); } } for (InstructorAttributes instructor : instructorList) { if (instructor.isArchived != null && instructor.isArchived == true) { activeCourseIds.add(instructor.courseId); } } return activeCourseIds; }</code><technical_language>Variable name archivedCourseIds</technical_language>

Target:
public List<String> getArchivedCourseIds(List<CourseDetailsBundle> allCourses, List<InstructorAttributes> instructorList) { List<String> archivedCourseIds = new ArrayList<String>(); for (CourseDetailsBundle cdb : allCourses) { if (cdb.course.isArchived) { archivedCourseIds.add(cdb.course.id); } } for (InstructorAttributes instructor : instructorList) { if (instructor.isArchived != null && instructor.isArchived == true) { archivedCourseIds.add(instructor.courseId); } } return archivedCourseIds; }
Source:
<code>public void testFileObjectPath() throws Exception { List<PID> pids = makePidList(5); when(pathFactory.getAncestorPids(pid)).thenReturn(pids); when(dip.getContentObject()).thenReturn(fileObject); filter.filter(dip); <START> verify(idb).setRollup(eq(pids.get(WORK_OBJECT_DEPTH).getId())); <END> }</code><technical_language>Verify ancestor path is set. easiest write a helper method loops pids verifies expect values present (and right number of them). in of methods</technical_language>

Target:
public void testFileObjectPath() throws Exception { List<PID> pids = makePidList(5); when(pathFactory.getAncestorPids(pid)).thenReturn(pids); when(dip.getContentObject()).thenReturn(fileObject); filter.filter(dip); verify(idb).setAncestorPath(listCaptor.capture()); List<String> ancestorPath = listCaptor.getValue(); ancestorPathCheck(ancestorPath, pids); assertEquals(5, ancestorPath.size()); verify(idb).setRollup(eq(pids.get(WORK_OBJECT_DEPTH).getId())); }
Source:
<code>public void start() throws Exception { startClient(httpClient); if (http2Client.isPresent()) { <START> startClient(http2Client.get()); <END> } }</code><technical_language>http2Client.map(startClient)? :P</technical_language>

Target:
public void start() throws Exception { startClient(httpClient); http2Client.ifPresent(this::startClient); }
Source:
<code>public void otherNodeCanBecomeLeaderAfterSteppingDown() { LeadershipToken token = state.gainLeadership(0); assertThat(state.leader(0).isStillLeading(token)).isEqualTo(StillLeadingStatus.LEADING); assertThat(state.leader(0).stepDown()).isTrue(); LeadershipToken token2 = state.gainLeadership(1); <START> assertThat(state.leader(1).isStillLeading(token2)).isEqualTo(StillLeadingStatus.LEADING); <END> }</code><technical_language>is worth double checking leader(0) is *not* leading</technical_language>

Target:
public void otherNodeCanBecomeLeaderAfterSteppingDown() { LeadershipToken token = state.gainLeadership(0); assertThat(state.leader(0).isStillLeading(token)).isEqualTo(StillLeadingStatus.LEADING); assertThat(state.leader(0).stepDown()).isTrue(); LeadershipToken token2 = state.gainLeadership(1); assertThat(state.leader(0).isStillLeading(token)).isEqualTo(StillLeadingStatus.NOT_LEADING); assertThat(state.leader(1).isStillLeading(token2)).isEqualTo(StillLeadingStatus.LEADING); }
Source:
<code>public void getAppConfigForUserReturnsOldestVersion() { Survey survey = Survey.create(); survey.setIdentifier("theIdentifier"); survey.setGuid(SURVEY_REF_LIST.get(0).getGuid()); survey.setCreatedOn(SURVEY_REF_LIST.get(0).getCreatedOn().getMillis()); CriteriaContext context = new CriteriaContext.Builder() .withClientInfo(ClientInfo.fromUserAgentCache("iPhone/6 (Motorola Flip-Phone; Android/14) BridgeJavaSDK/10")) <START> .withStudyIdentifier(TEST_STUDY).build(); <END> setupConfigsForUser(); AppConfig appConfig = service.getAppConfigForUser(context, true); assertEquals(EARLIER_TIMESTAMP, appConfig.getCreatedOn()); }</code><technical_language>I this test another victim of a refactor. changed throwException=true throwException=false, this test verify survey in result, noticed this test broken</technical_language>

Target:
public void getAppConfigForUserReturnsOldestVersion() { Survey survey = Survey.create(); survey.setIdentifier("theIdentifier"); survey.setGuid(SURVEY_REF_LIST.get(0).getGuid()); survey.setCreatedOn(SURVEY_REF_LIST.get(0).getCreatedOn().getMillis()); when(mockSurveyService.getSurvey(TestConstants.TEST_STUDY, SURVEY_KEY, false, false)).thenReturn(survey); CriteriaContext context = new CriteriaContext.Builder() .withClientInfo(ClientInfo.fromUserAgentCache("iPhone/6 (Motorola Flip-Phone; Android/14) BridgeJavaSDK/10")) .withStudyIdentifier(TEST_STUDY).build(); setupConfigsForUser(); AppConfig appConfig = service.getAppConfigForUser(context, true); assertEquals(EARLIER_TIMESTAMP, appConfig.getCreatedOn()); assertEquals("theIdentifier", appConfig.getSurveyReferences().get(0).getIdentifier()); }