auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Container)) { return false; } Container container = (Container) o; if (id != container.id) { return false; } if (isPrivate != container.isPrivate) { return false; } if (!name.equals(container.name)) { return false; } if (status != null ? !status.equals(container.status) : container.status != null) { return false; } <START> if (description != null ? !description.equals(container.description) : container.description != null) { <END> return false; } return parentAccount.equals(container.parentAccount); }</code><technical_language>description need part of equals</technical_language>

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Container)) { return false; } Container container = (Container) o; if (!id.equals(container.id)) { return false; } if (!name.equals(container.name)) { return false; } if (status != container.status) { return false; } if (!isPrivate.equals(container.isPrivate)) { return false; } return parentAccountId.equals(container.parentAccountId); }
Source:
<code>public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } session.save(); <START> return null; <END> }</code><technical_language>Guess return type void</technical_language>

Target:
public DocumentModel run(DocumentModel input) { DocumentModelList proxies = session.getProxies(input.getRef(), null); for (DocumentModel proxy : proxies) { session.removeDocument(proxy.getRef()); } if (save) { session.save(); } return input; }
Source:
<code>public void testDeleteAll() { Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); <START> StepVerifier.create(savedAllFlux).thenConsumeWhile(domain -> true).expectComplete().verify(); <END> final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<Long> countMono = repository.count(); StepVerifier.create(countMono).expectNext(0L).verifyComplete(); }</code><technical_language>expectNextCount = 2</technical_language>

Target:
public void testDeleteAll() { Flux<LongIdDomainPartition> savedAllFlux = this.repository.saveAll(Arrays.asList(DOMAIN_1, DOMAIN_2)); StepVerifier.create(savedAllFlux).expectNextCount(2).verifyComplete(); final Mono<Void> deletedMono = repository.deleteAll(); StepVerifier.create(deletedMono).thenAwait().verifyComplete(); Mono<Long> countMono = repository.count(); StepVerifier.create(countMono).expectNext(0L).verifyComplete(); }
Source:
<code>private void flushCodec() throws ExoPlaybackException { codecHotswapTimeMs = -1; inputIndex = -1; outputIndex = -1; waitingForFirstSyncFrame = true; decodeOnlyPresentationTimestamps.clear(); <START> if (Util.SDK_INT >= 18 && codecReinitState == REINIT_STATE_NONE) { <END> codec.flush(); } else { codecReinitState = REINIT_STATE_NONE; releaseCodec(); maybeInitCodec(); } if (codecReconfigured && format != null) { codecReconfigurationState = RECONFIGURATION_STATE_WRITE_PENDING; } hasQueuedOneInputBuffer = false; }</code><technical_language>a final pass this, I follow logic here. this left was, codecReinitState set REINIT_STATE_NONE bottom of this method, set hasQueuedOneInputBuffer false</technical_language>

Target:
private void flushCodec() throws ExoPlaybackException { codecHotswapTimeMs = -1; inputIndex = -1; outputIndex = -1; waitingForFirstSyncFrame = true; decodeOnlyPresentationTimestamps.clear(); if (Util.SDK_INT >= 18 && codecReinitState == REINIT_STATE_NONE) { codec.flush(); } else { codecReinitState = REINIT_STATE_NONE; releaseCodec(); maybeInitCodec(); } if (codecReconfigured && format != null) { codecReconfigurationState = RECONFIGURATION_STATE_WRITE_PENDING; } hasQueuedInputBuffer = false; }
Source:
<code>public void createPayment_responseWith422_whenZeroAmountForDirectDebitAccount() { publicAuthMockClient.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID, DIRECT_DEBIT); String payload = new JsonStringBuilder() .add("amount", 0) .add("reference", REFERENCE) .add("description", DESCRIPTION) <START> .add("return_url", RETURN_URL) <END> .add("agreement_id", "1234") .build(); postPaymentResponse(payload) .statusCode(422) .contentType(JSON) .body("code", is("P0102")) .body("field", is("amount")) .body("description", is("Invalid attribute value: amount. Must be greater than or equal to 1")); }</code><technical_language>request a return URL agreement ID,</technical_language>

Target:
public void createPayment_responseWith422_whenZeroAmountForDirectDebitAccount() { publicAuthMockClient.mapBearerTokenToAccountId(API_KEY, GATEWAY_ACCOUNT_ID, DIRECT_DEBIT); String payload = new JsonStringBuilder() .add("amount", 0) .add("reference", REFERENCE) .add("description", DESCRIPTION) .add("agreement_id", "1234") .build(); postPaymentResponse(payload) .statusCode(422) .contentType(JSON) .body("code", is("P0102")) .body("field", is("amount")) .body("description", is("Invalid attribute value: amount. Must be greater than or equal to 1")); }
Source:
<code><START> public void write(DataOutput dataOutput) throws IOException { <END> dataOutput.writeUTF(structureRecordJSON); dataOutput.writeUTF(sortFieldsJSON); dataOutput.writeUTF(schemaJSON); }</code><technical_language>Doc</technical_language>

Target:
public void write(DataOutput dataOutput) throws IOException { dataOutput.writeUTF(structuredRecordJSON); dataOutput.writeUTF(sortFieldsJSON); dataOutput.writeUTF(schemaJSON); }
Source:
<code>public DataRadioStation getPreviousById(String id) { <START> if (listStations.size() == 0) <END> return null; for (int i = 1; i < listStations.size(); i++) { if (listStations.get(i).ID.equals(id)) { return listStations.get(i - 1); } } return listStations.get(listStations.size()-1); }</code><technical_language>if (listStations.isEmpty())</technical_language>

Target:
public DataRadioStation getPreviousById(String id) { if (listStations.isEmpty()) return null; for (int i = 1; i < listStations.size(); i++) { if (listStations.get(i).ID.equals(id)) { return listStations.get(i - 1); } } return listStations.get(listStations.size()-1); }
Source:
<code>public void testCanNotReadWithoutPath() { try { ConfigLoader loader = new PropertiesConfigLoaderFactory().getLoader(new MapConfig()); loader.getConfig(); fail("should have gotten a samza exception"); <START> } catch (SamzaException e) { <END> } }</code><technical_language>need check in exception, @Test(expected = SamzaException.class) need try-catch</technical_language>

