auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public BookPage[] getAllPages() { List<BookPage> pages = new ArrayList<>(); pages.addAll((Collection<BookPage>) Arrays.stream(getEntries()).flatMap(entry -> Arrays.stream(entry.getPages())).collect(Collectors.toList())); for (BookCategory subcategory : getSubcategories()) { pages.addAll(Arrays.asList(subcategory.getAllPages())); } return pages.toArray(new BookPage[pages.size()]); }

Target:
public BookPage[] getAllPages() { List<BookPage> pages = Arrays.stream(getEntries()) .flatMap(entry -> Arrays.stream(entry.getPages())) .collect(Collectors.toList()); for (BookCategory subcategory : getSubcategories()) { pages.addAll(Arrays.asList(subcategory.getAllPages())); } return pages.toArray(new BookPage[pages.size()]); }
Source:
private List<String> collectAdminRolesIfAny() throws DotDataException { final List <Role> availableRoles = new ArrayList<>(2); final Role admin = roleAPI.loadRoleByKey(Role.ADMINISTRATOR); if(null != admin){ availableRoles.add(admin); } final Role cmsAdmin = roleAPI.loadCMSAdminRole(); if(null != cmsAdmin){ availableRoles.add(cmsAdmin); } return availableRoles.stream().map(Role::getId).collect(CollectionsUtils.toImmutableList()); }

Target:
private List<String> collectAdminRolesIfAny() throws DotDataException { final List <Role> availableRoles = Arrays.asList( roleAPI.loadRoleByKey(Role.ADMINISTRATOR), roleAPI.loadCMSAdminRole() ); return availableRoles.stream().filter(Objects::nonNull).map(Role::getId).collect(CollectionsUtils.toImmutableList()); }
Source:
public boolean delete(TileObject tile) throws StorageException { Utils.updateLogId("DELETE-" + tile.toString()); File file = fileManager.getFile(tile); Utils.debug(LOGGER, "Tile mapped to file '%s'.", file); initDatabaseFileIfNeeded(file, tile.getLayerName(), tile.getBlobFormat()); return connectionManager.doWork(file, false, connection -> { MBTilesFile mbtiles = GeoToolsMbtilesUtils.getMBTilesFile(connection, file); MBTilesTile gtTile = new MBTilesTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); try { byte[] olData = mbtiles.loadTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]).getData(); if (olData != null) { mbtiles.saveTile(gtTile); listeners.sendTileDeleted(tile); if (useCreateTime) { deleteTileCreateTime(connection, tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); } Utils.debug(LOGGER, "Tile deleted from file '%s'.", file); return true; } } catch (Exception exception) { throw Utils.exception(exception, "Error deleting tile '%s' from MBTiles file '%s'.", tile, file); } Utils.debug(LOGGER, "Tile not found on file '%s'.", file); return false; }); }

