auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private GeoHashLocation acquireGeohash() { provider = determineProviderRuntime(checker); if (provider == null) { return location; } try { if (!manager.isProviderEnabled(provider)) { return location; } Location fresh = manager.getLastKnownLocation(provider); if (fresh == null) { return location; } if (location == null || location.isDifferent(fresh)) { return new GeoHashLocation(fresh); } } catch (SecurityException ex) { Logger.log.logError("Missing permission for "+provider+" provider", ex); } catch (IllegalArgumentException ex) { Logger.log.logError("Provider "+provider+" is missing on this device", ex); } return location; }

Target:
private GeoHashLocation acquireGeohash() { List<Location> locations = new ArrayList<>(3); if (isAccurateAndFreshAndNotNull(location)) { locations.add(location); } List<String> providers = manager.getProviders(true); for (int i = 0, size = providers.size(); i < size; i++) { String provider = providers.get(i); try { Location location = manager.getLastKnownLocation(provider); if (isAccurateAndFreshAndNotNull(location)) { locations.add(location); } } catch (SecurityException ex) { Logger.log.logError("Missing permission for " + provider + " provider", ex); } } Location freshest = null; if (locations.size() > 1) { Collections.sort(locations, timeComparator); } if (locations.size() > 0) { freshest = locations.get(0); } if (freshest instanceof GeoHashLocation) { return (GeoHashLocation) freshest; } else { return freshest == null ? null : new GeoHashLocation(freshest); } }
Source:
BufferableHandle[] formatAll(AbstractWriteHandle[] value) { BufferableHandle[] bufferableHandle = new BufferableHandle[value.length]; for (int i=0; i<value.length; i++) { if(!(value[i] instanceof BufferableHandle)) throw new IllegalArgumentException("BufferableHandle array cannot be created."); NodeConverter.withFormat(value[i], getFormat()); bufferableHandle[i] = (BufferableHandle) value[i]; } return bufferableHandle; }

Target:
BufferableHandle[] formatAll(AbstractWriteHandle[] value) { BufferableHandle[] bufferableHandles = new BufferableHandle[value.length]; for (int i=0; i<value.length; i++) { if(!(value[i] instanceof BufferableHandle)) throw new IllegalArgumentException("AbstractWriteHandle value is not an instance of BufferableHandle."); NodeConverter.withFormat(value[i], getFormat()); bufferableHandles[i] = (BufferableHandle) value[i]; } return bufferableHandles; }
Source:
public Response cleanInfinispanCache( @ApiParam( "The name of cache to clean" ) @PathParam( "name" ) final String name ) { return Response.status( FORBIDDEN ).build(); }