Target:
public void testCanNotReadWithoutPath() { ConfigLoader loader = new PropertiesConfigLoaderFactory().getLoader(new MapConfig()); loader.getConfig(); }
Source:
<code>public void testEnableTetheringPermission() throws Exception { <START> if (!mTM.isTetheringSupported()) return; final TestTetheringEventCallback tetherEventCallback = new TestTetheringEventCallback(); mTM.registerTetheringEventCallback(c -> c.run(), tetherEventCallback); tetherEventCallback.expectCallbackStarted(); final TestSoftApCallback softApCallback = new TestSoftApCallback(); mWm.registerSoftApCallback(c -> c.run(), softApCallback); final StartTetheringCallback wifiCallback = new StartTetheringCallback(); mTM.startTethering(new TetheringRequest.Builder(TETHERING_WIFI).build(), c -> c.run(), wifiCallback); wifiCallback.verifyTetheringStarted(); softApCallback.expectSoftApState(WifiManager.WIFI_AP_STATE_ENABLED, DEFAULT_TIMEOUT_MS); <END> mTM.stopAllTethering(); softApCallback.expectSoftApState(WifiManager.WIFI_AP_STATE_DISABLED, DEFAULT_TIMEOUT_MS); mTM.unregisterTetheringEventCallback(tetherEventCallback); mUiAutomation.dropShellPermissionIdentity(); mTM.startTethering(new TetheringRequest.Builder(TETHERING_WIFI).build(), c -> c.run(), wifiCallback); wifiCallback.expectTetheringFailed(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION); }</code><technical_language>This identical test above, factored out ? Is objective of this test test stopAllTethering ? need re-test callbacks (like softApCallback) in case</technical_language>

Target:
public void testEnableTetheringPermission() throws Exception { mUiAutomation.dropShellPermissionIdentity(); final StartTetheringCallback startTetheringCallback = new StartTetheringCallback(); mTM.startTethering(new TetheringRequest.Builder(TETHERING_WIFI).build(), c -> c.run(), startTetheringCallback); startTetheringCallback.expectTetheringFailed(TETHER_ERROR_NO_CHANGE_TETHERING_PERMISSION); }
Source:
<code>public void testAppendCustomFileAbsoluteDirCompletion() throws Exception { Path tempFile = Files.createTempFile("tempFile", ".tmp"); String tempFileStringPath = tempFile.toString(); try { ctx.handle("version >" + tempFileStringPath); List<String> paths = new ArrayList<>(); paths.add(tempFile.toAbsolutePath().getRoot().toString()); for (int i=0; i < tempFile.toAbsolutePath().getNameCount(); i++) { paths.add(tempFile.toAbsolutePath().getName(i).toString()); } String cmd = "version >>"; String testPath = ""; <START> List<String> candidates = new ArrayList<>(); <END> for (int i = 0; i < (paths.size() - 1); i++) { String p = paths.get(i); if (i == 0 || (i == paths.size() - 1)) { testPath += p; } else { testPath += p + File.separator; } if (i < tempFile.toAbsolutePath().getNameCount() - 1) { candidates = complete(ctx, cmd + testPath, null); assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem(paths.get(i+1) + File.separator)); } else { candidates = complete(ctx, cmd + testPath, null); assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem((paths.get(paths.size()-1)))); } } } finally { Files.delete(tempFile); } }</code><technical_language>need create ArrayList</technical_language>

Target:
public void testAppendCustomFileAbsoluteDirCompletion() throws Exception { Path tempFile = Files.createTempFile("tempFile", ".tmp"); String tempFileStringPath = tempFile.toString(); try { ctx.handle("version >" + tempFileStringPath); List<String> paths = new ArrayList<>(); paths.add(tempFile.toAbsolutePath().getRoot().toString()); for (int i=0; i < tempFile.toAbsolutePath().getNameCount(); i++) { paths.add(tempFile.toAbsolutePath().getName(i).toString()); } String cmd = "version >>"; String testPath = ""; List<String> candidates; for (int i = 0; i < paths.size() - 1; i++) { String p = paths.get(i); if (i == 0 || (i == paths.size() - 1)) { testPath += p; } else { testPath += p + File.separator; } candidates = complete(ctx, cmd + testPath, null); if (i < tempFile.toAbsolutePath().getNameCount() - 1) { assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem(paths.get(i+1) + File.separator)); } else { assertThat("No candidate for completion match with the expected content.", candidates, CoreMatchers.hasItem((paths.get(paths.size()-1)))); } } } finally { Files.delete(tempFile); } }
Source:
<code>private int getExampleColumn(TableSupport tableSupport) { Row headerRow = tableSupport.getLastHeaderRow(); for (Element e : headerRow.getCells()) { <START> String exampleText = e.getAttributeValue("exampleName", ConcordionBuilder.NAMESPACE_CONCORDION_2007); <END> if (exampleText != null) { int exampleNameIndex = headerRow.getIndexOfCell(e); return exampleNameIndex; } } return -1; }</code><technical_language>need raise issue IntelliJ Eclipse extensions add support for this attribute</technical_language>

Target:
private int getExampleColumn(TableSupport tableSupport) { Row headerRow = tableSupport.getLastHeaderRow(); for (Element e : headerRow.getCells()) { String exampleText = e.getAttributeValue("example", ConcordionBuilder.NAMESPACE_CONCORDION_2007); if (exampleText != null) { int exampleNameIndex = headerRow.getIndexOfCell(e); return exampleNameIndex; } } return -1; }
Source:
<code>protected void addPidToResource(ResourceTable theEntity, IBaseResource theResource) { if (theResource instanceof IAnyResource) { IDao.RESOURCE_PID.put((IAnyResource) theResource, theEntity.getId()); <START> } <END> }</code><technical_language>This java if (theResource instanceof IResource) { ..... } ..to cover DSTU2 structures</technical_language>

Target:
protected void addPidToResource(ResourceTable theEntity, IBaseResource theResource) { if (theResource instanceof IAnyResource) { IDao.RESOURCE_PID.put((IAnyResource) theResource, theEntity.getId()); } else if (theResource instanceof IResource) { IDao.RESOURCE_PID.put((IResource) theResource, theEntity.getId()); } }
Source:
<code><START> public GeofencingApiImpl() { <END> }</code><technical_language>Empty public constructor removed</technical_language>

