auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void beforeClass(final @Optional String testType) throws IOException { if (testType.equals("buckets")) { throw new SkipException("Skipping tests since jobs are disabled in Manta Buckets"); } ConfigContext config = new IntegrationTestConfigContext(); final String testName = this.getClass().getSimpleName(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestHelper.setupTestPath(config, mantaClient, testName, testType); IntegrationTestHelper.createTestBucketOrDirectory(mantaClient, testPathPrefix, testType); }

Target:
public void beforeClass(final @Optional String testType) throws IOException { if ("buckets".equals(testType)) { throw new SkipException("Skipping tests since jobs are disabled in Manta Buckets"); } ConfigContext config = new IntegrationTestConfigContext(); final String testName = this.getClass().getSimpleName(); mantaClient = new MantaClient(config); testPathPrefix = IntegrationTestHelper.setupTestPath(config, mantaClient, testName, testType); IntegrationTestHelper.createTestBucketOrDirectory(mantaClient, testPathPrefix, testType); }
Source:
public void focusWindow(String titleOrUrl) throws Exception { String curTitle = this.getWd().getTitle(); String curUrl = this.getWd().getCurrentUrl(); if (titleOrUrl.equals(curTitle) || titleOrUrl.equals(curUrl)) { candybean.log.warning("No focus was made because the given string matched the current title or URL: " + titleOrUrl); } else { Set<String> windowHandlesSet = this.getWd().getWindowHandles(); String[] windowHandles = windowHandlesSet.toArray(new String[] {""}); int i = 0; boolean windowFound = false; while (i < windowHandles.length && !windowFound) { WebDriver window = this.getWd().switchTo().window(windowHandles[i]); if (window.getTitle().equals(titleOrUrl) || window.getCurrentUrl().equals(titleOrUrl)) { windows.push(new Pair<Integer, String>(Integer.valueOf(i), this.getWd().getWindowHandle())); candybean.log.info("Focused by title or URL: " + titleOrUrl + " to window: " + windows.peek()); windowFound = true; } i++; } if (!windowFound) { this.getWd().switchTo().window(windows.peek().getY()); throw new Exception("The given focus window string matched no title or URL: " + titleOrUrl); } } }

Target:
public void focusWindow(String titleOrUrl) throws Exception { String curTitle = this.wd.getTitle(); String curUrl = this.wd.getCurrentUrl(); if (titleOrUrl.equals(curTitle) || titleOrUrl.equals(curUrl)) { candybean.log.warning("No focus was made because the given string matched the current title or URL: " + titleOrUrl); } else { Set<String> windowHandlesSet = this.wd.getWindowHandles(); String[] windowHandles = windowHandlesSet.toArray(new String[] {""}); int i = 0; boolean windowFound = false; while (i < windowHandles.length && !windowFound) { WebDriver window = this.wd.switchTo().window(windowHandles[i]); if (window.getTitle().equals(titleOrUrl) || window.getCurrentUrl().equals(titleOrUrl)) { windows.push(new Pair<Integer, String>(Integer.valueOf(i), this.wd.getWindowHandle())); candybean.log.info("Focused by title or URL: " + titleOrUrl + " to window: " + windows.peek()); windowFound = true; } i++; } if (!windowFound) { this.wd.switchTo().window(windows.peek().getY()); throw new Exception("The given focus window string matched no title or URL: " + titleOrUrl); } } }
Source:
public void assumeBookmarkSupport() { String version = session.run( "RETURN 1" ).consume().server().version(); System.out.println( version ); assumeTrue( version( version ).greaterThanOrEqual( v3_1_0 ) ); }

Target:
public void assumeBookmarkSupport() { String version = session.run( "RETURN 1" ).consume().server().version(); assumeTrue( version( version ).greaterThanOrEqual( v3_1_0 ) ); }
Source:
int count(String tableName, Connector conn) throws Exception { Scanner s = conn.createScanner(tableName, Authorizations.EMPTY); s.close(); return Iterators.size(s.iterator()); }

Target:
int count(String tableName, Connector conn) throws Exception { try (Scanner s = conn.createScanner(tableName, Authorizations.EMPTY)) { return Iterators.size(s.iterator()); } }
Source:
public void staticMethodsAreNotGenerated() { Set<String> staticMethods = Arrays.stream(TEST_CLASS_METHODS) .filter(method -> Modifier.isStatic(method.getModifiers())) .map(TestingUtils::methodToString) .collect(Collectors.toSet()); Set<String> generatedMethods = TestingUtils.extractMethods(AutoDelegate_TestClass.class); assertThat(generatedMethods, not(hasItems(staticMethods.toArray(new String[0])))); }

Target:
public void staticMethodsAreNotGenerated() { Set<String> staticMethods = extractTestClassMethods(Modifier::isStatic); Set<String> generatedMethods = TestingUtils.extractMethods(AutoDelegate_TestClass.class); assertThat(generatedMethods, not(hasItems(staticMethods.toArray(new String[0])))); }
Source:
public static BucketList create(List<Bucket> buckets) { return new AutoValue_BucketList(buckets); }

Target:
public static BucketList create(List<Bucket> buckets) { return new AutoValue_BucketList(ImmutableList.copyOf(buckets)); }
Source:
private void setupFocusHandling() { PlatformUI.getWorkbench().addWindowListener(new IWindowListener() { public void windowOpened(IWorkbenchWindow window) { } public void windowDeactivated(IWorkbenchWindow window) { } public void windowClosed(IWorkbenchWindow window) { } public void windowActivated(IWorkbenchWindow window) { if (rcs.doReschedule) rcs.schedule(); refreshJob.schedule(); } }); }

Target:
private void setupFocusHandling() { focusListener = new IWindowListener() { public void windowOpened(IWorkbenchWindow window) { } public void windowDeactivated(IWorkbenchWindow window) { } public void windowClosed(IWorkbenchWindow window) { } public void windowActivated(IWorkbenchWindow window) { if (rcs.doReschedule) rcs.schedule(); refreshJob.schedule(); } }; PlatformUI.getWorkbench().addWindowListener(focusListener); }
Source:
protected AbstractSiteMap processXml(URL sitemapUrl, InputSource is) throws UnknownFormatException { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(false); factory.setXIncludeAware(false); try { factory.setFeature("<LINK_0>", false); } catch (Exception e) { } DelegatorHandler handler = new DelegatorHandler(sitemapUrl, strict); try { SAXParser saxParser = factory.newSAXParser(); saxParser.getXMLReader().setEntityResolver(new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) { return new InputSource(new StringReader("")); } }); saxParser.parse(is, handler); return handler.getSiteMap(); } catch (IOException e) { UnknownFormatException ufe = new UnknownFormatException("Failed to parse " + sitemapUrl); ufe.initCause(e); throw ufe; } catch (SAXException e) { LOG.warn("Error parsing sitemap {}: {}", sitemapUrl, e.getMessage()); AbstractSiteMap sitemap = handler.getSiteMap(); if (allowPartial && sitemap != null) { LOG.warn("Processed broken/partial sitemap for '" + sitemapUrl + "'"); sitemap.setProcessed(true); return sitemap; } else { UnknownFormatException ufe = new UnknownFormatException("Failed to parse " + sitemapUrl); ufe.initCause(e); throw ufe; } } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } }

