auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> protected int createGammaId() throws OseeCoreException { <END> if (artifact.isUseBackingdata()) { return artifact.getGammaId(); } return ConnectionHandler.getSequence().getNextGammaId(); }</code><technical_language>a single return</technical_language>

Target:
protected int createGammaId() throws OseeCoreException { return artifact.isUseBackingdata() ? artifact.getGammaId() : ConnectionHandler.getSequence().getNextGammaId(); }
Source:
<code>public FormValidation doCheck(@AncestorInPath AbstractProject project, @QueryParameter String value) { <START> if (project == null) return FormValidation.ok(); <END> if(!project.hasPermission(Item.CONFIGURE)) return FormValidation.ok(); StringTokenizer tokens = new StringTokenizer(Util.fixNull(value),","); boolean hasProjects = false; while(tokens.hasMoreTokens()) { String projectName = tokens.nextToken().trim(); if (StringUtils.isNotBlank(projectName)) { Item item = Jenkins.getInstance().getItem(projectName,project,Item.class); if (item == null) { AbstractProject nearest = AbstractProject.findNearest(projectName,project.getParent()); String alternative = nearest != null ? nearest.getRelativeNameFrom(project) : "?"; return FormValidation.error(Messages.BuildTrigger_NoSuchProject(projectName, alternative)); } if(!(item instanceof AbstractProject)) return FormValidation.error(Messages.BuildTrigger_NotBuildable(projectName)); Authentication auth = Tasks.getAuthenticationOf(project); if (auth.equals(ACL.SYSTEM) && !QueueItemAuthenticatorConfiguration.get().getAuthenticators().isEmpty()) { auth = Jenkins.ANONYMOUS; } if (!item.getACL().hasPermission(auth, Item.BUILD)) { return FormValidation.error(Messages.BuildTrigger_you_have_no_permission_to_build_(projectName)); } hasProjects = true; } } if (!hasProjects) { return FormValidation.error(Messages.BuildTrigger_NoProjectSpecified()); } return FormValidation.ok(); }</code><technical_language>I return a warning (as for permission check case below)</technical_language>

Target:
public FormValidation doCheck(@AncestorInPath AbstractProject project, @QueryParameter String value) { if (project == null) return FormValidation.ok(Messages.BuildTrigger_ok_ancestor_is_null()); if(!project.hasPermission(Item.CONFIGURE)) return FormValidation.ok(); StringTokenizer tokens = new StringTokenizer(Util.fixNull(value),","); boolean hasProjects = false; while(tokens.hasMoreTokens()) { String projectName = tokens.nextToken().trim(); if (StringUtils.isNotBlank(projectName)) { Item item = Jenkins.getInstance().getItem(projectName,project,Item.class); if (item == null) { AbstractProject nearest = AbstractProject.findNearest(projectName,project.getParent()); String alternative = nearest != null ? nearest.getRelativeNameFrom(project) : "?"; return FormValidation.error(Messages.BuildTrigger_NoSuchProject(projectName, alternative)); } if(!(item instanceof AbstractProject)) return FormValidation.error(Messages.BuildTrigger_NotBuildable(projectName)); Authentication auth = Tasks.getAuthenticationOf(project); if (auth.equals(ACL.SYSTEM) && !QueueItemAuthenticatorConfiguration.get().getAuthenticators().isEmpty()) { auth = Jenkins.ANONYMOUS; } if (!item.getACL().hasPermission(auth, Item.BUILD)) { return FormValidation.error(Messages.BuildTrigger_you_have_no_permission_to_build_(projectName)); } hasProjects = true; } } if (!hasProjects) { return FormValidation.error(Messages.BuildTrigger_NoProjectSpecified()); } return FormValidation.ok(); }
Source:
<code><START> public void useEqualsWhenTrueThenCustomMediaTypeIsMatched() throws HttpMediaTypeNotAcceptableException { <END> request.addHeader("Accept", "text/unique"); matcher = new MediaTypeRequestMatcher(new MediaType("text", "unique")); matcher.setUseEquals(true); assertThat(matcher.matches(request)).isTrue(); }</code><technical_language>A number of tests throw HttpMediaTypeNotAcceptableException. please remove throws signature is unnecessary? This way, expectations of test clearer</technical_language>

Target:
public void useEqualsWhenTrueThenCustomMediaTypeIsMatched() { request.addHeader("Accept", "text/unique"); matcher = new MediaTypeRequestMatcher(new MediaType("text", "unique")); matcher.setUseEquals(true); assertThat(matcher.matches(request)).isTrue(); }
Source:
<code>public void compute(final A[] input, final A[] output) { ops().run(ChunkerInterleaved.class, new Chunk() { @Override public void execute(long startIndex, final int stepSize, final long numSteps) { <START> int i = (int)startIndex; <END> int ctr = 0; while (ctr < numSteps) { output[i] = input[i]; i += stepSize; ctr++; } } }, input.length); }</code><technical_language>is a method org.scijava.util.ArrayUtils.safeMultiply32(long...) downcast a long (or product of multiple longs) int safely. fails fast if downcast overflow</technical_language>

Target:
public void compute(final A[] input, final A[] output) { ops().run(ChunkerInterleaved.class, new Chunk() { @Override public void execute(long startIndex, final long stepSize, final long numSteps) { int i = startIndex==0 ? 0 : ArrayUtils.safeMultiply32(startIndex); int stepSizeSafe32 = stepSize == 0 ? 0 : ArrayUtils.safeMultiply32(stepSize); int ctr = 0; while (ctr < numSteps) { output[i] = input[i]; i += stepSizeSafe32; ctr++; } } }, input.length); }
Source:
<code>private void getUserCredentials() { repoSelector.setDisable(true); new LoginDialog(mainStage, columns).show().thenApply(success -> { if (success) { browserComponent.initialise(); setExpandedWidth(false); columns.loadIssues(); triggerEvent(new LoginEvent()); repoSelector.setDisable(false); repoSelector.refreshComboBoxContents(ServiceManager.getInstance().getRepoId().generateId()); triggerEvent(new BoardSavedEvent()); <START> getMenuControl().scrollTo(columns.getCurrentlySelectedColumn().get(), columns.getChildren().size()); <END> } else { quit(); } return true; }).exceptionally(e -> { logger.error(e.getLocalizedMessage(), e); return false; }); }</code><technical_language>a selected column this point. check columns.getCurrentlySelectedColumn().isPresent(), assert it</technical_language>

