auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Map<String, Ref> getPubSubRefs() throws IOException { Map<String, Ref> matches = new HashMap<String, Ref>(); RefDatabase rdb = repository.getRefDatabase(); for (RefSpec spec : getSubscribeSpecs()) { String pubsubRef = getPubSubRefFromLocal(remote, spec.getSource()); if (spec.isWildcard()) { pubsubRef = pubsubRef.substring(0, pubsubRef.length() - 1); <START> for (Ref r : rdb.getRefs(pubsubRef).values()) { <END> matches.put(getLocalRefFromPubSub(remote, r.getName()), r); } } else { Ref r = rdb.getRef(pubsubRef); if (r != null) matches.put(getLocalRefFromPubSub(remote, r.getName()), r); } } return matches; }</code><technical_language>braces</technical_language>

Target:
public Map<String, Ref> getPubSubRefs() throws IOException { Map<String, Ref> matches = new HashMap<String, Ref>(); RefDatabase rdb = repository.getRefDatabase(); for (RefSpec spec : getSubscribeSpecs()) { String pubsubRef = getPubSubRefFromLocal(remote, spec.getSource()); if (spec.isWildcard()) { pubsubRef = pubsubRef.substring(0, pubsubRef.length() - 1); for (Ref r : rdb.getRefs(pubsubRef).values()) matches.put(getLocalRefFromPubSub(remote, r.getName()), r); } else { Ref r = rdb.getRef(pubsubRef); if (r != null) matches.put(getLocalRefFromPubSub(remote, r.getName()), r); } } return matches; }
Source:
<code>private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { connectButton.setEnabled(true); Transitions.transitionToHome((CoreActivity)getActivity()); ((CoreActivity)getActivity()).enableSlidingMenu(); } }) <START> .addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { <END> @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra( BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); if(mode == BluetoothAdapter.SCAN_MODE_NONE || mode == BluetoothAdapter.SCAN_MODE_CONNECTABLE){ Log.d(TAG, "Button Enabled"); connectButton.setEnabled(true); } else if(mode == BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE){ Log.d(TAG, "Button disabled"); connectButton.setEnabled(false); } else { Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); } } }) .register(this.getActivity()); }</code><technical_language>Love it! request is a switch statement below, for readability...otherwise, this is a solid change</technical_language>

Target:
private void registerReceivers() { this.broadcastRegistrar = new BroadcastRegistrar(); this.broadcastRegistrar .addAction(ConnectionService.ACTION_HOST_CONNECTED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { connectButton.setEnabled(true); Transitions.transitionToHome((CoreActivity)getActivity()); ((CoreActivity)getActivity()).enableSlidingMenu(); } }) .addAction(BluetoothAdapter.ACTION_SCAN_MODE_CHANGED, new IBroadcastActionHandler() { @Override public void onReceiveAction(Context context, Intent intent) { int mode = intent.getIntExtra( BluetoothAdapter.EXTRA_SCAN_MODE, BluetoothAdapter.SCAN_MODE_NONE); switch(mode){ case BluetoothAdapter.SCAN_MODE_NONE: connectButton.setEnabled(true); break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE: connectButton.setEnabled(true); break; case BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE: connectButton.setEnabled(false); break; default: Log.wtf(TAG, "Recieved scan mode changed with unknown mode"); break; } } }) .register(this.getActivity()); }
Source:
<code>protected void writeString(int majorType, byte[] bytes) throws IOException { int len = (bytes == null) ? 0 : bytes.length; writeType(majorType, len); <START> m_os.write(bytes); <END> }</code><technical_language>null case</technical_language>

Target:
protected void writeString(int majorType, byte[] bytes) throws IOException { int len = (bytes == null) ? 0 : bytes.length; writeType(majorType, len); if (len > 0){ m_os.write(bytes); } }
Source:
<code>public void updateIdentifiersWithPhone() throws Exception { mockPlayContextWithJson(PHONE_UPDATE); doReturn(session).when(controller).getAuthenticatedAndConsentedSession(); when(mockParticipantService.updateIdentifiers(eq(study), any(), any())).thenReturn(participant); Result result = controller.updateIdentifiers(); assertResult(result, 200); JsonNode node = BridgeObjectMapper.get().readTree(Helpers.contentAsString(result)); assertEquals(ID, node.get("id").textValue()); verify(mockParticipantService).updateIdentifiers(eq(study), contextCaptor.capture(), identifierUpdateCaptor.capture()); IdentifierUpdate update = identifierUpdateCaptor.getValue(); assertEquals(EMAIL_PASSWORD_SIGN_IN_REQUEST.getEmail(), update.getSignIn().getEmail()); assertEquals(EMAIL_PASSWORD_SIGN_IN_REQUEST.getPassword(), update.getSignIn().getPassword()); assertEquals(TestConstants.PHONE, update.getPhoneUpdate()); <START> assertNull(update.getEmailUpdate()); <END> }</code><technical_language>Is worth checking call sessionUpdateService.updateParticipant()</technical_language>

Target:
public void updateIdentifiersWithPhone() throws Exception { mockPlayContextWithJson(PHONE_UPDATE); doReturn(session).when(controller).getAuthenticatedAndConsentedSession(); when(mockParticipantService.updateIdentifiers(eq(study), any(), any())).thenReturn(participant); Result result = controller.updateIdentifiers(); assertResult(result, 200); JsonNode node = BridgeObjectMapper.get().readTree(Helpers.contentAsString(result)); assertEquals(ID, node.get("id").textValue()); verify(mockParticipantService).updateIdentifiers(eq(study), contextCaptor.capture(), identifierUpdateCaptor.capture()); verify(mockCacheProvider).setUserSession(sessionCaptor.capture()); assertEquals(participant.getId(), sessionCaptor.getValue().getId()); IdentifierUpdate update = identifierUpdateCaptor.getValue(); assertEquals(EMAIL_PASSWORD_SIGN_IN_REQUEST.getEmail(), update.getSignIn().getEmail()); assertEquals(EMAIL_PASSWORD_SIGN_IN_REQUEST.getPassword(), update.getSignIn().getPassword()); assertEquals(TestConstants.PHONE, update.getPhoneUpdate()); assertNull(update.getEmailUpdate()); }
Source:
<code>public String getDisplayFileName() { if (displayName == null) { if(name != null) { if (version != null) { return name + ":" + version; } else { return name; } } else { return this.fileName; <START> } <END> } return this.displayName; }</code><technical_language>Minor suggestion/subjective: get rid of nesting like: java if (displayName != null) { return displayName; } if (name == null) { return fileName; } if (version == null) { return name; } return name + ":" + version;</technical_language>