Target:
protected AbstractSiteMap processXml(URL sitemapUrl, InputSource is) throws UnknownFormatException { SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setValidating(false); factory.setXIncludeAware(false); try { factory.setFeature("<LINK_0>", false); } catch (Exception e) { throw new RuntimeException("Failed to configure XML parser: " + e.toString()); } DelegatorHandler handler = new DelegatorHandler(sitemapUrl, strict); try { SAXParser saxParser = factory.newSAXParser(); saxParser.getXMLReader().setEntityResolver(new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) { return new InputSource(new StringReader("")); } }); saxParser.parse(is, handler); return handler.getSiteMap(); } catch (IOException e) { UnknownFormatException ufe = new UnknownFormatException("Failed to parse " + sitemapUrl); ufe.initCause(e); throw ufe; } catch (SAXException e) { LOG.warn("Error parsing sitemap {}: {}", sitemapUrl, e.getMessage()); AbstractSiteMap sitemap = handler.getSiteMap(); if (allowPartial && sitemap != null) { LOG.warn("Processed broken/partial sitemap for '" + sitemapUrl + "'"); sitemap.setProcessed(true); return sitemap; } else { UnknownFormatException ufe = new UnknownFormatException("Failed to parse " + sitemapUrl); ufe.initCause(e); throw ufe; } } catch (ParserConfigurationException e) { throw new IllegalStateException(e); } }
Source:
public Object postProcess(Object bean, String beanName, Method method, List<Annotation> annotations) { String channelName = MessagingAnnotationUtils.resolveAttribute(annotations, AnnotationUtils.VALUE, String.class); Assert.hasText(channelName, "The channel ('value' attribute of @InboundChannelAdapter) can't be empty."); MessageSource<?> messageSource = null; try { messageSource = createMessageSource(bean, beanName, method); } catch (NoSuchBeanDefinitionException e) { return null; } MessageChannel channel = this.channelResolver.resolveDestination(channelName); SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); adapter.setOutputChannel(channel); adapter.setSource(messageSource); configurePollingEndpoint(adapter, annotations); return adapter; }

Target:
public Object postProcess(Object bean, String beanName, Method method, List<Annotation> annotations) { String channelName = MessagingAnnotationUtils.resolveAttribute(annotations, AnnotationUtils.VALUE, String.class); Assert.hasText(channelName, "The channel ('value' attribute of @InboundChannelAdapter) can't be empty."); MessageSource<?> messageSource = null; try { messageSource = createMessageSource(bean, beanName, method); } catch (NoSuchBeanDefinitionException e) { if (this.logger.isDebugEnabled()) { this.logger.debug("The bean for method [" + method + "] doesn't exist. " + "Mainly by the @Conditional reason."); } return null; } MessageChannel channel = this.channelResolver.resolveDestination(channelName); SourcePollingChannelAdapter adapter = new SourcePollingChannelAdapter(); adapter.setOutputChannel(channel); adapter.setSource(messageSource); configurePollingEndpoint(adapter, annotations); return adapter; }
Source:
protected String getPropertiesFilePath() { String propertiesFilePath = null; final String sValue = PropertyAccessor.getInstance().getPropertyFileLocation(); if (sValue != null && sValue.length() > 0) { if (sValue.endsWith("/") || sValue.endsWith("\\")) { propertiesFilePath = sValue; } else { final String sFileSeparator = System.getProperty("file.separator"); propertiesFilePath = sValue + sFileSeparator + FILE_NAME; } } else { LOG.error("Path to property files not found"); } return propertiesFilePath; }

Target:
protected String getPropertiesFilePath() { String propertiesFilePath = null; final String sValue = PropertyAccessor.getInstance().getPropertyFileLocation(); if (StringUtils.isNotEmpty(sValue)) { if (sValue.endsWith("/") || sValue.endsWith("\\")) { propertiesFilePath = sValue; } else { final String sFileSeparator = System.getProperty("file.separator"); propertiesFilePath = sValue + sFileSeparator + FILE_NAME; } } else { LOG.error("Path to property files not found"); } return propertiesFilePath; }
Source:
public synchronized void mutate(final Mutation mutation) throws IOException { if (closed) { throw new IllegalStateException("Cannot mutate when the BufferedMutator is closed."); } handleExceptions(); currentWriteBufferSize.addAndGet(mutation.heapSize()); ListenableFuture<? extends GeneratedMessage> future = batchExecutor.issueRequest(mutation); inflightOperations.add(future); Futures.addCallback(future, new AccountingFutureCallback(mutation, future)); boolean waited = false; while (inflightOperations.size() > maxInflightRpcCount || currentWriteBufferSize.get() > writeBufferSize) { waited = true; LOG.info("BufferedMutator is pausing: inflight operations: %d currentWriteBufferSize:%d", inflightOperations.size(), currentWriteBufferSize.get()); try { wait(MAX_WAIT_MILLIS); } catch (InterruptedException e) { } } if (waited) { handleExceptions(); } }

Target:
public void mutate(final Mutation mutation) throws IOException { ReadLock lock = mutationLock.readLock(); lock.lock(); try { if (closed) { throw new IllegalStateException("Cannot mutate when the BufferedMutator is closed."); } handleExceptions(); doMutation(mutation); } finally { lock.unlock(); } }
Source:
public static boolean isPublicKeyValid(String publicKey) { int i; i = publicKey.indexOf("\n"); if (i != -1 && i != publicKey.length()-1) { return false; } String[] words = publicKey.split("\\s+", 3); if (words.length < 2) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!isBase64(words[1].getBytes(Charset.forName("UTF-8")))) { return false; } return true; }