Target:
private void getUserCredentials() { repoSelector.setDisable(true); new LoginDialog(mainStage, columns).show().thenApply(success -> { if (success) { browserComponent.initialise(); setExpandedWidth(false); columns.loadIssues(); triggerEvent(new LoginEvent()); repoSelector.setDisable(false); repoSelector.refreshComboBoxContents(ServiceManager.getInstance().getRepoId().generateId()); triggerEvent(new BoardSavedEvent()); if(columns.getCurrentlySelectedColumn().isPresent()) { getMenuControl().scrollTo(columns.getCurrentlySelectedColumn().get(), columns.getChildren().size()); } } else { quit(); } return true; }).exceptionally(e -> { logger.error(e.getLocalizedMessage(), e); return false; }); }
Source:
<code>public Result close() throws IOException { try { if (commitStep > 1 && commitCounter > 0 && connection != null && statement != null) { <START> cleanWrites(); <END> connection.commit(); connection.setAutoCommit(true); commitCounter = 0; } if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } sink.closeConnection(container, connection); } catch (SQLException e) { throw new IOException(e); } return result; }</code><technical_language>Please clean in case</technical_language>

Target:
public Result close() throws IOException { try { cleanWrites(); if (commitStep > 1 && commitCounter > 0 && connection != null && statement != null) { connection.commit(); connection.setAutoCommit(true); commitCounter = 0; } if (rs != null) { rs.close(); } if (statement != null) { statement.close(); } sink.closeConnection(container, connection); } catch (SQLException e) { throw new IOException(e); } return result; }
Source:
<code>@Override public IgniteFuture<?> addData(K key, V val) { <START> if (closedStreamer) <END> throw new IllegalStateException("Data streamer has been closed.", cancellationReason); A.notNull(key, "key"); if (val == null) checkSecurityPermission(SecurityPermission.CACHE_REMOVE); else checkSecurityPermission(SecurityPermission.CACHE_PUT); KeyCacheObject key0 = cacheObjProc.toCacheKeyObject(cacheObjCtx, null, key, true); CacheObject val0 = cacheObjProc.toCacheObject(cacheObjCtx, val, true); DataStreamerEntry entry = new DataStreamerEntry(key0, val0); IgniteCacheFutureImpl fut = null; enterBusy(); try { long threadId = Thread.currentThread().getId(); bufMapReadLock.lock(); try { if (!threadBufMap.containsKey(threadId)) { IgniteCacheFutureImpl futPerThread = new IgniteCacheFutureImpl(new GridFutureAdapter()); List<DataStreamerEntry> entriesPerThread = new ArrayList<>(bufLdrSizePerThread); futPerThread.internalFuture().listen(rmvActiveFut); activeFuts.add(futPerThread.internalFuture()); threadBufMap.put(threadId, new IgniteBiTuple(futPerThread, entriesPerThread)); } IgniteBiTuple<IgniteCacheFutureImpl, List<DataStreamerEntry>> futBufPair = threadBufMap.get(threadId); fut = futBufPair.get1(); Collection<DataStreamerEntry> entries = futBufPair.get2(); entries.add(entry); if (entries.size() == bufLdrSizePerThread) { loadData(entries, fut); threadBufMap.remove(threadId); } return fut; } finally { bufMapReadLock.unlock(); } } catch (Throwable e) { if (fut == null) throw e; GridFutureAdapter internalFut = (GridFutureAdapter) fut.internalFuture(); internalFut.onDone(e); if (e instanceof Error || e instanceof IgniteDataStreamerTimeoutException) throw e; return fut; } finally { leaveBusy(); } }</code><technical_language>check closedStreamer flag lock acquiring</technical_language>

Target:
@Override public IgniteFuture<?> addData(K key, V val) { A.notNull(key, "key"); if (val == null) checkSecurityPermission(SecurityPermission.CACHE_REMOVE); else checkSecurityPermission(SecurityPermission.CACHE_PUT); KeyCacheObject key0 = cacheObjProc.toCacheKeyObject(cacheObjCtx, null, key, true); CacheObject val0 = cacheObjProc.toCacheObject(cacheObjCtx, val, true); return addDataInternal(Collections.singleton(new DataStreamerEntry(key0, val0))); }
Source:
<code>public void testExceptionStoredOnCallingUncaughtException() { assertTrue(sharedPreferences.getString(EXCEPTION_FOR_REPORT, "").isEmpty()); <START> new BaseExceptionHandler().uncaughtExceptionTest(new RuntimeException("Test Error")); <END> assertFalse(sharedPreferences.getString(EXCEPTION_FOR_REPORT, "").isEmpty()); }</code><technical_language>test uncaughtException need call :wink: with. if need a hint</technical_language>

Target:
public void testExceptionStoredOnCallingUncaughtException() { assertTrue(sharedPreferences.getString(EXCEPTION_FOR_REPORT, "").isEmpty()); BaseExceptionHandler baseExceptionHandler = new BaseExceptionHandler() { @Override protected void exit() { } }; baseExceptionHandler.uncaughtException(null, new RuntimeException("Test Error")); assertFalse(sharedPreferences.getString(EXCEPTION_FOR_REPORT, "").isEmpty()); }
Source:
<code>private AbstractFile getAbstractFile(String file) { Path path = Paths.get(file); String fileName = path.getFileName().toString(); String filePath = path.getParent().toString().replaceAll("\\\\", "/"); if (filePath.endsWith("/") == false) { filePath += "/"; } if (previousFile != null && previousFile.getName().equalsIgnoreCase(fileName) && previousFile.getParentPath().equalsIgnoreCase(filePath)) { return previousFile; } try { List<AbstractFile> abstractFiles = fileManager.findFiles(fileName, filePath); if (abstractFiles.size() == 1) { return abstractFiles.get(0); } for (AbstractFile resolvedFile : abstractFiles) { <START> if (filePath.toLowerCase().matches(resolvedFile.getParentPath().toLowerCase())) { <END> previousFile = resolvedFile; return resolvedFile; } } } catch (TskCoreException ex) { logger.log(Level.WARNING, Bundle.PlasoIngestModule_exception_find_file(), ex); } return null; }</code><technical_language>matches()? is regex invlolved. equalsIgnoreCase()</technical_language>