Target:
public String getDisplayFileName() { if (displayName != null) { return displayName; } if (name == null) { return fileName; } if (version == null) { return name; } return name + ":" + version; }
Source:
<code>public String checkOutConnection(String host, Port port) throws IOException { return getHostPortPoolManager(host, port).checkOutConnection(); <START> } <END></code><technical_language>removed lines</technical_language>

Target:
public String checkOutConnection(String host, Port port) throws IOException { if (!isOpen) { throw new IllegalStateException("Connection Manager is closed"); } return getHostPortPoolManager(host, port).checkOutConnection(); }
Source:
<code>public void handlePort(HttpField field) { String port = getLeftMost(field.getValue()); if (StringUtil.isEmpty(port)) throw new IllegalArgumentException(field.getName() + " has empty value"); if (!getForwardedPortAsAuthority()) { if (_for == null) <START> _for = new PortSetHostPort(_request.getRemoteHost(), Integer.parseInt(port)); <END> else if (_for instanceof PossiblyPartialHostPort && _for.getPort() <= 0) _for = new HostPort(HostPort.normalizeHost(_for.getHost()), Integer.parseInt(port)); } else { if (_host == null) _host = new PortSetHostPort(_request.getServerName(), Integer.parseInt(port)); else if (_host instanceof PossiblyPartialHostPort && _host.getPort() <= 0) _host = new HostPort(HostPort.normalizeHost(_host.getHost()), Integer.parseInt(port)); } }</code><technical_language>add a new method called parsePort(String rawPort) Integer.parseInt() validates range of values sane (port >= 1 && port <= 65535)</technical_language>

Target:
public void handlePort(HttpField field) { int port = HostPort.parsePort(getLeftMost(field.getValue())); if (!getForwardedPortAsAuthority()) { if (_for == null) _for = new PortSetHostPort(_request.getRemoteHost(), port); else if (_for instanceof PossiblyPartialHostPort && _for.getPort() <= 0) _for = new HostPort(HostPort.normalizeHost(_for.getHost()), port); } else { if (_host == null) _host = new PortSetHostPort(_request.getServerName(), port); else if (_host instanceof PossiblyPartialHostPort && _host.getPort() <= 0) _host = new HostPort(HostPort.normalizeHost(_host.getHost()), port); } }
Source:
<code>public static SignedCertificateTimestamp decode(InputStream input) throws SerializationException { int version = SerializationUtils.readNumber(input, CTConstants.VERSION_LENGTH); if (version != CTConstants.SCT_VERSION_V1) { throw new SerializationException("Unsupported SCT version " + version); } try { return new SignedCertificateTimestamp( version, SerializationUtils.readFixedBytes(input, CTConstants.LOGID_LENGTH), SerializationUtils.readLong(input, CTConstants.TIMESTAMP_LENGTH), SerializationUtils.readVariableBytes(input, CTConstants.EXTENSIONS_LENGTH_BYTES), DigitallySigned.decode(input) ); <START> } catch (IllegalArgumentException e) { throw new SerializationException(e); } <END> }</code><technical_language>I suppose need catch this if thrown SeralizationUtils</technical_language>

Target:
public static SignedCertificateTimestamp decode(InputStream input) throws SerializationException { int version = SerializationUtils.readNumber(input, CTConstants.VERSION_LENGTH); if (version != CTConstants.SCT_VERSION_V1) { throw new SerializationException("Unsupported SCT version " + version); } return new SignedCertificateTimestamp( version, SerializationUtils.readFixedBytes(input, CTConstants.LOGID_LENGTH), SerializationUtils.readLong(input, CTConstants.TIMESTAMP_LENGTH), SerializationUtils.readVariableBytes(input, CTConstants.EXTENSIONS_LENGTH_BYTES), DigitallySigned.decode(input) ); }
Source:
<code>private Mono<Void> uploadBlocks(long fileSize, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions, AsynchronousFileChannel channel, BlockBlobAsyncClient client) { ProgressReceiver progressReceiver = parallelTransferOptions.getProgressReceiver(); AtomicLong totalProgress = new AtomicLong(); Lock progressLock = new ReentrantLock(); <START> final SortedMap<Long, String> blockIds = new TreeMap<>(); <END> return Flux.fromIterable(sliceFile(fileSize, parallelTransferOptions.getBlockSize())) .flatMap(chunk -> { String blockId = getBlockID(); blockIds.put(chunk.getOffset(), blockId); Flux<ByteBuffer> progressData = ProgressReporter.addParallelProgressReporting( FluxUtil.readFile(channel, chunk.getOffset(), chunk.getCount()), progressReceiver, progressLock, totalProgress); return client.stageBlockWithResponse(blockId, progressData, chunk.getCount(), accessConditions.getLeaseId()); }) .then(Mono.defer(() -> client.commitBlockListWithResponse( new ArrayList<>(blockIds.values()), headers, metadata, tier, accessConditions))) .then(); }</code><technical_language>this sorted? commit blocks. Is order important for committing blocks</technical_language>