Target:
public static boolean isPublicKeyValid(String publicKey) { int i = publicKey.indexOf("\n"); if (i != -1 && i != publicKey.length()-1) { return false; } String[] words = publicKey.split("\\s+", 3); if (words.length < 2) { return false; } if (!words[0].matches("^[\\p{Alpha}\\p{Digit}-]*$")) { return false; } if (!isBase64(words[1].getBytes(Charset.forName("UTF-8")))) { return false; } return true; }
Source:
public void setLocked(boolean locked) { for (int i = 0; i < this.getQuantity(); i++) { if (this.getChild(i) instanceof TerrainQuad) { ((Terrain) getChild(i)).setLocked(locked); } else if (this.getChild(i) instanceof TerrainPatch) { if (locked) ((TerrainPatch) getChild(i)).lockMesh(); else ((TerrainPatch) getChild(i)).unlockMesh(); } } }

Target:
public void setLocked(boolean locked) { for (int i = 0; i < this.getQuantity(); i++) { if (this.getChild(i) instanceof TerrainQuad) { ((TerrainQuad) getChild(i)).setLocked(locked); } else if (this.getChild(i) instanceof TerrainPatch) { if (locked) ((TerrainPatch) getChild(i)).lockMesh(); else ((TerrainPatch) getChild(i)).unlockMesh(); } } }
Source:
public void testLoadOrderedPublicEvents_5() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_DESCR_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); String bodyResult = result.andReturn().getResponse().getContentAsString(); result.andExpect(status().isOk()); String[] expectedFreeContentsId = {"EVN25", "EVN21", "EVN20", "EVN194", "EVN193", "EVN192", "EVN191", "EVN23", "EVN24"}; int payloadSize = JsonPath.read(bodyResult, "$.payload.size()"); Assert.assertEquals(expectedFreeContentsId.length, payloadSize); for (int i = 0; i < expectedFreeContentsId.length; i++) { String expectedId = expectedFreeContentsId[i]; String extractedId = JsonPath.read(bodyResult, "$.payload[" + i + "].id"); Assert.assertEquals(expectedId, extractedId); } }

Target:
public void testLoadOrderedPublicEvents_5() throws Throwable { UserDetails user = new OAuth2TestUtils.UserBuilder("jack_bauer", "0x24") .withAuthorization(Group.FREE_GROUP_NAME, "tempRole", Permission.BACKOFFICE).build(); String accessToken = mockOAuthInterceptor(user); ResultActions result = mockMvc .perform(get("/plugins/cms/contents") .param("status", IContentService.STATUS_ONLINE) .param("sort", IContentManager.CONTENT_DESCR_FILTER_KEY) .param("direction", FieldSearchFilter.DESC_ORDER) .param("filters[0].attribute", IContentManager.ENTITY_TYPE_CODE_FILTER_KEY) .param("filters[0].operator", "eq") .param("filters[0].value", "EVN") .sessionAttr("user", user) .header("Authorization", "Bearer " + accessToken)); result.andDo(print()) .andExpect(status().isOk()) .andExpect(jsonPath("$.payload.size()", is(9))) .andExpect(jsonPath("$.payload[0].id", is("EVN25"))) .andExpect(jsonPath("$.payload[1].id", is("EVN21"))) .andExpect(jsonPath("$.payload[2].id", is("EVN20"))) .andExpect(jsonPath("$.payload[3].id", is("EVN194"))) .andExpect(jsonPath("$.payload[4].id", is("EVN193"))) .andExpect(jsonPath("$.payload[5].id", is("EVN192"))) .andExpect(jsonPath("$.payload[6].id", is("EVN191"))) .andExpect(jsonPath("$.payload[7].id", is("EVN23"))) .andExpect(jsonPath("$.payload[8].id", is("EVN24"))); }
Source:
public ElasticsearchTableHandle( @JsonProperty("schemaName") String schemaName, @JsonProperty("tableName") String tableName) { this.schemaTableName = new SchemaTableName(requireNonNull(schemaName.toLowerCase(ENGLISH), "schemaName is null"), requireNonNull(tableName.toLowerCase(ENGLISH), "tableName is null")); }

Target:
public ElasticsearchTableHandle( @JsonProperty("schemaName") String schemaName, @JsonProperty("tableName") String tableName) { requireNonNull(schemaName, "schemaName is null"); requireNonNull(tableName, "tableName is null"); this.schemaTableName = new SchemaTableName(schemaName.toLowerCase(ENGLISH), tableName.toLowerCase(ENGLISH)); }
Source:
public HomePage() { final GMap mapDefault = new GMap("mapPanelDefault"); add(mapDefault); final GMap map = new GMap("mapPanel"); add(map); List<GLatLng> markersToShow = new ArrayList<GLatLng>(); double minLat = -85.00; double maxLat = 85.00; double minLon = -180.00; double maxLon = 180.00; for(int i=0; i<1000; i++) { double latitude = minLat + (double)(Math.random() * ((maxLat - minLat) + 1)); double longitude = minLon + (double)(Math.random() * ((maxLon - minLon) + 1)); GLatLng glatlng = new GLatLng(latitude, longitude); markersToShow.add(glatlng); map.addOverlay(new GMarker("marker"+i, new GMarkerOptions(map, glatlng))); mapDefault.addOverlay(new GMarker("marker"+i, new GMarkerOptions(mapDefault, glatlng))); } GMarkerClusterOptions options = new GMarkerClusterOptions(); options.setMinimumClusterSize(3); List<GMarkerClusterStyle> styles = new ArrayList<GMarkerClusterStyle>(); GMarkerClusterStyle style1 = new GMarkerClusterStyle(); style1.setUrl(image1); style1.setHeight(26); style1.setWidth(30); GMarkerClusterStyle style2 = new GMarkerClusterStyle(); style2.setUrl(image2); style2.setHeight(35); style2.setWidth(40); GMarkerClusterStyle style3 = new GMarkerClusterStyle(); style3.setUrl(image3); style3.setHeight(44); style3.setWidth(50); styles.add(style1); styles.add(style2); styles.add(style3); options.setStyles(styles); map.setMarkerCluster(new GMarkerCluster(map, options)); mapDefault.setMarkerCluster(new GMarkerCluster(mapDefault)); map.fitMarkers(markersToShow); mapDefault.fitMarkers(markersToShow); }

