auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private void writeSignatureBlock(CMSTypedData data, X509Certificate publicKey, PrivateKey privateKey) throws IOException, CertificateEncodingException, OperatorCreationException, CMSException { ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>(); certList.add(publicKey); JcaCertStore certs = new JcaCertStore(certList); CMSSignedDataGenerator gen = new CMSSignedDataGenerator(); <START> ContentSigner sha1Signer = new JcaContentSignerBuilder("SHA1withRSA").build(privateKey); <END> gen.addSignerInfoGenerator( new JcaSignerInfoGeneratorBuilder( new JcaDigestCalculatorProviderBuilder() .build()) .setDirectSignature(true) .build(sha1Signer, publicKey)); gen.addCertificates(certs); CMSSignedData sigData = gen.generate(data, false); ASN1InputStream asn1 = new ASN1InputStream(sigData.getEncoded()); DEROutputStream dos = new DEROutputStream(mOutputJar); dos.writeObject(asn1.readObject()); }</code><technical_language>this "SHA1with" + mKey.getAlgorithm() lines 263 273</technical_language>

Target:
private void writeSignatureBlock(CMSTypedData data, X509Certificate publicKey, PrivateKey privateKey) throws IOException, CertificateEncodingException, OperatorCreationException, CMSException { ArrayList<X509Certificate> certList = new ArrayList<X509Certificate>(); certList.add(publicKey); JcaCertStore certs = new JcaCertStore(certList); CMSSignedDataGenerator gen = new CMSSignedDataGenerator(); ContentSigner sha1Signer = new JcaContentSignerBuilder( "SHA1with" + privateKey.getAlgorithm()) .build(privateKey); gen.addSignerInfoGenerator( new JcaSignerInfoGeneratorBuilder( new JcaDigestCalculatorProviderBuilder() .build()) .setDirectSignature(true) .build(sha1Signer, publicKey)); gen.addCertificates(certs); CMSSignedData sigData = gen.generate(data, false); ASN1InputStream asn1 = new ASN1InputStream(sigData.getEncoded()); DEROutputStream dos = new DEROutputStream(mOutputJar); dos.writeObject(asn1.readObject()); }
Source:
<code>public ClassOrInterfaceType(final int beginLine, final int beginColumn, final int endLine, final int endColumn, <START> final ClassOrInterfaceType scope, final String name, final List<Type> typeArgs) { <END> this(beginLine, beginColumn, endLine, endColumn, scope, name, typeArgs, false); }</code><technical_language>instead of a boolean parameter either: - provide enum values (TypeParamsNotSpecified, TypeParamsDerived, TypeParamsNotSpecified) - this constructor private expose static factory methods</technical_language>

Target:
public ClassOrInterfaceType(final int beginLine, final int beginColumn, final int endLine, final int endColumn, final ClassOrInterfaceType scope, final String name, final List<Type> typeArgs) { this(beginLine, beginColumn, endLine, endColumn, scope, name, TypeArguments.withArguments(typeArgs)); }
Source:
<code>public MaxwellParser(Schema currentSchema) throws Exception { this.schema = currentSchema; TimeZone.setDefault(TimeZone.getTimeZone("UTC")); this.binlogEventListener = new MaxwellBinlogEventListener(queue); this.replicator = new OpenReplicator(); this.replicator.setHost("127.0.0.1"); this.replicator.setUser("maxwell"); this.replicator.setPassword("maxwell"); <START> this.replicator.setBinlogEventListener(this.binlogEventListener); <END> }</code><technical_language>I guessing, defaults. If are, port is missing</technical_language>

Target:
public MaxwellParser(Schema currentSchema) throws Exception { this.schema = currentSchema; TimeZone.setDefault(TimeZone.getTimeZone("UTC")); this.binlogEventListener = new MaxwellBinlogEventListener(queue); this.replicator = new OpenReplicator(); this.replicator.setBinlogEventListener(this.binlogEventListener); }
Source:
<code>public Set<String> getEditRoles() { <START> Set<String> roleSet = new HashSet<>(); roleSet.add(edit); return edit != null ? Collections.unmodifiableSet(roleSet) : Collections.emptySet(); <END> }</code><technical_language>logic sense me. edit != null logic happen creating object, otherwise, a redundant object</technical_language>

Target:
public Set<String> getEditRoles() { Set<String> roleSet = new HashSet<>(); if (edit != null) { roleSet.add(edit); } return Collections.unmodifiableSet(roleSet); }
Source:
<code>public ResourcePath getPath() { <START> if (m_location == null || "Default".equals(m_location)) { <END> return ResourcePath.get(m_ipAddress); } else { return ResourcePath.get(ResourcePath.sanitize(m_location), m_ipAddress); } }</code><technical_language>org.opennms.core.util.LocationUtils#isDefaultLocationName instead</technical_language>

Target:
public ResourcePath getPath() { if (LocationUtils.isDefaultLocationName(m_location)) { return ResourcePath.get(m_ipAddress); } else { return ResourcePath.get(ResourcePath.sanitize(m_location), m_ipAddress); } }
Source:
<code>public String getComment() { <START> return null; <END> }</code><technical_language>if getSessionTags print warning - this do</technical_language>

Target:
public String getComment() { log.warn("Can't get comment. SessionInfoService is not supported in {}", jaggerPlace); return null; }
Source:
<code>public @Nullable Map<@NonNull String, @NonNull SegmentStoreStatistics> getPerSegmentTypeStatsForRange(long start, long end, IProgressMonitor monitor) { @Nullable ITmfTrace trace = getTrace(); <START> <END> if (trace != null && (start == TmfTimeRange.ETERNITY.getStartTime().toNanos() && end == TmfTimeRange.ETERNITY.getEndTime().toNanos())) { waitForCompletion(); return getPerSegmentTypeStats(); } return getPerTypeStats(start, end, monitor); }</code><technical_language>monitor test well</technical_language>