Target:
public GeofencingApiImpl() { pendingIntentMap = new HashMap<>(); }
Source:
<code>public synchronized void put(String originalQuery, String parameterizedQuery, AdHocPlannedStatement planIn, String[] extractedLiterals, boolean hasUserQuestionMarkParameters, boolean hasAutoParameterizedException) { assert(originalQuery != null); assert(parameterizedQuery != null); assert(planIn != null); <START> AdHocPlannedStatement plan = planIn; <END> assert(!hasUserQuestionMarkParameters || !hasAutoParameterizedException); if (! hasAutoParameterizedException) { CorePlan corePlan = m_coreCache.get(parameterizedQuery); if (corePlan == null) { corePlan = planIn.core; m_coreCache.put(parameterizedQuery, corePlan); ++m_planInsertions; } else { assert(corePlan.equals(plan.core)); } } if (! hasUserQuestionMarkParameters) { AdHocPlannedStatement cachedPlan = m_literalCache.get(originalQuery); if (cachedPlan == null) { / System.out.println("DEBUG: Caching literal '" + sql + "'"); m_literalCache.put(originalQuery, plan); ++m_literalInsertions; } else { assert(cachedPlan.equals(plan)); } } }</code><technical_language>local variable plan is redundant</technical_language>

Target:
public synchronized void put(String originalQuery, String parameterizedQuery, AdHocPlannedStatement planIn, String[] extractedLiterals, boolean hasUserQuestionMarkParameters, boolean hasAutoParameterizedException) { Preconditions.checkNotNull(originalQuery); Preconditions.checkNotNull(parameterizedQuery); Preconditions.checkNotNull(planIn); assert(!hasUserQuestionMarkParameters || !hasAutoParameterizedException); if (! hasAutoParameterizedException) { CorePlan corePlan = m_coreCache.get(parameterizedQuery); if (corePlan == null) { corePlan = planIn.core; m_coreCache.put(parameterizedQuery, corePlan); ++m_planInsertions; } else { assert(corePlan.equals(planIn.core)); } } if (! hasUserQuestionMarkParameters) { AdHocPlannedStatement cachedPlan = m_literalCache.get(originalQuery); if (cachedPlan == null) { / System.out.println("DEBUG: Caching literal '" + sql + "'"); m_literalCache.put(originalQuery, planIn); ++m_literalInsertions; } else { assert(cachedPlan.equals(planIn)); } } }
Source:
<code>public void visitNode(Tree tree) { if (tree.is(Kind.BITWISE_AND, Kind.BITWISE_OR) && !((BinaryExpressionTree) tree).rightOperand().is(Kind.NUMERIC_LITERAL)) { <START> SyntaxToken operator = ((BinaryExpressionTree) tree).operator(); <END> bitwiseAndOrOperators.add(operator); } else { fileContainsBitwiseOperations = true; } }</code><technical_language>inline this operator variable added bitwiseAndOrOperators</technical_language>

Target:
public void visitNode(Tree tree) { if (lonelyBitwiseAndOr == null && tree.is(Kind.BITWISE_AND, Kind.BITWISE_OR) && !((BinaryExpressionTree) tree).rightOperand().is(Kind.NUMERIC_LITERAL)) { lonelyBitwiseAndOr = ((BinaryExpressionTree) tree).operator(); } else { fileContainsBitwiseOperations = true; } }
Source:
<code>public static void saveJksTo(KeyStore keystore, String storePass, String storeLoc) { try (FileOutputStream os = new FileOutputStream(storeLoc)) { keystore.store(os, storePass.toCharArray()); } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { <START> LOG.error("error unable to save to the keystore: {}", storeLoc, e.getLocalizedMessage(), e); <END> } }</code><technical_language>throw exception fail silently</technical_language>

Target:
public static void saveJksTo(KeyStore keystore, String storePass, String storeLoc) throws UtilException { try (FileOutputStream os = new FileOutputStream(storeLoc)) { keystore.store(os, storePass.toCharArray()); } catch (KeyStoreException | NoSuchAlgorithmException | CertificateException | IOException e) { throw new UtilException("Unable to save to the tempKeystore.", e); } }
Source:
<code>public void testInvalidHttpsConfiguration() { Map<String, String> properties = new ImmutableMap.Builder<String, String>() .put("http-server.https.enabled", "true") .put("http-server.https.keystore.key", "keystore password") .build(); <START> ConfigurationFactory configurationFactory = new ConfigurationFactory(properties); <END> assertThatThrownBy(() -> configurationFactory.build(HttpServerConfig.class)) .isInstanceOf(ConfigurationException.class) .hasMessageContaining("PEM keystore path/password must be provided when HTTPS is enabled"); }</code><technical_language>if assertFailsValidation</technical_language>

Target:
public void testInvalidHttpsConfiguration() { assertFailsValidation( new HttpServerConfig() .setHttpsEnabled(true) .setKeystorePassword("keystore password"), "httpsConfigurationValid", "Keystore path/password must be provided when HTTPS is enabled", AssertTrue.class); }
Source:
<code>public void visitNode(Tree tree) { MethodTree methodTree = (MethodTree) tree; List<VariableSymbol> booleanParameterSymbols = getBooleanParametersAsSymbol(methodTree.parameters()); BlockTree blockTree = methodTree.block(); if (isPublic(methodTree) && blockTree != null && !booleanParameterSymbols.isEmpty()) { for (VariableSymbol variable : booleanParameterSymbols) { Collection<IdentifierTree> usages = getSemanticModel().getUsages(variable); if (usages.size() == 1) { <START> blockTree.accept(new ConditionnalStatementVisitor(variable.getName(), getSingleUsage(usages), tree)); <END> } } } }</code><technical_language>Typo : 'n' in conditional</technical_language>

Target:
public void visitNode(Tree tree) { if (!hasSemantic()) { return; } MethodTree methodTree = (MethodTree) tree; List<VariableSymbol> booleanParameterSymbols = getBooleanParametersAsSymbol(methodTree.parameters()); BlockTree blockTree = methodTree.block(); if (isPublic(methodTree) && blockTree != null && !booleanParameterSymbols.isEmpty()) { for (VariableSymbol variable : booleanParameterSymbols) { Collection<IdentifierTree> usages = getSemanticModel().getUsages(variable); if (usages.size() == 1) { blockTree.accept(new ConditionalStatementVisitor(variable.getName(), Iterables.get(usages, 0), tree)); } } } }
Source:
<code>public static <T extends Object> List<T> distinctListByClassOfObjects(List<T> listToDistinct) { List<T> distinctList = new ArrayList<>(); HashMap<Class, T> uniqueMap = new HashMap<>(); for (T objectInstance : listToDistinct) { uniqueMap.put(objectInstance.getClass(), objectInstance); } distinctList.addAll(uniqueMap.values()); <START> return distinctList; <END> }</code><technical_language>Perfect! :+1: a things. a picky :grimacing: need extends Object. Please Map declaration type. java return new ArrayList<>(uniqueMap.values()); method is a perfect text-book example for tests. :wink:</technical_language>

