auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void playerOnPlay(PlayerType.GetActivePlayersReturnType getActivePlayerResult, PlayerType.PropertyValue getPropertiesResult, ListType.ItemsAll getItemResult) { playerState = PLAYER_STATE.PLAYING; lastGetItemResult = getItemResult; lastGetActivePlayerResult = getActivePlayerResult; refreshPlaylist(lastGetActivePlayerResult.type); if (! userSelectedTab) { playlistsBar.selectTab(getActivePlayerResult.type); } playlistsBar.setIsPlaying(getActivePlayerResult.type, true); }

Target:
public void playerOnPlay(PlayerType.GetActivePlayersReturnType getActivePlayerResult, PlayerType.PropertyValue getPropertiesResult, ListType.ItemsAll getItemResult) { playerState = PLAYER_STATE.PLAYING; lastGetItemResult = getItemResult; lastGetActivePlayerResult = getActivePlayerResult; if (! userSelectedTab) { playlistsBar.selectTab(getActivePlayerResult.type); } playlistsBar.setIsPlaying(getActivePlayerResult.type, true); displayPlaylist(); PlaylistHolder playlistHolder = playlists.get(getActivePlayerResult.type); if (playlistHolder != null && isPlaying(playlistHolder.getPlaylistResult)) { highlightCurrentlyPlayingItem(); } else { playlistListView.clearChoices(); } }
Source:
private static boolean requiresReturnNull(MethodTree methodTree) { return isOverriding(methodTree) && REQUIRES_RETURN_NULL.stream().anyMatch(methodTree.symbol().owner().type()::isSubtypeOf); }

Target:
private static boolean requiresReturnNull(MethodTree methodTree) { return isOverriding(methodTree) && REQUIRES_RETURN_NULL.stream().anyMatch(methodTree.symbol().owner().type()::isSubtypeOf) && ITEM_PROCESSOR_PROCESS_METHOD.matches(methodTree); }
Source:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = lines.length; for (int i = lines.length - 1; i > 0; --i) { if (changeIdPattern.matcher(lines[i].trim()).matches()) { indexOfChangeIdLine = i; break; } } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return message.indexOf(CHANGE_ID, indexOfChangeIdLineinString); }

Target:
public static int indexOfChangeId(String message, String delimiter) { String[] lines = message.split(delimiter); int indexOfChangeIdLine = lines.length; boolean inFooter = false; for (int i = lines.length - 1; i > 0; --i) { if (!inFooter && lines[i].trim().length() == 0) continue; inFooter = true; if (changeIdPattern.matcher(lines[i].trim()).matches()) { indexOfChangeIdLine = i; break; } else if (lines[i].trim().length() == 0) { return -1; } } int indexOfChangeIdLineinString = 0; for (int i = 0; i < indexOfChangeIdLine; ++i) indexOfChangeIdLineinString += lines[i].length() + delimiter.length(); return message.indexOf(CHANGE_ID, indexOfChangeIdLineinString); }
Source:
private JsonObject getAccessTokenJson(HttpResponse postResponse) throws UnsupportedEncodingException, IOException { JsonElement accessTokenJson = gson.fromJson(new InputStreamReader(postResponse.getEntity() .getContent(), "UTF-8"), JsonElement.class); if(accessTokenJson.isJsonObject()) { return accessTokenJson.getAsJsonObject(); } else { return null; } }

Target:
private JsonObject getAccessTokenJson(HttpResponse postResponse) throws UnsupportedEncodingException, IOException { JsonElement accessTokenJson = gson.fromJson(new InputStreamReader(postResponse.getEntity() .getContent(), Charsets.UTF_8), JsonElement.class); if (accessTokenJson.isJsonObject()) { return accessTokenJson.getAsJsonObject(); } else { return null; } }
Source:
public final ResultIterator iterator() throws SQLException { return iterator(null); }

Target:
public final ResultIterator iterator() throws SQLException { return iterator(Collections.<SQLCloseable>emptyList()); }
Source:
public boolean execute(String sql) throws SQLException { sqlQuery = sql; System.out.println("ECLPREPSTMT execute(" + sql + ")"); processQuery(); return execute(); }

Target:
public boolean execute(String sql) throws SQLException { sqlQuery = sql; processQuery(); return execute(); }
Source:
public double getRuntime(){ Measurement first = getFirstMeasurement(); Measurement last = getLastMeasurement(); if (first == null || last == null) return 0; long diffInMs = last.start_time.getTime() - first.start_time.getTime(); long diffInSec = TimeUnit.MILLISECONDS.toSeconds(diffInMs); return diffInSec + last.runtime; }

Target:
public double getRuntime(){ Measurement first = getFirstMeasurement(); Measurement last = getLastMeasurement(); long diffInMs = last.start_time.getTime() - first.start_time.getTime(); long diffInSec = TimeUnit.MILLISECONDS.toSeconds(diffInMs); return diffInSec + last.runtime; }
Source:
public String getMessage(String version, String os, HttpHeaders headers) { String message = null; String hostAddress = getHostAddress(headers); for (DiscountSetting setting : settings.getDiscountSettings()) { if (handleCondition(setting.getDiscountCondition(), version, hostAddress)) { return chooseFileByPlatform(setting, os); } } return message; }

Target:
public MotdMessage getMessage(String version, String os, HttpHeaders headers) throws IOException, ParseException { Date now = new Date(); MotdMessage message = null; String hostAddress = getHostAddress(headers); for (DiscountSetting setting : settings.getDiscountSettings()) { if (setting.getDiscountCondition().checkCondition(now, hostAddress, version)) { String filename = setting.getMotdFileByPlatform(os); message = parseMotdMessageFile(websiteLocation.concat("api/messages/").concat(filename)); message = modifyMessageIfNeeded(setting, message); break; } } return message; }
Source:
private void startCgroupWatcher(final SingularityExecutorTask task) { SingularityTaskExecutorData taskExecutorData = (SingularityTaskExecutorData) task.getExecutorData(); if (taskExecutorData.getCpuHardLimit().isPresent()) { cgroupCfsWatcherService.submit(() -> { try { SingularityExecutorCgroupCfsChecker cfsChecker = new SingularityExecutorCgroupCfsChecker(task, taskExecutorData.getCpuHardLimit().get(), configuration.getDefaultCfsPeriod()); cfsChecker.watch(); cgroupCheckers.put(task.getTaskId(), cfsChecker); } catch (Throwable t) { LOG.error("Could not start cgorup checker for task {}", task.getTaskId(), t); } }); } }

