auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private List<AggregateEsBase<? extends Bucket>> buildAggregates() { ArrayList<AggregateEsBase<? extends Bucket>> ret = new ArrayList<>(getAggregateDefinitions().size()); for (AggregateDefinition def : getAggregateDefinitions()) { AggregateEsBase<? extends Bucket> agg = AggregateFactory.create(def, getSearchDocumentModel()); <START> if (!isSkipAggregates() || !agg.getSelection().isEmpty()) { <END> ret.add(AggregateFactory.create(def, getSearchDocumentModel())); } } return ret; }</code><technical_language>add a check isSkipAggregates loop</technical_language>

Target:
private List<AggregateEsBase<? extends Bucket>> buildAggregates() { ArrayList<AggregateEsBase<? extends Bucket>> ret = new ArrayList<>(getAggregateDefinitions().size()); boolean skip = isSkipAggregates(); for (AggregateDefinition def : getAggregateDefinitions()) { AggregateEsBase<? extends Bucket> agg = AggregateFactory.create(def, getSearchDocumentModel()); if (!skip || !agg.getSelection().isEmpty()) { ret.add(AggregateFactory.create(def, getSearchDocumentModel())); } } return ret; }
Source:
<code>public void onEndNegotiateRound(UploadPack up, Collection<? extends ObjectId> wants, int cntCommon, int cntNotFound, boolean ready) throws UploadPackMayNotContinueException { <START> for (PreUploadHook hook : hooks) { <END> hook.onEndNegotiateRound(up, wants, cntCommon, cntNotFound, ready); } }</code><technical_language>curly braces</technical_language>

Target:
public void onEndNegotiateRound(UploadPack up, Collection<? extends ObjectId> wants, int cntCommon, int cntNotFound, boolean ready) throws UploadPackMayNotContinueException { for (int i = 0; i < count; i++) hooks[i].onEndNegotiateRound(up, wants, cntCommon, cntNotFound, ready); }
Source:
<code>public void testConnectAPIMode() throws Exception { <START> PowerMockito.doReturn(XBeeMode.API).when(xbeeDevice, "determineConnectionMode"); <END> try { xbeeDevice.connect(); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } assertEquals(xbeeDevice.getOperatingMode(), XBeeMode.API); }</code><technical_language>check dataReader is running in XBee Device</technical_language>

Target:
public void testConnectAPIMode() throws Exception { PowerMockito.doReturn(OperatingMode.API).when(xbeeDevice, "determineConnectionMode"); try { xbeeDevice.open(); } catch (XBeeException e) { fail("This exception shouldn't be thrown now."); } catch (InvalidOperatingModeException e) { fail("This exception shouldn't be thrown now."); } assertTrue(xbeeDevice.isOpen()); assertTrue(dataReader.isRunning()); assertEquals(xbeeDevice.getOperatingMode(), OperatingMode.API); }
Source:
<code>public void sendRequest(final ITmfEventRequest request) { synchronized (fLock) { if (request.getExecType() == ExecutionType.FOREGROUND) { if ((fSignalDepth > 0) || (fRequestPendingCounter > 0)) { coalesceEventRequest(request); } else { dispatchRequest(request); } return; } <START> boolean startTimer = getNbPendingBackgroundRequests() == 0; <END> coalesceEventRequest(request); if (startTimer) { TimerTask task = new TimerTask() { @Override public void run() { synchronized (fLock) { fIsTimeout = true; fireRequest(); } } }; fTimer.schedule(task, DELAY); } } }</code><technical_language>technically needed, I helps readability add parentheses in cases these: boolean startTimer = (getNbPendingBackgroundRequests() == 0);</technical_language>

Target:
public void sendRequest(final ITmfEventRequest request) { synchronized (fLock) { if (request.getExecType() == ExecutionType.FOREGROUND) { if ((fSignalDepth > 0) || (fRequestPendingCounter > 0)) { coalesceEventRequest(request); } else { dispatchRequest(request); } return; } boolean startTimer = (getNbPendingBackgroundRequests() == 0); coalesceEventRequest(request); if (startTimer) { TimerTask task = new TimerTask() { @Override public void run() { synchronized (fLock) { fIsTimeout = true; fireRequest(); } } }; fTimer.schedule(task, DELAY); } } }
Source:
<code>public List<ODataEntry> readTableWithKeys(String tableName, ODataEntry keys) throws ODataServiceFault { List<ODataEntry> entryList = new ArrayList<>(); ODataEntry dataEntry; for (String keyName : keys.getData().keySet()) { String keyValue = keys.getValue(keyName); <START> String projectionResult = jongo.getCollection(tableName).findOne(new ObjectId(keyValue)).map(MongoQuery.MongoResultMapper.getInstance()); <END> if (projectionResult == null) { throw new ODataServiceFault("Document ID: " + keyValue + " does not exist in " + "collection: " + tableName + " ."); } Iterator<?> key = new JSONObject(projectionResult).keys(); dataEntry = createDataEntryFromResult(projectionResult, key); dataEntry.addValue(ETAG, ODataUtils.generateETag(this.configId, tableName, dataEntry)); entryList.add(dataEntry); } return entryList; }</code><technical_language>check for null. For example: happen if tablename exist</technical_language>

Target:
public List<ODataEntry> readTableWithKeys(String tableName, ODataEntry keys) throws ODataServiceFault { List<ODataEntry> entryList = new ArrayList<>(); ODataEntry dataEntry; for (String keyName : keys.getData().keySet()) { String keyValue = keys.getValue(keyName); String projectionResult = jongo.getCollection(tableName).findOne(new ObjectId(keyValue)). map(MongoQuery.MongoResultMapper.getInstance()); if (projectionResult == null) { throw new ODataServiceFault(DOCUMENT_ID + keyValue + " does not exist in collection: " + tableName + " ."); } Iterator<?> key = new JSONObject(projectionResult).keys(); dataEntry = createDataEntryFromResult(projectionResult, key); dataEntry.addValue(ETAG, ODataUtils.generateETag(this.configId, tableName, dataEntry)); entryList.add(dataEntry); } return entryList; }
Source:
<code>public Iterable<StructuredRecord> call(Tuple2<LongWritable, Text> in) throws Exception { if (recordFormat == null) { <START> schema = Schema.parseJson(schemaStr); <END> FormatSpecification spec = new FormatSpecification(format, schema, new HashMap<String, String>()); recordFormat = RecordFormats.createInitializedFormat(spec); } StructuredRecord.Builder builder = StructuredRecord.builder(schema); StructuredRecord messageRecord = recordFormat.read(new StreamEvent(ByteBuffer.wrap(in._2().getBytes()))); for (Schema.Field messageField : messageRecord.getSchema().getFields()) { String fieldName = messageField.getName(); builder.set(fieldName, messageRecord.get(fieldName)); } List<StructuredRecord> output = new ArrayList<>(1); output.add(builder.build()); return output; }</code><technical_language>schemaStr is null</technical_language>

