auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Where<Message, Object> modWhere(Where<Message, Object> where) throws SQLException { <START> where.like(Message.MESSAGE_STAR_FIELD, new SelectArg(isStarred)); <END> return where; }</code><technical_language>is "like" here? eq()</technical_language>

Target:
public Where<Message, Object> modWhere(Where<Message, Object> where) throws SQLException { where.eq(Message.MESSAGE_STAR_FIELD, new SelectArg(isStarred)); return where; }
Source:
<code>public List<OrganizationHistory> getLastVistited() { String userId = userInfoService.currentUser().getUserId(); Optional<UserOrganizationsHistory> userOrganizationsHistories = userOrganizationsHistoryRepository.findById(userId); <START> UserOrganizationsHistory userOrganizationsHistory = new UserOrganizationsHistory(); <END> if (userOrganizationsHistories.isPresent()) { userOrganizationsHistory = userOrganizationsHistories.get(); return userOrganizationsHistory.getOrganizationsHistory(); }else{ return null; } }</code><technical_language>this initialization is useless</technical_language>

Target:
public List<OrganizationHistory> getLastVistited() { String userId = userInfoService.currentUser().getUserId(); Optional<UserOrganizationsHistory> userOrganizationsHistories = userOrganizationsHistoryRepository.findById(userId); return userOrganizationsHistories .map(UserOrganizationsHistory::getOrganizationsHistory) .orElse(new ArrayList<>()); }
Source:
<code>public void visitMethodInvocation(MethodInvocationTree mit) { <START> if (maybeRaiseIssue(mit)) { <END> return; } if (FEST_ASSERTIONS.anyMatch(mit) && !FEST_EXCLUSIONS.anyMatch(mit)) { chainedTo.push(ChainedMethods.FEST); } else if (!FEST_EXCLUSIONS.anyMatch(mit)) { chainedTo.push(ChainedMethods.ANY_BUT_NOT_FEST_EXCLUSIONS); } else { chainedTo.push(ChainedMethods.ANY); } super.visitMethodInvocation(mit); chainedTo.pop(); }</code><technical_language>name of method is explicit. isInvalidAssert similar better</technical_language>

Target:
public void visitMethodInvocation(MethodInvocationTree mit) { if (incompleteAssertion(mit)) { return; } Boolean previous = chainedToAnyMethodButFestExclusions; chainedToAnyMethodButFestExclusions = !FEST_EXCLUSIONS.anyMatch(mit); scan(mit.methodSelect()); chainedToAnyMethodButFestExclusions = previous; }
Source:
<code><START> public String getBearerToken(HttpServletRequest request) { <END> String authorization = request.getHeader("Authorization"); if (authorization == null) { throw new IllegalArgumentException("No access_token submitted!"); } return authorization.substring("Bearer ".length(), authorization.length()); }</code><technical_language>this method static? ordinary utility function. reasons manage a singleton instance of this class spring</technical_language>

Target:
public static String getBearerToken(HttpServletRequest request) { String authorization = request.getHeader("Authorization"); if (authorization == null) { throw new IllegalArgumentException("No access_token submitted!"); } return authorization.substring("Bearer ".length(), authorization.length()); }
Source:
<code>public List<NetworkStatementsDTO> getNetworkNodes(List<String> statementIds) throws QuadrigaStorageException{ try { Query query = sessionFactory.getCurrentSession() .createSQLQuery("select ns.* from tbl_project p, tbl_project_workspace pw, tbl_network_workspace nw, tbl_networks n, tbl_network_statements ns where p.projectid = pw.projectid and pw.workspaceid = nw.workspaceid and nw.networkid = n.networkid and ns.networkid = n.networkid and p.accessibility = 'PUBLIC' and n.status = 'APPROVED' and ns.statementid in (:statementids)") .setResultTransformer(Transformers.aliasToBean(NetworkStatementsDTO.class)); query.setParameterList("statementids", statementIds) ; @SuppressWarnings("unchecked") List<NetworkStatementsDTO> listNetworkStatementsDTO = query.list(); <START> return listNetworkStatementsDTO; <END> } catch (HibernateException e) { throw new QuadrigaStorageException(e); } }</code><technical_language>merge line 319</technical_language>

Target:
public List<NetworkStatementsDTO> getNetworkNodes(List<String> statementIds) throws QuadrigaStorageException{ try { Query query = sessionFactory.getCurrentSession() .createSQLQuery("select ns.* from tbl_project p, tbl_project_workspace pw, tbl_network_workspace nw, tbl_networks n, tbl_network_statements ns where p.projectid = pw.projectid and pw.workspaceid = nw.workspaceid and nw.networkid = n.networkid and ns.networkid = n.networkid and p.accessibility = 'PUBLIC' and n.status = 'APPROVED' and ns.statementid in (:statementids)") .setResultTransformer(Transformers.aliasToBean(NetworkStatementsDTO.class)); query.setParameterList("statementids", statementIds) ; return (List<NetworkStatementsDTO>)query.list(); } catch (HibernateException e) { throw new QuadrigaStorageException(e); } }
Source:
<code>private String getAttribute(String attrId) { Map<String, List<String>> attributes = dataObject.getProject().getAttributes(); List<String> values = attributes.get(attrId); if (values == null || values.isEmpty()) { return ""; } <START> return MoreObjects.firstNonNull(values.get(0), ""); <END> }</code><technical_language>I is static import</technical_language>

Target:
private String getAttribute(String attrId) { Map<String, List<String>> attributes = dataObject.getProject().getAttributes(); List<String> values = attributes.get(attrId); if (values == null || values.isEmpty()) { return ""; } return firstNonNull(values.get(0), ""); }
Source:
<code>public void addProblemMarker(ProblemMarkerInfo problemMarkerInfo){ fErrors.add(problemMarkerInfo); fMarkerGenerator.addMarker(problemMarkerInfo); <START> if (problemMarkerInfo.severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE) <END> hasErrors = true; }</code><technical_language>Please bring braces back</technical_language>