Target:
public HomePage() { final GMap mapDefault = new GMap("mapPanelDefault"); add(mapDefault); final GMap map = new GMap("mapPanel"); add(map); List<GLatLng> markersToShow = new ArrayList<GLatLng>(); double minLat = -85.00; double maxLat = 85.00; double minLon = -180.00; double maxLon = 180.00; for(int i=0; i<1000; i++) { double latitude = minLat + (double)(Math.random() * ((maxLat - minLat) + 1)); double longitude = minLon + (double)(Math.random() * ((maxLon - minLon) + 1)); GLatLng glatlng = new GLatLng(latitude, longitude); markersToShow.add(glatlng); map.addOverlay(new GMarker("marker"+i, new GMarkerOptions(map, glatlng))); mapDefault.addOverlay(new GMarker("marker"+i, new GMarkerOptions(mapDefault, glatlng))); } GMarkerClusterOptions options = new GMarkerClusterOptions(); options.setMinimumClusterSize(3); List<GMarkerClusterStyle> styles = new ArrayList<GMarkerClusterStyle>(); GMarkerClusterStyle style1 = new GMarkerClusterStyle(); style1.setUrl(image1).setHeight(26).setWidth(30); GMarkerClusterStyle style2 = new GMarkerClusterStyle(); style2.setUrl(image2).setHeight(35).setWidth(40); GMarkerClusterStyle style3 = new GMarkerClusterStyle(); style3.setUrl(image3).setHeight(44).setWidth(50); styles.add(style1); styles.add(style2); styles.add(style3); options.setStyles(styles); map.setMarkerCluster(new GMarkerCluster(map, options)); mapDefault.setMarkerCluster(new GMarkerCluster(mapDefault)); map.fitMarkers(markersToShow); mapDefault.fitMarkers(markersToShow); }
Source:
public void testDeprecatedTimeMethods() { ShallowTraceBuilder builder = new ShallowTraceBuilder((Long) null); assertNull(builder.getId()); assertNull(builder.getStartNanos()); assertNull(builder.getEndNanos()); assertNull(builder.getPendingNanos()); builder = new ShallowTraceBuilder(new Long(1L)); builder.setResultType(ResultType.UNFINISHED); builder.setName("test"); ShallowTrace trace = builder.build(); assertNull(trace.getStartNanos()); assertNull(trace.getEndNanos()); assertNull(trace.getPendingNanos()); builder.setResultType(ResultType.EARLY_FINISH); assertNotNull(builder.getStartNanos()); assertNotNull(builder.getEndNanos()); assertNotNull(builder.getPendingNanos()); builder.setStartNanos(new Long(1L)); assertEquals(builder.getStartNanos(), new Long(1L)); builder.setEndNanos(new Long(1L)); assertEquals(builder.getEndNanos(), new Long(1L)); builder.setPendingNanos(new Long(1L)); assertEquals(builder.getPendingNanos(), new Long(1L)); }

Target:
public void testDeprecatedTimeMethods() { ShallowTraceBuilder builder = new ShallowTraceBuilder((Long) null); assertNull(builder.getId()); assertNull(builder.getStartNanos()); assertNull(builder.getEndNanos()); assertNull(builder.getPendingNanos()); builder = new ShallowTraceBuilder(new Long(1L)); assertEquals(builder.getId(), new Long(1L)); builder.setStartNanos(null); assertEquals(builder.getNativeStartNanos(), -1L); builder.setEndNanos(null); assertEquals(builder.getNativeEndNanos(), -1L); builder.setPendingNanos(null); assertEquals(builder.getNativePendingNanos(), -1L); builder.setNativeStartNanos(1L); assertEquals(builder.getStartNanos(), new Long(1L)); builder.setNativeEndNanos(1L); assertEquals(builder.getEndNanos(), new Long(1L)); builder.setNativePendingNanos(1L); assertEquals(builder.getPendingNanos(), new Long(1L)); builder.setStartNanos(new Long(1L)); assertEquals(builder.getStartNanos(), new Long(1L)); assertEquals(builder.getNativeStartNanos(), 1L); builder.setEndNanos(new Long(1L)); assertEquals(builder.getEndNanos(), new Long(1L)); assertEquals(builder.getNativeEndNanos(), 1L); builder.setPendingNanos(new Long(1L)); assertEquals(builder.getPendingNanos(), new Long(1L)); assertEquals(builder.getNativePendingNanos(), 1L); }
Source:
private Host createPowerHost() { final List<Pe> peList = new ArrayList<>(HOST_PES); for (int i = 0; i < HOST_PES; i++) { peList.add(new PeSimple(1000, new PeProvisionerSimple())); } final PowerModelHost powerModel = new PowerModelHost(STATIC_POWER, MAX_POWER); final long ram = 2048; final long bw = 10000; final long storage = 1000000; final ResourceProvisioner ramProvisioner = new ResourceProvisionerSimple(); final ResourceProvisioner bwProvisioner = new ResourceProvisionerSimple(); final VmScheduler vmScheduler = new VmSchedulerTimeShared(); final Host host = new HostSimple(ram, bw, storage, peList); host.setPowerModel(powerModel); host.setRamProvisioner(ramProvisioner); host.setBwProvisioner(bwProvisioner); host.setVmScheduler(vmScheduler); return host; }

Target:
private Host createPowerHost() { final List<Pe> peList = new ArrayList<>(HOST_PES); for (int i = 0; i < HOST_PES; i++) { peList.add(new PeSimple(1000, new PeProvisionerSimple())); } final PowerModelHost powerModel = new PowerModelHostSimple(MAX_POWER, STATIC_POWER); final long ram = 2048; final long bw = 10000; final long storage = 1000000; final ResourceProvisioner ramProvisioner = new ResourceProvisionerSimple(); final ResourceProvisioner bwProvisioner = new ResourceProvisionerSimple(); final VmScheduler vmScheduler = new VmSchedulerTimeShared(); final Host host = new HostSimple(ram, bw, storage, peList); host.setPowerModel(powerModel); host.setRamProvisioner(ramProvisioner); host.setBwProvisioner(bwProvisioner); host.setVmScheduler(vmScheduler); return host; }
Source:
File getWpsOutputStorage() { File wpsStore = null; try { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource wps = loader.get("temp/wps"); wpsStore = wps.dir(); } catch(Exception e) { throw new WcsException("Could not create the temporary storage directory for WPS"); } if(wpsStore == null || !wpsStore.exists()) { throw new WcsException("Could not create the temporary storage directory for WPS"); } return wpsStore; }

Target:
File getWpsOutputStorage() { File wpsStore = null; try { GeoServerResourceLoader loader = GeoServerExtensions.bean(GeoServerResourceLoader.class); Resource wps = loader.get("temp/wps"); wpsStore = wps.dir(); } catch(Exception e) { throw new ServiceException("Could not create the temporary storage directory for WPS"); } if(wpsStore == null || !wpsStore.exists()) { throw new ServiceException("Could not create the temporary storage directory for WPS"); } return wpsStore; }
Source:
public void replaceNodeShouldRemoveOldNode() throws Exception { Node oldNode = r.createSlave("foo", "", null); Node newNode = r.createSlave("foo-new", "", null); r.jenkins.addNode(oldNode); r.jenkins.getNodesObject().replaceNode(oldNode, newNode); r.jenkins.getNodesObject().load(); assertNull(r.jenkins.getNode(oldNode.getNodeName())); }

