auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties) { <START> return this.getDatabase(id).read().onErrorResume(exception -> { <END> final Throwable unwrappedException = Exceptions.unwrap(exception); if (unwrappedException instanceof CosmosException) { final CosmosException cosmosException = (CosmosException) unwrappedException; if (cosmosException.getStatusCode() == HttpConstants.StatusCodes.NOTFOUND) { CosmosDatabaseRequestOptions options = new CosmosDatabaseRequestOptions(); ModelBridgeInternal.setThroughputProperties(options, throughputProperties); return createDatabase(new CosmosDatabaseProperties(id), options); } } return Mono.error(unwrappedException); }); }</code><technical_language>wrong merge, undo please</technical_language>

Target:
public Mono<CosmosDatabaseResponse> createDatabaseIfNotExists(String id, ThroughputProperties throughputProperties) { return withContext(context -> createDatabaseIfNotExistsInternal(getDatabase(id), throughputProperties, context)); }
Source:
<code>public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String searchQueryExtra = null; String searchUrl = null; if (savedInstanceState != null) { searchUrl = savedInstanceState.getString(INSTANCE_CURRENT_DISCOVER_URL, null); } if (searchUrl == null && getArguments() != null) { searchQueryExtra = getArguments().getString(Router.EXTRA_SEARCH_QUERY); } if (searchQueryExtra != null) { initSearch(searchQueryExtra); } else { loadUrl(searchUrl == null ? getInitialUrl() : searchUrl); } <START> if (shouldShowSubjectDiscovery()) { <END> initSubjects(); } if (!EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().register(this); } setWebViewActionListener(); }</code><technical_language>Subjects related code moved WebViewDiscoverCoursesFragment instead of handling visibility shouldShowSubjectDiscovery abstract function</technical_language>

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); String searchQueryExtra = null; String searchUrl = null; if (savedInstanceState != null) { searchUrl = savedInstanceState.getString(INSTANCE_CURRENT_DISCOVER_URL, null); } if (searchUrl == null && getArguments() != null) { searchQueryExtra = getArguments().getString(Router.EXTRA_SEARCH_QUERY); } if (searchQueryExtra != null) { initSearch(searchQueryExtra); } else { loadUrl(searchUrl == null ? getInitialUrl() : searchUrl); } if (!EventBus.getDefault().isRegistered(this)) { EventBus.getDefault().register(this); } setWebViewActionListener(); }
Source:
<code>public int read(long position, byte[] buffer, int offset, int length) throws IOException { int bytesRead = inputStream.positionedRead(position, buffer, offset, length); if (cacheValidationEnabled) { <START> byte[] validationBuffer = new byte[bytesRead]; <END> originInputStream.read(position, validationBuffer, 0, bytesRead); for (int i = 0; i < bytesRead; i++) { verify(buffer[offset + i] == validationBuffer[i], "corrupted buffer at position " + i); } } return bytesRead; }</code><technical_language>bytes</technical_language>

Target:
public int read(long position, byte[] buffer, int offset, int length) throws IOException { int bytes = inputStream.positionedRead(position, buffer, offset, length); if (cacheValidationEnabled) { byte[] validationBuffer = new byte[bytes]; dataTierInputStream.get().read(position, validationBuffer, 0, bytes); for (int i = 0; i < bytes; i++) { verify(buffer[offset + i] == validationBuffer[i], "corrupted buffer at position " + i); } } return bytes; }
Source:
<code>public void test() throws Exception { String rawInput = getResource(TEST_DOC); String input; String expected = getResource(CONVERTED_HTML); <START> input = NormalizeHtml.convertToNormalizedHTML(rawInput); <END> input = bodyOnly(input); expected = bodyOnly(expected); input = input.replaceAll("\r", ""); expected = expected.replaceAll("\r", ""); Assert.assertEquals("Converted HTML does not equal expected", expected, input); input = rawInput.replaceAll("BODY", "body"); input = bodyOnly(input); input = NormalizeHtml.wrapAndNormalizeHTML(input, false, false, false); input = bodyOnly(input); input = input.replaceAll("\r", ""); Assert.assertEquals("Converted body only HTML does not equal expected", expected, input); }</code><technical_language>Move String input; this line obvious initialized/used for time</technical_language>

Target:
public void test() throws Exception { String rawInput = getResource(TEST_DOC); String expected = getResource(CONVERTED_HTML); String input = NormalizeHtml.convertToNormalizedHTML(rawInput); input = bodyOnly(input); expected = bodyOnly(expected); input = input.replaceAll("\r", ""); expected = expected.replaceAll("\r", ""); Assert.assertEquals("Converted HTML does not equal expected", expected, input); input = rawInput.replaceAll("BODY", "body"); input = bodyOnly(input); input = NormalizeHtml.wrapAndNormalizeHTML(input, false, false, false); input = bodyOnly(input); input = input.replaceAll("\r", ""); Assert.assertEquals("Converted body only HTML does not equal expected", expected, input); }
Source:
<code>public void onRefresh() { mSyncSavingsAccountTransactionPresenter.loadDatabaseSavingsAccountTransactions(); mSyncSavingsAccountTransactionPresenter.loadPaymentTypeOption(); <START> if (swipeRefreshLayout.isRefreshing()) <END> swipeRefreshLayout.setRefreshing(false); }</code><technical_language>Problem here! write statement executed if block line if braces. This prevent people adding code end confused if block</technical_language>

Target:
public void onRefresh() { mSyncSavingsAccountTransactionPresenter.loadDatabaseSavingsAccountTransactions(); mSyncSavingsAccountTransactionPresenter.loadPaymentTypeOption(); if (swipeRefreshLayout.isRefreshing()) { swipeRefreshLayout.setRefreshing(false); } }
Source:
<code>public AsyncReportStatusListener( final String path, final UUID uuid, final String mimeType, final List<? extends ReportProgressListener> callbackListeners ) { this.path = path; this.uuid = uuid; this.mimeType = mimeType; this.callbackListeners = callbackListeners; <START> <END> final ExtendedConfiguration config = ClassicEngineBoot.getInstance().getExtendedConfig(); firstPageMode = config.getBoolProperty( "org.pentaho.reporting.platform.plugin.output.FirstPageMode" ); }</code><technical_language>check list parameters for null. Dont allow it, demand pass in empty list instead. dont check for null time. Do expect users allowed modify list set? If not, a copy for private isolate evil user actions</technical_language>