Target:
public static <T> List<T> distinctListByClassOfObjects(List<T> listToDistinct) { Map<Class, T> uniqueMap = new HashMap<>(); for (T objectInstance : listToDistinct) { uniqueMap.put(objectInstance.getClass(), objectInstance); } return new ArrayList<>(uniqueMap.values()); }
Source:
<code>private MessageMetadata getMetadata(Map<Utf8, Utf8> metadata) { if (metadata == null) { long timestamp = clock.millis(); <START> return new MessageMetadata(timestamp, MessageId.empty(), Collections.EMPTY_MAP); <END> } else { long timestamp = metadata.containsKey(METADATA_TIMESTAMP_KEY) ? timestampFromMetadata(metadata) : clock.millis(); String messageId = metadata.containsKey(METADATA_MESSAGE_ID_KEY) ? messageIdFromMetadata(metadata) : MessageId.empty(); return new MessageMetadata(timestamp, messageId, extractMetadata(metadata)); } }</code><technical_language>skip MessageId param in constructor MessageMetadata handle case of missing ID - get single responsibility for free</technical_language>

Target:
private MessageMetadata getMetadata(Map<Utf8, Utf8> metadata) { if (metadata == null) { long timestamp = clock.millis(); return new MessageMetadata(timestamp, Collections.EMPTY_MAP); } else { long timestamp = metadata.containsKey(METADATA_TIMESTAMP_KEY) ? timestampFromMetadata(metadata) : clock.millis(); Map<String, String> extractedMetadata = extractMetadata(metadata); return metadata.containsKey(METADATA_MESSAGE_ID_KEY) ? new MessageMetadata(timestamp, messageIdFromMetadata(metadata), extractedMetadata) : new MessageMetadata(timestamp, extractedMetadata); } }
Source:
<code>private void checkGroupingSetsCount(GroupBy node) { int crossProduct = 1; for (GroupingElement element : node.getGroupingElements()) { try { int product; if (element instanceof Cube) { int exponent = ((Cube) element).getColumns().size(); if (exponent > 30) { throw new ArithmeticException(); } product = 1 << exponent; } else if (element instanceof Rollup) { product = ((Rollup) element).getColumns().size() + 1; } else { product = element.enumerateGroupingSets().size(); } crossProduct = Math.multiplyExact(crossProduct, product); } catch (ArithmeticException e) { <START> throw new SemanticException(INVALID_PROCEDURE_ARGUMENTS, node, <END> "GROUP BY has more than %s grouping sets but can contain at most %s", Integer.MAX_VALUE, getMaxGroupingSets(session)); } if (crossProduct > getMaxGroupingSets(session)) { throw new SemanticException(INVALID_PROCEDURE_ARGUMENTS, node, "GROUP BY has %s grouping sets but can contain at most %s", crossProduct, getMaxGroupingSets(session)); } } }</code><technical_language>This error is appropriate. Add a TOO_MANY_GROUPING_SETS SemanticErrorCode</technical_language>

