auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected Optional<? extends Metadata<T>> updateObject( String id, Predicate<T> predicate, Function<T, T> update, Supplier<T> init ) { return lock.synchronizedOn( id, () -> { Metadata<T> metadata = data.get( id ); if( metadata == null ) { if( init == null ) return Optional.empty(); metadata = data.computeIfAbsent( id, ( id1 ) -> { var object = init.get(); identifier.set( object, id ); checkConstraints( object ); return new Metadata<>( object ); } ); data.put( id, metadata ); metadata.setUpdated(); } else { if( predicate.test( metadata.object ) ) { if( constraints.isEmpty() ) { metadata.update( update.apply( metadata.object ) ); } else { var newObject = update.apply( Binder.json.clone( metadata.object ) ); checkConstraints( newObject ); identifier.set( newObject, id ); metadata.update( newObject ); } } else { return Optional.empty(); } } return Optional.of( metadata ); } ); }

Target:
protected Optional<? extends Metadata<T>> updateObject( String id, Predicate<T> predicate, Function<T, T> update, Supplier<T> init ) { return lock.synchronizedOn( id, () -> { Metadata<T> metadata = data.get( id ); if( metadata == null ) { if( init == null ) return Optional.empty(); metadata = data.computeIfAbsent( id, ( id1 ) -> { var object = init.get(); identifier.set( object, id ); checkConstraints( object ); return new Metadata<>( object ); } ); data.put( id, metadata ); } else { if( predicate.test( metadata.object ) ) { if( constraints.isEmpty() ) { metadata.update( update.apply( metadata.object ) ); } else { var newObject = update.apply( Binder.json.clone( metadata.object ) ); checkConstraints( newObject ); identifier.set( newObject, id ); metadata.update( newObject ); } } else { return Optional.empty(); } } return Optional.of( metadata ); } ); }
Source:
private void verifyExpectedArgument(long sweepTime, long totalTimeElapsed) { assertThat(RESULTS_NO_MORE_TO_SWEEP.getTimeInMillis()).isEqualTo(sweepTime); assertThat(totalTimeElapsed) .isLessThanOrEqualTo(RESULTS_NO_MORE_TO_SWEEP.getTimeElapsedSinceStartedSweeping()); assertThat(totalTimeElapsed) .isGreaterThanOrEqualTo(RESULTS_NO_MORE_TO_SWEEP.getTimeElapsedSinceStartedSweeping() - 1000L); }

Target:
private void verifyExpectedArgument(long sweepTime, long totalTimeElapsed) { assertThat(RESULTS_NO_MORE_TO_SWEEP.getTimeInMillis()).isEqualTo(sweepTime); assertThat(totalTimeElapsed).isBetween( RESULTS_NO_MORE_TO_SWEEP.getTimeElapsedSinceStartedSweeping() - 1000L, RESULTS_NO_MORE_TO_SWEEP.getTimeElapsedSinceStartedSweeping()); }
Source:
private List<EmailLogEntry> getEmailLogs(Long endTimeToSearch, AdminEmailLogPageData data) { List<EmailLogEntry> emailLogs = new LinkedList<EmailLogEntry>(); List<String> versionToQuery = getVersionsForQuery(data.getVersions()); AdminLogQuery query = new AdminLogQuery(versionToQuery, null, endTimeToSearch); int totalLogsSearched = 0; GaeLogApi logApi = new GaeLogApi(); long startTime = query.getEndTime() - SEARCH_TIME_INCREMENT; query.setTimePeriod(startTime, query.getEndTime()); for (int i = 0; i < MAX_SEARCH_TIMES; i++) { if (emailLogs.size() >= LOGS_PER_PAGE) { break; } List<AppLogLine> searchResult = logApi.fetchLogs(query); List<EmailLogEntry> filteredLogs = filterLogsForEmailLogPage(searchResult, data); emailLogs.addAll(filteredLogs); totalLogsSearched += searchResult.size(); query.moveTimePeriodBackward(SEARCH_TIME_INCREMENT); } nextEndTimeToSearch = query.getEndTime(); String status = new StringBuilder().append("&nbsp;&nbsp;Total Logs gone through in last search: ") .append(totalLogsSearched).append("<br>") .append("<button class=\"btn-link\" id=\"button_older\" onclick=\"submitFormAjax('") .append(nextEndTimeToSearch).append("');\">Search More</button>") .toString(); data.setStatusForAjax(status); statusToUser.add(new StatusMessage(status, StatusMessageColor.INFO)); return emailLogs; }

Target:
private List<EmailLogEntry> getEmailLogs(Long endTimeToSearch, AdminEmailLogPageData data) { List<EmailLogEntry> emailLogs = new LinkedList<EmailLogEntry>(); List<String> versionToQuery = getVersionsForQuery(data.getVersions()); AdminLogQuery query = new AdminLogQuery(versionToQuery, null, endTimeToSearch); int totalLogsSearched = 0; GaeLogApi logApi = new GaeLogApi(); long startTime = query.getEndTime() - SEARCH_TIME_INCREMENT; query.setTimePeriod(startTime, query.getEndTime()); for (int i = 0; i < MAX_SEARCH_TIMES; i++) { if (emailLogs.size() >= LOGS_PER_PAGE) { break; } List<AppLogLine> searchResult = logApi.fetchLogs(query); List<EmailLogEntry> filteredLogs = filterLogsForEmailLogPage(searchResult, data); emailLogs.addAll(filteredLogs); totalLogsSearched += searchResult.size(); query.moveTimePeriodBackward(SEARCH_TIME_INCREMENT); } Long nextEndTimeToSearch = query.getEndTime(); String status = "&nbsp;&nbsp;Total Logs gone through in last search: " + totalLogsSearched + "<br>" + "<button class=\"btn-link\" id=\"button_older\" onclick=\"submitFormAjax('" + nextEndTimeToSearch + "');\">Search More</button>"; data.setStatusForAjax(status); statusToUser.add(new StatusMessage(status, StatusMessageColor.INFO)); return emailLogs; }
Source:
public void fallsBack() throws IOException { final String err = "message"; final String format = "something went wrong: %s"; MatcherAssert.assertThat( new RsPrint( new TkFallback( new Take() { @Override public Response act() { throw new UnsupportedOperationException(err); } }, new Fallback() { @Override public Take take(final RqFallback req) { return new TkText( String.format( format, req.throwable().getMessage() ) ); } }, new RqFake("GET") ).act() ).printBody(), Matchers.equalTo(String.format(format, err)) ); }