Target:
public boolean delete(TileObject tile) throws StorageException { File file = fileManager.getFile(tile); if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Tile '%s' mapped to file '%s'.", tile, file)); } if (!file.exists()) { if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Containing file '%s' for tile '%s' doesn't exists.", file, tile)); } return false; } return connectionManager.doWork(file, false, connection -> { MBTilesFile mbtiles = GeoToolsMbtilesUtils.getMBTilesFile(connection, file); MBTilesTile gtTile = new MBTilesTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); try { byte[] olData = mbtiles.loadTile(tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]).getData(); if (olData != null) { mbtiles.saveTile(gtTile); listeners.sendTileDeleted(tile); if (useCreateTime) { deleteTileCreateTime(connection, tile.getXYZ()[2], tile.getXYZ()[0], tile.getXYZ()[1]); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Tile '%s' deleted from file '%s'.", tile, file)); } return true; } } catch (Exception exception) { throw Utils.exception(exception, "Error deleting tile '%s' from MBTiles file '%s'.", tile, file); } if (LOGGER.isDebugEnabled()) { LOGGER.debug(String.format("Tile '%s' not found on file '%s'.", tile, file)); } return false; }); }
Source:
private static JdbcStatementBuilder<RowData> createRowDataJdbcStatementBuilder(JdbcDialect dialect, LogicalType[] types) { return (st, record) -> dialect.getRowConverter(RowType.of(types)).toExternal(record, st); }

Target:
private static JdbcStatementBuilder<RowData> createRowDataJdbcStatementBuilder(JdbcDialect dialect, LogicalType[] types) { final JdbcRowConverter converter = dialect.getRowConverter(RowType.of(types)); return (st, record) -> converter.toExternal(record, st); }
Source:
public CreateKeyOptions setEnabled(Boolean enabled) { super.setEnabled(enabled); return this; }

Target:
public CreateEcKeyOptions setEnabled(Boolean enabled) { super.setEnabled(enabled); return this; }
Source:
private void puppetDelete(String vdc, String nodeName, String token) throws NodeExecutionException { puppetLog.info("deleting node " + nodeName + " from puppet master"); String deleteUrl = null; try { deleteUrl = openStackRegion.getPuppetWrapperEndPoint(token) + "v2/node/" + nodeName; } catch (OpenStackException e2) { puppetLog.warn(e2.getMessage()); } if (deleteUrl != null) { Map<String, String> headers = new HashMap<String, String>(); headers.put(HttpsClient.HEADER_AUTH, token); headers.put(HttpsClient.HEADER_TENNANT, vdc); try { int statusCode; statusCode = httpsClient.doHttpsDelete(deleteUrl, "", headers); if (statusCode == 200 || statusCode == 404) { log.info("Node deleted"); } else { String msg = format("[puppet delete node] response code was: {0}", statusCode); puppetLog.info(msg); throw new NodeExecutionException(msg); } puppetLog.info("Node succesfully deleted from pupper master"); } catch (IOException e) { puppetLog.info(e.getMessage()); throw new NodeExecutionException(e); } catch (IllegalStateException e1) { puppetLog.info(e1.getMessage()); throw new NodeExecutionException(e1); } catch (KeyManagementException | NoSuchAlgorithmException e2) { puppetLog.info(e2.getMessage()); throw new NodeExecutionException(e2); } } }

Target:
private void puppetDelete(String vdc, String nodeName, String token) throws NodeExecutionException { puppetLog.info("deleting node " + nodeName + " from puppet master"); String deleteUrl = null; try { deleteUrl = openStackRegion.getPuppetWrapperEndPoint(token) + "v2/node/" + nodeName; } catch (OpenStackException e2) { puppetLog.warn(e2.getMessage()); } if (deleteUrl != null) { Map<String, String> headers = new HashMap<String, String>(); headers.put(HttpsClient.HEADER_AUTH, token); headers.put(HttpsClient.HEADER_TENNANT, vdc); try { int statusCode; statusCode = httpsClient.doHttps(HttpMethod.DELETE, deleteUrl, "", headers); if (statusCode == 200 || statusCode == 404) { log.info("Node deleted"); } else { String msg = format("[puppet delete node] response code was: {0}", statusCode); puppetLog.info(msg); throw new NodeExecutionException(msg); } puppetLog.info("Node succesfully deleted from pupper master"); } catch (IOException e) { puppetLog.info(e.getMessage()); throw new NodeExecutionException(e); } catch (IllegalStateException e1) { puppetLog.info(e1.getMessage()); throw new NodeExecutionException(e1); } catch (KeyManagementException | NoSuchAlgorithmException e2) { puppetLog.info(e2.getMessage()); throw new NodeExecutionException(e2); } } }
Source:
public void setTimeZone(String zoneId) { this.timeZone = zoneId.equalsIgnoreCase("system") ? TimeZone.getDefault() : TimeZone.getTimeZone(zoneId); }

Target:
public void setTimeZone(String zoneId) { this.timeZone = nullToEmpty(zoneId).equalsIgnoreCase("system") ? TimeZone.getDefault() : TimeZone.getTimeZone(zoneId); }
Source:
private <T> T resolveArgument(Message<I> message) { logger.debug("Resolving input argument from message: " + message); T result = this.shouldConvertFromMessage(message) ? (T) this.messageConverter.fromMessage(message, this.inputClass) : (T) message; if (result == message && !this.inputClass.isAssignableFrom(message.getClass())) { result = (T) message.getPayload(); } return result; }

Target:
private <T> T resolveArgument(Message<I> message) { if (logger.isDebugEnabled()) { logger.debug("Resolving input argument from message: " + message); } T result = this.shouldConvertFromMessage(message) ? (T) this.messageConverter.fromMessage(message, this.inputClass) : (T) message; return result; }
Source:
public void testOperatorSerialization() { Kryo kryo = new Kryo(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); Output output = new Output(baos); kryo.writeObject(output, this.operator); output.close(); Input input = new Input(baos.toByteArray()); JsonFormatter jsonFormatter = kryo.readObject(input, JsonFormatter.class); Assert.assertNotNull("Json Formatter not null", jsonFormatter); }

Target:
public void testOperatorSerialization() { Assert.assertNotNull("Serialization", KryoCloneUtils.cloneObject(this.operator)); }
Source:
private boolean shouldLoad(InvocationContext ctx, AbstractDataWriteCommand command, DistributionInfo info) { if (!command.hasAnyFlag(FlagBitSets.SKIP_REMOTE_LOOKUP)) { VisitableCommand.LoadType loadType = command.loadType(); switch (loadType) { case DONT_LOAD: return false; case OWNER: return info.isPrimary() || info.isWriteOwner() && !ctx.isOriginLocal(); case PRIMARY: return info.isPrimary(); default: throw new IllegalStateException(); } } else { return false; } }

Target:
private boolean shouldLoad(InvocationContext ctx, AbstractDataWriteCommand command, DistributionInfo info) { if (!command.hasAnyFlag(FlagBitSets.SKIP_REMOTE_LOOKUP)) { VisitableCommand.LoadType loadType = command.loadType(); switch (loadType) { case DONT_LOAD: return false; case OWNER: return info.isPrimary() || (info.isWriteOwner() && !ctx.isOriginLocal()); case PRIMARY: return info.isPrimary(); default: throw new IllegalStateException(); } } else { return false; } }
Source:
private void start() { if (getSelectedItems() == null) { return; } ArrayList<VdcActionParametersBase> downList = new ArrayList<VdcActionParametersBase>(); ArrayList<String> volumesForForceStartWarning = new ArrayList<>(); for (Object item : getSelectedItems()) { GlusterVolumeEntity volume = (GlusterVolumeEntity) item; VolumeStatus status = GlusterVolumeUtils.getVolumeStatus(volume); if (status == VolumeStatus.DOWN) { downList.add(new GlusterVolumeActionParameters(volume.getId(), false)); } else if (status == VolumeStatus.ALL_BRICKS_DOWN || status == VolumeStatus.SOME_BRICKS_DOWN) { volumesForForceStartWarning.add(volume.getName()); } } if (!downList.isEmpty()) { onStartVolume(downList); } if (!volumesForForceStartWarning.isEmpty()) { ConfirmationModel cModel = new ConfirmationModel(); cModel.setHelpTag(HelpTag.volume_start); cModel.setHashName("volume_start"); setConfirmWindow(cModel); cModel.setMessage(ConstantsManager.getInstance().getConstants().startForceVolumeMessage()); cModel.setTitle(ConstantsManager.getInstance().getConstants().confirmStartVolume()); cModel.setForceLabel(ConstantsManager.getInstance().getConstants().startForceLabel()); cModel.setItems(volumesForForceStartWarning); cModel.getForce().setIsAvailable(true); cModel.getCommands().add(UICommand.createDefaultOkUiCommand("startVolumeWithForceOption", this)); cModel.getCommands().add(UICommand.createCancelUiCommand("closeConfirmationWindow", this)); } }

Target:
private void start() { if (getSelectedItems() == null) { return; } ArrayList<VdcActionParametersBase> list = new ArrayList<VdcActionParametersBase>(); ArrayList<String> volumesForForceStartWarning = new ArrayList<>(); for (Object item : getSelectedItems()) { GlusterVolumeEntity volume = (GlusterVolumeEntity) item; VolumeStatus status = GlusterVolumeUtils.getVolumeStatus(volume); } for (Object item : getSelectedItems()) { GlusterVolumeEntity volume = (GlusterVolumeEntity) item; VolumeStatus status = GlusterVolumeUtils.getVolumeStatus(volume); if (status == VolumeStatus.ALL_BRICKS_DOWN || status == VolumeStatus.SOME_BRICKS_DOWN) { volumesForForceStartWarning.add(volume.getName()); } } if (!volumesForForceStartWarning.isEmpty()) { ConfirmationModel cModel = new ConfirmationModel(); cModel.setHelpTag(HelpTag.volume_start); cModel.setHashName("volume_start"); setConfirmWindow(cModel); cModel.setMessage(ConstantsManager.getInstance().getConstants().startForceVolumeMessage()); cModel.setTitle(ConstantsManager.getInstance().getConstants().confirmStartVolume()); cModel.setForceLabel(ConstantsManager.getInstance().getConstants().startForceLabel()); cModel.setItems(volumesForForceStartWarning); cModel.getForce().setIsAvailable(true); cModel.getCommands().add(UICommand.createDefaultOkUiCommand("startVolumeWithForceOption", this)); cModel.getCommands().add(UICommand.createCancelUiCommand("closeConfirmationWindow", this)); } else { prepareForStartVolume(); } }
Source:
public Response welcomeUser(OsuApiUser apiUser, long inactiveTime) { String username = apiUser.getUserName(); String greeting = ""; if (inactiveTime < 4 * 60 * 1000) { greeting = welcomeUserShortShuffler.get( "Was soll das hier sein, das Kuckuckspiel?", "Das waren nicht mal fünf Minuten...", "Heute hat " + username + "an seinem Verschwindungszauber geübt." ); } else if (inactiveTime < 4l * 24 * 60 * 60 * 1000) { greeting = welcomeUserShuffler.get( "Wieder da? Ich bin nur hier weil ich nix zu tun hab! Nichts weiter!", "H-hey...", "♫ Zuhause, zuhause, lalalalala ♫ .... Was?", "Stell dir vor! Ich habe endlich deine Bestimmung gefunden. Sie gehört allerdings nicht zu der Art von Dingen, die ich gerne teile!", "Du hast doch nicht etwa mit anderen Chatbots geredet, oder?", "Huch? Was machst du denn hier!?", "Mach was dummes " + username + ", damit ich dich dafür bestrafen kann." ); } else { greeting = welcomeUserLongShuffler.get( "Wo warst du " + username + "!? N-nicht das ich dich vermisst hätte oder so...", "Wie war dein Urlaub " + username + "?", "Ugh! Weißt du wie lang " + inactiveTime + " Millisekunden ist!?" ); } if (inactiveTime > 4 * 60 * 60 * 1000) { recentRecommendations = 0; recentHugs = 0; } setChanged(true); return new Message(greeting); }

Target:
public Response welcomeUser(OsuApiUser apiUser, long inactiveTime) { String username = apiUser.getUserName(); String greeting = ""; if (inactiveTime < 4 * 60 * 1000) { greeting = welcomeUserShortShuffler.get( "Das waren nicht mal fünf Minuten...", username + " hat heute seinen Verschwindibuszauber perfektioniert." ); } else if (inactiveTime < 4l * 24 * 60 * 60 * 1000) { greeting = welcomeUserShuffler.get( "Wieder da? Ich bin nur hier weil ich nix zu tun hab! Nichts weiter!", "H-hey...", "♫ Home again, home again, jiggety-jig ♫ .... Was?", "Stell dir vor! Ich habe endlich deine Bestimmung gefunden. Sie gehört allerdings nicht zu der Art von Dingen, die ich gerne teile!", "Du hast doch nicht etwa mit anderen Chatbots geredet, oder?", "Huch? Was machst du denn hier!?", "Mach was dummes, " + username + ", damit ich dich dafür bestrafen kann." ); } else { greeting = welcomeUserLongShuffler.get( "Wo warst du, " + username + "!? N-nicht das ich dich vermisst hätte oder so...", "Wie war dein Urlaub, " + username + "?", "Ugh! Weißt du, wie lang " + inactiveTime + " Millisekunden sind!?" ); } if (inactiveTime > 4 * 60 * 60 * 1000) { recentRecommendations = 0; recentHugs = 0; } setChanged(true); return new Message(greeting); }
Source:
public ListBoxModel doFillJobCredentialIdItems(@QueryParameter String siteName) { JiraSite site = getSiteByName(siteName); URL url = null != site ? site.getUrl() : null; if(null == url) { return new StandardUsernameListBoxModel() .includeEmptyValue(); } return new StandardUsernameListBoxModel() .includeEmptyValue() .includeMatchingAs(ACL.SYSTEM, Jenkins.getInstance(), StandardUsernamePasswordCredentials.class, URIRequirementBuilder.fromUri(url.toString()).build(), CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class)); }

Target:
public ListBoxModel doFillJobCredentialIdItems(@QueryParameter String siteName) { JiraSite site = JiraSite.get(siteName); if(site == null) { return new StandardUsernameListBoxModel() .includeEmptyValue(); } URL url = site.getUrl(); return new StandardUsernameListBoxModel() .includeEmptyValue() .includeMatchingAs(ACL.SYSTEM, Jenkins.getInstance(), StandardUsernamePasswordCredentials.class, URIRequirementBuilder.fromUri(url.toString()).build(), CredentialsMatchers.instanceOf(StandardUsernamePasswordCredentials.class)); }
Source:
public boolean accepts(Class<?> extensionType) { if (GetHandle.class.isAssignableFrom(extensionType) || Transactional.class.isAssignableFrom(extensionType)) { return true; } MemberResolver mr = new MemberResolver(typeResolver); ResolvedType extension_type = typeResolver.resolve(extensionType); ResolvedTypeWithMembers d = mr.resolve(extension_type, null, null); for (ResolvedMethod method : d.getMemberMethods()) { Method rawMethod = method.getRawMember(); if (rawMethod.isAnnotationPresent(SqlQuery.class) || rawMethod.isAnnotationPresent(SqlUpdate.class) || rawMethod.isAnnotationPresent(SqlBatch.class) || rawMethod.isAnnotationPresent(SqlCall.class) || rawMethod.isAnnotationPresent(CreateSqlObject.class) || rawMethod.isAnnotationPresent(Transaction.class)) { return true; } } return false; }

Target:
public boolean accepts(Class<?> extensionType) { if (GetHandle.class.isAssignableFrom(extensionType) || Transactional.class.isAssignableFrom(extensionType)) { return true; } MemberResolver mr = new MemberResolver(typeResolver); ResolvedType extension_type = typeResolver.resolve(extensionType); ResolvedTypeWithMembers d = mr.resolve(extension_type, null, null); return Stream.of(d.getMemberMethods()) .flatMap(m -> Stream.of(m.getRawMember().getAnnotations())) .anyMatch(a -> a.annotationType().isAnnotationPresent(SqlMethodAnnotation.class)); }
Source:
private void validateRequiredInputs(Map<String, Schema> inputSchemas, FailureCollector collector) { for (String requiredInput : conf.getInputs()) { if (!inputSchemas.isEmpty() && !inputSchemas.containsKey(requiredInput)) { collector.addFailure(String.format("Provided input '%s' must be an input stage name.", requiredInput), null) .withConfigElement(JoinerConfig.REQUIRED_INPUTS, requiredInput); } } }

Target:
private void validateRequiredInputs(Map<String, Schema> inputSchemas, FailureCollector collector) { for (String requiredInput : conf.getInputs()) { if (conf.inputSchemasAvailable(inputSchemas) && !inputSchemas.containsKey(requiredInput)) { collector.addFailure(String.format("Provided input '%s' must be an input stage name.", requiredInput), null) .withConfigElement(JoinerConfig.REQUIRED_INPUTS, requiredInput); } } }
Source:
private boolean inLandscapeFormEntry(Activity a) { return (a instanceof FormEntryActivity) && getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; }

Target:
private static boolean inLandscapeFormEntry(Activity a) { return (a instanceof FormEntryActivity) && a.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { TeeHttpServletResponse resp = new TeeHttpServletResponse( (HttpServletResponse) response); chain.doFilter(request, resp); if (resp.getStatus() >= 200 && resp.getStatus() < 300) { eventSinkProvider.get().sendEvents(); } else { if (log.isDebugEnabled()) { log.debug("Request failed, skipping event sending, status=" + resp.getStatus()); } } }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { TeeHttpServletResponse resp = new TeeHttpServletResponse( (HttpServletResponse) response); chain.doFilter(request, resp); Status status = Status.fromStatusCode(resp.getStatus()); if (status.getFamily() == Status.Family.SUCCESSFUL) { eventSinkProvider.get().sendEvents(); } else { log.debug("Request failed, skipping event sending, status={}", status); } }
Source:
private WindowDefinition getWindowDefinition(Optional<Window> maybeWindow, ExpressionAnalysisContext context) { if (!maybeWindow.isPresent()) { return null; } var overWindow = maybeWindow.get(); final Window window; if (overWindow.windowRef() != null) { var refWindow = resolveWindowRef(overWindow.windowRef(), context.windows()); window = overWindow.merge(refWindow); } else { window = overWindow; } List<Symbol> partitionSymbols = new ArrayList<>(window.getPartitions().size()); for (Expression partition : window.getPartitions()) { Symbol symbol = convert(partition, context); SemanticSortValidator.validate(symbol, "PARTITION BY"); partitionSymbols.add(symbol); } OrderBy orderBy = OrderyByAnalyzer.analyzeSortItems(window.getOrderBy(), sortKey -> { Symbol symbol = convert(sortKey, context); SemanticSortValidator.validate(symbol); return symbol; }); WindowFrameDefinition windowFrameDefinition = WindowDefinition.RANGE_UNBOUNDED_PRECEDING_CURRENT_ROW; if (window.getWindowFrame().isPresent()) { WindowFrame windowFrame = window.getWindowFrame().get(); validateFrame(windowFrame); FrameBound start = windowFrame.getStart(); FrameBoundDefinition startBound = convertToAnalyzedFrameBound(context, start); FrameBoundDefinition endBound = windowFrame.getEnd() .map(end -> convertToAnalyzedFrameBound(context, end)) .orElse(new FrameBoundDefinition(FrameBound.Type.CURRENT_ROW)); windowFrameDefinition = new WindowFrameDefinition(windowFrame.getType(), startBound, endBound); } return new WindowDefinition(partitionSymbols, orderBy, windowFrameDefinition); }

Target:
private WindowDefinition getWindowDefinition(Optional<Window> maybeWindow, ExpressionAnalysisContext context) { if (!maybeWindow.isPresent()) { return null; } var unresolvedWindow = maybeWindow.get(); final Window window; if (unresolvedWindow.windowRef() != null) { var refWindow = resolveWindowRef(unresolvedWindow.windowRef(), context.windows()); window = unresolvedWindow.merge(refWindow); } else { window = unresolvedWindow; } List<Symbol> partitionSymbols = new ArrayList<>(window.getPartitions().size()); for (Expression partition : window.getPartitions()) { Symbol symbol = convert(partition, context); SemanticSortValidator.validate(symbol, "PARTITION BY"); partitionSymbols.add(symbol); } OrderBy orderBy = OrderyByAnalyzer.analyzeSortItems(window.getOrderBy(), sortKey -> { Symbol symbol = convert(sortKey, context); SemanticSortValidator.validate(symbol); return symbol; }); WindowFrameDefinition windowFrameDefinition = WindowDefinition.RANGE_UNBOUNDED_PRECEDING_CURRENT_ROW; if (window.getWindowFrame().isPresent()) { WindowFrame windowFrame = window.getWindowFrame().get(); validateFrame(windowFrame); FrameBound start = windowFrame.getStart(); FrameBoundDefinition startBound = convertToAnalyzedFrameBound(context, start); FrameBoundDefinition endBound = windowFrame.getEnd() .map(end -> convertToAnalyzedFrameBound(context, end)) .orElse(new FrameBoundDefinition(FrameBound.Type.CURRENT_ROW)); windowFrameDefinition = new WindowFrameDefinition(windowFrame.getType(), startBound, endBound); } return new WindowDefinition(partitionSymbols, orderBy, windowFrameDefinition); }
Source:
public void enable() { ServiceDiscoveryManager disco = ServiceDiscoveryManager.getInstanceFor(connection()); if (disco.includesFeature(NAMESPACE)) { return; } disco.addFeature(NAMESPACE); connection().addPacketInterceptor(stanzaListener, OUTGOING_FILTER); }

Target:
public synchronized void enable() { ServiceDiscoveryManager.getInstanceFor(connection()).addFeature(NAMESPACE); StanzaFilter filter = new AndFilter(OUTGOING_FILTER, new NotFilter(OUTGOING_FILTER)); connection().addPacketInterceptor(stanzaListener, filter); }
Source:
public final void wrapsIndexOutOfBoundsExceptionFromSubList() throws Exception { final int frmidx = 2; final int toidx = 5; final Exception cause = new IndexOutOfBoundsException(); Mockito.doThrow(cause).when(this.origin).subList(frmidx, toidx); this.thrown.expect(IllegalArgumentException.class); this.thrown.expectMessage(MSG); this.thrown.expectCause(Matchers.is(cause)); this.list.subList(frmidx, toidx); }

Target:
public final void wrapsIndexOutOfBoundsExceptionFromSubList() throws Exception { final int from = 2; final int toidx = 5; final Exception cause = new IndexOutOfBoundsException(); Mockito.doThrow(cause).when(this.origin).subList(from, toidx); this.thrown.expect(IndexOutOfBoundsException.class); this.thrown.expectMessage(MSG); this.thrown.expectCause(Matchers.is(cause)); this.list.subList(from, toidx); }
Source:
protected void moveOrCopyAllImageGroups(Guid containerID, Iterable<DiskImage> disks) { for (DiskImage disk : disks) { ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForDisk(disk, containerID)); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed to copy disk!"); } getReturnValue().getVdsmTaskIdList().addAll(vdcRetValue.getInternalVdsmTaskIdList()); } }

Target:
protected void moveOrCopyAllImageGroups(Guid containerID, Iterable<DiskImage> disks) { for (DiskImage disk : disks) { ActionReturnValue vdcRetValue = runInternalActionWithTasksContext( ActionType.CopyImageGroup, buildMoveOrCopyImageGroupParametersForDisk(disk, containerID)); if (!vdcRetValue.getSucceeded()) { throw new EngineException(vdcRetValue.getFault().getError(), "Failed to copy disk!"); } getTaskIdList().addAll(vdcRetValue.getVdsmTaskIdList()); } }
Source:
void peekBatchMessagesFromSequence() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); int maxMessages = 2; int fromSequenceNumber = 1; StepVerifier.create(sender.send(message) .then(sender.send(message)) .thenMany(receiver.peekBatch(maxMessages, fromSequenceNumber))) .expectNextCount(maxMessages) .verifyComplete(); }

Target:
void peekBatchMessagesFromSequence() { final String messageId = UUID.randomUUID().toString(); final String contents = "Some-contents"; final ServiceBusMessage message = TestUtils.getServiceBusMessage(contents, messageId, 0); int maxMessages = 2; int fromSequenceNumber = 1; StepVerifier.create(Mono.when(sender.send(message), sender.send(message)) .thenMany(receiver.peekBatch(maxMessages, fromSequenceNumber))) .expectNextCount(maxMessages) .verifyComplete(); }
Source:
private void initializeEnvironment(String workspaceId, String envName, Environment env, String networkId, MessageConsumer<MachineLogMessage> messageConsumer) throws ServerException, ConflictException { ComposeEnvironmentImpl composeEnvironment = environmentParser.parse(env); for (Map.Entry<String, ComposeServiceImpl> entry : composeEnvironment.getServices().entrySet()) { String machineName = entry.getKey(); ComposeServiceImpl composeService = entry.getValue(); List<String> agents = env.getMachines().get(machineName).getAgents(); try { agentConfigApplier.modify(composeService, agents); } catch (AgentException e) { throw new MachineException("Can't apply agent config", e); } } normalizeEnvironment(composeEnvironment); List<String> servicesOrder = startStrategy.order(composeEnvironment); EnvironmentHolder environmentHolder = new EnvironmentHolder(servicesOrder, composeEnvironment, messageConsumer, EnvStatus.STARTING, envName, networkId); try (StripedLocks.WriteLock lock = stripedLocks.acquireWriteLock(workspaceId)) { if (environments.putIfAbsent(workspaceId, environmentHolder) != null) { throw new ConflictException(format("Environment of workspace '%s' already exists", workspaceId)); } } }

Target:
private void initializeEnvironment(String workspaceId, String envName, Environment env, String networkId, MessageConsumer<MachineLogMessage> messageConsumer) throws ServerException, ConflictException { ComposeEnvironmentImpl composeEnvironment = environmentParser.parse(env); applyAgents(env, composeEnvironment); normalizeEnvironment(composeEnvironment); List<String> servicesOrder = startStrategy.order(composeEnvironment); EnvironmentHolder environmentHolder = new EnvironmentHolder(servicesOrder, composeEnvironment, messageConsumer, EnvStatus.STARTING, envName, networkId); try (StripedLocks.WriteLock lock = stripedLocks.acquireWriteLock(workspaceId)) { if (environments.putIfAbsent(workspaceId, environmentHolder) != null) { throw new ConflictException(format("Environment of workspace '%s' already exists", workspaceId)); } } }
Source:
private List<Blob> getPreviewBlobs(DocumentBlobHolder bh, boolean blobPostProcessing) { DocumentModel doc = bh.getDocument(); String xpath = bh.getXpath(); HtmlPreviewAdapter preview; try { if (isBlobTarget() && !isBlobHolder(doc, xpath)) { preview = PreviewHelper.getBlobPreviewAdapter(doc); return preview.getFilePreviewBlobs(xpath, blobPostProcessing); } preview = doc.getAdapter(HtmlPreviewAdapter.class); if (preview == null) { return null; } return preview.getFilePreviewBlobs(blobPostProcessing); } catch (PreviewException e) { throw new WebResourceNotFoundException("Preview not available"); } }

Target:
private List<Blob> getPreviewBlobs(DocumentBlobHolder bh, boolean blobPostProcessing) { DocumentModel doc = bh.getDocument(); String xpath = bh.getXpath(); HtmlPreviewAdapter preview; try { if (isBlobTarget() && !isBlobHolder(doc, xpath)) { preview = PreviewHelper.getBlobPreviewAdapter(doc); return preview.getFilePreviewBlobs(xpath, blobPostProcessing); } preview = doc.getAdapter(HtmlPreviewAdapter.class); if (preview == null) { return null; } return preview.getFilePreviewBlobs(blobPostProcessing); } catch (PreviewException e) { throw new WebResourceNotFoundException("Preview not available", e); } }
Source:
public static IntegrationTestInitService getInstance() { if (service == null) { service = new IntegrationTestInitService(); } return service; }

Target:
public static IntegrationTestInitService getInstance() { return service; }
Source:
public void updateConfigSetLastUpdateDownloadStatus_getValueByReflection_correctValue() { UpdateConfig updateConfig = new UpdateConfig(); try { Class<?> updateConfigClass = updateConfig.getClass(); Field lastUpdateDownloadStatusField = updateConfigClass.getDeclaredField("lastUpdateDownloadStatus"); lastUpdateDownloadStatusField.setAccessible(true); updateConfig.setLastUpdateDownloadStatus(true); assertTrue((boolean) lastUpdateDownloadStatusField.get(updateConfig)); updateConfig.setLastUpdateDownloadStatus(false); assertFalse((boolean) lastUpdateDownloadStatusField.get(updateConfig)); } catch (NoSuchFieldException e) { fail("No field lastUpdateDownloadStatus."); } catch (IllegalAccessException e) { fail("Can't access field lastUpdateDownloadStatus"); } }

Target:
public void updateConfigSetLastUpdateDownloadStatus_getValueByReflection_correctValue() throws NoSuchFieldException, IllegalAccessException { UpdateConfig updateConfig = new UpdateConfig(); Class<?> updateConfigClass = updateConfig.getClass(); Field isLastAppUpdateDownloadSuccessfulField = updateConfigClass.getDeclaredField("isLastAppUpdateDownloadSuccessful"); isLastAppUpdateDownloadSuccessfulField.setAccessible(true); updateConfig.setLastAppUpdateDownloadSuccessful(true); assertTrue((boolean) isLastAppUpdateDownloadSuccessfulField.get(updateConfig)); updateConfig.setLastAppUpdateDownloadSuccessful(false); assertFalse((boolean) isLastAppUpdateDownloadSuccessfulField.get(updateConfig)); }
Source:
public OkPacket(Buffer buffer, long clientCapabilities) { buffer.skipByte(); affectedRows = buffer.getLengthEncodedNumeric(); insertId = buffer.getLengthEncodedNumeric(); if ((clientCapabilities & MariaDbServerCapabilities.CLIENT_PROTOCOL_41) !=0) { statusFlags = buffer.readShort(); warnings = buffer.readShort(); } else if ((clientCapabilities & MariaDbServerCapabilities.TRANSACTIONS) !=0) { statusFlags = buffer.readShort(); warnings = 0; } else { statusFlags = 0; warnings = 0; } String message = ""; String sessionStateMessage = ""; if (buffer.remaining() > 0) { if ((clientCapabilities & MariaDbServerCapabilities.CLIENT_SESSION_TRACK) !=0) { message = buffer.readStringLengthEncoded(StandardCharsets.UTF_8); if ((statusFlags & MariaDbServerCapabilities.SERVER_SESSION_STATE_CHANGED) !=0) { sessionStateMessage = buffer.readStringLengthEncoded(StandardCharsets.UTF_8); } } else { message = buffer.readStringNullEnd(StandardCharsets.UTF_8); } } info = message; sessionStateInfo = sessionStateMessage; }

Target:
public OkPacket(Buffer buffer, long clientCapabilities) { buffer.skipByte(); affectedRows = buffer.getLengthEncodedNumeric(); insertId = buffer.getLengthEncodedNumeric(); statusFlags = buffer.readShort(); warnings = buffer.readShort(); String message = ""; String sessionStateMessage = ""; if (buffer.remaining() > 0) { if ((clientCapabilities & MariaDbServerCapabilities.CLIENT_SESSION_TRACK) !=0) { message = buffer.readStringLengthEncoded(StandardCharsets.UTF_8); if ((statusFlags & ServerStatus.SERVER_SESSION_STATE_CHANGED) !=0 && buffer.remaining() > 0) { sessionStateMessage = buffer.readStringLengthEncoded(StandardCharsets.UTF_8); } } else { message = buffer.readStringNullEnd(StandardCharsets.UTF_8); } } info = message; sessionStateInfo = sessionStateMessage; }
Source:
private void logError(String msg, @Nullable Throwable e) { if (e != null) { if (X.hasCause(e, NodeStoppingException.class)) { if (log.isDebugEnabled()) U.error(log, msg, e); } else U.error(log, msg, e); } }

Target:
private void logError(String msg, @Nullable Throwable e) { if (e != null && (log.isDebugEnabled() || !X.hasCause(e, NodeStoppingException.class))) U.error(log, msg, e); }
Source:
public DynamicUrlContentTabProxy create( Type<RequestTabsHandler> requestTabsEventType, Type<ChangeTabHandler> changeTabEventType, Type<RevealContentHandler<?>> slot, String label, float priority, String historyToken, boolean isMainTab, String contentUrl, Align align, String searchPrefix) { if (isMainTab) { if (searchPrefix == null) { searchPrefix = label; } commonModelProvider.get().addUiPluginListModel(searchPrefix, historyToken); } return new DynamicUrlContentTabProxy( placeManager, eventBus, gatekeeper, requestTabsEventType, changeTabEventType, slot, viewProvider, label, priority, historyToken, isMainTab, contentUrl, align, commonModelProvider); }

Target:
public DynamicUrlContentTabProxy create( Type<RequestTabsHandler> requestTabsEventType, Type<ChangeTabHandler> changeTabEventType, Type<RevealContentHandler<?>> slot, String label, float priority, String historyToken, boolean isMainTab, String contentUrl, Align align, String searchPrefix) { if (isMainTab) { commonModelProvider.get().addPluginModel(historyToken, searchPrefix != null ? searchPrefix : historyToken); } return new DynamicUrlContentTabProxy( placeManager, eventBus, gatekeeper, requestTabsEventType, changeTabEventType, slot, viewProvider, label, priority, historyToken, isMainTab, contentUrl, align, commonModelProvider); }
Source:
private String getSequenceNumberInternal(StreamPartition<String> partition, ShardIteratorType iteratorEnum) { String shardIterator = null; try { shardIterator = kinesis.getShardIterator( partition.getStream(), partition.getPartitionId(), iteratorEnum.toString() ).getShardIterator(); } catch (ResourceNotFoundException e) { log.warn("Caught ResourceNotFoundException: %s", e.getMessage()); } return getSequenceNumberInternal(partition, shardIterator); }

Target:
private String getSequenceNumberInternal(StreamPartition<String> partition, ShardIteratorType iteratorEnum) { String shardIterator = null; try { shardIterator = kinesis.getShardIterator( partition.getStream(), partition.getPartitionId(), iteratorEnum.toString() ).getShardIterator(); } catch (ResourceNotFoundException e) { log.warn(e, "Caught ResourceNotFoundException while getting shardIterator"); } return getSequenceNumberInternal(partition, shardIterator); }
Source:
public BackgroundHiveSplitLoader( String connectorId, Table table, Iterable<HivePartitionMetadata> partitions, Optional<HiveBucketHandle> bucketHandle, List<HiveBucket> buckets, ConnectorSession session, HdfsEnvironment hdfsEnvironment, NamenodeStats namenodeStats, DirectoryLister directoryLister, Executor executor, int maxPartitionBatchSize, int maxInitialSplits, boolean recursiveDirWalkerEnabled) { this.connectorId = connectorId; this.table = table; this.bucketHandle = bucketHandle; this.buckets = buckets; this.maxSplitSize = getMaxSplitSize(session); this.maxPartitionBatchSize = maxPartitionBatchSize; this.session = session; this.hdfsEnvironment = hdfsEnvironment; this.namenodeStats = namenodeStats; this.directoryLister = directoryLister; this.maxInitialSplitSize = getMaxInitialSplitSize(session); this.remainingInitialSplits = new AtomicInteger(maxInitialSplits); this.recursiveDirWalkerEnabled = recursiveDirWalkerEnabled; this.executor = executor; this.partitions = new ConcurrentLazyQueue<>(partitions); hdfsContext = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); }

Target:
public BackgroundHiveSplitLoader( String connectorId, Table table, Iterable<HivePartitionMetadata> partitions, Optional<HiveBucketHandle> bucketHandle, List<HiveBucket> buckets, ConnectorSession session, HdfsEnvironment hdfsEnvironment, NamenodeStats namenodeStats, DirectoryLister directoryLister, Executor executor, int maxPartitionBatchSize, int maxInitialSplits, boolean recursiveDirWalkerEnabled) { this.connectorId = connectorId; this.table = table; this.bucketHandle = bucketHandle; this.buckets = buckets; this.maxSplitSize = getMaxSplitSize(session); this.maxPartitionBatchSize = maxPartitionBatchSize; this.session = session; this.hdfsEnvironment = hdfsEnvironment; this.namenodeStats = namenodeStats; this.directoryLister = directoryLister; this.maxInitialSplitSize = getMaxInitialSplitSize(session); this.remainingInitialSplits = new AtomicInteger(maxInitialSplits); this.recursiveDirWalkerEnabled = recursiveDirWalkerEnabled; this.executor = executor; this.partitions = new ConcurrentLazyQueue<>(partitions); this.hdfsContext = new HdfsContext(session, table.getDatabaseName(), table.getTableName()); }
Source:
public static <T> Map<String, T> loadAllFilesInPath(Path path, Class<T> clazz) throws IOException { Map<String, T> fileContents = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); Stream<Path> paths = Files.walk(path); paths .filter(filePath -> filePath.toFile().getName().endsWith(".json")) .forEach(filePath -> { try { Stream<String> lines = Files.lines(filePath); String fileAsString = lines.collect(Collectors.joining()); lines.close(); if (clazz == String.class) { fileContents.put(getFileNameFromPath(filePath), (T) cleanupJsonString(fileAsString)); } else { fileContents.put(getFileNameFromPath(filePath), mapper.readValue(cleanupJsonString(fileAsString), clazz)); } } catch (IOException e) { e.printStackTrace(); } }); return fileContents; }