Target:
private void startCgroupWatcher(final SingularityExecutorTask task) { SingularityTaskExecutorData taskExecutorData = (SingularityTaskExecutorData) task.getExecutorData(); if (taskExecutorData.getCpuHardLimit().isPresent()) { cgroupCfsWatcherService.submit(() -> { try { SingularityExecutorCgroupCfsChecker cfsChecker = new SingularityExecutorCgroupCfsChecker(task, taskExecutorData.getCpuHardLimit().get(), configuration.getDefaultCfsPeriod()); cfsChecker.watch(); cgroupCheckers.put(task.getTaskId(), cfsChecker); } catch (Throwable t) { LOG.error("Could not start cgroup checker for task {}", task.getTaskId(), t); } }); } }
Source:
private void showQuickStartDialog() { if (AppPrefs.isQuickStartDisabled() || getSelectedSite() == null || !QuickStartUtils.isQuickStartAvailableForTheSite(getSelectedSite())) { return; } String tag = MySiteFragment.TAG_QUICK_START_DIALOG; PromoDialog promoDialog = new PromoDialog(); promoDialog.initialize( tag, getString(R.string.quick_start_dialog_need_help_title), getString(R.string.quick_start_dialog_need_help_message), getString(R.string.quick_start_dialog_need_help_button_positive), R.drawable.img_promo_quick_start, getString(R.string.quick_start_dialog_need_help_button_negative), "", getString(R.string.quick_start_dialog_need_help_button_neutral) ); promoDialog.show(getSupportFragmentManager(), tag); AnalyticsTracker.track(AnalyticsTracker.Stat.QUICK_START_REQUEST_SEEN); }

Target:
private void showQuickStartDialog() { if (AppPrefs.isQuickStartDisabled() || getSelectedSite() == null || !QuickStartUtils.isQuickStartAvailableForTheSite(getSelectedSite())) { return; } String tag = MySiteFragment.TAG_QUICK_START_DIALOG; PromoDialog promoDialog = new PromoDialog(); promoDialog.initialize( tag, getString(R.string.quick_start_dialog_need_help_title), getString(R.string.quick_start_dialog_need_help_message), getString(R.string.quick_start_dialog_need_help_button_positive), R.drawable.img_promo_quick_start, getString(R.string.quick_start_dialog_need_help_button_negative), "", getString(R.string.quick_start_dialog_need_help_button_neutral) ); promoDialog.show(getSupportFragmentManager(), tag); AnalyticsTracker.track(Stat.QUICK_START_REQUEST_VIEWED); }
Source:
public List<ClientModel> searchClientsByClientId(String clientId, Integer firstResult, Integer maxResults, RealmModel realm) { if (clientId != null && this.clientId.toLowerCase().contains(clientId.toLowerCase())) { return Collections.singletonList(new ClientAdapter(realm)); } return null; }

Target:
public List<ClientModel> searchClientsByClientId(String clientId, Integer firstResult, Integer maxResults, RealmModel realm) { if (clientId != null && this.clientId.toLowerCase().contains(clientId.toLowerCase())) { return Collections.singletonList(new ClientAdapter(realm)); } return Collections.EMPTY_LIST; }
Source:
public List<Event> getEventsSinceId(String workflowId, int eventId, int maxEvents) throws IOException { Preconditions.checkArgument(maxEvents > 0); WorkflowId id = WorkflowId.parseString(workflowId); FlowEventKey flowEventKey = new FlowEventKey(toFlowKey(id), eventId); List<FlowEvent> flowEventList = flowEventService.getFlowEventsSince(flowEventKey); int numElems = 0; List<Event> workflowEvents = Lists.newArrayList(); for (FlowEvent flowEvent : flowEventList) { if (numElems >= maxEvents) { break; } String eventDataJson = flowEvent.getEventDataJSON(); try { Event event = Event.fromJson(eventDataJson); numElems++; workflowEvents.add(event); } catch (JsonMappingException e) { LOG.error("Could not deserialize json: " + eventDataJson, e); } } return workflowEvents; }

Target:
public List<Event> getEventsSinceId(String workflowId, int eventId, int maxEvents) throws IOException { Preconditions.checkArgument(maxEvents > 0); WorkflowId id = WorkflowId.parseString(workflowId); FlowEventKey flowEventKey = new FlowEventKey(toFlowKey(id), eventId); List<FlowEvent> flowEventList = flowEventService.getFlowEventsSince(flowEventKey); int numElems = 0; List<Event> workflowEvents = Lists.newArrayListWithCapacity(maxEvents); for (FlowEvent flowEvent : flowEventList) { if (numElems >= maxEvents) { break; } String eventDataJson = flowEvent.getEventDataJSON(); try { Event event = Event.fromJson(eventDataJson); numElems++; workflowEvents.add(event); } catch (JsonMappingException e) { LOG.error("Could not deserialize json: " + eventDataJson, e); } } return workflowEvents; }
Source:
private static PolymorphicScalarFunctionBuilder castFunctionToDecimalFromBuilder(TypeSignature from, boolean nullableResult, String... methodNames) { Signature signature = Signature.builder() .kind(SCALAR) .operatorType(CAST) .argumentTypes(from) .returnType(parseTypeSignature("decimal(precision,scale)", ImmutableSet.of("precision", "scale"))) .build(); return SqlScalarFunction.builder(DecimalCasts.class) .signature(signature) .deterministic(true) .choice(c -> c .nullableResult(nullableResult) .implementation(b -> b .methods(methodNames) .withExtraParameters((context) -> { DecimalType resultType = (DecimalType) context.getReturnType(); Number tenToScale; if (isShortDecimal(resultType)) { tenToScale = longTenToNth(resultType.getScale()); } else { tenToScale = bigIntegerTenToNth(resultType.getScale()); } return ImmutableList.of(resultType.getPrecision(), resultType.getScale(), tenToScale); }))); }