Target:
public void addProblemMarker(ProblemMarkerInfo problemMarkerInfo){ fErrors.add(problemMarkerInfo); fMarkerGenerator.addMarker(problemMarkerInfo); if (problemMarkerInfo.severity == IMarkerGenerator.SEVERITY_ERROR_RESOURCE) { hasErrors = true; } }
Source:
<code>public void onCreate() { super.onCreate(); Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME); Security.insertProviderAt(new BouncyCastleProvider(), 1); PRNGFixes.apply(); Log.d(Constants.TAG, "Bouncy Castle set and PRNG Fixes applied!"); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { if (!Constants.Path.APP_DIR.exists() && !Constants.Path.APP_DIR.mkdirs()) { } } brandGlowEffect(getApplicationContext(), FormattingUtils.getColorFromAttr(getApplicationContext(), R.attr.colorPrimary)); createAccountIfNecessary(this); <START> if (Preferences.getPreferences(this).isAppExecutedFirstTime()) { <END> Preferences.getPreferences(this).setAppExecutedFirstTime(false); KeyserverSyncAdapterService.enableKeyserverSync(this); ContactSyncAdapterService.enableContactsSync(this); Preferences.getPreferences(this).setPrefVersionToCurrentVersion(); } if (Preferences.getKeyserverSyncEnabled(this)) { KeyserverSyncAdapterService.enableKeyserverSync(this); } Preferences.getPreferences(this).upgradePreferences(this); TlsCertificatePinning.addPinnedCertificate("hkps.pool.sks-keyservers.net", getAssets(), "hkps.pool.sks-keyservers.net.CA.cer"); TlsCertificatePinning.addPinnedCertificate("pgp.mit.edu", getAssets(), "pgp.mit.edu.cer"); TlsCertificatePinning.addPinnedCertificate("api.keybase.io", getAssets(), "api.keybase.io.CA.cer"); TemporaryFileProvider.cleanUp(this); }</code><technical_language>preferences object belongs variable</technical_language>

Target:
public void onCreate() { super.onCreate(); Security.removeProvider(BouncyCastleProvider.PROVIDER_NAME); Security.insertProviderAt(new BouncyCastleProvider(), 1); PRNGFixes.apply(); Log.d(Constants.TAG, "Bouncy Castle set and PRNG Fixes applied!"); if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { if (!Constants.Path.APP_DIR.exists() && !Constants.Path.APP_DIR.mkdirs()) { } } brandGlowEffect(getApplicationContext(), FormattingUtils.getColorFromAttr(getApplicationContext(), R.attr.colorPrimary)); createAccountIfNecessary(this); Preferences preferences = Preferences.getPreferences(this); if (preferences.isAppExecutedFirstTime()) { preferences.setAppExecutedFirstTime(false); KeyserverSyncAdapterService.enableKeyserverSync(this); ContactSyncAdapterService.enableContactsSync(this); preferences.setPrefVersionToCurrentVersion(); } if (Preferences.getKeyserverSyncEnabled(this)) { KeyserverSyncAdapterService.updateInterval(this); } preferences.upgradePreferences(this); TlsCertificatePinning.addPinnedCertificate("hkps.pool.sks-keyservers.net", getAssets(), "hkps.pool.sks-keyservers.net.CA.cer"); TlsCertificatePinning.addPinnedCertificate("pgp.mit.edu", getAssets(), "pgp.mit.edu.cer"); TlsCertificatePinning.addPinnedCertificate("api.keybase.io", getAssets(), "api.keybase.io.CA.cer"); TemporaryFileProvider.cleanUp(this); }
Source:
<code>@Benchmark public void writeRequest_singleSpan() throws IOException { <START> BulkCallBuilder.write(Unpooled.compositeBuffer(Integer.MAX_VALUE), entry, true); <END> }</code><technical_language>this one</technical_language>

Target:
@Benchmark public void writeRequest_singleSpan() { BulkCallBuilder.write(Unpooled.compositeBuffer(Integer.MAX_VALUE), entry, true); }
Source:
<code>public LogInScreenInteractor observeLogInScreen() { final MainApplication app = MainApplication.instance(); final CharSequence title = ResourceUtil.getFormattedString(app.getResources(), R.string.login_title, "platform_name", app.getInjector().getInstance(Config.class).getPlatformName()); <START> onUsernameView().check(matches(isCompletelyDisplayed())); <END> onPasswordView().check(matches(isCompletelyDisplayed())); onLogInButton().check(matches(isCompletelyDisplayed())); return this; }</code><technical_language>Instead of removing this assertion, update check titlebar text. is do that, MyCoursesScreenInteractor: java onView(allOf(isInActionBar(), withText(title.toString()))).check(matches(isCompletelyDisplayed()));</technical_language>

Target:
public LogInScreenInteractor observeLogInScreen() { final MainApplication app = MainApplication.instance(); final CharSequence title = ResourceUtil.getFormattedString(app.getResources(), R.string.login_title, "platform_name", app.getInjector().getInstance(Config.class).getPlatformName()); onView(allOf(isInActionBar(), withText(title.toString()))).check(matches(isCompletelyDisplayed())); onUsernameView().check(matches(isCompletelyDisplayed())); onPasswordView().check(matches(isCompletelyDisplayed())); onLogInButton().check(matches(isCompletelyDisplayed())); return this; }
Source:
<code><START> public static Object getStringIDValue(Object idValue) { <END> Assert.notNull(idValue, "id should not be null"); if (idValue instanceof String) { Assert.hasText(idValue.toString(), "id should not be empty or only whitespaces."); return idValue; } else if (idValue instanceof Integer) { return Integer.toString((Integer) idValue); } else if (idValue instanceof Long) { return Long.toString((Long) idValue); } else { throw new IllegalQueryException("Type of id field must be String or Integer or Long"); } }</code><technical_language>This return <String> type, is returning Object</technical_language>