Target:
public Iterable<StructuredRecord> call(Tuple2<LongWritable, Text> in) throws Exception { if (recordFormat == null) { schema = Schema.parseJson(schemaStr); FormatSpecification spec = new FormatSpecification(format, schema, new HashMap<String, String>()); recordFormat = RecordFormats.createInitializedFormat(spec); } StructuredRecord.Builder builder = StructuredRecord.builder(schema); StructuredRecord messageRecord = recordFormat.read(new StreamEvent(ByteBuffer.wrap(in._2().copyBytes()))); for (Schema.Field messageField : messageRecord.getSchema().getFields()) { String fieldName = messageField.getName(); builder.set(fieldName, messageRecord.get(fieldName)); } List<StructuredRecord> output = new ArrayList<>(1); output.add(builder.build()); return output; }
Source:
<code><START> private static void autoIgnoreWorkspaceMetaData(java.nio.file.Path gitDir) { <END> java.nio.file.Path workspaceRoot = ResourcesPlugin.getWorkspace() .getRoot().getLocation().toFile().toPath(); try { if (Files.isSameFile(workspaceRoot, gitDir.getParent())) { Path metaData = new Path(workspaceRoot.resolve(".metadata") .toAbsolutePath().toString()); Collection<IPath> ignore = new HashSet<IPath>(); ignore.add(metaData); JobUtil.scheduleUserJob( new IgnoreOperation(ignore), CoreText.RepositoryUtil_autoIgnoreMetaData, JobFamilies.AUTO_IGNORE); } } catch (IOException e) { Activator.logError(e.getMessage(), e); } }</code><technical_language>if .metadata is ignored</technical_language>

Target:
private static void autoIgnoreWorkspaceMetaData(java.nio.file.Path gitDir) { java.nio.file.Path workspaceRoot = ResourcesPlugin.getWorkspace() .getRoot().getLocation().toFile().toPath(); try (Repository r = FileRepositoryBuilder.create(gitDir.toFile())) { if (workspaceRoot.startsWith(r.getWorkTree().toPath())) { Collection<IPath> ignoredPaths = buildIgnoredPathsList( workspaceRoot, ".metadata", ".recommenders"); JobUtil.scheduleUserJob( new IgnoreOperation(ignoredPaths), CoreText.RepositoryUtil_autoIgnoreMetaData, JobFamilies.AUTO_IGNORE); } } catch (IOException e) { Activator.logError(e.getMessage(), e); } }
Source:
<code>public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { <START> Device device = DeviceUtils.getCurrentDevice(request); <END> String suffix = device.isMobile() ? MOBILE : (device.isTablet() ? TABLET : DESKTOP); return (YES.equals(featureState.getParameter(ON+suffix))); } return false; }</code><technical_language>is main recognition logic. I suggest extract private method String getParameterName(HttpServletRequest request) give ternary operators in line</technical_language>

Target:
public boolean isActive(FeatureState featureState, FeatureUser user) { HttpServletRequest request = HttpServletRequestHolder.get(); if (request != null) { Device device = DeviceUtils.getCurrentDevice(request); DeviceType deviceType = device.isMobile() ? MOBILE : (device.isTablet() ? TABLET : NORMAL); return (YES.equalsIgnoreCase(featureState.getParameter(deviceType.name()))); } return false; }
Source:
<code>public DirContext bind(String principalName, String password, List<SocketInfo> ldapServers) { Hashtable<String, String> props = new Hashtable<String, String>(); props.put(Context.REFERRAL, "follow"); <START> props.put("java.naming.ldap.attributes.binary", "tokenGroups objectSid"); <END> props.put("java.naming.ldap.factory.socket", TrustAllSocketFactory.class.getName()); return bind(principalName, password, ldapServers, props); }</code><technical_language>adding in bind(String principalName, String password, List<SocketInfo> ldapServers, Hashtable<String, String> props) method</technical_language>

Target:
public DirContext bind(String principalName, String password, List<SocketInfo> ldapServers) { return bind(principalName, password, ldapServers, new Hashtable<String, String>()); }
Source:
<code>public static VdcActionParametersBase getParameters(CommandEntity commandEntity) { return commandEntity.getData() != null ? (VdcActionParametersBase) commandEntity.getData().get(PARAMETERS_KEY) : null; <START> } <END></code><technical_language>initialize CommandEntity#data empty map in CommandEntity instead of null checks</technical_language>

Target:
public static VdcActionParametersBase getParameters(CommandEntity commandEntity) { return (VdcActionParametersBase) commandEntity.getData().get(PARAMETERS_KEY); }
Source:
<code>long menuForEvent (long id, long sel, long theEvent) { if (!isEnabled ()) return 0; NSPoint pt = NSEvent.mouseLocation(); pt.y = (int) (display.getPrimaryFrame().height - pt.y); int x = (int) pt.x; int y = (int) pt.y; Event event = new Event (); event.x = x; event.y = y; NSEvent nsEvent = new NSEvent(theEvent); event.detail = nsEvent.buttonNumber() > 0 ? SWT.MENU_MOUSE : SWT.MENU_KEYBOARD; int count = 0; boolean menuAlreadyHandledByDisplay = false; if (display.popups != null) { while (count < display.popups.length && display.popups[count] != null) { if <START> (menu != null && display.popups[count] <END> == menu) { menuAlreadyHandledByDisplay = true; } count++; } } sendEvent(SWT.MenuDetect, event); if (isDisposed ()) return 0; Menu menu = getMenu (); if (event.doit && menu != null && !menu.isDisposed () && !menuAlreadyHandledByDisplay) { if (x != event.x || y != event.y) { menu.setLocation (event.x, event.y); } return menu.nsMenu.id; } int count2 = 0; if (display.popups != null) { while (count2 < display.popups.length && display.popups[count2] != null) { count2++; } } if (count2 != count && count2 > 0) { Menu menu1 = display.popups[count2 - 1]; display.popups[count2 - 1] = null; return menu1.nsMenu.id; } if (!event.doit) return 0; return super.menuForEvent (id, sel, theEvent); }</code><technical_language>This is necessary. If menu == null, condition display.popups[count] == menu false</technical_language>