Target:
private Mono<Void> uploadBlocks(long fileSize, ParallelTransferOptions parallelTransferOptions, BlobHttpHeaders headers, Map<String, String> metadata, AccessTier tier, BlobRequestConditions accessConditions, AsynchronousFileChannel channel, BlockBlobAsyncClient client) { final ParallelTransferOptions finalParallelTransferOptions = (parallelTransferOptions == null) ? new ParallelTransferOptions(null, null, null) : new ParallelTransferOptions(parallelTransferOptions.getBlockSize(), parallelTransferOptions.getNumBuffers(), parallelTransferOptions.getProgressReceiver()); final BlobRequestConditions finalRequestConditions = (accessConditions == null) ? new BlobRequestConditions() : accessConditions; ProgressReceiver progressReceiver = finalParallelTransferOptions.getProgressReceiver(); AtomicLong totalProgress = new AtomicLong(); Lock progressLock = new ReentrantLock(); final SortedMap<Long, String> blockIds = new TreeMap<>(); return Flux.fromIterable(sliceFile(fileSize, finalParallelTransferOptions.getBlockSize())) .flatMap(chunk -> { String blockId = getBlockID(); blockIds.put(chunk.getOffset(), blockId); Flux<ByteBuffer> progressData = ProgressReporter.addParallelProgressReporting( FluxUtil.readFile(channel, chunk.getOffset(), chunk.getCount()), progressReceiver, progressLock, totalProgress); return client.stageBlockWithResponse(blockId, progressData, chunk.getCount(), finalRequestConditions.getLeaseId()); }) .then(Mono.defer(() -> client.commitBlockListWithResponse( new ArrayList<>(blockIds.values()), headers, metadata, tier, finalRequestConditions))) .then(); }
Source:
<code>private static void proxyFields(FieldDecorator decorator, Object page, Class<?> proxyIn) { Field[] fields = proxyIn.getDeclaredFields(); for (Field field : fields) { int modifiers = field.getModifiers(); <START> if (Modifier.isFinal(modifiers) || Modifier.isStatic(modifiers)) <END> continue; Object value = decorator.decorate(page.getClass().getClassLoader(), field); if (value != null) { try { field.setAccessible(true); field.set(page, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } } }</code><technical_language>curly brackets good</technical_language>

Target:
private static void proxyFields(FieldDecorator decorator, Object page, Class<?> proxyIn) { Field[] fields = proxyIn.getDeclaredFields(); for (Field field : fields) { int modifiers = field.getModifiers(); if (Modifier.isFinal(modifiers) || Modifier.isStatic(modifiers)) { continue; } Object value = decorator.decorate(page.getClass().getClassLoader(), field); if (value != null) { try { field.setAccessible(true); field.set(page, value); } catch (IllegalAccessException e) { throw new RuntimeException(e); } } } }
Source:
<code>void removeChild(AttributeId attribute) { synchronized (this) { if (children == null) { throw new IllegalArgumentException("No child found : " + attribute); } AttributeNode<AttributeId> child = children.get(attribute); if (child == null) { throw new IllegalArgumentException("No child found : " + attribute); } if (child.refCount.decrementAndGet() == 0) { children.remove(attribute); if (children.isEmpty() && parent != null) { <START> parent.removeChild(attribute); <END> } } } }</code><technical_language>I I a bit worried locking in this class. this line a deadlock if 1 thread removes a child attribute resulting in remove attribute parent another thread adding removing a child atttribute parent</technical_language>

Target:
void removeChild(AttributeId attribute) { if (children == null) { throw new IllegalArgumentException("No child found : " + attribute); } AttributeNode<AttributeId> child = children.get(attribute); if (child == null) { throw new IllegalArgumentException("No child found : " + attribute); } if (--child.refCount == 0) { children.remove(attribute); if (children.isEmpty() && parent != null) { parent.removeChild(attribute); } } }
Source:
<code>public GlueHiveMetastore(HdfsEnvironment hdfsEnvironment, GlueHiveMetastoreConfig glueConfig, AWSGlueAsync glueClient) { this.hdfsEnvironment = requireNonNull(hdfsEnvironment, "hdfsEnvironment is null"); this.hdfsContext = new HdfsContext(new Identity(DEFAULT_METASTORE_USER, Optional.empty())); <START> this.glueClient = glueClient; <END> this.defaultDir = glueConfig.getDefaultWarehouseDir(); }</code><technical_language>Check for null</technical_language>

Target:
public GlueHiveMetastore(HdfsEnvironment hdfsEnvironment, GlueHiveMetastoreConfig glueConfig, AWSGlueAsync glueClient) { this.hdfsEnvironment = requireNonNull(hdfsEnvironment, "hdfsEnvironment is null"); this.hdfsContext = new HdfsContext(new Identity(DEFAULT_METASTORE_USER, Optional.empty())); this.glueClient = requireNonNull(glueClient, "glueClient is null"); this.defaultDir = glueConfig.getDefaultWarehouseDir(); }
Source:
<code>public Response getPurchaseOrder(@PathParam(PurapPropertyConstants.PURAP_DOC_ID) String purapDocumentIdentifier, @Context HttpHeaders headers) { try { HashMap<String, String> map = new HashMap<>(); map.put(PurapPropertyConstants.PURAP_DOC_ID, purapDocumentIdentifier); PurchaseOrderDocument poDoc = getLookupDao().findObjectByMap(PurchaseOrderDocument.class.newInstance(), map); <START> if (poDoc == null) { <END> return respondNotFound(); } String responseBody = serializePoDocumentToJson(poDoc); return Response.ok(responseBody).build(); } catch (Exception ex) { LOG.error(ex); return respondInternalServerError(ex); } }</code><technical_language>This ObjectUtils for null check</technical_language>

Target:
public Response getPurchaseOrder(@PathParam(PurapPropertyConstants.PURAP_DOC_ID) String purapDocumentIdentifier, @Context HttpHeaders headers) { try { HashMap<String, String> map = new HashMap<>(); map.put(PurapPropertyConstants.PURAP_DOC_ID, purapDocumentIdentifier); PurchaseOrderDocument poDoc = getLookupDao().findObjectByMap(PurchaseOrderDocument.class.newInstance(), map); if (ObjectUtils.isNull(poDoc)) { return respondNotFound(); } String responseBody = serializePoDocumentToJson(poDoc); return Response.ok(responseBody).build(); } catch (Exception ex) { LOG.error(ex); return respondInternalServerError(ex); } }
Source:
<code>public Exec createExec(String container, boolean detach, String... cmd) throws IOException { final List<Pair<String, ?>> headers = new ArrayList<>(2); <START> headers.add(Pair.of("Content-Type", "application/json")); <END> final ExecConfig execConfig = new ExecConfig().withCmd(cmd); if (!detach) { execConfig.withAttachStderr(true).withAttachStdout(true); } final String entity = JsonHelper.toJson(execConfig, FIRST_LETTER_LOWERCASE); headers.add(Pair.of("Content-Length", entity.getBytes().length)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/containers/" + container + "/exec") .headers(headers) .entity(entity)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (status / 100 != 2) { throw new DockerException(getDockerExceptionMessage(response), status); } return new Exec(cmd, parseResponseStreamAndClose(response.getInputStream(), ExecCreated.class).getId()); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }</code><technical_language>constant</technical_language>

Target:
public Exec createExec(String container, boolean detach, String... cmd) throws IOException { final ExecConfig execConfig = new ExecConfig().withCmd(cmd); if (!detach) { execConfig.withAttachStderr(true).withAttachStdout(true); } final List<Pair<String, ?>> headers = new ArrayList<>(2); final String entity = JsonHelper.toJson(execConfig, FIRST_LETTER_LOWERCASE); headers.add(Pair.of("Content-Type", MediaType.APPLICATION_JSON)); headers.add(Pair.of("Content-Length", entity.getBytes().length)); try (DockerConnection connection = openConnection(dockerDaemonUri).method("POST") .path("/containers/" + container + "/exec") .headers(headers) .entity(entity)) { final DockerResponse response = connection.request(); final int status = response.getStatus(); if (status / 100 != 2) { throw new DockerException(getDockerExceptionMessage(response), status); } return new Exec(cmd, parseResponseStreamAndClose(response.getInputStream(), ExecCreated.class).getId()); } catch (JsonParseException e) { throw new IOException(e.getLocalizedMessage(), e); } }
Source:
<code>public void create(final Budget b, final ApiCallback<Long> callback) { if (!hasInternet(callback)) <START> return; <END> RequestParams params = new RequestParams(); String startDate = b.getStartDate().toString(DATE_FORMAT); params.put("budget_name", b.getName()); params.put("amount", "" + b.getBudgetAmount()); params.put("recur", "" + b.isRecurring()); params.put("start_date", startDate); params.put("recurrence_duration", b.getDuration().toString()); client.post(budgetsUrl, params, new JsonHttpResponseHandler() { @Override public void onSuccess(JSONObject obj) { try { long id = obj.getLong("id"); b.setId(id); callback.onSuccess(id); } catch (JSONException e) { Log.e(TAG, e.getMessage()); callback.onFailure(e.getMessage()); } } @Override public void onFailure(Throwable t) { callback.onFailure(t.getMessage()); } @Override public void onFailure(Throwable e, String message) { if (e instanceof SocketTimeoutException) { callback.onFailure("Network Timeout"); } else { callback.onFailure("FAILURE"); } } }); }</code><technical_language>call failure callback return? right now, caller get notified of failure</technical_language>

Target:
public void create(final Budget b, final ApiCallback<Long> callback) { if (failOnNoInternet(callback)) return; RequestParams params = new RequestParams(); String startDate = b.getStartDate().toString(DATE_FORMAT); params.put("budget_name", b.getName()); params.put("amount", "" + b.getBudgetAmount()); params.put("recur", "" + b.isRecurring()); params.put("start_date", startDate); params.put("recurrence_duration", b.getDuration().toString()); client.post(budgetsUrl, params, new JsonHttpResponseHandler() { @Override public void onSuccess(JSONObject obj) { try { long id = obj.getLong("id"); b.setId(id); callback.onSuccess(id); } catch (JSONException e) { Log.e(TAG, e.getMessage()); callback.onFailure(e.getMessage()); } } @Override public void onFailure(Throwable t) { callback.onFailure(t.getMessage()); } @Override public void onFailure(Throwable e, String message) { if (e instanceof SocketTimeoutException) { callback.onFailure("Network Timeout"); } else { callback.onFailure("FAILURE"); } } }); }
Source:
<code>public static boolean isExpenseReportURI(String URI) { <START> if (StringUtils.isNotBlank(URI) && URI.contains(ConcurConstants.EXPENSE_REPORT_URI_INDICATOR)) { <END> return true; } return false; }</code><technical_language>return condtional</technical_language>

Target:
public static boolean isExpenseReportURI(String URI) { return StringUtils.isNotBlank(URI) && URI.contains(ConcurConstants.EXPENSE_REPORT_URI_INDICATOR); }
Source:
<code>public static List<Document> getAsList(final Observable<Document> observable) { <START> final CountDownLatch latch = new CountDownLatch(1); <END> final List<Document> queriedDocuments = new ArrayList<Document>(); observable.subscribe(new Observer<Document>() { @Override public void onCompleted() { latch.countDown(); } @Override public void onError(final Throwable e) { latch.countDown(); } @Override public void onNext(final Document next) { queriedDocuments.add(next); } }); try { latch.await(1, SECONDS); } catch (InterruptedException e) { throw new RuntimeException(); } return queriedDocuments; }</code><technical_language>simplified to: return observable.timeout(1, SECONDS).toList().toBlockingObservable().first();</technical_language>

Target:
public static List<Document> getAsList(final Observable<Document> observable) { return observable.timeout(1, SECONDS).toList().toBlockingObservable().last(); }
Source:
<code>public TfsCommand createCommand( ScmProviderRepository r, ScmFileSet f, String m ) { TfsCommand command = new TfsCommand( "checkin", r, f, getLogger() ); command.addArgument( "-noprompt" ); if ( m != null && !m.equals( "" ) ) { command.addArgument( "-comment:" + m + "" ); } command.addArgument( f ); TfsScmProviderRepository tfsScmProviderRepo = (TfsScmProviderRepository)r; <START> if(tfsScmProviderRepo.isUseCheckinPolicies()) <END> { String policiesFix = "/override:checkin_policy"; command.addArgument( policiesFix + ""); } return command; }</code><technical_language>missing spaces</technical_language>

Target:
public TfsCommand createCommand( ScmProviderRepository r, ScmFileSet f, String m ) { TfsCommand command = new TfsCommand( "checkin", r, f, getLogger() ); command.addArgument( "-noprompt" ); if ( m != null && !m.equals( "" ) ) { command.addArgument( "-comment:" + m + "" ); } command.addArgument( f ); TfsScmProviderRepository tfsScmProviderRepo = ( TfsScmProviderRepository )r; if( tfsScmProviderRepo.isUseCheckinPolicies() ) { command.addArgument( policiesArgument ); } return command; }
Source:
<code>public void testConnectionIsPooled() throws IOException{ TestCloudbigtableConnectionPool pool = new TestCloudbigtableConnectionPool(); Configuration config = new Configuration(); <START> PoolEntry entry = pool.getConnection(config, "key"); <END> pool.returnConnection(entry); for (int i = 0; i < 100; i++) { PoolEntry newEntry = pool.getConnection(config, "key"); assertSame(entry, newEntry); pool.returnConnection(newEntry); } }</code><technical_language>need line 50 51. If verify pool size, nice</technical_language>

Target:
public void testConnectionIsPooled() throws IOException{ TestCloudbigtableConnectionPool pool = new TestCloudbigtableConnectionPool(); PoolEntry entry = pool.getConnection(config, "key"); pool.returnConnection(entry); for (int i = 0; i < 100; i++) { PoolEntry newEntry = pool.getConnection(config, "key"); assertSame(entry, newEntry); pool.returnConnection(newEntry); } }
Source:
<code>public void testUseDriverManagerLoginTimout2() throws Exception { Properties props = new Properties(); props.setProperty("user", TestUtil.getUser()); props.setProperty("password", TestUtil.getPassword()); DriverManager.setLoginTimeout(5); props.setProperty("loginTimeout", "0"); Connection conn = DriverManager.getConnection(TestUtil.getURL(), props); conn.close(); <START> DriverManager.setLoginTimeout(0); <END> }</code><technical_language>above. Please add assertions</technical_language>

Target:
public void testUseDriverManagerLoginTimout2() throws Exception { Properties props = new Properties(); props.setProperty("user", TestUtil.getUser()); props.setProperty("password", TestUtil.getPassword()); DriverManager.setLoginTimeout(5); props.setProperty("loginTimeout", "10"); Connection conn = DriverManager.getConnection(TestUtil.getURL(), props); conn.close(); DriverManager.setLoginTimeout(0); }
Source:
<code>public static Collector<CurrencyAmount, ?, MultiCurrencyAmount> collector() { return Collector.<CurrencyAmount, Map<Currency, CurrencyAmount>, MultiCurrencyAmount>of( HashMap::new, (map, ca) -> map.merge(ArgChecker.notNull(ca, "amount").getCurrency(), ca, CurrencyAmount::plus), (map1, map2) -> { <START> map1.putAll(map2); <END> return map1; }, (map) -> new MultiCurrencyAmount(ImmutableSortedSet.copyOf(map.values())), UNORDERED); }</code><technical_language>I parallel usage is for time being, this attempting a merge handle case map contains USD 100 other USD 200. is overwrite</technical_language>

Target:
public static Collector<CurrencyAmount, ?, MultiCurrencyAmount> collector() { return Collector.<CurrencyAmount, Map<Currency, CurrencyAmount>, MultiCurrencyAmount>of( HashMap::new, (map, ca) -> map.merge(ArgChecker.notNull(ca, "amount").getCurrency(), ca, CurrencyAmount::plus), (map1, map2) -> { map2.values().forEach((ca2) -> map1.merge(ca2.getCurrency(), ca2, CurrencyAmount::plus)); return map1; }, map -> new MultiCurrencyAmount(ImmutableSortedSet.copyOf(map.values())), UNORDERED); }
Source:
<code>SplitKeyDelegatingTransactionService( Function<Long, T> timestampToServiceKey, Map<T, TransactionService> keyedServices) { this.timestampToServiceKey = timestampToServiceKey; this.keyedServices = keyedServices; <START> this.keyedAsyncServices = KeyedStream.stream(keyedServices) <END> .map(TransactionServices::synchronousAsAsyncTransactionService) .collectToMap(); }</code><technical_language>synchronous opposed async</technical_language>

Target:
SplitKeyDelegatingTransactionService( Function<Long, T> timestampToServiceKey, Map<T, TransactionService> keyedServices) { this.timestampToServiceKey = timestampToServiceKey; this.keyedServices = keyedServices; this.keyedSyncServices = KeyedStream.stream(keyedServices) .map(TransactionServices::synchronousAsAsyncTransactionService) .collectToMap(); }
Source:
<code><START> Rational(final int numerator, final int denominator) throws IllegalArgumentException { <END> if (denominator == 0) { throw new IllegalArgumentException("Denominator must not be zero."); } this.numerator = numerator; this.denominator = denominator; this.reduce(); this.ensureSignInNumerator(); }</code><technical_language>IllegalArgumentException is [unchecked exception](<LINK_0> declare in method signature</technical_language>

Target:
Rational(final int numerator, final int denominator) { if (denominator == 0) { throw new IllegalArgumentException("Denominator must not be zero."); } this.numerator = numerator; this.denominator = denominator; this.reduce(); this.ensureSignInNumerator(); }
Source:
<code><START> public void authenticate_shouldNotAuthenticateWithNullCredentials() { <END> Context.authenticate((AuthenticationScheme) null , null); }</code><technical_language>Is this testing credentials null credentials authentication scheme</technical_language>

Target:
public void authenticate_shouldNotAuthenticateWithNullCredentials() { Context.authenticate(new UsernamePasswordAuthenticationScheme(), null); }
Source:
<code><START> public List<Source> getSources() { <END> return sources; }</code><technical_language>mark @Nullable here</technical_language>

Target:
@Nullable public List<Source> getSources() { return sources; }
Source:
<code>public void showUploadInfo(){ launchAlertWithLink(getResources().getString(R.string.images_uploaded) ,getResources().getString(R.string.images_uploaded_explanation) <START> , "<LINK_0>" <END> , getResources().getString(R.string.read_more)); }</code><technical_language>Thanks @gerardolgvr , good hardcoded urls. final variables instead</technical_language>

Target:
public void showUploadInfo(){ launchAlertWithLink(getResources().getString(R.string.images_uploaded) ,getResources().getString(R.string.images_uploaded_explanation) , IMAGES_UPLOADED_URL , getResources().getString(R.string.read_more)); }
Source:
<code><START> double stringToTons(String value) { <END> value = value.toLowerCase().replaceAll(" ", "").replaceAll("(tons|ton)", "t"); double factor = 1; if (value.endsWith("t")) { value = value.substring(0, value.length() - 1); } else if (value.endsWith("lbs")) { value = value.substring(0, value.length() - 3); factor = 0.00045359237; } return Double.parseDouble(value) * factor; }</code><technical_language>consider other measurement units, kg</technical_language>

Target:
public static double stringToTons(String value) { value = value.toLowerCase().replaceAll(" ", "").replaceAll("(tons|ton)", "t"); value = value.replace("mgw", "").trim(); double factor = 1; if (value.endsWith("t")) { value = value.substring(0, value.length() - 1); } else if (value.endsWith("lbs")) { value = value.substring(0, value.length() - 3); factor = 0.00045359237; } return Double.parseDouble(value) * factor; }
Source:
<code>String prepare(String name, Map<String, Map<String, String>> domain) { StringBuilder builder = new StringBuilder(name); while (domain.containsKey(name)) { <START> builder.append("~"); <END> } domain.put(builder.toString(), new LinkedHashMap<>()); return builder.toString(); }</code><technical_language>a couple of thousand times slower :-) Keys rarely overlap in this domain creating a StringBuilder initialization cost is amortized</technical_language>

Target:
String prepare(String name, Map<String, Map<String, String>> domain) { StringBuilder builder = new StringBuilder(name); while (domain.containsKey(name)) { builder.append("~"); } String val = builder.toString(); domain.put(val, new LinkedHashMap<>()); return val; }
Source:
<code>private boolean checkSummon(CommandSender sender, String type) { if (type == null) { return false; } EntityType entityType = EntityType.fromName(type); if (sender != null) sender.sendMessage(type + " == null: " + (entityType == null) + "!"); if (entityType != null && !EntityType.fromName(type).isSpawnable()) { if (sender != null) sender.sendMessage(ChatColor.RED + "The entity '" + EntityType.fromName(type).getName() + "' cannot be summoned."); return false; } if (entityType != null && EntityRegistry.getEntity(entityType) == null) { if (sender != null) sender.sendMessage(ChatColor.RED + "The entity '" + entityType.getName() + "' is not implemented yet."); return false; } else if (entityType == null && !EntityRegistry.isCustomEntityRegistered(type)) { if (sender != null) <START> sender.sendMessage(ChatColor.RED + "The entity '" + type + "' is does not exist."); <END> return false; } return true; }</code><technical_language>"is exist" - typo, bad</technical_language>

Target:
private boolean checkSummon(CommandSender sender, String type) { if (type == null) { return false; } EntityType entityType = EntityType.fromName(type); if (sender != null) sender.sendMessage(type + " == null: " + (entityType == null) + "!"); if (entityType != null && !EntityType.fromName(type).isSpawnable()) { if (sender != null) sender.sendMessage(ChatColor.RED + "The entity '" + EntityType.fromName(type).getName() + "' cannot be summoned."); return false; } if (entityType != null && EntityRegistry.getEntity(entityType) == null) { if (sender != null) sender.sendMessage(ChatColor.RED + "The entity '" + entityType.getName() + "' is not implemented yet."); return false; } else if (entityType == null && !EntityRegistry.isCustomEntityRegistered(type)) { if (sender != null) sender.sendMessage(ChatColor.RED + "The entity '" + type + "' does not exist."); return false; } return true; }
Source:
<code>public void beforeTestSnapshot() throws Exception { cleanPersistenceDir(); dfltCacheCfg = txCacheConfig(new CacheConfiguration<>(DEFAULT_CACHE_NAME)); <START> persistence = true; <END> }</code><technical_language>This is unnecessary</technical_language>

Target:
public void beforeTestSnapshot() throws Exception { cleanPersistenceDir(); dfltCacheCfg = txCacheConfig(new CacheConfiguration<>(DEFAULT_CACHE_NAME)); }
Source:
<code>public void onMessage(final Message message) { try { LOGGER.debug("Received message: {}", message.getJMSMessageID()); } catch (final JMSException e) { LOGGER.error("Received unintelligible message: {}", e); propagate(e); } try { final String eventType = message.getStringProperty(EVENT_TYPE_HEADER_NAME); final String id = message.getStringProperty(IDENTIFIER_HEADER_NAME); final String baseURL = message.getStringProperty(BASE_URL_HEADER_NAME); LOGGER.debug("Discovered id: in message.", id); LOGGER.debug("Discovered event type: in message.", eventType); LOGGER.debug("Discovered baseURL: in message.", baseURL); LOGGER.debug("Discovered properties: in message.", message.getStringProperty(PROPERTIES_HEADER_NAME)); <START> index( baseURL, baseURL + id, eventType ); <END> } catch (final JMSException e) { LOGGER.error("Error processing JMS event!", e); } }</code><technical_language>parameters complicated redundant: baseURL baseURL + id</technical_language>

Target:
public void onMessage(final Message message) { try { LOGGER.debug("Received message: {}", message.getJMSMessageID()); } catch (final JMSException e) { LOGGER.error("Received unintelligible message: {}", e); propagate(e); } try { final String eventType = message.getStringProperty(EVENT_TYPE_HEADER_NAME); final String id = message.getStringProperty(IDENTIFIER_HEADER_NAME); String baseURL = message.getStringProperty(BASE_URL_HEADER_NAME); LOGGER.debug("Discovered id: in message.", id); LOGGER.debug("Discovered event type: in message.", eventType); LOGGER.debug("Discovered baseURL: in message.", baseURL); LOGGER.debug("Discovered properties: in message.", message.getStringProperty(PROPERTIES_HEADER_NAME)); while (!Strings.isNullOrEmpty(baseURL) && baseURL.endsWith("/")) { baseURL = baseURL.substring(0, baseURL.length() - 1); } index( baseURL, id, eventType ); } catch (final JMSException e) { LOGGER.error("Error processing JMS event!", e); } }
Source:
<code>public void registerNavDrawerItems(final Activity activity, ContextMenuAdapter adapter) { PackageManager pm = activity.getPackageManager(); for (Map.Entry<String, List<NavDrawerItem>> entry : getNavDrawerItems().entrySet()) { String appPackage = entry.getKey(); for (NavDrawerItem item : entry.getValue()) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(item.uri)); <START> boolean isCopy = false; <END> if (intent.resolveActivity(pm) == null) { intent = pm.getLaunchIntentForPackage(appPackage); } if (intent != null) { if (item.flags != -1) { intent.addFlags(item.flags); } final Intent finalIntent = intent; for (String s : adapter.getItemNames()) { if (item.name.equals(s)) { isCopy = true; } } if (!isCopy) { adapter.addItem(new ContextMenuItem.ItemBuilder() .setId(item.getId()) .setTitle(item.name) .setIcon(getIconId(item.iconName)) .setListener(new ContextMenuAdapter.ItemClickListener() { @Override public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) { activity.startActivity(finalIntent); return true; } }) .createItem()); } } } } }</code><technical_language>api limit items displayed names. fixed result, source of issue. wrong telegram side</technical_language>

Target:
public void registerNavDrawerItems(final Activity activity, ContextMenuAdapter adapter) { PackageManager pm = activity.getPackageManager(); for (Map.Entry<String, List<NavDrawerItem>> entry : getNavDrawerItems().entrySet()) { String appPackage = entry.getKey(); for (NavDrawerItem item : entry.getValue()) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(item.uri)); if (intent.resolveActivity(pm) == null) { intent = pm.getLaunchIntentForPackage(appPackage); } if (intent != null) { if (item.flags != -1) { intent.addFlags(item.flags); } final Intent finalIntent = intent; adapter.addItem(new ContextMenuItem.ItemBuilder() .setId(item.getId()) .setTitle(item.name) .setIcon(getIconId(item.iconName)) .setListener(new ContextMenuAdapter.ItemClickListener() { @Override public boolean onContextMenuClick(ArrayAdapter<ContextMenuItem> adapter, int itemId, int position, boolean isChecked, int[] viewCoordinates) { activity.startActivity(finalIntent); return true; } }) .createItem()); } } } }
Source:
<code>public PeriodGranularity( @JsonProperty("period") Period period, @JsonProperty("origin") DateTime origin, @JsonProperty("timeZone") DateTimeZone tz ) { <START> this.period = period; <END> Preconditions.checkArgument(!Period.ZERO.equals(period), "zero period is not acceptable in QueryGranularity!"); this.chronology = tz == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(tz); if(origin == null) { this.origin = new DateTime(0, DateTimeZone.UTC).withZoneRetainFields(chronology.getZone()).getMillis(); this.hasOrigin = false; } else { this.origin = origin.getMillis(); this.hasOrigin = true; } this.isCompound = isCompoundPeriod(period); }</code><technical_language>toss this.period = Preconditions.checkNotNull(period, "period"); while here</technical_language>