Target:
public static String getStringIDValue(Object idValue) { Assert.notNull(idValue, "id should not be null"); if (idValue instanceof String) { Assert.hasText(idValue.toString(), "id should not be empty or only whitespaces."); return (String) idValue; } else if (idValue instanceof Integer) { return Integer.toString((Integer) idValue); } else if (idValue instanceof Long) { return Long.toString((Long) idValue); } else { throw new IllegalQueryException("Type of id field must be String or Integer or Long"); } }
Source:
<code>public static int compare(byte[] a, byte[] b) { <START> for (int i=0; i < Math.min(a.length, b.length); i++) <END> if (a[i] != b[i]) return a[i] & 0xff - b[i] & 0xff; return 0; }</code><technical_language>explain contract in a docstring? If arrays lengths equal if content length of smaller array</technical_language>

Target:
public static int compare(byte[] a, byte[] b) { if (a.length != b.length) return a.length - b.length; for (int i=0; i < a.length; i++) if (a[i] != b[i]) return a[i] & 0xff - b[i] & 0xff; return 0; }
Source:
<code>public String shortestExample(String pattern) { <START> if (reCache != null) { <END> return reCache.get(pattern); } return shortestExampleCalc(pattern); }</code><technical_language>This null. Guice allow constructor called if reCache arguement is null, argument is marked @Nullable. is this null of unit tests? If is case I prefer define a mock cache in unit test runtime cache</technical_language>

Target:
public static String shortestExample(String pattern) { if (isRE(pattern)) { return toRegExp(pattern).toAutomaton().getShortestExample(true); } else if (pattern.endsWith("/*")) { return pattern.substring(0, pattern.length() - 1) + '1'; } else { return pattern; } }
Source:
<code>private Set<Integer> parseStatusCodes(String statusCodesString) { if (statusCodesString == null || statusCodesString.isEmpty()) { return Collections.emptySet(); } <START> Set<Integer> codes = new HashSet<Integer>(); <END> for (String codeString: statusCodesString.split(",")) { codes.add(Integer.parseInt(codeString)); } return codes; }</code><technical_language>linkedhashset (prevents distraction in tests etc)</technical_language>

Target:
static Set<Integer> parseStatusCodes(String statusCodesString) { if (statusCodesString == null || statusCodesString.isEmpty()) { return Collections.emptySet(); } Set<Integer> codes = new LinkedHashSet<Integer>(); for (String codeString: statusCodesString.split(",")) { codes.add(Integer.parseInt(codeString)); } return codes; }
Source:
<code>public void connect() throws IOException { lock.lock(); try { if (jmxc != null) return; JMXServiceURL jmxUrl = new JMXServiceURL(String.format(fmtUrl, host, port)); <START> Map<String, Object> env = new HashMap<String, Object>(); <END> if (username != null) { String[] creds = {username, password}; env.put(JMXConnector.CREDENTIALS, creds); } jmxc = JMXConnectorFactory.connect(jmxUrl, env); mbeanServerConn = jmxc.getMBeanServerConnection(); } finally { lock.unlock(); } }</code><technical_language>Java 1.7 Style: Unnecessary generic args HashMap constructor. new HashMap<>();</technical_language>

Target:
private void connect() throws IOException { lock.lock(); try { if (jmxc != null) return; JMXServiceURL jmxUrl = new JMXServiceURL(String.format(fmtUrl, host, port)); Map<String, Object> env = new HashMap<>(); if (username != null) { String[] creds = {username, password}; env.put(JMXConnector.CREDENTIALS, creds); } jmxc = JMXConnectorFactory.connect(jmxUrl, env); mbeanServerConn = jmxc.getMBeanServerConnection(); } finally { lock.unlock(); } }
Source:
<code><START> public void setBinaryClassificationProperties(Iterable<? extends AbstractInstance> trainingData) { <END> HashMap<Serializable, MutableInt> classifications = Maps.newHashMap(); for (AbstractInstance instance : trainingData) { Serializable classification = instance.getClassification(); if (classifications.containsKey(classification)) { classifications.get(classification).increment(); } else classifications.put(classification, new MutableInt(1)); if (classifications.size() > 2) { binaryClassifications = false; return; } } minorityClassification = null; double minorityClassificationCount = 0; for (Serializable val : classifications.keySet()) if (minorityClassification == null || classifications.get(val).doubleValue() < minorityClassificationCount) { minorityClassification = val; minorityClassificationCount = classifications.get(val).doubleValue(); } }</code><technical_language>this public? protected private</technical_language>

Target:
private void setBinaryClassificationProperties(Iterable<? extends AbstractInstance> trainingData) { HashMap<Serializable, MutableInt> classifications = Maps.newHashMap(); for (AbstractInstance instance : trainingData) { Serializable classification = instance.getClassification(); if (classifications.containsKey(classification)) { classifications.get(classification).increment(); } else classifications.put(classification, new MutableInt(1)); if (classifications.size() > 2) { binaryClassifications = false; return; } } minorityClassification = null; double minorityClassificationCount = 0; for (Serializable val : classifications.keySet()) if (minorityClassification == null || classifications.get(val).doubleValue() < minorityClassificationCount) { minorityClassification = val; minorityClassificationCount = classifications.get(val).doubleValue(); } }
Source:
<code>public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((fConfiguration == null) ? 0 : fConfiguration.hashCode()); <START> result = prime * result + ((file == null) ? 0 : file.hashCode()); <END> return result; }</code><technical_language>consider name</technical_language>

Target:
public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((fTraceTypeId == null) ? 0 : fTraceTypeId.hashCode()); result = prime * result + ((fFile == null) ? 0 : fFile.hashCode()); return result; }
Source:
<code>private boolean hasDescriptor(Context context) { Boolean value = false; if ((context.getName() != null && !context.getName().equals(""))) { for (ContextDescriptor descriptor : preferences.getContexts()) { if (descriptor.getName().equals(context.getName())) { <START> value = true; <END> } } } return value; }</code><technical_language>I "value" variable break-condition in a wile-loop</technical_language>