Target:
private void checkGroupingSetsCount(GroupBy node) { int crossProduct = 1; for (GroupingElement element : node.getGroupingElements()) { try { int product; if (element instanceof Cube) { int exponent = ((Cube) element).getColumns().size(); if (exponent > 30) { throw new ArithmeticException(); } product = 1 << exponent; } else if (element instanceof Rollup) { product = ((Rollup) element).getColumns().size() + 1; } else { product = element.enumerateGroupingSets().size(); } crossProduct = Math.multiplyExact(crossProduct, product); } catch (ArithmeticException e) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has more than %s grouping sets but can contain at most %s", Integer.MAX_VALUE, getMaxGroupingSets(session)); } if (crossProduct > getMaxGroupingSets(session)) { throw new SemanticException(TOO_MANY_GROUPING_SETS, node, "GROUP BY has %s grouping sets but can contain at most %s", crossProduct, getMaxGroupingSets(session)); } } }
Source:
<code>public dClass(String s) { path=s; dclass_index=0; <START> if (!isDClassInitialized) { <END> init(); isDClassInitialized = true; } }</code><technical_language>This if condition is true, isDClassInitialized is default false. remove guard</technical_language>

Target:
public dClass(String s) { path=s; dclass_index=0; isDClassInitialized = ( init() >= 0); }
Source:
<code>public Predicate<String> getFilterEventPredicate() { return dataSetId -> getDataSetQueryHelper() != null && <START> getDataSetQueryHelper() != null && <END> getDataSetQueryHelper().getCurrentTableSettings() != null && dataSetId != null && dataSetId.equals(getDataSetQueryHelper().getCurrentTableSettings().getUUID()); }</code><technical_language>I guess _getDataSetQueryHelper_ is duplicated here</technical_language>

Target:
public Predicate<String> getFilterEventPredicate() { return dataSetId -> getDataSetQueryHelper() != null && getDataSetQueryHelper().getCurrentTableSettings() != null && dataSetId != null && dataSetId.equals(getDataSetQueryHelper().getCurrentTableSettings().getUUID()); }
Source:
<code>public boolean isDue() { final Jenkins j = Jenkins.getInstance(); <START> if(j == null || j.isUsageStatisticsCollected() || DISABLED || COMPLETED.compareTo(j.getInitLevel()) > 0) <END> return false; long now = System.currentTimeMillis(); if(now - lastAttempt > DAY) { lastAttempt = now; return true; } return false; }</code><technical_language>brackets IMO</technical_language>

Target:
public boolean isDue() { final Jenkins j = Jenkins.getInstance(); if (j == null || j.isUsageStatisticsCollected() || DISABLED || COMPLETED.compareTo(j.getInitLevel()) > 0) { return false; } long now = System.currentTimeMillis(); if(now - lastAttempt > DAY) { lastAttempt = now; return true; } return false; }
Source:
<code>private static List<Community> convert(Concept concept, String acknowledgementParamName) { <START> List<Community> communities = new ArrayList<>(); for (Param param : concept.getParams()) { if (acknowledgementParamName.equals(param.getName())) { communities.add(buildCommunity(concept.getId(), concept.getLabel(), StringUtils.isNotBlank(param.getValue()) ? param.getValue() : "")); } } return communities; <END> }</code><technical_language>1. I StringUtils.defaultIfBlank(param.getValue(), "") StringUtils.isNotBlank(param.getValue()) ? param.getValue() : "" 1. IDE complains CharSequence String.equals here: cknowledgementParamName.equals(param.getName()) 1. streams more readable java return concept.getParams().stream() .filter(x -> acknowledgementParamName.equals(x.getName().toString())) .map(x -> buildCommunity(concept.getId(), concept.getLabel(), StringUtils.defaultIfBlank(x.getValue(), ""))) .collect(Collectors.toList());</technical_language>

Target:
private static List<Community> convert(Concept concept, String acknowledgementParamName) { return concept.getParams().stream() .filter(x -> acknowledgementParamName.equals(x.getName().toString())) .map(x -> buildCommunity(concept.getId(), concept.getLabel(), StringUtils.defaultIfBlank(x.getValue(), ""))) .collect(Collectors.toList()); }
Source:
<code><START> public short getDatacenterId() { <END> return datacenterId; }</code><technical_language>return a byte</technical_language>

Target:
public byte getDatacenterId() { return datacenterId; }
Source:
<code>public static InetAddress resolveIpAddress() throws UnknownHostException { if (ipAddress != null) { return ipAddress; } Enumeration<NetworkInterface> netInterfaces = null; try { netInterfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { LOGGER.error("Socket error during resolving IP socketAddress", e); } while (netInterfaces != null && netInterfaces.hasMoreElements()) { NetworkInterface ni = netInterfaces.nextElement(); Enumeration<InetAddress> address = ni.getInetAddresses(); while (address.hasMoreElements()) { InetAddress addr = address.nextElement(); if (!addr.isLoopbackAddress() && addr.getAddress().length == 4) { return ipAddress = addr; } } } <START> throw new UnsupportedOperationException(); <END> }</code><technical_language>why</technical_language>

Target:
public static InetAddress resolveIpAddress() throws UnknownHostException { if (ipAddress != null) { return ipAddress; } Enumeration<NetworkInterface> netInterfaces = null; try { netInterfaces = NetworkInterface.getNetworkInterfaces(); } catch (SocketException e) { LOGGER.error("Socket error during resolving IP address", e); } while (netInterfaces != null && netInterfaces.hasMoreElements()) { NetworkInterface ni = netInterfaces.nextElement(); Enumeration<InetAddress> address = ni.getInetAddresses(); while (address.hasMoreElements()) { InetAddress addr = address.nextElement(); if (!addr.isLoopbackAddress() && addr.getAddress().length == 4) { return ipAddress = addr; } } } return InetAddress.getLocalHost(); }
Source:
<code>public void testConversionForByteFields() { TestableZoomObject2 pojo = new TestableZoomObject2(); TestMessage proto = pojo.toProto(TestMessage.class); assertTrue(pojo.compare(proto)); TestableZoomObject2 convertedPojo = ZoomConvert.fromProto(proto, TestableZoomObject2.class); <START> assertTrue(pojo.equals(convertedPojo)); <END> }</code><technical_language>i.e. assertEquals</technical_language>

Target:
public void testConversionForByteFields() { TestableZoomObject2 pojo = new TestableZoomObject2(); TestMessage proto = pojo.toProto(TestMessage.class); assertTrue(pojo.compare(proto)); TestableZoomObject2 convertedPojo = ZoomConvert.fromProto(proto, TestableZoomObject2.class); assertEquals(pojo, convertedPojo); }
Source:
<code>void validateJoinKeySchemas(Map<String, Schema> inputSchemas, Map<String, List<String>> joinKeys, FailureCollector collector) { if (!containsMacro(JoinerConfig.JOIN_KEYS) && <START> !inputSchemas.isEmpty() && !inputSchemas.values().stream().anyMatch(v -> v == null) && <END> joinKeys.size() != inputSchemas.size()) { collector.addFailure("There should be join keys present from each stage.", "Ensure join keys are present from each stage.") .withConfigProperty(JoinerConfig.JOIN_KEYS); } }</code><technical_language>duplicate code, refactored in multiple places</technical_language>

Target:
void validateJoinKeySchemas(Map<String, Schema> inputSchemas, Map<String, List<String>> joinKeys, FailureCollector collector) { if (!containsMacro(JoinerConfig.JOIN_KEYS) && inputSchemasAvailable(inputSchemas) && joinKeys.size() != inputSchemas.size()) { collector.addFailure("There should be join keys present from each stage.", "Ensure join keys are present from each stage.") .withConfigProperty(JoinerConfig.JOIN_KEYS); } }
Source:
<code>public void cancel() { <START> while (!TASK_STOPPABLE) { try { Thread.sleep(1000L); <END> } catch (Exception e) { } } super.cancel(); }</code><technical_language>This while-loop-sleep option. a countdown solve this wait better</technical_language>

Target:
public void cancel() { try { latch.await(); } catch (Exception e) { } super.cancel(); }
Source:
<code>public boolean relationshipAlreadyExists(String fieldName, PersistentResource toAdd) { Object relation = this.getValueUnchecked(fieldName); String toAddId = toAdd.getId(); if (toAddId == null) { return false; } if (relation instanceof Collection) { <START> return ((Collection) relation).stream().anyMatch((obj -> dictionary.getId(obj).equals(toAddId))); <END> } else { return toAddId.equals(dictionary.getId(relation)); } }</code><technical_language>swap operands of equals checked for null toAddId</technical_language>

Target:
public boolean relationshipAlreadyExists(String fieldName, PersistentResource toAdd) { Object relation = this.getValueUnchecked(fieldName); String toAddId = toAdd.getId(); if (toAddId == null) { return false; } if (relation instanceof Collection) { return ((Collection) relation).stream().anyMatch((obj -> toAddId.equals(dictionary.getId(obj)))); } else { return toAddId.equals(dictionary.getId(relation)); } }
Source:
<code>private List<VM> getVmsForUpdate(List<Guid> vmsIds) { if (vmsIds.isEmpty()) { return Collections.emptyList(); } List<Guid> idsToProcess = getIdsToProcess(vmsIds); List<VM> toReturn = new ArrayList<VM>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getstatus()) { <START> VmHandler.updateDisksFromDb(vm); <END> Long currentDbGeneration = getVmAndTemplatesGenerationsDAO().getDbGeneration(vm.getId()); if (vm.getStaticData().getDb_generation() == currentDbGeneration) { boolean verifyDisksNotLocked = verifyDisksNotLocked(vm.getDiskList()); if (verifyDisksNotLocked) { toReturn.add(vm); } } } } return toReturn; }</code><technical_language>here, a query check</technical_language>

Target:
private List<VM> getVmsForUpdate(List<Guid> vmsIds) { if (vmsIds.isEmpty()) { return Collections.emptyList(); } List<Guid> idsToProcess = getIdsToProcess(vmsIds); List<VM> toReturn = new ArrayList<VM>(); List<VM> vms = getVmDao().getVmsByIds(idsToProcess); for (VM vm : vms) { if (VMStatus.ImageLocked != vm.getstatus()) { VmHandler.updateDisksFromDb(vm); boolean verifyDisksNotLocked = verifyDisksNotLocked(vm.getDiskList()); if (verifyDisksNotLocked) { Long currentDbGeneration = getVmAndTemplatesGenerationsDAO().getDbGeneration(vm.getId()); if (vm.getStaticData().getDb_generation() == currentDbGeneration) { toReturn.add(vm); } } } } return toReturn; }
Source:
<code><START> public static HazelcastInstance newHazelcastClient(AddressProvider addressProvider, ClientConfig clientConfig) { <END> return newHazelcastClientInternal(addressProvider, MultipleClientConfigSupport.resolveClientConfigs(clientConfig)); }</code><technical_language>is this a public API? do want hide in internal? I understand is for testing purposes</technical_language>

Target:
public static HazelcastInstance newHazelcastClient(AddressProvider addressProvider, ClientConfig clientConfig) { return newHazelcastClientInternal(addressProvider, FailoverClientConfigSupport.resolveClientConfig(clientConfig)); }
Source:
<code>private TTransport createNewTransport(ThriftTransportKey cacheKey) throws TTransportException { TTransport transport = ThriftUtil.createClientTransport(cacheKey.getServer(), (int) cacheKey.getTimeout(), cacheKey.getSslParams(), cacheKey.getSaslParams()); log.trace("Creating new connection to connection to {}", cacheKey.getServer()); CachedTTransport tsc = new CachedTTransport(transport, cacheKey); CachedConnection cc = new CachedConnection(tsc); cc.reserve(); try { Lock lock = getLock(cacheKey); lock.lock(); try { CachedConnections cachedConns = getCache().computeIfAbsent(cacheKey, ck -> new CachedConnections()); cachedConns.reserved.put(cc.transport, cc); } finally { lock.unlock(); } } catch (TransportPoolShutdownException e) { <START> cc.transport.close(); <END> throw e; } return cc.transport; }</code><technical_language>This is example of code is handles a concurrent shutdown</technical_language>

Target:
private TTransport createNewTransport(ThriftTransportKey cacheKey) throws TTransportException { TTransport transport = ThriftUtil.createClientTransport(cacheKey.getServer(), (int) cacheKey.getTimeout(), cacheKey.getSslParams(), cacheKey.getSaslParams()); log.trace("Creating new connection to connection to {}", cacheKey.getServer()); CachedTTransport tsc = new CachedTTransport(transport, cacheKey); CachedConnection connection = new CachedConnection(tsc); connection.reserve(); try { ConnectionPool pool = getConnectionPool(); pool.putReserved(cacheKey, connection); } catch (TransportPoolShutdownException e) { connection.transport.close(); throw e; } return connection.transport; }
Source:
<code>public List<Section> getSectionsUnderEvalGroup( String evalGroupID ) { List<Section> sections = new ArrayList<Section>(); if( evalGroupID == null ) { throw new IllegalArgumentException( "evalGroupId cannot be null" ); } if( !evalGroupID.startsWith( EvalConstants.GROUP_ID_SITE_PREFIX ) ) { throw new IllegalArgumentException( "cannot determine sections of groupId='" + evalGroupID + "' (must be a site)" ); } boolean isSingleSection = false; if( evalGroupID.contains( EvalConstants.GROUP_ID_SECTION_PREFIX ) ) { isSingleSection = true; } try { String siteID = evalGroupID.replace( EvalConstants.GROUP_ID_SITE_PREFIX, "" ); if( isSingleSection ) { <START> sections.add( courseManagementService.getSection( evalGroupID.substring( evalGroupID.indexOf( EvalConstants.GROUP_ID_SECTION_PREFIX ) + 9 ) ) ); <END> } else { String realmID = siteService.siteReference( siteID ); Set<String> sectionIDs = authzGroupService.getProviderIds( realmID ); for( String secID : sectionIDs ) { sections.add( courseManagementService.getSection( secID ) ); } } } catch( Exception ex ) return sections; }</code><technical_language>Constant again. If parsing evalGroupIDs in multiple places good utility methods do work</technical_language>

Target:
public List<Section> getSectionsUnderEvalGroup( String evalGroupID ) { if( evalGroupID == null ) { throw new IllegalArgumentException( "evalGroupId cannot be null" ); } if( !evalGroupID.startsWith( EvalConstants.GROUP_ID_SITE_PREFIX ) ) { throw new IllegalArgumentException( "cannot determine sections of groupId='" + evalGroupID + "' (must be a site)" ); } List<Section> sections = new ArrayList<>(); boolean isSingleSection = false; if( evalGroupID.contains( EvalConstants.GROUP_ID_SECTION_PREFIX ) ) { isSingleSection = true; } try { String siteID = evalGroupID.replace( EvalConstants.GROUP_ID_SITE_PREFIX, "" ); if( isSingleSection ) { sections.add( courseManagementService.getSection( evalGroupID.substring( evalGroupID.indexOf( EvalConstants.GROUP_ID_SECTION_PREFIX ) + EvalConstants.GROUP_ID_SECTION_PREFIX.length() ) ) ); } else { String realmID = siteService.siteReference( siteID ); Set<String> sectionIDs = authzGroupService.getProviderIds( realmID ); for( String secID : sectionIDs ) { sections.add( courseManagementService.getSection( secID ) ); } } } catch( Exception ex ) return sections; }
Source:
<code><START> public void testGooglePlayStoreInstallSourceIsParsedCorrectly() { <END> final InstallSource installSource = InstallSource.fromInstallerPackageName("com.android.vending"); assertTrue(installSource instanceof GooglePlayStoreInstallSource); assertEquals("Google Play Store", installSource.toString()); }</code><technical_language><b>Reporter: </b>PMD<br /><b>Violation: </b><a target="_blank" href="<LINK_0>">JUnitTestContainsTooManyAsserts</a><br /><b>Notes: </b>JUnit tests more 1 assert(s)</technical_language>

Target:
public void testGooglePlayStoreInstallSourceIsParsedCorrectly() { final InstallSource installSource = InstallSource.fromInstallerPackageName("com.android.vending"); assertTrue( "Package name is correctly identified as belonging to the Google Play Store", installSource instanceof GooglePlayStoreInstallSource); assertEquals( "Google Play Store install source has correct description", "Google Play Store", installSource.toString()); }
Source:
<code>private void loadBackgroundImage() { final Controller controller = Controller.getCurrentController(); final MapStyle mapStyle = controller.getModeController().getExtension(MapStyle.class); final MapModel model = controller.getMap(); <START> final String file = mapStyle.getProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE); <END> if (file == MapStyle.CLEAR_BACKGROUND_IMAGE) { backgroundImage = null; return; } URI uri = null; try { uri = new URI(file); } catch (final URISyntaxException e) { LogUtils.severe(e); return; } try { backgroundImage = ImageIO.read(uri.toURL()); } catch (final IOException e) { LogUtils.severe(e); return; } }</code><technical_language>is "file" URI. file "a b.png" corresponds URI "a%20b.png", things. Naming uri "file" confused me</technical_language>

