auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( "android.permission.SEND_SMS", "Sending SMS message"); if (Log.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + sentIntent + " deliveryIntent=" + deliveryIntent); } Intent broadcastIntent = new Intent(Intent.ACTION_NEW_OUTGOING_SMS); broadcastIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, destAddr); broadcastIntent.putExtra(EXTRA_SC_ADDRESS, scAddr); broadcastIntent.putExtra(EXTRA_TEXT, text); broadcastIntent.putExtra(EXTRA_SENT_INTENT, sentIntent); broadcastIntent.putExtra(EXTRA_DELIVERY_INTENT, deliveryIntent); <START> mContext.sendOrderedBroadcast(broadcastIntent, PERMISSION, <END> new OutgoingSmsReceiver(), null, Activity.RESULT_OK, destAddr, null); }</code><technical_language>this is modeled incoming call interception... which, honestly, I hate. is control apps, visibility for user is on. This is of reasons this kind of functionality introduced yet, opening a floodgate of apps stomping other in a random order a broadcast leave in a bad mess. media keys, yucky stuff outgoing call stuff, do more. I starting kinds of facilities deserve some visibility in settings app, user apps for feature, control order</technical_language>

Target:
public void sendText(String destAddr, String scAddr, String text, PendingIntent sentIntent, PendingIntent deliveryIntent) { mPhone.getContext().enforceCallingPermission( "android.permission.SEND_SMS", "Sending SMS message"); if (Log.isLoggable("SMS", Log.VERBOSE)) { log("sendText: destAddr=" + destAddr + " scAddr=" + scAddr + " text='"+ text + "' sentIntent=" + sentIntent + " deliveryIntent=" + deliveryIntent); } Intent broadcastIntent = new Intent(SmsManager.ACTION_NEW_OUTGOING_SMS); broadcastIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, destAddr); broadcastIntent.putExtra(EXTRA_SC_ADDRESS, scAddr); broadcastIntent.putExtra(SmsManager.EXTRA_TEXT, text); broadcastIntent.putExtra(EXTRA_SENT_INTENT, sentIntent); broadcastIntent.putExtra(EXTRA_DELIVERY_INTENT, deliveryIntent); mContext.sendOrderedBroadcast(broadcastIntent, PERMISSION, new OutgoingSmsReceiver(), null, Activity.RESULT_OK, destAddr, null); }
Source:
<code>public CodeVisitor[] checkClasses() { List<CodeVisitor> visitors = Lists.newArrayList(); <START> for (JavaIssueFilter issueFilter : issueFilters) { <END> visitors.add(issueFilter); } for (Checks<JavaCheck> checksElement : checks) { Collection<JavaCheck> checksCollection = checksElement.all(); if (!checksCollection.isEmpty()) { visitors.addAll(checksCollection); } } return visitors.toArray(new CodeVisitor[visitors.size()]); }</code><technical_language>addAll</technical_language>

Target:
public CodeVisitor[] checkClasses() { List<CodeVisitor> visitors = Lists.newArrayList(); for (Checks<JavaCheck> checksElement : checks) { Collection<JavaCheck> checksCollection = checksElement.all(); if (!checksCollection.isEmpty()) { visitors.addAll(checksCollection); } } return visitors.toArray(new CodeVisitor[visitors.size()]); }
Source:
<code>private void cleanSweepableCells(ShardAndStrategy shardStrategy, long oldProgress, long newProgress) { if (firstIterationOfSweep(oldProgress)) { return; } long lastSweptPartitionPreviously = SweepQueueUtils.tsPartitionFine(oldProgress); long minimumSweepPartitionNextIteration = SweepQueueUtils.tsPartitionFine(newProgress + 1); if (minimumSweepPartitionNextIteration > lastSweptPartitionPreviously) { cleanDedicatedRows(shardStrategy, lastSweptPartitionPreviously); cleanNonDedicatedRow(shardStrategy, lastSweptPartitionPreviously); log.info("Deleted persisted sweep queue information in table SweepableCells for partition {}.", <START> lastSweptPartitionPreviously); <END> } }</code><technical_language>need LoggingArgs right</technical_language>

Target:
private void cleanSweepableCells(ShardAndStrategy shardStrategy, long oldProgress, long newProgress) { if (firstIterationOfSweep(oldProgress)) { return; } long lastSweptPartitionPreviously = SweepQueueUtils.tsPartitionFine(oldProgress); long minimumSweepPartitionNextIteration = SweepQueueUtils.tsPartitionFine(newProgress + 1); if (minimumSweepPartitionNextIteration > lastSweptPartitionPreviously) { cleanDedicatedRows(shardStrategy, lastSweptPartitionPreviously); cleanNonDedicatedRow(shardStrategy, lastSweptPartitionPreviously); log.info("Deleted persisted sweep queue information in table for partition {}.", LoggingArgs.tableRef(TargetedSweepTableFactory.of().getSweepableCellsTable(null).getTableRef()), SafeArg.of("partition", lastSweptPartitionPreviously)); } }
Source:
<code>public Integer getNumberOfLocalConnections() { <START> return Integer.valueOf(acceptedChannels.size()); <END> }</code><technical_language>Unnecessary boxing</technical_language>

Target:
public Integer getNumberOfLocalConnections() { return acceptedChannels.size(); }
Source:
<code>public void executeSystemStatement(String sql) throws IgniteCheckedException { Statement stmt = null; try { stmt = sysConn.createStatement(); stmt.executeUpdate(sql); } catch (SQLException e) { U.close(sysConn, log); <START> IgniteSQLException ex = new IgniteSQLException("Failed to execute system statement: " + sql, e); <END> throw new IgniteCheckedException("Failed to execute system statement: " + sql, e); } finally { U.close(stmt, log); } }</code><technical_language>ex is</technical_language>

