auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public static void analyzeFiles(Set<String> fileNames) throws ArgumentParserException, IOException { numErrors = 0; numWarnings = 0; List<File> files = fileNames.parallelStream().map(File::new).collect(Collectors.toList()); ConcurrentMap<File, Optional<CommonTokenStream>> filesToTokenStreams = files.parallelStream().collect(Collectors.toConcurrentMap(Function.identity(), Tailor::getTokenStream)); System.out.format("Analyzing %s:%n", pluralize(fileNames.size(), "file", "files")); ConcurrentMap<File, Optional<TopLevelContext>> filesToTrees = files .parallelStream() .collect(Collectors.toConcurrentMap(Function.identity(), file -> { Optional<TopLevelContext> tree = Optional.empty(); try { tree = Tailor.getParseTree(filesToTokenStreams.get(file)); System.out.print("."); } catch (ErrorListener.ParseException e) { System.out.print("S"); numSkippedFiles++; } return tree; })); System.out.format("%n"); files.parallelStream().forEach( file -> { try { Tailor.analyzeFile(file, filesToTokenStreams.get(file), filesToTrees.get(file)); } catch (ArgumentParserException e) { handleCliException(e); } }); printSummary(fileNames.size(), numSkippedFiles, numErrors, numWarnings); if (numErrors >= 1L) { System.exit(ExitCode.failure()); } }

Target:
private void analyzeFiles(Set<String> fileNames) throws CLIArgumentParserException, IOException { ColorSettings colorSettings = new ColorSettings(configuration.shouldColorOutput(), configuration.shouldInvertColorOutput()); Formatter formatter = configuration.getFormatter(colorSettings); Severity maxSeverity = configuration.getMaxSeverity(); ConstructLengths constructLengths = configuration.parseConstructLengths(); Set<Rules> enabledRules = configuration.getEnabledRules(); List<File> files = fileNames.parallelStream().map(File::new).collect(Collectors.toList()); formatter.printProgressInfo( String.format("Analyzing %s:%n", Formatter.pluralize(fileNames.size(), "file", "files"))); files.parallelStream().forEach( file -> { try { Optional<CommonTokenStream> tokenStream = getTokenStream(file); Optional<TopLevelContext> tree = getParseTree(tokenStream); analyzeFile(file, tokenStream, tree, formatter, maxSeverity, constructLengths, enabledRules); formatter.printProgressInfo("."); } catch (ErrorListener.ParseException e) { formatter.printProgressInfo("S"); Printer printer = new Printer(file, maxSeverity, formatter); printer.setShouldPrintParseErrorMessage(true); printersForAllFiles.add(printer); numSkippedFiles.incrementAndGet(); } catch (CLIArgumentParserException e) { handleCLIException(e, configuration); } }); formatter.printProgressInfo(String.format("%n")); printersForAllFiles.forEach(printer -> { try { printer.printAllMessages(); } catch (IOException e) { handleIOException(e); } }); formatter.displaySummary(fileNames.size(), numSkippedFiles.get(), numErrors.get(), numWarnings.get()); handleErrorViolations(formatter, numErrors.get()); }
Source:
private InputStream loadFile(File file) { InputStream inputStream = null; if (!file.canWrite() && isRootExplorer) { try { cachedFile = new File(externalCacheDir, file.getName()); RootUtils.copy(file.getAbsolutePath(), cachedFile.getPath()); inputStream = new FileInputStream(cachedFile); } catch (ShellNotRunningException e) { e.printStackTrace(); inputStream = null; } catch (FileNotFoundException e) { e.printStackTrace(); inputStream = null; } } else if (file.canRead()) { try { inputStream = new FileInputStream(file.getAbsolutePath()); } catch (FileNotFoundException e) { inputStream = null; } } return inputStream; }

Target:
private InputStream loadFile(File file) { InputStream inputStream = null; if (!file.canWrite() && isRootExplorer) { try { cachedFile = new File(externalCacheDir, file.getName()); RootUtils.copy(file.getAbsolutePath(), cachedFile.getPath()); inputStream = new FileInputStream(cachedFile); } catch (ShellNotRunningException e) { e.printStackTrace(); inputStream = null; } catch (FileNotFoundException e) { e.printStackTrace(); inputStream = null; } } else if (file.canRead()) { try { inputStream = new FileInputStream(file.getAbsolutePath()); } catch (FileNotFoundException e) { Log.e(TAG, "Unable to open file [" + file.getAbsolutePath() + "] for reading", e); inputStream = null; } } return inputStream; }
Source:
public String getPrintString(IAdaptable element, int flags) { String elementType = null; if(element instanceof SemanticAdapter){ Object realObject = ((SemanticAdapter) element).getAdapter(EObject.class); if (realObject instanceof org.eclipse.uml2.uml.Class) { elementType = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) realObject), ConstraintBlock.class) != null ? "constraintBlock" : "block"; } } if (element instanceof EObjectAdapter) { Object realObject = ((EObjectAdapter) element).getRealObject(); if (realObject instanceof org.eclipse.uml2.uml.Class) { elementType = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) realObject), ConstraintBlock.class) != null ? "ConstraintBlock" : "Block"; } } return "par [" + elementType + "] " + super.getPrintString(element, flags); }

Target:
public String getPrintString(IAdaptable element, int flags) { String elementType = null; if(element instanceof SemanticAdapter){ Object realObject = ((SemanticAdapter) element).getAdapter(EObject.class); if (realObject instanceof org.eclipse.uml2.uml.Class) { elementType = UMLUtil.getStereotypeApplication(((org.eclipse.uml2.uml.Class) realObject), ConstraintBlock.class) != null ? "constraintBlock" : "block"; } } return "par [" + elementType + "] " + super.getPrintString(element, flags); }
Source:
public InvalidCursorException(final CursorError error, final NakadiCursor position) { super(); this.error = error; this.cursor = null; this.position = position; }

Target:
public InvalidCursorException(final CursorError error, final NakadiCursor position) { this.error = error; this.cursor = null; this.position = position; }
Source:
public void removeBlob(String container, String name) { String objManifest = getManifestInfo(container, name); String sloInfo = getSLOInfo(container, name); if (objManifest == null && sloInfo == null) api.getObjectApi(regionId, container).delete(name); else if (objManifest == null && sloInfo != null) { DeleteStaticLargeObjectResponse response = api.getStaticLargeObjectApi(regionId, container).delete(name); } else if (objManifest != null && sloInfo == null) { api.getObjectApi(regionId, container).delete(name); if (!Strings.isNullOrEmpty(objManifest)) { removeObjectsWithPrefix(objManifest); } } }