Target:
public static <T> Map<String, T> loadAllFilesInPath(Path path, Class<T> clazz) throws IOException { Map<String, T> fileContents = new HashMap<>(); ObjectMapper mapper = new ObjectMapper(); Stream<Path> paths = Files.walk(path); paths .filter(filePath -> filePath.toFile().getName().endsWith(".json")) .forEach(filePath -> { try { Stream<String> lines = Files.lines(filePath); String fileAsString = lines.collect(Collectors.joining()); lines.close(); if (clazz == String.class) { String cleanedJsonString = cleanupJsonString(fileAsString); T c = (T) cleanedJsonString; fileContents.put(getFileNameFromPath(filePath), c); } else { fileContents.put(getFileNameFromPath(filePath), mapper.readValue(cleanupJsonString(fileAsString), clazz)); } } catch (IOException e) { e.printStackTrace(); } }); return fileContents; }
Source:
private Ref getRef(PlotCommit commit, Repository repository, String currentBranch) { int count = commit.getRefCount(); if (count == 0) return new ObjectIdRef.Unpeeled(Storage.LOOSE, commit.getName(), commit); else if (count == 1) return commit.getRef(0); else { BranchConfig branchConfig = new BranchConfig(repository.getConfig(), currentBranch); String trackingBranch = branchConfig.getRemoteTrackingBranch(); Ref remoteRef = null; for (int i = 0; i < count; i++) { Ref ref = commit.getRef(i); if (trackingBranch != null && trackingBranch.equals(ref.getName())) return ref; if (ref.getName().startsWith(Constants.R_REMOTES)) remoteRef = ref; } if (remoteRef != null) return remoteRef; else return commit.getRef(0); } }