Target:
private boolean hasDescriptor(Context context) { Boolean value = false; if ((context.getName() != null && !context.getName().equals(""))) { Iterator<ContextDescriptor> contextIterator = preferences.getContexts().iterator(); while (contextIterator.hasNext() && !value) { if (contextIterator.next().getName().equals(context.getName())) { value = true; } } } return value; }
Source:
<code><START> private static boolean isLoadRunnerFileType(String line) throws IOException { <END> final char[] magic = new char[]{ 0x00, 0x01, 0x00, 0x00, 0x53, 0x74, 0x61, 0x6E, 0x64, 0x61, 0x72, 0x64, 0x20, 0x4A, 0x65, 0x74, 0x20, 0x44, 0x42 }; return line.length() > magic.length && Arrays.equals(magic, line.substring(0, magic.length).toCharArray()); }</code><technical_language>this method more simple understandable? maybe: String patternString = "Standard Jet DB"; return line.length() > patternString.length() && patternString.equals(line.substring(4, line.length()));</technical_language>

Target:
private static boolean isLoadRunnerFileType(String line) { String pattern = new String(new char[]{0x00, 0x01, 0x00, 0x00})+"Standard Jet DB"; return line.length() > pattern.length() && pattern.equals(line.substring(0, pattern.length())); }
Source:
<code>DumpDataHelper(ClusterMap clusterMap, int bytesPerSec) { this._clusterMap = clusterMap; <START> if(bytesPerSec != -1){ <END> this.throttler = new Throttler(bytesPerSec, 100, true, SystemTime.getInstance()); } }</code><technical_language>if bytePerSec is other negative value? 0</technical_language>

Target:
DumpDataHelper(ClusterMap clusterMap, int bytesPerSec) { this._clusterMap = clusterMap; if (bytesPerSec > 0) { this.throttler = new Throttler(bytesPerSec, 100, true, SystemTime.getInstance()); } else if (bytesPerSec < 0) { throw new IllegalArgumentException("BytesPerSec " + bytesPerSec + " cannot be negative "); } }
Source:
<code>public void setInjectionTarget(InjectionTarget<X> injectionTarget) { checkWithinObserverNotification(); this.injectionTarget = injectionTarget; <START> BootstrapLogger.LOG.setInjectionTargetCalled(getReceiver().getClass(), injectionTarget.getClass()); <END> }</code><technical_language>I injectionTarget.getClass() sense here. simply pass instance. applies extension. I log original new for ProcessX events, e.g. like: ProcessInjectionTarget.setInjectionTarget() called {0}: {1} replaced {2}. do think</technical_language>

Target:
public void setInjectionTarget(InjectionTarget<X> injectionTarget) { checkWithinObserverNotification(); BootstrapLogger.LOG.setInjectionTargetCalled(getReceiver(), getInjectionTarget(), injectionTarget); this.injectionTarget = injectionTarget; }
Source:
<code>protected Class<?> findClass(@Nonnull String name) throws ClassNotFoundException { VPath path = new VPath(name, '.'); path.addSuffix(".class"); InputVFile vFile; try { vFile = vfs.getRootInputVDir().getInputVFile(path); } catch (NotFileOrDirectoryException | NoSuchFileException e) { throw new ClassNotFoundException(name, e); } ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); try { try (InputStream is = vFile.getInputStream()) { new LocationByteStreamSucker(is, byteStream, vFile.getLocation(), NoLocation.getInstance()) .suck(); } catch (IOException e) { throw new CannotCloseException(vFile, e); } } catch (CannotWriteException e) { throw new AssertionError(e); } catch (WrongPermissionException | CannotCloseException | CannotReadException e) { <START> logger.log(Level.WARNING, "Failed to load class '" + name + "' from " <END> + vfs.getLocation().getDescription(), e); throw new ClassNotFoundException(name, e); } byte[] byteArray = byteStream.toByteArray(); return defineClass(name, byteArray, 0, byteArray.length); }</code><technical_language>I convince. of CNFE here. CCE is easy from. double check a problem load class here. If throw :94 only, CNFE is case if CCE</technical_language>

Target:
protected Class<?> findClass(@Nonnull String name) throws ClassNotFoundException { VPath path = new VPath(name, '.'); path.addSuffix(".class"); InputVFile vFile; try { vFile = vfs.getRootInputVDir().getInputVFile(path); } catch (NotFileOrDirectoryException | NoSuchFileException e) { throw new ClassNotFoundException(name, e); } ByteArrayOutputStream byteStream = new ByteArrayOutputStream(); try { try (InputStream is = vFile.getInputStream()) { new LocationByteStreamSucker(is, byteStream, vFile.getLocation(), NoLocation.getInstance()) .suck(); } catch (IOException e) { throw new CannotCloseException(vFile, e); } } catch (CannotWriteException e) { throw new AssertionError(e); } catch (CannotCloseException | CannotReadException e) { logger.log(Level.SEVERE, "Failed to load class '" + name + "' from " + vfs.getLocation().getDescription(), e); throw new ClassNotFoundException(name, e); } catch (WrongPermissionException e) { logger.log(Level.INFO, "Failed to load class '" + name + "' from " + vfs.getLocation().getDescription(), e); throw new ClassNotFoundException(name, e); } byte[] byteArray = byteStream.toByteArray(); return defineClass(name, byteArray, 0, byteArray.length); }
Source:
<code>public static void compileAndCompareSubsetOfActualToExpected( String goldenFileName, CompilerOptions options, String sourceFileName) throws Exception { List<SourceFile> sourceFiles = ImmutableList.of(readSource(sourceFileName)); List<SourceFile> externsFiles = ImmutableList.of(); String compiledSource = compile(externsFiles, sourceFiles, options); String referenceSource = readFile(toFullPath(goldenFileName)); String[] compiledLines = compiledSource.split("\n"); String[] goldenLines = referenceSource.split("\n"); int expectedNumberOfIdenticalLines = goldenLines.length; int identicalLinesBetweenFiles = 0; for (int i = 0; i < compiledLines.length; i++) { if (goldenLines[identicalLinesBetweenFiles].equals(compiledLines[i])) { identicalLinesBetweenFiles++; } } <START> assertThat(identicalLinesBetweenFiles).isEqualTo(expectedNumberOfIdenticalLines); <END> }</code><technical_language>If this assertion fails error message helpful. identical lines expectedNumberOfIdenticalLines of compiledLines? If instead truncate compiledLines expect exact string equality</technical_language>