Target:
public @Nullable Map<@NonNull String, @NonNull SegmentStoreStatistics> getPerSegmentTypeStatsForRange(long start, long end, IProgressMonitor monitor) { ITmfTrace trace = getTrace(); if (trace != null && (start == TmfTimeRange.ETERNITY.getStartTime().toNanos() && end == TmfTimeRange.ETERNITY.getEndTime().toNanos())) { waitForCompletion(); return getPerSegmentTypeStats(); } return getPerTypeStats(start, end, monitor); }
Source:
<code>public static MagicCommandFinder find(Code code, Map<String, MagicCommandFunctionality> commands, Message message, int executionCount, MessageCreator messageCreator) { List<MagicCommandItemWithResult> errors = new ArrayList<>(); LinkedHashMap<String, MagicCommandFunctionality> functionalityToRun = new LinkedHashMap<>(); code.getCommands().forEach(command -> { if (command.startsWith("%%") && isCellmagicHeadNonEmpty(command)) { <START> errors.add(processIllegalCommand( "Cell magic head contains data move it to body.", message, executionCount, messageCreator)); <END> return; } if (command.contains("\"")) { int indexOfFirstQuote = command.indexOf("\""); command = command.substring(0, indexOfFirstQuote) .replaceAll("\\s+"," ") .concat(command.substring(indexOfFirstQuote, command.length())); } else { command = command.replaceAll("\\s+"," "); } Optional<MagicCommandFunctionality> functionality = findFunctionality(commands, command); if (functionality.isPresent()) { functionalityToRun.put(command, functionality.get()); } else { errors.add(processIllegalCommand("Cell magic " + command + " not found", message, executionCount, messageCreator)); } }); return new MagicCommandFinder(functionalityToRun, errors); }</code><technical_language>Add comma. read: Cell magic head contains data, move body</technical_language>

Target:
public static MagicCommandFinder find(Code code, Map<String, MagicCommandFunctionality> commands, Message message, int executionCount, MessageCreator messageCreator) { List<MagicCommandItemWithResult> errors = new ArrayList<>(); LinkedHashMap<String, MagicCommandFunctionality> functionalityToRun = new LinkedHashMap<>(); code.getCommands().forEach(command -> { if (command.startsWith("%%") && isCellmagicHeadNonEmpty(command)) { errors.add(processIllegalCommand( "Cell magic head contains data, move it to body.", message, executionCount, messageCreator)); return; } if (command.contains("\"")) { int indexOfFirstQuote = command.indexOf("\""); command = command.substring(0, indexOfFirstQuote) .replaceAll("\\s+"," ") .concat(command.substring(indexOfFirstQuote, command.length())); } else { command = command.replaceAll("\\s+"," "); } Optional<MagicCommandFunctionality> functionality = findFunctionality(commands, command); if (functionality.isPresent()) { functionalityToRun.put(command, functionality.get()); } else { errors.add(processIllegalCommand("Cell magic " + command + " not found", message, executionCount, messageCreator)); } }); return new MagicCommandFinder(functionalityToRun, errors); }
Source:
<code>private boolean isRequestAllowed(HttpServletRequest httpRequest) { CurrentUser currentUser = userProvider.get(); if(httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { <START> return currentUser instanceof IdentifiedUser && currentUser.getCapabilities().canAdministrateServer(); <END> } return true; }</code><technical_language>do need check if currentUser instanceof IdentifiedUser</technical_language>

Target:
private boolean isRequestAllowed(HttpServletRequest httpRequest) { CurrentUser currentUser = userProvider.get(); if(httpRequest.getRequestURI().equals(getMonitoringUrl(httpRequest))) { return currentUser.getCapabilities().canAdministrateServer(); } return true; }
Source:
<code>public static ArrayList<Integer> johnsonLindenstraussMinDim(int[] n, double... eps){ Boolean basicCheck = n == null || n.length == 0 || eps == null || eps.length == 0; if (basicCheck) throw new IllegalArgumentException("Johnson-Lindenstrauss dimension estimation requires > 0 components and at least a relative error"); for (int i =0; i < eps.length; i++){ if (eps[i] <= 0 || eps[i] >= 1) { throw new IllegalArgumentException("A relative error should be in ]0, 1["); } } <START> ArrayList<Integer> res = new ArrayList(n.length * eps.length); <END> for (double epsilon : eps){ double denom = (Math.pow(epsilon, 2) / 2 - Math.pow(epsilon, 3) / 3); for (int components: n){ res.add((int) (4 * Math.log(components) / denom)); } } return res; }</code><technical_language>Change this List instead of ArrayList</technical_language>

Target:
public static List<Integer> johnsonLindenstraussMinDim(int[] n, double... eps){ Boolean basicCheck = n == null || n.length == 0 || eps == null || eps.length == 0; if (basicCheck) throw new IllegalArgumentException("Johnson-Lindenstrauss dimension estimation requires > 0 components and at least a relative error"); for (double epsilon: eps){ if (epsilon <= 0 || epsilon >= 1) { throw new IllegalArgumentException("A relative error should be in ]0, 1["); } } List<Integer> res = new ArrayList(n.length * eps.length); for (double epsilon : eps){ double denom = (Math.pow(epsilon, 2) / 2 - Math.pow(epsilon, 3) / 3); for (int components: n){ res.add((int) (4 * Math.log(components) / denom)); } } return res; }
Source:
<code>public void addComment(String issueKey, String commentString) { try { JiraSOAPSession jiraSoapSession = login(); JiraSoapService jiraSoapService = jiraSoapSession.getJiraSoapService(); String authToken = jiraSoapSession.getAuthenticationToken(); <START> <END> final RemoteComment comment = new RemoteComment(); comment.setBody(commentString); jiraSoapService.addComment(authToken, issueKey, comment); } catch (RemoteException e) { log.error("Error commenting issue . XMLRPC call failed. "); throw new DomainMethodExecutionException("RPC called failed", e); } finally { this.state = AliveState.DISCONNECTED; } }</code><technical_language>//login JiraSOAPSession jiraSoapSession = login(); JiraSoapService jiraSoapService = jiraSoapSession.getJiraSoapService(); String authToken = jiraSoapSession.getAuthenticationToken(); This 4 lines present in method (don't copy&paste ;)) extract some methods</technical_language>

Target:
public void addComment(String issueKey, String commentString) { try { JiraSoapService jiraSoapService = login(); RemoteComment comment = new RemoteComment(); comment.setBody(commentString); jiraSoapService.addComment(authToken, issueKey, comment); } catch (RemoteException e) { log.error("Error commenting issue . XMLRPC call failed. "); throw new DomainMethodExecutionException("RPC called failed", e); } finally { this.state = AliveState.DISCONNECTED; } }
Source:
<code>public void onAudioFocusChange(int focusChange) { switch (focusChange) { case AudioManager.AUDIOFOCUS_LOSS: eventEmitter.audioFocusChanged(false); <START> audioManager.abandonAudioFocus(this); <END> break; case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: eventEmitter.audioFocusChanged(false); break; case AudioManager.AUDIOFOCUS_GAIN: eventEmitter.audioFocusChanged(true); break; default: break; } if (player != null) { if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) { if (!muted) { player.setVolume(audioVolume * 0.8f); } } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) { if (!muted) { player.setVolume(audioVolume * 1); } } } }</code><technical_language>If abandon focus, pause automatically? giving user option stop</technical_language>