Target:
private static SqlScalarFunction castFunctionToDecimalFromBuilder(TypeSignature from, boolean nullableResult, String... methodNames) { Signature signature = Signature.builder() .kind(SCALAR) .operatorType(CAST) .argumentTypes(from) .returnType(parseTypeSignature("decimal(precision,scale)", ImmutableSet.of("precision", "scale"))) .build(); return SqlScalarFunction.builder(DecimalCasts.class) .signature(signature) .deterministic(true) .choice(choice -> choice .nullableResult(nullableResult) .implementation(methodsGroup -> methodsGroup .methods(methodNames) .withExtraParameters((context) -> { DecimalType resultType = (DecimalType) context.getReturnType(); Number tenToScale; if (isShortDecimal(resultType)) { tenToScale = longTenToNth(resultType.getScale()); } else { tenToScale = bigIntegerTenToNth(resultType.getScale()); } return ImmutableList.of(resultType.getPrecision(), resultType.getScale(), tenToScale); }))).build(); }
Source:
public void setupMocks() { MockitoAnnotations.initMocks(this); constraintViolationBuilder = mock(ConstraintValidatorContext.ConstraintViolationBuilder.class); nodeBuilderCustomizableContext = mock(ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext.class); validatorContext = mock(ConstraintValidatorContext.class); when(validatorContext.buildConstraintViolationWithTemplate(any())).thenReturn(constraintViolationBuilder); when(constraintViolationBuilder.addPropertyNode(any())).thenReturn(nodeBuilderCustomizableContext); when(nodeBuilderCustomizableContext.addConstraintViolation()).thenReturn(validatorContext); doNothing().when(validatorContext).disableDefaultConstraintViolation(); }

Target:
public void setupMocks() { constraintViolationBuilder = mock(ConstraintValidatorContext.ConstraintViolationBuilder.class); nodeBuilderCustomizableContext = mock(ConstraintValidatorContext.ConstraintViolationBuilder.NodeBuilderCustomizableContext.class); validatorContext = mock(ConstraintValidatorContext.class); when(validatorContext.buildConstraintViolationWithTemplate(any())).thenReturn(constraintViolationBuilder); when(constraintViolationBuilder.addPropertyNode(any())).thenReturn(nodeBuilderCustomizableContext); when(nodeBuilderCustomizableContext.addConstraintViolation()).thenReturn(validatorContext); doNothing().when(validatorContext).disableDefaultConstraintViolation(); }
Source:
protected void assertEquals(IPath parent, RemoteFolder container1, RemoteFolder container2, boolean includeTags) throws CoreException, TeamException, IOException { IPath path = parent.append(container1.getName()); assertEquals(path, container1.getFolderSyncInfo(), container2.getFolderSyncInfo(), includeTags); ICVSRemoteResource[] members1 = container1.getMembers(DEFAULT_MONITOR); ICVSRemoteResource[] members2 = container2.getMembers(DEFAULT_MONITOR); assertTrue("Number of members differ for " + path, members1.length == members2.length); Map<String, ICVSRemoteResource> memberMap2 = new HashMap<>(); for (ICVSRemoteResource members21 : members2) { memberMap2.put(members21.getName(), members21); } for (ICVSRemoteResource members11 : members1) { ICVSRemoteResource member2 = memberMap2.get(members11.getName()); assertNotNull("Resource does not exist: " + path.append(members11.getName()) + member2); assertEquals(path, members11, member2, includeTags); } }

Target:
protected void assertEquals(IPath parent, RemoteFolder container1, RemoteFolder container2, boolean includeTags) throws CoreException, TeamException, IOException { IPath path = parent.append(container1.getName()); assertEquals(path, container1.getFolderSyncInfo(), container2.getFolderSyncInfo(), includeTags); ICVSRemoteResource[] members1 = container1.getMembers(DEFAULT_MONITOR); ICVSRemoteResource[] members2 = container2.getMembers(DEFAULT_MONITOR); assertTrue("Number of members differ for " + path, members1.length == members2.length); Map<String, ICVSRemoteResource> memberMap2 = new HashMap<>(); for (ICVSRemoteResource m : members2) { memberMap2.put(m.getName(), m); } for (ICVSRemoteResource _m : members1) { ICVSRemoteResource member2 = memberMap2.get(_m.getName()); assertNotNull("Resource does not exist: " + path.append(_m.getName()) + member2); assertEquals(path, _m, member2, includeTags); } }
Source:
public ByteAmount multiply(int factor) { Preconditions.checkArgument(asBytes() <= Long.MAX_VALUE / factor, String.format( "Subtracting %s from %s would overshoot Long.MIN_LONG", this, factor)); return ByteAmount.fromBytes(asBytes() * factor); }

Target:
public ByteAmount multiply(int factor) { Preconditions.checkArgument(asBytes() <= Long.MAX_VALUE / factor, String.format( "Multiplying %s by %d would exceed Long.MAX_LONG", this, factor)); return ByteAmount.fromBytes(asBytes() * factor); }
Source:
public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) { AzureDlsGen2BlobSource source = new AzureDlsGen2BlobSource(); AzureDlsGen2BlobInputProperties properties = new AzureDlsGen2BlobInputProperties("health"); AzureDlsGen2BlobDatasetProperties dataset = new AzureDlsGen2BlobDatasetProperties("dataprep"); dataset.setDatastoreProperties(datastore); properties.setDatasetProperties(dataset); source.initialize(container, properties); return Arrays.asList(source.validate(container)); }

Target:
public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) { AzureDlsGen2BlobSource source = new AzureDlsGen2BlobSource(); AzureDlsGen2BlobInputProperties properties = new AzureDlsGen2BlobInputProperties("health"); AzureDlsGen2BlobDatasetProperties dataset = new AzureDlsGen2BlobDatasetProperties("dataprep"); dataset.setDatastoreProperties(datastore); properties.setDatasetProperties(dataset); source.initialize(container, properties); return Collections.singletonList(source.validate(container)); }
Source:
void extendTicket() { assertDoesNotThrow(() -> imageioClient.extendTicket(imageTicket.getId(), 300)); }

Target:
void extendTicket() { imageioClient.putTicket(imageTicket); ImageTicketInformation oldTicket = imageioClient.getTicket(imageTicket.getId()); assertDoesNotThrow(() -> imageioClient.extendTicket(imageTicket.getId(), 600)); ImageTicketInformation newTicket = imageioClient.getTicket(imageTicket.getId()); assertTrue(newTicket.getExpires() >= oldTicket.getExpires() + oldTicket.getTimeout()); assertTrue(oldTicket.getExpires() + oldTicket.getTimeout() + 1 >= newTicket.getExpires()); }
Source:
private boolean isYoungerThanThisNode(PathChildrenCacheEvent event) { Stat stat = event.getData().getStat(); return stat.getCtime() > initializationTime && stat.getMtime() > initializationTime; }