Target:
public PeriodGranularity( @JsonProperty("period") Period period, @JsonProperty("origin") DateTime origin, @JsonProperty("timeZone") DateTimeZone tz ) { this.period = Preconditions.checkNotNull(period, "period can't be null!"); Preconditions.checkArgument(!Period.ZERO.equals(period), "zero period is not acceptable in QueryGranularity!"); this.chronology = tz == null ? ISOChronology.getInstanceUTC() : ISOChronology.getInstance(tz); if(origin == null) { this.origin = new DateTime(0, DateTimeZone.UTC).withZoneRetainFields(chronology.getZone()).getMillis(); this.hasOrigin = false; } else { this.origin = origin.getMillis(); this.hasOrigin = true; } this.isCompound = isCompoundPeriod(period); }
Source:
<code>public Mono<ImmutabilityPolicyInner> deleteImmutabilityPolicyAsync( String resourceGroupName, String accountName, String containerName) { <START> return deleteImmutabilityPolicyAsync(resourceGroupName, accountName, containerName); <END> }</code><technical_language>Is deadlock in this recursive function</technical_language>

Target:
public Mono<Void> deleteImmutabilityPolicyAsync( String resourceGroupName, String accountName, String containerName) { return deleteImmutabilityPolicyAsync(resourceGroupName, accountName, containerName, null); }
Source:
<code><START> public void checkWhitespaceAroundColon(TypeAnnotationContext ctx) { <END> TerminalNodeImpl colon = (TerminalNodeImpl) ctx.getChild(0); ParseTree parentLeftSibling = ParseTreeUtil.getLeftSibling(colon.getParent()); ParseTree rightSibling = ctx.getChild(1); if (parentLeftSibling == null || rightSibling == null) { return; } Token left = parentLeftSibling instanceof ParserRuleContext ? ((ParserRuleContext) parentLeftSibling).getStop() : ((TerminalNodeImpl) parentLeftSibling).getSymbol(); Token right = rightSibling instanceof ParserRuleContext ? ((ParserRuleContext) rightSibling).getStart() : ((TerminalNodeImpl) rightSibling).getSymbol(); Token colonToken = colon.getSymbol(); if (colonToken.getLine() == left.getLine() && colonToken.getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(left) != 1) { printer.error(Messages.COLON + Messages.NO_SPACE_BEFORE, ListenerUtil.getTokenLocation(colonToken)); } if (right.getLine() == colonToken.getLine() && right.getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(colonToken) != 2) { printer.error(Messages.COLON + Messages.SPACE_AFTER, ListenerUtil.getTokenLocation(colonToken)); } }</code><technical_language>Remove public access modifier method package-private</technical_language>