Target:
public void executeSystemStatement(String sql) throws IgniteCheckedException { Statement stmt = null; try { stmt = sysConn.createStatement(); stmt.executeUpdate(sql); } catch (SQLException e) { U.close(sysConn, log); throw new IgniteCheckedException("Failed to execute system statement: " + sql, e); } finally { U.close(stmt, log); } }
Source:
<code>private void thin(File sourceFatJar) throws ZipException, IOException, NoSuchAlgorithmException { File targetThinJar = new File(outputDirectory, "thin-" + sourceFatJar.getName()); File libIndexCache = new File(outputDirectory, "lib.index.cache"); <START> getLog().info("Thinning " + getArtifactExtension() + ": " + targetThinJar.getAbsolutePath()); <END> getLog().info("Lib index cache: " + libIndexCache.getAbsolutePath()); SpringBootThinUtil thinUtil = new SpringBootThinUtil(sourceFatJar, targetThinJar, libIndexCache, null); thinUtil.execute(); }</code><technical_language>I reference log variable calling getLog() time</technical_language>

Target:
private void thin(File sourceFatJar) throws ZipException, IOException, NoSuchAlgorithmException, SpringBootThinException { File targetThinJar = new File(outputDirectory, "thin-" + sourceFatJar.getName()); File libIndexCache = new File(outputDirectory, "lib.index.cache"); getLog().info("Thinning " + getArtifactExtension() + ": " + targetThinJar.getAbsolutePath()); getLog().info("Lib index cache: " + libIndexCache.getAbsolutePath()); SpringBootThinUtil thinUtil = new SpringBootThinUtil(sourceFatJar, targetThinJar, libIndexCache, null); thinUtil.execute(); }
Source:
<code>public void sendLastNEndpointsChangeEvent( Collection<String> forwardedEndpoints, Collection<String> endpointsEnteringLastN, Collection<String> conferenceEndpoints) { if (endpointsEnteringLastN == null) { endpointsEnteringLastN = forwardedEndpoints; } String msg = createLastNEndpointsChangeEvent( forwardedEndpoints, endpointsEnteringLastN, conferenceEndpoints); sendMessage(msg); <START> notifyForwardedEndpointsChanged(forwardedEndpoints, endpointsEnteringLastN, conferenceEndpoints); <END> }</code><technical_language>Hm, wondering if this feels a bit weird this call _outside_ endpoint. If anything, this instead BitrateController source of truth (like in other PR)</technical_language>

Target:
private void sendLastNEndpointsChangeEvent( Collection<String> forwardedEndpoints, Collection<String> endpointsEnteringLastN, Collection<String> conferenceEndpoints) { if (endpointsEnteringLastN == null) { endpointsEnteringLastN = forwardedEndpoints; } String msg = createLastNEndpointsChangeEvent( forwardedEndpoints, endpointsEnteringLastN, conferenceEndpoints); sendMessage(msg); }
Source:
<code>public void setUp() throws IOException { existingTempFile = File.createTempFile("FiletypeTest.", ".tmp"); existingTempFile.deleteOnExit(); systemTempDir = System.getProperty("java.io.tmpdir"); final File tmpDir = new File(systemTempDir); inMemoryFileSystem = Jimfs.newFileSystem(Configuration.unix());; if (!tmpDir.isDirectory()) tmpDir.mkdir(); if (!tmpDir.isDirectory()) throw new RuntimeException("java.io.tmpdir (" + systemTempDir + ") is not a directory"); systemUser = System.getProperty("user.name"); WORDS_LONG = Files.createTempFile("words_long", ".txt"); WORDS_LONG.toFile().deleteOnExit(); <START> List<String> wordsList = new ArrayList<String>(); <END> try (Stream<String> dictStream = Files.lines(TEST_DATA_DIR.resolve("dictionary_english_short.dic"))) { wordsList = dictStream.collect(Collectors.toList()); } final int numberOfWords = 300000; final int seed = 345987345; final Random rand = new Random(seed); try (final BufferedWriter writer = Files.newBufferedWriter(WORDS_LONG)) { for (int i = 0; i < numberOfWords; i++) { writer.write(wordsList.get(rand.nextInt(wordsList.size()))); } } }</code><technical_language>final</technical_language>

Target:
public void setUp() throws IOException { existingTempFile = File.createTempFile("FiletypeTest.", ".tmp"); existingTempFile.deleteOnExit(); systemTempDir = System.getProperty("java.io.tmpdir"); final File tmpDir = new File(systemTempDir); inMemoryFileSystem = Jimfs.newFileSystem(Configuration.unix());; if (!tmpDir.isDirectory()) tmpDir.mkdir(); if (!tmpDir.isDirectory()) throw new RuntimeException("java.io.tmpdir (" + systemTempDir + ") is not a directory"); systemUser = System.getProperty("user.name"); WORDS_LONG = Files.createTempFile("words_long", ".txt"); WORDS_LONG.toFile().deleteOnExit(); final List<String> wordsList = Files.lines(TEST_DATA_DIR.resolve("dictionary_english_short.dic")).collect(Collectors.toList()); final int numberOfWords = 300000; final int seed = 345987345; final Random rand = new Random(seed); try (final BufferedWriter writer = Files.newBufferedWriter(WORDS_LONG)) { for (int i = 0; i < numberOfWords; i++) { writer.write(wordsList.get(rand.nextInt(wordsList.size()))); } } }
Source:
<code>public void fqn_by_package_with_subpackage() { assertThat(SymbolUtils.fullyQualifiedModuleName("", "foo.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "__init__.py")).isEqualTo("foo"); <START> assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo.py")).isEqualTo("foo"); <END> assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("curses.ascii", "ascii.py")).isEqualTo("curses.ascii"); assertThat(SymbolUtils.fullyQualifiedModuleName("curses", "ascii.py")).isEqualTo("curses.ascii"); }</code><technical_language>I in this case foo.foo</technical_language>

