auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void downloadLatestSiteStats(final View view) { final Handler handler = new SiteDownloadHandler(view, numberFormat, getActivity().getPackageName(), getResources()); final ApiDownloader task = new ApiDownloader(getActivity(), ListFragment.lameStatic.dbHelper, "site-stats-cache.json", MainActivity.SITE_STATS_URL, false, false, false, ApiDownloader.REQUEST_GET, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) { handleSiteStats(json, handler); } }); try { task.startDownload(this); <START> } catch (WiGLEAuthException waex) END> }</code><technical_language>Info log in case if would</technical_language>

Target:
public void downloadLatestSiteStats(final View view) { final Handler handler = new SiteDownloadHandler(view, numberFormat, getActivity().getPackageName(), getResources()); final ApiDownloader task = new ApiDownloader(getActivity(), ListFragment.lameStatic.dbHelper, "site-stats-cache.json", MainActivity.SITE_STATS_URL, false, false, false, ApiDownloader.REQUEST_GET, new ApiListener() { @Override public void requestComplete(final JSONObject json, final boolean isCache) { handleSiteStats(json, handler); } }); try { task.startDownload(this); } catch (WiGLEAuthException waex) { MainActivity.warn("Authentication error on site stats load (should not happen)", waex); } }
Source:
<code>public void clearReceive() { if (networkReceive != null) { <START> ReferenceCountUtil.release(networkReceive.getReceivedBytes().getAndRelease()); <END> } networkReceive = null; }</code><technical_language>this exceptions calling getAndRelease in NetworkClient? I clearReceive is called selector receive is unboxed inNetworkClient:sendAndPoll</technical_language>

Target:
public void clearReceive() { networkReceive = null; }
Source:
<code>public void fullTextShouldWorkWithBindVar() throws Exception { Node n1 = session.getRootNode().addNode("n1"); n1.setProperty("n1-prop-1", "wow"); n1.setProperty("n1-prop-2", "any"); Node n2 = session.getRootNode().addNode("n2"); n2.setProperty("n2-prop-1", "test"); <START> session.save(); <END> String queryString = "select * from [nt:unstructured] as a where contains(a.*, 'wow')"; assertNodesAreFound(queryString, Query.JCR_SQL2, "/n1"); String queryStringWithBind = "select * from [nt:unstructured] as a where contains(a.*, $text)"; QueryManager queryManager = session.getWorkspace().getQueryManager(); Query query = queryManager.createQuery(queryStringWithBind, Query.JCR_SQL2); query.bindValue("text", session.getValueFactory().createValue("wow")); QueryResult result = query.execute(); NodeIterator nit = result.getNodes(); assertTrue(nit.hasNext()); Node n11 = nit.nextNode(); assertEquals("n1", n11.getName()); assertTrue(!nit.hasNext()); }</code><technical_language>repository is set once, reused for tests. Therefore, this content is tests run this. do is remove content in a finally block end of this test. Otherwise, this great</technical_language>

Target:
public void fullTextShouldWorkWithBindVar() throws Exception { Node n1 = session.getRootNode().addNode("n1"); n1.setProperty("n1-prop-1", "wow"); n1.setProperty("n1-prop-2", "any"); Node n2 = session.getRootNode().addNode("n2"); n2.setProperty("n2-prop-1", "test"); try { session.save(); String queryString = "select * from [nt:unstructured] as a where contains(a.*, 'wow')"; assertNodesAreFound(queryString, Query.JCR_SQL2, "/n1"); String queryStringWithBind = "select * from [nt:unstructured] as a where contains(a.*, $text)"; QueryManager queryManager = session.getWorkspace().getQueryManager(); Query query = queryManager.createQuery(queryStringWithBind, Query.JCR_SQL2); query.bindValue("text", session.getValueFactory().createValue("wow")); QueryResult result = query.execute(); NodeIterator nit = result.getNodes(); assertTrue(nit.hasNext()); Node n11 = nit.nextNode(); assertEquals("n1", n11.getName()); assertTrue(!nit.hasNext()); } finally { n1.remove(); n2.remove(); session.save(); } }
Source:
<code>public void setDigestAlgorithm(String digestAlgorithm) throws NoSuchAlgorithmException { if (callbackWrapper != null) { <START> throw new IllegalStateException("Cannot create a digest because some content has already been discarded"); <END> } digest = MessageDigest.getInstance(digestAlgorithm); }</code><technical_language>some content "may"</technical_language>

Target:
public void setDigestAlgorithm(String digestAlgorithm) throws NoSuchAlgorithmException { if (callbackWrapper != null) { throw new IllegalStateException("Cannot create a digest because some content may have been consumed"); } digest = MessageDigest.getInstance(digestAlgorithm); }
Source:
<code>public String deploy(Artifact artifact) throws CarbonDeploymentException { logger.info("Deploying : " + artifact.getName()); <START> if (artifact.getName().contains("sample1.txt")) { <END> sample1Deployed = false; } else if (artifact.getName().contains("sample2.txt")) { sample2Deployed = false; } return null; }</code><technical_language>NPE calling contains artifact.getName() ? checking for nullity calling .contains</technical_language>

Target:
public String deploy(Artifact artifact) throws CarbonDeploymentException { logger.info("Deploying : " + artifact.getName()); if (artifact.getName() != null && artifact.getName().contains("sample1.txt")) { sample1Deployed = false; } else if (artifact.getName() != null && artifact.getName().contains("sample2.txt")) { sample2Deployed = false; } return null; }
Source:
<code>public void Cluster_SelectedItemChanged() { UpdateDefaultHost(); updateCustomPropertySheet(); UpdateMinAllocatedMemory(); UpdateNumOfSockets(); <START> if ((VmTemplate) getModel().getTemplate().getSelectedItem() != null) { <END> VmTemplate template = (VmTemplate) getModel().getTemplate().getSelectedItem(); updateQuotaByCluster(template.getQuotaId(), template.getQuotaName()); } updateCpuPinningVisibility(); }</code><technical_language>redundant cast</technical_language>