Target:
public void replaceNodeShouldRemoveOldNode() throws Exception { Node oldNode = r.createSlave("foo", "", null); Node newNode = r.createSlave("foo-new", "", null); r.jenkins.addNode(oldNode); r.jenkins.getNodesObject().replaceNode(oldNode, newNode); r.jenkins.getNodesObject().load(); assertNull(r.jenkins.getNode("foo")); }
Source:
public AbstractId unmarshal(String id) { throw new AssertionError("Cannot unmarshal from String"); }

Target:
public AbstractId unmarshal(String id) { throw new UnsupportedOperationException("Cannot unmarshal from String"); }
Source:
public <Match extends IPatternMatch> MatchSetRecord getMatchSetRecord(ResourceSet rs, IQuerySpecification<? extends ViatraQueryMatcher<Match>> querySpecification, Match filter) throws ViatraQueryException { if (engine == null){ engine = AdvancedViatraQueryEngine.createUnmanagedEngine(new EMFScope(rs)); } ViatraQueryEngine engine = ViatraQueryEngine.on(new EMFScope(rs)); ViatraQueryMatcher<Match> matcher = (ViatraQueryMatcher<Match>) ((AdvancedViatraQueryEngine) engine) .getMatcher(querySpecification, hint); return new SnapshotHelper().createMatchSetRecordForMatcher(matcher, filter == null ? matcher.newEmptyMatch() : filter); }

Target:
public <Match extends IPatternMatch> MatchSetRecord getMatchSetRecord(ResourceSet rs, IQuerySpecification<? extends ViatraQueryMatcher<Match>> querySpecification, Match filter) throws ViatraQueryException { return getMatchSetRecord(new EMFScope(rs), querySpecification, filter); }
Source:
MessageInfoAndMetadataListSerde(List<MessageInfo> messageInfoList, List<MessageMetadata> messageMetadataList, short version) { if (messageMetadataList != null && messageInfoList.size() != messageMetadataList.size()) { throw new IllegalArgumentException( "Mismatch in the number of messages in message Info list: " + messageInfoList.size() + " and message metadata list: " + messageMetadataList.size()); } this.messageInfoList = messageInfoList; this.messageMetadataList = messageMetadataList; this.version = version; }

Target:
MessageInfoAndMetadataListSerde(List<MessageInfo> messageInfoList, List<MessageMetadata> messageMetadataList, short version) { if (messageInfoList != null && messageMetadataList != null && messageInfoList.size() != messageMetadataList.size()) { throw new IllegalArgumentException( "Mismatch in the number of messages in message Info list: " + messageInfoList.size() + " and message metadata list: " + messageMetadataList.size()); } this.messageInfoList = messageInfoList; this.messageMetadataList = messageMetadataList; this.version = version; }
Source:
public synchronized List<PrestoWarning> getWarnings() { if (addWarnings) { super.add(createTestWarning(warningCode.incrementAndGet())); } return super.getWarnings(); }

Target:
public synchronized List<PrestoWarning> getWarnings() { if (addWarnings) { add(createTestWarning(warningCode.incrementAndGet())); } return ImmutableList.copyOf(warnings.values()); }
Source:
public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) { boolean resultContainerCreate = false; checkArgument(location == null || location.equals(region), "location must be null or %s", region); if (options.isPublicRead()) { resultContainerCreate = api.getContainerApi(regionId).create(container, ANYBODY_READ); } resultContainerCreate = api.getContainerApi(regionId).create(container, BASIC_CONTAINER); if (resultContainerCreate) { Container val = api.getContainerApi(regionId).get(container); containerCache.put(container, Optional.fromNullable(val)); } return resultContainerCreate; }

Target:
public boolean createContainerInLocation(Location location, String container, CreateContainerOptions options) { checkArgument(location == null || location.equals(region), "location must be null or %s", region); if (options.isPublicRead()) { return api.getContainerApi(regionId).create(container, ANYBODY_READ); } return api.getContainerApi(regionId).create(container, BASIC_CONTAINER); }
Source:
public static void removeBulkLoadEntries(Connector conn, String tableId, long tid) throws Exception { try (Scanner mscanner = new IsolatedScanner(conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)); BatchWriter bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig())) { mscanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange()); mscanner.fetchColumnFamily(TabletsSection.BulkFileColumnFamily.NAME); boolean shouldTrace = log.isTraceEnabled(); String tidString = Long.toString(tid); for (Entry<Key,Value> entry : mscanner) { if (shouldTrace) { log.trace("Looking at entry " + entry + " with tid " + tidString); } if (entry.getValue().toString().equals(tidString)) { if (shouldTrace) { log.trace("deleting entry " + entry); } Key key = entry.getKey(); Mutation m = new Mutation(key.getRow()); m.putDelete(key.getColumnFamily(), key.getColumnQualifier()); bw.addMutation(m); } } } }

Target:
public static void removeBulkLoadEntries(Connector conn, String tableId, long tid) throws Exception { try (Scanner mscanner = new IsolatedScanner(conn.createScanner(MetadataTable.NAME, Authorizations.EMPTY)); BatchWriter bw = conn.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig())) { mscanner.setRange(new KeyExtent(tableId, null, null).toMetadataRange()); mscanner.fetchColumnFamily(TabletsSection.BulkFileColumnFamily.NAME); boolean shouldTrace = log.isTraceEnabled(); byte[] tidAsBytes = Long.toString(tid).getBytes(UTF_8); for (Entry<Key,Value> entry : mscanner) { if (shouldTrace) { log.trace("Looking at entry with tid {}", entry, tid); } if (Arrays.equals(entry.getValue().get(), tidAsBytes)) { if (shouldTrace) { log.trace("deleting entry {}", entry); } Key key = entry.getKey(); Mutation m = new Mutation(key.getRow()); m.putDelete(key.getColumnFamily(), key.getColumnQualifier()); bw.addMutation(m); } } } }
Source:
private Map<String, FilePath> getJobs(AWSDeviceFarm adf, ScheduleRunResult run, FilePath resultsDir) throws IOException, InterruptedException { Map<String, FilePath> jobs = new HashMap<String, FilePath>(); ListJobsResult result = adf.listJobs(run.getRun().getArn()); for (Job job : result.getJobs()) { String arn = job.getArn().split(":")[6]; String jobId = arn.substring(arn.lastIndexOf("/") + 1); jobs.put(arn, new FilePath(resultsDir, job.getName() + "-" + jobId)); jobs.get(arn).mkdirs(); } return jobs; }