Target:
private AbstractFile getAbstractFile(String file) { Path path = Paths.get(file); String fileName = path.getFileName().toString(); String filePath = path.getParent().toString().replaceAll("\\\\", "/"); if (filePath.endsWith("/") == false) { filePath += "/"; } if (previousFile != null && previousFile.getName().equalsIgnoreCase(fileName) && previousFile.getParentPath().equalsIgnoreCase(filePath)) { return previousFile; } try { List<AbstractFile> abstractFiles = fileManager.findFiles(fileName, filePath); if (abstractFiles.size() == 1) { return abstractFiles.get(0); } for (AbstractFile resolvedFile : abstractFiles) { if (filePath.equalsIgnoreCase(resolvedFile.getParentPath())) { previousFile = resolvedFile; return resolvedFile; } } } catch (TskCoreException ex) { logger.log(Level.WARNING, Bundle.PlasoIngestModule_exception_find_file(), ex); } return null; }
Source:
<code>public KeycloakDeployment resolve(final HttpFacade.Request request) { Assert.requireNonNull(request, "request"); final String realmName = Optional.ofNullable(request.getHeader(REALM_NAME_HEADER)). orElse(configuration.getRealmName()); final String applicationName = Optional.ofNullable(request.getHeader(APPLICATION_NAME_HEADER)). orElse(configuration.getApplicationName()); final String authEndPoint = configuration.getAuthEndpoint(); Optional.ofNullable(realmName).orElseThrow(() -> new SecurityException("Realm name for security check is not configured!")); Optional.ofNullable(applicationName).orElseThrow(() -> new SecurityException("Application name for security check is not configured!")); Optional.ofNullable(authEndPoint).orElseThrow(() -> new SecurityException("Auth endpoint for security check is not configured!")); final AdapterConfig adapterConfig = new AdapterConfig(); if(isRealmExist(realmName)){ adapterConfig.setRealm(realmName); }else{ <START> throw new SecurityException("Access Denied"); <END> } adapterConfig.setResource(applicationName); adapterConfig.setAuthServerUrl(authEndPoint); Optional.ofNullable(request.getHeader(BEARER_ONLY_HEADER)). ifPresent(v -> adapterConfig.setBearerOnly(true)); return KeycloakDeploymentBuilder.build(adapterConfig); }</code><technical_language>add some more info "Access Denied! realm is in allowed realms"</technical_language>

Target:
public KeycloakDeployment resolve(final HttpFacade.Request request) { Assert.requireNonNull(request, "request"); final String realmName = Optional.ofNullable(request.getHeader(REALM_NAME_HEADER)). orElse(configuration.getRealmName()); final String applicationName = Optional.ofNullable(request.getHeader(APPLICATION_NAME_HEADER)). orElse(configuration.getApplicationName()); final String authEndPoint = configuration.getAuthEndpoint(); Optional.ofNullable(realmName).orElseThrow(() -> new SecurityException("Realm name for security check is not configured!")); Optional.ofNullable(applicationName).orElseThrow(() -> new SecurityException("Application name for security check is not configured!")); Optional.ofNullable(authEndPoint).orElseThrow(() -> new SecurityException("Auth endpoint for security check is not configured!")); final AdapterConfig adapterConfig = new AdapterConfig(); if(isRealmAllowed(realmName)){ adapterConfig.setRealm(realmName); }else{ throw new SecurityException("Access Denied! The given realm is not in the allowed realms."); } adapterConfig.setResource(applicationName); adapterConfig.setAuthServerUrl(authEndPoint); Optional.ofNullable(request.getHeader(BEARER_ONLY_HEADER)). ifPresent(v -> adapterConfig.setBearerOnly(true)); return KeycloakDeploymentBuilder.build(adapterConfig); }
Source:
<code>public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { op = ExtUtil.readInt(in); readExpressions(in, pf); <START> computedCacheability = ExtUtil.readBool(in); <END> exprIsCacheable = ExtUtil.readBool(in); computedContextTypes = ExtUtil.readBool(in); contextRefIsRelevant = ExtUtil.readBool(in); originalContextRefIsRelevant = ExtUtil.readBool(in); }</code><technical_language>repeated frequently, is pretty dangerous for making updates later. storing flags (and relevant serialization code) in a composed member object safer save "do repeat effort"</technical_language>

Target:
public void readExternal(DataInputStream in, PrototypeFactory pf) throws IOException, DeserializationException { op = ExtUtil.readInt(in); readExpressions(in, pf); cacheState = (CacheableExprState)ExtUtil.read(in, CacheableExprState.class, pf); }
Source:
<code>Object[][] samFilesforFingerprinting() { return new Object[][]{ <START> new Object[]{"NA12891.over.fingerprints.r1.sam", true}, <END> new Object[]{"aligned_queryname_sorted.sam", false}, new Object[]{"aligned_unsorted.sam", false}, }; }</code><technical_language>unnecessary new suggestion {"NA12891.over.fingerprints.r1.sam", true},</technical_language>

Target:
Object[][] samFilesforFingerprinting() { return new Object[][]{ {"NA12891.over.fingerprints.r1.sam", true}, {"aligned_queryname_sorted.sam", false}, {"aligned_unsorted.sam", false}, }; }
Source:
<code>protected void buildScript(int age) { if (age == 0) { init(); } if (age == 0) { <START> addPendingClient(new <END> AnnouncementClient()); } addPendingClient(new AggregatedFeedContentClient()); addPendingClient(new ContinueReadingClient()); if (age == 0) { addPendingClient(new MainPageClient()); } addPendingClient(new BecauseYouReadClient()); if (age == 0) { addPendingClient(new RandomClient()); } }</code><technical_language>reason move this addPendingClient call existing conditional block above</technical_language>