Target:
public void Cluster_SelectedItemChanged() { UpdateDefaultHost(); updateCustomPropertySheet(); UpdateMinAllocatedMemory(); UpdateNumOfSockets(); if (getModel().getTemplate().getSelectedItem() != null) { VmTemplate template = (VmTemplate) getModel().getTemplate().getSelectedItem(); updateQuotaByCluster(template.getQuotaId(), template.getQuotaName()); } updateCpuPinningVisibility(); }
Source:
<code>private void removeSelfFromListeners() { ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); if (selectionService != null && <START> ReflectionHelper.getFieldValueWithoutException(selectionService, "listeners").isPresent()) { Optional<Object> listenersList = ReflectionHelper.getFieldValueWithoutException(selectionService, <END> "listeners").filter(ListenerList.class::isInstance); if (listenersList.isPresent()) { selectionService.removeSelectionListener(this); } } }</code><technical_language>call reflection helper once. do filter(...).isPresent() in if test: if (selectionService != null) { Optional<Object> listenersList = ReflectionHelper.getFieldValueWithoutException(selectionService, "listeners") //$NON-NLS-1$ if (listenersList.filter(ListenerList.class::isInstance).isPresent()) {; selectionService.removeSelectionListener(this); This needs tested in standar case in error one</technical_language>

Target:
private void removeSelfFromListeners() { ISelectionService selectionService = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService(); Optional<Object> fieldValueWithoutException = ReflectionHelper.getFieldValueWithoutException(selectionService, "listeners"); if (selectionService != null && fieldValueWithoutException.isPresent() && fieldValueWithoutException.filter(ListenerList.class::isInstance).isPresent()) { selectionService.removeSelectionListener(this); } }
Source:
<code>public void initialise() { requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FRAME_BUFFER_URN, displayResolutionDependentFBOs)); update(); addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); <START> displayResolutionDependentFBOs.subscribe(this); <END> }</code><technical_language>Move up, please</technical_language>

Target:
public void initialise() { requiresCondition(() -> worldRenderer.getCurrentRenderStage() == MONO || worldRenderer.getCurrentRenderStage() == LEFT_EYE); addDesiredStateChange(new BindFBO(DEFAULT_FRAME_BUFFER_URN, displayResolutionDependentFBOs)); update(); displayResolutionDependentFBOs.subscribe(this); addDesiredStateChange(new EnableMaterial("engine:prog.defaultTextured")); }
Source:
<code>public AggregatedResult<T, S> deserialize( JsonElement jsonElement, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (jsonElement == null) return null; JsonObject json = jsonElement.getAsJsonObject(); if (!json.has("range") || !json.has("value")) { <START> throw new JsonParseException("no neceessary fields."); <END> } Gson gson = new GsonBuilder() .registerTypeAdapter(TimeRange.class, new TimeRangeAdapter()) .registerTypeAdapter(HistoryState.class, new HistoryStateAdapter(this.stateClass)) .create(); TimeRange range = gson.fromJson(json.getAsJsonObject("range"), TimeRange.class); T value = (T)json.getAsJsonPrimitive("value").getAsNumber(); List<HistoryState<S>> aggregateObjects = null; if (json.has("objects")) { aggregateObjects = new ArrayList<>(); JsonArray objects = json.getAsJsonArray("objects"); for (int i = 0; i < objects.size(); ++i) { aggregateObjects.add(gson.fromJson(objects.get(i), HistoryState.class)); } } return new AggregatedResult(range, value, aggregateObjects); }</code><technical_language>change neceessary fields. json of 2 necessary fields: range value</technical_language>