Target:
public void fallsBack() throws IOException { final String err = "message"; MatcherAssert.assertThat( new RsPrint( new TkFallback( new Take() { @Override public Response act() throws IOException { throw new IOException(err); } }, new Fallback() { @Override public Take take(final RqFallback req) { return new TkText( req.throwable().getMessage() ); } }, new RqFake("GET") ).act() ).printBody(), Matchers.equalTo(err) ); }
Source:
default String toOneLineString() { StringBuilder st = new StringBuilder(256); st.append("Model[").append(getModelName()).append("], "); st.append(String.format("%d Solutions, ", getSolutionCount())); if (hasObjective()) { st.append(getBoundsManager()).append(", "); } st.append(String.format("Resolution time %.3fs, Time to first/best solution %.3fs, %d Nodes (%,.1f n/s), %d Backtracks, %d Backjumps, %d Fails, %d Restarts", getTimeCount(), getTimeToBestSolution(), getNodeCount(), getNodeCount() / getTimeCount(), getBackTrackCount(), getBackjumpCount(), getFailCount(), getRestartCount())); return st.toString(); }

Target:
default String toOneLineString() { StringBuilder st = new StringBuilder(256); st.append("Model[").append(getModelName()).append("], "); st.append(String.format("%d Solutions, ", getSolutionCount())); if (hasObjective()) { st.append(getBoundsManager()).append(", "); } st.append( String.format( "Resolution time %.3fs, " + (hasObjective() ? String.format("Time to best solution %.3fs, ", getTimeToBestSolution()) : "") + "%d Nodes (%,.1f n/s), %d Backtracks, %d Backjumps, %d Fails, %d Restarts", getTimeCount(), getNodeCount(), getNodeCount() / getTimeCount(), getBackTrackCount(), getBackjumpCount(), getFailCount(), getRestartCount() ) ); return st.toString(); }
Source:
public void testNegativeEndCoordinateInRenormalization() throws IllegalArgumentException { exception.expect(IllegalArgumentException.class); exception.expectMessage(CoreMatchers.equalTo("Variant end coordinate cannot be negative")); Variant variant = new Variant("1", 1, 1, "C", "T"); variant.renormalize(1, -1, "A", "T"); }

Target:
public void testNegativeEndCoordinateInRenormalization() throws IllegalArgumentException { Variant variant = new Variant("1", 1, 1, "C", "T"); exception.expect(IllegalArgumentException.class); exception.expectMessage(CoreMatchers.equalTo(AbstractVariant.VARIANT_END_COORDINATE_CANNOT_BE_NEGATIVE)); variant.renormalize(1, -1, "A", "T"); }
Source:
public Object compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final UpdateDoublesSketch qs = UpdateDoublesSketch.builder().setK(k).build(); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { qs.update(it.getValues()[column - 1]); } return qs; }

Target:
public DoublesSketch compute(final Map<String, Object> combinedAggregators) { final ArrayOfDoublesSketch sketch = (ArrayOfDoublesSketch) getField().compute(combinedAggregators); final UpdateDoublesSketch qs = UpdateDoublesSketch.builder().setK(k).build(); final ArrayOfDoublesSketchIterator it = sketch.iterator(); while (it.next()) { qs.update(it.getValues()[column - 1]); } return qs; }
Source:
public static Optional<InsightCard> getInsights(final Long accountId) { final String categoryName = "Goal Go Outside"; return Optional.of(new InsightCard(accountId, GoalMsgEN.GOAL_GO_OUTSIDE_MARKETING_TITLE, GoalMsgEN.GOAL_GO_OUTSIDE_MARKETING_MSG, InsightCard.Category.GOAL_GO_OUTSIDE, InsightCard.TimePeriod.NONE, DateTime.now(DateTimeZone.UTC), categoryName, InsightCard.InsightType.BASIC)); }

Target:
public static Optional<InsightCard> getInsights(final Long accountId) { return Optional.of(new InsightCard(accountId, GoalMsgEN.GOAL_GO_OUTSIDE_TITLE, GoalMsgEN.GOAL_GO_OUTSIDE_MSG, InsightCard.Category.GOAL_GO_OUTSIDE, InsightCard.TimePeriod.NONE, DateTime.now(DateTimeZone.UTC), GoalMsgEN.GOAL_WEEKLONG_CATEGORY_NAME, InsightCard.InsightType.BASIC)); }
Source:
public void shouldEditAnAutoGenerationOptionByAnyNumberOFArguments() throws Exception { boolean automaticGenerationEnabled = false; boolean manualEntryEnabled = false; SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("manualEntryEnabled", manualEntryEnabled); autoGenerationOption.add("automaticGenerationEnabled", automaticGenerationEnabled); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); assertFalse( identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isAutomaticGenerationEnabled()); assertFalse(identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isManualEntryEnabled()); }

Target:
public void shouldEditAnAutoGenerationOptionByAnyNumberOFArguments() throws Exception { assertTrue( identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isAutomaticGenerationEnabled()); assertTrue(identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isManualEntryEnabled()); SimpleObject autoGenerationOption = new SimpleObject(); autoGenerationOption.add("manualEntryEnabled", false); autoGenerationOption.add("automaticGenerationEnabled", false); String json = new ObjectMapper().writeValueAsString(autoGenerationOption); MockHttpServletRequest req = request(RequestMethod.POST, getURI() + "/" + getUuid()); req.setContent(json.getBytes()); handle(req); assertFalse( identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isAutomaticGenerationEnabled()); assertFalse(identifierSourceService.getAutoGenerationOption(Integer.parseInt(getUuid())).isManualEntryEnabled()); }
Source:
public Map<Change, PatchSet> getChanges(GerritQueryHandler gerritQueryHandler) { if (changes == null) { changes = new HashMap<Change, PatchSet>(); try { List<JSONObject> jsonList = gerritQueryHandler.queryCurrentPatchSets("topic:{" + name + "}"); for (JSONObject json : jsonList) { if (json.has("type") && "stats".equalsIgnoreCase(json.getString("type"))) { continue; } if (json.has("currentPatchSet")) { JSONObject currentPatchSet = json.getJSONObject("currentPatchSet"); changes.put(new Change(json), new PatchSet(currentPatchSet)); } } } catch (IOException e) { logger.error("IOException occured. ", e); } catch (GerritQueryException e) { logger.error("Bad query. ", e); } } return changes; }