Target:
protected void buildScript(int age) { if (age == 0) { addPendingClient(new SearchClient()); addPendingClient(new AnnouncementClient()); } addPendingClient(new AggregatedFeedContentClient()); addPendingClient(new ContinueReadingClient()); if (age == 0) { addPendingClient(new MainPageClient()); } addPendingClient(new BecauseYouReadClient()); if (age == 0) { addPendingClient(new RandomClient()); } }
Source:
<code>private Attribute getChangePasswordAttribute(Attribute oldPasswordAttribute, Object oldCredential, Object newPassword) throws DirectoryServerManagerException { String passwordHashMethod = null; if (oldCredential != null) { try { NamingEnumeration passwords = oldPasswordAttribute.getAll(); if (passwords.hasMore()) { byte[] byteArray = (byte[]) passwords.next(); String password = new String(byteArray, java.nio.charset.StandardCharsets.UTF_8); if (password.startsWith("{")) { passwordHashMethod = password.substring(password.indexOf("{") + 1, password.indexOf("}")); } if (!password.equals(getPasswordToStore((String) oldCredential, passwordHashMethod))) { throw new DirectoryServerManagerException("Old password does not match"); } } } catch (NamingException e) { log.error("Unable to retrieve old password details.", e); <START> throw new DirectoryServerManagerException("Could not find old password details", e); <END> } } Attribute passwordAttribute = new BasicAttribute(LDAPServerManagerConstants.LDAP_PASSWORD); passwordAttribute.add(getPasswordToStore((String) newPassword, passwordHashMethod)); return passwordAttribute; }</code><technical_language>log throw exception</technical_language>

Target:
private Attribute getChangePasswordAttribute(Attribute oldPasswordAttribute, Object oldCredential, Object newPassword) throws DirectoryServerManagerException { String passwordHashMethod = null; if (oldCredential != null) { try { NamingEnumeration passwords = oldPasswordAttribute.getAll(); if (passwords.hasMore()) { byte[] byteArray = (byte[]) passwords.next(); String password = new String(byteArray, StandardCharsets.UTF_8); if (password.startsWith("{")) { passwordHashMethod = password.substring(password.indexOf("{") + 1, password.indexOf("}")); } if (!password.equals(getPasswordToStore((String) oldCredential, passwordHashMethod))) { throw new DirectoryServerManagerException("Old password does not match"); } } } catch (NamingException e) { log.error("Unable to retrieve old password details.", e); throw new DirectoryServerManagerException("Could not find old password details"); } } Attribute passwordAttribute = new BasicAttribute(LDAPServerManagerConstants.LDAP_PASSWORD); passwordAttribute.add(getPasswordToStore((String) newPassword, passwordHashMethod)); return passwordAttribute; }
Source:
<code>private void verifyShowHide(boolean positive) { if(positive) { when(serviceCaller.call(any(RemoteCallback.class), any(ErrorCallback.class))) .thenAnswer(new LoadContentAnswer(importsService, importsContent, null)); } else { when(serviceCaller.call(any(RemoteCallback.class), any(ErrorCallback.class))) .thenAnswer(new LoadContentAnswer(importsService, importsContent, errorCallback)); <START> } <END> presenter.init(path, placeRequest); verify(view, times(2)).showLoading(); if(positive) { verify(view).hideBusyIndicator(); } else { verify(errorCallback).error(any(Message.class), any(Throwable.class)); } }</code><technical_language>statements similar I positive ? null : errorCallback instead of duplicating entirely</technical_language>

Target:
private void verifyShowHide(boolean positive) { when(serviceCaller.call(any(RemoteCallback.class), any(ErrorCallback.class))) .thenAnswer(new LoadContentAnswer(importsService, importsContent, positive ? null : errorCallback)); presenter.init(path, placeRequest); verify(view).showLoading(); if(positive) { verify(view).hideBusyIndicator(); } else { verify(errorCallback).error(any(Message.class), any(Throwable.class)); } }
Source:
<code>private int expectedAssociationNumber() { <START> if ( TestHelper.getCurrentDialectType().equals( GridDialectType.NEO4J ) || TestHelper.getCurrentDialectType().equals( GridDialectType.NEO4J_REMOTE )) { <END> return 1; } else { return 2; } }</code><technical_language>Minor nitpicking consistent in test for this. change this one</technical_language>

Target:
private int expectedAssociationNumber() { if ( EnumSet.of( NEO4J, NEO4J_REMOTE ).contains( TestHelper.getCurrentDialectType() ) ) { return 1; } else { return 2; } }
Source:
<code><START> public void countActiveUsers() { <END> Metrics.gauge(METRIC_USERS_ACTIVE, this.personService.getActivePersons().size()); }</code><technical_language>muss dies public sein oder recht package private</technical_language>

Target:
void countActiveUsers() { Metrics.gauge(METRIC_USERS_ACTIVE, this.personService.getActivePersons().size()); }
Source:
<code><START> public static KafkaConsumer<byte[], byte[]> getKafkaConsumerImpl(String systemName, String clientId, Config config) { <END> Map<String, String> injectProps = new HashMap<>(); KafkaConsumerConfig consumerConfig = KafkaConsumerConfig.getKafkaSystemConsumerConfig(config, systemName, clientId, injectProps); LOG.info("KafkaClient properties for systemName {}: {}", systemName, consumerConfig.originals()); return new KafkaConsumer<>(consumerConfig.originals()); }</code><technical_language>this need public</technical_language>

Target:
public static KafkaConsumer<byte[], byte[]> getKafkaConsumerImpl(String systemName, String clientId, Config config) { KafkaConsumerConfig consumerConfig = KafkaConsumerConfig.getKafkaSystemConsumerConfig(config, systemName, clientId); LOG.info("{}: KafkaClient properties {}", systemName, consumerConfig); return new KafkaConsumer(consumerConfig); }
Source:
<code>public static int getBatchSize(Schema schema) { int batchSize = 1000 * 10; for (int j = 0; j < schema.numColumns(); ++j) { Type type = schema.getColumnType(j); if (type == Type.BLOB_TYPE) { <START> batchSize = 1; <END> } } return batchSize; }</code><technical_language>Missing a "break" (or return)</technical_language>