Target:
private Ref getRef(PlotCommit commit, Repository repository, String currentBranch) { int count = commit.getRefCount(); if (count == 0) return new ObjectIdRef.Unpeeled(Storage.LOOSE, commit.getName(), commit); else if (count == 1) return commit.getRef(0); else { BranchConfig branchConfig = new BranchConfig(repository.getConfig(), currentBranch); String trackingBranch = branchConfig.getTrackingBranch(); Ref remoteRef = null; for (int i = 0; i < count; i++) { Ref ref = commit.getRef(i); if (trackingBranch != null && trackingBranch.equals(ref.getName())) return ref; if (ref.getName().startsWith(Constants.R_REMOTES)) remoteRef = ref; } if (remoteRef != null) return remoteRef; else return commit.getRef(0); } }
Source:
public boolean next() throws IOException { try { boolean opNotEOF = true; if (!initialized) { opNotEOF = Utilities.skipHeader(sourceReader, skipFooterCnt, key, value); if (opNotEOF && skipFooterCnt > 0) { footerBuffer = new FooterBuffer(); opNotEOF = footerBuffer.initializeBuffer(jobConf, sourceReader, skipFooterCnt, (WritableComparable) key, value); } this.initialized = true; } if (opNotEOF && footerBuffer == null) { opNotEOF = sourceReader.next(key, value); } if (opNotEOF && footerBuffer != null) { opNotEOF = footerBuffer.updateBuffer(jobConf, sourceReader, (WritableComparable) key, value); } if (opNotEOF) { return true; } else { close(); return false; } } catch (Exception e) { throw new IOException(e); } }