Target:
public AsyncReportStatusListener( final String path, final UUID uuid, final String mimeType, final List<? extends ReportProgressListener> callbackListeners ) { ArgumentNullException.validate( "callbackListeners", callbackListeners ); this.path = path; this.uuid = uuid; this.mimeType = mimeType; this.callbackListeners = Collections.unmodifiableList( callbackListeners ); final ExtendedConfiguration config = ClassicEngineBoot.getInstance().getExtendedConfig(); firstPageMode = config.getBoolProperty( "org.pentaho.reporting.platform.plugin.output.FirstPageMode" ); }
Source:
<code>public boolean hasAllFinishedReading() throws IOException { if (m_closed) throw new IOException("Segment closed"); if (m_readCursors.size() == 0) return false; <START> for (String cid : m_readCursors.keySet()) { <END> SegmentReader reader = m_readCursors.get(cid); if (reader.m_objectReadIndex < m_numOfEntries) { return false; } } return true; }</code><technical_language>values() instead of keySet() save a map lookup for you</technical_language>

Target:
public boolean hasAllFinishedReading() throws IOException { if (m_closed) throw new IOException("Segment closed"); if (m_readCursors.size() == 0) return false; for (SegmentReader reader : m_readCursors.values()) { if (reader.m_objectReadIndex < m_numOfEntries) { return false; } } return true; }
Source:
<code>public void test_casting() { assertEquals(Stream.empty().map(Guavate.casting(Integer.class)).collect(toList()), ImmutableList.of()); <START> List<Number> baseList = Arrays.asList(1, 2, 3); <END> List<Integer> castList = baseList.stream().map(Guavate.casting(Integer.class)).collect(toList()); assertEquals(castList, ImmutableList.of(1, 2, 3)); List<Number> baseListMixed = Arrays.asList(1, 2f, 3); assertThrows( ClassCastException.class, () -> baseListMixed.stream().map(Guavate.casting(Short.class)).collect(toList())); }</code><technical_language>is Arrays.asList() popping instead of ImmutableList.of()</technical_language>

Target:
public void test_casting() { assertEquals(Stream.empty().map(Guavate.casting(Integer.class)).collect(toList()), ImmutableList.of()); List<Number> baseList = Arrays.asList(1, 2, 3); List<Integer> castList = baseList.stream().map(Guavate.casting(Integer.class)).collect(toList()); assertEquals(castList, baseList); List<Number> baseListMixed = ImmutableList.of(1, 2f, 3); assertThrows( ClassCastException.class, () -> baseListMixed.stream().map(Guavate.casting(Short.class)).collect(toList())); }
Source:
<code>public void updateStudent(String courseId, String email, String newName, String newTeamName, String newSectionName, String newEmail, String newGoogleId, String newComments, boolean hasDocument, boolean keepUpdateTimestamp) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, email); verifyStudentExists(courseId, email); CourseStudent courseStudent = getCourseStudentEntityForEmail(courseId, email); if (courseStudent != null) { boolean isEmailChanged = !email.equals(newEmail); String lastName = StringHelper.splitName(newName)[1]; if (isEmailChanged) { CourseStudent newCourseStudent = new CourseStudent(newEmail, newName, newGoogleId, newComments, <START> courseId, newTeamName, newSectionName); <END> try { updateStudentChangeEmail(newCourseStudent, lastName, courseStudent, hasDocument, keepUpdateTimestamp, courseId, email); } catch (EntityAlreadyExistsException e) { StudentAttributes existingStudent = (StudentAttributes) e.existingEntity; String error = ERROR_UPDATE_EMAIL_ALREADY_USED + existingStudent.getName() + "/" + existingStudent.getEmail(); throw new InvalidParametersException(error); } } else { updateStudentDetails(newName, newTeamName, newSectionName, newEmail, newGoogleId, newComments, hasDocument, keepUpdateTimestamp, courseStudent, lastName); } } log.info(Const.SystemParams.COURSE_BACKUP_LOG_MSG + courseId); getPm().close(); }</code><technical_language>alignment issues (look diff)</technical_language>

Target:
public void updateStudent(String courseId, String email, String newName, String newTeamName, String newSectionName, String newEmail, String newGoogleId, String newComments, boolean hasDocument, boolean keepUpdateTimestamp) throws InvalidParametersException, EntityDoesNotExistException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, email); verifyStudentExists(courseId, email); CourseStudent courseStudent = getCourseStudentEntityForEmail(courseId, email); if (courseStudent != null) { boolean isEmailChanged = !email.equals(newEmail); String lastName = StringHelper.splitName(newName)[1]; if (isEmailChanged) { CourseStudent newCourseStudent = new CourseStudent(newEmail, newName, newGoogleId, newComments, courseId, newTeamName, newSectionName); recreateStudentWithNewEmail(newCourseStudent, lastName, courseStudent, hasDocument, keepUpdateTimestamp, courseId, email); } else { updateStudentDetails(newName, newTeamName, newSectionName, newGoogleId, newComments, hasDocument, keepUpdateTimestamp, courseStudent, lastName); } } log.info(Const.SystemParams.COURSE_BACKUP_LOG_MSG + courseId); getPm().close(); }
Source:
<code>public void testMerge() { List<Result<Object>> resultsBefore = Arrays.asList( new Result<Object>(DateTimes.of("2011-01-01"), 1L), new Result<Object>(DateTimes.of("2011-01-01"), 2L) ); Iterable<Result<Object>> expectedResults = Collections.singletonList( new Result<Object>(DateTimes.of("2011-01-01"), 3L) ); Iterable<Result<Object>> resultsAfter = CombiningIterable.create( resultsBefore, <START> (r1, r2) -> r1.getTimestamp().compareTo(r2.getTimestamp()), <END> (arg1, arg2) -> { if (arg1 == null) { return arg2; } if (arg2 == null) { return arg1; } return new Result<>( arg1.getTimestamp(), ((Long) arg1.getValue()).longValue() + ((Long) arg2.getValue()).longValue() ); } ); Iterator<Result<Object>> it1 = expectedResults.iterator(); Iterator<Result<Object>> it2 = resultsAfter.iterator(); while (it1.hasNext() && it2.hasNext()) { Result r1 = it1.next(); Result r2 = it2.next(); Assert.assertEquals(r1.getTimestamp(), r2.getTimestamp()); Assert.assertEquals(r1.getValue(), r2.getValue()); } }</code><technical_language>Please Comparator.comparing(Result::getTimestamp)</technical_language>