Target:
private boolean isYoungerThanThisNode(PathChildrenCacheEvent event) { return event.getData().getStat().getMtime() > initializationTime; }
Source:
public double max(String colName) { double[] colArray = toDoubleArray(colName); double arrayMax = StatUtils.max(colArray); return arrayMax; }

Target:
public double max(String colName) { return StatUtils.max(toDoubleArray(colName)); }
Source:
public boolean isKeepNext() { if (getCTP() != null && getCTP().getPPr() != null) { return getCTP().getPPr().setKeepNext(on); } }

Target:
public boolean isKeepNext() { if (getCTP() != null && getCTP().getPPr() != null && getCTP().getPPr().isSetKeepNext()) { return getCTP().getPPr().getKeepNext().getVal() == STOnOff.ON; } return false; }
Source:
private void handleArrowKeys(final KeyboardEvent.Key... keys) { final int selectedIDsCount = selectedIDs.size(); if (selectedIDsCount == 0) { return; } final double multiplier = 10d; final double divider = 5d; double movementDistance = 5d; double horizontalDistance = 0d; double verticalDistance = 0d; if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.CONTROL)){ movementDistance *= multiplier; } else if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.SHIFT)){ movementDistance /= divider; } if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_UP)) { verticalDistance = -movementDistance; } else if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_DOWN)) { verticalDistance = movementDistance; } if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_LEFT)) { horizontalDistance = -movementDistance; }else if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_RIGHT)) { horizontalDistance = movementDistance; } if (verticalDistance == 0 && horizontalDistance == 0) { return; } ArrayList<Element> moveNodes = new ArrayList<>(); ArrayList<Point2D> movePositions = new ArrayList<>(); for (String uuid : selectedIDs) { final Node<View<?>, Edge> node = canvasHandler.getGraphIndex().getNode(uuid); if (node != null) { final Point2D nodePosition = GraphUtils.getPosition(node.getContent()); final Point2D movePosition = new Point2D(nodePosition.getX() + horizontalDistance, nodePosition.getY() + verticalDistance); moveNodes.add(node); movePositions.add(movePosition); } } move(moveNodes.toArray(new Element[] {}), movePositions.toArray(new Point2D[] {})); }

Target:
private void handleArrowKeys(final KeyboardEvent.Key... keys) { final int selectedIDsCount = selectedIDs.size(); if (selectedIDsCount == 0) { return; } double movementDistance = NORMAL_DISTANCE; if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.CONTROL)) { movementDistance = LARGE_DISTANCE; } else if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.SHIFT)) { movementDistance = SHORT_DISTANCE; } double horizontalDistance = 0d; double verticalDistance = 0d; if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_LEFT)) { horizontalDistance = -movementDistance; } else if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_RIGHT)) { horizontalDistance = movementDistance; } if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_UP)) { verticalDistance = -movementDistance; } else if (KeysMatcher.isKeyMatch(keys, KeyboardEvent.Key.ARROW_DOWN)) { verticalDistance = movementDistance; } if (verticalDistance == 0 && horizontalDistance == 0) { return; } List<Element> moveNodes = new ArrayList<>(); List<Point2D> movePositions = new ArrayList<>(); for (String uuid : selectedIDs) { final Node<View<?>, Edge> node = canvasHandler.getGraphIndex().getNode(uuid); if (node != null) { final Point2D nodePosition = GraphUtils.getPosition(node.getContent()); final Point2D movePosition = new Point2D(nodePosition.getX() + horizontalDistance, nodePosition.getY() + verticalDistance); moveNodes.add(node); movePositions.add(movePosition); } } move(moveNodes.toArray(new Element[]{}), movePositions.toArray(new Point2D[]{})); }
Source:
protected StandardIntegrationFlow get() { if (this.integrationFlow == null) { if (this.currentMessageChannel instanceof FixedSubscriberChannelPrototype) { throw new BeanCreationException("The 'currentMessageChannel' (" + this.currentMessageChannel + ") is a prototype for 'FixedSubscriberChannel' which can't be created without " + "'MessageHandler' " + "constructor argument. That means that '.fixedSubscriberChannel()' can't be the last " + "EIP-method in the 'IntegrationFlow' definition."); } if (this.integrationComponents.size() == 1) { if (this.currentComponent != null) { if (this.currentComponent instanceof SourcePollingChannelAdapterSpec) { throw new BeanCreationException("The 'SourcePollingChannelAdapter' (" + this.currentComponent + ") " + "must be configured with at least one 'MessageChannel' or 'MessageHandler'."); } } else if (this.currentMessageChannel != null) { throw new BeanCreationException("The 'IntegrationFlow' can't consist of only one 'MessageChannel'. " + "Add at lest '.bridge()' EIP-method before the end of flow."); } } if (this.implicitChannel) { Optional<Object> lastComponent = this.integrationComponents.keySet() .stream() .reduce((first, second) -> second); if (lastComponent.get() instanceof WireTapSpec) { channel(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); } } this.integrationFlow = new StandardIntegrationFlow(this.integrationComponents); } return this.integrationFlow; }

Target:
protected StandardIntegrationFlow get() { if (this.integrationFlow == null) { if (this.currentMessageChannel instanceof FixedSubscriberChannelPrototype) { throw new BeanCreationException("The 'currentMessageChannel' (" + this.currentMessageChannel + ") is a prototype for 'FixedSubscriberChannel' which can't be created without " + "a 'MessageHandler' constructor argument. " + "That means that '.fixedSubscriberChannel()' can't be the last " + "EIP-method in the 'IntegrationFlow' definition."); } if (this.integrationComponents.size() == 1) { if (this.currentComponent != null) { if (this.currentComponent instanceof SourcePollingChannelAdapterSpec) { throw new BeanCreationException("The 'SourcePollingChannelAdapter' (" + this.currentComponent + ") " + "must be configured with at least one 'MessageChannel' or 'MessageHandler'."); } } else if (this.currentMessageChannel != null) { throw new BeanCreationException("The 'IntegrationFlow' can't consist of only one 'MessageChannel'. " + "Add at lest '.bridge()' EIP-method before the end of flow."); } } if (this.implicitChannel) { Optional<Object> lastComponent = this.integrationComponents.keySet() .stream() .reduce((first, second) -> second); if (lastComponent.get() instanceof WireTapSpec) { channel(IntegrationContextUtils.NULL_CHANNEL_BEAN_NAME); } } this.integrationFlow = new StandardIntegrationFlow(this.integrationComponents); } return this.integrationFlow; }
Source:
public Object visit(PropertyIsLike filter, Object extraData) { BasicDBObject output = asDBObject(extraData); String expr = convert(filter.getExpression().accept(this, null), String.class); String multi = filter.getWildCard(); String single = filter.getSingleChar(); int flags = (filter.isMatchingCase()) ? 0 : Pattern.CASE_INSENSITIVE; String regex = filter.getLiteral().replace(multi, ".*").replace(single, "."); Pattern p = Pattern.compile(regex, flags); output.put((String) expr, p); return output; }