Target:
public Response cleanInfinispanCache( @ApiParam( "The name of cache to clean" ) @PathParam( "name" ) final String name ) { Response response; try { ispnCacheController.clean( name ); response = Response.ok().build(); } catch ( IndyWorkflowException e ) { logger.error( String.format( "Failed to clean: %s. Reason: %s", name, e.getMessage() ), e ); response = responseHelper.formatResponse( e ); } return response; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try (Closeable ignored = populateTraceContext(request)) { chain.doFilter(request, response); } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { Closeable traceContext = populateTraceContext(request); try { chain.doFilter(request, response); } finally { traceContext.close(); } }
Source:
public void activate() { try { logger.debug("Activating CarbonCoreComponent"); ConfigProvider configProvider = DataHolder.getInstance().getOptConfigProvider().get(); CarbonRuntime carbonRuntime = CarbonRuntimeFactory.createCarbonRuntime(configProvider); DataHolder.getInstance().getBundleContext() .registerService(CarbonRuntime.class.getName(), carbonRuntime, null); } catch (Throwable throwable) { logger.error("Error while activating CarbonCoreComponent"); } }

Target:
public void activate() { try { logger.debug("Activating CarbonCoreComponent"); ConfigProvider configProvider = DataHolder.getInstance().getConfigProvider(); CarbonRuntime carbonRuntime = CarbonRuntimeFactory.createCarbonRuntime(configProvider); DataHolder.getInstance().getBundleContext() .registerService(CarbonRuntime.class.getName(), carbonRuntime, null); } catch (Throwable throwable) { logger.error("Error while activating CarbonCoreComponent"); } }
Source:
public LoggingPreferences getLoggingPreferences() throws JSONException { LoggingPreferences ret = null; Object o = getCapability(CapabilityType.LOGGING_PREFS); if (o != null) { ret = new LoggingPreferences(); if (o instanceof JSONObject){ JSONObject json = (JSONObject) o; Iterator<String> iter = json.keys(); while (iter.hasNext()) { String key = iter.next(); Level level = Level.parse((String) json.get(key)); ret.enable(key, level); } } } return ret; }

Target:
public LoggingPreferences getLoggingPreferences() throws JSONException { LoggingPreferences loggingPrefs = null; Object loggingPrefsJson = getCapability(CapabilityType.LOGGING_PREFS); if (loggingPrefsJson != null) { loggingPrefs = new LoggingPreferences(); JSONObject json = (JSONObject) loggingPrefsJson; Iterator<String> iter = json.keys(); while(iter.hasNext()) { String logType = iter.next(); Level level = Level.parse((String) json.get(logType)); loggingPrefs.enable(logType, level); } } if (loggingPrefs == null) { return new LoggingPreferences(); } return loggingPrefs; }
Source:
public void addContents(@NonNull Container container) { Jenkins j = Jenkins.getActiveInstance(); addUnixContents(container, j); for (Node node : j.getNodes()) { addUnixContents(container, node); } }

Target:
public void addContents(@NonNull Container container) { Jenkins j = Jenkins.getInstance(); addUnixContents(container, j); for (Node node : j.getNodes()) { addUnixContents(container, node); } }
Source:
public void testLaunchpadStressByCreatingLotsOfFrameworksInDifferentThreads() throws Exception { List<Launchpad> l = new CopyOnWriteArrayList<>(); List<Throwable> e = new CopyOnWriteArrayList<>(); Random r = new Random(); Semaphore semaphore = new Semaphore(0); builder.bundles("org.apache.felix.log, org.apache.felix.scr") .runfw("org.apache.felix.framework"); int n = 20; for (int i = 0; i < n; i++) { Launchpad fw = builder.create("foo", "bar"); l.add(fw); Processor.getExecutor() .execute(() -> { try { Bundle bundle = fw.component(ExternalRefComp.class); int sleep = Math.abs(r.nextInt() % 100) + 30; System.out.println( fw.runspec.properties.get(org.osgi.framework.Constants.FRAMEWORK_STORAGE) + " " + sleep); Thread.sleep(sleep); softly.assertThat(fw.getService(ExternalRefComp.class)) .isNotNull(); bundle.stop(); } catch (Throwable ee) { softly.fail(ee.toString(), ee); } finally { semaphore.release(); } }); } System.out.println("Waiting for the threads to finish"); boolean success = semaphore.tryAcquire(n, 60, TimeUnit.SECONDS); assertTrue(success); System.out.println("Closing " + n + " frameworks"); l.forEach(IO::close); }

Target:
public void testLaunchpadStressByCreatingLotsOfFrameworksInDifferentThreads() throws Exception { List<Launchpad> l = new CopyOnWriteArrayList<>(); List<Throwable> e = new CopyOnWriteArrayList<>(); Random r = new Random(); Semaphore semaphore = new Semaphore(0); builder.bundles("org.apache.felix.log, org.apache.felix.scr") .runfw("org.apache.felix.framework"); int n = 20; for (int i = 0; i < n; i++) { Launchpad fw = builder.create("foo", "bar"); l.add(fw); Processor.getExecutor() .execute(() -> { try { Bundle bundle = fw.component(ExternalRefComp.class); int sleep = Math.abs(r.nextInt() % 100) + 30; System.out.println( fw.runspec.properties.get(org.osgi.framework.Constants.FRAMEWORK_STORAGE) + " " + sleep); Thread.sleep(sleep); softly.assertThat(fw.getService(ExternalRefComp.class)) .isNotNull(); bundle.stop(); } catch (Throwable ee) { softly.fail(ee.toString(), ee); } finally { semaphore.release(); } }); } System.out.println("Waiting for the threads to finish"); boolean success = semaphore.tryAcquire(n, 60, TimeUnit.SECONDS); softly.assertThat(success) .isTrue(); System.out.println("Closing " + n + " frameworks"); l.forEach(IO::close); }
Source:
private Block filterAndSend(InboundMessageQueuer p1, List<Block> blocks, BloomFilter filter) { Block exhaustionPoint = null; for (int i = 0; i < blocks.size(); i++) { Block block = blocks.get(i); FilteredBlock fb = filter.applyAndUpdate(block); inbound(p1, fb); for (Transaction tx : fb.getAssociatedTransactions().values()) inbound(p1, tx); if (i == 3) exhaustionPoint = block; } return exhaustionPoint; }

Target:
private void filterAndSend(InboundMessageQueuer p1, List<Block> blocks, BloomFilter filter) { for (Block block : blocks) { FilteredBlock fb = filter.applyAndUpdate(block); inbound(p1, fb); for (Transaction tx : fb.getAssociatedTransactions().values()) inbound(p1, tx); } }
Source:
private boolean singleMatchRune(int r) { int r0 = runes[0]; if (r == r0) { return true; } if ((arg & RE2.FOLD_CASE) != 0) { int[] folds = Unicode.optimizedFoldOrbit(r0); if (folds == null) { return (r == Unicode.optimizedFoldNonOrbit(r0)); } else { for(int i = 0; i < folds.length; i++) { if (folds[i] == r) return true; } } } return false; }

Target:
private boolean singleMatchRune(int r) { int r0 = runes[0]; if (r == r0) { return true; } if ((arg & RE2.FOLD_CASE) != 0) { int[] folds = Unicode.optimizedFoldOrbit(r0); if (folds == null) { return Unicode.areEqualsCaseInsensitive(r, r0); } else { for(int i = 0; i < folds.length; i++) { if (folds[i] == r) return true; } } } return false; }
Source:
static void visitObject(JsonParser parser, String name, Set<String> result) throws IOException { if (!parser.isExpectedStartObjectToken()) { throw new IOException("Expecting object start, got " + parser.currentToken()); } JsonToken value; while ((value = parser.nextValue()) != JsonToken.END_OBJECT) { if (value == null) { throw new IOException("End of input while parsing object."); } if (parser.getCurrentName().equals(name)) { result.add(parser.getText()); } else { visitNextOrSkip(parser, name, result); } } }

Target:
static void visitObject(JsonParser parser, String name, Set<String> result) throws IOException { if (!parser.isExpectedStartObjectToken()) { throw new IOException("Expecting object start, got " + parser.currentToken()); } JsonToken value; while ((value = parser.nextValue()) != JsonToken.END_OBJECT) { if (value == null) { return; } if (parser.getCurrentName().equals(name)) { result.add(parser.getText()); } else { visitNextOrSkip(parser, name, result); } } }
Source:
private Collection<IInstallableUnit> findUpdates(IInstallableUnit iu, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); Collection<IInstallableUnit> availableUpdates = new HashSet<>(); IQueryResult<IInstallableUnit> updatesAvailable = planner.updatesFor(iu, provisioningContext, subMonitor.split(1)); for (IInstallableUnit iInstallableUnit : updatesAvailable) { availableUpdates.add(iInstallableUnit); } return availableUpdates; }

Target:
private Collection<IInstallableUnit> findUpdates(IInstallableUnit iu, IProgressMonitor monitor) { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); Collection<IInstallableUnit> availableUpdates = new HashSet<>(); IQueryResult<IInstallableUnit> updatesAvailable = planner.updatesFor(iu, provisioningContext, subMonitor.split(1)); for (IInstallableUnit iuu : updatesAvailable) { availableUpdates.add(iuu); } return availableUpdates; }
Source:
private ServerTemplate loadServerTemplate(String serverTemplateId) { ServerTemplate template = getTemplateStorage().load(serverTemplateId); if (template == null) { throw new RuntimeException("No server template found for id " + serverTemplateId); } return template; }