Target:
public void removeBlob(String container, String name) { DeleteStaticLargeObjectResponse response = api.getStaticLargeObjectApi(regionId, container).delete(name); if (!response.status().equals("200 OK")) { api.getObjectApi(regionId, container).delete(name); } }
Source:
public void doBeforeComposeChildren(final Component comp) throws Exception { if (comp.getPage() == null) { ((ComponentCtrl) comp).addCallback(ComponentCtrl.AFTER_PAGE_ATTACHED, new Callback() { public void call(Object data) { try { doBeforeComposeChildren(comp); } catch (Exception e) { throw UiException.Aide.wrap(e, e.getMessage()); } } }); return; } _viewModel = initViewModel(evalx, comp); _binder = initBinder(evalx, comp); if (!this.equals(_viewModel)) { Object vmProxy = _binder.createViewModelProxyIfEnabled(_viewModel); if (vmProxy != null) { _viewModel = vmProxy; comp.setAttribute((String) comp.getAttribute(VM_ID), vmProxy); } } ValidationMessages _vmsgs = initValidationMessages(evalx, comp, _binder); Selectors.wireVariables(comp, _viewModel, Selectors.newVariableResolvers(BindUtils.getViewModelClass(_viewModel), null)); if (_vmsgs != null) { _binder.setValidationMessages(_vmsgs); } try { BinderKeeper keeper = BinderKeeper.getInstance(comp); keeper.book(_binder, comp); _binder.init(comp, _viewModel, getViewModelInitArgs(evalx, comp)); } catch (Exception x) { throw MiscUtil.mergeExceptionInfo(x, comp); } ConventionWires.wireController(comp, this); }

Target:
public void doBeforeComposeChildren(final Component comp) throws Exception { if (comp.getPage() == null) { ((ComponentCtrl) comp).addCallback(ComponentCtrl.AFTER_PAGE_ATTACHED, new Callback() { public void call(Object data) { try { doBeforeComposeChildren(comp); } catch (Exception e) { throw UiException.Aide.wrap(e); } } }); return; } _viewModel = initViewModel(evalx, comp); _binder = initBinder(evalx, comp); if (!this.equals(_viewModel)) { Object vmProxy = _binder.createViewModelProxyIfEnabled(_viewModel); if (vmProxy != null) { _viewModel = vmProxy; comp.setAttribute((String) comp.getAttribute(VM_ID), vmProxy); } } ValidationMessages _vmsgs = initValidationMessages(evalx, comp, _binder); Selectors.wireVariables(comp, _viewModel, Selectors.newVariableResolvers(BindUtils.getViewModelClass(_viewModel), null)); if (_vmsgs != null) { _binder.setValidationMessages(_vmsgs); } try { BinderKeeper keeper = BinderKeeper.getInstance(comp); keeper.book(_binder, comp); _binder.init(comp, _viewModel, getViewModelInitArgs(evalx, comp)); } catch (Exception x) { throw MiscUtil.mergeExceptionInfo(x, comp); } ConventionWires.wireController(comp, this); }
Source:
public static final void setPreferenceNodeId (String id) { if (fgPreferenceNodeId == null || id == null) { fgPreferenceNodeId= id; } else { Assert.isTrue(false, "Preference node already set"); } }

Target:
public static final void setPreferenceNodeId (String id) { Assert.isLegal(fgPreferenceNodeId == null || id == null, "Preference node already set"); fgPreferenceNodeId= id; }
Source:
public void disconnect(){ }

Target:
public void disconnect() { if (fafConnectionTask != null) { fafConnectionTask.cancel(true); } }
Source:
private void createGrid() { GridOperator.traverseGrid((i, j) -> { gridGroup.getChildren().add(createCell(i, j)); return 0; }); gridGroup.getStyleClass().add("game-grid"); hBottom.getStyleClass().add("game-backGrid"); gridGroup.setManaged(false); gridGroup.setLayoutX(BORDER_WIDTH); gridGroup.setLayoutY(BORDER_WIDTH); hBottom.setMinSize(GRID_WIDTH, GRID_WIDTH); hBottom.setPrefSize(GRID_WIDTH, GRID_WIDTH); hBottom.setMaxSize(GRID_WIDTH, GRID_WIDTH); Rectangle rect = new Rectangle(GRID_WIDTH, GRID_WIDTH); hBottom.setClip(rect); hBottom.getChildren().add(gridGroup); vGame.getChildren().add(hBottom); getChildren().add(0, vGame); }

Target:
private void createGrid() { GridOperator.traverseGrid((xPosition, yPosition) -> { gridGroup.getChildren().add(createCell(xPosition, yPosition)); return 0; }); gridGroup.getStyleClass().add("game-grid"); hBottom.getStyleClass().add("game-backGrid"); gridGroup.setManaged(false); gridGroup.setLayoutX(BORDER_WIDTH); gridGroup.setLayoutY(BORDER_WIDTH); hBottom.setMinSize(GRID_WIDTH, GRID_WIDTH); hBottom.setPrefSize(GRID_WIDTH, GRID_WIDTH); hBottom.setMaxSize(GRID_WIDTH, GRID_WIDTH); Rectangle rect = new Rectangle(GRID_WIDTH, GRID_WIDTH); hBottom.setClip(rect); hBottom.getChildren().add(gridGroup); vGame.getChildren().add(hBottom); getChildren().add(0, vGame); }
Source:
public static LimitPlanNode toPlanNode(RexNode limit, RexNode offset) { LimitPlanNode lpn = new LimitPlanNode(); if (limit != null) { if (limit instanceof RexDynamicParam) { lpn.setLimit(-1); lpn.setLimitParameterIndex(RexConverter.getParameterIndex()); RexConverter.setParameterIndex(RexConverter.getParameterIndex() + 1); } else { lpn.setLimit(RexLiteral.intValue(limit)); } } if (offset != null) { if (offset instanceof RexDynamicParam) { lpn.setOffset(0); lpn.setOffsetParameterIndex(RexConverter.getParameterIndex()); RexConverter.setParameterIndex(RexConverter.getParameterIndex() + 1); } else { lpn.setOffset(RexLiteral.intValue(offset)); } } return lpn; }