Target:
public void fqn_by_package_with_subpackage() { assertThat(SymbolUtils.fullyQualifiedModuleName("", "foo.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "__init__.py")).isEqualTo("foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo.py")).isEqualTo("foo.foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("foo", "foo")).isEqualTo("foo.foo"); assertThat(SymbolUtils.fullyQualifiedModuleName("curses", "ascii.py")).isEqualTo("curses.ascii"); }
Source:
<code>public void testExecuteOnNull() { Object obj = mock(Object.class); CommandManager manager = mock(CommandManager.class); when(registryFactory.newCommandRegistry()).thenReturn(commandRegistry); when(commandRegistry.isEmpty()).thenReturn(true); CommandResult expectedResult = mock(CommandResult.class); when(commandRegistry.peek()).thenReturn(command1); when(manager.execute(obj, command1)).thenReturn(expectedResult); tested = new RedoCommandHandler(registryFactory); <START> assertEquals(null, <END> tested.execute(obj, manager)); }</code><technical_language>assertNull(object)</technical_language>

Target:
public void testExecuteOnNull() { Object obj = mock(Object.class); CommandManager manager = mock(CommandManager.class); when(registryFactory.newCommandRegistry()).thenReturn(commandRegistry); when(commandRegistry.isEmpty()).thenReturn(true); tested = new RedoCommandHandler(registryFactory); tested.execute(obj, manager); }
Source:
<code>public void provision( InternalEnvironment environment, OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { final String workspaceId = identity.getWorkspaceId(); <START> final Map<String, Pod> pods = new HashMap<>(osEnv.getPods()); <END> osEnv.getPods().clear(); for (Pod pod : pods.values()) { final ObjectMeta podMeta = pod.getMetadata(); podMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, podMeta.getName()); final String podName = workspaceId + SEPARATOR + podMeta.getName(); podMeta.setName(podName); osEnv.getPods().put(podName, pod); } final Map<String, Route> routes = new HashMap<>(osEnv.getRoutes()); osEnv.getRoutes().clear(); for (Route route : routes.values()) { final ObjectMeta routeMeta = route.getMetadata(); routeMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, routeMeta.getName()); final String routeName = NameGenerator.generate(ROUTE_PREFIX, ROUTE_SUFFIX_SIZE); routeMeta.setName(routeName); osEnv.getRoutes().put(routeName, route); } }</code><technical_language>keys of map</technical_language>

Target:
public void provision( InternalEnvironment environment, OpenShiftEnvironment osEnv, RuntimeIdentity identity) throws InfrastructureException { final String workspaceId = identity.getWorkspaceId(); final Set<Pod> pods = new HashSet<>(osEnv.getPods().values()); osEnv.getPods().clear(); for (Pod pod : pods) { final ObjectMeta podMeta = pod.getMetadata(); podMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, podMeta.getName()); final String podName = workspaceId + SEPARATOR + podMeta.getName(); podMeta.setName(podName); osEnv.getPods().put(podName, pod); } final Set<Route> routes = new HashSet<>(osEnv.getRoutes().values()); osEnv.getRoutes().clear(); for (Route route : routes) { final ObjectMeta routeMeta = route.getMetadata(); routeMeta.getLabels().put(CHE_ORIGINAL_NAME_LABEL, routeMeta.getName()); final String routeName = NameGenerator.generate(ROUTE_PREFIX, ROUTE_SUFFIX_SIZE); routeMeta.setName(routeName); osEnv.getRoutes().put(routeName, route); } }
Source:
<code>ChoicesDisplayDialog(Listener listener, Context context, int listId, ListInfo listInfo, ChoosingSettings settings) { this.listId = listId; this.settings = settings; dialog = new MaterialDialog.Builder(context) .title(R.string.name_chosen) <START> .customView(R.layout.name_choices_dialog, false) <END> .positiveText(android.R.string.yes) .negativeText(R.string.copy_text) .neutralText(R.string.say_name) .onPositive((dialog, which) -> dialog.dismiss()) .onNegative((dialog, which) -> listener.copyNamesToClipboard( NameUtils.flattenListToString(chosenNames, settings), chosenNames.size())) .onNeutral((dialog, which) -> listener.sayNames( NameUtils.flattenListToString(chosenNames, settings))) .autoDismiss(false) .build(); choicesDisplayViewHolder = new ChoicesDisplayViewHolder(dialog.getView(), listInfo); }</code><technical_language>Instead of custom view, I MaterialDialog's .adapter() API. dialog provide RecyclerView for :)</technical_language>

Target:
ChoicesDisplayDialog(Listener listener, Context context, int listId, ListInfo listInfo, ChoosingSettings settings) { this.listId = listId; this.settings = settings; chooseNameDialogAdapter = new ChooseNameDialogAdapter(new ArrayList<>(), listInfo); dialog = new MaterialDialog.Builder(context) .title(R.string.name_chosen) .adapter(chooseNameDialogAdapter, new LinearLayoutManager(context)) .positiveText(android.R.string.yes) .negativeText(R.string.copy_text) .neutralText(R.string.say_name) .onPositive((dialog, which) -> dialog.dismiss()) .onNegative((dialog, which) -> listener.copyNamesToClipboard( NameUtils.flattenListToString(chosenNames, settings), chosenNames.size())) .onNeutral((dialog, which) -> listener.sayNames( NameUtils.flattenListToString(chosenNames, settings))) .autoDismiss(false) .build(); }
Source:
<code>public void testNewReservedWordsWarning() { String query = "SELECT CALLED, t.called FROM (VALUES (3)) t(called)"; <START> Session session = testSessionBuilder() <END> .setCatalog("tpch") .setSchema("tiny") .build(); assertWarnings(queryRunner, session, query, ImmutableList.of(PARSER_WARNING.toWarningCode())); }</code><technical_language>TEST_SESSION</technical_language>

Target:
public void testNewReservedWordsWarning() { String query = "SELECT CALLED, t.called FROM (VALUES (3)) t(called)"; assertWarnings(queryRunner, TEST_SESSION, query, ImmutableList.of(PARSER_WARNING.toWarningCode())); }
Source:
<code>private ImmutableList<Symbol> pruneMarkDistinctSymbols(MarkDistinctNode node, List<LocalProperty<Symbol>> localProperties) { <START> ImmutableSet.Builder redundantSymbolsBuilder = ImmutableSet.builder(); <END> for (LocalProperty<Symbol> property : localProperties) { if (property instanceof ConstantProperty) { redundantSymbolsBuilder.add(((ConstantProperty<Symbol>) property).getColumn()); } else if (!node.getDistinctSymbols().containsAll(property.getColumns())) { break; } } ImmutableSet redundantSymbols = redundantSymbolsBuilder.build(); return node.getDistinctSymbols().stream() .filter(symbol -> !redundantSymbols.contains(symbol)) .collect(toImmutableList()); }</code><technical_language>please add <Symbol> generics: ImmutableSet.Builder<Symbo> redundantSymbolsBuilder</technical_language>