Target:
void checkWhitespaceAroundColon(TypeAnnotationContext ctx) { TerminalNodeImpl colon = (TerminalNodeImpl) ctx.getChild(0); ParseTree parentLeftSibling = ParseTreeUtil.getLeftSibling(colon.getParent()); ParseTree rightSibling = ctx.getChild(1); assert !(parentLeftSibling == null || rightSibling == null); Token left = parentLeftSibling instanceof ParserRuleContext ? ((ParserRuleContext) parentLeftSibling).getStop() : ((TerminalNodeImpl) parentLeftSibling).getSymbol(); Token right = rightSibling instanceof ParserRuleContext ? ((ParserRuleContext) rightSibling).getStart() : ((TerminalNodeImpl) rightSibling).getSymbol(); Token colonToken = colon.getSymbol(); if (colonToken.getLine() == left.getLine() && colonToken.getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(left) != 1) { printer.error(Messages.COLON + Messages.NO_SPACE_BEFORE, ListenerUtil.getTokenLocation(colonToken)); } if (right.getLine() == colonToken.getLine() && right.getCharPositionInLine() - ListenerUtil.getLastCharPositionInLine(colonToken) != 2) { printer.error(Messages.COLON + Messages.SPACE_AFTER, ListenerUtil.getTokenLocation(colonToken)); } }
Source:
<code>public void onBrowserEvent(Context context, Element parent, GlusterVolumeEntity volume, SafeHtml tooltipContent, NativeEvent event, ValueUpdater<GlusterVolumeEntity> valueUpdater) { VolumeStatus status = GlusterVolumeUtils.getVolumeStatus(volume); if (BrowserEvents.CLICK.equals(event.getType()) && onClickCommand != null && (status == VolumeStatus.ALL_BRICKS_DOWN || status == VolumeStatus.SOME_BRICKS_DOWN)) { onClickCommand.execute(); } else { <START> super.onBrowserEvent(context, parent, volume, tooltipContent, event, valueUpdater); <END> } }</code><technical_language>I call super.onBrowserEvent, click do in super class well</technical_language>