Target:
public static LimitPlanNode toPlanNode(RexNode limit, RexNode offset) { LimitPlanNode lpn = new LimitPlanNode(); if (limit != null) { if (limit instanceof RexDynamicParam) { lpn.setLimit(-1); lpn.setLimitParameterIndex(RexConverter.getAndIncrementParameterIndex()); } else { lpn.setLimit(RexLiteral.intValue(limit)); } } if (offset != null) { if (offset instanceof RexDynamicParam) { lpn.setOffset(0); lpn.setOffsetParameterIndex(RexConverter.getAndIncrementParameterIndex()); } else { lpn.setOffset(RexLiteral.intValue(offset)); } } return lpn; }
Source:
public void verifySwapVideo() { this.waitForElementByElement(swapCount); int initialCount = Integer.parseInt(swapCount.getText()); this.waitForElementByElement(firstSwapButton); firstSwapButton.click(); this.waitForTextToBePresentInElementByElement(swapCount, String.valueOf(initialCount-1)); PageObjectLogging.log("verifyClickSwap", "Swap button has been clicked", true); }

Target:
public void verifySwapVideo() { waitForElementByElement(swapCount); int initialCount = Integer.parseInt(swapCount.getText()); waitForElementByElement(firstSwapButton); scrollAndClick(firstSwapButton); waitForTextToBePresentInElementByElement(swapCount, String.valueOf(initialCount-1)); PageObjectLogging.log("verifyClickSwap", "Swap button has been clicked", true); }
Source:
public Response getDatabaseSegments( @Context final HttpServletRequest req, @QueryParam("datasources") final Set<String> datasources ) { Collection<ImmutableDruidDataSource> druidDataSources = metadataSegmentManager.getDataSources(); if (datasources != null && !datasources.isEmpty()) { druidDataSources = druidDataSources.stream() .filter(src -> datasources.contains(src.getName())) .collect(Collectors.toList()); } final Stream<DataSegment> metadataSegments = druidDataSources .stream() .flatMap(t -> t.getSegments().stream()); final Function<DataSegment, Iterable<ResourceAction>> raGenerator = segment -> Collections.singletonList( AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(segment.getDataSource())); final Iterable<DataSegment> authorizedSegments = AuthorizationUtils.filterAuthorizedResources(req, metadataSegments::iterator, raGenerator, authorizerMapper); final StreamingOutput stream = outputStream -> { final JsonFactory jsonFactory = jsonMapper.getFactory(); try (final JsonGenerator jsonGenerator = jsonFactory.createGenerator(outputStream)) { jsonGenerator.writeStartArray(); for (DataSegment ds : authorizedSegments) { jsonGenerator.writeObject(ds); jsonGenerator.flush(); } jsonGenerator.writeEndArray(); } }; Response.ResponseBuilder builder = Response.status(Response.Status.OK); return builder.entity(stream).build(); }

Target:
public Response getDatabaseSegments( @Context final HttpServletRequest req, @QueryParam("datasources") final Set<String> datasources ) { Collection<ImmutableDruidDataSource> druidDataSources = Optional.ofNullable(metadataSegmentManager.getDataSources()) .orElse(Collections.emptyList()); Stream<ImmutableDruidDataSource> dataSourceStream = druidDataSources.stream(); if (datasources != null && !datasources.isEmpty()) { dataSourceStream = dataSourceStream.filter(src -> datasources.contains(src.getName())); } final Stream<DataSegment> metadataSegments = dataSourceStream.flatMap(t -> t.getSegments().stream()); final Function<DataSegment, Iterable<ResourceAction>> raGenerator = segment -> Collections.singletonList( AuthorizationUtils.DATASOURCE_READ_RA_GENERATOR.apply(segment.getDataSource())); final Iterable<DataSegment> authorizedSegments = AuthorizationUtils.filterAuthorizedResources(req, metadataSegments::iterator, raGenerator, authorizerMapper); final Response.ResponseBuilder builder = Response.status(Response.Status.OK); return builder.entity(authorizedSegments).build(); }
Source:
public void testAlwaysMeteredVpnWithNonNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = ensureWifiConnected(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = new ArrayList<>(1); underlyingNetworks.add(wifi); String allowedApps = mPackageName; boolean isAlwaysMetered = true; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }

Target:
public void testAlwaysMeteredVpnWithNonNullUnderlyingNetwork() throws Exception { if (!supportedHardware()) { return; } Network wifi = getWifiNetwork(); assertEquals(wifi, mCM.getActiveNetwork()); ArrayList<Network> underlyingNetworks = new ArrayList<>(1); underlyingNetworks.add(wifi); String allowedApps = mPackageName; boolean isAlwaysMetered = true; startVpn( new String[] {"192.0.2.2/32", "2001:db8:1:2::ffe/128"}, new String[] {"0.0.0.0/0", "::/0"}, allowedApps, "", null, underlyingNetworks, isAlwaysMetered); assertEquals(mNetwork, mCM.getActiveNetwork()); ensureVpnTransportContains(NetworkCapabilities.TRANSPORT_WIFI); assertTrue(isNetworkMetered(mNetwork)); assertTrue(mCM.isActiveNetworkMetered()); }
Source:
private File getNextLogFile(String logDir, Long currentTime, boolean fromSaveState, File currFile) { File[] dirFiles = new File(logDir).listFiles(new LogFilter(logFileName, rotationPattern)); Comparator logfileComparator = new Comparator<LogFileTime>() { @Override public int compare(LogFileTime o1, LogFileTime o2) { int res = o1.getModificationTime().compareTo(o2.getModificationTime()); if (res != 0) { return res; } else { res = o2.getFileName().length() - o1.getFileName().length(); } return (res != 0) ? res : o2.getFileName().compareTo(o1.getFileName()); } }; TreeMap<LogFileTime, File> logFilesTimesMap = new TreeMap<LogFileTime, File>(logfileComparator); for (File f : dirFiles) { logFilesTimesMap.put(new LogFileTime(f.lastModified(), f.getName()), f); } if (currentTime == 0 && logFilesTimesMap.size() > 0) { return logFilesTimesMap.firstEntry().getValue(); } if (fromSaveState && logFilesTimesMap.containsKey(new LogFileTime(currentTime, currFile.getName()))) { return logFilesTimesMap.get(new LogFileTime(currentTime, currFile.getName())); } else { boolean currentFileChanged = true; for (LogFileTime logFileTime : logFilesTimesMap.keySet()) { if (logFileTime.getModificationTime().equals(currentTime)) { currentFileChanged = false; break; } } if (currentFileChanged && logFilesTimesMap.higherKey(new LogFileTime(currentTime, currFile.getName())) == null) { return null; } LogFileTime key = logFilesTimesMap.higherKey(new LogFileTime(currentTime, currFile.getName())); return key == null ? null : logFilesTimesMap.get(key); } }