Target:
private ServerTemplate loadServerTemplate(String serverTemplateId) { final ServerTemplate template = getTemplateStorage().load(serverTemplateId); if (template == null) { throw new RuntimeException("No server template found for id " + serverTemplateId); } return template; }
Source:
public CalcState(final JSONObject json) { format = Settings.CoordInputFormatEnum.values()[json.optInt("format", 2)]; plainLat = json.optString("plainLat"); plainLon = json.optString("plainLon"); latHemisphere = (char) json.optInt("latHemisphere", ERROR_CHAR); lonHemisphere = (char) json.optInt("lonHemisphere", ERROR_CHAR); { final JSONArray array = json.optJSONArray("buttons"); final int arrayLength = array != null ? array.length() : 0; buttons = new ArrayList<>(arrayLength); for (int i = 0; i < arrayLength; i++) { buttons.add(new CalculateButton.ButtonData(array.optJSONObject(i))); } } { final JSONArray array = json.optJSONArray("equations"); final int arrayLength = array != null ? array.length() : 0; equations = new ArrayList<>(arrayLength); for (int i = 0; i < arrayLength; i++) { equations.add(new CalculatorVariable.VariableData(array.optJSONObject(i))); } } { final JSONArray array = json.optJSONArray("freeVariables"); final int arrayLength = array != null ? array.length() : 0; freeVariables = new ArrayList<>(arrayLength); for (int i = 0; i < arrayLength; i++) { freeVariables.add(new CalculatorVariable.VariableData(array.optJSONObject(i))); } } notes = json.optString("notes"); }

Target:
private CalcState(final JSONObject json) { format = CoordInputFormatEnum.values()[json.optInt("format", 2)]; plainLat = json.optString("plainLat"); plainLon = json.optString("plainLon"); latHemisphere = (char) json.optInt("latHemisphere", ERROR_CHAR); lonHemisphere = (char) json.optInt("lonHemisphere", ERROR_CHAR); buttons = createJSONAbleList(json.optJSONArray("buttons"), new CalculateButton.ButtonDataFactory()); equations = createJSONAbleList(json.optJSONArray("equations"), new CalculatorVariable.VariableDataFactory()); freeVariables = createJSONAbleList(json.optJSONArray("freeVariables"), new CalculatorVariable.VariableDataFactory()); variableBank = new ArrayList<>(); notes = json.optString("notes"); }
Source:
public void refreshHeavyWeightData() { log.debug("Refreshing Gluster Data [heavyweight]"); for (VDSGroup cluster : getClusterDao().getAll()) { if (cluster.getcompatibility_version().compareTo(Version.v3_2) >= 0 && cluster.supportsGlusterService()) { try { refreshClusterHeavyWeightData(cluster); } catch (Exception e) { log.errorFormat("Error while refreshing Gluster heavyweight data of cluster {0}!", cluster.getname(), e); } } } }

Target:
public void refreshHeavyWeightData() { log.debug("Refreshing Gluster Data [heavyweight]"); for (VDSGroup cluster : getClusterDao().getAll()) { if (GlusterFeatureSupported.refreshHeavyWeight(cluster.getcompatibility_version()) && cluster.supportsGlusterService()) { try { refreshClusterHeavyWeightData(cluster); } catch (Exception e) { log.errorFormat("Error while refreshing Gluster heavyweight data of cluster {0}!", cluster.getname(), e); } } } }
Source:
public void testUpdate() throws InterruptedException { server.enqueue( new MockResponse().setBody(stringFromResource("/publicip/get.json")) ); PublicIp response = publicIpApi().update("publicipId", PublicIp.UpdatePublicIp.create("reverseDns")); assertNotNull(response); assertEquals(server.getRequestCount(), 1); assertSent(server, "PUT", "/public_ips/publicipId"); }

Target:
public void testUpdate() throws InterruptedException { server.enqueue( new MockResponse().setBody(stringFromResource("/publicip/get.json")) ); PublicIp response = publicIpApi().update("publicipId", PublicIp.UpdatePublicIp.create("reverseDns")); assertNotNull(response); assertEquals(server.getRequestCount(), 1); assertSent(server, "PUT", "/public_ips/publicipId", "{\"reverse_dns\":\"reverseDns\"}"); }
Source:
public void synchronouslyInitializedManagerIsInitializedEvenIfKvsIsNot() { SerializableTransactionManager theManager = SerializableTransactionManager.create( mockKvs, mockTimelockService, null, null, () -> null, null, null, mockCleaner, mockInitializer, false, () -> 1L, 1, false); when(mockKvs.isInitialized()).thenReturn(false); assertTrue(theManager.isInitialized()); }

Target:
public void synchronouslyInitializedManagerIsInitializedEvenIfKvsIsNot() { SerializableTransactionManager theManager = SerializableTransactionManager.create( mockKvs, mockTimelockService, null, null, () -> null, null, null, mockCleaner, mockInitializer, false, () -> 1L, 1, false); when(mockKvs.isInitialized()).thenReturn(false); when(mockTimelockService.isInitialized()).thenReturn(false); when(mockCleaner.isInitialized()).thenReturn(false); when(mockInitializer.isInitialized()).thenReturn(false); assertTrue(theManager.isInitialized()); }
Source:
private void saveImageToMediaStore() { if (galleryItem == null) { return; } parentActivity.getFunnel().logGallerySave(pageTitle, galleryItem.getName()); new SaneAsyncTask<String>(SaneAsyncTask.SINGLE_THREAD) { @Override public String performTask() throws Throwable { return MediaStore.Images.Media.insertImage(parentActivity.getContentResolver(), ((BitmapDrawable) mainImage.getDrawable()).getBitmap(), pageTitle.getDisplayText(), galleryItem.getName()); } @Override public void onFinish(String result) { if (!isAdded()) { return; } if (result != null) { Toast.makeText(parentActivity, getString(R.string.gallery_save_success), Toast.LENGTH_SHORT).show(); } else { parentActivity.showError(getString(R.string.gallery_save_error_unknown)); } } @Override public void onCatch(Throwable caught) { if (!isAdded()) { return; } parentActivity.showError(String.format(getString(R.string.gallery_save_error), caught.getLocalizedMessage())); } }.execute(); }