Target:
public boolean next() throws IOException { try { boolean opNotEOF = true; if (!initialized) { opNotEOF = Utilities.skipHeader(sourceReader, skipFooterCnt, key, value); if (opNotEOF && skipFooterCnt > 0) { footerBuffer = new FooterBuffer(); opNotEOF = footerBuffer.initializeBuffer(jobConf, sourceReader, skipFooterCnt, (WritableComparable) key, value); } this.initialized = true; } if (opNotEOF && footerBuffer == null) { opNotEOF = sourceReader.next(key, value); } if (opNotEOF && footerBuffer != null) { opNotEOF = footerBuffer.updateBuffer(jobConf, sourceReader, (WritableComparable) key, value); } if (opNotEOF) { return true; } else { return false; } } catch (Exception e) { throw new IOException(e); } }
Source:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); Resource resource = context.getOriginalRootResource(); for (final PathElement element : address) { resource = resource.getChild(element); } byte[] contentHash = resource.getModel().get(CONTENT).asBytes(); try { TypedInputStream inputStream = contentRepository.readContent(contentHash, ""); String uuid = context.attachResultStream(inputStream.getContentType(), inputStream); context.getResult().get(UUID).set(uuid); } catch (ExplodedContentException ex) { throw new OperationFailedException(ex.getMessage(), ex); } }