Target:
public Map<Change, PatchSet> getChanges(GerritQueryHandler gerritQueryHandler) { if (changes == null) { Map<Change, PatchSet> temp = new HashMap<Change, PatchSet>(); try { List<JSONObject> jsonList = gerritQueryHandler.queryCurrentPatchSets("topic:{" + name + "}"); for (JSONObject json : jsonList) { if (json.has("type") && "stats".equalsIgnoreCase(json.getString("type"))) { continue; } if (json.has("currentPatchSet")) { JSONObject currentPatchSet = json.getJSONObject("currentPatchSet"); temp.put(new Change(json), new PatchSet(currentPatchSet)); } } changes = temp; } catch (IOException e) { logger.error("IOException occured. ", e); } catch (GerritQueryException e) { logger.error("Bad query. ", e); } } return changes; }
Source:
public void onTick(TickEvent.ClientTickEvent event) { if(statKey.isKeyDown() && !statKeyPressed) { GuiPlayerStats.openGui(false); } else if(editKey.isKeyDown() && !editKeyPressed) { if(Minecraft.getMinecraft().currentScreen == null) ClientEditHandler.onKeyPressed(); } else if(captchaKey.isPressed()) { if(Minecraft.getMinecraft().currentScreen == null && Minecraft.getMinecraft().player.getHeldItemMainhand() != null) MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(MinestuckPacket.Type.CAPTCHA, CaptchaDeckPacket.CAPTCHALOUGE)); } else if(Keyboard.isKeyDown(captchaKey.getKeyCode()) && !captchaKeyPressed) { if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer && ((GuiContainer)Minecraft.getMinecraft().currentScreen).getSlotUnderMouse().getHasStack()) MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(MinestuckPacket.Type.CAPTCHA, CaptchaDeckPacket.CAPTCHALOUGE_INV)); } statKeyPressed = statKey.isKeyDown(); editKeyPressed = editKey.isKeyDown(); captchaKeyPressed = Keyboard.isKeyDown(captchaKey.getKeyCode()); }

Target:
public void onTick(TickEvent.ClientTickEvent event) { if(statKey.isKeyDown() && !statKeyPressed) { GuiPlayerStats.openGui(false); } else if(editKey.isKeyDown() && !editKeyPressed) { if(Minecraft.getMinecraft().currentScreen == null) ClientEditHandler.onKeyPressed(); } else if(captchaKey.isPressed()) { if(Minecraft.getMinecraft().currentScreen == null && Minecraft.getMinecraft().player.getHeldItemMainhand() != null) MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(MinestuckPacket.Type.CAPTCHA, CaptchaDeckPacket.CAPTCHALOUGE)); } else if(Keyboard.isKeyDown(captchaKey.getKeyCode()) && !captchaKeyPressed) { if (Minecraft.getMinecraft().currentScreen instanceof GuiContainerCreative && Minecraft.getMinecraft().player.openContainer instanceof GuiContainerCreative.ContainerCreative && ((GuiContainer)Minecraft.getMinecraft().currentScreen).getSlotUnderMouse() != null && ((GuiContainer)Minecraft.getMinecraft().currentScreen).getSlotUnderMouse().getHasStack()) MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(MinestuckPacket.Type.CAPTCHA, CaptchaDeckPacket.CAPTCHALOUGE_INV, ((GuiContainer)Minecraft.getMinecraft().currentScreen).getSlotUnderMouse().getSlotIndex())); else if(Minecraft.getMinecraft().currentScreen instanceof GuiContainer && ((GuiContainer)Minecraft.getMinecraft().currentScreen).getSlotUnderMouse() != null && ((GuiContainer)Minecraft.getMinecraft().currentScreen).getSlotUnderMouse().getHasStack()) MinestuckChannelHandler.sendToServer(MinestuckPacket.makePacket(MinestuckPacket.Type.CAPTCHA, CaptchaDeckPacket.CAPTCHALOUGE_INV, ((GuiContainer)Minecraft.getMinecraft().currentScreen).getSlotUnderMouse().slotNumber)); } statKeyPressed = statKey.isKeyDown(); editKeyPressed = editKey.isKeyDown(); captchaKeyPressed = Keyboard.isKeyDown(captchaKey.getKeyCode()); }
Source:
public void testValues() { assertQuery("VALUES 1, 2, 3, 4"); assertQuery("VALUES 1, 3, 2, 4 ORDER BY 1", "SELECT * FROM (VALUES 1, 3, 2, 4) ORDER BY 1"); assertQuery("VALUES (1.1, 2, 'foo'), (sin(3.3), 2+2, 'bar')"); assertQuery("VALUES (1.1, 2), (sin(3.3), 2+2) ORDER BY 1", "VALUES (sin(3.3), 2+2), (1.1, 2)"); assertQuery("VALUES (1.1, 2), (sin(3.3), 2+2) LIMIT 1", "VALUES (1.1, 2)"); assertQuery("SELECT * FROM (VALUES (1.1, 2), (sin(3.3), 2+2))"); assertQuery( "SELECT * FROM (VALUES (1.1, 2), (sin(3.3), 2+2)) x (a, b) LEFT JOIN (VALUES (1.1, 2), (1.1, 2+2)) y (a, b) USING (a)", "VALUES (1.1, 2, 4), (1.1, 2, 2), (sin(3.3), 4, NULL)"); assertQuery("SELECT 1.1 in (VALUES (1.1), (2.2))", "VALUES (TRUE)"); assertQuery("" + "WITH a AS (VALUES (1.1, 2), (sin(3.3), 2+2)) " + "SELECT * FROM a", "VALUES (1.1, 2), (sin(3.3), 2+2)"); assertQuery("VALUES 1, 2.2, 3, 4.4"); assertQuery("VALUES (1, 2), (3.3, 4.4)"); assertQuery("VALUES true, 1.0 in (1, 2, 3)"); }