Target:
public AggregatedResult<T, S> deserialize( JsonElement jsonElement, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { if (jsonElement == null) return null; JsonObject json = jsonElement.getAsJsonObject(); if (!json.has("range") || !json.has("aggregations")) { throw new JsonParseException( "json doesn't contain both of 2 necessary fields: range and aggregations."); } Gson gson = new GsonBuilder() .registerTypeAdapter(TimeRange.class, new TimeRangeAdapter()) .registerTypeAdapter(HistoryState.class, new HistoryStateAdapter(this.stateClass)) .create(); TimeRange range = gson.fromJson(json.getAsJsonObject("range"), TimeRange.class); JsonArray aggregations = json.getAsJsonArray("aggregations"); if (aggregations.size() != 1) { throw new JsonParseException( "aggregations doesn't contain one object."); } JsonObject aggregation = aggregations.get(0).getAsJsonObject(); T value = null; List<HistoryState<S>> aggregateObjects = null; if (aggregation.has("value")) { value = gson.fromJson(aggregation.getAsJsonPrimitive("value"), this.fieldClass); } if (aggregation.has("objects")) { aggregateObjects = new ArrayList<>(); JsonArray objects = aggregation.getAsJsonArray("objects"); Type historyStateType = new TypeToken<HistoryState<S>>(){}.getType(); for (int i = 0; i < objects.size(); ++i) { HistoryState<S> historyState = gson.fromJson(objects.get(i), historyStateType); aggregateObjects.add(historyState); } } return new AggregatedResult<T, S>(range, value, aggregateObjects); }
Source:
<code>default boolean accept(F file) { @SuppressWarnings("unchecked") F[] fileArray = (F[]) Array.newInstance(file.getClass(), 1); <START> fileArray[0] = file; <END> return filterFiles(fileArray).size() > 0; }</code><technical_language>F[] fileArray = (F[]) Stream.of(file).toArray(); instead</technical_language>

Target:
default boolean accept(F file) { throw new UnsupportedOperationException( "Filters that return true in supportsSingleFileFiltering() must implement this method"); }
Source:
<code>protected void destroyVm() { boolean vmMigrating = getVm().getStatus() == VMStatus.MigratingFrom && getVm().getMigratingToVds() != null; setActionReturnValue(vmMigrating ? destroyMigratingVm() : destroyNonMigratingVm()); <START> managedBlockStorageCommandUtil.disconnectManagedBlockStorageDisks(getVm(), vmHandler, getVdsId()); <END> }</code><technical_language>This moved to: ProcessDownVmCommand</technical_language>

Target:
protected void destroyVm() { boolean vmMigrating = getVm().getStatus() == VMStatus.MigratingFrom && getVm().getMigratingToVds() != null; setActionReturnValue(vmMigrating ? destroyMigratingVm() : destroyNonMigratingVm()); }
Source:
<code>public void destroySessionBack(final C context, final String ticket) { final Object trackableSession = store.get(ticket); logger.debug("ticket: -> trackableSession: {}", ticket, trackableSession); if (trackableSession == null) { logger.error("No trackable session found for back channel logout. Either the session store does not support to track session " + "or it has expired from the store and the store settings must be updated (expired data)"); } else { store.remove(ticket); final SessionStore sessionStore = context.getSessionStore(); if (sessionStore == null) { logger.error("No session store available for this web context"); } else { <START> final SessionStore<C> newSessionStore = (SessionStore<C>) sessionStore.buildFromTrackableSession(context, trackableSession) <END> .orElse(null); if (newSessionStore != null) { logger.debug("newSesionStore: {}", newSessionStore); final String sessionId = newSessionStore.getOrCreateSessionId(context); logger.debug("remove sessionId: {}", sessionId); store.remove(sessionId); destroy(context, newSessionStore, "back"); } else { logger.error("The session store should be able to build a new session store from the tracked session"); } } } }</code><technical_language>exploit fact is optional instead of turning a null!</technical_language>

Target:
public void destroySessionBack(final C context, final String ticket) { final Object trackableSession = store.get(ticket); logger.debug("ticket: -> trackableSession: {}", ticket, trackableSession); if (trackableSession == null) { logger.error("No trackable session found for back channel logout. Either the session store does not support to track session " + "or it has expired from the store and the store settings must be updated (expired data)"); } else { store.remove(ticket); final SessionStore sessionStore = context.getSessionStore(); if (sessionStore == null) { logger.error("No session store available for this web context"); } else { final Optional<SessionStore<C>> newSessionStoreOpt = sessionStore.buildFromTrackableSession(context, trackableSession); if (newSessionStoreOpt.isPresent()) { SessionStore<C> newSessionStore = newSessionStoreOpt.get(); logger.debug("newSesionStore: {}", newSessionStore); final String sessionId = newSessionStore.getOrCreateSessionId(context); logger.debug("remove sessionId: {}", sessionId); store.remove(sessionId); destroy(context, newSessionStore, "back"); } else { logger.error("The session store should be able to build a new session store from the tracked session"); } } } }
Source:
<code>private static String evaluateStaticConstant(String fqn) { int lastPeriod = fqn.lastIndexOf("."); String clazzName = fqn.substring(0, lastPeriod); String constantName = fqn.substring(lastPeriod + 1); try { Class<?> clazz = Context.loadClass(clazzName); <START> java.lang.reflect.Field constantField = clazz.getField(constantName); <END> Object val = constantField.get(null); return val != null ? String.valueOf(val) : null; } catch (Exception ex) { throw new IllegalArgumentException("Unable to evaluate " + fqn, ex); } }</code><technical_language>Import Field here</technical_language>

Target:
private static String evaluateStaticConstant(String fqn) { int lastPeriod = fqn.lastIndexOf("."); String clazzName = fqn.substring(0, lastPeriod); String constantName = fqn.substring(lastPeriod + 1); try { Class<?> clazz = Context.loadClass(clazzName); Field constantField = clazz.getField(constantName); Object val = constantField.get(null); return val != null ? String.valueOf(val) : null; } catch (Exception ex) { throw new IllegalArgumentException("Unable to evaluate " + fqn, ex); } }
Source:
<code>public RepositoryFileTreeDto doGetTree( String pathId, Integer depth, String filter, Boolean showHidden, Boolean includeAcls, Boolean includeSystemFolders ) { String path = null; if ( pathId == null || pathId.equals( FileUtils.PATH_SEPARATOR ) ) { path = FileUtils.PATH_SEPARATOR; } else if ( !pathId.startsWith( FileUtils.PATH_SEPARATOR ) ) { path = idToPath( pathId ); } RepositoryRequest repositoryRequest = getRepositoryRequest( path, showHidden, depth, filter ); repositoryRequest.setIncludeAcls( includeAcls ); repositoryRequest.setIncludeSystemFolders( includeSystemFolders ); RepositoryFileTreeDto tree = null; try { tree = getRepoWs().getTreeFromRequest( repositoryRequest ); } catch ( Exception e ) { <START> logger.error( "Problem getting path: " + path ); <END> } if ( tree != null && isShowingTitle( repositoryRequest ) ) { Collator collator = getCollatorInstance(); collator.setStrength( Collator.PRIMARY ); sortByLocaleTitle( collator, tree ); } return tree; }</code><technical_language>This catch clause swallows exception occur here. guessing want catch a folder related - a more specific type of exception catch here? log exception. Right now, information is lost</technical_language>

Target:
public RepositoryFileTreeDto doGetTree( String pathId, Integer depth, String filter, Boolean showHidden, Boolean includeAcls, Boolean includeSystemFolders ) { String path = null; if ( pathId == null || pathId.equals( FileUtils.PATH_SEPARATOR ) ) { path = FileUtils.PATH_SEPARATOR; } else if ( !pathId.startsWith( FileUtils.PATH_SEPARATOR ) ) { path = idToPath( pathId ); } RepositoryRequest repositoryRequest = getRepositoryRequest( path, showHidden, depth, filter ); repositoryRequest.setIncludeAcls( includeAcls ); repositoryRequest.setIncludeSystemFolders( includeSystemFolders ); RepositoryFileTreeDto tree = null; try { tree = getRepoWs().getTreeFromRequest( repositoryRequest ); } catch ( UnifiedRepositoryException e ) { logger.error( e.getCause() ); } if ( tree != null && isShowingTitle( repositoryRequest ) ) { Collator collator = getCollatorInstance(); collator.setStrength( Collator.PRIMARY ); sortByLocaleTitle( collator, tree ); } return tree; }
Source:
<code>public static RestServiceErrorCode getRestServiceErrorCode(RouterErrorCode routerErrorCode) { switch (routerErrorCode) { case BlobTooLarge: case InvalidBlobId: case InvalidPutArgument: case BadInputChannel: return BadRequest; case BlobDeleted: case BlobExpired: return Deleted; case BlobDoesNotExist: return NotFound; case RangeNotSatisfiable: return RangeNotSatisfiable; case AmbryUnavailable: case InsufficientCapacity: <START> case OperationTimedOut: <END> case RouterClosed: case UnexpectedInternalError: default: return InternalServerError; } }</code><technical_language>ChannelClosed needs added (though strictly necessary)</technical_language>

Target:
public static RestServiceErrorCode getRestServiceErrorCode(RouterErrorCode routerErrorCode) { switch (routerErrorCode) { case BlobTooLarge: case InvalidBlobId: case InvalidPutArgument: case BadInputChannel: return BadRequest; case BlobDeleted: case BlobExpired: return Deleted; case BlobDoesNotExist: return NotFound; case RangeNotSatisfiable: return RangeNotSatisfiable; case AmbryUnavailable: case InsufficientCapacity: case OperationTimedOut: case RouterClosed: case UnexpectedInternalError: case ChannelClosed: default: return InternalServerError; } }
Source:
<code>public Alias alias() throws IOException { final Aliases aliases = this.user().aliases(); if (!aliases.iterate().iterator().hasNext()) { throw new RsForward( HttpURLConnection.HTTP_MOVED_TEMP, "/login/start" ); } final Alias alias = aliases.iterate().iterator().next(); <START> if (alias.photo().equals(Alias.BLANK)) { <END> final Identity identity = new RqAuth(this).identity(); if (identity.urn().startsWith("urn:github:")) { alias.photo(URI.create(identity.properties().get("avatar"))); } else if (identity.urn().startsWith("urn:facebook:") || identity.urn().startsWith("urn:google:")) { alias.photo(URI.create(identity.properties().get("picture"))); } } return alias; }</code><technical_language>@dmzaytsev also, in mind, in this design set user avatar once. Later, user changes picture in Github, catch change. continue picture. I solution is add randomization (pseudo code): if (alias.photo().equals(Alias.BLANK) || new Random().nextInt(10) == 5) { // ... }</technical_language>

Target:
public Alias alias() throws IOException { final Aliases aliases = this.user().aliases(); if (!aliases.iterate().iterator().hasNext()) { throw new RsForward( HttpURLConnection.HTTP_MOVED_TEMP, "/login/start" ); } final Alias alias = aliases.iterate().iterator().next(); final URI photo; final Identity identity = new RqAuth(this).identity(); if (identity.urn().startsWith("urn:github:")) { photo = URI.create(identity.properties().get("avatar")); } else if (identity.urn().startsWith("urn:facebook:") || identity.urn().startsWith("urn:google:")) { photo = URI.create(identity.properties().get("picture")); } else { photo = Alias.BLANK; } if (!alias.photo().equals(photo)) { alias.photo(photo); } return alias; }
Source:
<code>private RedisResponse doSet(Command command, ExecutionHandlerContext context, ByteArrayWrapper key, ByteArrayWrapper value, RedisStringCommands redisStringCommands, SetOptions setOptions) { boolean result = redisStringCommands.set(key, value, setOptions); if (result) { command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS)); <START> return RedisResponse.string(SUCCESS); <END> } return RedisResponse.nil(); }</code><technical_language>remove this setResponse call</technical_language>