Target:
long menuForEvent (long id, long sel, long theEvent) { if (!isEnabled ()) return 0; NSPoint pt = NSEvent.mouseLocation(); pt.y = (int) (display.getPrimaryFrame().height - pt.y); int x = (int) pt.x; int y = (int) pt.y; Event event = new Event (); event.x = x; event.y = y; NSEvent nsEvent = new NSEvent(theEvent); event.detail = nsEvent.buttonNumber() > 0 ? SWT.MENU_MOUSE : SWT.MENU_KEYBOARD; int count = 0; boolean menuAlreadyHandledByDisplay = false; if (display.popups != null) { while (count < display.popups.length && display.popups[count] != null) { if (display.popups[count] == menu) { menuAlreadyHandledByDisplay = true; } count++; } } sendEvent(SWT.MenuDetect, event); if (isDisposed ()) return 0; Menu menu = getMenu (); if (event.doit && menu != null && !menu.isDisposed () && !menuAlreadyHandledByDisplay) { if (x != event.x || y != event.y) { menu.setLocation (event.x, event.y); } return menu.nsMenu.id; } int count2 = 0; if (display.popups != null) { while (count2 < display.popups.length && display.popups[count2] != null) { count2++; } } if (count2 != count && count2 > 0) { Menu menu1 = display.popups[count2 - 1]; display.popups[count2 - 1] = null; return menu1.nsMenu.id; } if (!event.doit) return 0; return super.menuForEvent (id, sel, theEvent); }
Source:
<code>public static synchronized void start(boolean startRecoveryService) throws InitializationException { if (initialized) { if (startRecoveryService) startRecoveryService(); return; } try { <START> jdbcPropertyManager.getJDBCEnvironmentBean().setJndiProperties(new InitialContext().getEnvironment()); <END> } catch (NamingException e) { throw new InitializationException("No suitable JNDI provider available", e); } registerJndiBindings(); try { DriverManager.registerDriver(new TransactionalDriver()); } catch (SQLException e) { throw new InitializationException("Cannot initialize TransactionalDriver", e); } initialized = true; if (startRecoveryService) { startRecoveryService(); } }</code><technical_language>issue I of is overrides user set system properties/config file. maybe: props = jdbcPropertyManager.getJDBCEnvironmentBean().getJndiProperties() props.addAll(new InitialContext().getEnvironment()) jdbcPropertyManager.getJDBCEnvironmentBean().setJndiProperties(props) conflict I suppose. Maybe: if (jdbcPropertyManager.getJDBCEnvironmentBean().getJndiProperties().size() == 0) { jdbcPropertyManager.getJDBCEnvironmentBean().setJndiProperties(new InitialContext().getEnvironment());</technical_language>

Target:
public static synchronized void start(boolean startRecoveryService) throws InitializationException { if (initialized) return; try { initialContext = new InitialContext(); replacedJndiProperties = jdbcPropertyManager.getJDBCEnvironmentBean().getJndiProperties().size() == 0; if (replacedJndiProperties) jdbcPropertyManager.getJDBCEnvironmentBean().setJndiProperties(initialContext.getEnvironment()); DriverManager.registerDriver(new TransactionalDriver()); } catch (NamingException e) { if (tsLogger.logger.isInfoEnabled()) tsLogger.logger.info("TransactionServiceFactory error:", e); throw new InitializationException("No suitable JNDI provider available", e); } catch (SQLException e) { if (tsLogger.logger.isInfoEnabled()) tsLogger.logger.info("TransactionServiceFactory error:", e); throw new InitializationException("Cannot initialize TransactionalDriver", e); } registerJndiBindings(initialContext); initialized = true; if (startRecoveryService) startRecoveryService(); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { TransactionServiceFactory.stop(); } }); }
Source:
<code>public boolean intersects(PointList pointList) { int len = pointList.getSize(); if (len == 0) throw new IllegalArgumentException("PointList must not be empty"); double lat = pointList.getLatitude(0); double lon = pointList.getLongitude(0); if (len == 1) return contains(lat, lon); Coordinate coords = new Coordinate(lon, lat); <START> RectangleLineIntersector intersector = getCachedRectangleLineIntersector(); <END> for (int pointIndex = 1; pointIndex < len; pointIndex++) { Coordinate nextCoords = new Coordinate(pointList.getLongitude(pointIndex), pointList.getLatitude(pointIndex)); if (intersector.intersects(coords, nextCoords)) return true; coords = nextCoords; } return false; }</code><technical_language>I this fail this method is called this object updated update(). BBox is mutable, I cache RectangleLineIntersector</technical_language>

Target:
public boolean intersects(PointList pointList) { return intersects(new RectangleLineIntersector(toEnvelope(this)), pointList); }
Source:
<code>public static LatokenOrderStatus parse(String s) { try { return LatokenOrderStatus.valueOf(s); } catch (Exception e) { <START> throw new RuntimeException("Unknown LatokenOrderStatus " + s + "."); <END> } }</code><technical_language>ExchangeException</technical_language>

Target:
public static LatokenOrderStatus parse(String s) { try { return LatokenOrderStatus.valueOf(s); } catch (Exception e) { throw new ExchangeException("Unknown LatokenOrderStatus " + s + "."); } }
Source:
<code>public String getHelp() { <START> return new TextComponentTranslation("commands.bloodmagic.orb." + getName() + ".help", getInfo()).getFormattedText(); <END> }</code><technical_language>This expects a localization key</technical_language>

Target:
public String getHelp() { return "commands.bloodmagic.orb." + getName() + ".help"; }
Source:
<code>public KubernetesEnvironment build() { KubernetesEnvironment kubernetesEnvironment; if (internalEnvironment == null) { kubernetesEnvironment = new KubernetesEnvironment( internalRecipe, machines, warnings, pods, services, ingresses, pvcs, secrets, configMaps); } else { kubernetesEnvironment = new KubernetesEnvironment( internalEnvironment, pods, services, ingresses, pvcs, secrets, configMaps); if (internalRecipe != null) { <START> kubernetesEnvironment.setRecipe(internalRecipe); <END> } if (machines != null) { kubernetesEnvironment.setMachines(machines); } if (commands != null) { kubernetesEnvironment.setCommands(commands); } if (warnings != null) { kubernetesEnvironment.setWarnings(warnings); } } kubernetesEnvironment.setType(type); return kubernetesEnvironment; }</code><technical_language>I setting values in InternalEnvironment object simplify this code builder setters</technical_language>