Target:
public void onAudioFocusChange(int focusChange) { switch (focusChange) { case AudioManager.AUDIOFOCUS_LOSS: eventEmitter.audioFocusChanged(false); pausePlayback(); audioManager.abandonAudioFocus(this); break; case AudioManager.AUDIOFOCUS_LOSS_TRANSIENT: eventEmitter.audioFocusChanged(false); break; case AudioManager.AUDIOFOCUS_GAIN: eventEmitter.audioFocusChanged(true); break; default: break; } if (player != null) { if (focusChange == AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK) { if (!muted) { player.setVolume(audioVolume * 0.8f); } } else if (focusChange == AudioManager.AUDIOFOCUS_GAIN) { if (!muted) { player.setVolume(audioVolume * 1); } } } }
Source:
<code><START> public EObject getEObject(String uriFragment) { <END> Option<String> optionalRewrittenFragment = VSMMigrationService.getInstance().getNewFragment(uriFragment); if (optionalRewrittenFragment.some()) { return getEObject(optionalRewrittenFragment.get()); } else { if (isLoading) { return super.getEObject(uriFragment); } else { return getEObjectByID(uriFragment); } } }</code><technical_language>want cache permanent lead external tools breaking references (changing element in .odesign expecting reference updated, in respect EMF contract) I introduce a specific method named "freezeURIs" (or similar) ViewpointRegistry "enable" of cache</technical_language>

Target:
public EObject getEObject(String uriFragment) { Option<String> optionalRewrittenFragment = VSMMigrationService.getInstance().getNewFragment(uriFragment); if (optionalRewrittenFragment.some()) { return getEObject(optionalRewrittenFragment.get()); } else { if (isLoading) { EObject eObject = super.getEObject(uriFragment); if (eObject != null) { String fragment = EcoreUtil.getURI(eObject).fragment(); if (fragment != null) { setID(eObject, fragment); } } return eObject; } else { EObject eObject = getEObjectByID(uriFragment); if (eObject == null) { eObject = super.getEObject(uriFragment); if (eObject != null) { String fragment = EcoreUtil.getURI(eObject).fragment(); if (fragment != null) { setID(eObject, fragment); return getEObject(uriFragment); } } } return eObject; } } }
Source:
<code>public void run() { long periodMSec = checkpointConf.getCheckPeriod() * 1000; long checkpointPeriodMSec = checkpointConf.getPeriod() * 1000; long lastCheckpointTime = 0; if (!backupNode.shouldCheckpointAtStartup()) { lastCheckpointTime = monotonicNow(); } while(shouldRun) { try { long now = monotonicNow(); boolean shouldCheckpoint = false; if(now >= lastCheckpointTime + checkpointPeriodMSec) { shouldCheckpoint = true; } else { long txns = countUncheckpointedTxns(); if(txns >= checkpointConf.getTxnCount()) shouldCheckpoint = true; } if(shouldCheckpoint) { doCheckpoint(); lastCheckpointTime = now; } } catch(IOException e) { LOG.error("Exception in doCheckpoint: ", e); } catch(Throwable e) { LOG.error("Throwable Exception in doCheckpoint: ", e); shutdown(); break; } try { <START> Thread.sleep(LongMath.gcd(periodMSec, checkpointPeriodMSec)); <END> } catch(InterruptedException ie) { } } }</code><technical_language>If periodMsec is set 60 checkPointPeriodMsec is set 503, sleep time 1 (= gcd(60, 503)) sec edit log check seconds. I suggest sleeping periodMsec instead of gcd</technical_language>