Target:
public void testValues() { assertQuery("VALUES 1, 2, 3, 4"); assertQuery("VALUES 1, 3, 2, 4 ORDER BY 1", "SELECT * FROM (VALUES 1, 3, 2, 4) ORDER BY 1"); assertQuery("VALUES (1.1, 2, 'foo'), (sin(3.3), 2+2, 'bar')"); assertQuery("VALUES (1.1, 2), (sin(3.3), 2+2) ORDER BY 1", "VALUES (sin(3.3), 2+2), (1.1, 2)"); assertQuery("VALUES (1.1, 2), (sin(3.3), 2+2) LIMIT 1", "VALUES (1.1, 2)"); assertQuery("SELECT * FROM (VALUES (1.1, 2), (sin(3.3), 2+2))"); assertQuery("SELECT 1.1 in (VALUES (1.1), (2.2))", "VALUES (TRUE)"); assertQuery("" + "WITH a AS (VALUES (1.1, 2), (sin(3.3), 2+2)) " + "SELECT * FROM a", "VALUES (1.1, 2), (sin(3.3), 2+2)"); assertQuery("VALUES 1, 2.2, 3, 4.4"); assertQuery("VALUES (1, 2), (3.3, 4.4)"); assertQuery("VALUES true, 1.0 in (1, 2, 3)"); }
Source:
protected void initializeImageSizeAndRegion() { sizes = sortedSizes().sortedCopy(api.getSizesApi().list()); regions = api.getRegionApi().list(); images = newArrayList(filter(api.getImageApi().list(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.isPublicImage(); } })); assertTrue(sizes.size() > 1, "There must be at least two sizes"); assertTrue(regions.size() > 1, "There must be at least two regions"); assertTrue(images.size() > 0, "Image list should not be empty"); defaultSize = sizes.get(0); defaultRegion = regions.get(0); defaultImage = images.get(0); }

Target:
protected void initializeImageSizeAndRegion() { sizes = sortedSizes().sortedCopy(api.getSizesApi().list()); regions = api.getRegionApi().list(); images = newArrayList(filter(api.getImageApi().list(), new Predicate<Image>() { @Override public boolean apply(Image input) { return input.isPublicImage(); } })); assertTrue(sizes.size() > 1, "There must be at least two sizes"); assertTrue(regions.size() > 1, "There must be at least two regions"); assertFalse(images.isEmpty(), "Image list should not be empty"); defaultSize = sizes.get(0); defaultRegion = regions.get(0); defaultImage = images.get(0); }
Source:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); String[] configParts = bindingConfig.split(";"); String type = ""; List<String> params = new ArrayList<String>(); for (int i = 0; i < configParts.length; i++) { String paramName = configParts[i].split("=")[0].toLowerCase(); if (paramName.equals("type")) { type = configParts[i].split("=")[1]; } else { params.add(configParts[i]); } } if (type.equals("")) { throw new BindingConfigParseException("'type' is missing in configuration!"); } IntertechnoAddressParser parser = AddressParserFactory.getParser(type); parser.parseConfig(params); String commandOn = parser.getCommandON(); String commandOff = parser.getCommandOFF(); IntertechnoBindingConfig config = new IntertechnoBindingConfig(commandOn, commandOff); addBindingConfig(item, config); }

Target:
public void processBindingConfiguration(String context, Item item, String bindingConfig) throws BindingConfigParseException { super.processBindingConfiguration(context, item, bindingConfig); String[] configParts = bindingConfig.split(";"); String type = ""; List<String> params = new ArrayList<String>(); for (int i = 0; i < configParts.length; i++) { String paramName = configParts[i].split("=")[0].toLowerCase(); if (paramName.equals("type")) { type = configParts[i].split("=")[1]; } else { params.add(configParts[i]); } } if (StringUtils.isBlank(type)) { throw new BindingConfigParseException("'type' is missing in configuration!"); } IntertechnoAddressParser parser = AddressParserFactory.getParser(type); parser.parseConfig(params); String commandOn = parser.getCommandON(); String commandOff = parser.getCommandOFF(); IntertechnoBindingConfig config = new IntertechnoBindingConfig(commandOn, commandOff); addBindingConfig(item, config); }
Source:
public boolean isSameType(IType type) { if (type == this) return true; if (type instanceof ITypedef || type instanceof IIndexBinding) return type.isSameType(this); if ( fDeferredInstance != null && type instanceof ICPPDeferredClassInstance) { return type.isSameType(fDeferredInstance); } return false; }

Target:
public boolean isSameType(IType type) { if (type == this) return true; if (type instanceof ITypedef || type instanceof IIndexBinding) return type.isSameType(this); return false; }
Source:
protected void testAccessControl() throws Exception { dataBundle = getTypicalDataBundle(); String[] submissionParams = new String[]{}; verifyOnlyAdminsCanAccess(submissionParams); }

Target:
protected void testAccessControl() throws Exception { String[] submissionParams = new String[]{}; verifyOnlyAdminsCanAccess(submissionParams); }
Source:
protected boolean putFileToImpl(String fileName, String serviceUrl) { boolean result; resetResponse(); String url = getUrl(serviceUrl); String filePath = getFilePathFromWikiUrl(fileName); File file = new File(filePath); if (!file.exists()) { throw new StopTestException(false, "File " + filePath + " not found."); } try { response.setRequest(fileName); storeLastCall("PUT_FILE", serviceUrl); getEnvironment().doHttpFilePut(url, response, headerValues, file); } catch (Throwable t) { throw new StopTestException("Unable to get response from PUT to: " + url, t); } result = postProcessResponse(); return result; }

Target:
protected boolean putFileToImpl(String fileName, String serviceUrl) { return sendFileImpl(fileName, serviceUrl, "PUT"); }
Source:
public boolean add(final Task task) { giant.lock(); try { Preconditions.checkState(active, "Queue is not active!"); taskStorage.insert(task, TaskStatus.running(task.getId())); queue.add(task); workMayBeAvailable.signalAll(); return true; } finally { giant.unlock(); } }