Target:
private File getNextLogFile(String logDir, Long currentTime, boolean fromSaveState, File currFile) { File[] dirFiles = new File(logDir).listFiles(new LogFilter(logFileName, rotationPattern)); TreeMap<LogFileTime, File> logFilesTimesMap = new TreeMap<LogFileTime, File>(logFileComparator); for (File f : dirFiles) { logFilesTimesMap.put(new LogFileTime(f.lastModified(), f.getName()), f); } if (currentTime == 0 && logFilesTimesMap.size() > 0) { return logFilesTimesMap.firstEntry().getValue(); } if (fromSaveState && logFilesTimesMap.containsKey(new LogFileTime(currentTime, currFile.getName()))) { return logFilesTimesMap.get(new LogFileTime(currentTime, currFile.getName())); } boolean currentFileChanged = true; for (LogFileTime logFileTime : logFilesTimesMap.keySet()) { if (logFileTime.getModificationTime().equals(currentTime)) { currentFileChanged = false; break; } } if (currentFileChanged && logFilesTimesMap.higherKey(new LogFileTime(currentTime, currFile.getName())) == null) { return null; } LogFileTime key = logFilesTimesMap.higherKey(new LogFileTime(currentTime, currFile.getName())); return key == null ? null : logFilesTimesMap.get(key); }
Source:
public ImmutableValue<Boolean> sneaking() { return new ImmutableSpongeValue<Boolean>(Keys.IS_SNEAKING, false, this.value); }

Target:
public ImmutableValue<Boolean> sneaking() { return ImmutableDataCachingUtil.getValue(ImmutableSpongeValue.class, Keys.IS_SNEAKING, this.value, false); }
Source:
public void changeEvent(int type) { String currUri = null; int currIndex = 0; IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); if (connection != null) { currUri = connection.getUri(); } int index = 0; for (int i = 0; i < connections.length; ++i) { if (currUri.equals(connections[i].getUri())) { index = i; } } if (type == IDockerConnectionManagerListener.RENAME_EVENT) { index = currIndex; } if (connections.length > 0 && type != IDockerConnectionManagerListener.REMOVE_EVENT) { setConnection(connections[index]); } else { setConnection(null); } }

Target:
public void changeEvent(int type) { String currUri = null; int currIndex = 0; IDockerConnection[] connections = DockerConnectionManager.getInstance() .getConnections(); if (connection != null) { currUri = connection.getUri(); } int index = 0; for (int i = 0; i < connections.length; ++i) { if (connections[i].getUri() != null && connections[i].getUri().equals(currUri)) { index = i; } } if (type == IDockerConnectionManagerListener.RENAME_EVENT) { index = currIndex; } if (connections.length > 0 && type != IDockerConnectionManagerListener.REMOVE_EVENT) { setConnection(connections[index]); } else { setConnection(null); } }
Source:
public void shouldNotDeleteEncounterTypeWhenEncounterTypesAreLocked() throws Exception { executeDataSet("org/openmrs/web/encounter/include/EncounterTypeFormControllerTest.xml"); EncounterService es = Context.getEncounterService(); EncounterTypeFormController controller = (EncounterTypeFormController) applicationContext .getBean("encounterTypeForm"); controller.setApplicationContext(applicationContext); controller.setSuccessView("index.htm"); controller.setFormView("EncounterType.form"); MockHttpServletRequest request = new MockHttpServletRequest("GET", "/admin/encounters/encounterType.form?encounterTypeId=1"); request.setSession(new MockHttpSession(null)); HttpServletResponse response = new MockHttpServletResponse(); controller.handleRequest(request, response); request.setMethod("POST"); request.addParameter("action", "Delete EncounterType"); ModelAndView mav = controller.handleRequest(request, response); Assert.assertNotSame("The purge attempt should have failed!", "index.htm", mav.getViewName()); Assert.assertNotNull(es.getEncounterType(1)); }

Target:
public void shouldNotDeleteEncounterTypeWhenEncounterTypesAreLocked() throws Exception { executeDataSet("org/openmrs/web/encounter/include/EncounterTypeFormControllerTest.xml"); EncounterService es = Context.getEncounterService(); EncounterTypeFormController controller = (EncounterTypeFormController) applicationContext .getBean("encounterTypeForm"); controller.setApplicationContext(applicationContext); controller.setSuccessView("index.htm"); controller.setFormView("EncounterType.form"); MockHttpServletRequest request = new MockHttpServletRequest("GET", "/admin/encounters/encounterType.form?encounterTypeId=1"); request.setSession(new MockHttpSession(null)); HttpServletResponse response = new MockHttpServletResponse(); controller.handleRequest(request, response); request.setMethod("POST"); request.addParameter("action", "Delete EncounterType"); ModelAndView mav = controller.handleRequest(request, response); Assert.assertEquals("The purge attempt should have failed!", "EncounterType.form", mav.getViewName()); Assert.assertSame(controller.getFormView(), mav.getViewName()); Assert.assertNotNull(es.getEncounterType(1)); }
Source:
public static String imageRef(IBuild build) { final String kind = build.getOutputKind(); if (ResourceKind.IMAGE_STREAM_TAG.equals(kind) || IMAGE_STREAM_IMAGE_KIND.equals(kind)) { return build.getOutputTo().getNameAndTag(); } if (DOCKER_IMAGE_KIND.equals(kind)) { return build.getOutputTo().getNameAndTag().toString(); } return ""; }