Target:
public static int getBatchSize(Schema schema) { int batchSize = 1000 * 10; if (schema.getColumnTypes().indexOf(Type.BLOB_TYPE) >= 0) batchSize = 1; return batchSize; }
Source:
<code>protected String createFilePath(Object binaryuri) { String path = ""; destMediaPath = ""; if (binaryuri instanceof Uri) { try { path = UriToFilePath.getPathFromUri(CommCareApplication.instance(), (Uri)binaryuri); } catch (UriToFilePath.NoDataColumnForUriException e) { InputStream inputStream; try { inputStream = getContext().getContentResolver().openInputStream((Uri)binaryuri); } catch (FileNotFoundException e1) { showToast("form.attachment.notfound"); e1.printStackTrace(); return ""; } recordedFileName = FileUtil.getFileName(((Uri)binaryuri).getPath()); destMediaPath = mInstanceFolder + System.currentTimeMillis() + FileUtil.getExtension(((Uri)binaryuri).getPath()); try { FileUtil.copyFile(inputStream, new File(destMediaPath)); } catch (IOException e1) { e1.printStackTrace(); showToast("form.attachment.copy.fail"); return ""; } path = destMediaPath; } customFileTag = ""; } else { path = (String)binaryuri; <START> customFileTag = CUSTOM_TAG; <END> } return path; }</code><technical_language>purpose is customFileTag serving</technical_language>

Target:
private String createFilePath(Object binaryuri) throws IOException { String path = ""; destMediaPath = ""; if (binaryuri instanceof Uri) { try { path = UriToFilePath.getPathFromUri(CommCareApplication.instance(), (Uri)binaryuri); } catch (UriToFilePath.NoDataColumnForUriException e) { InputStream inputStream = getContext().getContentResolver().openInputStream((Uri)binaryuri); recordedFileName = FileUtil.getFileName(((Uri)binaryuri).getPath()); destMediaPath = mInstanceFolder + System.currentTimeMillis() + FileUtil.getExtension(((Uri)binaryuri).getPath()); FileUtil.copyFile(inputStream, new File(destMediaPath)); path = destMediaPath; } customFileTag = ""; } else { path = (String)binaryuri; customFileTag = CUSTOM_TAG; } return path; }
Source:
<code>public boolean isObjectLegalHoldEnabled(String bucketName, String objectName, String versionId) throws IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("legal-hold", ""); if (versionId != null && !versionId.isEmpty()) { queryParamMap.put("versionId", versionId); } Response response = null; <START> try { <END> response = executeGet(bucketName, objectName, null, queryParamMap); ResponseBody body = response.body(); LegalHold result = Xml.unmarshal(LegalHold.class, body.charStream()); return result.status(); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() == ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { return false; } } finally { if (response != null) { response.body().close(); } } return false; }</code><technical_language>try-with-resource. java try (Response response = executeGet(bucketName, objectName, null, queryParamMap)) { .... .... } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } return false;</technical_language>

Target:
public boolean isObjectLegalHoldEnabled(String bucketName, String objectName, String versionId) throws ErrorResponseException, IllegalArgumentException, InsufficientDataException, InternalException, InvalidBucketNameException, InvalidKeyException, InvalidResponseException, IOException, NoSuchAlgorithmException, XmlParserException { Map<String, String> queryParamMap = new HashMap<>(); queryParamMap.put("legal-hold", ""); if (versionId != null && !versionId.isEmpty()) { queryParamMap.put("versionId", versionId); } try (Response response = executeGet(bucketName, objectName, null, queryParamMap)) { LegalHold result = Xml.unmarshal(LegalHold.class, response.body().charStream()); return result.status(); } catch (ErrorResponseException e) { if (e.errorResponse().errorCode() != ErrorCode.NO_SUCH_OBJECT_LOCK_CONFIGURATION) { throw e; } } return false; }
Source:
<code><START> public void checkVisitedNode() { <END> List<Node> nodes = lexer.parse(readFile("scanner/testFile.html")); HtmlSourceCode htmlSourceCode = createHtmlSourceCode("scanner/testFile.html"); htlScanner.scan(nodes, htmlSourceCode); assertEquals(3, counterVisitor.getExpressionCounter()); }</code><technical_language>I missing testing HtlScanner? I a feeling check expressions part other stuff TAG, TEXT...</technical_language>

Target:
public void checkVisitedNode() { HtmlSourceCode htmlSourceCode = createHtmlSourceCode("scanner/testFile.html"); try (Reader reader = readFile("scanner/testFile.html")) { List<Node> nodes = lexer.parse(reader); htlScanner.scan(nodes, htmlSourceCode); } catch (IOException e) { throw Throwables.propagate(e); } assertEquals(1, counterVisitor.getCounter(CommentNode.class).intValue()); assertEquals(7, counterVisitor.getCounter(TagNode.class).intValue()); assertEquals(3, counterVisitor.getCounter(Expression.class).intValue()); }
Source:
<code>public void run() { try { while (running.get()) { Reference<? extends ScopeCleanupMarker> ref = markerReferenceQueue.remove(1000); if (ref != null && ref instanceof ScopeCleanupAction) { Object markerKey = ((ScopeCleanupAction)ref).getId(); ScopeCleanupAction cleanupAction = scopedCleanupActions.remove(markerKey); if (cleanupAction != null) { cleanupAction.call(); } } } LOGGER.info("PreDestroyMonitor.ScopedCleanupWorker is exiting"); } catch (InterruptedException e) { <START> LOGGER.info("PreDestroyMonitor.ScopedCleanupWorker is exiting due to thread interrupt"); <END> } }</code><technical_language>Reset thread interrupted state</technical_language>