Target:
public void run() { long periodMSec = checkpointConf.getCheckPeriod() * 1000; long checkpointPeriodMSec = checkpointConf.getPeriod() * 1000; long lastCheckpointTime = 0; long lastEditLogCheckTime =0; if (!backupNode.shouldCheckpointAtStartup()) { lastCheckpointTime = monotonicNow(); } while(shouldRun) { try { long now = monotonicNow(); boolean shouldCheckpoint = false; if(now >= lastCheckpointTime + checkpointPeriodMSec) { shouldCheckpoint = true; } else if(now >= lastEditLogCheckTime + periodMSec) { long txns = countUncheckpointedTxns(); lastEditLogCheckTime = now; if(txns >= checkpointConf.getTxnCount()) shouldCheckpoint = true; } if(shouldCheckpoint) { doCheckpoint(); lastCheckpointTime = now; lastEditLogCheckTime = now; } } catch(IOException e) { LOG.error("Exception in doCheckpoint: ", e); } catch(Throwable e) { LOG.error("Throwable Exception in doCheckpoint: ", e); shutdown(); break; } try { Thread.sleep(LongMath.gcd(periodMSec, checkpointPeriodMSec)); } catch(InterruptedException ie) { } } }
Source:
<code>public boolean test(Map.Entry<String, Revisioned> entry) { Object value = entry.getValue(); if (value == null) return false; if (value instanceof CachedRole) { CachedRole cachedRole = (CachedRole)value; if (cachedRole.getComposites().contains(role)) return true; } if (value instanceof CachedGroup) { CachedGroup cachedRole = (CachedGroup)value; if (cachedRole.getRoleMappings().contains(role)) return true; } if (value instanceof RoleQuery) { RoleQuery roleQuery = (RoleQuery)value; if (roleQuery.getRoles().contains(role)) return true; } if (value instanceof CachedClient) { CachedClient cachedClient = (CachedClient)value; if (cachedClient.getScope().contains(role)) return true; } if (value instanceof CachedClientScope) { <START> CachedClientScope cachedClientTemplate = (CachedClientScope)value; <END> if (cachedClientTemplate.getScope().contains(role)) return true; } return false; }</code><technical_language>cachedClientTemplate</technical_language>

Target:
public boolean test(Map.Entry<String, Revisioned> entry) { Object value = entry.getValue(); if (value == null) return false; if (value instanceof CachedRole) { CachedRole cachedRole = (CachedRole)value; if (cachedRole.getComposites().contains(role)) return true; } if (value instanceof CachedGroup) { CachedGroup cachedRole = (CachedGroup)value; if (cachedRole.getRoleMappings().contains(role)) return true; } if (value instanceof RoleQuery) { RoleQuery roleQuery = (RoleQuery)value; if (roleQuery.getRoles().contains(role)) return true; } if (value instanceof CachedClient) { CachedClient cachedClient = (CachedClient)value; if (cachedClient.getScope().contains(role)) return true; } if (value instanceof CachedClientScope) { CachedClientScope cachedClientScope = (CachedClientScope)value; if (cachedClientScope.getScope().contains(role)) return true; } return false; }
Source:
<code>public static boolean containsMatchingProperty(Set<IConfigurationProperty> existingProperties, String name, String os, String arch) { for (IConfigurationProperty property : existingProperties) { if (name.equals(property.getName().trim())) { String propOs = property.getOs() != null ? property.getOs().trim() : <START> ""; END> if (ALL_OS.equals(propOs) || ALL_OS.equals(os) || propOs.equals(os)) { String propArch = property.getArch() != null ? property.getArch().trim() : ""; if (propArch.equals(arch) || ALL_ARCH.equals(arch) || ALL_ARCH.equals(propArch)) { return true; } } } } return false; }</code><technical_language>Do ALL_OS here</technical_language>

Target:
public static boolean containsMatchingProperty(Set<IConfigurationProperty> existingProperties, String name, String os, String arch) { for (IConfigurationProperty property : existingProperties) { if (name.equals(property.getName().trim())) { String propOs = property.getOs() != null ? property.getOs().trim() : ALL_OS; if (ALL_OS.equals(propOs) || ALL_OS.equals(os) || propOs.equals(os)) { String propArch = property.getArch() != null ? property.getArch().trim() : ALL_ARCH; if (propArch.equals(arch) || ALL_ARCH.equals(arch) || ALL_ARCH.equals(propArch)) { return true; } } } } return false; }
Source:
<code>public void setTerminateDruidProcessOnConnectFail(Boolean terminateDruidProcessOnConnectFail) { <START> this.terminateDruidProcessOnConnectFail = terminateDruidProcessOnConnectFail == null ? false : terminateDruidProcessOnConnectFail; <END> }</code><technical_language>Line longer 120 cols. Please if-else</technical_language>

Target:
public void setTerminateDruidProcessOnConnectFail(Boolean terminateDruidProcessOnConnectFail) { if (terminateDruidProcessOnConnectFail == null) { this.terminateDruidProcessOnConnectFail = false; } else { this.terminateDruidProcessOnConnectFail = terminateDruidProcessOnConnectFail; } }
Source:
<code>public static Policy getPolicy(CloudResourceManager crmService, String projectId) { Policy policy = null; try { GetIamPolicyRequest request = new GetIamPolicyRequest(); policy = crmService.projects().getIamPolicy(projectId, request).execute(); <START> } catch (IOException e) { System.out.println("Unable to get policy: \n" + e.toString()); } <END> return policy; }</code><technical_language>add a throws getPolicy catch IOException if it</technical_language>

Target:
public static Policy getPolicy(CloudResourceManager crmService, String projectId) { Policy policy = null; try { GetIamPolicyRequest request = new GetIamPolicyRequest(); policy = crmService.projects().getIamPolicy(projectId, request).execute(); } catch (IOException e) { System.out.println("Unable to get policy: \n" + e.getMessage() + e.getStackTrace()); } return policy; }
Source:
<code>public Object intercept(InvocationContext ic) throws Exception { final TransactionManager tm = getTransactionManager(); final Transaction tx = tm.getTransaction(); <START> boolean previousUserTransactionAvailability = setUserTransactionAvailable(false); <END> try { return doIntercept(tm, tx, ic); } finally { resetUserTransactionAvailability(previousUserTransactionAvailability); } }</code><technical_language>I expected passed constructor (by subclass) instead of false, in: boolean previousUserTransactionAvailability = setUserTransactionAvailable(userTransactionAvailable);</technical_language>