Target:
private Map<String, FilePath> getJobs(AWSDeviceFarm adf, ScheduleRunResult run, FilePath resultsDir) throws IOException, InterruptedException { Map<String, FilePath> jobs = new HashMap<String, FilePath>(); ListJobsResult result = adf.listJobs(run.getRun().getArn()); for (Job job : result.getJobs()) { String arn = job.getArn().split(":")[6]; String jobId = arn.substring(arn.lastIndexOf("/") + 1); String osVersion = null; if (job.getDevice() != null) { osVersion = job.getDevice().getOs(); } jobs.put(arn, new FilePath(resultsDir, job.getName() + "-" + (osVersion != null ? osVersion : jobId))); jobs.get(arn).mkdirs(); } return jobs; }
Source:
private static String getRawMac() { final StringBuilder ret = new StringBuilder(); final String os = System.getProperty("os.name"); String[] command = {"ifconfig", "-a"}; if (os != null && !os.isEmpty() && os.toLowerCase(Locale.US).startsWith("win")) { command = new String[]{"getmac"}; } try { final ProcessBuilder builder = new ProcessBuilder(command); final Process process = builder.start(); InputStream inputStream = process.getInputStream(); try ( InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); BufferedReader br = new BufferedReader(inputStreamReader)) { String tmp; while ((tmp = br.readLine()) != null) { ret.append(tmp); } } } catch (IOException e) { return null; } return ret.toString(); }

Target:
private static String getRawMac() { final StringBuilder ret = new StringBuilder(); final String os = System.getProperty("os.name"); String[] command = {"ifconfig", "-a"}; if (os != null && !os.isEmpty() && os.toLowerCase(Locale.US).startsWith("win")) { command = new String[]{"getmac"}; } try { final ProcessBuilder builder = new ProcessBuilder(command); final Process process = builder.start(); try (InputStream inputStream = process.getInputStream(); InputStreamReader inputStreamReader = new InputStreamReader(inputStream, StandardCharsets.UTF_8); BufferedReader br = new BufferedReader(inputStreamReader)) { String tmp; while ((tmp = br.readLine()) != null) { ret.append(tmp); } } } catch (IOException e) { return null; } return ret.toString(); }
Source:
public Set<ResolvedBroadcast> aggregateBroadcasts( Set<Broadcast> broadcasts, Optional<Platform> platformOptional, List<Id> downweighChannelIds ) { if (platformOptional.isPresent()) { broadcasts = removeBroadcastsNotOnPlatform(broadcasts, platformOptional.get()); } broadcasts = aggregateContinuations(broadcasts); Multimap<DateTime, ResolvedBroadcast> broadcastMap = broadcasts.stream() .filter(broadcast -> broadcast.getTransmissionEndTime().isAfterNow()) .map(broadcast -> ResolvedBroadcast.create( broadcast, ResolvedChannel.builder(resolveChannel(broadcast.getChannelId())).build()) ) .collect(MoreCollectors.toImmutableListMultiMap( resolvedBroadcast -> resolvedBroadcast.getBroadcast().getTransmissionTime(), resolvedBroadcast -> resolvedBroadcast )); ImmutableMultimap.Builder<DateTime, ResolvedBroadcast> aggregatedBroadcasts = ImmutableMultimap.builder(); for(DateTime dateTime : broadcastMap.keySet()) { Collection<ResolvedBroadcast> sameTimeBroadcasts = broadcastMap.get(dateTime); if (sameTimeBroadcasts.size() > 1) { aggregatedBroadcasts.putAll( dateTime, aggregateBroadcastsInternal(sameTimeBroadcasts, platformOptional) ); } else { aggregatedBroadcasts.put(dateTime, Iterables.getOnlyElement(sameTimeBroadcasts)); } } return sortByDownweighChannelIds( downweighChannelIds, sortBroadcastsByDateTime(aggregatedBroadcasts.build()) ); }

Target:
public Set<ResolvedBroadcast> aggregateBroadcasts( Set<Broadcast> broadcasts, Optional<Platform> platformOptional, List<Id> downweighChannelIds ) { Set<Broadcast> platformBroadcasts = platformOptional.isPresent() ? removeBroadcastsNotOnPlatform(broadcasts, platformOptional.get()) : broadcasts; Set<Broadcast> mergedContinuations = mergeBroadcastContinuations(platformBroadcasts); Multimap<DateTime, ResolvedBroadcast> broadcastMap = mergedContinuations.stream() .filter(broadcast -> broadcast.getTransmissionEndTime().isAfterNow()) .map(broadcast -> ResolvedBroadcast.create( broadcast, ResolvedChannel.builder(resolveChannel(broadcast.getChannelId())).build()) ) .collect(MoreCollectors.toImmutableListMultiMap( resolvedBroadcast -> resolvedBroadcast.getBroadcast().getTransmissionTime(), resolvedBroadcast -> resolvedBroadcast )); ImmutableMultimap.Builder<DateTime, ResolvedBroadcast> aggregatedBroadcasts = ImmutableMultimap.builder(); for(DateTime dateTime : broadcastMap.keySet()) { Collection<ResolvedBroadcast> sameTimeBroadcasts = broadcastMap.get(dateTime); if (sameTimeBroadcasts.size() > 1) { aggregatedBroadcasts.putAll( dateTime, aggregateBroadcastsInternal(sameTimeBroadcasts, platformOptional) ); } else { aggregatedBroadcasts.put(dateTime, Iterables.getOnlyElement(sameTimeBroadcasts)); } } return sortByDownweighChannelIds( downweighChannelIds, sortBroadcastsByDateTime(aggregatedBroadcasts.build()) ); }
Source:
public static Map<String, SortedMap<Genotype, VariantContext>> createSampleToGenotypeVariantContextSortedMap(final List<String> sampleNames, final Collection<VariantContext> variants) { final Comparator<Genotype> genotypePArtifactComparator = Comparator .comparingDouble((Genotype g) -> -OrientationBiasUtils.getGenotypeDouble(g, OrientationBiasFilterConstants.P_ARTIFACT_FIELD_NAME, 0.0)) .thenComparingInt(g -> g.hashCode()); final Map<String, SortedMap<Genotype, VariantContext>> sampleNameToVariants = new HashMap<>(); final ProgressMeter customProgressMeter = new ProgressMeter(0.1); customProgressMeter.start(); for (final String sampleName: sampleNames) { final SortedMap<Genotype, VariantContext> genotypesToConsiderForFiltering = new TreeMap<>(genotypePArtifactComparator); for (final VariantContext vc : variants) { vc.getGenotypes(sampleName).forEach( genotype -> { if (!vc.isFiltered() && !genotype.isFiltered() && (genotype.getAnyAttribute(OrientationBiasFilterConstants.IS_ORIENTATION_BIAS_ARTIFACT_MODE).equals(String.valueOf(true)) || genotype.getAnyAttribute(OrientationBiasFilterConstants.IS_ORIENTATION_BIAS_RC_ARTIFACT_MODE).equals(String.valueOf(true))) ) { genotypesToConsiderForFiltering.put(genotype, vc); } }); customProgressMeter.update(new SimpleInterval(vc.getContig(), vc.getStart(), vc.getEnd())); } sampleNameToVariants.put(sampleName, genotypesToConsiderForFiltering); } customProgressMeter.stop(); return sampleNameToVariants; }