Target:
public static String imageRef(IBuild build) { if(build != null) { switch(build.getOutputKind()) { case ResourceKind.IMAGE_STREAM_TAG: case IMAGE_STREAM_IMAGE_KIND: case DOCKER_IMAGE_KIND: return build.getOutputTo().getNameAndTag(); } } return ""; }
Source:
public void stringsDifferWithUserMessage() { try { assertEquals("not equal", "one", "two"); } catch (AssertionError exception) { assertEquals("not equal expected:<[one]> but was:<[two]>", exception.getMessage()); return; } failAssertionErrorExpected(); }

Target:
public void stringsDifferWithUserMessage() { try { assertEquals("not equal", "one", "two"); } catch (ComparisonFailure exception) { assertEquals("not equal expected:<[one]> but was:<[two]>", exception.getMessage()); return; } throw new AssertionError(ASSERTION_ERROR_EXPECTED); }
Source:
public String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType) throws IOException { String hostPortString = address.getHostString() + address.getPort(); Integer count = connectionIdToCount.get(hostPortString); if (count != null) { count++; } else { count = 1; } connectionIdToCount.put(hostPortString, count); String connectionId = hostPortString + index++; connections.add(connectionId); return connectionId; }

Target:
public String connect(InetSocketAddress address, int sendBufferSize, int receiveBufferSize, PortType portType) throws IOException { String hostPortString = address.getHostString() + address.getPort(); Integer count = connectionIdToCount.get(hostPortString); if (count != null) { count++; } else { count = 1; } connectionIdToCount.put(hostPortString, count); String connectionId = hostPortString + count; connections.add(connectionId); return connectionId; }
Source:
public void setup(OperatorContext context) { super.setup(context); try { if (getFieldInfos() == null) { LOG.info("Assuming direct mapping between POJO fields and DB columns"); populateColumnDataTypes(null); } else { StringBuilder columns = new StringBuilder(); StringBuilder values = new StringBuilder(); for (int i = 0; i < getFieldInfos().size(); i++) { columns.append(getFieldInfos().get(i).getColumnName()); values.append("?"); if (i < getFieldInfos().size() - 1) { columns.append(","); values.append(","); } } populateColumnDataTypes(columns.toString()); } } catch (SQLException e) { throw new RuntimeException(e); } }

Target:
public void setup(OperatorContext context) { super.setup(context); try { if (getFieldInfos() == null) { LOG.info("FieldInfo missing. Assuming direct mapping between POJO fields and DB columns"); populateColumnDataTypes(null); } else { StringBuilder columns = new StringBuilder(); StringBuilder values = new StringBuilder(); for (int i = 0; i < getFieldInfos().size(); i++) { columns.append(getFieldInfos().get(i).getColumnName()); values.append("?"); if (i < getFieldInfos().size() - 1) { columns.append(","); values.append(","); } } populateColumnDataTypes(columns.toString()); } } catch (SQLException e) { throw new RuntimeException(e); } }
Source:
private Optional<FloatingIP> allocateFloatingIPForNode(FloatingIPApi floatingIpApi, Optional<Set<String>> poolNames, String nodeID) { FloatingIP ip = null; if (poolNames.isPresent()){ for (String poolName : poolNames.get()){ try { logger.debug(">> allocating floating IP from pool %s for node(%s)", poolName, nodeID); ip = floatingIpApi.allocateFromPool(poolName); if (ip != null){ break; } } catch (InsufficientResourcesException ire){ logger.trace("<< [%s] failed to allocate floating IP from pool %s for node(%s)", ire.getMessage(), poolName, nodeID); } } } if (ip == null){ try { logger.debug(">> creating floating IP for node(%s)", nodeID); ip = floatingIpApi.create(); } catch (InsufficientResourcesException ire){ logger.trace("<< [%s] failed to create floating IP for node(%s)", ire.getMessage(), nodeID); } } if (ip == null){ logger.trace(">> searching for existing, unassigned floating IP for node(%s)", nodeID); List<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpApi.list(), new Predicate<FloatingIP>() { @Override public boolean apply(FloatingIP arg0) { return arg0.getFixedIp() == null; } })); Collections.shuffle(unassignedIps); ip = Iterables.getLast(unassignedIps); } return Optional.fromNullable(ip); }

Target:
private Optional<FloatingIP> allocateFloatingIPForNode(FloatingIPApi floatingIpApi, Optional<Set<String>> poolNames, String nodeID) { FloatingIP ip = null; if (poolNames.isPresent()) { for (String poolName : poolNames.get()){ try { logger.debug(">> allocating floating IP from pool %s for node(%s)", poolName, nodeID); ip = floatingIpApi.allocateFromPool(poolName); if (ip != null) return Optional.of(ip); } catch (InsufficientResourcesException ire){ logger.trace("<< [%s] failed to allocate floating IP from pool %s for node(%s)", ire.getMessage(), poolName, nodeID); } } } try { logger.debug(">> creating floating IP for node(%s)", nodeID); ip = floatingIpApi.create(); if(ip != null) return Optional.of(ip); } catch (InsufficientResourcesException ire){ logger.trace("<< [%s] failed to create floating IP for node(%s)", ire.getMessage(), nodeID); } logger.trace(">> searching for existing, unassigned floating IP for node(%s)", nodeID); List<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpApi.list(), new Predicate<FloatingIP>() { @Override public boolean apply(FloatingIP arg0) { return arg0.getFixedIp() == null; } })); Collections.shuffle(unassignedIps); ip = Iterables.getLast(unassignedIps); return Optional.fromNullable(ip); }
Source:
public void evict(WrappedBytes key) { Lock lock = locks.getLock(key).writeLock(); lock.lock(); try { checkDeallocation(); long address = memoryLookup.getMemoryAddress(key); if (address != 0) { InternalCacheEntry<WrappedBytes, WrappedBytes> ice = performGet(address, key); passivator.passivate(ice); performRemove(address, key); } } finally { lock.unlock(); } }