Target:
public static void compileAndCompareSubsetOfActualToExpected( String goldenFileName, CompilerOptions options, String sourceFileName) throws Exception { List<SourceFile> sourceFiles = ImmutableList.of(readSource(sourceFileName)); List<SourceFile> externsFiles = ImmutableList.of(); String compiledSource = compile(externsFiles, sourceFiles, options); String referenceSource = readFile(toFullPath(goldenFileName)); String[] compiledLines = compiledSource.split("\n"); String[] goldenLines = referenceSource.split("\n"); int expectedNumberOfIdenticalLines = goldenLines.length; int identicalLinesBetweenFiles = 0; for (int i = 0; i < compiledLines.length; i++) { if (goldenLines[identicalLinesBetweenFiles].equals(compiledLines[i])) { identicalLinesBetweenFiles++; } } assertWithMessage( "Line " + (identicalLinesBetweenFiles + 1) + " from Golden was not found in compiled version of source file") .that(identicalLinesBetweenFiles).isEqualTo(expectedNumberOfIdenticalLines); }
Source:
<code><START> public Optional<List<Path>> getPathList(String key) { <END> List<Path> pathList = new ArrayList<Path>(); try { String[] stringList = configuration.getStringArray(key); for (String pathStr : stringList) { pathList.add(Paths.get(pathStr)); } if (pathList.size() > 0) { return Optional.of(pathList); } } catch (ConversionException ce) { throw new IllegalStateException(String.format("requested key [%s] is not convertable to an array", key)); } return Optional.ofNullable((List<Path>)null); }</code><technical_language>I return Optional here. return empty list instead</technical_language>

Target:
public List<Path> getPathList(String key) { List<Path> pathList = new ArrayList<Path>(); try { String[] stringList = configuration.getStringArray(key); for (String pathStr : stringList) { pathList.add(Paths.get(pathStr)); } } catch (ConversionException ce) { throw new IllegalStateException(String.format("requested key [%s] is not convertable to an array", key)); } return pathList; }
Source:
<code>public static OVirtNodeInfo[] get() { final String delimiter = ":"; final String prefix[] = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix).split(delimiter); final String path[] = Config.resolveOVirtISOsRepositoryPath().split(delimiter); <START> final String pattern = Config.<String> GetValue(ConfigValues.OvirtPattern); <END> final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); if (prefix.length != minimumVersion.length || prefix.length != path.length) { throw new IllegalArgumentException("Illegal Node Info"); } List<OVirtNodeInfo> info = new LinkedList<OVirtNodeInfo>(); for (int i=0;i<prefix.length;i++) { info.add(new OVirtNodeInfo(prefix[i], path[i], minimumVersion[i], pattern)); } return info.toArray(new OVirtNodeInfo[info.size()]); }</code><technical_language>pattern follow principle, a pattern configuration. is important consistent. also, please prefix pattern</technical_language>

Target:
public static OVirtNodeInfo[] get() { final String delimiter = ":"; final String pattern = Config.<String> GetValue(ConfigValues.OvirtIsoPrefix); final String path[] = Config.resolveOVirtISOsRepositoryPath().split(delimiter); final String minimumVersion[] = Config.<String> GetValue(ConfigValues.OvirtInitialSupportedIsoVersion).split(delimiter); final String prefix[]; Pattern exp = Pattern.compile("\\((.*?)\\)", Pattern.DOTALL); Matcher matcher = exp.matcher(Config.<String> GetValue(ConfigValues.OvirtIsoPrefix)); matcher.find(); log.debugFormat("matcher: {0}", Config.<String> GetValue(ConfigValues.OvirtIsoPrefix)); log.infoFormat("matcher group(1): prefix = [{0}]", matcher.group(1)); prefix = matcher.group(1).split("\\|"); log.debugFormat("NodeInfo: prefix length {0} minimum length {1} path length {2}", prefix.length, minimumVersion.length, path.length); if (prefix.length != minimumVersion.length || prefix.length != path.length) { throw new IllegalArgumentException("Illegal NodeInfo - length"); } List<OVirtNodeInfo> info = new LinkedList<OVirtNodeInfo>(); for (int i=0; i < prefix.length; i++) { log.debugFormat("NodeInfo Adding: prefix {0} path {1}, minimumVersion {2}, pattern {3}", prefix[i], path[i], minimumVersion[i], pattern); info.add(new OVirtNodeInfo(prefix[i], path[i], minimumVersion[i], pattern)); } return info.toArray(new OVirtNodeInfo[info.size()]); }
Source:
<code>private List<ActionEventRequest> prepareProgramActionEventRequests() { ProgramActionBuilder builder = new ProgramActionBuilder(); List<ActionEventRequest> result = builder.build(programs, serverVersion); <START> return result; <END> }</code><technical_language>return builder.build(programs, serverVersion); do method login in line</technical_language>