Target:
private List<Symbol> pruneMarkDistinctSymbols(MarkDistinctNode node, List<LocalProperty<Symbol>> localProperties) { if (localProperties.isEmpty()) { return node.getDistinctSymbols(); } ImmutableSet.Builder<Symbol> redundantSymbolsBuilder = ImmutableSet.builder(); for (LocalProperty<Symbol> property : localProperties) { if (property instanceof ConstantProperty) { redundantSymbolsBuilder.add(((ConstantProperty<Symbol>) property).getColumn()); } else if (!node.getDistinctSymbols().containsAll(property.getColumns())) { break; } } Set<Symbol> redundantSymbols = redundantSymbolsBuilder.build(); List<Symbol> remainingSymbols = node.getDistinctSymbols().stream() .filter(symbol -> !redundantSymbols.contains(symbol)) .collect(toImmutableList()); if (remainingSymbols.isEmpty()) { return ImmutableList.of(node.getDistinctSymbols().get(0)); } return remainingSymbols; }
Source:
<code>protected Set<Set<String>> collectCommonModeSets(Object[] selection) { HashSet<ILaunchDelegate> delegates = new HashSet<>(); Object o = null; for(int i = 0; i < selection.length; i++) { o = selection[i]; if(o instanceof ILaunchDelegate) { delegates.add((ILaunchDelegate) o); } else if(o instanceof ILaunchConfigurationType) { fgCurrentWorkingContext.add(o); Object[] kids = fTreeViewer.getFilteredChildren(o); for (Object kid : kids) { delegates.add((ILaunchDelegate) <START> kids[i]); <END> } } } HashSet<Set<String>> common = new HashSet<>(); List<Set<String>> modes = null; HashSet<Set<String>> pruned = new HashSet<>(); for (ILaunchDelegate delegate : delegates) { modes = delegate.getModes(); for (Set<String> fmodes : modes) { if (isCommonModeset(fmodes, delegates, pruned)) { common.add(fmodes); fgCurrentWorkingContext.add(delegate); } } } return common; }</code><technical_language>fishy. Please open a bug this situation separately</technical_language>

Target:
protected Set<Set<String>> collectCommonModeSets(Object[] selection) { HashSet<ILaunchDelegate> delegates = new HashSet<>(); Object o = null; for(int i = 0; i < selection.length; i++) { o = selection[i]; if(o instanceof ILaunchDelegate) { delegates.add((ILaunchDelegate) o); } else if(o instanceof ILaunchConfigurationType) { fgCurrentWorkingContext.add(o); Object[] kids = fTreeViewer.getFilteredChildren(o); for (int j = 0; j < kids.length; j++) { delegates.add((ILaunchDelegate) kids[i]); } } } HashSet<Set<String>> common = new HashSet<>(); List<Set<String>> modes = null; HashSet<Set<String>> pruned = new HashSet<>(); for (ILaunchDelegate delegate : delegates) { modes = delegate.getModes(); for (Set<String> fmodes : modes) { if (isCommonModeset(fmodes, delegates, pruned)) { common.add(fmodes); fgCurrentWorkingContext.add(delegate); } } } return common; }
Source:
<code>public void test_arrayOfType() throws ClassNotFoundException { assertThat((Class) Predefined.arrayTypeOf(Object.class), sameInstance((Class) Object[].class)); assertThat((Class) Predefined.arrayTypeOf(byte.class), sameInstance((Class) byte[].class)); try { Predefined.arrayTypeOf(new Object()); Assert.fail(); } catch (Throwable t) { <START> assertThat((Class) t.getClass(), sameInstance((Class) AssertionError.class)); <END> } assertThat((Class) Predefined.objectArrayType(), sameInstance((Class) Object[].class)); }</code><technical_language>Assert.fail() raise AssertionError</technical_language>

Target:
public void test_arrayOfType() throws ClassNotFoundException { assertThat((Class) Predefined.arrayTypeOf(Object.class), sameInstance((Class) Object[].class)); assertThat((Class) Predefined.arrayTypeOf(byte.class), sameInstance((Class) byte[].class)); try { Predefined.arrayTypeOf(new Object()); throw new RuntimeException("set a wrong parameter to arrayTypeOf should raise an AssertionError"); } catch (AssertionError ae) { } assertThat((Class) Predefined.objectArrayType(), sameInstance((Class) Object[].class)); }
Source:
<code>public void setUp() throws Exception { super.setUp(); mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); PackageManager packageManager = mContext.getPackageManager(); mHasWifi = packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI); mHasTelephony = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); mBuilder = new JobInfo.Builder(CONNECTIVITY_JOB_ID, kJobServiceComponent); if(!mHasWifi) { return; } mInitialWiFiState = mWifiManager.isWifiEnabled(); <START> mInitialRestrictBackground = SystemUtil .runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_GET_CMD) .contains("enabled"); <END> }</code><technical_language>this code run if mHasWifi is false</technical_language>

Target:
public void setUp() throws Exception { super.setUp(); mWifiManager = (WifiManager) getContext().getSystemService(Context.WIFI_SERVICE); mCm = (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE); PackageManager packageManager = mContext.getPackageManager(); mHasWifi = packageManager.hasSystemFeature(PackageManager.FEATURE_WIFI); mHasTelephony = packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY); mBuilder = new JobInfo.Builder(CONNECTIVITY_JOB_ID, kJobServiceComponent); mInitialRestrictBackground = SystemUtil .runShellCommand(getInstrumentation(), RESTRICT_BACKGROUND_GET_CMD) .contains("enabled"); if(!mHasWifi) { return; } mInitialWiFiState = mWifiManager.isWifiEnabled(); }
Source:
<code>public void setTags(Set<String> tags) { if (tags == null || tags.isEmpty()) return; JSONArray tagArray = new JSONArray(); try { int index = 0; for (String tag : tags) tagArray.put(index++, tag); schema.put(FIELD_SCHEMA_TAGS, tagArray); } catch (JSONException e) { <START> Preconditions.checkState(false, e.getMessage()); <END> } schemaJSON = schema.toString(); }</code><technical_language>Rethrow exception stack trace printed throw new RuntimeException(e);</technical_language>