Target:
private RedisResponse doSet(Command command, ExecutionHandlerContext context, ByteArrayWrapper key, ByteArrayWrapper value, RedisStringCommands redisStringCommands, SetOptions setOptions) { boolean result = redisStringCommands.set(key, value, setOptions); if (result) { return RedisResponse.string(SUCCESS); } return RedisResponse.nil(); }
Source:
<code>public void testGetEntry() { <START> Optional o = metacardMapper.getEntry(e -> e.getFeatureProperty().equals(FEATURE_NAME)); <END> assertThat(o.isPresent(), is(true)); o = metacardMapper.getEntry(e -> e.getFeatureProperty().equals(NON_EXISTENT_FEATURE)); assertThat(o.isPresent(), is(false)); o = metacardMapper.getEntry(null); assertThat(o, is(Optional.empty())); }</code><technical_language>nit: this variable name a more descriptive</technical_language>

Target:
public void testGetEntry() { Optional optionalEntry = metacardMapper.getEntry(e -> e.getFeatureProperty().equals(FEATURE_NAME)); assertThat(optionalEntry.isPresent(), is(true)); optionalEntry = metacardMapper.getEntry(e -> e.getFeatureProperty().equals(NON_EXISTENT_FEATURE)); assertThat(optionalEntry.isPresent(), is(false)); optionalEntry = metacardMapper.getEntry(null); assertThat(optionalEntry, is(Optional.empty())); }
Source:
<code>public Pair<String, List<Object>> getTableInsertData(Persistable p){ String built = "INSERT INTO " + scrubName(name) + " ("; HashMap<String, Object> contentValues = DatabaseHelper.getMetaFieldsAndValues(p); ArrayList<Object> params = new ArrayList<Object>(); for(int i = 0 ; i < rawCols.size() ; ++i) { built += rawCols.elementAt(i); if(i < rawCols.size() - 1) { built += ", "; } } built += ") VALUES ("; for(int i = 0 ; i < rawCols.size() ; ++i) { Object currentValue = contentValues.get(rawCols.elementAt(i)); built += "?"; params.add(currentValue); if(i < rawCols.size() - 1) { built += ", "; } } built += ");"; <START> return new Pair(built, params); <END> }</code><technical_language>Needs generics annotation: Pair<String, List<Object>>(built, params)</technical_language>