Target:
public boolean add(final Task task) { giant.lock(); try { Preconditions.checkState(active, "Queue is not active!"); try { taskStorage.insert(task, TaskStatus.running(task.getId())); } catch(TaskExistsException e) { log.warn("Attempt to add task twice: %s", task.getId()); throw Throwables.propagate(e); } queue.add(task); workMayBeAvailable.signalAll(); tryLock(task); return true; } finally { giant.unlock(); } }
Source:
public static String getHostName() throws IOException { Process p = Runtime.getRuntime().exec("hostname"); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String result = reader.readLine(); try { int exitCode = p.waitFor(); if (exitCode != 0) { throw new IOException("Non-zero return from hostname process: " + result); } } catch (InterruptedException e) { throw new IOException(e); } finally { reader.close(); } return result; }

Target:
public static String getHostName() throws IOException { Process p = Runtime.getRuntime().exec("hostname"); try (BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()))) { String result = reader.readLine(); int exitCode = p.waitFor(); if (exitCode != 0) { throw new IOException("Non-zero return from hostname process: " + result); } return result; } catch (InterruptedException e) { throw new IOException(e); } }
Source:
private static void execute(String command) { try { LOGGER.info("Executing command: " + command); Process process = Runtime.getRuntime().exec(command); int exitStatus = process.waitFor(); if (exitStatus != 0) { throw new RuntimeException(String.format("Command '%s' exited with no zero status '%d'", command, exitStatus)); } } catch (InterruptedException | IOException e) { throw new RuntimeException(e); } }

Target:
private static void execute(String command) { try { LOGGER.info("Executing command: " + command); File devNull = new File("/dev/null"); int exitStatus = new ProcessBuilder(Splitter.on(" ").splitToList(command)) .redirectError(devNull) .redirectOutput(devNull) .redirectInput(devNull) .start() .waitFor(); if (exitStatus != 0) { throw new RuntimeException(String.format("Command '%s' exited with no zero status '%d'", command, exitStatus)); } } catch (InterruptedException | IOException e) { throw new RuntimeException(e); } }
Source:
public void addCompleter(CommandLineCompleter completer) { completions.add((Completion) (CompleteOperation co) -> { List<String> candidates = new ArrayList<>(); CliLogger.ROOT_LOGGER.completingBuffer(co.getBuffer()); int offset = completer.complete(cmdCtx, co.getBuffer(), co.getCursor(), candidates); co.setOffset(offset); co.addCompletionCandidates(candidates); String buffer = cmdCtx.getArgumentsString() == null ? co.getBuffer() : cmdCtx.getArgumentsString() + co.getBuffer(); if (co.getCompletionCandidates().size() == 1 && co.getCompletionCandidates().get(0). getCharacters().startsWith(buffer)) { co.doAppendSeparator(true); } else { co.doAppendSeparator(false); } CliLogger.ROOT_LOGGER.completitionCandidates(co.getCompletionCandidates()); }); }

Target:
public void addCompleter(CommandLineCompleter completer) { completions.add((Completion) (CompleteOperation co) -> { List<String> candidates = new ArrayList<>(); if (CliLogger.ROOT_LOGGER.isTraceEnabled()) { CliLogger.ROOT_LOGGER.tracef("Completing %s", co.getBuffer()); } int offset = completer.complete(cmdCtx, co.getBuffer(), co.getCursor(), candidates); co.setOffset(offset); co.addCompletionCandidates(candidates); String buffer = cmdCtx.getArgumentsString() == null ? co.getBuffer() : cmdCtx.getArgumentsString() + co.getBuffer(); if (co.getCompletionCandidates().size() == 1 && co.getCompletionCandidates().get(0). getCharacters().startsWith(buffer)) { co.doAppendSeparator(true); } else { co.doAppendSeparator(false); } if (CliLogger.ROOT_LOGGER.isTraceEnabled()) { CliLogger.ROOT_LOGGER.tracef("Completion candidates %s", co.getCompletionCandidates()); } }); }
Source:
protected BoxFolder getCurrentFolder() { Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.box_browsesdk_fragment_container); BoxFolder curFolder = fragment instanceof BoxBrowseFolderFragment ? ((BoxBrowseFolderFragment) fragment).getFolder() : (BoxFolder) mItem; JsonObject jsonObject = curFolder.toJsonObject(); JsonValue obj = jsonObject.get(BoxFolder.FIELD_ITEM_COLLECTION); if (obj != null && !obj.isNull()) { obj.asObject().set(BoxIterator.FIELD_ENTRIES, new JsonArray()); } return new BoxFolder(jsonObject); }

Target:
protected BoxFolder getCurrentFolder() { Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.box_browsesdk_fragment_container); BoxFolder curFolder = fragment instanceof BoxBrowseFolderFragment ? ((BoxBrowseFolderFragment) fragment).getFolder() : null; return curFolder; }
Source:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_compress_image); initView(); Button size=(Button)findViewById(R.id.size); Button dimension=(Button)findViewById(R.id.bypixel); ImageButton cancel=(ImageButton)findViewById(R.id.edit_cancel); size.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { compressbysize(); } }); dimension.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { compressbydim(); } }); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }

Target:
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_compress_image); initView(); Button size=(Button)findViewById(R.id.size); Button dimension=(Button)findViewById(R.id.bypixel); ImageButton cancel=(ImageButton)findViewById(R.id.edit_cancel); size.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { compressSize(); } }); dimension.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { compressDim(); } }); cancel.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); }
Source:
public static String getExpandedUrl(String url) { EnvVars globalConfiguredEnvVars = Jenkins.getInstance().getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class).getEnvVars(); return globalConfiguredEnvVars.expand(url); }