Target:
private void saveImageToMediaStore() { if (galleryItem == null) { return; } parentActivity.getFunnel().logGallerySave(pageTitle, galleryItem.getName()); new SaneAsyncTask<Void>(SaneAsyncTask.SINGLE_THREAD) { @Override public Void performTask() throws Throwable { String url = MediaStore.Images.Media.insertImage(parentActivity.getContentResolver(), ((BitmapDrawable) mainImage.getDrawable()).getBitmap(), pageTitle.getDisplayText(), galleryItem.getName()); if (url == null) throw new RuntimeException(getString(R.string.gallery_save_error_unknown)); return null; } @Override public void onFinish(Void result) { if (!isAdded()) { return; } Toast.makeText(parentActivity, getString(R.string.gallery_save_success), Toast.LENGTH_SHORT).show(); } @Override public void onCatch(Throwable caught) { if (!isAdded()) { return; } parentActivity.showError(String.format(getString(R.string.gallery_save_error), caught.getLocalizedMessage())); } }.execute(); }
Source:
protected void analyze() { if (isVmStoppedBeingReported()) { proceedDisappearedVm(); return; } if (isExternalOrUnmanagedHostedEngineVm()) { processUnmanagedVm(); return; } if (isVmDown()) { proceedDownVm(); return; } if (isVmRebooting()) { proceedRebootingVm(); } if (!isVmRunningInDatabaseOnMonitoredHost()) { proceedVmReportedOnOtherHost(); return; } proceedVmReportedOnExpectedHost(); }

Target:
protected void analyze() { if (isVmStoppedBeingReported()) { proceedDisappearedVm(); return; } if (isExternalOrUnmanagedHostedEngineVm()) { processUnmanagedVm(); return; } if (isVmDown()) { proceedDownVm(); return; } if (!isVmRunningInDatabaseOnMonitoredHost()) { proceedVmReportedOnOtherHost(); return; } proceedVmReportedOnExpectedHost(); }
Source:
private SymbolToken intern(final String text) { if (text == null) return null; SymbolToken token = lst.intern(text); newSymbols |= token.getSid() > maxSysId; return token; }

Target:
private SymbolToken intern(final String text) { if (text == null) return null; SymbolToken token = lst.intern(text); hasUnflushedLocalSymbols |= token.getSid() > maxSysId; return token; }
Source:
private void deleteQuestion() { String questionId = getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID); Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_QUESTION_ID, questionId); String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID); Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId); String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName); String questionNumber = getRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_NUMBER); Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, questionNumber); logic.deleteFeedbackQuestion(questionId); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_QUESTION_DELETED, StatusMessageColor.SUCCESS)); statusToAdmin = "Feedback Question " + questionNumber + " for session:<span class=\"bold\">(" + feedbackSessionName + ")</span> for Course <span class=\"bold\">[" + courseId + "]</span> deleted.<br>"; }

Target:
private void deleteQuestion() { String questionId = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_ID); String courseId = getNonNullRequestParamValue(Const.ParamsNames.COURSE_ID); String feedbackSessionName = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME); String questionNumber = getNonNullRequestParamValue(Const.ParamsNames.FEEDBACK_QUESTION_NUMBER); logic.deleteFeedbackQuestion(questionId); statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_QUESTION_DELETED, StatusMessageColor.SUCCESS)); statusToAdmin = "Feedback Question " + questionNumber + " for session:<span class=\"bold\">(" + feedbackSessionName + ")</span> for Course <span class=\"bold\">[" + courseId + "]</span> deleted.<br>"; }
Source:
public Map<K, V> getNextTrainingData() { final List<K> nextTrainingDataKeyList; synchronized (this) { if (trainingDataKeys.isEmpty()) { LOG.log(Level.INFO, "no more training data for current epoch"); return Collections.emptyMap(); } nextTrainingDataKeyList = new ArrayList<>( trainingDataKeys.subList(0, Math.min(miniBatchSize, trainingDataKeys.size()))); trainingDataKeys = trainingDataKeys .subList(Math.min(miniBatchSize, trainingDataKeys.size()), trainingDataKeys.size()); } final Map<K, V> nextTrainingData = new HashMap<>(); for (final K key : nextTrainingDataKeyList) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingData.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } LOG.log(Level.INFO, "Size of training data for next mini-batch: {0}", nextTrainingData.size()); if (nextTrainingDataKeyList.size() != nextTrainingData.size()) { LOG.log(Level.INFO, "The number of assigned data keys for next mini-batch is {0}," + " but ths size of actually prepared training data is {1}", new Object[]{nextTrainingDataKeyList.size(), nextTrainingData.size()}); } return nextTrainingData; }

Target:
public Map<K, V> getNextTrainingData() { final List<K> nextTrainingDataKeyList; synchronized (this) { if (trainingDataKeys.isEmpty()) { LOG.log(Level.INFO, "no more training data for current epoch"); return Collections.emptyMap(); } final int numRemainingKeys = trainingDataKeys.size(); final int nextBatchSize = Math.min(miniBatchSize, numRemainingKeys); nextTrainingDataKeyList = new ArrayList<>(trainingDataKeys.subList(0, nextBatchSize)); trainingDataKeys = trainingDataKeys.subList(nextBatchSize, numRemainingKeys); } final Map<K, V> nextTrainingData = new HashMap<>(); for (final K key : nextTrainingDataKeyList) { final Pair<K, V> keyValuePair = memoryStore.get(key); if (keyValuePair == null) { continue; } nextTrainingData.put(keyValuePair.getFirst(), keyValuePair.getSecond()); } LOG.log(Level.INFO, "Size of training data for next mini-batch: {0}", nextTrainingData.size()); if (nextTrainingDataKeyList.size() != nextTrainingData.size()) { LOG.log(Level.INFO, "The number of assigned data keys for next mini-batch is {0}," + " but ths size of actually prepared training data is {1}", new Object[]{nextTrainingDataKeyList.size(), nextTrainingData.size()}); } return nextTrainingData; }
Source:
private void checkHeadBranchExist(PullRequestStory pullRequestStory) { RepoInfo headRepoInfo = pullRequestStory.item.head.repo.toInfo(); GetRepoClient getRepoClient = new GetRepoClient(headRepoInfo); GetReferenceClient referenceClient = new GetReferenceClient(headRepoInfo, pullRequestStory.item.head.ref); getRepoClient .observable() .flatMap((repo) -> { hasPushPermissionsToHead = repo.permissions.push; return referenceClient.observable() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<GitReference>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { notifyHeadOfAdapter(false); } @Override public void onNext(GitReference reference) { notifyHeadOfAdapter(true); } }); }