Target:
public void evict(WrappedBytes key) { Lock lock = locks.getLock(key).writeLock(); lock.lock(); try { checkDeallocation(); long address = memoryLookup.getMemoryAddress(key); if (address != 0) { InternalCacheEntry<WrappedBytes, WrappedBytes> ice = performGet(address, key); if (ice != null) { passivator.passivate(ice); performRemove(address, key); } } } finally { lock.unlock(); } }
Source:
protected void executeCommand() { setCommandStatus(CommandStatus.ACTIVE_ASYNC); Guid taskId = persistAsyncTaskPlaceHolder(VdcActionType.DestroyImage); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { getParameters().setVdsmTaskIds(new ArrayList<Guid>()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), VdcActionType.DestroyImage, VdcObjectType.Storage, getParameters().getStorageDomainId()); getReturnValue().getInternalVdsmTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); getParameters().getVdsmTaskIds().add(result); setSucceeded(vdsReturnValue.getSucceeded()); setCommandStatus(CommandStatus.ACTIVE_ASYNC_EXECUTED); persistCommandWithContext(getParameters().getParentCommand(), true); log.info("Successfully started task to remove orphaned volumes resulting from live merge"); } else { setSucceeded(false); setCommandStatus(CommandStatus.FAILED); } }

Target:
protected void executeCommand() { setCommandStatus(CommandStatus.ACTIVE_ASYNC); Guid taskId = persistAsyncTaskPlaceHolder(VdcActionType.DestroyImage); VDSReturnValue vdsReturnValue = runVdsCommand(VDSCommandType.DestroyImage, createVDSParameters()); if (vdsReturnValue != null && vdsReturnValue.getCreationInfo() != null) { getParameters().setVdsmTaskIds(new ArrayList<Guid>()); Guid result = createTask(taskId, vdsReturnValue.getCreationInfo(), VdcActionType.DestroyImage, VdcObjectType.Storage, getParameters().getStorageDomainId()); getReturnValue().getInternalVdsmTaskIdList().add(result); getReturnValue().getVdsmTaskIdList().add(result); getParameters().getVdsmTaskIds().add(result); setSucceeded(vdsReturnValue.getSucceeded()); persistCommandWithContext(getParameters().getParentCommand(), true); log.info("Successfully started task to remove orphaned volumes resulting from live merge"); } else { setSucceeded(false); setCommandStatus(CommandStatus.FAILED); } }
Source:
public UserBasedBlacklist(Path source, CoreNode core, MutablePointers mutable, ContentAddressedStorage dht) { this.source = source; this.core = core; this.mutable = mutable; this.dht = dht; pool.submit(() -> { while (true) { updateBlackList(); try { Thread.sleep(5000); } catch (InterruptedException e) } }); }

Target:
public UserBasedBlacklist(Path source, CoreNode core, MutablePointers mutable, ContentAddressedStorage dht) { this.source = source; this.core = core; this.mutable = mutable; this.dht = dht; pool.submit(() -> { while (true) { try { updateBlackList(); } catch (Throwable t) { t.printStackTrace(); } try { Thread.sleep(5000); } catch (InterruptedException e) } }); }
Source:
public void onGetSmeltingResult(ItemStack stack, CallbackInfoReturnable<ItemStack> cir) { ItemStackSnapshot ingredient = ItemStackUtil.snapshotOf(stack); Optional<SmeltingResult> result = getCustomResult(ingredient); if (result.isPresent()) { ItemStack nativeResult = ItemStackUtil.fromSnapshotToNative(result.get().getResult()); cir.setReturnValue(nativeResult); } }

Target:
private void onGetSmeltingResult(ItemStack stack, CallbackInfoReturnable<ItemStack> cir) { ItemStackSnapshot ingredient = ItemStackUtil.snapshotOf(stack); Optional<SmeltingResult> result = getCustomResult(ingredient); if (result.isPresent()) { ItemStack nativeResult = ItemStackUtil.fromSnapshotToNative(result.get().getResult()); cir.setReturnValue(nativeResult); } }
Source:
Optional<DataType> lookupAbsoluteParent(final DataType reference) { final Optional<DataType> optionalParent = Optional.ofNullable(parent(reference)); if (optionalParent.isPresent()) { final DataType parent = optionalParent.get(); if (parent.getType().equals(dataTypeManager.structure())) { return Optional.of(parent); } else { return dataTypeStore .getTopLevelDataTypes() .stream() .filter(dataType -> dataType.getName().equals(parent.getType())) .findFirst(); } } return Optional.empty(); }

Target:
Optional<DataType> lookupAbsoluteParent(final DataType reference) { final Optional<DataType> optionalParent = Optional.ofNullable(parent(reference)); if (optionalParent.isPresent()) { return fetchTopLevelDataType(optionalParent.get()); } return Optional.empty(); }
Source:
private boolean isEmptyCollection(Expression expr) { return (expr instanceof ListExpression && ((ListExpression) expr).getExpressions().size() == 0) || (expr instanceof MapExpression && ((MapExpression) expr).getMapEntryExpressions().size() == 0); }

Target:
private static boolean isEmptyCollection(Expression expr) { return (expr instanceof ListExpression && ((ListExpression) expr).getExpressions().size() == 0) || (expr instanceof MapExpression && ((MapExpression) expr).getMapEntryExpressions().size() == 0); }
Source:
static void readMappingFile(VolumeManager fs, ImportedTableInfo tableInfo, String importDir, Map<String,String> fileNameMappings) throws Exception { try (BufferedReader in = new BufferedReader( new InputStreamReader(fs.open(new Path(importDir, "mappings.txt")), UTF_8))) { String line, prev; while ((line = in.readLine()) != null) { String[] sa = line.split(":", 2); prev = fileNameMappings.put(sa[0], importDir + "/" + sa[1]); if (prev != null) { String msg = "File exists in multiple import directories: '" + sa[0] + "'"; log.warn(msg); throw new AcceptableThriftTableOperationException(tableInfo.tableId.canonical(), tableInfo.tableName, TableOperation.IMPORT, TableOperationExceptionType.OTHER, msg); } } } }