Target:
public Object intercept(InvocationContext ic) throws Exception { final TransactionManager tm = getTransactionManager(); final Transaction tx = tm.getTransaction(); boolean previousUserTransactionAvailability = setUserTransactionAvailable(userTransactionAvailable); try { return doIntercept(tm, tx, ic); } finally { resetUserTransactionAvailability(previousUserTransactionAvailability); } }
Source:
<code>void threadSafeParametersTest() throws Exception { String[] iatas = { "JFK", "IAD", "SFO", "SJC", "SEA", "LAX", "PHX" }; Future[] future = new Future[iatas.length]; ExecutorService executorService = Executors.newFixedThreadPool(iatas.length); try { for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i].toLowerCase() ); airportRepository.save(airport); } try { Thread.sleep(1000); } catch (InterruptedException ie) { <START> ; <END> } for (int k = 0; k < 50; k++) { Callable<Boolean>[] suppliers = new Callable[iatas.length]; for (int i = 0; i < iatas.length; i++) { final int idx = i; suppliers[i] = () -> { try { Thread.sleep(iatas.length - idx); } catch (InterruptedException ie) { ; } List<Airport> airports = airportRepository.findAllByIata(iatas[idx]); String foundName = airportRepository.findAllByIata(iatas[idx]).get(0).getIata(); assertEquals(iatas[idx], foundName); return iatas[idx].equals(foundName); }; } for (int i = 0; i < iatas.length; i++) { future[i] = executorService.submit(suppliers[i]); } for (int i = 0; i < iatas.length; i++) { future[i].get(); } } } finally { executorService.shutdown(); for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i] ); airportRepository.delete(airport); } } }</code><technical_language>NIT: throw new RuntimeException(ie);</technical_language>

Target:
void threadSafeParametersTest() throws Exception { String[] iatas = { "JFK", "IAD", "SFO", "SJC", "SEA", "LAX", "PHX" }; Future[] future = new Future[iatas.length]; ExecutorService executorService = Executors.newFixedThreadPool(iatas.length); try { for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i].toLowerCase(Locale.ROOT) ); airportRepository.save(airport); } sleep(1000); for (int k = 0; k < 50; k++) { Callable<Boolean>[] suppliers = new Callable[iatas.length]; for (int i = 0; i < iatas.length; i++) { final int idx = i; suppliers[i] = () -> { sleep(iatas.length - idx); List<Airport> airports = airportRepository.findAllByIata(iatas[idx]); String foundName = airportRepository.findAllByIata(iatas[idx]).get(0).getIata(); assertEquals(iatas[idx], foundName); return iatas[idx].equals(foundName); }; } for (int i = 0; i < iatas.length; i++) { future[i] = executorService.submit(suppliers[i]); } for (int i = 0; i < iatas.length; i++) { future[i].get(); } } } finally { executorService.shutdown(); for (int i = 0; i < iatas.length; i++) { Airport airport = new Airport("airports::" + iatas[i], iatas[i] , iatas[i] ); airportRepository.delete(airport); } } }
Source:
<code>private Map<String, HiveColumnStatistics> groupStatisticsByColumn(List<ColumnStatisticsInfo> statistics, OptionalLong rowCount) { return statistics.stream() <START> .collect(toImmutableMap(ColumnStatisticsInfo::getColName, statisticsObj -> AlluxioProtoUtils.fromProto(statisticsObj.getData(), rowCount))); <END> }</code><technical_language>statisticsObj -> statisticsInfo</technical_language>

Target:
private Map<String, HiveColumnStatistics> groupStatisticsByColumn(List<ColumnStatisticsInfo> statistics, OptionalLong rowCount) { return statistics.stream() .collect(toImmutableMap(ColumnStatisticsInfo::getColName, statisticsInfo -> AlluxioProtoUtils.fromProto(statisticsInfo.getData(), rowCount))); }
Source:
<code>public void testEnableTablesWithNull() throws IOException { try (Admin admin = getConnection().getAdmin()) { Exception actualError = null; try { HTableDescriptor[] descriptors = admin.enableTables((String) null); assertTrue(descriptors.length > 0); } catch (Exception e) { actualError = e; } assertNotNull(actualError); assertTrue(actualError instanceof NullPointerException); actualError = null; <START> try { assertEquals(0, admin.enableTables("").length); } catch (Exception e) { actualError = e; } assertNull(actualError); } <END> }</code><technical_language>try isnt necessary</technical_language>

Target:
public void testEnableTablesWithNull() throws IOException { try (Admin admin = getConnection().getAdmin()) { Exception actualError = null; try { admin.enableTables((String) null); } catch (Exception e) { actualError = e; } assertNotNull(actualError); assertTrue(actualError instanceof NullPointerException); assertEquals(0, admin.enableTables("").length); } }
Source:
<code><START> SSOStateSerializer() { <END> }</code><technical_language>@weijjia I this new commit needs CR/approval</technical_language>

Target:
private SSOStateSerializer() { }
Source:
<code>public static void main(String[] args) throws Exception { Logger.getLogger(FJmsPublisherTransport.class).setLevel(Level.ALL); FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); Connection connection = connectionFactory.createConnection(); connection.start(); <START> FPublisherTransportFactory publisherFactory = new FJmsPublisherTransport.Factory(connection, "VirtualTopic.", true); <END> FScopeProvider provider = new FScopeProvider(publisherFactory, null, protocolFactory); AlbumWinnersPublisher.Iface publisher = new AlbumWinnersPublisher.Client(provider); publisher.open(); Album album = new Album(); album.setASIN(UUID.randomUUID().toString()); album.setDuration(1200); album.addToTracks( new Track( "Comme des enfants", "Coeur de pirate", "Grosse Boîte", "Béatrice Martin", 169, PerfRightsOrg.ASCAP)); publisher.publishWinner(new FContext(), album); List<Album> albums = new ArrayList<>(); albums.add(album); albums.add(album); publisher.publishContestStart(new FContext(), albums); System.out.println("Published event"); publisher.close(); connection.close(); }</code><technical_language>This virtual topics match other languages</technical_language>