Target:
public Pair<String, List<Object>> getTableInsertData(Persistable p){ StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("INSERT INTO " + scrubName(name) + " ("); HashMap<String, Object> contentValues = DatabaseHelper.getMetaFieldsAndValues(p); ArrayList<Object> params = new ArrayList<Object>(); for(int i = 0 ; i < rawCols.size() ; ++i) { stringBuilder.append(rawCols.elementAt(i)); if(i < rawCols.size() - 1) { stringBuilder.append(", "); } } stringBuilder.append(") VALUES ("); for(int i = 0 ; i < rawCols.size() ; ++i) { Object currentValue = contentValues.get(rawCols.elementAt(i)); stringBuilder.append("?"); params.add(currentValue); if(i < rawCols.size() - 1) { stringBuilder.append(", "); } } stringBuilder.append(");"); return new Pair<String, List<Object>>(stringBuilder.toString(), params); }
Source:
<code>private static Class<?> compileWrapperClass(SubjectFactory<?, ?> subjectFactory) { Class<?> subjectClass = subjectFactory.getSubjectClass(); String wrapperClassName = subjectClass.getSimpleName() + ITERATING_WRAPPER; List<Method> methods = Arrays.asList(subjectClass.getMethods()); String subjectName = subjectClass.getSimpleName(); <START> Class<?> targetType = ReflectionUtil.capture(subjectClass, 1); <END> StringBuffer code = new StringBuffer(); code.append("package ").append(subjectClass.getPackage().getName()).append(";\n\n"); code.append("public class ").append(wrapperClassName).append(" ") .append("extends ").append(subjectName).append(" {\n"); appendConstructor(wrapperClassName, targetType, code); for (Method m : methods) { appendMethodWrapper(code, subjectClass, targetType, m); } code.append("}\n"); String out = code.toString(); ClassLoader classLoader; try { classLoader = new CompilingClassLoader( subjectClass.getClassLoader(), subjectClass.getName() + ITERATING_WRAPPER, out, null); } catch (CompilerException e) { throw new Error("Could not compile class " + wrapperClassName + " with source:\n" + out , e); } try { Class<?> wrapper = classLoader.loadClass(subjectClass.getName() + ITERATING_WRAPPER); return wrapper; } catch (ClassNotFoundException e) { throw new Error("Could not load class " + subjectName, e); } }</code><technical_language>I '1' worth giving a name to</technical_language>

Target:
private static Class<?> compileWrapperClass(SubjectFactory<?, ?> subjectFactory) { IteratingWrapperClassBuilder builder = new IteratingWrapperClassBuilder(subjectFactory); String out = builder.build().toString(); ClassLoader classLoader; try { classLoader = new CompilingClassLoader( subjectFactory.getSubjectClass().getClassLoader(), builder.className, out, null); } catch (CompilerException e) { throw new Error("Could not compile class " + builder.className + " with source:\n" + out , e); } try { Class<?> wrapper = classLoader.loadClass(builder.className); return wrapper; } catch (ClassNotFoundException e) { throw new Error("Could not load class " + subjectFactory.getSubjectClass().getSimpleName(), e); } }
Source:
<code>public static String formatRequest(String url, Position position, String alarm) { Uri serverUrl = Uri.parse(url).buildUpon() .appendQueryParameter("id", position.getDeviceId()) .appendQueryParameter("timestamp", String.valueOf(position.getTime().getTime() / 1000)) .appendQueryParameter("lat", String.valueOf(position.getLatitude())) .appendQueryParameter("lon", String.valueOf(position.getLongitude())) .appendQueryParameter("speed", String.valueOf(position.getSpeed())) .appendQueryParameter("bearing", String.valueOf(position.getCourse())) .appendQueryParameter("altitude", String.valueOf(position.getAltitude())) .appendQueryParameter("batt", String.valueOf(position.getBattery())) .build(); if (alarm != null && alarm.trim().length() != 0) { <START> serverUrl = serverUrl.buildUpon().appendQueryParameter("alarm", alarm).build(); <END> } int port = serverUrl.getPort(); if (port < 0 || port > 65535) { port = 5055; String host = serverUrl.getHost(); serverUrl = serverUrl.buildUpon().encodedAuthority(host + ":" + port).build(); } return serverUrl.toString(); }</code><technical_language>Why</technical_language>