Target:
public KubernetesEnvironment build() { return new KubernetesEnvironment( internalEnvironment, pods, services, ingresses, pvcs, secrets, configMaps); }
Source:
<code>public Block build() { if (currentEntryOpened) { throw new IllegalStateException("Current entry must be closed before the block can be built"); } Optional<int[]> rawHashTables = hashTables.get(); <START> verify(rawHashTables.isPresent(), "rawHashTables is null"); <END> int hashTablesEntries = offsets[positionCount] * HASH_MULTIPLIER; return createMapBlockInternal( 0, positionCount, Optional.of(mapIsNull), offsets, keyBlockBuilder.build(), valueBlockBuilder.build(), new HashTables(Optional.of(Arrays.copyOf(rawHashTables.get(), hashTablesEntries)), hashTablesEntries), keyType, keyBlockNativeEquals, keyNativeHashCode, keyBlockHashCode); }</code><technical_language>nit: error message is slightly misleading, "rawHashTables is empty"</technical_language>

Target:
public Block build() { if (currentEntryOpened) { throw new IllegalStateException("Current entry must be closed before the block can be built"); } Optional<int[]> rawHashTables = hashTables.get(); verify(rawHashTables.isPresent(), "rawHashTables is empty"); int hashTablesEntries = offsets[positionCount] * HASH_MULTIPLIER; return createMapBlockInternal( 0, positionCount, Optional.of(mapIsNull), offsets, keyBlockBuilder.build(), valueBlockBuilder.build(), new HashTables(Optional.of(Arrays.copyOf(rawHashTables.get(), hashTablesEntries)), hashTablesEntries), keyType, keyBlockNativeEquals, keyNativeHashCode, keyBlockHashCode); }
Source:
<code>public void loadNbt(CompoundTag tag) { super.loadNbt(tag); tag.readString("EntityId", name -> spawning = EntityType.fromName(name)); <START> if (spawning == null) { <END> spawning = DEFAULT; } if (!tag.readInt("Delay", this::setDelay)) { delay = 0; } }</code><technical_language>This chained</technical_language>

Target:
public void loadNbt(CompoundTag tag) { super.loadNbt(tag); spawning = tag.tryGetString("EntityId").map(EntityType::fromName).orElse(DEFAULT); delay = tag.tryGetInt("Delay").orElse(0); }
Source:
<code>public void withProperty(String key, String value) { <START> if (properties == null) { properties = new HashedMap(); } <END> properties.put(key, value); }</code><technical_language>I init map in line #34 null remove null check in getProperty</technical_language>

Target:
public void withProperty(String key, String value) { properties.put(key, value); }
Source:
<code>private void checkIneffectiveAnnotations(Class valueCls) { <START> for (Field f:valueCls.getDeclaredFields()) { <END> AffinityKeyMapped[] annotations = f.getDeclaredAnnotationsByType(AffinityKeyMapped.class); if (annotations.length > 0) { LT.warn(log, "AffinityKeyMapped annotation should be used on key and not value type"); } } }</code><technical_language>Missed spaces ":"</technical_language>

Target:
private void checkIneffectiveAnnotations(Class valueCls) { for (Field f: valueCls.getDeclaredFields()) { AffinityKeyMapped[] annotations = f.getDeclaredAnnotationsByType(AffinityKeyMapped.class); if (annotations != null && annotations.length > 0) { LT.warn(log, "AffinityKeyMapped annotation should be used on key and not value type"); } } }
Source:
<code>public String toString() { return "DefaultSubscriptionBillingEvent{" + "type=" + type + <START> ", plan='" + plan + '\'' + <END> ", planPhase='" + planPhase + '\'' + ", effectiveDate=" + effectiveDate + ", totalOrdering=" + totalOrdering + ", bcdLocal=" + bcdLocal + '}'; }</code><technical_language>Unclear if circular dependencies objects' toString methods (we problem in past). safer print names</technical_language>

Target:
public String toString() { return "DefaultSubscriptionBillingEvent{" + "type=" + type + ", plan='" + plan.getName() + '\'' + ", planPhase='" + planPhase.getName() + '\'' + ", effectiveDate=" + effectiveDate + ", totalOrdering=" + totalOrdering + ", bcdLocal=" + bcdLocal + '}'; }
Source:
<code><START> public void setDns(List<String> dns) { <END> this.dns = dns; }</code><technical_language>return Builder other set\* methods</technical_language>

Target:
public AgentConfig setDns(List<String> dns) { this.dns = dns; return this; }
Source:
<code>public boolean isPreRelease(String version) { <START> return PypiCanonicalVersionValidator.PRE_RELEASE_PATTERN.matcher(version).matches(); <END> }</code><technical_language>Tip: (and in next methods) a BiPredicate. private BiPredicate<Pattern, String> versionMatches = (pattern, version) -> pattern.matcher(version).matches(); [...] public boolean isPreRelease(String version) { return versionMatches.test(PRE_RELEASE_PATTERN, version); }</technical_language>

Target:
public boolean isPreRelease(String version) { return versionMatches.test(PypiCanonicalVersionValidator.PRE_RELEASE_PATTERN, version); }
Source:
<code>protected void makeWrittable() { super.makeWrittable(); if (button != null && eObject instanceof ContainerMapping) { ContainerMapping containerMapping = (ContainerMapping) eObject; Option<String> experimentalStackButtons = <START> shouldMarkCompartimentsExperimental(containerMapping); <END> Option<String> disabledStackButtons = shouldDisableCompartiments(containerMapping); updateControls(experimentalStackButtons, disabledStackButtons); } }</code><technical_language>Compartments</technical_language>