Target:
private void loadBackgroundImage() { final MapStyle mapStyle = getModeController().getExtension(MapStyle.class); final String uriString = mapStyle.getProperty(model, MapStyle.RESOURCES_BACKGROUND_IMAGE); if (uriString == null) { backgroundComponent = null; return; } URI uri = assignAbsoluteURI(uriString); final ViewerController vc = getModeController().getExtension(ViewerController.class); final IViewerFactory factory = vc.getCombiFactory(); if (uri != null) { assignViewerToBackgroundComponent(factory, uri); ((ScalableComponent) backgroundComponent).setCenter(true); } repaint(); }
Source:
<code><START> public void bufferWhilePredicateNull() { <END> try { Observable.empty().bufferSplitWhen(null, false); Assert.fail("Didn't throw NullPointerException"); } catch (NullPointerException ex) { Assert.assertEquals("predicate", ex.getMessage()); } }</code><technical_language>k, live in dedicated clas, ok</technical_language>

Target:
public void bufferWhilePredicateNull() { try { Observable.empty().bufferWhile(null); Assert.fail("Didn't throw NullPointerException"); } catch (NullPointerException ex) { Assert.assertEquals("predicate", ex.getMessage()); } }
Source:
<code>private TableStatistics createZeroStatistics(Map<String, ColumnHandle> columns, Map<String, Type> columnTypes) { TableStatistics.Builder result = TableStatistics.builder(); result.setRowCount(Estimate.of(0)); columns.forEach((columnName, columnHandle) -> { <START> Type columnType = requireNonNull(columnTypes.get(columnName), "columnType is null"); <END> ColumnStatistics.Builder columnStatistics = ColumnStatistics.builder(); columnStatistics.setNullsFraction(Estimate.of(0)); columnStatistics.setDistinctValuesCount(Estimate.of(0)); if (isDataSizeRequired(columnType)) { columnStatistics.setDataSize(Estimate.of(0)); } result.setColumnStatistics(columnHandle, columnStatistics.build()); }); return result.build(); }</code><technical_language>nit: perhaps, include column name in error message</technical_language>