Target:
public static String getExpandedUrl(String url) { EnvironmentVariablesNodeProperty evnp = Jenkins.getInstance().getGlobalNodeProperties().get(EnvironmentVariablesNodeProperty.class); if(evnp == null){ return url; } EnvVars globalConfiguredEnvVars = evnp.getEnvVars(); return globalConfiguredEnvVars.expand(url); }
Source:
public static void main(String[] args) { TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildAsyncClient(); String document = "Satya Nadella is the CEO of Microsoft"; client.recognizeEntities(document).subscribe( entityCollection -> entityCollection.forEach(entity -> System.out.printf( "Recognized categorized entity: %s, entity category: %s, entity subcategory: %s, score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())), error -> System.err.println("There was an error recognizing entities of the text." + error), () -> System.out.println("Entities recognized.") ); try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException ignored) { } }

Target:
public static void main(String[] args) { TextAnalyticsAsyncClient client = new TextAnalyticsClientBuilder() .credential(new AzureKeyCredential("{key}")) .endpoint("{endpoint}") .buildAsyncClient(); String document = "Satya Nadella is the CEO of Microsoft"; client.recognizeEntities(document).subscribe( entityCollection -> entityCollection.forEach(entity -> System.out.printf( "Recognized categorized entity: %s, entity category: %s, entity subcategory: %s," + " confidence score: %f.%n", entity.getText(), entity.getCategory(), entity.getSubcategory(), entity.getConfidenceScore())), error -> System.err.println("There was an error recognizing entities of the text." + error), () -> System.out.println("Entities recognized.") ); try { TimeUnit.SECONDS.sleep(5); } catch (InterruptedException ignored) { } }
Source:
private void createSelectionGroup() { Composite group = new Composite(fDialogComposite, SWT.BORDER); group.setLayout(new GridLayout(2, true)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fLocalButton = new Button(group, SWT.RADIO); fLocalButton.setText(Messages.TraceControl_LocalButtonText); fLocalButton.setLayoutData(new GridData(GridData.FILL_BOTH)); fLocalButton.setSelection(true); fRemoteButton = new Button(group, SWT.RADIO); fRemoteButton.setText(Messages.TraceControl_RemoteButtonText); fRemoteButton.setLayoutData(new GridData(GridData.FILL_BOTH)); fLocalButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fLocalButton.getSelection()) { disposeRemoteComposite(); createLocalComposite(); fRemoteFiles = null; fDialogComposite.layout(); } } }); fRemoteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fRemoteButton.getSelection()) { disposeLocalComposite(); createRemoteComposite(); fLocalFiles = null; fDialogComposite.layout(); } } }); }

Target:
private void createSelectionGroup() { Composite group = new Composite(fDialogComposite, SWT.BORDER); group.setLayout(new GridLayout(2, true)); group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fLocalButton = new Button(group, SWT.RADIO); fLocalButton.setText(Messages.TraceControl_LocalButtonText); fLocalButton.setLayoutData(new GridData(GridData.FILL_BOTH)); fLocalButton.setSelection(true); fRemoteButton = new Button(group, SWT.RADIO); fRemoteButton.setText(Messages.TraceControl_RemoteButtonText); fRemoteButton.setLayoutData(new GridData(GridData.FILL_BOTH)); fLocalButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fLocalButton.getSelection()) { disposeRemoteComposite(); createLocalComposite(); fRemoteFiles = null; fDialogComposite.layout(); enableLocalButtons(); } } }); fRemoteButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fRemoteButton.getSelection()) { disposeLocalComposite(); createRemoteComposite(); fLocalFiles = null; fDialogComposite.layout(); enableRemoteButtons(); } } }); }
Source:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartSignalEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartSignalEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, ""); assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }

Target:
public void testUnmarshallSubprocessLevelEventEmptyProperties() throws Exception { Diagram<Graph, Metadata> diagram = unmarshall(marshaller, BPMN_START_EVENT_FILE_PATH); assertDiagram(diagram, AMOUNT_OF_NODES_IN_DIAGRAM); StartSignalEvent emptySubprocess = getStartNodeById(diagram, EMPTY_SUBPROCESS_LEVEL_EVENT_ID, StartSignalEvent.class); assertGeneralSet(emptySubprocess.getGeneral(), EMPTY_VALUE, EMPTY_VALUE); assertSignalEventExecutionSet(emptySubprocess.getExecutionSet(), EMPTY_VALUE, NON_INTERRUPTING, EMPTY_VALUE); assertDataIOSet(emptySubprocess.getDataIOSet(), EMPTY_VALUE); }
Source:
public void find(String token, List<SearchItem> result) { boolean caseInsensitive = UserSearchProperty.isCaseInsensitive(); for (SearchItem i : items){ String name = i.getSearchName(); if(caseInsensitive){ token=token.toLowerCase(); name=name.toLowerCase(); } if(token.equals(name)) result.add(i); } }

Target:
public void find(String token, List<SearchItem> result) { boolean caseInsensitive = UserSearchProperty.isCaseInsensitive(); for (SearchItem i : items) { String name = i.getSearchName(); if (name.equals(token) || (caseInsensitive && name.equalsIgnoreCase(token))) { result.add(i); } } }
Source:
public double valuationCompositionFactor() { LocalDate currentFixing = nextFixing; LocalDate currentPublication = index.calculatePublicationFromFixing(currentFixing); if (env.getValuationDate().equals(currentPublication)) { OptionalDouble fixedRate = indexFixingDateSeries.get(currentFixing); if (fixedRate.isPresent()) { nextFixing = fixingCalendar.next(nextFixing); LocalDate effectiveDate = index.calculateEffectiveFromFixing(currentFixing); LocalDate maturityDate = index.calculateMaturityFromEffective(effectiveDate); double accrualFactor = index.getDayCount().yearFraction(effectiveDate, maturityDate); if (currentFixing.isBefore(lastFixingNonCutoff)) { return 1.0d + accrualFactor * fixedRate.getAsDouble(); } if (currentFixing.equals(lastFixingNonCutoff)) { double compositionFactor = 1.0d + accrualFactor * fixedRate.getAsDouble(); for (int i = 0; i < cutoffOffset - 1; i++) { compositionFactor *= 1.0d + accrualFactorCutoff[i] * fixedRate.getAsDouble(); } return compositionFactor; } } else { return 1.0d; } } return 1.0d; }