Target:
public Object visit(PropertyIsLike filter, Object extraData) { BasicDBObject output = asDBObject(extraData); Expression filterExpression = filter.getExpression(); if (!(filterExpression instanceof PropertyName)) { throw new UnsupportedOperationException(); } String expr = convert(filterExpression.accept(this, null), String.class); String multi = filter.getWildCard(); String single = filter.getSingleChar(); int flags = (filter.isMatchingCase()) ? 0 : Pattern.CASE_INSENSITIVE; String regex = filter.getLiteral().replace(multi, ".*").replace(single, "."); Pattern p = Pattern.compile(regex, flags); output.put((String) expr, p); return output; }
Source:
protected void doSomething(int i, Record record) throws IOException { assertEquals("0", record.getKey()); assertTrue(record.getData().length > 0); if (!writeToOuput) { return; } String message = new String(record.getData(), StandardCharsets.UTF_8); message = message.replace("logEntry", "XXX"); Record changed = new Record(record.getKey(), message.getBytes(StandardCharsets.UTF_8), record.getWatermark(), record.getFlags()); dataFileWriter.append(changed); }

Target:
protected void doSomething(int i, Record record) throws IOException { assertEquals("0", record.getKey()); assertTrue(record.getData().length > 0); if (!writeToOuput) { return; } String message = new String(record.getData(), UTF_8); message = message.replace("logEntry", "XXX"); Record changed = new Record(record.getKey(), message.getBytes(UTF_8), record.getWatermark(), record.getFlags()); dataFileWriter.append(changed); }
Source:
public void onReplaced(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, BlockState newState, boolean moving) { if(state.getBlock()!=newState.getBlock()) { int dummyState = state.get(POST_SLAVE); HorizontalOffset offset = state.get(HORIZONTAL_OFFSET); if(dummyState > 0&&offset==HorizontalOffset.NONE) world.setBlockState(pos.down(dummyState), Blocks.AIR.getDefaultState()); else if(dummyState==0) { spawnAsEntity(world, pos, new ItemStack(this)); final int highestBlock = 3; BlockPos armStart = pos.up(highestBlock); for(Direction d : Direction.BY_HORIZONTAL_INDEX) { BlockPos armPos = armStart.offset(d); BlockState armState = world.getBlockState(armPos); if(armState.getBlock()==this&&armState.get(HORIZONTAL_OFFSET).getOffset().equals(d.getDirectionVec())) world.setBlockState(armPos, Blocks.AIR.getDefaultState()); } for(int i = 0; i <= highestBlock; ++i) world.setBlockState(pos.up(i), Blocks.AIR.getDefaultState()); } super.onReplaced(state, world, pos, newState, moving); } }

Target:
public void onReplaced(@Nonnull BlockState state, World world, @Nonnull BlockPos pos, BlockState newState, boolean moving) { if(state.getBlock()!=newState.getBlock()) { int dummyState = state.get(POST_SLAVE); HorizontalOffset offset = state.get(HORIZONTAL_OFFSET); if(dummyState > 0&&offset==HorizontalOffset.NONE) world.setBlockState(pos.down(dummyState), Blocks.AIR.getDefaultState()); else if(dummyState==0) { spawnAsEntity(world, pos, new ItemStack(this)); final int highestBlock = 3; BlockPos armStart = pos.up(highestBlock); for(Direction d : Direction.BY_HORIZONTAL_INDEX) { BlockPos armPos = armStart.offset(d); BlockState armState = world.getBlockState(armPos); if(armState.getBlock()==this&&armState.get(HORIZONTAL_OFFSET).getOffset().equals(d.getDirectionVec())) world.setBlockState(armPos, Blocks.AIR.getDefaultState()); } for(int i = 0; i <= highestBlock; ++i) world.setBlockState(pos.up(i), Blocks.AIR.getDefaultState()); } } super.onReplaced(state, world, pos, newState, moving); }
Source:
public Observable<ChangeNotification<InstanceInfo>> changeNotifications() { return aggregatedStream.share(); }

Target:
public Observable<ChangeNotification<InstanceInfo>> changeNotifications() { return aggregatedStream; }
Source:
protected HAClusterConfig(final Builder builder) { super(builder); data_sources = builder.dataSources == null ? Collections.emptyList() : builder.dataSources; data_source_configs = builder.dataSourceConfigs == null ? Collections.emptyList() : builder.dataSourceConfigs; merge_aggregator = builder.mergeAggregator; secondary_timeout = builder.secondaryTimeout; primary_timeout = builder.primaryTimeout; original_secondary_timeout = Strings.isNullOrEmpty(getOriginalsecondarytimeout()) ? secondary_timeout : getOriginalsecondarytimeout(); original_primary_timeout = Strings.isNullOrEmpty(getOriginalprimarytimeout()) ? primary_timeout : getOriginalprimarytimeout(); hash = buildHashCode().asInt(); if (!Strings.isNullOrEmpty(secondary_timeout)) { DateTime.parseDuration(secondary_timeout); } if (!Strings.isNullOrEmpty(primary_timeout)) { DateTime.parseDuration(primary_timeout); } }