Target:
private List<ActionEventRequest> prepareProgramActionEventRequests() { List<ActionEventRequest> result = new ArrayList<>(); for(Program program : programs) { result.add(prepareActionEventRequests(program.getName(), EventSubjects.ENROLL_IN_PROGRAM)); result.add(prepareActionEventRequests(program.getTrackedEntity().getName() + ", " + program.getName(), EventSubjects.CREATE_AND_ENROLL)); } return result; }
Source:
<code>public static void ensureCurrentApprovalsLoaded(Iterable<ChangeData> changes) throws OrmException { List<ResultSet<PatchSetApproval>> pending = Lists.newArrayList(); for (ChangeData cd : changes) { if (!cd.notesMigration.readPatchSetApprovals()) { if (cd.currentApprovals == null && cd.limitedApprovals == null) { pending.add(cd.db.patchSetApprovals() .byPatchSet(cd.change().currentPatchSetId())); } } else { <START> cd.change(); <END> } } if (!pending.isEmpty()) { int idx = 0; for (ChangeData cd : changes) { if (cd.currentApprovals == null && cd.limitedApprovals == null) { cd.currentApprovals = sortApprovals(pending.get(idx++)); } } } }</code><technical_language>a for this async a thread pool something. this ensureChangeLoaded() relevant anymore of search result data stored in secondary index</technical_language>

Target:
public static void ensureCurrentApprovalsLoaded(Iterable<ChangeData> changes) throws OrmException { List<ResultSet<PatchSetApproval>> pending = Lists.newArrayList(); for (ChangeData cd : changes) { if (!cd.notesMigration.readPatchSetApprovals()) { if (cd.currentApprovals == null && cd.limitedApprovals == null) { pending.add(cd.db.patchSetApprovals() .byPatchSet(cd.change().currentPatchSetId())); } } else { cd.currentApprovals(); } } if (!pending.isEmpty()) { int idx = 0; for (ChangeData cd : changes) { if (cd.currentApprovals == null && cd.limitedApprovals == null) { cd.currentApprovals = sortApprovals(pending.get(idx++)); } } } }
Source:
<code>protected Schema getMainSchema() throws MetaModelException { if (schema == null) { MutableSchema theSchema = new MutableSchema(getMainSchemaName()); for (SimpleTableDef tableDef: tableDefs) { MutableTable table = tableDef.toTable().setSchema(theSchema); theSchema.addTable(table); } <START> schema = theSchema; <END> } return schema; }</code><technical_language>need cache schema here. superclass automatically cache schema "refreshSchemas" is called</technical_language>

Target:
protected Schema getMainSchema() throws MetaModelException { MutableSchema theSchema = new MutableSchema(getMainSchemaName()); for (SimpleTableDef tableDef: tableDefs) { MutableTable table = tableDef.toTable().setSchema(theSchema); theSchema.addTable(table); } return theSchema; }
Source:
<code>private void flipYifMag(String yunit) { try { if (SPVYQuantity.MAGNITUDE.getPossibleUnits() .contains(SPVYUnit.getFromUnitString(yunit))) { <START> plotPreferences.setYflip(true); <END> } } catch (SedException ex) { Logger.getLogger(SedPreferences.class.getName()) .log(Level.SEVERE, null, ex); } }</code><technical_language>this flip if mag flux? automatically reset false time</technical_language>

Target:
private void flipYifMag(String yunit) { try { if (SPVYQuantity.MAGNITUDE.getPossibleUnits() .contains(SPVYUnit.getFromUnitString(yunit))) { plotPreferences.setYflip(true); } else { plotPreferences.setYflip(false); } } catch (SedException ex) { Logger.getLogger(SedPreferences.class.getName()) .log(Level.SEVERE, null, ex); } }
Source:
<code>public void testIllegalConstructionForTimeRange() { <START> final long[][] illegalArgs = <END> new long[][]{{0, -1}, {0, 1}, {-1, 0}, {-1, -1}, {Long.MAX_VALUE, 1}, {1, Long.MAX_VALUE}}; for (int i = 0; i < illegalArgs.length; i++) { try { new TimeRange(illegalArgs[i][0], illegalArgs[i][1]); fail("Expected IllegalArgumentException not thrown when constructing TimeRange with illegal arguments"); } catch (IllegalArgumentException e) { } } }</code><technical_language>minor: need for final</technical_language>

Target:
public void testIllegalConstructionForTimeRange() { long[][] illegalArgs = new long[][]{{0, -1}, {0, 1}, {-1, 0}, {-1, -1}, {Long.MAX_VALUE, 1}, {1, Long.MAX_VALUE}}; for (int i = 0; i < illegalArgs.length; i++) { try { new TimeRange(illegalArgs[i][0], illegalArgs[i][1]); fail("Expected IllegalArgumentException not thrown when constructing TimeRange with illegal arguments"); } catch (IllegalArgumentException e) { } } }
Source:
<code>private void testActionWithNoParams() { ______TS("Failure case: no parameters given"); loginAsStudent(account.googleId); String[] submissionParams = new String[] {}; GetStudentProfilePictureAction action = getAction(submissionParams); assertThrows(NullHttpParameterException.class, () -> { <START> action.execute(); <END> }); }</code><technical_language>This inlined. java assertThrows(NullHttpParameterException.class, () -> action.execute());</technical_language>

Target:
private void testActionWithNoParams() { ______TS("Failure case: no parameters given"); loginAsStudent(account.googleId); String[] submissionParams = new String[] {}; GetStudentProfilePictureAction action = getAction(submissionParams); assertThrows(NullHttpParameterException.class, () -> action.execute()); }
Source:
<code>public PreparedStatement toExternal(RowData rowData, PreparedStatement statement) throws SQLException { for (int index = 0; index < rowData.getArity(); index++) { toExternalConverters[index].convert(statement, index, fieldTypes[index], rowData); } <START> return statement; } <END></code><technical_language>style</technical_language>

Target:
public PreparedStatement toExternal(RowData rowData, PreparedStatement statement) throws SQLException { for (int index = 0; index < rowData.getArity(); index++) { toExternalConverters[index].serialize(rowData, index, statement); } return statement; }
Source:
<code>private String trimToMaxLength(String detail) { if (detail != null && detail.length() > maxDetailLength) { <START> String result = detail.substring(0, maxDetailLength).concat("..."); <END> logger.warn("Detail was truncated to " + result); return result; } else { return detail; } }</code><technical_language>.. account in max-length, string ... max maxDetailLength long</technical_language>