Target:
public void setTags(Set<String> tags) { if (tags == null || tags.isEmpty()) throw new IllegalArgumentException("tags can't be null or empty."); try { JSONArray tagArray = new JSONArray(tags); schema.put(FIELD_SCHEMA_TAGS, tagArray); } catch (JSONException e) { Preconditions.checkState(false, e.getMessage()); throw new RuntimeException(e); } schemaJSON = schema.toString(); }
Source:
<code>public PodTemplate getTemplate() { if (template == null) { <START> template = getKubernetesCloud().getTemplate(getPodTemplateName()); <END> if (template == null) { throw new IllegalStateException("Not expecting pod template to be null at this point"); } } return template; }</code><technical_language>suggestion template = getKubernetesCloud().getTemplateByName(getPodTemplateName());</technical_language>

Target:
public PodTemplate getTemplate() { if (template == null) { template = getKubernetesCloud().getTemplateByName(getPodTemplateName()); if (template == null) { throw new IllegalStateException("Not expecting pod template to be null at this point"); } } return template; }
Source:
<code>public void buildExport(OutputStream os) throws IOException { try (Writer writer = new BufferedWriter(new OutputStreamWriter(os))) { <START> writer.write("{\"types\":[\n"); <END> int offset = 0; boolean hasMore = true; boolean first = true; while (hasMore) { List<ResourceType> batch = qResourceType.from(ResourceType.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (ResourceType rt : batch) { if (!first) { writer.write(",\n"); } else { first = false; } writer.write(JsonUtil.toJson(rt) + "\n"); } hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } writer.write("],\"resources\":[\n"); hasMore = true; first = true; offset = 0; while (hasMore) { List<Resource> batch = qResource.from(Resource.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (Resource r : batch) { if (!first) { writer.write(",\n"); } else { first = false; } writer.write(JsonUtil.toJson(r) + "\n"); } hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } writer.write("]}\n"); writer.flush(); } }</code><technical_language>I jackson offers some streaming cappabilities, honestly I tested yet, I read API examples. is worth a investigate this together. I remember in alerting format a json se, chunks of jsons, this case rely a library output is a fully json object</technical_language>

Target:
public void buildExport(OutputStream os) throws IOException { JsonGenerator jsonGen = JsonUtil.createJsonGenerator(os); jsonGen.writeStartObject(); jsonGen.writeFieldName("types"); jsonGen.writeStartArray(); int offset = 0; boolean hasMore = true; while (hasMore) { List<ResourceType> batch = qResourceType.from(ResourceType.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (ResourceType rt : batch) { jsonGen.writeObject(rt); } jsonGen.flush(); hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } jsonGen.writeEndArray(); jsonGen.writeFieldName("resources"); jsonGen.writeStartArray(); hasMore = true; offset = 0; while (hasMore) { List<Resource> batch = qResource.from(Resource.class) .maxResults(MAX_RESULTS) .startOffset(offset) .build() .list(); for (Resource r : batch) { jsonGen.writeObject(r); } jsonGen.flush(); hasMore = batch.size() == MAX_RESULTS; offset += MAX_RESULTS; } jsonGen.writeEndArray(); jsonGen.writeEndObject(); jsonGen.flush(); }
Source:
<code>public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException { int txInfo = getXAResourceState(_theXAResource); XAException toThrow = null; if ((txInfo != TxInfo.NOT_ASSOCIATED) && (txInfo != TxInfo.FAILED)) { try { doEnd(_tranID, _theXAResource, xaState, txInfoState); } catch (XAException e) { if (toThrow == null) { toThrow = e; } else { _theTransaction.getDeferredThrowables().add(e); } } } for (Object resource : _duplicateResources.keySet()) { XAResource dupXar = (XAResource) resource; if (_theXAResource.isSameRM(dupXar)) { <START> try { <END> doEnd(_tranID, dupXar, xaState, txInfoState); } catch (XAException e) { if (e.errorCode != XAException.XAER_PROTO || STRICTJTA12DUPLICATEXAENDPROTOERR) { if (toThrow == null) { toThrow = e; } else { _theTransaction.getDeferredThrowables().add(e); } } } } } if (toThrow != null) { throw toThrow; } }</code><technical_language>initial if (toThrow == null) duplicate resource line 1042 true (I missed this previous review). is harmless messy</technical_language>

Target:
public void endAssociation(Xid _tranID, XAResource _theXAResource, int xaState, int txInfoState) throws XAException { int txInfo = getXAResourceState(_theXAResource); XAException toThrow = null; if ((txInfo != TxInfo.NOT_ASSOCIATED) && (txInfo != TxInfo.FAILED)) { try { doEnd(_tranID, _theXAResource, xaState, txInfoState); } catch (XAException e) { toThrow = e; } } for (Object resource : _duplicateResources.keySet()) { XAResource dupXar = (XAResource) resource; if (_theXAResource.isSameRM(dupXar)) { try { doEnd(_tranID, dupXar, xaState, txInfoState); } catch (XAException e) { if (e.errorCode != XAException.XAER_PROTO || STRICTJTA12DUPLICATEXAENDPROTOERR) { if (toThrow == null) { toThrow = e; } else { _theTransaction.getDeferredThrowables().add(e); } } } } } if (toThrow != null) { throw toThrow; } }
Source:
<code>public DimLookup sort() { <START> return new NullValueConverterDimLookup(delegate.sort()); <END> }</code><technical_language>i is nice preserve behavior nulls returned empty strings in general in Druid, nulls empty strings treated</technical_language>

Target:
public SortedDimLookup sort() { return new NullValueConverterDimLookup(delegate.sort()); }
Source:
<code>protected void executeCommand() { Set<Guid> volumes = getVolumeChain(); List<Guid> failedGuids = LinqUtils.filter(volumes, new Predicate<Guid>() { @Override public boolean eval(Guid guid) { for (Guid guidToDelete : <START> getParameters().getImageList()) { <END> if (guid.equals(guidToDelete)) { return true; } } return false; } }); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setSucceeded(true); persistCommand(getParameters().getParentCommand()); setCommandStatus(CommandStatus.SUCCEEDED); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } }</code><technical_language>validate 'getParameters().getImageList()' first</technical_language>

Target:
protected void executeCommand() { Set<Guid> volumes = getVolumeChain(); List<Guid> failedGuids = LinqUtils.filter(volumes, new Predicate<Guid>() { @Override public boolean eval(Guid guid) { if (getParameters().getImageList() != null) { for (Guid guidToDelete : getParameters().getImageList()) { if (guid.equals(guidToDelete)) { return true; } } } return false; } }); if (failedGuids.isEmpty()) { log.info("Requested images were successfully removed"); setSucceeded(true); persistCommand(getParameters().getParentCommand()); setCommandStatus(CommandStatus.SUCCEEDED); } else { log.error("The following images were not removed: {}", failedGuids); setCommandStatus(CommandStatus.FAILED); } }
Source:
<code>public void testConvertSecondsToMinutes() { long seconds = 1800L; Pair<Long, TimeUnit> expectedResults = TimeConverter.autoConvert(seconds, TimeUnit.SECONDS); assertEquals(expectedResults.getFirst().longValue() , 30L); <START> assertEquals(expectedResults.getSecond(), TimeUnit.MINUTES); <END> }</code><technical_language>Reorder expected actual this patch - <LINK_0></technical_language>

Target:
public void testConvertSecondsToMinutes() { long seconds = 1800L; Pair<Long, TimeUnit> expectedResults = TimeConverter.autoConvert(seconds, TimeUnit.SECONDS); assertEquals(30L, expectedResults.getFirst().longValue()); assertEquals(TimeUnit.MINUTES, expectedResults.getSecond()); }
Source:
<code>public SELF isNotEqualTo(String dateTimeAsString) { <START> Objects.instance().assertNotNull(info, actual); <END> assertDateTimeAsStringParameterIsNotNull(dateTimeAsString); return super.isNotEqualTo(parse(dateTimeAsString)); }</code><technical_language>I miss I this is needed super.isNotEqualTo fail is actual is null expected is not</technical_language>

Target:
public SELF isNotEqualTo(String dateTimeAsString) { assertDateTimeAsStringParameterIsNotNull(dateTimeAsString); return super.isNotEqualTo(parse(dateTimeAsString)); }
Source:
<code>public synchronized void close() { if (isClosed) { return; } LOG.info("{}: Close", blobAsyncClient.getBlobUrl().toString()); try { if (byteArrayOutputStream.isPresent()) { byteArrayOutputStream.get().close(); } if (blockList.size() == 0) { return; } CompletableFuture<Void> future = CompletableFuture.allOf(pendingUpload.toArray(new CompletableFuture[0])); LOG.info("Closing blob: PendingUpload:{} ", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); future.get((long) flushTimeoutMs, TimeUnit.MILLISECONDS); LOG.info("For blob: committing blockList size:{}", blobAsyncClient.getBlobUrl().toString(), blockList.size()); metrics.updateAzureCommitMetrics(); Map<String, String> blobMetadata = Collections.singletonMap(BLOB_RAW_SIZE_BYTES_METADATA, Long.toString(totalUploadedBlockSize)); blobAsyncClient.commitBlockListWithResponse(blockList, null, blobMetadata, null, null).block(); <START> } catch (InterruptedException | ExecutionException | TimeoutException e) { String msg = String.format("Close blob %s failed with exception. Total pending sends %d", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); throw new RuntimeException(msg, e); } catch (Exception e) { <END> String msg = String.format("Close blob %s failed with exception. Resetting the system producer. %s", blobAsyncClient.getBlobUrl().toString(), e.getLocalizedMessage()); throw new RuntimeException(msg, e); } finally { blockList.clear(); pendingUpload.stream().forEach(future -> future.cancel(true)); pendingUpload.clear(); isClosed = true; } }</code><technical_language>Based exception messages, cases handled differently. If is helpful treat cases differently, please add more details exception messages</technical_language>

Target:
public synchronized void close() { if (isClosed) { LOG.info("{}: already closed", blobAsyncClient.getBlobUrl().toString()); return; } LOG.info("{}: Close", blobAsyncClient.getBlobUrl().toString()); try { if (byteArrayOutputStream.isPresent()) { byteArrayOutputStream.get().close(); } if (blockList.size() == 0) { return; } CompletableFuture<Void> future = CompletableFuture.allOf(pendingUpload.toArray(new CompletableFuture[0])); LOG.info("Closing blob: PendingUpload:{} ", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); future.get((long) flushTimeoutMs, TimeUnit.MILLISECONDS); LOG.info("For blob: committing blockList size:{}", blobAsyncClient.getBlobUrl().toString(), blockList.size()); metrics.updateAzureCommitMetrics(); Map<String, String> blobMetadata = Collections.singletonMap(BLOB_RAW_SIZE_BYTES_METADATA, Long.toString(totalUploadedBlockSize)); blobAsyncClient.commitBlockListWithResponse(blockList, null, blobMetadata, null, null).block(); } catch (Exception e) { String msg = String.format("Close blob %s failed with exception. Total pending sends %d", blobAsyncClient.getBlobUrl().toString(), pendingUpload.size()); throw new AzureException(msg, e); } finally { blockList.clear(); pendingUpload.stream().forEach(future -> future.cancel(true)); pendingUpload.clear(); isClosed = true; } }
Source:
<code>public List<RadiologyOrder> getRadiologyOrdersByPatient(Patient patient) { Criteria radiologyOrderCriteria = createRadiologyOrderCriteria(); addRestrictionOnPatient(radiologyOrderCriteria, patient); <START> List<RadiologyOrder> result = (List<RadiologyOrder>) radiologyOrderCriteria.list(); <END> return result == null ? new ArrayList<RadiologyOrder>() : result; }</code><technical_language>final</technical_language>

Target:
public List<RadiologyOrder> getRadiologyOrdersByPatient(Patient patient) { Criteria radiologyOrderCriteria = createRadiologyOrderCriteria(); addRestrictionOnPatient(radiologyOrderCriteria, patient); final List<RadiologyOrder> result = (List<RadiologyOrder>) radiologyOrderCriteria.list(); return result == null ? new ArrayList<RadiologyOrder>() : result; }
Source:
<code>public FileManager(Configuration conf, Path hdfsWorkingPath) throws IOException { hfs = FileSystem.get(conf); lfs = FileSystem.getLocal(conf); hdfsWorkPath = hdfsWorkingPath; <START> localWorkPath = new Path(System.getProperty("java.io.tmpdir")); <END> allocatedHdfsPath = new HashMap<Path, OutputStream>(); allocatedLocalPath = new HashMap<Path, OutputStream>(); this.conf = conf; }</code><technical_language>sense dump this hyracks pregelix tmp directory instead</technical_language>

Target:
public FileManager(Configuration conf, Path hdfsWorkingPath) throws IOException { hfs = FileSystem.get(conf); lfs = FileSystem.getLocal(conf); hdfsWorkPath = hdfsWorkingPath; localWorkPath = new Path(BspUtils.TMP_DIR); allocatedHdfsPath = new HashMap<Path, OutputStream>(); allocatedLocalPath = new HashMap<Path, OutputStream>(); this.conf = conf; }
Source:
<code>public void handleEvent(IResumedDMEvent event) { IDMContext context = event.getDMContext(); <START> if (isSessionAllStop(event.getDMContext().getSessionId()) ) { <END> List<VisualizerThread> tList = fVisualizer.getModel().getThreads(); for(VisualizerThread t : tList) { t.setState(VisualizerExecutionState.RUNNING); } return; } if (context instanceof IContainerDMContext) { } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); VisualizerThread thread = fVisualizer.getModel().getThread(tid); if (thread != null) { assert thread.getState() == VisualizerExecutionState.SUSPENDED || thread.getState() == VisualizerExecutionState.CRASHED; thread.setState(VisualizerExecutionState.RUNNING); fVisualizer.getMulticoreVisualizerCanvas().requestUpdate(); } } }</code><technical_language>Variable context right above. Also, check for null, in case. Note InstanceOf check is implicit check for null</technical_language>