Target:
public void run() { try { while (running.get()) { Reference<? extends ScopeCleanupMarker> ref = markerReferenceQueue.remove(1000); if (ref != null && ref instanceof ScopeCleanupAction) { Object markerKey = ((ScopeCleanupAction) ref).getId(); ScopeCleanupAction cleanupAction = scopedCleanupActions.remove(markerKey); if (cleanupAction != null) { cleanupAction.call(); } } } LOGGER.info("PreDestroyMonitor.ScopedCleanupWorker is exiting"); } catch (InterruptedException e) { LOGGER.info("PreDestroyMonitor.ScopedCleanupWorker is exiting due to thread interrupt"); Thread.currentThread().interrupt(); } }
Source:
<code>public String toString() { <START> return "Suggestion{" + <END> "primaryLine='" + primaryLine + '\'' + ", city='" + city + '\'' + ", state='" + state + '\'' + ", zipCode='" + zipCode + '\'' + '}'; }</code><technical_language>While String concatenation is more performant, easier read if a [String.format](<LINK_0>,%20java.lang.Object...%29) instead this more readable</technical_language>

Target:
public String toString() { return String.format( "Suggestion{primaryLine='%s', city='%s', state='%s', zipCode='%s'}", primaryLine, city, state, zipCode ); }
Source:
<code>public void destroy() { <START> DBUtils.cleanup(driverClass); <END> dbManager.destroy(); }</code><technical_language>this throw exceptions? If catch destroy is called dbManager</technical_language>

Target:
public void destroy() { try { DBUtils.cleanup(driverClass); } finally { dbManager.destroy(); } }
Source:
<code>public String toString() { String flattenValue = values.stream().filter(value -> !CoreUtils.isNullOrEmpty(value)) .map(this::escapeValue).collect(Collectors.joining(COMMA)); if (CoreUtils.isNullOrEmpty(flattenValue)) { throw logger.logExceptionAsError( new IllegalArgumentException("There must be at least one valid value for scoring parameter values.")); } <START> return name + SEPARATOR + values.stream().filter(value -> !CoreUtils.isNullOrEmpty(value)) .map(this::escapeValue).collect(Collectors.joining(COMMA)); <END> }</code><technical_language>do need repeat creating flattenValue? This simplified following: java return name + SEPARATOR + flattenValue;</technical_language>

Target:
public String toString() { String flattenValue = values.stream().filter(value -> !CoreUtils.isNullOrEmpty(value)) .map(ScoringParameter::escapeValue).collect(Collectors.joining(COMMA)); if (CoreUtils.isNullOrEmpty(flattenValue)) { throw logger.logExceptionAsError( new IllegalArgumentException("There must be at least one valid value for scoring parameter values.")); } return name + DASH + flattenValue; }
Source:
<code>MessageHandler createMethodInvokingHandler(Object targetObject, String targetMethodName) { MessageHandler directHandler = null; directHandler = createDirectHandlerIfPossible(targetObject, targetMethodName); if (directHandler != null) { return directHandler; } <START> else { <END> ServiceActivatingHandler handler = (StringUtils.hasText(targetMethodName)) ? new ServiceActivatingHandler(targetObject, targetMethodName) : new ServiceActivatingHandler(targetObject); return this.configureHandler(handler); } }</code><technical_language>I guess 'else' is required if block a return... personally, find this easier read: MessageHandler handler = createDirectHandlerIfPossible(targetObject, targetMethodName); if (handler == null) { ServiceActivatingHandler handler = (StringUtils.hasText(targetMethodName)) ? new ServiceActivatingHandler(targetObject, targetMethodName) : new ServiceActivatingHandler(targetObject); handler = this.configureHandler(handler); } return handler; ...but feel free ignore :)</technical_language>

Target:
MessageHandler createMethodInvokingHandler(Object targetObject, String targetMethodName) { MessageHandler handler = null; handler = createDirectHandlerIfPossible(targetObject, targetMethodName); if (handler == null) { handler = configureHandler( StringUtils.hasText(targetMethodName) ? new ServiceActivatingHandler(targetObject, targetMethodName) : new ServiceActivatingHandler(targetObject)); } return handler; }
Source:
<code>protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.CREATION_ROLE, new RTSideAffixedNodesCreationEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new RTCustomDiagramDragDropEditPolicy()); <START> installEditPolicy("CanonicalPortDisplay", new <END> CanonicalPortDisplayEditPolicy()); }</code><technical_language>create a constant</technical_language>

Target:
protected void createDefaultEditPolicies() { super.createDefaultEditPolicies(); installEditPolicy(EditPolicyRoles.CREATION_ROLE, new RTSideAffixedNodesCreationEditPolicy()); installEditPolicy(EditPolicyRoles.DRAG_DROP_ROLE, new RTCustomDiagramDragDropEditPolicy()); installEditPolicy(CanonicalPortDisplayEditPolicy.CANONICAL_PORT_DISPLAY_ROLE, new CanonicalPortDisplayEditPolicy()); }
Source:
<code>public void endElement(final String uri, final String localName, final String qName) throws SAXException { processRoleStack.pop(); final DitaClass cls = classes.pop(); if ((cls == null || !cls.isValid()) && !ELEMENT_NAME_DITA.equals(localName)) { <START> return; <END> } getContentHandler().endElement(uri, localName, qName); }</code><technical_language>This is a filter. If return passing end element event next content handler, end unbalanced tree. Is this correct</technical_language>

Target:
public void endElement(final String uri, final String localName, final String qName) throws SAXException { processRoleStack.pop(); classes.pop(); getContentHandler().endElement(uri, localName, qName); }
Source:
<code>private void handleAsrr(final Map<String, String> parameters, int code) { if (parameters.containsKey("asrr")) { String asrr = parameters.get("asrr"); if (!StringUtils.isEmpty(asrr)) { try { asrr = new String(Hex.decodeHex(asrr.toCharArray())); } catch (DecoderException e) { <START> logger.error("asrr parameter cannot be decoded"); <END> fail(code); } } final IvrEndpointResponse result = new IvrEndpointResponse(new CollectedResult(asrr, true, code == 101)); for (final ActorRef observer : observers) { observer.tell(result, self()); } } else { logger.error("asrr parameter is missing"); fail(code); } }</code><technical_language>add atleast code in this error msg if sense print complete paramters</technical_language>