Target:
public void execute(final OperationContext context, final ModelNode operation) throws OperationFailedException { final PathAddress address = PathAddress.pathAddress(operation.get(OP_ADDR)); Resource resource = context.getOriginalRootResource(); for (final PathElement element : address) { resource = resource.getChild(element); } byte[] contentHash = resource.getModel().get(CONTENT).asBytes(); try { TypedInputStream inputStream = contentRepository.readContent(contentHash, ""); String uuid = context.attachResultStream(inputStream.getContentType(), inputStream); context.getResult().get(UUID).set(uuid); } catch (ExplodedContentException ex) { throw new RuntimeException(ex.getMessage(), ex); } }
Source:
public HelixTaskExecutor(ParticipantStatusMonitor participantStatusMonitor, MessageQueueMonitor messageQueueMonitor) { _monitor = participantStatusMonitor; _messageQueueMonitor = messageQueueMonitor; _taskMap = new ConcurrentHashMap<>(); _hdlrFtyRegistry = new ConcurrentHashMap<>(); _executorMap = new ConcurrentHashMap<>(); _messageTaskMap = new ConcurrentHashMap<>(); _knownMessageIds = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); _batchMessageExecutorService = Executors.newCachedThreadPool(); _monitor.createExecutorMonitor("BatchMessageExecutor", _batchMessageExecutorService); _resourcesThreadpoolChecked = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); _transitionTypeThreadpoolChecked = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>()); _lock = new Object(); _statusUpdateUtil = new StatusUpdateUtil(); _timer = new Timer("HelixTaskExecutor_Timer", true); _isShuttingDown = false; startMonitorThread(); }