Target:
private TableStatistics createZeroStatistics(Map<String, ColumnHandle> columns, Map<String, Type> columnTypes) { TableStatistics.Builder result = TableStatistics.builder(); result.setRowCount(Estimate.of(0)); columns.forEach((columnName, columnHandle) -> { Type columnType = columnTypes.get(columnName); verify(columnType != null, "columnType is missing for column: %s", columnName); ColumnStatistics.Builder columnStatistics = ColumnStatistics.builder(); columnStatistics.setNullsFraction(Estimate.of(0)); columnStatistics.setDistinctValuesCount(Estimate.of(0)); if (hasDataSize(columnType)) { columnStatistics.setDataSize(Estimate.of(0)); } result.setColumnStatistics(columnHandle, columnStatistics.build()); }); return result.build(); }
Source:
<code>public double score(InsertionData best, Job job) { Vehicle selectedVehicle = best.getSelectedVehicle(); double maxFromStart = job.getAllLocations().stream() .mapToDouble(l -> getDistance(selectedVehicle.getStartLocation(), l)) .max() .orElse(0d); double maxToEnd = job.getAllLocations().stream() .mapToDouble(l -> getDistance(selectedVehicle.getEndLocation(), l)) .max() .orElse(0d); double maxDepotDistance = Math.max(maxFromStart, maxToEnd); double minTimeToOperate = job.getOperationTimeWindows().stream() .mapToDouble(tw -> tw.getEnd() - tw.getStart()) .min() <START> .orElse(0d); <END> return Math.max(timeWindowParam * minTimeToOperate, minTimeWindowScore) + depotDistanceParam * maxDepotDistance; }</code><technical_language>Nice , I need accustomed streaming lib</technical_language>