Target:
protected void makeWrittable() { super.makeWrittable(); if (button != null && eObject instanceof ContainerMapping) { ContainerMapping containerMapping = (ContainerMapping) eObject; Option<String> experimentalStackButtons = shouldMarkCompartmentsExperimental(containerMapping); Option<String> disabledStackButtons = shouldDisableCompartments(containerMapping); updateControls(experimentalStackButtons, disabledStackButtons); } }
Source:
<code>public void testKeepsOutputSymbols() { assertReorderJoins() .on(p -> p.join( INNER, p.values(new PlanNodeId("valuesA"), ImmutableList.of(p.symbol("A1"), p.symbol("A2")), TWO_ROWS), p.values(new PlanNodeId("valuesB"), ImmutableList.of(p.symbol("B1")), TWO_ROWS), <START> ImmutableList.of(new JoinNode.EquiJoinClause(p.symbol("A1"), p.symbol("B1"))), <END> ImmutableList.of(p.symbol("A2")), Optional.empty())) .withStats("valuesA", PlanNodeStatsEstimate.builder() .setOutputRowCount(5000) .addSymbolStatistics(ImmutableMap.of( new Symbol("A1"), new SymbolStatsEstimate(0, 100, 0, 100, 100), new Symbol("A2"), new SymbolStatsEstimate(0, 100, 0, 100, 100))) .build()) .withStats("valuesB", PlanNodeStatsEstimate.builder() .setOutputRowCount(10000) .addSymbolStatistics(ImmutableMap.of(new Symbol("B1"), new SymbolStatsEstimate(0, 100, 0, 100, 100))) .build()) .matches(join( INNER, ImmutableList.of(equiJoinClause("A1", "B1")), Optional.empty(), Optional.of(PARTITIONED), values(ImmutableMap.of("A1", 0, "A2", 1)), values(ImmutableMap.of("B1", 0))) .withExactOutputs("A2")); }</code><technical_language>Import EquiJoinClause</technical_language>

Target:
public void testKeepsOutputSymbols() { assertReorderJoins() .on(p -> p.join( INNER, p.values(new PlanNodeId("valuesA"), ImmutableList.of(p.symbol("A1"), p.symbol("A2")), TWO_ROWS), p.values(new PlanNodeId("valuesB"), ImmutableList.of(p.symbol("B1")), TWO_ROWS), ImmutableList.of(new EquiJoinClause(p.symbol("A1"), p.symbol("B1"))), ImmutableList.of(p.symbol("A2")), Optional.empty())) .overrideStats("valuesA", PlanNodeStatsEstimate.builder() .setOutputRowCount(5000) .addSymbolStatistics(ImmutableMap.of( new Symbol("A1"), new SymbolStatsEstimate(0, 100, 0, 100, 100), new Symbol("A2"), new SymbolStatsEstimate(0, 100, 0, 100, 100))) .build()) .overrideStats("valuesB", PlanNodeStatsEstimate.builder() .setOutputRowCount(10000) .addSymbolStatistics(ImmutableMap.of(new Symbol("B1"), new SymbolStatsEstimate(0, 100, 0, 100, 100))) .build()) .matches(join( INNER, ImmutableList.of(equiJoinClause("A1", "B1")), Optional.empty(), Optional.of(PARTITIONED), values(ImmutableMap.of("A1", 0, "A2", 1)), values(ImmutableMap.of("B1", 0))) .withExactOutputs("A2")); }
Source:
<code>private boolean replace(IfStatement node, Assignment a, ITypeBinding typeBinding, Expression rightHandSide) { if (typeBinding == null) { return VISIT_SUBTREE; } final String expressionTypeName = typeBinding.getQualifiedName(); final Expression newE = maybeGetExpression(expressionTypeName, node.getExpression(), a.getRightHandSide(), <START> rightHandSide); <END> if (newE != null) { ctx.getRefactorings().replace(rightHandSide, newE); ctx.getRefactorings().remove(node); return DO_NOT_VISIT_SUBTREE; } return VISIT_SUBTREE; }</code><technical_language>this fit line? java final Expression newE = maybeGetExpression(expressionTypeName, node.getExpression(), a.getRightHandSide(), rightHandSide);</technical_language>

Target:
private boolean replace(IfStatement node, Assignment a, ITypeBinding typeBinding, Expression rightHandSide) { if (typeBinding == null) { return VISIT_SUBTREE; } final String expressionTypeName = typeBinding.getQualifiedName(); final Expression newE = newExpressionOrNull(expressionTypeName, node.getExpression(), a.getRightHandSide(), rightHandSide); if (newE != null) { ctx.getRefactorings().replace(rightHandSide, newE); ctx.getRefactorings().remove(node); return DO_NOT_VISIT_SUBTREE; } return VISIT_SUBTREE; }
Source:
<code>protected void postBatchRequest(String postData, final IPostBatchRequestListener listener) { restClient.post(config.getEventsUrl() + SwrveBase.BATCH_EVENTS_ACTION, postData, new IRESTResponseListener() { @Override public void onResponse(RESTResponse response) { boolean deleteEvents = true; if (SwrveHelper.userErrorResponseCode(response.responseCode)) { SwrveLogger.e(LOG_TAG, "Error sending events to Swrve: " + response.responseBody); } else if (SwrveHelper.successResponseCode(response.responseCode)) { SwrveLogger.i(LOG_TAG, "Events sent to Swrve"); } else if (SwrveHelper.serverErrorResponseCode(response.responseCode)) { deleteEvents = false; SwrveLogger.e(LOG_TAG, "Error sending events to Swrve: " + response.responseBody); } listener.onResponse(deleteEvents); } @Override <START> public void onException(Exception exp) { <END> } }); }</code><technical_language>I this copy/paste while in neighbourhood, throw a SwrveLogger.e in here</technical_language>

Target:
protected void postBatchRequest(String postData, final IPostBatchRequestListener listener) { restClient.post(config.getEventsUrl() + SwrveBase.BATCH_EVENTS_ACTION, postData, new IRESTResponseListener() { @Override public void onResponse(RESTResponse response) { boolean deleteEvents = true; if (SwrveHelper.userErrorResponseCode(response.responseCode)) { SwrveLogger.e(LOG_TAG, "Error sending events to Swrve: " + response.responseBody); } else if (SwrveHelper.successResponseCode(response.responseCode)) { SwrveLogger.i(LOG_TAG, "Events sent to Swrve"); } else if (SwrveHelper.serverErrorResponseCode(response.responseCode)) { deleteEvents = false; SwrveLogger.e(LOG_TAG, "Error sending events to Swrve: " + response.responseBody); } listener.onResponse(deleteEvents); } @Override public void onException(Exception ex) { SwrveLogger.e(LOG_TAG, "Error posting batch of events.", ex); } }); }
Source:
<code>private void validateZkConnectionSettings(String zkAddress, HelixManagerProperty helixManagerProperty) { if (helixManagerProperty != null && helixManagerProperty.getZkConnectionConfig() != null) { <START> if (zkAddress != null && !zkAddress.isEmpty()) { <END> throw new HelixException( "ZKHelixManager: cannot have both ZkAddress and ZkConnectionConfig set!"); } RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig = helixManagerProperty.getZkConnectionConfig(); if (connectionConfig.getZkRealmShardingKey() == null || connectionConfig .getZkRealmShardingKey().isEmpty()) { throw new HelixException( "ZKHelixManager::ZK path sharding key must be set for ZKHelixManager! ZKHelixManager " + "is only available on single-realm mode."); } _realmAwareZkConnectionConfig = connectionConfig; } }</code><technical_language>strict here, I empty string is allowed. zkAddress completely untouched</technical_language>