Target:
private void handleAsrr(final Map<String, String> parameters, int code) { if (parameters.containsKey("asrr")) { String asrr = parameters.get("asrr"); if (!StringUtils.isEmpty(asrr)) { try { asrr = new String(Hex.decodeHex(asrr.toCharArray())); } catch (DecoderException e) { logger.error("asrr parameter cannot be decoded.", e); fail(code); } } final IvrEndpointResponse result = new IvrEndpointResponse(new CollectedResult(asrr, true, code == 101)); for (final ActorRef observer : observers) { observer.tell(result, self()); } } else { logger.error("asrr parameter is missing"); fail(code); } }
Source:
<code>public AssignmentServiceImpl() { <START> this.strategy = registry.getStrategy(System.getProperty("org.jbpm.task.assignment.strategy", "PotentialOwnerBusyness")); <END> }</code><technical_language>strategy identifier referenced IDENTIFIER constant (which public)</technical_language>

Target:
public AssignmentServiceImpl() { this.strategy = registry.getStrategy(System.getProperty("org.jbpm.task.assignment.strategy", PotentialOwnerBusynessAssignmentStrategy.IDENTIFIER)); }
Source:
<code>private DropdownListSearchPanel() { listsTableModel = new KeywordListsTableModel(); keywordsTableModel = new KeywordsTableModel(); initComponents(); customizeComponents(); dataSourceList.setModel(getDataSourceListModel()); dataSourceList.addListSelectionListener((ListSelectionEvent evt) -> { firePropertyChange(Bundle.DropdownSingleTermSearchPanel_selected(), null, null); }); dataSourceList.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseDragged(MouseEvent evt) { } @Override public void mouseMoved(MouseEvent evt) { <START> JList<String> DsList = (JList<String>) evt.getSource(); <END> int index = DsList.locationToIndex(evt.getPoint()); if (index > -1) { DsList.setToolTipText(getDataSourceToolTipList().get(index)); } } }); }</code><technical_language>please this lowercase ("dsList") good</technical_language>

Target:
private DropdownListSearchPanel() { listsTableModel = new KeywordListsTableModel(); keywordsTableModel = new KeywordsTableModel(); initComponents(); customizeComponents(); dataSourceList.setModel(getDataSourceListModel()); dataSourceList.addListSelectionListener((ListSelectionEvent evt) -> { firePropertyChange(Bundle.DropdownSingleTermSearchPanel_selected(), null, null); }); dataSourceList.addMouseMotionListener(new MouseMotionListener() { @Override public void mouseDragged(MouseEvent evt) { } @Override public void mouseMoved(MouseEvent evt) { JList<String> dsList = (JList<String>) evt.getSource(); int index = dsList.locationToIndex(evt.getPoint()); if (index > -1) { dsList.setToolTipText(getDataSourceToolTipList().get(index)); } } }); }
Source:
<code>public R apply(ASTNode t) { try { Method visitorMethod = this.getClass().getDeclaredMethod("apply", t.getClass()); return (R) visitorMethod.invoke(this, t); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException e) { throw new VisitingException(makeErrorMessage(t), e); } catch (InvocationTargetException e) { if (e.getCause() instanceof InvocationTargetException) <START> throw (VisitingException) e.getCause(); <END> else if (e.getCause() instanceof RuntimeException) throw (RuntimeException) e.getCause(); else throw new VisitingException(makeErrorMessage(t), e); } }</code><technical_language>this a ClassCastException me. instanceof VisitingException</technical_language>

Target:
public R apply(ASTNode t) { try { MethodHandles.Lookup lookup = MethodHandles.lookup(); Method visitMethod = this.getClass().getDeclaredMethod("apply", t.getClass()); MethodHandle visitMethodHandle = lookup.unreflect(visitMethod); return (R) visitMethodHandle.invoke(this, t); } catch (NoSuchMethodException e) { throw new VisitingException("Visitor " + this.getClass() + " is missing a definition for visit(" + t.getClass() + ")" + ". Encounteed when visiting " + makeErrorMessage(t), e); } catch (Throwable e) { throw new VisitingException(makeErrorMessage(t), e); } }
Source:
<code>public String getAllCriteriaWithNumber(String criterionNumber) { List<CertificationCriterionDTO> allCriteriaWithNumber = criteriaDao.getAllByNumber(criterionNumber); String criteriaNumbers = ""; <START> for (CertificationCriterionDTO criterion : allCriteriaWithNumber) { if (!StringUtils.isEmpty(criteriaNumbers)) { criteriaNumbers += " or "; } criteriaNumbers += Util.formatCriteriaNumber(criterion); } return criteriaNumbers; <END> }</code><technical_language>this: return allCriteriaWithNumbers.stream.collect(Collectors.joining(" "));</technical_language>

Target:
public String getAllCriteriaWithNumber(String criterionNumber) { List<CertificationCriterionDTO> allCriteriaWithNumber = criteriaDao.getAllByNumber(criterionNumber); List<String> allCriteriaNumbers = allCriteriaWithNumber.stream() .map(criterion -> Util.formatCriteriaNumber(criterion)) .collect(Collectors.toList()); return allCriteriaNumbers.stream().collect(Collectors.joining(" or ")); }
Source:
<code>public PinotColumnHandle( @JsonProperty("columnName") String columnName, @JsonProperty("dataType") Type dataType, @JsonProperty("type") PinotColumnType type) { <START> this.columnName = requireNonNull(columnName, "column name"); <END> this.dataType = requireNonNull(dataType, "data type name"); this.type = requireNonNull(type, "type is null"); }</code><technical_language>"columnName is null"</technical_language>