Target:
public static void main(String[] args) throws Exception { FProtocolFactory protocolFactory = new FProtocolFactory(new TBinaryProtocol.Factory()); ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(); Connection connection = connectionFactory.createConnection(); connection.start(); FPublisherTransportFactory publisherFactory = new FJmsPublisherTransport.Factory.Builder(connection).build(); FScopeProvider provider = new FScopeProvider(publisherFactory, null, protocolFactory); AlbumWinnersPublisher.Iface publisher = new AlbumWinnersPublisher.Client(provider); publisher.open(); Album album = new Album(); album.setASIN(UUID.randomUUID().toString()); album.setDuration(1200); album.addToTracks( new Track( "Comme des enfants", "Coeur de pirate", "Grosse Boîte", "Béatrice Martin", 169, PerfRightsOrg.ASCAP)); publisher.publishWinner(new FContext(), album); List<Album> albums = new ArrayList<>(); albums.add(album); albums.add(album); publisher.publishContestStart(new FContext(), albums); System.out.println("Published event"); publisher.close(); connection.close(); }
Source:
<code>private Task<Void> saveAsync(final String sessionToken, final ProgressCallback uploadProgressCallback, Task<Void> toAwait, final Task<Void> cancellationToken) { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } return toAwait.continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } Task<ParseFile.State> saveTask = data != null ? getFileController().saveAsync( state, data, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), cancellationToken) : getFileController().saveAsync( state, file, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), <START> cancellationToken); <END> return saveTask.onSuccessTask(new Continuation<State, Task<Void>>() { @Override public Task<Void> then(Task<State> task) throws Exception { state = task.getResult(); return task.makeVoid(); } }); } }); }</code><technical_language>nit: a if/else instead? This ternary operator is weird</technical_language>

Target:
private Task<Void> saveAsync(final String sessionToken, final ProgressCallback uploadProgressCallback, Task<Void> toAwait, final Task<Void> cancellationToken) { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } return toAwait.continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { if (!isDirty()) { return Task.forResult(null); } if (cancellationToken != null && cancellationToken.isCancelled()) { return Task.cancelled(); } Task<ParseFile.State> saveTask; if (data != null) { saveTask = getFileController().saveAsync( state, data, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), cancellationToken); } else { saveTask = getFileController().saveAsync( state, file, sessionToken, progressCallbackOnMainThread(uploadProgressCallback), cancellationToken); } return saveTask.onSuccessTask(new Continuation<State, Task<Void>>() { @Override public Task<Void> then(Task<State> task) throws Exception { state = task.getResult(); file = null; return task.makeVoid(); } }); } }); }
Source:
<code>private static String[] provideIncorrectFormats() { <START> String[] data = new String[] {" Knuth, Donald E. ", "Knuth, Donald E. and Kurt Cobain and A. Einstein", <END> ", and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and ,", "and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and"}; return data; }</code><technical_language>-> Stream.of(...)</technical_language>

Target:
private static Stream<String> provideIncorrectFormats() { return Stream.of(" Knuth, Donald E. ", "Knuth, Donald E. and Kurt Cobain and A. Einstein", ", and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and ,", "and Kurt Cobain and A. Einstein", "Donald E. Knuth and Kurt Cobain and"); }
Source:
<code>public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0, 1}}, <START> {"0\\n1", new int[] {0}}, <END> {"0 1\\n2 3", new int[] {0, 1}}, {"0 1 2\\n3 4 5\\n6 7 8", new int[] {0, 1, 2}} }); }</code><technical_language>Do strings need include escaped newline? work ok for if I replaced occurrences of \\n a simple \n? a related note, change matrixAsString.replaceAll("\\\\n", "\n") lines removable too</technical_language>

Target:
public static Collection<Object[]> data() { return Arrays.asList(new Object[][]{ {"0", new int[] {0}}, {"0 1", new int[] {0, 1}}, { "0\n" + "1", new int[] {0}}, { "0 1\n" + "2 3", new int[] {0, 1}}, { "0 1 2\n" + "3 4 5\n" + "6 7 8", new int[] {0, 1, 2}} }); }
Source:
<code>protected ToStringHelper string() { <START> return Objects.toStringHelper(this) <END> .add("id", id); }</code><technical_language>Objects class replaced in Guava [MoreObjects](<LINK_0></technical_language>

Target:
protected ToStringHelper string() { return MoreObjects.toStringHelper(this).omitNullValues().add("id", id); }
Source:
<code>public Principal getPrincipal(HttpRequest httpRequest) { try { String auth = AuthUtil.getHeader(httpRequest, "Authorization"); if (!auth.isEmpty()) { String[] authArray = auth.split(" "); if (authArray[0].equals("Basic")) { return null; } else { Base64 base64Url = new Base64(true); String[] splitstring = authArray[1].split("\\."); String base64EncodedBody = splitstring[1]; String body = new String(base64Url.decode(base64EncodedBody)); JSONObject obj = new JSONObject(body); <START> String tokenType = obj.getString("typ"); <END> if (tokenType.equals("Refresh")) { handleRefreshToken(httpRequest, auth); } else if (tokenType.equals("Bearer")) { handleBearerToken(httpRequest); } } KeycloakSecurityContext keycloakSecurityContext = (KeycloakSecurityContext) httpRequest.getAttribute(KeycloakSecurityContext.class.getName()); if (keycloakSecurityContext != null) { String userName = keycloakSecurityContext.getToken().getPreferredUsername(); Principal principal = createPrincipal(userName); return principal; } } else { return null; } } catch (CandlepinException e) { throw e; } catch (Exception e) { throw new ServiceUnavailableException(i18nProvider.get().tr("Keycloak Authentication failed")); } return null; }</code><technical_language>a typo in string name (missing 'e' in "type")</technical_language>

Target:
public Principal getPrincipal(HttpRequest httpRequest) { try { String auth = AuthUtil.getHeader(httpRequest, "Authorization"); if (!auth.isEmpty()) { String[] authArray = auth.split(" "); if (authArray[0].equalsIgnoreCase("basic")) { return null; } else { String tokenType = TokenVerifier.create(authArray[1], JsonWebToken.class).getToken().getType(); switch (tokenType) { case TokenUtil.TOKEN_TYPE_BEARER: handleBearerToken(httpRequest); break; case TokenUtil.TOKEN_TYPE_REFRESH: handleRefreshToken(httpRequest, authArray[1]); break; default: log.warn("Not authenticating as token type is unsupported: {}", tokenType); break; } } KeycloakSecurityContext keycloakSecurityContext = (KeycloakSecurityContext) httpRequest.getAttribute(KeycloakSecurityContext.class.getName()); if (keycloakSecurityContext != null && keycloakSecurityContext.getToken() != null) { String userName = keycloakSecurityContext.getToken().getPreferredUsername(); return createPrincipal(userName); } } else { return null; } } catch (CandlepinException e) { throw e; } catch (Exception e) { throw new ServiceUnavailableException(i18nProvider.get().tr("Keycloak Authentication failed")); } return null; }
Source:
<code>public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); <START> } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { <END> throw logger.logExceptionAsError( new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); } final Flux<PartitionEvent> events = Flux.create(emitter -> { queueWork(RECEIVE_ALL_KEY, maximumMessageCount, maximumWaitTime, emitter); }); final Flux<PartitionEvent> map = events.collectList().map(x -> { logger.info("Number of events received: {}", x.size()); return Flux.fromIterable(x); }).block(); return new IterableStream<>(map); }</code><technical_language>nit: remove extra empty line</technical_language>