Target:
private String trimToMaxLength(String detail) { if (detail != null && detail.length() > maxDetailLength) { String result = detail.substring(0, maxDetailLength - 3).concat("..."); logger.warn("Detail was truncated to " + result); return result; } else { return detail; } }
Source:
<code>public void createTopics(int partitions, int replication, Properties topicProperties, String... topics) { checkState(started.get() && !stopped.get(), "not started!"); ZkClient zkClient = new ZkClient(getZookeeperConnectString(), 30_000, 30_000, ZKStringSerializer$.MODULE$); <START> ZkUtils zkUtils = ZkUtils.apply(zkClient, false); <END> try { for (String topic : topics) { AdminUtils.createTopic(zkUtils, topic, partitions, replication, topicProperties, RackAwareMode.Disabled$.MODULE$); } } finally { zkClient.close(); } }</code><technical_language>Curious: this variable is once. inline</technical_language>

Target:
public void createTopics(int partitions, int replication, Properties topicProperties, String... topics) { checkState(started.get() && !stopped.get(), "not started!"); ZkUtils zkUtils = ZkUtils.apply(getZookeeperConnectString(), 30_000, 30_000, false); try { for (String topic : topics) { AdminUtils.createTopic(zkUtils, topic, partitions, replication, topicProperties, RackAwareMode.Disabled$.MODULE$); } } finally { zkUtils.close(); } }
Source:
<code>private void registerLongClickOnFavorites() { View.OnLongClickListener listener = new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { int favNumber = Integer.parseInt((String) view.getTag()); ArrayList<Pojo> favorites = KissApplication.getDataHandler(MainActivity.this).getFavorites(tryToRetrieve); if (favNumber >= favorites.size()) { Log.i(TAG, "Clicking on an unitialized favorite."); return false; } Pojo pojo = favorites.get(favNumber); final Result result = Result.fromPojo(MainActivity.this, pojo); result.getPopupMenu(MainActivity.this, adapter, view).show(); return true; } }; <START> findViewById(R.id.favoriteBar0).setOnLongClickListener(listener); <END> findViewById(R.id.favoriteBar1).setOnLongClickListener(listener); findViewById(R.id.favoriteBar2).setOnLongClickListener(listener); findViewById(R.id.favoriteBar3).setOnLongClickListener(listener); findViewById(R.id.favoriteBar4).setOnLongClickListener(listener); findViewById(R.id.favoriteBar5).setOnLongClickListener(listener); }</code><technical_language>iterate favBarIds</technical_language>

Target:
private void registerLongClickOnFavorites() { View.OnLongClickListener listener = new View.OnLongClickListener() { @Override public boolean onLongClick(View view) { int favNumber = Integer.parseInt((String) view.getTag()); ArrayList<Pojo> favorites = KissApplication.getDataHandler(MainActivity.this).getFavorites(tryToRetrieve); if (favNumber >= favorites.size()) { Log.i(TAG, "Long clicking on an unitialized favorite."); return false; } Pojo pojo = favorites.get(favNumber); final Result result = Result.fromPojo(MainActivity.this, pojo); result.getPopupMenu(MainActivity.this, adapter, view).show(); return true; } }; for (int id : favBarIds) { findViewById(id).setOnLongClickListener(listener); } for (int id : favsIds) { findViewById(id).setOnLongClickListener(listener); } }
Source:
<code>public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(fragmentResource, container, false); <START> return view; <END> }</code><technical_language>need variable here. return inflater.inflate(fragmentResource, container, false)</technical_language>

Target:
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(fragmentResource, container, false); }
Source:
<code>private MilliSpan() { this.begin = 0; this.name = null; this.traceId = 0; this.spanId = null; this.processId = null; <START> this.parents = new ArrayList<>(); <END> }</code><technical_language>oh.. ok fields, this object is mutable. I this is a separate issue</technical_language>

Target:
private MilliSpan() { this.begin = 0; this.name = null; this.traceId = 0; this.spanId = 0; this.processId = null; this.parents = new ArrayList<>(); }
Source:
<code>public void run() { try { Thread.sleep(DELAY_MS); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to simulate computation", e); } <START> for (int i = 0; i < numberOfUpdates; i++) { <END> for (int j = 0; j < numberOfKeys; j++) { parameterWorker.push(startKey + j, delta); final Vector value = parameterWorker.pull(startKey + j); LOG.log(Level.INFO, "Current value associated with key {0} is {1}", new Object[]{startKey + j, value}); } } final WorkerMetrics workerMetrics = buildMetricsMsg(memoryStore.getNumBlocks()); sendMetrics(workerMetrics); }</code><technical_language>This mechanism is a bit other apps; number of push/pull requests done numberOfUpdates times numberOfKeys in iteration. other hand, Dolphin apps (e.g., NMF, MLR) update models sending push/pull requests in mini-batch. semantics</technical_language>

Target:
public void run() { for (int i = 0; i < numMiniBatchesPerItr; i++) { final List<Vector> valueList = parameterWorker.pull(keyList); LOG.log(Level.INFO, "Current values associated with keys {0} is {1}", new Object[]{keyList, valueList}); try { Thread.sleep(computeTime); } catch (final InterruptedException e) { LOG.log(Level.WARNING, "Interrupted while sleeping to simulate computation", e); } for (final int key : keyList) { parameterWorker.push(key, delta); } } final WorkerMetrics workerMetrics = buildMetricsMsg(memoryStore.getNumBlocks()); sendMetrics(workerMetrics); }
Source:
<code>private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } MarkableInputStream markStream = new MarkableInputStream(stream); stream = markStream; long mark = markStream.savePosition(1024); byte[] fileHeaderBytes = new byte[WEBP_FILE_HEADER_SIZE]; boolean isWebPFile = false; if (stream.read(fileHeaderBytes, 0, WEBP_FILE_HEADER_SIZE) == WEBP_FILE_HEADER_SIZE) { isWebPFile = WEBP_FILE_HEADER_RIFF.equals(new String(fileHeaderBytes, 0, 4)) && WEBP_FILE_HEADER_WEBP.equals(new String(fileHeaderBytes, 8, 4)); } markStream.reset(mark); if (isWebPFile) { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); byte[] buffer = new byte[1024 * 4]; int n = 0; while (-1 != (n = stream.read(buffer))) { byteArrayOutputStream.write(buffer, 0, n); } <START> byte[] bytes = byteArrayOutputStream.toByteArray(); <END> BitmapFactory.Options options = new BitmapFactory.Options(); options.inPurgeable = true; options.inInputShareable = true; if (data.hasSize()) { options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); } else { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); markStream.reset(mark); } return BitmapFactory.decodeStream(stream, null, options); } }</code><technical_language>Stream bytes in a method in Utils.java</technical_language>