Target:
private void validateZkConnectionSettings(String zkAddress, HelixManagerProperty helixManagerProperty) { if (helixManagerProperty != null && helixManagerProperty.getZkConnectionConfig() != null) { if (zkAddress != null) { throw new HelixException( "ZKHelixManager: cannot have both ZkAddress and ZkConnectionConfig set!"); } RealmAwareZkClient.RealmAwareZkConnectionConfig connectionConfig = helixManagerProperty.getZkConnectionConfig(); if (connectionConfig.getZkRealmShardingKey() == null || connectionConfig .getZkRealmShardingKey().isEmpty()) { throw new HelixException( "ZKHelixManager::ZK path sharding key must be set for ZKHelixManager! ZKHelixManager " + "is only available on single-realm mode."); } _realmAwareZkConnectionConfig = connectionConfig; } }
Source:
<code>public <T> T getAdapter(Class<T> adapter) { <START> if (CommentService.class == adapter) { <END> return (T) this; } else if (commentManager == null) { synchronized (this) { if (commentManager == null) { commentManager = recomputeCommentManager(); } } } return (T) commentManager; }</code><technical_language>I end choosing _myClass.class_ syntaxe (@troger) consistency implementations of getAdapter method in i change adapter.cast(this) syntaxe instead _(T) this_ end a double check :) (Class#cast is check cast avoid classCastException)</technical_language>

Target:
public <T> T getAdapter(Class<T> adapter) { if (adapter == CommentService.class) { return adapter.cast(this); } else if (commentManager == null) { synchronized (this) { if (commentManager == null) { commentManager = recomputeCommentManager(); } } } return (T) commentManager; }
Source:
<code>public DefaultDsfExecutor(String name) { super(1, new DsfThreadFactory(name + " - " + fgInstanceCounter++)); fName = name; <START> if(DsfDebugOptions.DEBUG_EXECUTOR || ASSERTIONS_ENABLED) { <END> prestartAllCoreThreads(); fThreadToExecutorMap.put(((DsfThreadFactory)getThreadFactory()).fThread, DefaultDsfExecutor.this); } }</code><technical_language>This is done in constructor allow changed a debug session. However, other areas do allow a dynamic change. worried a conflict try tracing while is initialized. stuff in constructor moved out in a smart way, flags instance of class allowed change class is created</technical_language>

Target:
public DefaultDsfExecutor(String name) { super(1, new DsfThreadFactory(name + " - " + fgInstanceCounter++)); fName = name; if(DEBUG_EXECUTOR || ASSERTIONS_ENABLED) { prestartAllCoreThreads(); fThreadToExecutorMap.put(((DsfThreadFactory)getThreadFactory()).fThread, DefaultDsfExecutor.this); } }
Source:
<code>public void init(Config.Scope config) { vaultDirectory = config.get("dir"); <START> disabled = config.getBoolean("disabled", null); <END> if (vaultDirectory == null && disabled == null) { logger.debug("PlainTextVaultProviderFactory not configured"); return; } if (disabled != null && disabled) { logger.debug("PlainTextVaultProviderFactory disabled"); return; } vaultPath = Paths.get(vaultDirectory); if (!Files.exists(vaultPath)) { throw new VaultNotFoundException("The " + vaultPath.toAbsolutePath().toString() + " directory doesn't exist"); } logger.debugf("Configured PlainTextVaultProviderFactory with directory %s", vaultPath.toString()); }</code><technical_language>defaulting null here? If I mistaken null behave false. Also, avoid checking disabled != null</technical_language>

Target:
public void init(Config.Scope config) { vaultDirectory = config.get("dir"); Boolean disabledFromConfig = config.getBoolean("disabled"); if (disabledFromConfig == null) { disabled = false; } else { disabled = disabledFromConfig.booleanValue(); } if (disabled) { logger.debug("PlainTextVaultProviderFactory disabled"); return; } if (vaultDirectory == null) { logger.debug("PlainTextVaultProviderFactory not configured"); return; } vaultPath = Paths.get(vaultDirectory); if (!Files.exists(vaultPath)) { throw new VaultNotFoundException("The " + vaultPath.toAbsolutePath().toString() + " directory doesn't exist"); } logger.debugf("Configured PlainTextVaultProviderFactory with directory %s", vaultPath.toString()); }
Source:
<code>void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = new DeleteOperation(routerConfig, routerMetrics, responseHandler, blobId, futureResult, callback, time); deleteOperations.add(deleteOperation); <START> readyForPollCallback.onPollReady(); <END> } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.deleteBlobErrorCount.inc(); routerMetrics.countError(e); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }</code><technical_language>need this. call this OperationController</technical_language>

Target:
void submitDeleteBlobOperation(String blobIdString, FutureResult<Void> futureResult, Callback<Void> callback) { try { BlobId blobId = RouterUtils.getBlobIdFromString(blobIdString, clusterMap); DeleteOperation deleteOperation = new DeleteOperation(routerConfig, routerMetrics, responseHandler, blobId, futureResult, callback, time); deleteOperations.add(deleteOperation); } catch (RouterException e) { routerMetrics.operationDequeuingRate.mark(); routerMetrics.deleteBlobErrorCount.inc(); routerMetrics.countError(e); operationCompleteCallback.completeOperation(futureResult, callback, null, e); } }
Source:
<code>public static String inflateBase64(String base64EncodedValue) throws IOException { <START> byte[] deflatedValue = Base64.getMimeDecoder().decode(base64EncodedValue); <END> InputStream is = new InflaterInputStream( new ByteArrayInputStream(deflatedValue), new Inflater(GZIP_COMPATIBLE)); return IOUtils.toString(is, StandardCharsets.UTF_8.name()); }</code><technical_language>this decoding ISO-8859-1 UTF-8? decode method is UTF-8</technical_language>