Target:
private double valuationCompositionFactor() { LocalDate currentFixing = nextFixing; LocalDate currentPublication = index.calculatePublicationFromFixing(currentFixing); if (env.getValuationDate().equals(currentPublication) && !(currentFixing.isAfter(lastFixingNonCutoff))) { OptionalDouble fixedRate = indexFixingDateSeries.get(currentFixing); if (fixedRate.isPresent()) { nextFixing = fixingCalendar.next(nextFixing); LocalDate effectiveDate = index.calculateEffectiveFromFixing(currentFixing); LocalDate maturityDate = index.calculateMaturityFromEffective(effectiveDate); double accrualFactor = index.getDayCount().yearFraction(effectiveDate, maturityDate); if (currentFixing.isBefore(lastFixingNonCutoff)) { return 1.0d + accrualFactor * fixedRate.getAsDouble(); } double compositionFactor = 1.0d + accrualFactor * fixedRate.getAsDouble(); for (int i = 0; i < cutoffOffset - 1; i++) { compositionFactor *= 1.0d + accrualFactorCutoff[i] * fixedRate.getAsDouble(); } return compositionFactor; } } return 1.0d; }
Source:
public static String truncateWithoutWordSplit(String source, int length) { if (source.length() <= length) { return source; } BreakIterator atWordInstance = BreakIterator.getWordInstance(); atWordInstance.setText(source); return source.substring(0, atWordInstance.preceding(length)).trim(); }

Target:
public static String truncateWithoutWordSplit(String source, int length) { if (source.length() <= length) { return source; } BreakIterator atWordInstance = BreakIterator.getWordInstance(); atWordInstance.setText(source); return source.substring(0, atWordInstance.following(length)).trim(); }
Source:
public String process(String query) { _logger.info("Processing query: {}", query); try { URI uri = new URI(query); String path = getPath(query, _logger); if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.DATASTREAM_STATE.toString())) { String response = processDatastreamStateRequest(uri); _logger.trace("Query: returns response: {}", query, response); return response; } else if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.POSITION.toString())) { final Map<PositionKey, PositionValue> positionData = PositionDataStore.getInstance() .getOrDefault(_connectorName, new ConcurrentHashMap<>()); final String response = JsonUtils.toJson(positionData); _logger.trace("Query: returns response: {}", query, response); return response; } else { _logger.warn("Could not process query with path {}", query, path); } } catch (Exception e) { _logger.warn("Failed to process query {}", query); _logger.debug("Failed to process query {}", query, e); } return null; }

Target:
public String process(String query) { _logger.info("Processing query: {}", query); try { URI uri = new URI(query); String path = getPath(query, _logger); if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.DATASTREAM_STATE.toString())) { String response = processDatastreamStateRequest(uri); _logger.trace("Query: returns response: {}", query, response); return response; } else if (path != null && path.equalsIgnoreCase(DiagnosticsRequestType.POSITION.toString())) { final String response = processPositionRequest(); _logger.trace("Query: returns response: {}", query, response); return response; } else { _logger.warn("Could not process query with path {}", query, path); } } catch (Exception e) { _logger.warn("Failed to process query {}", query); _logger.debug("Failed to process query {}", query, e); throw new DatastreamRuntimeException(e); } return null; }
Source:
private static String remoteUrl(final Context context) { String customURL = context.get(Download.INSTANCE); if(customURL != null && !customURL.isEmpty()) { return context.get(Download.INSTANCE); } else { return DEFAULT_REMOTE_URL; } }

Target:
private static String remoteUrl(final Context context) { final String customURL = context.get(Download.INSTANCE); if(customURL != null && !customURL.isEmpty()) { return customURL; } else { return DEFAULT_REMOTE_URL; } }
Source:
public static void create(TaggedMetricRegistry taggedMetricRegistry, Supplier<String> versionSupplier, String serviceName) { UUID nodeId = UUID.randomUUID(); ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(5); scheduledExecutorService.scheduleWithFixedDelay((Runnable) () -> { ConjureTimelockServiceBlockingMetrics conjureTimelockServiceBlockingMetrics = ConjureTimelockServiceBlockingMetrics.of(taggedMetricRegistry); ImmutableMap.of( "perc99", conjureTimelockServiceBlockingMetrics.startTransactions().getSnapshot().get99thPercentile(), "Rate", conjureTimelockServiceBlockingMetrics.startTransactions().getOneMinuteRate(), "atlasVersion", versionSupplier.get(), "nodeId", nodeId, "serviceName", serviceName); }, 30, 30, TimeUnit.SECONDS); }

Target:
public static TimeLockFeedbackBackgroundTask create(TaggedMetricRegistry taggedMetricRegistry, Supplier<String> versionSupplier, String serviceName) { TimeLockFeedbackBackgroundTask task = new TimeLockFeedbackBackgroundTask(taggedMetricRegistry, versionSupplier, serviceName); task.scheduleWithFixedDelay(); return task; }
Source:
public Metadata getMetadata(UIContext context) { return Metadata.from(super.getMetadata(context), getClass()) .name("Constraint: New Annotation") .description("Create a Bean Validation constraint annotation") .category(super.getMetadata(context).getCategory()); }