Target:
private Bitmap decodeStream(InputStream stream, Request data) throws IOException { if (stream == null) { return null; } MarkableInputStream markStream = new MarkableInputStream(stream); stream = markStream; long mark = markStream.savePosition(MARKER); boolean isWebPFile = Utils.isWebPFile(stream); markStream.reset(mark); if (isWebPFile) { byte[] bytes = Utils.toByteArray(stream); BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); } return BitmapFactory.decodeByteArray(bytes, 0, bytes.length, options); } else { BitmapFactory.Options options = null; if (data.hasSize()) { options = new BitmapFactory.Options(); options.inJustDecodeBounds = true; BitmapFactory.decodeStream(stream, null, options); calculateInSampleSize(data.targetWidth, data.targetHeight, options); markStream.reset(mark); } return BitmapFactory.decodeStream(stream, null, options); } }
Source:
<code>private static void printUsage() { System.out.println("Usage:"); <START> System.out.println("StoreUtils -[enc|dec|pvk] -store=path/to/keystore-file -pass=keystore-pass -string='string to be enc/decrypted' [-alias='cert alias']"); <END> System.out.println("StoreUtils -pubkey2ssh -store=path/to/keystore-file -pass=keystore-pass -alias='cert alias'"); }</code><technical_language>pvk visible. Please remove it</technical_language>

Target:
private static void printUsage() { System.out.println("Usage:"); System.out.println("StoreUtils -[enc|dec] -store=path/to/keystore-file -pass=keystore-pass -string='string to be enc/decrypted' [-alias='cert alias']"); System.out.println("StoreUtils -pubkey2ssh -store=path/to/keystore-file -pass=keystore-pass -alias='cert alias'"); }
Source:
<code>private float getPercenUsedCores(QueueMetrics metrics) { int totalCores = metrics.getAllocatedVirtualCores() + metrics.getAvailableVirtualCores(); int usedCores = metrics.getAllocatedVirtualCores() + metrics.getPendingVirtualCores(); <START> return (float) usedCores / totalCores; <END> }</code><technical_language>Dive zero triggered metrics</technical_language>

Target:
private float getPercenUsedCores(QueueMetrics metrics) { int totalCores = metrics.getAllocatedVirtualCores() + metrics.getAvailableVirtualCores(); int usedCores = metrics.getAllocatedVirtualCores() + metrics.getPendingVirtualCores(); return totalCores == 0 ? 0 : (float) usedCores / totalCores; }
Source:
<code>public SerialMessage executeRefresh(ZWaveNode node, <START> ZWaveSwitchAllCommandClass commandClass, int endpointId, Map<String, String> arguments) { <END> logger.debug("NODE {}: Generating poll message for {}, endpoint {}", new Object[]{node.getNodeId(), commandClass.getCommandClass().getLabel(), endpointId}); return node.encapsulate(commandClass.getValueMessage(), commandClass, endpointId); }</code><technical_language>sense poll this? polling status of switch, polling status of configuration (correct?). If so, I sense remove polling? do think</technical_language>

Target:
public SerialMessage executeRefresh(ZWaveNode node, ZWaveSwitchAllCommandClass commandClass, int endpointId, Map<String, String> arguments) { return null; }
Source:
<code>public boolean minimized() { <START> return "min".equals(m_matcher.group(4)); <END> }</code><technical_language>constant MINIMIZED_URL_KEYWORD</technical_language>

Target:
public boolean minimized() { return MINIMIZED_URL_KEYWORD.equals(m_matcher.group(4)); }
Source:
<code>public List<CloudianUser> listUsers(final String groupId) { if (Strings.isNullOrEmpty(groupId)) { return new ArrayList<>(); } LOG.debug("Trying to list Cloudian users in group id=" + groupId); try { <START> final HttpResponse response = get(String.format("/user/list?groupId=%s&userType=all&userStatus=active", groupId)); <END> checkResponseOK(response); if (response.getStatusLine().getStatusCode() == HttpStatus.SC_NO_CONTENT || response.getEntity() == null || response.getEntity().getContent() == null) { return new ArrayList<>(); } final ObjectMapper mapper = new ObjectMapper(); return Arrays.asList(mapper.readValue(response.getEntity().getContent(), CloudianUser[].class)); } catch (final IOException e) { LOG.error("Failed to list Cloudian users due to:", e); checkResponseTimeOut(e); } return new ArrayList<>(); }</code><technical_language>reason for returning empty list instead of null for this method</technical_language>

Target:
public List<CloudianUser> listUsers(final String groupId) { if (Strings.isNullOrEmpty(groupId)) { return new ArrayList<>(); } LOG.debug("Trying to list Cloudian users in group id=" + groupId); try { final HttpResponse response = get(String.format("/user/list?groupId=%s&userType=all&userStatus=active", groupId)); checkResponseOK(response); if (checkEmptyResponse(response)) { return new ArrayList<>(); } final ObjectMapper mapper = new ObjectMapper(); return Arrays.asList(mapper.readValue(response.getEntity().getContent(), CloudianUser[].class)); } catch (final IOException e) { LOG.error("Failed to list Cloudian users due to:", e); checkResponseTimeOut(e); } return new ArrayList<>(); }