Target:
public IterableStream<PartitionEvent> receive(int maximumMessageCount, Duration maximumWaitTime) { Objects.requireNonNull(maximumWaitTime, "'maximumWaitTime' cannot be null."); if (maximumMessageCount < 1) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumMessageCount' cannot be less than 1.")); } else if (maximumWaitTime.isNegative() || maximumWaitTime.isZero()) { throw logger.logExceptionAsError( new IllegalArgumentException("'maximumWaitTime' cannot be zero or less.")); } final Flux<PartitionEvent> events = Flux.create(emitter -> { queueWork(RECEIVE_ALL_KEY, maximumMessageCount, maximumWaitTime, emitter); }); return new IterableStream<>(events); }
Source:
<code><START> protected void executeAnalysis() { <END> Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(this); for (IAnalysisModule module : modules.values()) { if (module.isAutomatic()) { try { module.setTrace(this); } catch (TmfAnalysisException e) { } module.execute(); } } }</code><technical_language>return IStatus buildStateSystem() inform user in case analysis successful? module.execute returns a status forwarded caller of executeAnalysis</technical_language>

Target:
protected IStatus executeAnalysis() { MultiStatus status = new MultiStatus(Activator.PLUGIN_ID, IStatus.OK, null, null); Map<String, IAnalysisModule> modules = TmfAnalysisManager.getAnalysisModules(this); for (IAnalysisModule module : modules.values()) { if (module.isAutomatic()) { try { module.setTrace(this); } catch (TmfAnalysisException e) { } status.add(module.execute()); } } return status; }
Source:
<code>public void testAll() throws Exception { testGetInstructorForEmail(); testGetInstructorsForEmail(); testGetInstructorForGoogleId(); testGetInstructorsForGoogleId(); testGetInstructorForRegistrationKey(); testGetInstructorsForCourse(); testGetKeyForInstructor(); testIsGoogleIdOfInstructorOfCourse(); testIsEmailOfInstructorOfCourse(); testVerifyInstructorExists(); testVerifyIsEmailOfInstructorOfCourse(); testIsNewInstructor(); testAddInstructor(); testUpdateInstructorByGoogleId(); testUpdateInstructorByEmail(); testDeleteInstructor(); testDeleteInstructorsForGoogleId(); testDeleteInstructorsForCourse(); <START> testGetCoOwnersForCourse(); <END> }</code><technical_language>test this method testDeleteInstructorsForCourse() instructors for deleted in test</technical_language>

Target:
public void testAll() throws Exception { testGetInstructorForEmail(); testGetInstructorsForEmail(); testGetInstructorForGoogleId(); testGetInstructorsForGoogleId(); testGetInstructorForRegistrationKey(); testGetInstructorsForCourse(); testGetKeyForInstructor(); testIsGoogleIdOfInstructorOfCourse(); testIsEmailOfInstructorOfCourse(); testVerifyInstructorExists(); testVerifyIsEmailOfInstructorOfCourse(); testIsNewInstructor(); testAddInstructor(); testGetCoOwnersForCourse(); testUpdateInstructorByGoogleId(); testUpdateInstructorByEmail(); testDeleteInstructor(); testDeleteInstructorsForGoogleId(); testDeleteInstructorsForCourse(); }
Source:
<code>public Response publishModel(@PathParam("modelId") long modelId) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); int tenantId = carbonContext.getTenantId(); String userName = carbonContext.getUsername(); try { String registryPath = mlModelHandler.publishModel(tenantId, userName, modelId); <START> return Response.ok(registryPath).build(); <END> } catch (InvalidRequestException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(new MLErrorBean(e.getMessage())).build(); } catch (MLModelPublisherException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(new MLErrorBean(e.getMessage())) .build(); } }</code><technical_language>this return a JSON? If need return a JSON</technical_language>

Target:
public Response publishModel(@PathParam("modelId") long modelId) { PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext(); int tenantId = carbonContext.getTenantId(); String userName = carbonContext.getUsername(); try { String registryPath = mlModelHandler.publishModel(tenantId, userName, modelId); return Response.ok(new MLResponseBean(registryPath)).build(); } catch (InvalidRequestException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.BAD_REQUEST).entity(new MLErrorBean(e.getMessage())).build(); } catch (MLModelPublisherException e) { String msg = MLUtils.getErrorMsg(String.format( "Error occurred while publishing the model [id] %s of tenant [id] %s and [user] %s .", modelId, tenantId, userName), e); logger.error(msg, e); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(new MLErrorBean(e.getMessage())) .build(); } }
Source:
<code>public int compare(RefRight a, RefRight b) { int aLength = a.getRefPattern().length(); int bLength = b.getRefPattern().length(); <START> return bLength - aLength; <END> }</code><technical_language>If lengths same, sort name? I impact code is this, I if a slightly more predictable sorting rule</technical_language>