Target:
public void handleEvent(IResumedDMEvent event) { IDMContext context = event.getDMContext(); if (context != null && isSessionAllStop(context.getSessionId()) ) { List<VisualizerThread> tList = fVisualizer.getModel().getThreads(); for(VisualizerThread t : tList) { t.setState(VisualizerExecutionState.RUNNING); } fVisualizer.getMulticoreVisualizerCanvas().requestUpdate(); return; } if (context instanceof IContainerDMContext) { } else if (context instanceof IMIExecutionDMContext) { int tid = ((IMIExecutionDMContext)context).getThreadId(); VisualizerThread thread = fVisualizer.getModel().getThread(tid); if (thread != null) { assert thread.getState() == VisualizerExecutionState.SUSPENDED || thread.getState() == VisualizerExecutionState.CRASHED; thread.setState(VisualizerExecutionState.RUNNING); fVisualizer.getMulticoreVisualizerCanvas().requestUpdate(); } } }
Source:
<code>public void close() throws IOException { <START> if (this.isClosed) throw new IllegalStateException("Writer is already closed"); this.isClosed = true; <END> this.blockingClose(); }</code><technical_language>suggestion I this call blockingClose() move checks in I blockingClose() nonBlockingClose() more symmetrical</technical_language>

Target:
public void close() throws IOException { if (this.isClosed) return; this.isClosed = true; this.blockingCheckAndRethrow(); this.drain(); this.blockingCheckAndRethrow(); this.writer.close(); }
Source:
<code>public void onEpochFinished(final Collection<LassoData> epochData, final EpochInfo epochInfo) { final int epochIdx = epochInfo.getEpochIdx(); pullModels(); <START> final double regLoss = computeLoss(epochData); <END> LOG.log(Level.INFO, "Loss value: {0}", new Object[]{regLoss}); if ((epochIdx + 1) % PRINT_MODEL_PERIOD == 0) { for (int i = 0; i < numFeatures; i++) { LOG.log(Level.INFO, "model : {0}", new Object[]{newModel.get(i)}); } } final int numMiniBatches = epochInfo.getNumMiniBatches(); final int numEMBlocks = epochInfo.getNumEMBlocks(); final double epochElapsedTime = (System.currentTimeMillis() - epochInfo.getEpochStartTime()) / 1000.0D; final WorkerMetrics epochMetric = buildEpochMetric(epochIdx, numMiniBatches, numEMBlocks, epochData.size(), regLoss, epochElapsedTime); LOG.log(Level.INFO, "EpochMetrics {0}", epochMetric); sendMetrics(epochMetric); if (decayRate != 1 && (epochIdx + 1) % decayPeriod == 0) { final double prevStepSize = stepSize; stepSize *= decayRate; LOG.log(Level.INFO, "{0} iterations have passed. Step size decays from {1} to {2}", new Object[]{decayPeriod, prevStepSize, stepSize}); } }</code><technical_language>change loss sum of squared loss; revert regularized loss evaluating convergence offline</technical_language>