Target:
public static String formatRequest(String url, Position position, String alarm) { Uri serverUrl = Uri.parse(url); Uri.Builder builder = serverUrl.buildUpon() .appendQueryParameter("id", position.getDeviceId()) .appendQueryParameter("timestamp", String.valueOf(position.getTime().getTime() / 1000)) .appendQueryParameter("lat", String.valueOf(position.getLatitude())) .appendQueryParameter("lon", String.valueOf(position.getLongitude())) .appendQueryParameter("speed", String.valueOf(position.getSpeed())) .appendQueryParameter("bearing", String.valueOf(position.getCourse())) .appendQueryParameter("altitude", String.valueOf(position.getAltitude())) .appendQueryParameter("batt", String.valueOf(position.getBattery())); if (alarm != null) { builder.appendQueryParameter("alarm", alarm); } return builder.build().toString(); }
Source:
<code>private static Slice realToLongDecimal(long value, long precision, long scale) { float floatValue = intBitsToFloat(intScale(value)); if (Float.isInfinite(floatValue) || Float.isNaN(floatValue)) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast REAL '%s' to DECIMAL(%s, %s)", floatValue, precision, scale)); } try { <START> BigDecimal bigDecimal = new BigDecimal(String.valueOf(floatValue)).setScale((int) scale, BigDecimal.ROUND_HALF_UP); <END> Slice decimal = Decimals.encodeScaledValue(bigDecimal); if (overflows(decimal, intScale(precision))) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast REAL '%s' to DECIMAL(%s, %s)", floatValue, precision, scale)); } return decimal; } catch (ArithmeticException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast REAL '%s' to DECIMAL(%s, %s)", floatValue, precision, scale)); } }</code><technical_language>intScale(scale), HALF_UP</technical_language>

Target:
private static Slice realToLongDecimal(long value, long precision, long scale) { float floatValue = intBitsToFloat(intScale(value)); if (Float.isInfinite(floatValue) || Float.isNaN(floatValue)) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast REAL '%s' to DECIMAL(%s, %s)", floatValue, precision, scale)); } try { BigDecimal bigDecimal = new BigDecimal(String.valueOf(floatValue)).setScale(intScale(scale), HALF_UP); Slice decimal = Decimals.encodeScaledValue(bigDecimal); if (overflows(decimal, intScale(precision))) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast REAL '%s' to DECIMAL(%s, %s)", floatValue, precision, scale)); } return decimal; } catch (ArithmeticException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast REAL '%s' to DECIMAL(%s, %s)", floatValue, precision, scale)); } }
Source:
<code>private void startFurnace() throws InterruptedException, ExecutionException { Future<Furnace> future = furnace.startAsync(); future.get(); long startTime = System.currentTimeMillis(); long maxWait = 1000L * 30L; while (true) { long currentTime = System.currentTimeMillis(); long timeWaited = currentTime - startTime; boolean allStarted = true; for (Addon addon : furnace.getAddonRegistry().getAddons()) { if (!addon.getStatus().isStarted()) { allStarted = false; } } if (allStarted) break; if (timeWaited > maxWait) { System.err.println("WARN: Not all addons started!"); for (Addon addon : furnace.getAddonRegistry().getAddons()) { if (!addon.getStatus().isStarted()) System.err.println("WARN: " + addon.getId() + " status: " + addon.getStatus()); } <START> } <END> } }</code><technical_language>I a break; this if RHAMT wait more 30 secs for addons start (maybe is addons get STARTED status)</technical_language>

Target:
private void startFurnace() throws InterruptedException, ExecutionException { Future<Furnace> future = furnace.startAsync(); future.get(); long startTime = System.currentTimeMillis(); long maxWait = 1000L * 30L; while (true) { long currentTime = System.currentTimeMillis(); long timeWaited = currentTime - startTime; boolean allStarted = true; for (Addon addon : furnace.getAddonRegistry().getAddons()) { if (!addon.getStatus().isStarted()) { allStarted = false; } } if (allStarted) break; if (timeWaited > maxWait) { System.err.println("WARN: Not all addons started!"); for (Addon addon : furnace.getAddonRegistry().getAddons()) { if (!addon.getStatus().isStarted()) System.err.println("WARN: " + addon.getId() + " status: " + addon.getStatus()); } break; } } }
Source:
<code>public void onBackPressed() { if (narrowedList != null) { narrowedList = null; getSupportFragmentManager().popBackStack(NARROW, FragmentManager.POP_BACK_STACK_INCLUSIVE); } else { <START> if(atHome){ <END> if(backPressedOnce){ finish(); } backPressedOnce=true; Toast.makeText(this, R.string.press_again_to_exit, Toast.LENGTH_SHORT).show(); new Handler().postDelayed(new Runnable() { @Override public void run() { backPressedOnce= false; } }, 2000); } else if(!atHome) atHome = true; } }</code><technical_language>figure out atHome is needed? I running app worked. I missed some case</technical_language>

Target:
public void onBackPressed() { if (narrowedList == null) { if (backPressedOnce) { finish(); } backPressedOnce = true; Toast.makeText(this, R.string.press_again_to_exit, Toast.LENGTH_SHORT).show(); statusUpdateRunnable = new Runnable() { @Override public void run() { backPressedOnce = false; } }; statusUpdateHandler.postDelayed(statusUpdateRunnable, 2000); } else { narrowedList = null; getSupportFragmentManager().popBackStack(NARROW, FragmentManager.POP_BACK_STACK_INCLUSIVE); } }
Source:
<code>public void testFaultyStyleDoesntBreak() throws Exception { MockHttpServletResponse response = getAsServletResponse( "wms?BBOX=-180,-90,180,90" + "&styles=raster&layers=cdf:Fifteen&Format=image/png" + "&request=GetMap" + "&width=256" + "&height=256" + "&srs=EPSG%3A4326"); <START> BufferedImage image = ImageIO.read(getBinaryInputStream(response)); <END> assertNotNull(image); }</code><technical_language>This is supposed return a blank image, if I understand correctly. If so, assert assertBlank utility method</technical_language>

Target:
public void testFaultyStyleDoesntBreak() throws Exception { MockHttpServletResponse response = getAsServletResponse( "wms?BBOX=-180,-90,180,90" + "&styles=raster&layers=cdf:Fifteen&Format=image/png" + "&request=GetMap" + "&width=256" + "&height=256" + "&srs=EPSG%3A4326"); BufferedImage image = ImageIO.read(getBinaryInputStream(response)); assertNotNull(image); assertBlank("testFaultyStyleDoesntBreak", image); }
Source:
<code>public void updateEntry(Sort oldSort, Sort newSort) { SQLiteDatabase sqLiteDatabase = getWritableDatabase(); ContentValues contentValues = new ContentValues(); <START> contentValues.put(COLUMN_SORT_ID, newSort.getId()); <END> contentValues.put(COLUMN_SORT_PATH, newSort.getPath()); contentValues.put(COLUMN_SORT_TYPE, newSort.getSortType()); sqLiteDatabase.update(TABLE_SORT, contentValues, COLUMN_SORT_ID + " = ?", new String[]{oldSort.getId() + ""}); }</code><technical_language>This is redundant. a clause COLUMN_SORT_ID + " = ?" ? is oldSort.getId() + ""</technical_language>

Target:
public void updateEntry(Sort oldSort, Sort newSort) { if (TextUtils.isEmpty(oldSort.path) || TextUtils.isEmpty(newSort.path)) { return; } SQLiteDatabase sqLiteDatabase = getWritableDatabase(); ContentValues contentValues = new ContentValues(); contentValues.put(COLUMN_SORT_PATH, newSort.path); contentValues.put(COLUMN_SORT_TYPE, newSort.type); sqLiteDatabase.update(TABLE_SORT, contentValues, COLUMN_SORT_PATH + " = ?", new String[]{oldSort.path}); }
Source:
<code>public void testCloseIsForcedOnPendingAddOffsetRequest() throws InterruptedException { Map<String, Object> configs = new HashMap<>(); configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9000"); configs.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "this-is-a-transactional-id"); Time time = new MockTime(); MetadataResponse initialUpdateResponse = TestUtils.metadataUpdateWith(1, singletonMap("testTopic", 1)); <START> ProducerMetadata metadata = newMetadata(0, Long.MAX_VALUE, Long.MAX_VALUE); <END> metadata.update(initialUpdateResponse, time.milliseconds()); MockClient client = new MockClient(time, metadata); Producer<String, String> producer = new KafkaProducer<>(configs, new StringSerializer(), new StringSerializer(), metadata, client, null, time); ExecutorService executorService = Executors.newSingleThreadExecutor(); CountDownLatch assertionDoneLatch = new CountDownLatch(1); client.prepareResponse(FindCoordinatorResponse.prepareResponse(Errors.NONE, host1)); executorService.submit(() -> { assertThrows(KafkaException.class, producer::initTransactions); assertionDoneLatch.countDown(); }); client.waitForRequests(1, 2000); producer.close(Duration.ofMillis(1000)); assertionDoneLatch.await(5000, TimeUnit.MILLISECONDS); }</code><technical_language>Is a reason test expiration idle time? Earlier, default idle time</technical_language>

Target:
public void testCloseIsForcedOnPendingAddOffsetRequest() throws InterruptedException { Map<String, Object> configs = new HashMap<>(); configs.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9000"); configs.put(ProducerConfig.TRANSACTIONAL_ID_CONFIG, "this-is-a-transactional-id"); Time time = new MockTime(); MetadataResponse initialUpdateResponse = TestUtils.metadataUpdateWith(1, singletonMap("testTopic", 1)); ProducerMetadata metadata = newMetadata(0, Long.MAX_VALUE); metadata.updateWithCurrentRequestVersion(initialUpdateResponse, false, time.milliseconds()); MockClient client = new MockClient(time, metadata); Producer<String, String> producer = new KafkaProducer<>(configs, new StringSerializer(), new StringSerializer(), metadata, client, null, time); ExecutorService executorService = Executors.newSingleThreadExecutor(); CountDownLatch assertionDoneLatch = new CountDownLatch(1); client.prepareResponse(FindCoordinatorResponse.prepareResponse(Errors.NONE, host1)); executorService.submit(() -> { assertThrows(KafkaException.class, producer::initTransactions); assertionDoneLatch.countDown(); }); client.waitForRequests(1, 2000); producer.close(Duration.ofMillis(1000)); assertionDoneLatch.await(5000, TimeUnit.MILLISECONDS); }
Source:
<code>public AvroConverter<String, ?> getConverterFromString(org.apache.avro.Schema.Field f) { Schema fieldSchema = AvroUtils.unwrapIfNullable(f.schema()); if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) { return new StringToBooleanConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._decimal())) { return new StringToDecimalConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) { return new StringToDoubleConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._int())) { return new StringToIntegerConverter(f); <START> } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._date()) || LogicalTypes.timestampMillis() == fieldSchema.getLogicalType()) { <END> return new StringToDateConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._bytes())) { return new StringToBytesConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._string())) { return super.getConverter(String.class); } throw new UnsupportedOperationException("The type " + fieldSchema.getType() + " is not supported."); }</code><technical_language>is recommended LogicalTypeUtils.isLogicalTimestampMillis()</technical_language>