Target:
public void testMerge() { List<Result<Object>> resultsBefore = Arrays.asList( new Result<>(DateTimes.of("2011-01-01"), 1L), new Result<>(DateTimes.of("2011-01-01"), 2L) ); Iterable<Result<Object>> expectedResults = Collections.singletonList( new Result<>(DateTimes.of("2011-01-01"), 3L) ); Iterable<Result<Object>> resultsAfter = CombiningIterable.create( resultsBefore, Comparator.comparing(Result::getTimestamp), (arg1, arg2) -> { if (arg1 == null) { return arg2; } if (arg2 == null) { return arg1; } return new Result<>( arg1.getTimestamp(), ((Long) arg1.getValue()).longValue() + ((Long) arg2.getValue()).longValue() ); } ); Iterator<Result<Object>> it1 = expectedResults.iterator(); Iterator<Result<Object>> it2 = resultsAfter.iterator(); while (it1.hasNext() && it2.hasNext()) { Result r1 = it1.next(); Result r2 = it2.next(); Assert.assertEquals(r1.getTimestamp(), r2.getTimestamp()); Assert.assertEquals(r1.getValue(), r2.getValue()); } }
Source:
<code>public AzureTemplateOptions secrets(Iterable<? extends Secrets> secrets) { <START> this.secrets = (secrets == null) ? null : ImmutableList.copyOf(checkNotNull(secrets, "secrets")); <END> return this; }</code><technical_language>if secrets null, want pattern for ipOptions</technical_language>

Target:
public AzureTemplateOptions secrets(Iterable<? extends Secrets> secrets) { for (Secrets secret : checkNotNull(secrets, "secrets")) checkNotNull(secret, "secrets can not be empty"); this.secrets = ImmutableList.copyOf(secrets); return this; }
Source:
<code>public String withdrawFunds(WithdrawFundsParams params) throws IOException { if (params instanceof RippleWithdrawFundsParams) { RippleWithdrawFundsParams xrpParams = (RippleWithdrawFundsParams) params; return withdrawFunds( <START> xrpParams.currency, <END> xrpParams.amount, xrpParams.address, xrpParams.tag); } else if (params instanceof MoneroWithdrawFundsParams) { MoneroWithdrawFundsParams xmrParams = (MoneroWithdrawFundsParams) params; return withdrawFunds( xmrParams.currency, xmrParams.amount, xmrParams.address, xmrParams.paymentId); } else if (params instanceof DefaultWithdrawFundsParams) { DefaultWithdrawFundsParams defaultParams = (DefaultWithdrawFundsParams) params; return withdrawFunds(defaultParams.currency, defaultParams.amount, defaultParams.address); } throw new IllegalStateException("Don't know how to withdraw: " + params); }</code><technical_language>getters setters preferable consistent rest of lib</technical_language>

Target:
public String withdrawFunds(WithdrawFundsParams params) throws IOException { if (params instanceof RippleWithdrawFundsParams) { RippleWithdrawFundsParams xrpParams = (RippleWithdrawFundsParams) params; return withdrawFunds( xrpParams.getCurrency(), xrpParams.getAmount(), xrpParams.getAddress(), xrpParams.getTag()); } else if (params instanceof MoneroWithdrawFundsParams) { MoneroWithdrawFundsParams xmrParams = (MoneroWithdrawFundsParams) params; return withdrawFunds( xmrParams.getCurrency(), xmrParams.getAmount(), xmrParams.getAddress(), xmrParams.getPaymentId()); } else if (params instanceof DefaultWithdrawFundsParams) { DefaultWithdrawFundsParams defaultParams = (DefaultWithdrawFundsParams) params; return withdrawFunds(defaultParams.getCurrency(), defaultParams.getAmount(), defaultParams.getAddress()); } throw new IllegalStateException("Don't know how to withdraw: " + params); }
Source:
<code>public static MobileNodeType getMobileNodeType(String mobileNodeType) { if (StringUtils.isEmpty(mobileNodeType)) { <START> <END> } for (MobileNodeType node : MobileNodeType.values()) { if (node.getAsString().equalsIgnoreCase(mobileNodeType)) { return node; } } StringBuilder errorMsg = new StringBuilder(); errorMsg.append("MobileNodeType '"); errorMsg.append(mobileNodeType).append("\' did not match any mobileNodeTypes supported by SeLion.\n"); errorMsg.append("Supported mobileNodes are : [").append(MobileNodeType.getSupportedMobileNodesAsCSV()); errorMsg.append("]."); IllegalArgumentException e = new IllegalArgumentException(errorMsg.toString()); throw e; }</code><technical_language>this empty if statement... address mandatory-ness of mobileNodeType a change</technical_language>

Target:
public static MobileNodeType getMobileNodeType(String mobileNodeType) { for (MobileNodeType node : MobileNodeType.values()) { if (node.getAsString().equalsIgnoreCase(mobileNodeType)) { return node; } } StringBuilder errorMsg = new StringBuilder(); errorMsg.append("MobileNodeType '"); errorMsg.append(mobileNodeType).append("\' did not match any mobileNodeTypes supported by SeLion.\n"); errorMsg.append("Supported mobileNodes are : [").append(MobileNodeType.getSupportedMobileNodesAsCSV()); errorMsg.append("]."); IllegalArgumentException e = new IllegalArgumentException(errorMsg.toString()); throw e; }
Source:
<code><START> protected TaggedValuePointable isDuplicateKeys(TaggedValuePointable key, Set<TaggedValuePointable> pointables) { <END> for (TaggedValuePointable tvp : pointables) { if (tvp != null && FunctionHelper.arraysEqual(tvp, key)) { return tvp; } } return null; }</code><technical_language>this method return a boolean value</technical_language>