Target:
public void onEpochFinished(final Collection<LassoData> epochData, final EpochInfo epochInfo) { final int epochIdx = epochInfo.getEpochIdx(); pullModels(); final double sampleLossSum = computeLoss(epochData); LOG.log(Level.INFO, "Loss value: {0}", sampleLossSum); if ((epochIdx + 1) % PRINT_MODEL_PERIOD == 0) { for (int i = 0; i < numFeatures; i++) { LOG.log(Level.INFO, "model : {0}", newModel.get(i)); } } final int numMiniBatches = epochInfo.getNumMiniBatches(); final int numEMBlocks = epochInfo.getNumEMBlocks(); final double epochElapsedTime = (System.currentTimeMillis() - epochInfo.getEpochStartTime()) / 1000.0D; final WorkerMetrics epochMetric = buildEpochMetric(epochIdx, numMiniBatches, numEMBlocks, epochData.size(), sampleLossSum, epochElapsedTime); LOG.log(Level.INFO, "EpochMetrics {0}", epochMetric); sendMetrics(epochMetric); if (decayRate != 1 && (epochIdx + 1) % decayPeriod == 0) { final double prevStepSize = stepSize; stepSize *= decayRate; LOG.log(Level.INFO, "{0} iterations have passed. Step size decays from {1} to {2}", new Object[]{decayPeriod, prevStepSize, stepSize}); } }
Source:
<code>public ISO8601DateSerde(SimpleDateFormat df, Class<? extends Date> targetType) { <START> this.df = FastDateFormat.getInstance(df.toPattern(), df.getTimeZone()); <END> this.targetType = targetType; }</code><technical_language>do java this(df.toPattern(), df.getTimeZone(), targetType);</technical_language>