Target:
public AvroConverter<String, ?> getConverterFromString(org.apache.avro.Schema.Field f) { Schema fieldSchema = AvroUtils.unwrapIfNullable(f.schema()); if (AvroUtils.isSameType(fieldSchema, AvroUtils._boolean())) { return new StringToBooleanConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._decimal())) { return new StringToDecimalConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._double())) { return new StringToDoubleConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._int())) { return new StringToIntegerConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._date()) || LogicalTypeUtils.isLogicalTimestampMillis(fieldSchema)) { return new StringToDateConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._bytes())) { return new StringToBytesConverter(f); } else if (AvroUtils.isSameType(fieldSchema, AvroUtils._string())) { return super.getConverter(String.class); } throw new UnsupportedOperationException("The type " + fieldSchema.getType() + " is not supported."); }
Source:
<code>public void shouldThrow_whenIncorrectOperationForCorporateDebitSurchargeAmount() { JsonNode jsonNode = new ObjectMapper() <START> .valueToTree(ImmutableMap.of(FIELD_OPERATION, "update", <END> FIELD_OPERATION_PATH, "corporate_debit_card_surcharge_amount", FIELD_VALUE, 250)); try { validator.validatePatchRequest(jsonNode); fail( "Expected ValidationException" ); } catch (ValidationException validationException) { assertThat(validationException.getErrors().size(), is(1)); assertThat(validationException.getErrors(), hasItems( "Operation [update] is not valid for path [corporate_debit_card_surcharge_amount]")); } }</code><technical_language>Minor "update" a valid JSON Patch operation ("add", "replace", "remove")</technical_language>

Target:
public void shouldThrow_whenIncorrectOperationForCorporateDebitSurchargeAmount() { JsonNode jsonNode = new ObjectMapper() .valueToTree(ImmutableMap.of(FIELD_OPERATION, "remove", FIELD_OPERATION_PATH, "corporate_debit_card_surcharge_amount", FIELD_VALUE, 250)); try { validator.validatePatchRequest(jsonNode); fail( "Expected ValidationException" ); } catch (ValidationException validationException) { assertThat(validationException.getErrors().size(), is(1)); assertThat(validationException.getErrors(), hasItems( "Operation [remove] is not valid for path [corporate_debit_card_surcharge_amount]")); } }
Source:
<code><START> public CassandraSegmentStore(CassandraDataStaxClient cassandra, String keyspace, String tableName, <END> AliasIndex<Segment> aliasIndex, IdGenerator idGenerator, Equivalence<? super Segment> equivalence, MessageSender<ResourceUpdatedMessage> sender) { super(idGenerator, equivalence, sender, new SystemClock()); this.cassandra = checkNotNull(cassandra); this.aliasIndex = checkNotNull(aliasIndex); this.keyspace = checkNotNull(keyspace); this.tableName = checkNotNull(tableName); }</code><technical_language>this private</technical_language>

Target:
private CassandraSegmentStore(CassandraDataStaxClient cassandra, String keyspace, String tableName, AliasIndex<Segment> aliasIndex, IdGenerator idGenerator, Equivalence<? super Segment> equivalence, MessageSender<ResourceUpdatedMessage> sender) { super(idGenerator, equivalence, sender, new SystemClock()); this.cassandra = checkNotNull(cassandra); this.aliasIndex = checkNotNull(aliasIndex); this.keyspace = checkNotNull(keyspace); this.tableName = checkNotNull(tableName); }
Source:
<code>public Object getAdapter(Class type) { <START> if (!initEditor.get() && stackedPane.getActiveControlKey() == EDIT_VIEW) <END> { if (type == CommandStack.class) { return chartEditor.getViewer().getEditDomain().getCommandStack(); } } if (type == IPropertySheetPage.class) { return propertySheetPage; } return super.getAdapter(type); }</code><technical_language>tidier text for CommandStack first, initEditor, etc. structure more consistent: - check type is asked for - try provide a relevant object (like below) @SuppressWarnings("rawtypes") public Object getAdapter(Class type) { if (type == CommandStack.class) { if (!initEditor.get() && stackedPane.getActiveControlKey() == EDIT_VIEW) { return chartEditor.getViewer().getEditDomain().getCommandStack(); } } if (type == IPropertySheetPage.class) { return propertySheetPage; } return super.getAdapter(type); }</technical_language>