Target:
public Metadata getMetadata(UIContext context) { return Metadata.from(super.getMetadata(context), getClass()) .name("Constraint: New Annotation") .description("Create a Bean Validation constraint annotation"); }
Source:
private void setComposite(Composite parent) { container = new Composite(parent, SWT.NONE); Label lblSelectPattern = new Label(container, SWT.NONE); lblSelectPattern.setBounds(10, 20, 76, 15); lblSelectPattern.setText("Select Pattern"); combo = new Combo(container, SWT.READ_ONLY); combo.setBounds(88, 17, 199, 23); addPatternToCombo(combo); combo.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { setPageComplete(getComboSelect()); canvas = new Canvas(container, SWT.NONE); canvas.setBounds(240, 130, 200, 160); ImageDescriptor image = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.sirius.editor.diagram", comboSelection.getImagePath()); Image img = new Image(container.getDisplay(), image.getImageData()); canvas.setBackgroundImage(img); lblParagra = new Label(container, SWT.WRAP); lblParagra.setBounds(10, 132, 220, 170); lblParagra.setText(comboSelection.getDescription()); ((ClassDiagramPatternConfigurationPage) getNextPage()).setSelectedPattern(getComboSelection()); getContainer().updateButtons(); } }); lblDescription = new Label(container, SWT.NONE); lblDescription.setBounds(10, 90, 76, 15); lblDescription.setText("Description:"); }

Target:
private void setComposite(Composite parent) { container = new Composite(parent, SWT.NONE); container.setLayout(new GridLayout()); container.setLayoutData(new GridData(GridData.FILL_VERTICAL)); Label lblSelectPattern = new Label(container, SWT.NONE); lblSelectPattern.setBounds(10, 20, 76, 15); lblSelectPattern.setText("Select Pattern"); combo = new Combo(container, SWT.READ_ONLY); combo.setBounds(88, 17, 199, 23); addPatternToCombo(combo); combo.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { setPageComplete(getComboSelect()); canvas = new Canvas(container, SWT.NONE); canvas.setBounds(240, 130, 200, 160); ImageDescriptor image = AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.sirius.editor.diagram", comboSelection.getImagePath()); Image img = new Image(container.getDisplay(), image.getImageData()); canvas.setBackgroundImage(img); lblParagra = new Label(container, SWT.WRAP); lblParagra.setBounds(10, 132, 220, 170); lblParagra.setText(comboSelection.getDescription()); if (getComboSelection() instanceof ClassDiagramPattern) ((ClassDiagramPatternConfigurationPage) getNextPage()).setSelectedPattern((ClassDiagramPattern) getComboSelection()); getContainer().updateButtons(); } }); lblDescription = new Label(container, SWT.NONE); lblDescription.setBounds(10, 90, 76, 15); lblDescription.setText("Description:"); }
Source:
public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); Config config = Util.rewriteConfig(orgConfig); ApplicationRunnerOperation op = cmdLine.getOperation(options); ApplicationRunner appRunner = ApplicationRunners.getApplicationRunner(ApplicationClassUtils.fromConfig(config), config); switch (op) { case RUN: appRunner.run(); break; case KILL: appRunner.kill(); break; case STATUS: System.out.println(appRunner.status()); break; default: throw new IllegalArgumentException("Unrecognized operation: " + op); } }

Target:
public static void main(String[] args) throws Exception { ApplicationRunnerCommandLine cmdLine = new ApplicationRunnerCommandLine(); OptionSet options = cmdLine.parser().parse(args); Config orgConfig = cmdLine.loadConfig(options); Config config = Util.rewriteConfig(orgConfig); ApplicationRunnerOperation op = cmdLine.getOperation(options); ApplicationRunner appRunner = ApplicationRunners.getApplicationRunner(ApplicationUtil.fromConfig(config), config); switch (op) { case RUN: appRunner.run(); break; case KILL: appRunner.kill(); break; case STATUS: System.out.println(appRunner.status()); break; default: throw new IllegalArgumentException("Unrecognized operation: " + op); } }
Source:
public Collection<String> getSupportedCategories() { return Collections.unmodifiableCollection(SUPPORTED_CATEGORIES); }

Target:
public Collection<String> getSupportedCategories() { return SUPPORTED_CATEGORIES; }
Source:
private int mapPortForwarding(final DebuggingContext debuggingContext, final IProgressMonitor monitor) { monitor.subTask("Enabling port forwarding"); IPod pod = debuggingContext.getPod(); int remotePort = debuggingContext.getDebugPort(); if (pod == null || remotePort < 1) { return -1; } Set<PortPair> ports = PortForwardingUtils.getForwardablePorts(pod); Optional<PortPair> debugPort = ports.stream().filter(p -> remotePort == p.getRemotePort()).findFirst(); if (!debugPort.isPresent() || monitor.isCanceled()) { return -1; } if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } for (IPortForwardable.PortPair port : ports) { if(monitor.isCanceled()) { return -1; } if (port.getRemotePort() != 9999) { port.setLocalPort(SocketUtil.findFreePort()); } monitor.worked(1); } PortForwardingUtils.startPortForwarding(pod, ports, OpenShiftBinaryOption.SKIP_TLS_VERIFY); if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } return -1; }

Target:
private int mapPortForwarding(final DebuggingContext debuggingContext, final IProgressMonitor monitor) { monitor.subTask("Enabling port forwarding"); IPod pod = debuggingContext.getPod(); int remotePort = debuggingContext.getDebugPort(); if (pod == null || remotePort < 1) { return -1; } Set<PortPair> ports = PortForwardingUtils.getForwardablePorts(pod); Optional<PortPair> debugPort = ports.stream().filter(p -> remotePort == p.getRemotePort()).findFirst(); if (!debugPort.isPresent() || monitor.isCanceled()) { return -1; } if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } for (IPortForwardable.PortPair port : ports) { if(monitor.isCanceled()) { return -1; } if (port.getRemotePort() != OpenShiftDebugUtils.NATIVE_MANAGMENT_PORT) { port.setLocalPort(SocketUtil.findFreePort()); } monitor.worked(1); } PortForwardingUtils.startPortForwarding(pod, ports, OpenShiftBinaryOption.SKIP_TLS_VERIFY); if (PortForwardingUtils.isPortForwardingStarted(pod)) { int p = debugPort.get().getLocalPort(); return p; } return -1; }
Source:
private String listAllCommands() { String commands = "Installed Commands: "; Iterator<CliCommand> implementations = getAllCommands(); while (implementations.hasNext()) { CliCommand implementation = implementations.next(); String unCamel = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, implementation.getClass().getSimpleName()); commands += unCamel + ", "; } return commands; }

Target:
private String listAllCommands() { final StringBuilder commands = new StringBuilder("Installed Commands: "); final Iterator<CliCommand> implementations = getAllCommands(); while (implementations.hasNext()) { final CliCommand implementation = implementations.next(); commands.append(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, implementation.getClass().getSimpleName())); if (implementations.hasNext()) { commands.append(", "); } } return commands.toString(); }
Source:
public UnitOfWorkAspect newAspect(ImmutableMap<String, SessionFactory> sessionFactories) { return new UnitOfWorkAspect(this.sessionFactories); }

Target:
public UnitOfWorkAspect newAspect(ImmutableMap<String, SessionFactory> sessionFactories) { return new UnitOfWorkAspect(sessionFactories); }