Target:
public static Map<String, SortedMap<Genotype, VariantContext>> createSampleToGenotypeVariantContextSortedMap(final List<String> sampleNames, final Collection<VariantContext> variants) { final Comparator<Genotype> genotypePArtifactComparator = Comparator .comparingDouble((Genotype g) -> -OrientationBiasUtils.getGenotypeDouble(g, OrientationBiasFilterConstants.P_ARTIFACT_FIELD_NAME, 0.0)) .thenComparingInt(g -> g.hashCode()); final Map<String, SortedMap<Genotype, VariantContext>> sampleNameToVariants = new HashMap<>(); final ProgressMeter customProgressMeter = new ProgressMeter(0.1); customProgressMeter.start(); for (final String sampleName : sampleNames) { final SortedMap<Genotype, VariantContext> genotypesToConsiderForFiltering = new TreeMap<>(genotypePArtifactComparator); for (final VariantContext vc : variants) { vc.getGenotypes(sampleName).stream() .filter(g -> isFilteringCandidate(g, vc)) .forEach(genotype -> genotypesToConsiderForFiltering.put(genotype, vc)); customProgressMeter.update(new SimpleInterval(vc.getContig(), vc.getStart(), vc.getEnd())); } sampleNameToVariants.put(sampleName, genotypesToConsiderForFiltering); } customProgressMeter.stop(); return sampleNameToVariants; }
Source:
public void importHostedEngineVm(final VM vm, final Guid vdsGroupId) { ThreadPoolUtil.execute(new Runnable() { public void run() { StorageDomain sd = (StorageDomain) ((ArrayList) backend.runInternalQuery( VdcQueryType.Search, new SearchParameters( "Storage: name=" + Config.<String>getValue(ConfigValues.HostedEngineStorageDomainName), SearchType.StorageDomain ) ).getReturnValue()).get(0); if (sd != null && sd.getStatus() == StorageDomainStatus.Active) { boolean removedUnmanagedHEVM = backend.runInternalAction( VdcActionType.RemoveVm, new RemoveVmParameters(vm.getId(), true)).getSucceeded(); if (removedUnmanagedHEVM) { ImportVmParameters parameters = new ImportVmParameters( vm, sd.getId(), sd.getId(), sd.getStoragePoolId(), vdsGroupId); Guid sdProfileId = diskProfileDao.getAllForStorageDomain(sd.getId()).get(0).getId(); for (DiskImage image : vm.getImages()) { image.setDiskProfileId(sdProfileId); image.setStorageIds(new ArrayList(Arrays.asList(sd.getId()))); image.setVmSnapshotId(Guid.newGuid()); } parameters.setImagesExistOnTargetStorageDomain(true); vm.setOrigin(OriginType.MANAGED_HOSTED_ENGINE); VDSGroup vdsGroup = vdsGroupDAO.get(vdsGroupId); vm.setClusterArch(vdsGroup.getArchitecture()); vm.setCustomCpuName(vdsGroup.getCpuName()); vm.setCustomEmulatedMachine(vdsGroup.getEmulatedMachine()); backend.runInternalAction( VdcActionType.ImportVm, parameters); } } } }); }

Target:
public void importHostedEngineVm(final VM vm, final Guid vdsGroupId) { ThreadPoolUtil.execute(new Runnable() { @Override public void run() { hostedEngineImporterProvider.get().run(vm, vdsGroupId); } }); }
Source:
public String toString() { return "InjectionPoint of type " + requiredType + " with qualifiers " + qualifiers + " which is " + (isDelegate ? "" : "not ") + "delegate and is" + (isTransient ? "" : "not ") + "transient."; }

Target:
public String toString() { return "InjectionPoint with type=" + requiredType + ", qualifiers=" + qualifiers + ", delegate=" + isDelegate + ", transient=" + isTransient + "."; }
Source:
public static void logoutAllUsers() { final CountDownLatch allUsersLoggedOut = new CountDownLatch(1); final HandlerThread ht = new HandlerThread("LoggingOutUsersThread"); ht.start(); Handler handler = new Handler(ht.getLooper()); handler.post(() -> { Map<String, SyncUser> users = SyncUser.all(); for (SyncUser user : users.values()) { user.logOut(); } TestHelper.waitForNetworkThreadExecutorToFinish(); allUsersLoggedOut.countDown(); }); TestHelper.awaitOrFail(allUsersLoggedOut); ht.quit(); try { ht.join(TimeUnit.MILLISECONDS.convert(TestHelper.SHORT_WAIT_SECS, TimeUnit.SECONDS)); } catch (InterruptedException e) { throw new AssertionError("LoggingOutUsersThread failed to finish in time"); } }

Target:
public static void logoutAllUsers() { final CountDownLatch allUsersLoggedOut = new CountDownLatch(1); final HandlerThread ht = new HandlerThread("LoggingOutUsersThread"); ht.start(); Handler handler = new Handler(ht.getLooper()); handler.post(() -> { Map<String, SyncUser> users = SyncUser.all(); for (SyncUser user : users.values()) { user.logOut(); } TestHelper.waitForNetworkThreadExecutorToFinish(); allUsersLoggedOut.countDown(); }); TestHelper.awaitOrFail(allUsersLoggedOut); ht.quit(); try { ht.join(TimeUnit.SECONDS.toMillis(TestHelper.SHORT_WAIT_SECS)); } catch (InterruptedException e) { throw new AssertionError("LoggingOutUsersThread failed to finish in time"); } }
Source:
public EntityEquipmentInvWrapper(final EntityLivingBase entity, final EntityEquipmentSlot.Type slotType) { this.entity = entity; final List<EntityEquipmentSlot> slots = new ArrayList<EntityEquipmentSlot>(); for (final EntityEquipmentSlot slot : EntityEquipmentSlot.values()) { if (slot.getSlotType() == slotType) { slots.add(slot.getIndex(), slot); } } this.slots = ImmutableList.copyOf(slots); }