Target:
private TaggedValuePointable isDuplicateKeys(TaggedValuePointable key, Set<TaggedValuePointable> pointables) { for (TaggedValuePointable tvp : pointables) { if (tvp != null && FunctionHelper.arraysEqual(tvp, key)) { return tvp; } } return null; }
Source:
<code><START> public static Keyspace getKeyspace() { <END> return keyspace; }</code><technical_language>do need this public? package scoped, protected work well. Astyanax classes in com.rackspace.blueflood.io.astyanax.\* able call this method public</technical_language>

Target:
protected static Keyspace getKeyspace() { return keyspace; }
Source:
<code><START> default AsyncQueryDAO getAsyncQueryDAO() { <END> return new DefaultAsyncQueryDAO(); }</code><technical_language>Instead of resolving this a setting - this injected async code (either lifecycle hook bean)</technical_language>

Target:
default AsyncQueryDAO getAsyncQueryDAO() { return null; }
Source:
<code>public void testConnectAPIEscapedMode() throws Exception { PowerMockito.doReturn(XBeeMode.API_ESCAPE).when(xbeeDevice, "determineConnectionMode"); <START> <END> try { xbeeDevice.connect(); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } assertEquals(xbeeDevice.getOperatingMode(), XBeeMode.API_ESCAPE); }</code><technical_language>check dataReader is running in XBee Device</technical_language>

Target:
public void testConnectAPIEscapedMode() throws Exception { PowerMockito.doReturn(OperatingMode.API_ESCAPE).when(xbeeDevice, "determineConnectionMode"); try { xbeeDevice.open(); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } assertTrue(xbeeDevice.isOpen()); assertTrue(dataReader.isRunning()); assertEquals(xbeeDevice.getOperatingMode(), OperatingMode.API_ESCAPE); }
Source:
<code>public void testCreateFailConstructor() { <START> PluginDescriptor pluginDescriptor = mock(DefaultPluginDescriptor.class); <END> when(pluginDescriptor.getPluginClass()).thenReturn(AnotherFailTestPlugin.class.getName()); PluginWrapper pluginWrapper = mock(PluginWrapper.class); when(pluginWrapper.getDescriptor()).thenReturn(pluginDescriptor); when(pluginWrapper.getPluginClassLoader()).thenReturn(getClass().getClassLoader()); DefaultPluginFactory instance = new DefaultPluginFactory(); Plugin result = instance.create(pluginWrapper); assertNull(result); }</code><technical_language>need change. I feel refactoring action</technical_language>

Target:
public void testCreateFailConstructor() { PluginDescriptor pluginDescriptor = mock(PluginDescriptor.class); when(pluginDescriptor.getPluginClass()).thenReturn(AnotherFailTestPlugin.class.getName()); PluginWrapper pluginWrapper = mock(PluginWrapper.class); when(pluginWrapper.getDescriptor()).thenReturn(pluginDescriptor); when(pluginWrapper.getPluginClassLoader()).thenReturn(getClass().getClassLoader()); DefaultPluginFactory instance = new DefaultPluginFactory(); Plugin result = instance.create(pluginWrapper); assertNull(result); }
Source:
<code>public static String getPlainText(String str) { <START> if (!TextUtils.isEmpty(str) && isHtml(str)) { <END> HtmlToPlainText formatter = new HtmlToPlainText(); Document feedDescription = Jsoup.parse(str); str = StringUtils.trim(formatter.getPlainText(feedDescription)); } return str; }</code><technical_language>I is safer explicitly return empty string if TextUtils.isEmpty prevent crashes caller description is null</technical_language>

Target:
public static String getPlainText(String str) { if (!TextUtils.isEmpty(str) && isHtml(str)) { HtmlToPlainText formatter = new HtmlToPlainText(); Document feedDescription = Jsoup.parse(str); str = StringUtils.trim(formatter.getPlainText(feedDescription)); } else if (TextUtils.isEmpty(str)) { str = ""; } return str; }
Source:
<code>public void testDuplicateBatchAppend() throws Exception { HTableDescriptor hdt = TEST_UTIL <START> .createTableDescriptor(name.getTableName(), HColumnDescriptor.DEFAULT_MIN_VERSIONS, 3, <END> HConstants.FOREVER, HColumnDescriptor.DEFAULT_KEEP_DELETED); Map<String, String> kvs = new HashMap<>(); kvs.put(SleepAtFirstRpcCall.SLEEP_TIME_CONF_KEY, "2000"); hdt.addCoprocessor(SleepAtFirstRpcCall.class.getName(), null, 1, kvs); TEST_UTIL.createTable(hdt, new byte[][] { ROW }).close(); Configuration c = new Configuration(TEST_UTIL.getConfiguration()); c.setInt(HConstants.HBASE_CLIENT_PAUSE, 50); c.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 1500); try (Connection connection = ConnectionFactory.createConnection(c); Table table = connection.getTableBuilder(name.getTableName(), null). setOperationTimeout(3 * 1000).build()) { Append append = new Append(ROW); append.addColumn(HBaseTestingUtility.fam1, QUALIFIER, VALUE); Object[] results = new Object[1]; table.batch(Collections.singletonList(append), results); Cell[] cells = ((Result) results[0]).rawCells(); assertEquals(1, cells.length); assertKey(cells[0], ROW, HBaseTestingUtility.fam1, QUALIFIER, VALUE); Result readResult = table.get(new Get(ROW)); cells = readResult.rawCells(); assertEquals(1, cells.length); assertKey(cells[0], ROW, HBaseTestingUtility.fam1, QUALIFIER, VALUE); } }</code><technical_language>relevant method for createModifyableTableDescriptor? HTableDescriptor is deprecated</technical_language>