Target:
public void onBrowserEvent(Context context, Element parent, GlusterVolumeEntity volume, SafeHtml tooltipContent, NativeEvent event, ValueUpdater<GlusterVolumeEntity> valueUpdater) { super.onBrowserEvent(context, parent, volume, tooltipContent, event, valueUpdater); VolumeStatus status = GlusterVolumeUtils.getVolumeStatus(volume); if (BrowserEvents.CLICK.equals(event.getType()) && onClickCommand != null && (status == VolumeStatus.ALL_BRICKS_DOWN || status == VolumeStatus.SOME_BRICKS_DOWN)) { onClickCommand.execute(); } }
Source:
<code>default void updateServletContextHandler(ServletContextHandler servletContextHandler) { <START> ServletHolder jerseyServlet = servletContextHandler.addServlet(ServletContainer.class, "/swagger"); <END> jerseyServlet.setInitOrder(0); jerseyServlet.setInitParameter("jersey.config.server.provider.packages", "com.yahoo.elide.contrib.swagger.resources"); jerseyServlet.setInitParameter("javax.ws.rs.Application", ElideResourceConfig.class.getCanonicalName()); }</code><technical_language>do this in core code extension point. optionally configure JSON-API GraphQL. Swagger similar</technical_language>

Target:
default void updateServletContextHandler(ServletContextHandler servletContextHandler) { }
Source:
<code>public static String getAmazonS3InitParams(final ImmutableMap<String, String> requiredArgs) { if (requiredArgs.containsKey("bucketName")) { if (requiredArgs.containsKey("objectName")) { return "const char* bucket_name, const char* object_name"; <START> } else { <END> return "const char* bucket_name"; } } return "void"; }</code><technical_language>need for else</technical_language>