Target:
private void checkHeadBranchExist(PullRequestStory pullRequestStory) { RepoInfo headRepoInfo = pullRequestStory.item.head.repo.toInfo(); GetRepoClient getRepoClient = new GetRepoClient(headRepoInfo); GetReferenceClient referenceClient = new GetReferenceClient(headRepoInfo, pullRequestStory.item.head.ref); getRepoClient .observable() .flatMap((repo) -> { if (repo.permissions != null) { hasPushPermissionsToHead = repo.permissions.push; } return referenceClient.observable() .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()); }) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Subscriber<GitReference>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { notifyHeadOfAdapter(false); } @Override public void onNext(GitReference reference) { notifyHeadOfAdapter(true); } }); }
Source:
public void setStackInSlot(int slot, ItemStack stack) { ItemStack[] stacks = this.stacks; validateSlotIndex(slot, stacks); if (ItemStack.areItemStacksEqual(stacks[slot], stack)) return; stacks[slot] = stack; onContentsChanged(slot); }

Target:
public void setStackInSlot(int slot, ItemStack stack) { validateSlotIndex(slot); if (ItemStack.areItemStacksEqual(this.stacks[slot], stack)) return; this.stacks[slot] = stack; onContentsChanged(slot); }
Source:
public int read(char[] cbuf, int off, int len) throws IOException { buf = cbuf.clone(); bufIndex = off; if (Objects.isNull(tableNames)) { try { tableNames = reader.getTableNames().iterator(); } catch (SQLiteTableReaderException ex) { return -1; } } if (Objects.nonNull(leftOvers) && !leftOvers.isFinished()) { bufIndex += leftOvers.read(cbuf, off, len); } while (bufIndex != len) { if (Objects.isNull(currentTableName) || reader.isFinished()) { if (tableNames.hasNext()) { currentTableName = tableNames.next(); try { totalColumns = reader.getColumnCount(currentTableName); reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } else { if (bufIndex == off) { return -1; } return bufIndex; } } else { try { reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } } return bufIndex; }

Target:
public int read(char[] cbuf, int off, int len) throws IOException { buf = cbuf; bufIndex = off; if (Objects.isNull(tableNames)) { try { tableNames = reader.getTableNames().iterator(); } catch (SQLiteTableReaderException ex) { return -1; } } if (Objects.nonNull(leftOvers) && !leftOvers.isFinished()) { bufIndex += leftOvers.read(cbuf, off, len); } while (bufIndex != len) { if (Objects.isNull(currentTableName) || reader.isFinished()) { if (tableNames.hasNext()) { currentTableName = tableNames.next(); try { totalColumns = reader.getColumnCount(currentTableName); reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } else { if (bufIndex == off) { return -1; } return bufIndex; } } else { try { reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } } return bufIndex; }
Source:
public void createClaimWithLogging(String wikidataEntityId, String fileName) { if (wikidataEntityId == null) { Timber.d("Skipping creation of claim as Wikidata entity ID is null"); return; } if (fileName == null) { Timber.d("Skipping creation of claim as fileName entity ID is null"); return; } if (!(directPrefs.getBoolean("Picture_Has_Correct_Location",true))) { Timber.d("Image location and nearby place location missmatched, so wikidata item won't be edited"); return; } editWikidataProperty(wikidataEntityId, fileName); }

Target:
public void createClaimWithLogging(String wikidataEntityId, String fileName) { if (wikidataEntityId == null) { Timber.d("Skipping creation of claim as Wikidata entity ID is null"); return; } if (fileName == null) { Timber.d("Skipping creation of claim as fileName entity ID is null"); return; } if (!(directPrefs.getBoolean("Picture_Has_Correct_Location",true))) { Timber.d("Image location and nearby place location mismatched, so Wikidata item won't be edited"); return; } editWikidataProperty(wikidataEntityId, fileName); }
Source:
public void shouldGetLateRecordDropSensor() { final String metricNamePrefix = "late-record-drop"; final String descriptionOfCount = "The total number of dropped late records"; final String descriptionOfRate = "The average number of dropped late records per second"; if (builtInMetricsVersion == Version.FROM_0100_TO_24) { setUpThroughputSensor( metricNamePrefix, descriptionOfRate, descriptionOfCount, RecordingLevel.INFO ); } else { expect(streamsMetrics.nodeLevelSensor( THREAD_ID, TASK_ID, PROCESSOR_NODE_ID, metricNamePrefix, RecordingLevel.INFO )).andReturn(expectedSensor); } verifySensor(() -> ProcessorNodeMetrics.lateRecordDropSensor(THREAD_ID, TASK_ID, PROCESSOR_NODE_ID, streamsMetrics)); }

Target:
public void shouldGetLateRecordDropSensor() { final String metricNamePrefix = "late-record-drop"; final String descriptionOfCount = "The total number of dropped late records"; final String descriptionOfRate = "The average number of dropped late records per second"; setUpThroughputSensor( metricNamePrefix, descriptionOfRate, descriptionOfCount, RecordingLevel.INFO ); verifySensor(() -> ProcessorNodeMetrics.lateRecordDropSensor(THREAD_ID, TASK_ID, PROCESSOR_NODE_ID, streamsMetrics)); }
Source:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { count++; if (count % stepSize == 0) { if (worked-- > 0) monitor.update(stepSize); if (monitor.isCancelled()) cancelled = true; } return !cancelled; }

Target:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { count++; if (count % stepSize == 0) { if (count <= total) monitor.update(stepSize); if (monitor.isCancelled()) throw StopWalkException.INSTANCE; } return true; }
Source:
public void testEquals() throws Exception { File tempFile = File.createTempFile( "pomTest-", ".xml" ); tempFile.deleteOnExit(); FileModelSource instance = new FileModelSource( tempFile ); assertFalse( instance.equals( null ) ); assertFalse( instance.equals( new Object() ) ); assertTrue( instance.equals( instance ) ); assertTrue( instance.equals( new FileModelSource( tempFile ) ) ); }

Target:
public void testEquals() throws Exception { File tempFile = createTempFile( "pomTest" ); FileModelSource instance = new FileModelSource( tempFile ); assertFalse( instance.equals( null ) ); assertFalse( instance.equals( new Object() ) ); assertTrue( instance.equals( instance ) ); assertTrue( instance.equals( new FileModelSource( tempFile ) ) ); }
Source:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String spanName = spanName(handler); boolean reuseSpan = getTracer().isTracing(); Span span = reuseSpan ? getTracer().getCurrentSpan() : getTracer().createSpan(spanName); span.logEvent(getTraceKeys().getMvc().getControllerStart()); if (log.isDebugEnabled()) { log.debug("Created new span " + span + " with name [" + spanName + "]"); } addClassMethodTag(handler, span); addClassNameTag(handler, span); setSpanInAttribute(request, span); if (!reuseSpan) { setNewSpanCreatedAttribute(request, span); } return true; }

Target:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String spanName = spanName(handler); boolean continueSpan = getRootSpanFromAttribute(request) != null; Span span = continueSpan ? getRootSpanFromAttribute(request) : getTracer().createSpan(spanName); if (log.isDebugEnabled()) { log.debug("Created new span " + span + " with name [" + spanName + "]"); } addClassMethodTag(handler, span); addClassNameTag(handler, span); setSpanInAttribute(request, span); if (!continueSpan) { setNewSpanCreatedAttribute(request, span); } return true; }
Source:
public void getThreadExecutionStateDone(ICPUDMContext cpuContext, ICoreDMContext coreContext, IMIExecutionDMContext execContext, IThreadDMData threadData, VisualizerExecutionState state, Object arg) { VisualizerModel model = (VisualizerModel) arg; int cpuID = Integer.parseInt(cpuContext.getId()); VisualizerCPU cpu = model.getCPU(cpuID); int coreID = Integer.parseInt(coreContext.getId()); VisualizerCore core = cpu.getCore(coreID); if (state == null) { state = VisualizerExecutionState.RUNNING; } IMIProcessDMContext processContext = DMContexts.getAncestorOfType(execContext, IMIProcessDMContext.class); int pid = Integer.parseInt(processContext.getProcId()); int tid = execContext.getThreadId(); String osTIDValue = threadData.getId(); int osTid = (osTIDValue == null) ? tid : Integer.parseInt(osTIDValue); if (model.getThread(tid) == null) { model.addThread(new VisualizerThread(core, pid, osTid, tid, state)); } else { VisualizerThread t = model.getThread(tid); t.setState(state); t.setCore(core); } done(1, model); }

Target:
public void getThreadExecutionStateDone(ICPUDMContext cpuContext, ICoreDMContext coreContext, IMIExecutionDMContext execContext, IThreadDMData threadData, VisualizerExecutionState state, Object arg) { VisualizerModel model = (VisualizerModel) arg; int cpuID = Integer.parseInt(cpuContext.getId()); VisualizerCPU cpu = model.getCPU(cpuID); int coreID = Integer.parseInt(coreContext.getId()); VisualizerCore core = cpu.getCore(coreID); if (state == null) { state = VisualizerExecutionState.RUNNING; } IMIProcessDMContext processContext = DMContexts.getAncestorOfType(execContext, IMIProcessDMContext.class); int pid = Integer.parseInt(processContext.getProcId()); int tid = execContext.getThreadId(); String osTIDValue = threadData.getId(); int osTid = (osTIDValue == null) ? tid : Integer.parseInt(osTIDValue); VisualizerThread t = model.getThread(tid); if (t == null) { model.addThread(new VisualizerThread(core, pid, osTid, tid, state)); } else { t.setCore(core); t.setTID(osTid); t.setState(state); } done(1, model); }
Source:
public int hashCode() { return getClass().hashCode(); }

Target:
public int hashCode() { return 1; }
Source:
protected Object setSkipRemoteGetsAndInvokeNextForDataCommand(InvocationContext ctx, DataWriteCommand command, CompletionStage<Void> delay) { if (delay != null) { return asyncValue(delay).thenApply(ctx, command, (rCtx, rCommand, rValue) -> invokeNextAndHandle(ctx, command, handleDataWriteReturn)); } return invokeNextAndHandle(ctx, command, handleDataWriteReturn); }

Target:
protected Object setSkipRemoteGetsAndInvokeNextForDataCommand(InvocationContext ctx, DataWriteCommand command, CompletionStage<Void> delay) { return makeStage(asyncInvokeNext(ctx, command, delay)).andHandle(ctx, command, handleDataWriteReturn); }
Source:
public AddQuotaCommand(T parameters) { super(parameters); }

Target:
public AddQuotaCommand(T parameters) { super(parameters); setStoragePoolId(parameters.getStoragePoolId()); }
Source:
private static void openInBrowser(FragmentActivity context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(url)); try { context.startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.cannot_open_url, Toast.LENGTH_SHORT).show(); logger.error(new Exception(String.format("No activity found (browser cannot handle request) for this url: %s, error:\n", url) + e.getMessage()), true); } AnalyticsRegistry analyticsRegistry = environment.getAnalyticsRegistry(); analyticsRegistry.trackBrowserLaunched(url); }