Target:
protected HAClusterConfig(final Builder builder) { super(builder); data_sources = builder.dataSources == null ? Collections.emptyList() : builder.dataSources; data_source_configs = builder.dataSourceConfigs == null ? Collections.emptyList() : builder.dataSourceConfigs; merge_aggregator = builder.mergeAggregator; secondary_timeout = builder.secondaryTimeout; primary_timeout = builder.primaryTimeout; if (!Strings.isNullOrEmpty(secondary_timeout)) { DateTime.parseDuration(secondary_timeout); } if (!Strings.isNullOrEmpty(primary_timeout)) { DateTime.parseDuration(primary_timeout); } hash = buildHashCode().asInt(); }
Source:
public String postBuildComment(AbstractBuild<?, ?> build, TaskListener listener) { return "\nRefer to this link for build results (access rights to CI server needed): \n" + generateCustomizedMessage(build) + "\n"; }

Target:
public String postBuildComment(AbstractBuild<?, ?> build, TaskListener listener) { StringBuilder msg = new StringBuilder(); msg.append("\nRefer to this link for build results (access rights to CI server needed): \n"); msg.append(generateCustomizedMessage(build)); msg.append("\n"); return msg.toString(); }
Source:
public static Collection<Thread> findThreads(final ThreadGroup group, final boolean recurse, final ThreadPredicate predicate) { if (group == null) { throw new IllegalArgumentException("The group must not be null"); } if (predicate == null) { throw new IllegalArgumentException("The predicate must not be null"); } final List<Thread> result = new ArrayList<Thread>(); int count = group.activeCount(); Thread[] threads; do { threads = new Thread[count + (count >> 1) + 1]; count = group.enumerate(threads, recurse); } while (count >= threads.length); for (int i = 0; i < count; ++i) { if (predicate.test(threads[i])) { result.add(threads[i]); } } return Collections.unmodifiableCollection(result); }

Target:
public static Collection<Thread> findThreads(final ThreadGroup group, final boolean recurse, final ThreadPredicate predicate) { if (group == null) { throw new IllegalArgumentException("The group must not be null"); } if (predicate == null) { throw new IllegalArgumentException("The predicate must not be null"); } int count = group.activeCount(); Thread[] threads; do { threads = new Thread[count + (count / 2) + 1]; count = group.enumerate(threads, recurse); } while (count >= threads.length); final List<Thread> result = new ArrayList<Thread>(count); for (int i = 0; i < count; ++i) { if (predicate.test(threads[i])) { result.add(threads[i]); } } return Collections.unmodifiableCollection(result); }
Source:
public void onInitAfterLoadTemplate(LiveStreamTranscoder liveStreamTranscoder) { TranscoderStream transcoderStream = liveStreamTranscoder.getTranscodingStream(); java.util.List<com.wowza.wms.transcoder.model.TranscoderStreamDestination> transcoderStreamsMap = transcoderStream.getDestinations(); IMediaStream stream = liveStreamTranscoder.getStream(); if (transcoderStreamsMap.size() == 0){ String msg = "Stream " + stream.getName() + " has no ingest in conversion profile"; logger.error(msg); if (stream.getClient() != null){ DiagnosticsProvider.addRejectedStreamFromClient(msg, stream.getClient()); } else if (stream.getRTPStream() != null && stream.getRTPStream().getSession() !=null){ DiagnosticsProvider.addRejectedStreamFromRTSP(msg, stream.getRTPStream().getSession()); } stream.shutdown(); stream.stopPublishing(); } }

Target:
public void onInitAfterLoadTemplate(LiveStreamTranscoder liveStreamTranscoder) { TranscoderStream transcoderStream = liveStreamTranscoder.getTranscodingStream(); java.util.List<com.wowza.wms.transcoder.model.TranscoderStreamDestination> transcoderStreamsMap = transcoderStream.getDestinations(); IMediaStream stream = liveStreamTranscoder.getStream(); if (transcoderStreamsMap.size() == 0){ DiagnosticsProvider.addRejectedStream(stream, " has no ingest in conversion profile. Error: transcoderStreamsMap.size() = 0"); stream.shutdown(); stream.stopPublishing(); } }
Source:
protected void init(long[] shape) { if (shape.length == 1) { rows = 1; columns = (int) shape[0]; } else if (this.shape().length == 2) { rows = (int) shape[0]; columns = (int) shape[1]; } rank = shape.length; }

Target:
protected void init(long[] shape) { if (shape.length == 1) { rows = 1; columns = shape[0]; } else if (this.shape().length == 2) { rows = shape[0]; columns = shape[1]; } rank = shape.length; }
Source:
private TaskAssigningSolution createTaskAssigningSolution(String fileName, int taskListSize, int groupListSize, int userListSize) { random = new Random(37); TaskAssigningSolution solution = new TaskAssigningSolution(); solution.setId(0L); List<Group> groupList = createGroupList(groupListSize); createUserList(solution, userListSize, groupList); createTaskList(solution, taskListSize, groupList); BigInteger a = AbstractSolutionImporter.factorial(taskListSize + userListSize - 1); BigInteger b = AbstractSolutionImporter.factorial(userListSize - 1); BigInteger possibleSolutionSize = (a == null || b == null) ? null : a.divide(b); logger.info("TaskAssigningSolution has tasks, groups, and users with a search space of {}.", fileName, taskListSize, groupListSize, userListSize, AbstractSolutionImporter.getFlooredPossibleSolutionSize(possibleSolutionSize)); return solution; }

Target:
private TaskAssigningSolution createTaskAssigningSolution(String fileName, int taskListSize, int groupListSize, int userListSize) { TaskAssigningSolution solution = new TaskAssigningSolution(); solution.setId(0L); List<Group> groupList = createGroupList(groupListSize); createUserList(solution, userListSize, groupList); createTaskList(solution, taskListSize, groupList); BigInteger totalFacts = AbstractSolutionImporter.factorial(taskListSize + userListSize - 1); BigInteger fixedFacts = AbstractSolutionImporter.factorial(userListSize - 1); BigInteger possibleSolutionSize = (totalFacts == null || fixedFacts == null) ? null : totalFacts.divide(fixedFacts); logger.info("TaskAssigningSolution has tasks, groups, and users with a search space of {}.", fileName, taskListSize, groupListSize, userListSize, AbstractSolutionImporter.getFlooredPossibleSolutionSize(possibleSolutionSize)); return solution; }
Source:
protected void updateWeights(FeedbackQuestion question) { FeedbackQuestionAttributes attr = FeedbackQuestionAttributes.valueOf(question); FeedbackRubricQuestionDetails fqd = (FeedbackRubricQuestionDetails) attr.getQuestionDetails(); List<List<Double>> weightsForEachCell = fqd.getRubricWeights(); FeedbackQuestionsDb fqDb = new FeedbackQuestionsDb(); try { Field rubricWeightsForEachCell = fqd.getClass().getDeclaredField("rubricWeightsForEachCell"); rubricWeightsForEachCell.setAccessible(true); rubricWeightsForEachCell.set(fqd, weightsForEachCell); attr.setQuestionDetails(fqd); fqDb.updateFeedbackQuestion(attr); } catch (ReflectiveOperationException e) { System.out.println(e.getMessage()); } catch (InvalidParametersException e) { System.out.println(e.getMessage()); } catch (EntityDoesNotExistException e) { System.out.println(e.getMessage()); } }