Target:
public void testDuplicateBatchAppend() throws Exception { TableDescriptorBuilder.ModifyableTableDescriptor mtd = TEST_UTIL .createModifyableTableDescriptor(name.getTableName(), ColumnFamilyDescriptorBuilder.DEFAULT_MIN_VERSIONS, 3, HConstants.FOREVER, ColumnFamilyDescriptorBuilder.DEFAULT_KEEP_DELETED); Map<String, String> kvs = new HashMap<>(); kvs.put(SleepAtFirstRpcCall.SLEEP_TIME_CONF_KEY, "2000"); mtd.setCoprocessor(CoprocessorDescriptorBuilder .newBuilder(SleepAtFirstRpcCall.class.getName()) .setPriority(1) .setProperties(kvs) .build()); TEST_UTIL.createTable(mtd, new byte[][] { ROW }).close(); Configuration c = new Configuration(TEST_UTIL.getConfiguration()); c.setInt(HConstants.HBASE_CLIENT_PAUSE, 50); c.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 1500); try (Connection connection = ConnectionFactory.createConnection(c); Table table = connection.getTableBuilder(name.getTableName(), null). setOperationTimeout(3 * 1000).build()) { Append append = new Append(ROW); append.addColumn(HBaseTestingUtility.fam1, QUALIFIER, VALUE); Object[] results = new Object[1]; table.batch(Collections.singletonList(append), results); Cell[] cells = ((Result) results[0]).rawCells(); assertEquals(1, cells.length); assertKey(cells[0], ROW, HBaseTestingUtility.fam1, QUALIFIER, VALUE); Result readResult = table.get(new Get(ROW)); cells = readResult.rawCells(); assertEquals(1, cells.length); assertKey(cells[0], ROW, HBaseTestingUtility.fam1, QUALIFIER, VALUE); } }
Source:
<code>protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { ViewGroup answerView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.url_widget_answer, null); openUrlButton = answerView.findViewById(R.id.url_button); stringAnswer = answerView.findViewById(R.id.url_answer_text); if (prompt.isReadOnly()) { openUrlButton.setVisibility(GONE); } else { openUrlButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); openUrlButton.setOnClickListener(v -> { if (MultiClickGuard.allowClick(QuestionWidget.class.getName())) { onButtonClick(openUrlButton.getId()); } }); } <START> stringAnswer.setTextColor(new ThemeUtils(context).getColorOnSurface()); <END> stringAnswer.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); String s = prompt.getAnswerText(); if (s != null) { stringAnswer.setText(s); uri = Uri.parse(stringAnswer.getText().toString()); } return answerView; }</code><technical_language>This move XML layout</technical_language>

Target:
protected View onCreateAnswerView(Context context, FormEntryPrompt prompt, int answerFontSize) { binding = UrlWidgetAnswerBinding.inflate(((Activity) context).getLayoutInflater()); View answerView = binding.getRoot(); if (prompt.isReadOnly()) { binding.urlButton.setVisibility(GONE); } else { binding.urlButton.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.urlButton.setOnClickListener(v -> onButtonClick()); } binding.urlAnswerText.setTextSize(TypedValue.COMPLEX_UNIT_DIP, answerFontSize); binding.urlAnswerText.setText(prompt.getAnswerText()); return answerView; }
Source:
<code>public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartSignalEvent emptyTop = getStartNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, StartSignalEvent.class); assertGeneralSet(emptyTop.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); <START> assertSignalEventExecutionSet(emptyTop.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, ""); <END> assertDataIOSet(emptyTop.getDataIOSet(), EMPTY_VALUE); }</code><technical_language>suggestion assertSignalEventExecutionSet(emptyTop.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE);</technical_language>

Target:
public void testUnmarshallTopLevelEmptyEventProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartSignalEvent emptyTop = getStartNodeById(diagram, EMPTY_TOP_LEVEL_EVENT_ID, StartSignalEvent.class); assertGeneralSet(emptyTop.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptyTop.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE); assertDataIOSet(emptyTop.getDataIOSet(), EMPTY_VALUE); }
Source:
<code>private void standPlayer(EntityRef entity) { ClientComponent clientComp = entity.getComponent(ClientComponent.class); GazeMountPointComponent gazeMountPointComponent = clientComp.character.getComponent(GazeMountPointComponent.class); float height = clientComp.character.getComponent(CharacterMovementComponent.class).height; float eyeHeight = gazeMountPointComponent.translate.getY(); Vector3f pos = entity.getComponent(LocationComponent.class).getWorldPosition(); CharacterCollider collider = physics.getCharacterCollider(clientComp.character); Vector3f to = new Vector3f(pos.x, pos.y + height, pos.z); SweepCallback callback = collider.sweep(pos, to, VERTICAL_PENETRATION_LEEWAY, -1f); if (callback.hasHit()) { <START> entity.send(new NotificationMessageEvent("Cannot stand here!", entity)); <END> return; } movementDebugCommands.playerHeight(localPlayer.getClientEntity(), height / 0.5f); movementDebugCommands.playerEyeHeight(localPlayer.getClientEntity(), eyeHeight / 0.5f); clientComp.character.send(new SetMovementModeEvent(MovementMode.WALKING)); }</code><technical_language>Tiny clarification: "Cannot stand _up_ here" ? slightly inability action stand there</technical_language>