Target:
public ISO8601DateSerde(SimpleDateFormat df, Class<? extends Date> targetType) { this(df.toPattern(), df.getTimeZone(), targetType); }
Source:
<code>protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { boolean shouldAddPausePartitionsTask = false; _kafkaPositionTrackerTask.updatePositions(readTime, records, _consumer.metrics(), <START> records.partitions().stream().collect(Collectors.toMap(tp -> tp, tp -> _consumer.position(tp)))); <END> for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { sendMessage(record, readTime); } catch (Exception e) { _consumerMetrics.updateErrorRate(1); seekToLastCheckpoint(Collections.singleton(topicPartition)); if (_pausePartitionOnError) { _logger.warn("Got exception while sending record {}, adding topic partition to auto-pause set", record, topicPartition); Instant start = Instant.now(); _autoPausedSourcePartitions.put(topicPartition, PausedSourcePartitionMetadata.sendError(start, _pauseErrorPartitionDuration)); shouldAddPausePartitionsTask = true; } break; } } } if (shouldAddPausePartitionsTask) { _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); } }</code><technical_language>nit: do Function.identity() instead of "tp -> tp" for key mapper</technical_language>

Target:
protected void translateAndSendBatch(ConsumerRecords<?, ?> records, Instant readTime) { boolean shouldAddPausePartitionsTask = false; for (TopicPartition topicPartition : records.partitions()) { for (ConsumerRecord<?, ?> record : records.records(topicPartition)) { try { sendMessage(record, readTime); } catch (Exception e) { _consumerMetrics.updateErrorRate(1); seekToLastCheckpoint(Collections.singleton(topicPartition)); if (_pausePartitionOnError) { _logger.warn("Got exception while sending record {}, adding topic partition to auto-pause set", record, topicPartition); Instant start = Instant.now(); _autoPausedSourcePartitions.put(topicPartition, PausedSourcePartitionMetadata.sendError(start, _pauseErrorPartitionDuration)); shouldAddPausePartitionsTask = true; } break; } } } _kafkaPositionTracker.updatePositions(readTime, records, _consumer.metrics(), records.partitions().stream().collect(Collectors.toMap(Function.identity(), tp -> _consumer.position(tp)))); if (shouldAddPausePartitionsTask) { _taskUpdates.add(DatastreamConstants.UpdateType.PAUSE_RESUME_PARTITIONS); } }
Source:
<code>private void flushStripe(FlushReason flushReason) throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); long stripeStartOffset = orcDataSink.size(); if (closedStripes.isEmpty()) { outputData.add(createDataOutput(MAGIC)); stripeStartOffset += MAGIC.length(); } outputData.addAll(bufferStripeData(stripeStartOffset, flushReason)); if (flushReason == CLOSED) { outputData.addAll(bufferFileFooter()); } orcDataSink.write(outputData); <START> resetInternalWriters(); <END> dictionaryCompressionOptimizer.reset(); rowGroupRowCount = 0; stripeRowCount = 0; bufferedBytes = toIntExact(columnWriters.stream().mapToLong(ColumnWriter::getBufferedBytes).sum()); }</code><technical_language>This solve problem if original exception is thrown columnWriters.forEach(ColumnWriter::close); in bufferStripeData this line, rollback, try close column writers resetting them. reading code, part potentially place in flushStripe throwing error causing column writers closed. java // write data orcDataSink.write(outputData); a step, write a unit test verify stacktrace reproduced if caller calls orcWriter.write(page) orcWriter.close()? full stackstrace matching. get closing column writers good enough. OrcDataSink is interface mocked. In terms of actual solution, I need it. feel free propose a good one</technical_language>

Target:
private void flushStripe(FlushReason flushReason) throws IOException { List<OrcDataOutput> outputData = new ArrayList<>(); long stripeStartOffset = orcDataSink.size(); if (closedStripes.isEmpty()) { outputData.add(createDataOutput(MAGIC)); stripeStartOffset += MAGIC.length(); } outputData.addAll(bufferStripeData(stripeStartOffset, flushReason)); if (flushReason == CLOSED) { outputData.addAll(bufferFileFooter()); } orcDataSink.write(outputData); columnWriters.forEach(ColumnWriter::reset); dictionaryCompressionOptimizer.reset(); rowGroupRowCount = 0; stripeRowCount = 0; bufferedBytes = toIntExact(columnWriters.stream().mapToLong(ColumnWriter::getBufferedBytes).sum()); }
Source:
<code>public void heapUsageMetrics(){ navigation.selectRow().invoke("View"); Application.waitUntilVisible(); <START> <END> MetricsAreaFragment metricsArea = jvmPage.getHeapUsageMetricsArea(); double expectedUsedPercentage = metricsArea.getPercentage(USED, MAX); double expectedCommittedPercentage = metricsArea.getPercentage(COMMITTED, MAX); MetricsFragment usedMetrics = metricsArea.getMetricsFragment(USED); MetricsFragment committedMetrics = metricsArea.getMetricsFragment(COMMITTED); assertEquals(expectedUsedPercentage, usedMetrics.getPercentage(), DELTA); assertEquals(expectedCommittedPercentage, committedMetrics.getPercentage(), DELTA); }</code><technical_language>Please move this end of before() method</technical_language>

Target:
public void heapUsageMetrics(){ MetricsAreaFragment metricsArea = jvmPage.getHeapUsageMetricsArea(); double expectedUsedPercentage = metricsArea.getPercentage(USED, MAX); double expectedCommittedPercentage = metricsArea.getPercentage(COMMITTED, MAX); MetricsFragment usedMetrics = metricsArea.getMetricsFragment(USED); MetricsFragment committedMetrics = metricsArea.getMetricsFragment(COMMITTED); assertEquals(expectedUsedPercentage, usedMetrics.getPercentage(), DELTA); assertEquals(expectedCommittedPercentage, committedMetrics.getPercentage(), DELTA); }