Target:
public double score(InsertionData best, Job job) { Vehicle selectedVehicle = best.getSelectedVehicle(); double maxFromStart = job.getAllLocations().stream() .mapToDouble(l -> getDistance(selectedVehicle.getStartLocation(), l)) .max() .orElse(0d); double maxToEnd = job.getAllLocations().stream() .mapToDouble(l -> getDistance(selectedVehicle.getEndLocation(), l)) .max() .orElse(0d); double maxDepotDistance = Math.max(maxFromStart, maxToEnd); double minTimeToOperate = job.getTimeWindows().stream() .mapToDouble(tw -> tw.getEnd() - tw.getStart()) .min() .orElse(0d); return Math.max(timeWindowParam * minTimeToOperate, minTimeWindowScore) + depotDistanceParam * maxDepotDistance; }
Source:
<code>public void setup() throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, InterruptedException, NoSuchFieldException { Configuration conf = new Configuration(); String input_file = ClassLoader.getSystemClassLoader().getResource(filename).getFile(); conf.set("hadoopbam.vcf.trust-exts", "true"); conf.set("mapred.input.dir", "file://" + input_file); conf.setStrings("io.compression.codecs", BGZFEnhancedGzipCodec.class.getCanonicalName(), BGZFCodec.class.getCanonicalName()); conf.setInt(FileInputFormat.SPLIT_MAXSIZE, 100 * 1024); <START> if (filename == "small_snpeff.vcf") { <END> VCFRecordReader.setValidationStringency(conf, ValidationStringency.SILENT); } if (interval != null) { VCFInputFormat.setIntervals(conf, ImmutableList.of(interval)); } taskAttemptContext = new TaskAttemptContextImpl(conf, mock(TaskAttemptID.class)); JobContext ctx = new JobContextImpl(conf, taskAttemptContext.getJobID()); VCFInputFormat inputFormat = new VCFInputFormat(conf); List<InputSplit> splits = inputFormat.getSplits(ctx); switch (expectedSplits) { case EXACTLY_ONE: assertEquals("Should be exactly one split", 1, splits.size()); break; case MORE_THAN_ONE: assertTrue("Should be more than one split", splits.size() > 1); break; case ANY: default: break; } readers = new ArrayList<>(); for (InputSplit split : splits) { RecordReader<LongWritable, VariantContextWritable> reader = inputFormat.createRecordReader(split, taskAttemptContext); reader.initialize(split, taskAttemptContext); readers.add(reader); } }</code><technical_language>I avoid reference equality operators strings - work in this case due string folding, comparisons .equals instead of == !=</technical_language>

Target:
public void setup() throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, InterruptedException, NoSuchFieldException { Configuration conf = new Configuration(); String input_file = ClassLoader.getSystemClassLoader().getResource(filename).getFile(); conf.set("hadoopbam.vcf.trust-exts", "true"); conf.set("mapred.input.dir", "file://" + input_file); conf.setStrings("io.compression.codecs", BGZFEnhancedGzipCodec.class.getCanonicalName(), BGZFCodec.class.getCanonicalName()); conf.setInt(FileInputFormat.SPLIT_MAXSIZE, 100 * 1024); if (interval != null) { VCFInputFormat.setIntervals(conf, ImmutableList.of(interval)); } taskAttemptContext = new TaskAttemptContextImpl(conf, mock(TaskAttemptID.class)); JobContext ctx = new JobContextImpl(conf, taskAttemptContext.getJobID()); VCFInputFormat inputFormat = new VCFInputFormat(conf); List<InputSplit> splits = inputFormat.getSplits(ctx); switch (expectedSplits) { case EXACTLY_ONE: assertEquals("Should be exactly one split", 1, splits.size()); break; case MORE_THAN_ONE: assertTrue("Should be more than one split", splits.size() > 1); break; case ANY: default: break; } readers = new ArrayList<>(); for (InputSplit split : splits) { RecordReader<LongWritable, VariantContextWritable> reader = inputFormat.createRecordReader(split, taskAttemptContext); reader.initialize(split, taskAttemptContext); readers.add(reader); } }
Source:
<code>public void spotrf(byte uplo, int N, INDArray A, INDArray INFO) { int status = LAPACKE_spotrf(getColumnOrder(A), uplo, N, A.data().asNioFloat(), getLda(A) ); if( status != 0 ) { <START> throw new Error( "Failed to execute spotrf, code:" + status ) ; <END> } if( uplo == 'U' ) { for( int ro=1 ; ro<N ; ro++ ) { for( int c=0 ; c<ro ; c++ ) { A.putScalar( ro, c, 0 ) ; } } } else { for( int c=1 ; c<N ; c++ ) { for( int ro=0 ; ro<c ; ro++ ) { A.putScalar( ro, c, 0 ) ; } } } }</code><technical_language>I feel a LapackException maybe</technical_language>

Target:
public void spotrf(byte uplo, int N, INDArray A, INDArray INFO) { int status = LAPACKE_spotrf(getColumnOrder(A), uplo, N, (FloatPointer)A.data().addressPointer(), getLda(A) ); if( status != 0 ) { throw new BlasException( "Failed to execute spotrf", status ) ; } if( uplo == 'U' ) { INDArrayIndex ix[] = new INDArrayIndex[ 2 ] ; for( int i=1 ; i<Math.min( A.rows(), A.columns() ) ; i++ ) { ix[0] = NDArrayIndex.point( i ) ; ix[1] = NDArrayIndex.interval( 0, i ) ; A.put(ix, 0) ; } } else { INDArrayIndex ix[] = new INDArrayIndex[ 2 ] ; for( int i=0 ; i<Math.min( A.rows(), A.columns()-1 ) ; i++ ) { ix[0] = NDArrayIndex.point( i ) ; ix[1] = NDArrayIndex.interval( i+1, A.columns() ) ; A.put(ix, 0) ; } } }
Source:
<code>private void leaveErrorBreadcrumb(@NonNull Event event) { List<Error> errors = event.getErrors(); <START> String name = ""; String msg = ""; <END> if (errors.size() > 0) { name = errors.get(0).getErrorClass(); msg = errors.get(0).getErrorMessage(); } Map<String, Object> message = Collections.<String, Object>singletonMap("message", msg); breadcrumbState.add(new Breadcrumb(name, BreadcrumbType.ERROR, message, new Date())); }</code><technical_language>I feel is default - if is error message add metadata. Possibly set name "unknown"</technical_language>

Target:
private void leaveErrorBreadcrumb(@NonNull Event event) { List<Error> errors = event.getErrors(); if (errors.size() > 0) { String name = errors.get(0).getErrorClass(); String msg = errors.get(0).getErrorMessage(); Map<String, Object> message = Collections.<String, Object>singletonMap("message", msg); breadcrumbState.add(new Breadcrumb(name, BreadcrumbType.ERROR, message, new Date())); } }