Target:
public HelixTaskExecutor(ParticipantStatusMonitor participantStatusMonitor, MessageQueueMonitor messageQueueMonitor) { _monitor = participantStatusMonitor; _messageQueueMonitor = messageQueueMonitor; _taskMap = new ConcurrentHashMap<>(); _hdlrFtyRegistry = new ConcurrentHashMap<>(); _executorMap = new ConcurrentHashMap<>(); _messageTaskMap = new ConcurrentHashMap<>(); _knownMessageIds = Collections.newSetFromMap(new ConcurrentHashMap<>()); _batchMessageExecutorService = Executors.newCachedThreadPool(); _monitor.createExecutorMonitor("BatchMessageExecutor", _batchMessageExecutorService); _resourcesThreadpoolChecked = Collections.newSetFromMap(new ConcurrentHashMap<>()); _transitionTypeThreadpoolChecked = Collections.newSetFromMap(new ConcurrentHashMap<>()); _lock = new Object(); _statusUpdateUtil = new StatusUpdateUtil(); _timer = new Timer("HelixTaskExecutor_Timer", true); _isShuttingDown = false; startMonitorThread(); }
Source:
private StudentAttributes getStudent() { if (student == null) { student = logic.getStudentForGoogleId(courseId, account.googleId); } return student; }