Target:
public int compare(RefRight a, RefRight b) { int aLength = a.getRefPattern().length(); int bLength = b.getRefPattern().length(); if ((bLength - aLength) == 0) { return a.getApprovalCategoryId().get() .compareTo(b.getApprovalCategoryId().get()); } return bLength - aLength; }
Source:
<code>protected void buildVmVirtioSerial() { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSERIAL.getName()); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.VirtioSerial); <START> struct.put(VdsProperties.Index, Integer.toString(0)); <END> addAddress(vmDevice, struct); addDevice(struct, vmDevice, null); } }</code><technical_language>index is needed? if multiple devices? index 0</technical_language>

Target:
protected void buildVmVirtioSerial() { List<VmDevice> vmDevices = DbFacade.getInstance() .getVmDeviceDao() .getVmDeviceByVmIdTypeAndDevice(vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSERIAL.getName()); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.VirtioSerial); addAddress(vmDevice, struct); addDevice(struct, vmDevice, null); } }
Source:
<code>protected abstract void addKeyValue(UTF8StringPointable stringKey, TaggedValuePointable taggedValuePointable) throws IOException; private void addPair(TaggedValuePointable tempTvp) throws IOException, SystemException { TaggedValuePointable tvp = isDuplicateKeys(tempTvp, tvps.keySet()); value = ppool.takeOne(TaggedValuePointable.class); tempTvp.getValue(stringKey); op.getValue(stringKey, value); if (tvp == null) { key = ppool.takeOne(TaggedValuePointable.class); key.set(tempTvp); values = new ArrayList<>(); values.add(value); tvps.put(key, values); } else { <START> values = tvps.get(tvp); <END> values.add(value); tvps.replace(tvp, values); } }</code><technical_language>lines be: tvps.get(tvp).add(value);</technical_language>

Target:
protected abstract void addKeyValue(UTF8StringPointable stringKey, TaggedValuePointable taggedValuePointable) throws IOException; private void addPair(TaggedValuePointable tvp1, ObjectPointable op) throws IOException, SystemException { TaggedValuePointable tvp = isDuplicateKeys(tvp1, tvps.keySet()); value = ppool.takeOne(TaggedValuePointable.class); tvp1.getValue(stringKey); op.getValue(stringKey, value); if (tvp == null) { key = ppool.takeOne(TaggedValuePointable.class); key.set(tvp1); values = new ArrayList<>(); values.add(value); tvps.put(key, values); } else { tvps.get(tvp).add(value); } }
Source:
<code>public void singleCellSpanningSeveralPages() { new TestDataBuilder() <START> .put(10, 1, 1000) <END> .put(10, 1, 1001) .put(10, 1, 1002) .put(10, 1, 1003) .put(10, 1, 1004) .store(); List<CandidateCellForSweeping> cells = getAllCandidates( conservativeRequest(PtBytes.EMPTY_BYTE_ARRAY, 2000L, 2)); assertEquals(ImmutableList.of(ImmutableCandidateCellForSweeping.builder() .cell(cell(10, 1)) .isLatestValueEmpty(false) .numCellsTsPairsExamined(5) .sortedTimestamps(1000L, 1001L, 1002L, 1003L, 1004L) .build()), cells); }</code><technical_language>nit: 1000L (and similar below)</technical_language>

Target:
public void singleCellSpanningSeveralPages() { new TestDataBuilder() .put(10, 1, 1000L) .put(10, 1, 1001L) .put(10, 1, 1002L) .put(10, 1, 1003L) .put(10, 1, 1004L) .store(); List<CandidateCellForSweeping> cells = getAllCandidates( conservativeRequest(PtBytes.EMPTY_BYTE_ARRAY, 2000L, 2)); assertEquals(ImmutableList.of(ImmutableCandidateCellForSweeping.builder() .cell(cell(10, 1)) .isLatestValueEmpty(false) .numCellsTsPairsExamined(5) .sortedTimestamps(1000L, 1001L, 1002L, 1003L, 1004L) .build()), cells); }
Source:
<code>public String toString() { StringBuilder sb = new StringBuilder(); sb.append(" Bank label: " + getBankLabel()); <START> sb.append("\n Capacity: " + FormatUtil.formatBytes(getCapacity())); <END> sb.append("\n Clock speed: " + FormatUtil.formatHertz(getClockSpeed())); sb.append("\n Manufacturer: " + getManufacturer()); sb.append("\n Memory type: " + getMemoryType()); return sb.toString(); }</code><technical_language>Minor point, for output possibly multiple entries, want this line</technical_language>

Target:
public String toString() { StringBuilder sb = new StringBuilder(); sb.append("Bank label: " + getBankLabel()); sb.append(", Capacity: " + FormatUtil.formatBytes(getCapacity())); sb.append(", Clock speed: " + FormatUtil.formatHertz(getClockSpeed())); sb.append(", Manufacturer: " + getManufacturer()); sb.append(", Memory type: " + getMemoryType()); return sb.toString(); }
Source:
<code>public void getChildCollection_shouldThrowAPIExceptionIfGetterMethodNotFound() throws Exception { ClassWithBadGetter oo = new ClassWithBadGetter(); oo.setMyLocations(new HashSet<>()); <START> Assertions.assertThrows(APIException.class,() ->RequiredDataAdvice.getChildCollection(oo, ClassWithBadGetter.class.getDeclaredField("locations"))); <END> }</code><technical_language>a tiny thing, miss a whitespace -></technical_language>

Target:
public void getChildCollection_shouldThrowAPIExceptionIfGetterMethodNotFound() throws Exception { ClassWithBadGetter oo = new ClassWithBadGetter(); oo.setMyLocations(new HashSet<>()); RequiredDataAdvice.getChildCollection(oo, ClassWithBadGetter.class.getDeclaredField("locations")); }