Target:
public static String inflateBase64(String base64EncodedValue) throws IOException { byte[] deflatedValue = Base64.getMimeDecoder().decode(base64EncodedValue.getBytes(StandardCharsets.UTF_8)); InputStream is = new InflaterInputStream( new ByteArrayInputStream(deflatedValue), new Inflater(GZIP_COMPATIBLE)); return IOUtils.toString(is, StandardCharsets.UTF_8.name()); }
Source:
<code>protected void doCleanup(String psUuid) { List<ImageCacheShadowVO> shadowVOs = createShadowImageCacheVOs(psUuid); if (shadowVOs == null || shadowVOs.isEmpty()) { return; } for (final ImageCacheShadowVO vo : shadowVOs) { if (!destMaker.isManagedByUs(vo.getImageUuid())) { continue; } CacheInstallPath p = new CacheInstallPath(); p.fullPath = vo.getInstallUrl(); p.disassemble(); <START> if (Q.New(HostVO.class).eq(HostVO_.uuid, p.hostUuid).count() == 0){ <END> continue; } LocalStorageDeleteImageCacheOnPrimaryStorageMsg msg = new LocalStorageDeleteImageCacheOnPrimaryStorageMsg(); msg.setHostUuid(p.hostUuid); msg.setImageUuid(vo.getImageUuid()); msg.setInstallPath(p.installPath); msg.setPrimaryStorageUuid(vo.getPrimaryStorageUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, vo.getPrimaryStorageUuid()); bus.send(msg, new CloudBusCallBack(null) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { logger.warn(String.format("failed to delete the stale image cache[%s] on the primary storage[%s], %s," + "will re-try later", vo.getInstallUrl(), vo.getPrimaryStorageUuid(), reply.getError())); return; } logger.debug(String.format("successfully deleted the stale image cache[%s] on the primary storage[%s]", vo.getInstallUrl(), vo.getPrimaryStorageUuid())); dbf.remove(vo); } }); } }</code><technical_language>dbf.isExist(p.hostUuid, HostVO.class) is cleaner</technical_language>

Target:
protected void doCleanup(String psUuid) { List<ImageCacheShadowVO> shadowVOs = createShadowImageCacheVOs(psUuid); if (shadowVOs == null || shadowVOs.isEmpty()) { return; } for (final ImageCacheShadowVO vo : shadowVOs) { if (!destMaker.isManagedByUs(vo.getImageUuid())) { continue; } CacheInstallPath p = new CacheInstallPath(); p.fullPath = vo.getInstallUrl(); p.disassemble(); if (!dbf.isExist(p.hostUuid, HostVO.class)){ dbf.removeByPrimaryKey(vo.getId(), ImageCacheShadowVO.class); continue; } LocalStorageDeleteImageCacheOnPrimaryStorageMsg msg = new LocalStorageDeleteImageCacheOnPrimaryStorageMsg(); msg.setHostUuid(p.hostUuid); msg.setImageUuid(vo.getImageUuid()); msg.setInstallPath(p.installPath); msg.setPrimaryStorageUuid(vo.getPrimaryStorageUuid()); bus.makeTargetServiceIdByResourceUuid(msg, PrimaryStorageConstant.SERVICE_ID, vo.getPrimaryStorageUuid()); bus.send(msg, new CloudBusCallBack(null) { @Override public void run(MessageReply reply) { if (!reply.isSuccess()) { logger.warn(String.format("failed to delete the stale image cache[%s] on the primary storage[%s], %s," + "will re-try later", vo.getInstallUrl(), vo.getPrimaryStorageUuid(), reply.getError())); return; } logger.debug(String.format("successfully deleted the stale image cache[%s] on the primary storage[%s]", vo.getInstallUrl(), vo.getPrimaryStorageUuid())); dbf.remove(vo); } }); } }
Source:
<code>protected void updateCollectorBatchWithOriginEntries() { Integer fiscalYear = Integer.valueOf(collectorBatch.getUniversityFiscalYear()); <START> SystemOptions options = optionsService.getOptions(fiscalYear); <END> String actualFinancialBalanceTypeCode = options.getActualFinancialBalanceTypeCd(); for (ConcurDetailLineGroupForCollector lineGroup : lineGroups.values()) { for (OriginEntryFull originEntry : lineGroup.buildOriginEntries()) { originEntry.setFinancialBalanceTypeCode(actualFinancialBalanceTypeCode); originEntry.setTransactionLedgerEntrySequenceNumber( getNextTransactionSequenceNumber(lineGroup.getReportId())); collectorBatch.addOriginEntry(originEntry); } } Integer totalRecords = Integer.valueOf(collectorBatch.getOriginEntries().size()); KualiDecimal totalDebitAmount = collectorBatch.getOriginEntries() .stream() .filter(this::isDebitEntry) .map(OriginEntryFull::getTransactionLedgerEntryAmount) .reduce(KualiDecimal.ZERO, KualiDecimal::add); collectorBatch.setTotalRecords(totalRecords); collectorBatch.setTotalAmount(totalDebitAmount); }</code><technical_language>sense rename this fiscalYearOptions for clarity</technical_language>

Target:
protected void updateCollectorBatchWithOriginEntries() { Integer fiscalYear = Integer.valueOf(collectorBatch.getUniversityFiscalYear()); SystemOptions fiscalYearOptions = optionsService.getOptions(fiscalYear); String actualFinancialBalanceTypeCode = fiscalYearOptions.getActualFinancialBalanceTypeCd(); for (ConcurDetailLineGroupForCollector lineGroup : lineGroups.values()) { for (OriginEntryFull originEntry : lineGroup.buildOriginEntries()) { originEntry.setFinancialBalanceTypeCode(actualFinancialBalanceTypeCode); originEntry.setTransactionLedgerEntrySequenceNumber( getNextTransactionSequenceNumber(lineGroup.getReportId())); collectorBatch.addOriginEntry(originEntry); } } Integer totalRecords = Integer.valueOf(collectorBatch.getOriginEntries().size()); KualiDecimal totalDebitAmount = collectorBatch.getOriginEntries() .stream() .filter(this::isDebitEntry) .map(OriginEntryFull::getTransactionLedgerEntryAmount) .reduce(KualiDecimal.ZERO, KualiDecimal::add); collectorBatch.setTotalRecords(totalRecords); collectorBatch.setTotalAmount(totalDebitAmount); }
Source:
<code>private SafeHtml getLineNumbers(final Set<Integer> rowNumbers) { return new SafeHtml() { @Override public String asString() { StringBuilder builder = new StringBuilder(); Iterator<Integer> iterator = rowNumbers.iterator(); while (iterator.hasNext()) { builder.append(iterator.next()); if (iterator.hasNext()) { builder.append(", "); } } <START> return builder.toString(); <END> } }; }</code><technical_language>Candidate for streams. Collectors.joining( ", " )</technical_language>