Target:
private void standPlayer(EntityRef entity) { ClientComponent clientComp = entity.getComponent(ClientComponent.class); GazeMountPointComponent gazeMountPointComponent = clientComp.character.getComponent(GazeMountPointComponent.class); float height = clientComp.character.getComponent(CharacterMovementComponent.class).height; float eyeHeight = gazeMountPointComponent.translate.getY(); Vector3f pos = entity.getComponent(LocationComponent.class).getWorldPosition(); CharacterCollider collider = physics.getCharacterCollider(clientComp.character); Vector3f to = new Vector3f(pos.x, pos.y + (1 - crouchFraction) * height / crouchFraction, pos.z); SweepCallback callback = collider.sweep(pos, to, VERTICAL_PENETRATION_LEEWAY, -1f); if (callback.hasHit()) { entity.send(new NotificationMessageEvent("Cannot stand up here!", entity)); return; } movementDebugCommands.playerHeight(localPlayer.getClientEntity(), height / crouchFraction); movementDebugCommands.playerEyeHeight(localPlayer.getClientEntity(), eyeHeight / crouchFraction); clientComp.character.send(new SetMovementModeEvent(MovementMode.WALKING)); }
Source:
<code>public void execute(SensorContext context) { <START> Set<String> reports = Sets.newHashSet(context.config().getStringArray(JavaScriptPlugin.LCOV_REPORT_PATHS)); <END> if (context.config().hasKey(JavaScriptPlugin.TS_LCOV_REPORT_PATHS)) { LOG.warn("The use of " + JavaScriptPlugin.TS_LCOV_REPORT_PATHS + " for coverage import is deprecated, use " + JavaScriptPlugin.LCOV_REPORT_PATHS + " instead!"); reports.addAll(Arrays.asList(context.config().getStringArray(JavaScriptPlugin.TS_LCOV_REPORT_PATHS))); } List<File> lcovFiles = reports.stream() .map(report -> getIOFile(context.fileSystem().baseDir(), report)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (lcovFiles.isEmpty()) { LOG.warn("No coverage information will be saved because all LCOV files cannot be found."); return; } saveCoverageFromLcovFiles(context, lcovFiles); }</code><technical_language>Try avoid guava</technical_language>

Target:
public void execute(SensorContext context) { Set<String> reports = new HashSet<>(Arrays.asList(context.config().getStringArray(JavaScriptPlugin.LCOV_REPORT_PATHS))); if (context.config().hasKey(JavaScriptPlugin.TS_LCOV_REPORT_PATHS)) { LOG.warn("The use of " + JavaScriptPlugin.TS_LCOV_REPORT_PATHS + " for coverage import is deprecated, use " + JavaScriptPlugin.LCOV_REPORT_PATHS + " instead."); reports.addAll(Arrays.asList(context.config().getStringArray(JavaScriptPlugin.TS_LCOV_REPORT_PATHS))); } List<File> lcovFiles = reports.stream() .map(report -> getIOFile(context.fileSystem().baseDir(), report)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (lcovFiles.isEmpty()) { LOG.warn("No coverage information will be saved because all LCOV files cannot be found."); return; } saveCoverageFromLcovFiles(context, lcovFiles); }
Source:
<code>private void killInstances(SchedulerDriver driver, int toKill) { if (toKill == 0) return; <START> if (toKill >= crateInstances.size()) { <END> markForceShutdown(driver); } int killed = 0; LOGGER.debug("Too many instances running. Killing tasks", toKill); for (CrateInstance crateInstance : crateInstances) { if (killed == toKill) { break; } LOGGER.info("Kill task {}", crateInstance.taskId()); driver.killTask(taskID(crateInstance.taskId())); killed++; } }</code><technical_language>toKill greater crateInstances.size()</technical_language>

Target:
private void killInstances(SchedulerDriver driver, int toKill) { if (toKill == 0) return; if (toKill == crateInstances.size()) { markForceShutdown(driver); } int killed = 0; LOGGER.debug("Too many instances running. Killing tasks", toKill); for (CrateInstance crateInstance : crateInstances) { if (killed == toKill) { break; } LOGGER.info("Kill task {}", crateInstance.taskId()); driver.killTask(taskID(crateInstance.taskId())); killed++; } }
Source:
<code>private static Process runASyncProcess(String[] command, File workingDirectory, Map<String, String> envs, String logFileUuid, boolean logStderr) { <START> LOG.log(Level.INFO, "Run async process: ``{0}''", String.join(" ", command)); <END> String commandFileName = Paths.get(command[0]).getFileName().toString(); String uuid = logFileUuid; if (uuid == null) { uuid = UUID.randomUUID().toString().substring(0, 8) + "-started"; } ProcessBuilder pb = getProcessBuilder(false, command, workingDirectory, envs); pb.redirectErrorStream(true); if (logStderr) { String logFilePath = String.format("%s/%s-%s.stderr", workingDirectory, commandFileName, uuid); pb.redirectOutput(ProcessBuilder.Redirect.appendTo(new File(logFilePath))); } Process process = null; try { process = pb.start(); } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to run async process ", e); } return process; }</code><technical_language>s/Run/Running/</technical_language>

Target:
private static Process runASyncProcess(String[] command, File workingDirectory, Map<String, String> envs, String logFileUuid, boolean logStderr) { LOG.log(Level.INFO, "Running async process: ``{0}''''", String.join(" ", command)); String commandFileName = Paths.get(command[0]).getFileName().toString(); String uuid = logFileUuid; if (uuid == null) { uuid = UUID.randomUUID().toString().substring(0, 8) + "-started"; } ProcessBuilder pb = getProcessBuilder(false, command, workingDirectory, envs); pb.redirectErrorStream(true); if (logStderr) { String logFilePath = String.format("%s/%s-%s.stderr", workingDirectory, commandFileName, uuid); pb.redirectOutput(ProcessBuilder.Redirect.appendTo(new File(logFilePath))); } Process process = null; try { process = pb.start(); } catch (IOException e) { LOG.log(Level.SEVERE, "Failed to run async process", e); } return process; }
Source:
<code>public ARXRandomForestConfiguration getRandomForestConfiguration() { if (this.configRandomForest == null || this.configCurrent == null) { this.configRandomForest = ARXRandomForestConfiguration.create(); <START> this.configCurrent = this.configRandomForest; <END> } return this.configRandomForest; }</code><technical_language>No. Please change in getters</technical_language>

Target:
public ARXRandomForestConfiguration getRandomForestConfiguration() { if (this.configRandomForest == null) { this.configRandomForest = ARXRandomForestConfiguration.create(); } return this.configRandomForest; }
Source:
<code>public int hashCode() { <START> return Utils.hashcode(new Object[]{uuid}); <END> }</code><technical_language>this change is safe? this based versions too</technical_language>

Target:
public int hashCode() { return uuid.hashCode(); }
Source:
<code>public List<A> createEntities(Collection<A> entitiesToAdd) throws InvalidParametersException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, entitiesToAdd); List<A> entitiesToUpdate = new ArrayList<A>(); List<E> entities = new ArrayList<E>(); for (A entityToAdd : entitiesToAdd) { entityToAdd.sanitizeForSaving(); if (!entityToAdd.isValid()) { throw new InvalidParametersException(entityToAdd.getInvalidityInfo()); } if (hasEntity(entityToAdd)) { entitiesToUpdate.add(entityToAdd); } else { E entity = entityToAdd.toEntity(); entities.add(entity); } log.info(entityToAdd.getBackupIdentifier()); } <START> ofy().save().entities(entities).now(); <END> return entitiesToUpdate; }</code><technical_language>createEntities call saveEntities calling ofy directly, consistent createEntity calls saveEntity. defined saveEntities, all</technical_language>

Target:
public List<A> createEntities(Collection<A> entitiesToAdd) throws InvalidParametersException { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, entitiesToAdd); List<A> entitiesToUpdate = new ArrayList<>(); List<E> entities = new ArrayList<>(); for (A entityToAdd : entitiesToAdd) { entityToAdd.sanitizeForSaving(); if (!entityToAdd.isValid()) { throw new InvalidParametersException(entityToAdd.getInvalidityInfo()); } if (hasEntity(entityToAdd)) { entitiesToUpdate.add(entityToAdd); } else { E entity = entityToAdd.toEntity(); entities.add(entity); } } saveEntities(entities, entitiesToAdd); return entitiesToUpdate; }
Source:
<code>public void testBackupStatic() throws Exception { final int SERVER_COUNT = 3; final int[] clientPorts = new int[SERVER_COUNT]; StringBuilder sb = new StringBuilder(); String server; for (int i = 0; i < SERVER_COUNT; i++) { clientPorts[i] = PortAssignment.unique(); <START> server = "server." <END> + i + "=localhost:" + PortAssignment.unique() + ":" + PortAssignment.unique() + ":participant;localhost:" + clientPorts[i]; sb.append(server + "\n"); } String currentQuorumCfgSection = sb.toString(); MainThread[] mt = new MainThread[SERVER_COUNT]; String[] staticFileContent = new String[SERVER_COUNT]; String[] staticBackupContent = new String[SERVER_COUNT]; for (int i = 0; i < SERVER_COUNT; i++) { mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, false); Assert.assertNull("static file backup shouldn't exist before bootup", mt[i].getFileByName("zoo.cfg.bak")); staticFileContent[i] = getFileContent(mt[i].confFile); mt[i].start(); } for (int i = 0; i < SERVER_COUNT; i++) { Assert.assertTrue("waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); File backupFile = mt[i].getFileByName("zoo.cfg.bak"); Assert.assertNotNull("static file backup should exist", backupFile); staticBackupContent[i] = getFileContent(backupFile); Assert.assertEquals(staticFileContent[i], staticBackupContent[i]); } for (int i = 0; i < SERVER_COUNT; i++) { mt[i].shutdown(); } }</code><technical_language>is worth reverting</technical_language>

Target:
public void testBackupStatic() throws Exception { final int SERVER_COUNT = 3; final int[] clientPorts = new int[SERVER_COUNT]; StringBuilder sb = new StringBuilder(); String server; for (int i = 0; i < SERVER_COUNT; i++) { clientPorts[i] = PortAssignment.unique(); server = "server." + i + "=localhost:" + PortAssignment.unique() + ":" + PortAssignment.unique() + ":participant;localhost:" + clientPorts[i]; sb.append(server + "\n"); } String currentQuorumCfgSection = sb.toString(); MainThread[] mt = new MainThread[SERVER_COUNT]; String[] staticFileContent = new String[SERVER_COUNT]; String[] staticBackupContent = new String[SERVER_COUNT]; for (int i = 0; i < SERVER_COUNT; i++) { mt[i] = new MainThread(i, clientPorts[i], currentQuorumCfgSection, false); assertNull("static file backup shouldn't exist before bootup", mt[i].getFileByName("zoo.cfg.bak")); staticFileContent[i] = getFileContent(mt[i].confFile); mt[i].start(); } for (int i = 0; i < SERVER_COUNT; i++) { assertTrue( "waiting for server " + i + " being up", ClientBase.waitForServerUp("127.0.0.1:" + clientPorts[i], CONNECTION_TIMEOUT)); File backupFile = mt[i].getFileByName("zoo.cfg.bak"); assertNotNull("static file backup should exist", backupFile); staticBackupContent[i] = getFileContent(backupFile); assertEquals(staticFileContent[i], staticBackupContent[i]); } for (int i = 0; i < SERVER_COUNT; i++) { mt[i].shutdown(); } }
Source:
<code>public void visitSwitchStatement(SwitchStatementTree tree) { boolean hasClauseWithoutJump = false; boolean hasDefaultCase = false; List<SwitchClauseTree> branches = new ArrayList<>(); for (int i = 0; i < tree.cases().size(); i++) { SwitchClauseTree caseTree = tree.cases().get(i); <START> boolean isLast = (i == tree.cases().size() - 1); <END> if (caseTree.is(Kind.DEFAULT_CLAUSE)) { hasDefaultCase = true; } if (!caseTree.statements().isEmpty() || isLast) { branches.add(caseTree); } if (!endsWithJump(caseTree) && !isLast) { hasClauseWithoutJump = true; } } if (!hasClauseWithoutJump && hasDefaultCase && allBranchesEquivalent(branches)) { allBranchesDuplicated(tree); } else { checkDuplicatedBranches(branches); } super.visitSwitchStatement(tree); }</code><technical_language>I</technical_language>

Target:
public void visitSwitchStatement(SwitchStatementTree tree) { boolean hasFallthrough = false; boolean hasDefaultCase = false; List<Tree> branches = new ArrayList<>(); for (int i = 0; i < tree.cases().size(); i++) { SwitchClauseTree caseTree = tree.cases().get(i); boolean isLast = (i == tree.cases().size() - 1); if (caseTree.is(Kind.DEFAULT_CLAUSE)) { hasDefaultCase = true; } if (!caseTree.statements().isEmpty() || isLast) { branches.add(caseTree); } if (!endsWithJump(caseTree) && !isLast) { hasFallthrough = true; } } if (!hasFallthrough && hasDefaultCase && allBranchesEquivalent(branches)) { allBranchesDuplicated(tree); } else { checkDuplicatedBranches(branches); } super.visitSwitchStatement(tree); }
Source:
<code>public int getMessageType() { String authorValue = authorText.getText(); if (authorValue.length() == 0 || RawParseUtils.parsePersonIdent(authorValue) == null) return ERROR; String committerValue = committerText.getText(); if (committerValue.length() == 0 || RawParseUtils.parsePersonIdent(committerValue) == null) return ERROR; if (amending && amendingCommitInRemoteBranch) return WARNING; return NONE; <START> } <END></code><technical_language>This code is duplicated in getMessage(), for return value. introduce a class Message (with String getText(), int getType() methods), consolidate logic method adapt calling code. IMessageProvider longer implemented, IMO code duplication is more important here</technical_language>

Target:
public int getMessageType() { return statusType; }
Source:
<code>protected void doExecute() throws Exception { if (skip == true) { return; } if (features == null) { return; } InstallFeatureTask installFeatureTask = (InstallFeatureTask) ant .createTask("antlib:net/wasdev/wlp/ant:install-feature"); if (installFeatureTask == null) { throw new NullPointerException("Install feature task not found."); } installFeatureTask.setInstallDir(installDirectory); installFeatureTask.setServerName(serverName); installFeatureTask.setUserDir(userDirectory); installFeatureTask.setOutputDir(outputDirectory); <START> if (features != null) { <END> installFeatureTask.setAcceptLicense(features.isAcceptLicense()); installFeatureTask.setTo(features.getTo()); installFeatureTask.setWhenFileExists(features.getWhenFileExists()); installFeatureTask.setFeatures(features.getFeatures()); installFeatureTask.setFrom(features.getFrom()); } installFeatureTask.execute(); }</code><technical_language>This is unnecessary is earlier features == check</technical_language>

Target:
protected void doExecute() throws Exception { if (skip == true) { return; } if (features == null) { return; } InstallFeatureTask installFeatureTask = (InstallFeatureTask) ant .createTask("antlib:net/wasdev/wlp/ant:install-feature"); if (installFeatureTask == null) { throw new NullPointerException("Install feature task not found."); } installFeatureTask.setInstallDir(installDirectory); installFeatureTask.setServerName(serverName); installFeatureTask.setUserDir(userDirectory); installFeatureTask.setOutputDir(outputDirectory); installFeatureTask.setAcceptLicense(features.isAcceptLicense()); installFeatureTask.setTo(features.getTo()); installFeatureTask.setWhenFileExists(features.getWhenFileExists()); installFeatureTask.setFeatures(features.getFeatures()); installFeatureTask.setFrom(features.getFrom()); installFeatureTask.execute(); }
Source:
<code><START> static TerminateStrategyConfiguration generateTermination(JTermination jTermination) { <END> TerminateStrategyConfiguration termination = null; if (jTermination instanceof JTerminationIterations) { termination = new IterationsOrDurationStrategyConfiguration(); String duration = parseDuration(((JTerminationIterations) jTermination).getMaxDurationInSeconds()); ((IterationsOrDurationStrategyConfiguration) termination).setDuration(duration); ((IterationsOrDurationStrategyConfiguration) termination).setIterations( (int) ((JTerminationIterations) jTermination).getIterationCount()); ((IterationsOrDurationStrategyConfiguration) termination).setShutdown(new AtomicBoolean(false)); } else if (jTermination instanceof JTerminationDuration) { termination = new IterationsOrDurationStrategyConfiguration(); String duration = parseDuration(((JTerminationDuration) jTermination).getDurationInSeconds()); ((IterationsOrDurationStrategyConfiguration) termination).setDuration(duration); ((IterationsOrDurationStrategyConfiguration) termination).setShutdown(new AtomicBoolean(false)); } else if (jTermination instanceof JTerminationBackground) { termination = new InfiniteTerminationStrategyConfiguration(); } return termination; }</code><technical_language>Instead of heavy hardly-read method, I recommend split 3 methods: - generateTerminationIterations(...) - generateTerminationDuration(...) - generateTerminationBackground(...) try avoid cast operations, hard read( create a temp variable cast further</technical_language>

Target:
static TerminateStrategyConfiguration generateTermination(JTermination jTermination) { TerminateStrategyConfiguration termination = null; if (jTermination instanceof JTerminationIterations) { termination = generateIterationTermination((JTerminationIterations) jTermination); } else if (jTermination instanceof JTerminationDuration) { termination = generateDurationTermination((JTerminationDuration) jTermination); } else if (jTermination instanceof JTerminationBackground) { termination = new InfiniteTerminationStrategyConfiguration(); } return termination; }
Source:
<code>private void addGrantsToACL(AccessControlList acl) { String ownerId = acl.getOwner().getId(); acl.addPermission(GroupGranteeURI.ALL_USERS, Permission.READ); <START> acl.addPermission(new EmailAddressGrantee(TEST_ACL_EMAIL), Permission.READ_ACP); <END> acl.addPermission(new CanonicalUserGrantee(ownerId), Permission.WRITE_ACP); }</code><technical_language>static import Permission.READ_ACP follow style of TEST_ACL_EMAIL</technical_language>

Target:
private void addGrantsToACL(AccessControlList acl) { String ownerId = acl.getOwner().getId(); acl.addPermission(ALL_USERS, READ); acl.addPermission(new EmailAddressGrantee(TEST_ACL_EMAIL), READ_ACP); acl.addPermission(new CanonicalUserGrantee(ownerId), WRITE_ACP); }