Target:
static void readMappingFile(VolumeManager fs, ImportedTableInfo tableInfo, String importDir, Map<String,String> fileNameMappings) throws Exception { try (BufferedReader in = new BufferedReader( new InputStreamReader(fs.open(new Path(importDir, "mappings.txt")), UTF_8))) { String line, prev; while ((line = in.readLine()) != null) { String[] sa = line.split(":", 2); prev = fileNameMappings.put(sa[0], importDir + "/" + sa[1]); if (prev != null) { String msg = "File exists in multiple import directories: '" + sa[0].replaceAll("[\r\n]", "") + "'"; log.warn(msg); throw new AcceptableThriftTableOperationException(tableInfo.tableId.canonical(), tableInfo.tableName, TableOperation.IMPORT, TableOperationExceptionType.OTHER, msg); } } } }
Source:
public void openEmailClient() { if (WPActivityUtils.isEmailClientAvailable(this)) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_OPEN_EMAIL_CLIENT_VIEWED); WPActivityUtils.openEmailClient(this); } else { ToastUtils.showToast(this, R.string.login_email_client_not_found); } }

Target:
public void openEmailClient() { if (WPActivityUtils.isEmailClientAvailable(this)) { AnalyticsTracker.track(AnalyticsTracker.Stat.LOGIN_MAGIC_LINK_OPEN_EMAIL_CLIENT_CLICKED); WPActivityUtils.openEmailClient(this); } else { ToastUtils.showToast(this, R.string.login_email_client_not_found); } }
Source:
public ModelAndView showNewCodeReviewPage(@RequestParam(BRANCH_ID) Long branchId) throws NotFoundException { TopicDto dto; TopicDraft draft = topicDraftService.getDraft(); if (draft != null) { dto = new TopicDto(draft); } else { Topic topic = new Topic(); topic.setPoll(new Poll()); dto = new TopicDto(topic); } Branch branch = branchService.get(branchId); dto.getTopic().setBranch(branch); return new ModelAndView(CODE_REVIEW_VIEW) .addObject(TOPIC_DTO, dto) .addObject(BRANCH_ID, branchId) .addObject(SUBMIT_URL, "/reviews/new?branchId=" + branchId) .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getNewTopicBreadcrumb(branch)); }

Target:
public ModelAndView showNewCodeReviewPage(@RequestParam(BRANCH_ID) Long branchId) throws NotFoundException { TopicDraft draft = ObjectUtils.defaultIfNull( topicDraftService.getDraft(), new TopicDraft()); TopicDto dto = new TopicDto(draft); Branch branch = branchService.get(branchId); dto.getTopic().setBranch(branch); return new ModelAndView(CODE_REVIEW_VIEW) .addObject(TOPIC_DTO, dto) .addObject(BRANCH_ID, branchId) .addObject(SUBMIT_URL, "/reviews/new?branchId=" + branchId) .addObject(BREADCRUMB_LIST, breadcrumbBuilder.getNewTopicBreadcrumb(branch)); }
Source:
protected Resource getSelectedResource(final ISelection currentSelection) { Resource resource = null; if (currentSelection instanceof StructuredSelection && ((StructuredSelection) currentSelection).size() == 1) { final Object selectedElement = ((StructuredSelection) currentSelection).getFirstElement(); if (selectedElement instanceof File && NattableConfigurationConstants.NATTABLE_CONFIGURATION_EXTENSION_FILE.equals(((File) selectedElement).getFileExtension())) { INattableModelManager manager = null; final IEditorPart currentPart = getActivePart().getSite().getPage().getActiveEditor(); if (null != currentPart) { manager = (INattableModelManager) currentPart.getAdapter(INattableModelManager.class); } if (null != manager) { resource = TableEditingDomainUtils.getTableEditingDomain(manager.getTable()).getResourceSet().getResource(URI.createFileURI(((File) selectedElement).getLocation().toString()), true); } } } return resource; }

Target:
protected Resource getSelectedResource(final ISelection currentSelection) { Resource resource = null; if (currentSelection instanceof StructuredSelection && 1 == ((StructuredSelection) currentSelection).size()) { final Object selectedElement = ((StructuredSelection) currentSelection).getFirstElement(); if (selectedElement instanceof File && NattableConfigurationConstants.NATTABLE_CONFIGURATION_EXTENSION_FILE.equals(((File) selectedElement).getFileExtension())) { INattableModelManager manager = null; final IEditorPart currentPart = getActivePart().getSite().getPage().getActiveEditor(); if (null != currentPart) { manager = (INattableModelManager) currentPart.getAdapter(INattableModelManager.class); } if (null != manager) { resource = TableEditingDomainUtils.getTableEditingDomain(manager.getTable()).getResourceSet().getResource(URI.createFileURI(((File) selectedElement).getLocation().toString()), true); } } } return resource; }
Source:
public void stopNavigation() { clickRouteCancel(); }

Target:
public void stopNavigation() { mapRouteInfoMenu.hide(); if (mapActivity.getRoutingHelper().isFollowingMode()) { mapActivity.getMapActions().stopNavigationActionConfirm(); } else { mapActivity.getMapActions().stopNavigationWithoutConfirm(); } }
Source:
public final Map<String, Object> getGeocodedData(final String ip) { InetAddress ipAddress = null; Map<String, Object> geoData = getDefaultMap(); try { ipAddress = InetAddress.getByName(ip); } catch (UnknownHostException hEx) { Log.warn(hEx); return geoData; } CityResponse response = null; try { response = databaseReader.city(ipAddress); } catch (IOException iEx) { Log.warn(iEx); return geoData; } catch (GeoIp2Exception gEx) { Log.warn(gEx); return geoData; } if (response == null) return geoData; Continent continent = response.getContinent(); if (continent != null && continent.getName() != null) geoData.put(CONTINENT, continent.getName()); Country country = response.getCountry(); if (country != null && country.getIsoCode() != null) { geoData.put(COUNTRY_CODE, country.getIsoCode()); geoData.put(COUNTRY, country.getName()); } List<Subdivision> subdivisions = response.getSubdivisions(); if (subdivisions != null && subdivisions.size() > 0) { geoData.put(SUB_DIVISION, subdivisions.get(0).getName()); } City city = response.getCity(); if (city != null && city.getName() != null) geoData.put(CITY, city.getName()); Postal postal = response.getPostal(); if (postal != null && postal.getCode() != null) geoData.put(POSTAL_CODE, postal.getCode()); Location location = response.getLocation(); if (location != null) { geoData.put(LATITUDE, location.getLatitude()); geoData.put(LONGITUDE, location.getLongitude()); if (location.getTimeZone() != null) geoData.put(TIME_ZONE, location.getTimeZone()); } return geoData; }