Target:
private SafeHtml getLineNumbers(final Set<Integer> rowNumbers) { return (SafeHtml) () -> rowNumbers .stream() .map(Object::toString) .collect(Collectors.joining(", ")); }
Source:
<code>public GraphQLType getWrappedType() { if (replacedWrappedType != null) { return replacedWrappedType; } <START> return originalWrappedType; <END> }</code><technical_language>a case for ? : operator a helper method <T> T orElse(T one, T two)</technical_language>

Target:
public GraphQLType getWrappedType() { return replacedWrappedType != null ? replacedWrappedType : originalWrappedType; }
Source:
<code>protected void doStop() { if(getDistributedObject() instanceof IMap) { ((IMap<?, ?>)getDistributedObject()).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if(getDistributedObject() instanceof MultiMap) { ((MultiMap<?, ?>)getDistributedObject()).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if(getDistributedObject() instanceof ReplicatedMap) { ((ReplicatedMap<?, ?>)getDistributedObject()).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if(getDistributedObject() instanceof IList) { ((IList<?>)getDistributedObject()).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if(getDistributedObject() instanceof ISet) { ((ISet<?>)getDistributedObject()).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if(getDistributedObject() instanceof IQueue) { ((IQueue<?>)getDistributedObject()).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if(getDistributedObject() instanceof ITopic) { ((ITopic<?>)getDistributedObject()).removeMessageListener(getHazelcastRegisteredEventListenerId()); <START> } <END> }</code><technical_language>some StopCallback abstraction better? else if(getDistributedObject() instanceof ITopic) { final ITopic<?> topic = (ITopic<?>)getDistributedObject(); final String listenerId = topic.addMessageListener(new HazelcastMessageListener())); setStopCallback(new Runnable() { public void run() { topic.removeMessageListener(listenerId); } }); } this: getStopCallback().run(); live current solution, too. is need care generics anyway</technical_language>

Target:
protected void doStop() { if(this.distributedObject instanceof IMap) { ((IMap<?, ?>) this.distributedObject).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if(this.distributedObject instanceof MultiMap) { ((MultiMap<?, ?>) this.distributedObject).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if(this.distributedObject instanceof ReplicatedMap) { ((ReplicatedMap<?, ?>) this.distributedObject).removeEntryListener(getHazelcastRegisteredEventListenerId()); } else if(this.distributedObject instanceof IList) { ((IList<?>) this.distributedObject).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if(this.distributedObject instanceof ISet) { ((ISet<?>) this.distributedObject).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if(this.distributedObject instanceof IQueue) { ((IQueue<?>) this.distributedObject).removeItemListener(getHazelcastRegisteredEventListenerId()); } else if(this.distributedObject instanceof ITopic) { ((ITopic<?>) this.distributedObject).removeMessageListener(getHazelcastRegisteredEventListenerId()); } }
Source:
<code>protected List<String> run() throws Exception { Run run = getContext().get(Run.class); BuildScanLogScanner scanner = new BuildScanLogScanner(new DefaultBuildScanPublishedListener(run)); try ( BufferedReader logReader = new BufferedReader(run.getLogReader()); Stream<String> lines = logReader.lines() ) { lines.forEach(scanner::scanLine); } <START> return run.getAction(BuildScanAction.class).getScanUrls(); <END> }</code><technical_language>This give a null pointer exception if scans found. a composite listener track of build scans is passed BuildScanLogScanner. fine if DefaultBuildScanPublishedListener queried for build scans. Finally, a null check is good enough for now</technical_language>

Target:
protected List<String> run() throws Exception { Run run = getContext().get(Run.class); BuildScanLogScanner scanner = new BuildScanLogScanner(new DefaultBuildScanPublishedListener(run)); try ( BufferedReader logReader = new BufferedReader(run.getLogReader()); Stream<String> lines = logReader.lines() ) { lines.forEach(scanner::scanLine); } BuildScanAction action = run.getAction(BuildScanAction.class); if (action != null) { return action.getScanUrls(); } return Collections.emptyList(); }
Source:
<code>private static void compareINDArrays(String label, INDArray a, INDArray b, double eps) { INDArray diff = a.sub(b); double min = diff.minNumber().doubleValue(); double max = diff.maxNumber().doubleValue(); log.info(label + ": " + a.equalsWithEps(b, eps) + ", " + min + ", " + max); double threshold = 1e-7; double aAbsMax = Math.max(Math.abs(a.minNumber().doubleValue()), Math.abs(a.maxNumber().doubleValue())); double bAbsMax = Math.max(Math.abs(b.minNumber().doubleValue()), Math.abs(b.maxNumber().doubleValue())); if (Math.abs(aAbsMax) > threshold && Math.abs(bAbsMax) > threshold) { <START> assert (a.equalsWithEps(b, eps)); <END> } }</code><technical_language>assert is a Java feature, a JUnit feature. Furthermore, assertions enabled (not default, easy forget realize aren't)... this</technical_language>

Target:
private static void compareINDArrays(String label, INDArray a, INDArray b, double eps) { INDArray diff = a.sub(b); double min = diff.minNumber().doubleValue(); double max = diff.maxNumber().doubleValue(); log.info(label + ": " + a.equalsWithEps(b, eps) + ", " + min + ", " + max); double threshold = 1e-7; double aAbsMax = Math.max(Math.abs(a.minNumber().doubleValue()), Math.abs(a.maxNumber().doubleValue())); double bAbsMax = Math.max(Math.abs(b.minNumber().doubleValue()), Math.abs(b.maxNumber().doubleValue())); if (Math.abs(aAbsMax) > threshold && Math.abs(bAbsMax) > threshold) { assertTrue(a.equalsWithEps(b, eps)); } }