Target:
public EntityEquipmentInvWrapper(final EntityLivingBase entity, final EntityEquipmentSlot.Type slotType) { this.entity = entity; final List<EntityEquipmentSlot> slots = new ArrayList<EntityEquipmentSlot>(); for (final EntityEquipmentSlot slot : EntityEquipmentSlot.values()) { if (slot.getSlotType() == slotType) { slots.add(slot); } } this.slots = ImmutableList.copyOf(slots); }
Source:
static public boolean isWorkunitComplete(WUState state) { switch (state) { case UNKNOWN_ONSERVER: case COMPLETED: case FAILED: case ABORTED: case ARCHIVED: case COMPILED: return true; } return false; }

Target:
static public boolean isWorkunitComplete(WUState state) { switch (state) { case UNKNOWN_ONSERVER: case COMPLETED: case FAILED: case ABORTED: case ARCHIVED: case COMPILED: return true; case ABORTING: case BLOCKED: case COMPILING: case LAST: case RUNNING: case SCHEDULED: case SUBMITTED: case UNKNOWN: case WAIT: default: return false; } }
Source:
private List<Pair<Guid, Pair<Integer, Integer>>> getUnutilizedResources(List<VDS> hosts) { List<Pair<Guid, Pair<Integer, Integer>>> hostsUnutilizedResources = new ArrayList<Pair<Guid, Pair<Integer, Integer>>>(); for (VDS host : hosts) { Pair<Integer, Integer> innerUnutilizedCpuRamPair = new Pair<Integer, Integer>(); innerUnutilizedCpuRamPair.setFirst(100 - host.getUsageCpuPercent()); int hostFreeMem = 0; if (host.getPhysicalMemMb() != null && host.getUsageMemPercent() != null) { int usedMem = (int) Math.round(host.getPhysicalMemMb() * (host.getUsageMemPercent() / 100.0)); hostFreeMem = host.getPhysicalMemMb() - usedMem; } innerUnutilizedCpuRamPair.setSecond(hostFreeMem); Pair<Guid, Pair<Integer, Integer>> outerUnutilizedCpuRamPair = new Pair<Guid, Pair<Integer, Integer>>(); outerUnutilizedCpuRamPair.setFirst(host.getId()); outerUnutilizedCpuRamPair.setSecond(innerUnutilizedCpuRamPair); hostsUnutilizedResources.add(outerUnutilizedCpuRamPair); } return hostsUnutilizedResources; }

Target:
private List<Pair<Guid, Pair<Integer, Integer>>> getUnutilizedResources(List<VDS> hosts) { List<Pair<Guid, Pair<Integer, Integer>>> hostsUnutilizedResources = new ArrayList<>(); for (VDS host : hosts) { Pair<Integer, Integer> innerUnutilizedCpuRamPair = new Pair<>(); int hostFreeCpu = 0; if (host.getUsageCpuPercent() != null) { hostFreeCpu = 100 - host.getUsageCpuPercent(); } innerUnutilizedCpuRamPair.setFirst(hostFreeCpu); int hostFreeMem = 0; if (host.getPhysicalMemMb() != null && host.getUsageMemPercent() != null) { int usedMem = (int) Math.round(host.getPhysicalMemMb() * (host.getUsageMemPercent() / 100.0)); hostFreeMem = host.getPhysicalMemMb() - usedMem; } innerUnutilizedCpuRamPair.setSecond(hostFreeMem); Pair<Guid, Pair<Integer, Integer>> outerUnutilizedCpuRamPair = new Pair<>(host.getId(), innerUnutilizedCpuRamPair); outerUnutilizedCpuRamPair.setFirst(host.getId()); outerUnutilizedCpuRamPair.setSecond(innerUnutilizedCpuRamPair); hostsUnutilizedResources.add(outerUnutilizedCpuRamPair); } return hostsUnutilizedResources; }
Source:
private void waitUntilMirrorMakerIsRunning(EmbeddedConnectCluster connectCluster, Set<String> connNames) throws InterruptedException { for (String connector : connNames) { TestUtils.waitForCondition(() -> areConnectorAndTasksRunning(connectCluster, connector, MIN_TASKS), "Timed out trying to verify connector " + connector + " was up!" ); } }

Target:
private void waitUntilMirrorMakerIsRunning(EmbeddedConnectCluster connectCluster, Set<String> connNames) throws InterruptedException { for (String connector : connNames) { TestUtils.waitForCondition(() -> areConnectorAndTasksRunning(connectCluster, connector), "Timed out trying to verify connector " + connector + " was up!"); } }
Source:
public int run() { if (!options.mainDefinitionFile().exists()) { throw KEMException.criticalError("Definition file doesn't exist: " + options.mainDefinitionFile().getAbsolutePath()); } Kompile kompile = new Kompile(options, files, kem, sw); CompiledDefinition def = null; def = kompile.run(options.mainDefinitionFile(), options.mainModule(), options.syntaxModule(), Sorts.K(), koreBackend.get().steps(kompile)); loader.saveOrDie(files.resolveKompiled("compiled.bin"), def); koreBackend.get().accept(def); loader.saveOrDie(files.resolveKompiled("timestamp"), ""); sw.printIntermediate("Save to disk"); sw.printTotal("Total"); return 0; }

Target:
public int run() { if (!options.outerParsing.mainDefinitionFile(files).exists()) { throw KEMException.criticalError("Definition file doesn't exist: " + options.outerParsing.mainDefinitionFile(files).getAbsolutePath()); } Kompile kompile = new Kompile(options, files, kem, sw); CompiledDefinition def = kompile.run(options.outerParsing.mainDefinitionFile(files), options.mainModule(files), options.syntaxModule(files), Sorts.K(), koreBackend.get().steps(kompile)); loader.saveOrDie(files.resolveKompiled("compiled.bin"), def); koreBackend.get().accept(def); loader.saveOrDie(files.resolveKompiled("timestamp"), ""); sw.printIntermediate("Save to disk"); sw.printTotal("Total"); return 0; }
Source:
public static void throwNonAggExpressionInAggException(String nonAggregateExpression) throws SQLException { throw new SQLException("Aggregate query may not contain column that do not appear in the GROUP BY: " + nonAggregateExpression); }

Target:
public static void throwNonAggExpressionInAggException(String nonAggregateExpression) throws SQLException { throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_WITH_NOT_GROUP_BY_COLUMN) .setMessage(nonAggregateExpression).build().buildException(); }