Target:
public PinotColumnHandle( @JsonProperty("columnName") String columnName, @JsonProperty("dataType") Type dataType, @JsonProperty("type") PinotColumnType type) { this.columnName = requireNonNull(columnName, "column name is null"); this.dataType = requireNonNull(dataType, "data type name is null"); this.type = requireNonNull(type, "type is null"); }
Source:
<code>public void createAndTriggerReplicationWithNoIamAuth() throws Exception { mockWebServer.enqueue(JSON_OK); CloudantClient c = CloudantClientHelper.newMockWebServerClientBuilder(mockWebServer) .build(); c.replication() .source(sourceDbUrl) .target(targetDbUrl) .trigger(); <START> RecordedRequest[] requests = takeN(mockWebServer, 1); <END> assertEquals(requests[0].getPath(), "/_replicate"); String body = requests[0].getBody().readString(Charset.forName("UTF-8")); assertThat("The replication document should contain the correct source", body, containsString("\"source\":\"" + sourceDbUrl + "\"")); assertThat("The replication document should contain the correct target", body, containsString("\"target\":\"" + targetDbUrl + "\"")); }</code><technical_language>this simplified to: getBody().readUtf8()</technical_language>

Target:
public void createAndTriggerReplicationWithNoIamAuth() throws Exception { server.enqueue(JSON_OK); CloudantClient c = CloudantClientHelper.newMockWebServerClientBuilder(server) .build(); c.replication() .source(sourceDbUrl) .target(targetDbUrl) .trigger(); RecordedRequest[] requests = takeN(server, 1); assertEquals(requests[0].getPath(), "/_replicate"); String body = requests[0].getBody().readUtf8(); assertThat("The replication document should contain the correct source", body, containsString("\"source\":\"" + sourceDbUrl + "\"")); assertThat("The replication document should contain the correct target", body, containsString("\"target\":\"" + targetDbUrl + "\"")); }
Source:
<code>private void reflowAsync() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { <START> getParentSection().getTaskEditorPage().reflow(); <END> } }); }</code><technical_language>call reflow() instead</technical_language>

Target:
private void reflowAsync() { Display.getDefault().asyncExec(new Runnable() { @Override public void run() { reflow(); } }); }
Source:
<code>public void testAddUserToGroup() throws RedmineException { final Group template = new Group(); template.setName("testAddUserToGroup " + System.currentTimeMillis()); final Group group = mgr.createGroup(template); try { final User newUser = mgr.createUser(generateRandomUser()); try { mgr.addUserToGroup(newUser, group); mgr.addUserToGroup(newUser, group); final List<Group> userGroups = mgr.getUserById(newUser.getId()).getGroups(); <START> assertTrue(userGroups.size() > 0); <END> } finally { mgr.deleteUser(newUser.getId()); } } finally { mgr.deleteGroup(group); } }</code><technical_language>check group name instead of groups number</technical_language>

Target:
public void testAddUserToGroup() throws RedmineException { final Group template = new Group(); template.setName("testAddUserToGroup " + System.currentTimeMillis()); final Group group = mgr.createGroup(template); try { final User newUser = mgr.createUser(generateRandomUser()); try { mgr.addUserToGroup(newUser, group); final List<Group> userGroups = mgr.getUserById(newUser.getId()).getGroups(); assertTrue(userGroups.size() == 1); assertTrue(group.getName().equals(userGroups.get(0).getName())); } finally { mgr.deleteUser(newUser.getId()); } } finally { mgr.deleteGroup(group); } }
Source:
<code>public byte[] getFileContent(Long userEntityId, String fileId) throws IOException { if (userEntityId == null || fileId == null) { logger.severe(String.format("Invalid fetch parameters: file %s of user %d", fileId, userEntityId)); return new byte[0]; } SystemSetting fileFolderSetting = systemSettingDAO.findByKey(SETTING_FILEFOLDER); if (fileFolderSetting != null && !StringUtils.isBlank(fileFolderSetting.getValue())) { java.io.File answerFile = Paths.get(fileFolderSetting.getValue(), userEntityId.toString(), fileId).toFile(); if (answerFile.exists()) { return Files.readAllBytes(answerFile.toPath()); } } logger.warning(String.format("Failed to retrieve file %s of user %d", fileId, userEntityId)); <START> return new byte[0]; <END> }</code><technical_language>this exception-worth too</technical_language>

Target:
public byte[] getFileContent(Long userEntityId, String fileId) throws IOException { if (userEntityId == null || fileId == null) { logger.severe(String.format("Invalid fetch parameters: file %s of user %d", fileId, userEntityId)); throw new IllegalArgumentException("Invalid fetch parameters"); } SystemSetting fileFolderSetting = systemSettingDAO.findByKey(SETTING_FILEFOLDER); if (fileFolderSetting == null || StringUtils.isBlank(fileFolderSetting.getValue())) { throw new IOException("File answer storage folder not set"); } java.io.File answerFile = Paths.get(fileFolderSetting.getValue(), userEntityId.toString(), fileId).toFile(); if (answerFile.exists()) { return Files.readAllBytes(answerFile.toPath()); } else { logger.warning(String.format("File %s of user %d not found", fileId, userEntityId)); throw new FileNotFoundException(); } }
Source:
<code>public void testAllBlockComments() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(BlockCommentListenerCheck.class); final String path = getPath("InputFullOfBlockComments.java"); if (new FileText(new File(path), StandardCharsets.UTF_8.name()) .getFullText().chars().anyMatch(character -> character == '\r')) { lineSeparator = "\r\n"; } else { lineSeparator = "\n"; <START> } <END> final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checkConfig, path, expected); Assert.assertTrue("All comments should be empty", ALL_COMMENTS.isEmpty()); }</code><technical_language>sounds util method reused</technical_language>

Target:
public void testAllBlockComments() throws Exception { final DefaultConfiguration checkConfig = createModuleConfig(BlockCommentListenerCheck.class); final String path = getPath("InputFullOfBlockComments.java"); lineSeparator = CheckUtil.getLineSeparatorForFile(path, StandardCharsets.UTF_8); final String[] expected = CommonUtil.EMPTY_STRING_ARRAY; verify(checkConfig, path, expected); Assert.assertTrue("All comments should be empty", ALL_COMMENTS.isEmpty()); }