Target:
private static void openInBrowser(FragmentActivity context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(url)); try { context.startActivity(intent); AnalyticsRegistry analyticsRegistry = environment.getAnalyticsRegistry(); analyticsRegistry.trackBrowserLaunched(url); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.cannot_open_url, Toast.LENGTH_SHORT).show(); logger.error(new Exception(String.format("No activity found (browser cannot handle request) for this url: %s, error:\n", url) + e.getMessage()), true); } }
Source:
private static synchronized void init() { if (cacheManager == null) { try { distributed = Boolean.valueOf(HawkularProperties.getProperty(ALERTS_DISTRIBUTED, ALERTS_DISTRIBUTED_ENV, ALERTS_DISTRIBUTED_DEFAULT)); String configPath = System.getProperty(CONFIG_PATH); InputStream is = null; if (configPath != null) { File configFile = new File(configPath, distributed ? ISPN_CONFIG_DISTRIBUTED : ISPN_CONFIG_LOCAL); if (configFile.exists() && configFile.isDirectory()) { is = new FileInputStream(configFile); } } if (is == null) { is = IspnCacheManager.class.getResourceAsStream("/" + (distributed ? ISPN_CONFIG_DISTRIBUTED : ISPN_CONFIG_LOCAL)); } cacheManager = new DefaultCacheManager(is); } catch (IOException e) { log.error(e); } } }