Target:
public static String getAmazonS3InitParams(final ImmutableMap<String, String> requiredArgs) { if (!requiredArgs.containsKey("bucketName")) { return "void"; } else if (requiredArgs.containsKey("objectName")) { return "const char* bucket_name, const char* object_name"; } return "const char* bucket_name"; }
Source:
<code>private void setupFocusHandling() { focusListener = new IWindowListener() { public void windowOpened(IWorkbenchWindow window) { } public void windowDeactivated(IWorkbenchWindow window) { } public void windowClosed(IWorkbenchWindow window) { } public void windowActivated(IWorkbenchWindow window) { if (rcs.doReschedule) rcs.schedule(); <START> refreshJob.schedule(); <END> } }; PlatformUI.getWorkbench().addWindowListener(focusListener); }</code><technical_language>is listener needed? RepositoryChangeScanner Job reschedules workbench window is active. ResourceRefreshJob is scheduled indexChanged Event</technical_language>

Target:
private void setupFocusHandling() { focusListener = new IWindowListener() { public void windowOpened(IWorkbenchWindow window) { } public void windowDeactivated(IWorkbenchWindow window) { } public void windowClosed(IWorkbenchWindow window) { } public void windowActivated(IWorkbenchWindow window) { if (rcs.doReschedule) rcs.schedule(); refreshJob.triggerRefresh(); } }; PlatformUI.getWorkbench().addWindowListener(focusListener); }
Source:
<code>protected boolean isDragEnabled() { if (getScoutObject() != null) { return getScoutObject().isDragEnabled(); } else { <START> return false; <END> } }</code><technical_language>omit explicit else-case "return false" instead</technical_language>

Target:
protected boolean isDragEnabled() { if (getScoutObject() != null) { return getScoutObject().isDragEnabled(); } return false; }
Source:
<code>public void refreshTestData() { super.prepareTestData(); dataBundle = getTypicalDataBundle(); <START> removeAndRestoreTypicalDataBundle(); <END> }</code><technical_language>lines unnecessary</technical_language>

Target:
public void refreshTestData() { super.prepareTestData(); }
Source:
<code>public boolean isDefaultOrEmptyAccessibilityDelegateCompat() { return (this.getClass().equals(AccessibilityDelegateCompat.class) <START> && mOriginalDelegate.getClass().equals(AccessibilityDelegate.class)) <END> || mOriginalDelegate == null; }</code><technical_language>platform set accessibilityDelegate default</technical_language>

Target:
public boolean isDefaultOrEmptyAccessibilityDelegateCompat() { return mOriginalDelegate == null || (this.getClass().equals(AccessibilityDelegateCompat.class) && mOriginalDelegate.getClass().equals(AccessibilityDelegate.class)); }