Target:
private StudentAttributes getStudent() { if (student == null) { return logic.getStudentForGoogleId(courseId, account.googleId); } return student; }
Source:
private void setValueExtractors(Set<String> valueExtractorFqcns, ClassLoader externalClassLoader) { for ( String valueExtractorFqcn : valueExtractorFqcns ) { try { @SuppressWarnings("unchecked") Class<? extends ValueExtractor<?>> clazz = (Class<? extends ValueExtractor<?>>) run( LoadClass.action( valueExtractorFqcn, externalClassLoader ) ); ValueExtractor<?> valueExtractor = run( NewInstance.action( clazz, "value extractor class" ) ); log.addingValueExtractor( clazz ); ValueExtractorDescriptor descriptor = new ValueExtractorDescriptor( valueExtractor ); valueExtractors.put( descriptor.getKey(), descriptor ); } catch (ValidationException e) { throw log.getUnableToInstantiateValueExtractorClassException( valueExtractorFqcn, e ); } } }

Target:
private void setValueExtractors(Set<String> valueExtractorFqcns, ClassLoader externalClassLoader) { for ( String valueExtractorFqcn : valueExtractorFqcns ) { ValueExtractor<?> valueExtractor; try { Class<? extends ValueExtractor<?>> clazz = (Class<? extends ValueExtractor<?>>) run( LoadClass.action( valueExtractorFqcn, externalClassLoader ) ); valueExtractor = run( NewInstance.action( clazz, "value extractor class" ) ); } catch (ValidationException e) { throw log.getUnableToInstantiateValueExtractorClassException( valueExtractorFqcn, e ); } ValueExtractorDescriptor descriptor = new ValueExtractorDescriptor( valueExtractor ); ValueExtractorDescriptor previous = valueExtractors.put( descriptor.getKey(), descriptor ); if ( previous != null ) { throw log.getValueExtractorForTypeAndTypeUseAlreadyPresentException( valueExtractor, previous.getValueExtractor() ); } log.addingValueExtractor( (Class<? extends ValueExtractor<?>>) valueExtractor.getClass() ); } }
Source:
public ClassLoaderLease registerClassLoaderLease(JobID jobId) { synchronized (lockObject) { LibraryCacheEntry libraryCacheEntry = cacheEntries.get(jobId); if (libraryCacheEntry == null) { libraryCacheEntry = new LibraryCacheEntry(jobId); cacheEntries.put(jobId, libraryCacheEntry); } return libraryCacheEntry.obtainHandle(); } }

Target:
public ClassLoaderLease registerClassLoaderLease(JobID jobId) { synchronized (lockObject) { return cacheEntries .computeIfAbsent(jobId, jobID -> new LibraryCacheEntry(jobId)) .obtainLease(); } }