Target:
private static synchronized void init() { if (cacheManager == null) { try { distributed = Boolean.valueOf(HawkularProperties.getProperty(ALERTS_DISTRIBUTED, ALERTS_DISTRIBUTED_ENV, ALERTS_DISTRIBUTED_DEFAULT)); String configFilename = distributed ? ISPN_CONFIG_DISTRIBUTED : ISPN_CONFIG_LOCAL; Path configPath = Paths.get(System.getProperty("jboss.server.config.dir"), "hawkular"); File cacheConfigFile = new File(configPath.toFile(), configFilename); if (cacheConfigFile.exists()) { cacheManager = new DefaultCacheManager(cacheConfigFile.getPath()); } else { cacheManager = new DefaultCacheManager( IspnCacheManager.class.getResourceAsStream("/" + configFilename)); } } catch (IOException e) { log.error(e); } } }
Source:
public void jobStatusChanged(JobInstance job) { JobIdentifier identifier = job.getIdentifier(); if (job.getState().isScheduled()) { consoleActivityMonitor.jobScheduledMap.putIfAbsent(identifier, consoleActivityMonitor.timeProvider.currentTimeMillis()); } else if (job.getState().isActiveOnAgent() || job.isCompleted()) { consoleActivityMonitor.jobScheduledMap.remove(identifier); consoleActivityMonitor.removeHungJobWarning(identifier); } }

Target:
public void jobStatusChanged(JobInstance job) { JobIdentifier identifier = job.getIdentifier(); if (job.getState().isScheduled()) { consoleActivityMonitor.jobScheduledMap.putIfAbsent(identifier, consoleActivityMonitor.timeProvider.currentTimeMillis()); } else if (job.getState().isActiveOnAgent() || job.isCompleted()) { Long timestamp = consoleActivityMonitor.jobScheduledMap.remove(identifier); if (timestamp != null) { consoleActivityMonitor.removeHungJobWarning(identifier); } } }
Source:
public int read() { int data = -1; if (loadData()) { data = currentChunk.get() & 0xFF; bytesAvailable--; } return data; }

Target:
public int read() throws IOException { int data = -1; if (loadData()) { data = currentChunk.get() & 0xFF; bytesAvailable--; } return data; }
Source:
public void push(Run run) { if (enabled) { if (run != null) { Run clone = partialCopy(run); if (clone != null) { applyListeners(clone); if (!runs.containsKey(run.getId())) { runs.put(run.getId(), clone); } } } } else { log.warn("Alerting system disabled."); } }

Target:
public void push(Run run) { if (enabled) { if (run != null) { Run clone = partialCopy(run); if (clone != null) { applyListeners(clone); if (runs.containsKey(run.getId())) { if (clone.getHealth() != null) { log.debug("Not replacing Run " + clone.getId() + ": " + clone.getHealth().name()); } } if (!runs.containsKey(run.getId())) { runs.put(run.getId(), clone); if (clone.getHealth() != null) { log.debug("Queued Run " + clone.getId() + ": " + clone.getHealth().name()); } } } } } else { log.warn("Alerting system disabled."); } }
Source:
public ValidationJob(Object family, Runnable runnable) { super(VALIDATION_JOB_NAME); this.family = family; this.runnable = runnable; }

Target:
public ValidationJob(Object family, Runnable runnable) { super(VALIDATION_JOB_NAME); Preconditions.checkNotNull(family); Preconditions.checkNotNull(runnable); this.family = family; this.runnable = runnable; }
Source:
public void setLockDuration(Duration lockDuration) { if (lockDuration == null) { throw new IllegalArgumentException("Value cannot be null."); } this.lockDuration = lockDuration; if (this.lockDuration.compareTo(ManagementClientConstants.MAX_DURATION) > 0) { this.lockDuration = ManagementClientConstants.MAX_DURATION; } }

Target:
public void setLockDuration(Duration lockDuration) { Objects.requireNonNull(lockDuration, "'lockDuration' cannot be null."); this.lockDuration = lockDuration; if (this.lockDuration.compareTo(ManagementClientConstants.MAX_DURATION) > 0) { this.lockDuration = ManagementClientConstants.MAX_DURATION; } }
Source:
private static String learnedConstraintMessage(Constraint lc, ExplodedGraph.Node currentNode, ExplodedGraph.Node parent) { Tree nodeTree = parent.programPoint.syntaxTree(); String name = SyntaxTreeNameFinder.getName(nodeTree); if (nodeTree.is(Tree.Kind.METHOD_INVOCATION)) { List<MethodYield> usedMethodYields = currentNode.usedMethodYields(parent); if (!usedMethodYields.isEmpty()) { Type exceptionType = usedMethodYields.get(0).exceptionType(); if (exceptionType != null) { return exceptionType.isUnknown() ? String.format("Exception thrown by '%s'", name) : String.format("Exception '%s' thrown by '%s'", exceptionType.name(), name); } } return String.format("'%s' returns %s", name, lc.valueAsString()); } if (nodeTree.is(Tree.Kind.NEW_CLASS)) { return String.format("Constructor call creates '%s'", lc.valueAsString()); } return name == null ? lc.valueAsString() : String.format("Implies '%s' is %s", name, lc.valueAsString()); }