Target:
protected void updateWeights(FeedbackQuestion question) { FeedbackQuestionAttributes attr = FeedbackQuestionAttributes.valueOf(question); FeedbackRubricQuestionDetails fqd = (FeedbackRubricQuestionDetails) attr.getQuestionDetails(); List<List<Double>> weightsForEachCell = fqd.getRubricWeights(); try { Field rubricWeightsForEachCell = fqd.getClass().getDeclaredField("rubricWeightsForEachCell"); rubricWeightsForEachCell.setAccessible(true); rubricWeightsForEachCell.set(fqd, weightsForEachCell); attr.setQuestionDetails(fqd); question.setQuestionText(attr.questionMetaData); question.keepUpdateTimestamp = true; } catch (ReflectiveOperationException e) { System.out.println(e.getMessage()); } }
Source:
public void run() { setPriority(Thread.NORM_PRIORITY); try { while ((currentJob = pool.startJob(this)) != null) { IStatus result = Status.OK_STATUS; try { MonitorCancellationMonitoringPolicy monitorCancellationMonitoringPolicy = JobManager.getInstance().getMonitorCancellationMonitoringPolicy(); if (monitorCancellationMonitoringPolicy != null && monitorCancellationMonitoringPolicy.enabled()) { CancelCheckMonitor pm = new CancelCheckMonitor(currentJob.getProgressMonitor(), monitorCancellationMonitoringPolicy); currentJob.setProgressMonitor(pm); result = currentJob.run(pm.willStart()); pm.hasStopped(); IStatus cancelStatus = checkCancel(currentJob, pm, monitorCancellationMonitoringPolicy); if (!cancelStatus.isOK()) { RuntimeLog.log(cancelStatus); } } else { result = currentJob.run(currentJob.getProgressMonitor()); } } catch (OperationCanceledException e) { result = Status.CANCEL_STATUS; } catch (Exception e) { result = handleException(currentJob, e); } catch (ThreadDeath e) { result = handleException(currentJob, e); throw e; } catch (Error e) { result = handleException(currentJob, e); } finally { Thread.interrupted(); if (result == null) result = handleException(currentJob, new NullPointerException()); pool.endJob(currentJob, result); currentJob = null; setPriority(Thread.NORM_PRIORITY); } } } catch (Throwable t) { RuntimeLog.log(new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "Unhandled error", t)); } finally { currentJob = null; pool.endWorker(this); } }

Target:
public void run() { setPriority(Thread.NORM_PRIORITY); try { while ((currentJob = pool.startJob(this)) != null) { IStatus result = Status.OK_STATUS; try { JobCancelabilityMonitor.Options jobCancelabilityMonitorOptions = JobManager.getInstance().getJobCancelabilityMonitorOptions(); if (jobCancelabilityMonitorOptions != null && jobCancelabilityMonitorOptions.enabled()) { result = runWithCancelabilityMonitoring(jobCancelabilityMonitorOptions); } else { result = currentJob.run(currentJob.getProgressMonitor()); } } catch (OperationCanceledException e) { result = Status.CANCEL_STATUS; } catch (Exception e) { result = handleException(currentJob, e); } catch (ThreadDeath e) { result = handleException(currentJob, e); throw e; } catch (Error e) { result = handleException(currentJob, e); } finally { Thread.interrupted(); if (result == null) result = handleException(currentJob, new NullPointerException()); pool.endJob(currentJob, result); currentJob = null; setPriority(Thread.NORM_PRIORITY); } } } catch (Throwable t) { RuntimeLog.log(new Status(IStatus.ERROR, JobManager.PI_JOBS, JobManager.PLUGIN_ERROR, "Unhandled error", t)); } finally { currentJob = null; pool.endWorker(this); } }
Source:
public int fetchUniformLocation (String name, boolean pedantic) { GL20 gl = Gdx.gl20; int location; if ((location = uniforms.get(name, -2)) == -2) { location = gl.glGetUniformLocation(program, name); if (location == -1 && pedantic) { if (isCompiled) throw new IllegalArgumentException("no uniform with name '" + name + "' in shader"); else throw new GdxRuntimeException("An attempted fetch uniform from uncompiled shader \n" + getLog()); } uniforms.put(name, location); } return location; }

Target:
public int fetchUniformLocation (String name, boolean pedantic) { GL20 gl = Gdx.gl20; int location; if ((location = uniforms.get(name, -2)) == -2) { location = gl.glGetUniformLocation(program, name); if (location == -1 && pedantic) { if (isCompiled) throw new IllegalArgumentException("no uniform with name '" + name + "' in shader"); throw new IllegalStateException("An attempted fetch uniform from uncompiled shader \n" + getLog()); } uniforms.put(name, location); } return location; }
Source:
public CqlResult( Result result, Set<SearchTerm> searchTerms, QueryRequest queryRequest, boolean normalize, FilterAdapter filterAdapter, ActionRegistry actionRegistry) { Metacard mc = result.getMetacard(); hasThumbnail = Optional.of(mc).map(Metacard::getThumbnail).map(thumb -> thumb.length > 0).orElse(false); isResourceLocal = Optional.of(mc) .map(m -> m.getAttribute("internal.local-resource")) .map(Attribute::getValue) .filter(Boolean.class::isInstance) .map(Boolean.class::cast) .orElse(false); distance = normalizeDistance(result, queryRequest.getQuery(), filterAdapter); relevance = result.getRelevanceScore(); if (normalize) { countMatches(searchTerms, mc); } actions = actionRegistry .list(result.getMetacard()) .stream() .map(cqlResult -> new CqlAction(cqlResult, cqlResult.getId())) .collect(Collectors.toList()); metacard = metacardToMap(result); }