Target:
public Object getAdapter(Class type) { if (type == CommandStack.class) { if (!initEditor.get() && stackedPane.getActiveControlKey() == EDIT_VIEW) { return chartEditor.getViewer().getEditDomain().getCommandStack(); } } if (type == IPropertySheetPage.class) { return propertySheetPage; } return super.getAdapter(type); }
Source:
<code>public static void validateJdk() throws RuntimeException { if (!isSupportedJdkVersion()) { if (isJdkAboveRange(getJdkVersion(), createJdkVersionRanges(getSupportedJdks()))) { logger.warn("We are looking into adding support for this JDK version. Use it at your own risk."); } else { throw new RuntimeException("Unsupported Jdk"); } } if (!isSupportedJdkVendor()) { logger.info("You're executing with a JDK made by a vendor that is not on the recommended list of vendors. Vendor: " + JAVA_VENDOR + " Please consider changing to a recommended JDK vendor."); <START> } else if (getBoolean(getProperty("mule.jdkDebug"))) { <END> logger.info("You're executing with a JDK made by a recommended vendor."); } }</code><technical_language>getBoolean</technical_language>

Target:
public static void validateJdk() throws RuntimeException { if (!isSupportedJdkVersion()) { if (isJdkAboveRange(getJdkVersion(), createJdkVersionRanges(getSupportedJdks()))) { logger.warn("We are looking into adding support for this JDK version. Use it at your own risk."); } else { throw new RuntimeException("Unsupported Jdk"); } } if (!isSupportedJdkVendor()) { logger.info("You're executing with a JDK made by a vendor that is not on the recommended list of vendors. Vendor: " + JAVA_VENDOR + " Please consider changing to a recommended JDK vendor."); } else if (getBoolean(MULE_JDK_DEBUG)) { logger.info("You're executing with a JDK made by a recommended vendor."); } }
Source:
<code>public void testSDView() { SWTBotView viewBot = fBot.viewById(UML2DVIEW_ID); assertNotNull(viewBot); viewBot.setFocus(); SWTBotUtils.waitForJobs(); List<SWTBotToolbarButton> viewButtons = viewBot.getToolbarButtons(); List<String> titles = new ArrayList<>(); for (SWTBotToolbarButton buttonBot : viewButtons) { titles.add(buttonBot.getToolTipText()); } String[] expected = { "Reset zoom factor", "Select", "Zoom in the diagram", "Zoom out the diagram", "Go to next page", "Go to previous page", "Go to first page", "Go to last page", "Find... (Ctrl+F)" }; <START> assertArrayEquals("Buttons", expected, titles.toArray(new String[0])); <END> }</code><technical_language>check if is in view? about: SDView view = (SDView) viewBot.getViewReference().getPart(false); Frame frame = view.getFrame(); assertEquals(2, frame.lifeLinesCount());</technical_language>

Target:
public void testSDView() { SWTBotView viewBot = fBot.viewById(UML2DVIEW_ID); assertNotNull(viewBot); viewBot.setFocus(); SWTBotUtils.waitForJobs(); List<SWTBotToolbarButton> viewButtons = viewBot.getToolbarButtons(); List<String> titles = new ArrayList<>(); for (SWTBotToolbarButton buttonBot : viewButtons) { titles.add(buttonBot.getToolTipText()); } String[] expected = { "Reset zoom factor", "Select", "Zoom in the diagram", "Zoom out the diagram", "Go to next page", "Go to previous page", "Go to first page", "Go to last page", "Find... (Ctrl+F)" }; assertArrayEquals("Buttons", expected, titles.toArray(new String[0])); SDView view = (SDView) viewBot.getViewReference().getPart(false); Frame frame = view.getFrame(); assertEquals(2, frame.lifeLinesCount()); }
Source:
<code>public long getSpaceRequired(Set<Entity> entities) { long total = 0L; for (val entity : entities) { <START> ObjectSpecification spec = storageService.getDownloadSpecification(entity.getId(), 0, -1L); <END> total += spec.getObjectSize(); } return total; }</code><technical_language>storageService.getDownloadSpecification(entity.getId()) added for convenience prevent accidental errors</technical_language>

Target:
public long getSpaceRequired(Set<Entity> entities) { long total = 0L; for (val entity : entities) { ObjectSpecification spec = storageService.getDownloadSpecification(entity.getId()); total += spec.getObjectSize(); } return total; }
Source:
<code>public static boolean backupFileDiffers(Path originalPath) { Path backupPath = getBackupPath(originalPath); if (!Files.exists(backupPath) || Files.isDirectory(backupPath)) { return false; } try { <START> return !com.google.common.io.Files.equal(originalPath.toFile(), backupPath.toFile()); <END> } catch (IOException e) { LOGGER.debug("Could not compare original file and backup file.", e); return true; } }</code><technical_language>Files.mismatch do job <LINK_0>,java.nio.file.Path)</technical_language>

Target:
public static boolean backupFileDiffers(Path originalPath) { Path backupPath = getBackupPath(originalPath); if (!Files.exists(backupPath) || Files.isDirectory(backupPath)) { return false; } try { return Files.mismatch(originalPath, backupPath) != -1L; } catch (IOException e) { LOGGER.debug("Could not compare original file and backup file.", e); return true; } }
Source:
<code><START> public void forceDarkTheme(boolean forced) { <END> forceDarkTheme = forced; }</code><technical_language>this method synchronized</technical_language>

Target:
public synchronized void forceDarkTheme(boolean forced) { forceDarkTheme = forced; }