Target:
private static String learnedConstraintMessage(Constraint lc, ExplodedGraph.Node currentNode, ExplodedGraph.Node parent) { Tree nodeTree = parent.programPoint.syntaxTree(); String name = SyntaxTreeNameFinder.getName(nodeTree); if (nodeTree.is(Tree.Kind.METHOD_INVOCATION)) { MethodYield selectedMethodYield = currentNode.selectedMethodYield(parent); if (selectedMethodYield != null) { Type exceptionType = selectedMethodYield.exceptionType(); if (exceptionType != null) { return exceptionType.isUnknown() ? String.format("Exception thrown by '%s'", name) : String.format("Exception '%s' thrown by '%s'", exceptionType.name(), name); } } return String.format("'%s' returns %s", name, lc.valueAsString()); } if (nodeTree.is(Tree.Kind.NEW_CLASS)) { return String.format("Constructor call creates '%s'", lc.valueAsString()); } return name == null ? lc.valueAsString() : String.format("Implies '%s' is %s", name, lc.valueAsString()); }
Source:
public Collection<Map.Entry<K, V>> scanAndFilterByEntry( Predicate<? super Map.Entry<K, V>> entryPredicate) { return mainMap.entryStream().parallel() .filter(entryPredicate) .collect(Collectors.toCollection(ArrayList::new)); }

Target:
public Collection<Map.Entry<K, V>> scanAndFilterByEntry( Predicate<? super Map.Entry<K, V>> entryPredicate) { return mainMap.entryStream() .filter(entryPredicate) .collect(Collectors.toCollection(ArrayList::new)); }
Source:
public org.ovirt.engine.api.model.Cluster update(org.ovirt.engine.api.model.Cluster incoming) { return performUpdate(incoming, new QueryIdResolver<>(VdcQueryType.GetClusterById, IdQueryParameters.class), VdcActionType.UpdateCluster, new UpdateParametersProvider(this)); }

Target:
public org.ovirt.engine.api.model.Cluster update(org.ovirt.engine.api.model.Cluster incoming) { return performUpdate(incoming, new QueryIdResolver<>(VdcQueryType.GetClusterById, IdQueryParameters.class), ActionType.UpdateCluster, new UpdateParametersProvider(this)); }
Source:
protected void addAnnotation(AnnotationProxy annotation) { if (map == null) { return; } TiMarker tiMarker = annotation.getTiMarker(); if (tiMarker != null) { timarkers.remove(tiMarker); tiMarker.getMarker().remove(); } if (map != null) { annotation.processOptions(); if (annotation.getProperty(MapModule.PROPERTY_CLUSTER_IDENTIFIER) == null) { Marker marker = mMarkerManager.getCollection(DEFAULT_COLLECTION_ID).addMarker(annotation.getMarkerOptions()); tiMarker = new TiMarker(marker, annotation); } else { tiMarker = new TiMarker(null, annotation); if (mClusterManager != null) { mClusterManager.addItem((TiMarker)tiMarker); } mClusterManager.cluster(); } annotation.setTiMarker(tiMarker); timarkers.add(tiMarker); } }

Target:
protected void addAnnotation(AnnotationProxy annotation) { if (map == null) { return; } TiMarker tiMarker = annotation.getTiMarker(); if (tiMarker != null) { timarkers.remove(tiMarker); tiMarker.getMarker().remove(); } if (map != null) { annotation.processOptions(); if (annotation.getProperty(MapModule.PROPERTY_CLUSTER_IDENTIFIER) == null) { Marker marker = mMarkerManager.getCollection(DEFAULT_COLLECTION_ID).addMarker(annotation.getMarkerOptions()); tiMarker = new TiMarker(marker, annotation); } else { tiMarker = new TiMarker(null, annotation); if (mClusterManager != null) { mClusterManager.addItem((TiMarker)tiMarker); mClusterManager.cluster(); } } annotation.setTiMarker(tiMarker); timarkers.add(tiMarker); } }
Source:
public static BuySell parseBuySell(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "BUY": case "B": return BuySell.BUY; case "SELL": case "S": return BuySell.SELL; default: throw new IllegalArgumentException("Unknown BuySell value, must 'Buy' or 'Sell' but was '" + str + "'"); } }

Target:
public static BuySell parseBuySell(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "BUY": case "B": return BuySell.BUY; case "SELL": case "S": return BuySell.SELL; default: throw new IllegalArgumentException( "Unknown BuySell value, must be 'Buy' or 'Sell' but was '" + str + "'; " + "parser is case insensitive and also accepts 'B' and 'S'"); } }
Source:
public void iterateByPageSnippet() { PagedFlux<Integer> pagedFlux = createAnInstance(); PagedIterable<Integer> pagedIterableResponse = new PagedIterable<>(pagedFlux); pagedIterableResponse.iterableByPage().forEach(resp -> { if (resp.statusCode() == HttpURLConnection.HTTP_OK) { System.out.printf("Response headers are %s. Url %s \n", resp.headers(), resp.request().url()); resp.items().forEach(value -> { System.out.printf("Response value is %d \n", value); }); } else { System.out.printf("Failed with status is %d and url is %s \n", resp.statusCode(), resp.request().url()); } }); END: com.azure.core.http.rest.pagedIterable.iterableByPage }

Target:
public void iterateByPageSnippet() { PagedFlux<Integer> pagedFlux = createAnInstance(); PagedIterable<Integer> pagedIterableResponse = new PagedIterable<>(pagedFlux); pagedIterableResponse.iterableByPage().forEach(resp -> { System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), resp.request().url(), resp.statusCode()); resp.items().forEach(value -> { System.out.printf("Response value is %d %n", value); }); }); END: com.azure.core.http.rest.pagedIterable.iterableByPage }
Source:
public void setFilters(@NonNull ViewerFilter[] filters) { fFilters.clear(); if (filters != null) { fFilters.addAll(Arrays.asList(filters)); } }

Target:
public void setFilters(@NonNull ViewerFilter[] filters) { fFilters.clear(); if (filters != null) { List<@NonNull ViewerFilter> filtersList = Arrays.asList(filters); fFilters.addAll(filtersList); fireFiltersAdded(filtersList); } }