Target:
public CqlResult( Result result, Set<SearchTerm> searchTerms, QueryRequest queryRequest, boolean normalize, FilterAdapter filterAdapter, ActionRegistry actionRegistry) { Metacard mc = result.getMetacard(); hasThumbnail = Optional.of(mc).map(Metacard::getThumbnail).map(thumb -> thumb.length > 0).orElse(false); isResourceLocal = Optional.of(mc) .map(m -> m.getAttribute("internal.local-resource")) .map(Attribute::getValue) .filter(Boolean.class::isInstance) .map(Boolean.class::cast) .orElse(false); distance = normalizeDistance(result, queryRequest.getQuery(), filterAdapter); relevance = result.getRelevanceScore(); if (normalize) { countMatches(searchTerms, mc); } actions = actionRegistry .list(result.getMetacard()) .stream() .map(action -> new DisplayableAction(action, action.getId())) .collect(Collectors.toList()); metacard = metacardToMap(result); }
Source:
protected void processIncoming() throws IOException, ClientConnectionException { ByteBuffer buffer = ByteBuffer.allocate(16384); int read = readBuffer(buffer); if (read <= 0) { return; } ByteBuffer messages = getCompleteMessages(buffer); if (messages.position() > 0){ messages.rewind(); emitOnMessageReceived(messages.array()); } if (buffer.position() > 0) { ByteBuffer acc = ByteBuffer.allocate(this.ibuff.limit() + buffer.limit()); acc.put(this.ibuff); acc.put(buffer); this.ibuff = acc; } else { this.ibuff = ByteBuffer.allocate(0); } }

Target:
protected abstract void processIncoming() throws IOException, ClientConnectionException; protected void processOutgoing() throws IOException, ClientConnectionException { final ByteBuffer buff = outbox.peekLast(); if (buff == null) { return; } writeBuffer(buff); if (!buff.hasRemaining()) { outbox.removeLast(); } updateInterestedOps(); }
Source:
public static void install() throws Exception { Field fieldStatusHandler = StatusManager.class.getDeclaredField("statusHandler"); fieldStatusHandler.setAccessible(true); fieldStatusHandler.set(StatusManager.getManager(), new TestStatusHandler()); }

Target:
public static void install() throws Exception { if (isInstalled) { return; } Field fieldStatusHandler = StatusManager.class.getDeclaredField("statusHandler"); fieldStatusHandler.setAccessible(true); StatusManager statusManager = StatusManager.getManager(); originalInstance = fieldStatusHandler.get(statusManager); fieldStatusHandler.set(statusManager, new TestStatusHandler()); fieldStatusHandler.setAccessible(false); isInstalled = true; }
Source:
private static Map<String, String> dataMapToQueryParams(DataMap dataMap) { final Map<String, String> result = encodeDataMapParameters(dataMap); for (final String parameterName : RestConstants.PROJECTION_PARAMETERS) { if (dataMap.containsKey(parameterName)) { try { result.put(parameterName, dataMap.getString(parameterName)); } catch (ClassCastException exception) { result.put(parameterName, URIMaskUtil.encodeMaskForURI(dataMap.getDataMap(parameterName))); } } } return result; }

Target:
private static Map<String, String> dataMapToQueryParams(DataMap dataMap) { final Map<String, String> result = encodeDataMapParameters(dataMap); for (final String parameterName : RestConstants.PROJECTION_PARAMETERS) { if (dataMap.containsKey(parameterName)) { Object projectionParameters = dataMap.get(parameterName); if (projectionParameters instanceof String) { result.put(parameterName, (String) projectionParameters); } else if (projectionParameters instanceof DataMap) { result.put(parameterName, URIMaskUtil.encodeMaskForURI((DataMap) projectionParameters)); } else { throw new IllegalArgumentException("Invalid projection field data type"); } } } return result; }
Source:
private List<AssetRecord> determineWritingChannels(final WireRecord record) { requireNonNull(record, message.wireRecordsNonNull()); final List<AssetRecord> assetRecordsToWriteChannels = CollectionUtil.newArrayList(); final Map<Long, Channel> channels = this.assetConfiguration.getAssetChannels(); for (final Entry<Long, Channel> channelEntry : channels.entrySet()) { final Channel channel = channelEntry.getValue(); final String channelName = channel.getName(); final ChannelType channelType = channel.getType(); if (channelType != WRITE && channelType != READ_WRITE) { continue; } Map<String, TypedValue<?>> wireRecordProperties = record.getProperties(); if (wireRecordProperties.containsKey(channelName)) { final TypedValue<?> value = wireRecordProperties.get(channelName); if (channel.getValueType() == value.getType()) { assetRecordsToWriteChannels.add(prepareAssetRecord(channel, value)); } } } return assetRecordsToWriteChannels; }

Target:
private List<AssetRecord> determineWritingChannels(final WireRecord record) { requireNonNull(record, message.wireRecordNonNull()); final List<AssetRecord> assetRecordsToWriteChannels = CollectionUtil.newArrayList(); final Map<Long, Channel> channels = this.assetConfiguration.getAssetChannels(); for (final Entry<Long, Channel> channelEntry : channels.entrySet()) { final Channel channel = channelEntry.getValue(); final String channelName = channel.getName(); final ChannelType channelType = channel.getType(); if (channelType != WRITE && channelType != READ_WRITE) { continue; } Map<String, TypedValue<?>> wireRecordProperties = record.getProperties(); if (wireRecordProperties.containsKey(channelName)) { final TypedValue<?> value = wireRecordProperties.get(channelName); if (channel.getValueType() == value.getType()) { assetRecordsToWriteChannels.add(prepareAssetRecord(channel, value)); } } } return assetRecordsToWriteChannels; }
Source:
protected boolean takeCharge(@Nonnull Location l) { if (isChargeable()) { if (getCharge(l) < getEnergyConsumption()) { return false; } removeCharge(l, getEnergyConsumption()); } return true; }

Target:
protected boolean takeCharge(@Nonnull Location l) { Validate.notNull(l, "Can't attempt to take charge from a null location!"); if (isChargeable()) { if (getCharge(l) < getEnergyConsumption()) { return false; } removeCharge(l, getEnergyConsumption()); } return true; }