Target:
public final Map<String, Object> getGeocodedData(final String ip) { InetAddress ipAddress = null; Map<String, Object> geoData = getDefaultMap(); try { ipAddress = InetAddress.getByName(ip); } catch (UnknownHostException hEx) { LOG.warn(hEx); return geoData; } CityResponse response = null; try { response = databaseReader.city(ipAddress); } catch (IOException iEx) { LOG.warn(iEx); return geoData; } catch (GeoIp2Exception gEx) { LOG.warn(gEx); return geoData; } if (response == null) return geoData; Continent continent = response.getContinent(); if (continent != null && continent.getName() != null) geoData.put(CONTINENT, continent.getName()); Country country = response.getCountry(); if (country != null && country.getIsoCode() != null) { geoData.put(COUNTRY_CODE, country.getIsoCode()); geoData.put(COUNTRY, country.getName()); } List<Subdivision> subdivisions = response.getSubdivisions(); if (subdivisions != null && subdivisions.size() > 0) { geoData.put(SUBDIVISION, subdivisions.get(0).getName()); } City city = response.getCity(); if (city != null && city.getName() != null) geoData.put(CITY, city.getName()); Postal postal = response.getPostal(); if (postal != null && postal.getCode() != null) geoData.put(POSTAL_CODE, postal.getCode()); Location location = response.getLocation(); if (location != null) { geoData.put(LATITUDE, location.getLatitude()); geoData.put(LONGITUDE, location.getLongitude()); if (location.getTimeZone() != null) geoData.put(TIMEZONE, location.getTimeZone()); } return geoData; }
Source:
CosmosAsyncStoredProcedureResponse(ResourceResponse<StoredProcedure> response, CosmosAsyncContainer cosmosContainer) { super(response); if (response.getResource() != null) { super.setProperties(new CosmosStoredProcedureProperties(response)); storedProcedure = new CosmosAsyncStoredProcedure(this.getProperties().getId(), cosmosContainer); storedProcedureResponse = null; } else { storedProcedureResponse = null; storedProcedure = null; } }

Target:
CosmosAsyncStoredProcedureResponse(ResourceResponse<StoredProcedure> response, CosmosAsyncContainer cosmosContainer) { super(response); if (response.getResource() != null) { super.setProperties(new CosmosStoredProcedureProperties(response)); storedProcedure = new CosmosAsyncStoredProcedure(this.getProperties().getId(), cosmosContainer); } else { storedProcedure = null; } storedProcedureResponse = null; }
Source:
private Predicate createSearchPredicate(String filter, String searchTerm) { Predicate rootPredicate = Predicate.empty(); if (filter != null && !filter.trim().isEmpty()) { NugetODataFilterParserTemplate t = new NugetODataFilterParserTemplate(rootPredicate); rootPredicate = t.parseFilterExpression(filter); } if (searchTerm != null && !searchTerm.trim().isEmpty()) { rootPredicate.and(Predicate.of(ExpOperator.LIKE.of("artifactCoordinates.coordinates.Id", "%" + searchTerm + "%"))); } return rootPredicate; }

Target:
private Predicate createSearchPredicate(String filter, String searchTerm) { Predicate rootPredicate = Predicate.empty(); if (filter != null && !filter.trim().isEmpty()) { NugetODataFilterParserTemplate t = new NugetODataFilterParserTemplate(rootPredicate); rootPredicate = t.parseFilterExpression(filter); } if (searchTerm != null && !searchTerm.trim().isEmpty()) { rootPredicate.and(Predicate.of(ExpOperator.LIKE.of("artifactCoordinates.coordinates.id", "%" + searchTerm + "%"))); } return rootPredicate; }
Source:
public EObject apply(EObject input) { if (input != null) { EObject container = input.eContainer(); while (!(container instanceof RepresentationDescription || container instanceof RepresentationElementMapping || container instanceof RepresentationExtensionDescription)) { container = container.eContainer(); } return container; } else { return null; } }

Target:
public EObject apply(EObject input) { if (input != null) { EObject container = input.eContainer(); while (container != null && !isRelevant(container)) { container = container.eContainer(); } return container; } else { return null; } }
Source:
public void onFailure(SshPollValue val) { log.error("Chef attribute query did not respond as expected. exitcode={} stdout={} stderr={}", new Object[]{val.getExitStatus(), val.getStdout(), val.getStderr()}); for (AttributeSensor attribute : chefAttributeSensors) { if (!attribute.getName().startsWith(CHEF_ATTRIBUTE_PREFIX)) continue; entity.setAttribute(attribute, null); } }

Target:
public void onFailure(SshPollValue val) { log.error("Chef attribute query did not respond as expected. exitcode={} stdout={} stderr={}", new Object[]{val.getExitStatus(), val.getStdout(), val.getStderr()}); for (AttributeSensor attribute : chefAttributeSensors.values()) { if (!attribute.getName().startsWith(CHEF_ATTRIBUTE_PREFIX)) continue; entity.setAttribute(attribute, null); } }
Source:
public static void copyToFileAndClose(InputStream is, File file) throws IOException { OutputStream os = null; try { file.getParentFile().mkdirs(); os = new BufferedOutputStream(new FileOutputStream(file)); ByteStreams.copy(is, os); } finally { CloseQuietly.close(is); CloseQuietly.close(os); } }

Target:
public static void copyToFileAndClose(InputStream is, File file) throws IOException { file.getParentFile().mkdirs(); try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) { ByteStreams.copy(is, os); } finally { CloseQuietly.close(is); } }
Source:
public static ImmutableList<EnumConstant> addEnum( final ImmutableList<EnumConstant> enumConstants, final String newEnumValue) { ImmutableList.Builder<EnumConstant> builder = ImmutableList.builder(); if (hasContent(enumConstants)) { builder.addAll(enumConstants); } builder.add(new EnumConstant(newEnumValue)); return builder.build(); }

Target:
public static ImmutableList<EnumConstant> addEnum( final ImmutableList<EnumConstant> enumConstants, final String newEnumValue) { final ImmutableList.Builder<EnumConstant> builder = ImmutableList.builder(); if (hasContent(enumConstants)) { builder.addAll(enumConstants); } builder.add(new EnumConstant(newEnumValue)); return builder.build(); }