auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void setDSTPointBytes() { int xValue = (relativeX < 0 ? DSTFileConstants.CONVERSION_TABLE[(relativeX * (-1)) + 121] : DSTFileConstants.CONVERSION_TABLE[relativeX]); int yValue = (relativeY < 0 ? DSTFileConstants.CONVERSION_TABLE[(relativeY * (-1)) + 121] : DSTFileConstants.CONVERSION_TABLE[relativeY]); char yPart = (char) ((((yValue & 0x1) << 3) | ((yValue & 0x2) << 1) | ((yValue & 0x10) >>> 3) | ((yValue & 0x20) >>> 5)) << 4); char xPart = (char) (((xValue >>> 2) & 0xC) | (xValue & 0x3)); dstPointBytes[0] = (byte) (yPart | xPart); yPart = (char) ((((yValue & 0x4) << 1) | ((yValue & 0x8) >>> 1) | ((yValue & 0x40) >>> 5) | ((yValue & 0x80) >>> 7)) << 4); xPart = (char) (((xValue >>> 4) & 0xC) | ((xValue >>> 2) & 0x3)); dstPointBytes[1] = (byte) (yPart | xPart); yPart = (char) (((yValue >>> 5) & 0x10) | ((yValue >>> 3) & 0x20)); xPart = (char) ((xValue >>> 6) & 0xC); dstPointBytes[2] = (byte) (dstPointBytes[2] | yPart | xPart); }

Target:
private byte[] setDSTPointBytes() { byte[] dstPointBytes = new byte[] {0, 0, (char) 0x03}; int xValue = mapToConversionTable(relativeX); int yValue = mapToConversionTable(relativeY); char yPart = (char) ((((yValue & 0x1) << 3) | ((yValue & 0x2) << 1) | ((yValue & 0x10) >>> 3) | ((yValue & 0x20) >>> 5)) << 4); char xPart = (char) (((xValue >>> 2) & 0xC) | (xValue & 0x3)); dstPointBytes[0] = (byte) (yPart | xPart); yPart = (char) ((((yValue & 0x4) << 1) | ((yValue & 0x8) >>> 1) | ((yValue & 0x40) >>> 5) | ((yValue & 0x80) >>> 7)) << 4); xPart = (char) (((xValue >>> 4) & 0xC) | ((xValue >>> 2) & 0x3)); dstPointBytes[1] = (byte) (yPart | xPart); yPart = (char) (((yValue >>> 5) & 0x10) | ((yValue >>> 3) & 0x20)); xPart = (char) ((xValue >>> 6) & 0xC); dstPointBytes[2] = (byte) (dstPointBytes[2] | yPart | xPart); if (jumpPoint) { dstPointBytes[2] = (byte) (dstPointBytes[2] | (0x1 << 7)); } if (colorChangePoint) { dstPointBytes[2] = (byte) ((char) dstPointBytes[2] | (0x1 << 6) | (0x1 << 7)); } return dstPointBytes; }
Source:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.archived: if (item.getTitle().equals(getString(R.string.menu_option_archived))) { refresh(true); isarchivedvisible = true; }else if (item.getTitle().equals(getString(R.string.menu_option_unread))) { isarchivedvisible = false; refresh(false); } return true; default: return super.onOptionsItemSelected(item); } }

Target:
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.archived: if (item.getTitle().equals(getString(R.string.menu_option_archived))) { NotificationActivity.startYourself(NotificationActivity.this, "read"); }else if (item.getTitle().equals(getString(R.string.menu_option_unread))) { onBackPressed(); } return true; default: return super.onOptionsItemSelected(item); } }
Source:
private List<GlusterServerInfo> getGlusterPeers(Guid upServerId) { List<GlusterServerInfo> glusterServers = new ArrayList<GlusterServerInfo>(); VDSReturnValue returnValue = Backend.getInstance() .getResourceManager() .RunVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServerId)); if (!returnValue.getSucceeded()) { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_SERVERS_LIST_FAILED); } else { glusterServers = (List<GlusterServerInfo>) returnValue.getReturnValue(); } return glusterServers; }

Target:
private List<GlusterServerInfo> getGlusterPeers(Guid upServerId) { List<GlusterServerInfo> glusterServers = new ArrayList<GlusterServerInfo>(); VDSReturnValue returnValue = runVdsCommand(VDSCommandType.GlusterServersList, new VdsIdVDSCommandParametersBase(upServerId)); if (!returnValue.getSucceeded()) { getReturnValue().getFault().setError(returnValue.getVdsError().getCode()); getReturnValue().getFault().setMessage(returnValue.getVdsError().getMessage()); AuditLogDirector.log(new AuditLogableBase(upServerId), AuditLogType.GLUSTER_SERVERS_LIST_FAILED); } else { glusterServers = (List<GlusterServerInfo>) returnValue.getReturnValue(); } return glusterServers; }
Source:
private LanguagesAdapter(List<String> languages, WikipediaApp app) { this.originalLanguages = languages; this.languages = languages; this.app = app; }

Target:
private LanguagesAdapter(List<String> languages, WikipediaApp app) { this.originalLanguages = languages; this.languages = new ArrayList<String>(); this.languages.addAll(languages); this.app = app; }
Source:
protected void setUp() throws Exception { loopbackInterface = NetworkInterface.getByInetAddress(InetAddress.getLoopbackAddress()); assertNotNull(loopbackInterface); assertTrue(loopbackInterface.isLoopback()); assertFalse(loopbackInterface.supportsMulticast()); Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements() && (ipv4NetworkInterface == null || ipv6NetworkInterface == null)) { NetworkInterface nextInterface = interfaces.nextElement(); if (willWorkForMulticast(nextInterface)) { Enumeration<InetAddress> addresses = nextInterface.getInetAddresses(); while (addresses.hasMoreElements()) { final InetAddress nextAddress = addresses.nextElement(); if (nextAddress instanceof Inet6Address && ipv6NetworkInterface == null) { ipv6NetworkInterface = nextInterface; } else if (nextAddress instanceof Inet4Address && ipv4NetworkInterface == null) { ipv4NetworkInterface = nextInterface; } } } } if (ipv4NetworkInterface == null || ipv6NetworkInterface == null) { fail("Test environment must have at least one environment capable of multicast"); } }

Target:
protected void setUp() throws Exception { loopbackInterface = NetworkInterface.getByInetAddress(InetAddress.getLoopbackAddress()); assertNotNull(loopbackInterface); assertTrue(loopbackInterface.isLoopback()); assertFalse(loopbackInterface.supportsMulticast()); Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); supportsMulticast = Boolean.parseBoolean( System.getProperty("android.cts.device.multicast", "true")); if (!supportsMulticast) { return; } while (interfaces.hasMoreElements() && (ipv4NetworkInterface == null || ipv6NetworkInterface == null)) { NetworkInterface nextInterface = interfaces.nextElement(); if (willWorkForMulticast(nextInterface)) { Enumeration<InetAddress> addresses = nextInterface.getInetAddresses(); while (addresses.hasMoreElements()) { final InetAddress nextAddress = addresses.nextElement(); if (nextAddress instanceof Inet6Address && ipv6NetworkInterface == null) { ipv6NetworkInterface = nextInterface; } else if (nextAddress instanceof Inet4Address && ipv4NetworkInterface == null) { ipv4NetworkInterface = nextInterface; } } } } if (ipv4NetworkInterface == null) { fail("Test environment must have at least one network interface capable of IPv4" + " multicast"); } if (ipv6NetworkInterface == null) { fail("Test environment must have at least one network interface capable of IPv6" + " multicast"); } }
Source:
JSONObj list(@PathVariable String wsName, @RequestParam(value="sort", required=false) String sort, @RequestParam(value="filter", required=false) String textFilter, HttpServletRequest req) { JSONObj obj = new JSONObj(); Catalog cat = geoServer.getCatalog(); if ("default".equals(wsName)) { WorkspaceInfo def = cat.getDefaultWorkspace(); if (def != null) { wsName = def.getName(); } } Filter filter = equal("resource.namespace.prefix", wsName); if (textFilter != null) { filter = Predicates.and( equal("resource.namespace.prefix", wsName), Predicates.fullTextSearch(textFilter)); } Integer total = cat.count(LayerInfo.class, filter); Integer page = page(req); Integer count = count(req); SortBy sortBy = null; if (sort != null) { String[] sortArr = sort.split(":", 2); if (sortArr.length == 2) { if (sortArr[1].equals("asc")) { sortBy = Predicates.asc(sortArr[0]); } else if (sortArr[1].equals("desc")) { sortBy = Predicates.desc(sortArr[0]); } else { throw new BadRequestException("Sort order must be \"asc\" or \"desc\""); } } else { sortBy = Predicates.asc(sortArr[0]); } } obj.put("total", total); obj.put("page", page != null ? page : 0); obj.put("count", Math.min(total, count != null ? count : total)); JSONArr arr = obj.putArray("layers"); try ( CloseableIterator<LayerInfo> it = cat.list(LayerInfo.class, filter, offset(req), count, sortBy); ) { while (it.hasNext()) { IO.layer(arr.addObject(), it.next()); } } return obj; }

Target:
JSONObj list(@PathVariable String wsName, @RequestParam(value="sort", required=false) String sort, @RequestParam(value="filter", required=false) String textFilter, HttpServletRequest req) { JSONObj obj = new JSONObj(); Catalog cat = geoServer.getCatalog(); if ("default".equals(wsName)) { WorkspaceInfo def = cat.getDefaultWorkspace(); if (def != null) { wsName = def.getName(); } } Filter filter = equal("resource.namespace.prefix", wsName); if (textFilter != null) { filter = Predicates.and(filter, Predicates.fullTextSearch(textFilter)); } Integer total = cat.count(LayerInfo.class, filter); Integer page = page(req); Integer count = count(req); SortBy sortBy = null; if (sort != null) { String[] sortArr = sort.split(":", 2); if (sortArr.length == 2) { if (sortArr[1].equals("asc")) { sortBy = Predicates.asc(sortArr[0]); } else if (sortArr[1].equals("desc")) { sortBy = Predicates.desc(sortArr[0]); } else { throw new BadRequestException("Sort order must be \"asc\" or \"desc\""); } } else { sortBy = Predicates.asc(sortArr[0]); } } obj.put("total", total); obj.put("page", page != null ? page : 0); obj.put("count", Math.min(total, count != null ? count : total)); JSONArr arr = obj.putArray("layers"); try ( CloseableIterator<LayerInfo> it = cat.list(LayerInfo.class, filter, offset(req), count, sortBy); ) { while (it.hasNext()) { IO.layer(arr.addObject(), it.next()); } } return obj; }
Source:
public boolean canPayFor(IAcquisitionWork acquisition) { if( (acquisition instanceof UnitOrder && getCampaignOptions().payForUnits()) ||(acquisition instanceof Part && getCampaignOptions().payForParts()) ) { return !(getFunds() < acquisition.getBuyCost()); } return true; }

Target:
public boolean canPayFor(IAcquisitionWork acquisition) { if( (acquisition instanceof UnitOrder && getCampaignOptions().payForUnits()) ||(acquisition instanceof Part && getCampaignOptions().payForParts()) ) { return (getFunds() >= acquisition.getBuyCost()); } return true; }
Source:
public void testCustomFixedPartDocumentHistoryPageProvider() { assertNotNull(pageProviderService.getPageProviderDefinition("FIXED_PART_DOCUMENT_HISTORY_PROVIDER")); DocumentModel searchDoc = session.createDocumentModel("BasicAuditSearch"); searchDoc.setPathInfo("/", "auditsearch"); searchDoc = session.createDocument(searchDoc); PageProvider<LogEntry> pageProvider; searchDoc.setPropertyValue("basicauditsearch:eventIds", null); searchDoc.setPropertyValue("basicauditsearch:eventCategories", null); searchDoc.setPropertyValue("basicauditsearch:startDate", null); searchDoc.setPropertyValue("basicauditsearch:endDate", null); pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, doc); pageProvider.setSearchDocumentModel(searchDoc); assertEquals(1,pageProvider.getCurrentPage().size()); pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, proxy); pageProvider.setSearchDocumentModel(searchDoc); assertEquals(0,pageProvider.getCurrentPage().size()); }

Target:
public void testCustomFixedPartDocumentHistoryPageProvider() { assertNotNull(pageProviderService.getPageProviderDefinition("FIXED_PART_DOCUMENT_HISTORY_PROVIDER")); DocumentModel searchDoc = session.createDocumentModel("BasicAuditSearch"); searchDoc.setPathInfo("/", "auditsearch"); searchDoc = session.createDocument(searchDoc); searchDoc.setPropertyValue("basicauditsearch:eventIds", null); searchDoc.setPropertyValue("basicauditsearch:eventCategories", null); searchDoc.setPropertyValue("basicauditsearch:startDate", null); searchDoc.setPropertyValue("basicauditsearch:endDate", null); PageProvider<LogEntry> pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, doc); pageProvider.setSearchDocumentModel(searchDoc); assertEquals(1, pageProvider.getCurrentPage().size()); pageProvider = getPageProvider("FIXED_PART_DOCUMENT_HISTORY_PROVIDER", 30, 0, proxy); pageProvider.setSearchDocumentModel(searchDoc); assertTrue(pageProvider.getCurrentPage().isEmpty()); }
Source:
public void testFail() throws IOException { final List<Pass> list = new ArrayList<Pass>(2); list.add(new PsFake(true)); list.add(new PsFake(false)); final Opt<Identity> identity = new PsAll(list, 1).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(false) ); }

Target:
public void testFail() throws Exception { final List<Pass> list = new ArrayList<Pass>(2); list.add(new PsFake(true)); list.add(new PsFake(false)); final Opt<Identity> identity = new PsAll(list, 1).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(false) ); }
Source:
private <T extends Enum<T>> Set<String> getRecommendationByBlacklist(Class<T> enumClass, boolean emptyServiceListBlacklisted, List<String> entitlements) { Map<String, Set<String>> componentsByHostGroup = getNonGatewayComponentsByHostGroup(); Set<String> recos = new HashSet<>(); for (Entry<String, Set<String>> hostGroupServices : componentsByHostGroup.entrySet()) { if (emptyServiceListBlacklisted && hostGroupServices.getValue().isEmpty()) { continue; } boolean foundBlackListItem = false; for (String service : hostGroupServices.getValue()) { com.google.common.base.Optional<T> enumValue = Enums.getIfPresent(enumClass, service); if (enumValue.isPresent()) { if (EntitledForServiceScale.class.isAssignableFrom(enumClass)) { Entitlement entitledFor = ((EntitledForServiceScale) enumValue.get()).getEntitledFor(); if (!entitlements.contains(entitledFor.name())) { foundBlackListItem = true; break; } } else { foundBlackListItem = true; break; } } } if (!foundBlackListItem) { recos.add(hostGroupServices.getKey()); } } return recos; }

Target:
private <T extends Enum<T>> Set<String> getRecommendationByBlacklist(Class<T> enumClass, boolean emptyServiceListBlacklisted, List<String> entitlements) { LOGGER.info("Get recommendation by blacklisted with entitlements {}.", enumClass, entitlements); Map<String, Set<String>> componentsByHostGroup = getNonGatewayComponentsByHostGroup(); Set<String> recos = new HashSet<>(); for (Entry<String, Set<String>> hostGroupServices : componentsByHostGroup.entrySet()) { if (emptyServiceListBlacklisted && hostGroupServices.getValue().isEmpty()) { continue; } boolean foundBlackListItem = false; for (String service : hostGroupServices.getValue()) { com.google.common.base.Optional<T> enumValue = Enums.getIfPresent(enumClass, service); if (enumValue.isPresent()) { if (EntitledForServiceScale.class.isAssignableFrom(enumClass)) { Entitlement entitledFor = ((EntitledForServiceScale) enumValue.get()).getEntitledFor(); if (!entitlements.contains(entitledFor.name())) { foundBlackListItem = true; break; } } else { foundBlackListItem = true; break; } } } if (!foundBlackListItem) { recos.add(hostGroupServices.getKey()); } } return recos; }
Source:
private void updateButtonsEnablement() { fDeclareFinalCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingFinal()); fDeclareStaticCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingStatic()); for (Button fInitializeInRadioButton : fInitializeInRadioButtons) { fInitializeInRadioButton.setEnabled(canEnable(getDataAsInt(fInitializeInRadioButton))); } }

Target:
private void updateButtonsEnablement() { fDeclareFinalCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingFinal()); fDeclareStaticCheckbox.setEnabled(getPromoteTempRefactoring().canEnableSettingStatic()); for (Button initializeInRadioButton : fInitializeInRadioButtons) { initializeInRadioButton.setEnabled(canEnable(getDataAsInt(initializeInRadioButton))); } }
Source:
private void checkForQuotaInDC(storage_pool storage_pool, final ICommandTarget commandTarget) { GetQuotaByStoragePoolIdQueryParameters parameters = new GetQuotaByStoragePoolIdQueryParameters(); parameters.setRefresh(getIsQueryFirstTime()); parameters.setStoragePoolId(storage_pool.getId()); Frontend.RunQuery(VdcQueryType.GetQuotaByStoragePoolId, parameters, new AsyncQuery( quotaListModel, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object returnValue) { if (((ArrayList<Quota>) ((VdcQueryReturnValue) returnValue).getReturnValue()).size() == 0) { promptNoQuotaInDCMessage(); } else { OnSaveInternal(); } } })); }

Target:
private void checkForQuotaInDC(storage_pool storage_pool, final ICommandTarget commandTarget) { GetQuotaByStoragePoolIdQueryParameters parameters = new GetQuotaByStoragePoolIdQueryParameters(storage_pool.getId()); Frontend.RunQuery(VdcQueryType.GetQuotaByStoragePoolId, parameters, new AsyncQuery( quotaListModel, new INewAsyncCallback() { @Override public void OnSuccess(Object model, Object returnValue) { if (((ArrayList<Quota>) ((VdcQueryReturnValue) returnValue).getReturnValue()).size() == 0) { promptNoQuotaInDCMessage(); } else { OnSaveInternal(); } } })); }
Source:
public void test_logsCoverageZip() throws DeviceNotAvailableException, IOException { doReturn( new StringJoiner("\n") .add("/data/misc/gcov/path/to/coverage.gcda") .add("/data/misc/gcov/path/to/.hidden/coverage2.gcda") .toString()) .when(mMockDevice) .executeShellCommand(anyString()); doAnswer( inv -> { File destFile = (File) inv.getArgument(1); try (OutputStream out = new FileOutputStream(destFile)) { COVERAGE_MEASUREMENT.writeTo(out); } return true; }) .when(mMockDevice) .pullFile(anyString(), any()); mCodeCoverageListener.testRunStarted(RUN_NAME, TEST_COUNT); Map<String, String> metric = new HashMap<>(); mCodeCoverageListener.testRunEnded(ELAPSED_TIME, TfMetricProtoUtil.upgradeConvert(metric)); List<ByteString> logs = mFakeListener.getLogs(); assertThat(logs).hasSize(1); File outputZip = folder.newFile("coverage.zip"); try (OutputStream out = new FileOutputStream(outputZip)) { logs.get(0).writeTo(out); } URI uri = URI.create(String.format("jar:file:%s", outputZip)); try (FileSystem filesystem = FileSystems.newFileSystem(uri, new HashMap<>())) { Path path1 = filesystem.getPath("/path/to/coverage.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path1))) .isEqualTo(COVERAGE_MEASUREMENT); Path path2 = filesystem.getPath("/path/to/.hidden/coverage2.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path2))) .isEqualTo(COVERAGE_MEASUREMENT); } }

Target:
public void test_logsCoverageZip() throws DeviceNotAvailableException, IOException { doReturn( new StringJoiner("\n") .add("/data/misc/gcov/path/to/coverage.gcda") .add("/data/misc/gcov/path/to/.hidden/coverage2.gcda") .toString()) .when(mMockDevice) .executeShellCommand(anyString()); doAnswer( inv -> { File destFile = (File) inv.getArgument(1); try (OutputStream out = new FileOutputStream(destFile)) { out.write(destFile.getName().getBytes(StandardCharsets.UTF_8)); } return true; }) .when(mMockDevice) .pullFile(anyString(), any()); mCodeCoverageListener.testRunStarted(RUN_NAME, TEST_COUNT); Map<String, String> metric = new HashMap<>(); mCodeCoverageListener.testRunEnded(ELAPSED_TIME, TfMetricProtoUtil.upgradeConvert(metric)); List<ByteString> logs = mFakeListener.getLogs(); assertThat(logs).hasSize(1); File outputZip = folder.newFile("coverage.zip"); try (OutputStream out = new FileOutputStream(outputZip)) { logs.get(0).writeTo(out); } URI uri = URI.create(String.format("jar:file:%s", outputZip)); try (FileSystem filesystem = FileSystems.newFileSystem(uri, new HashMap<>())) { Path path1 = filesystem.getPath("/path/to/coverage.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path1))) .isEqualTo(ByteString.copyFromUtf8("coverage.gcda")); Path path2 = filesystem.getPath("/path/to/.hidden/coverage2.gcda"); assertThat(ByteString.readFrom(Files.newInputStream(path2))) .isEqualTo(ByteString.copyFromUtf8("coverage2.gcda")); } }
Source:
private Node getOrCreateSequence(RowKey rowKey, final int initialValue) { String updateSequenceQuery = getQuery( rowKey ); Map<String, Object> parameters = new HashMap<String, Object>(); parameters.put( "initialValue", initialValue ); parameters.put( "sequenceName", sequenceName( rowKey ) ); ExecutionEngine engine = new ExecutionEngine( neo4jDb ); ExecutionResult result = engine.execute( updateSequenceQuery, parameters ); ResourceIterator<Node> column = result.columnAs( "n" ); Node node = null; if ( column.hasNext() ) { node = column.next(); } column.close(); return node; }

Target:
private Node getOrCreateSequence(RowKey rowKey, final int initialValue) { String updateSequenceQuery = getQuery( rowKey ); Map<String, Object> parameters = new HashMap<String, Object>( 2 ); parameters.put( "initialValue", initialValue ); parameters.put( "sequenceName", sequenceName( rowKey ) ); ExecutionResult result = engine.execute( updateSequenceQuery, parameters ); ResourceIterator<Node> column = result.columnAs( "n" ); Node node = null; if ( column.hasNext() ) { node = column.next(); } column.close(); return node; }
Source:
private CassandraNode buildCassandraNode(Protos.Offer offer, boolean seed, String replacementForIp) { CassandraNode.Builder builder = CassandraNode.newBuilder() .setHostname(offer.getHostname()) .setTargetRunState(CassandraNode.TargetRunState.RUN) .addDataVolumes( DataVolume.newBuilder() .setPath(configuration.getDefaultConfigRole().getPreDefinedDataDirectory()) .build() ) .setSeed(seed); if (replacementForIp != null) { builder.setReplacementForIp(replacementForIp); } try { InetAddress ia = InetAddress.getByName(offer.getHostname()); int jmxPort = getPortMapping(PORT_JMX); if (ia.isLoopbackAddress()) { try (ServerSocket serverSocket = new ServerSocket(0)) { jmxPort = serverSocket.getLocalPort(); } catch (IOException e) { throw new RuntimeException(e); } } return builder.setIp(ia.getHostAddress()) .setJmxConnect(JmxConnect.newBuilder() .setIp("127.0.0.1") .setJmxPort(jmxPort) ) .build(); } catch (UnknownHostException e) { throw new RuntimeException(e); } }

Target:
private CassandraNode buildCassandraNode(Protos.Offer offer, boolean seed, String replacementForIp) { CassandraNode.Builder builder = CassandraNode.newBuilder() .setHostname(offer.getHostname()) .setTargetRunState(CassandraNode.TargetRunState.RUN) .addDataVolumes( DataVolume.newBuilder() .setPath(configuration.getDefaultConfigRole().getPreDefinedDataDirectory()) ) .setSeed(seed); if (replacementForIp != null) { builder.setReplacementForIp(replacementForIp); } try { InetAddress ia = InetAddress.getByName(offer.getHostname()); int jmxPort = getPortMapping(PORT_JMX); if (ia.isLoopbackAddress()) { try (ServerSocket serverSocket = new ServerSocket(0)) { jmxPort = serverSocket.getLocalPort(); } catch (IOException e) { throw new RuntimeException(e); } } return builder.setIp(ia.getHostAddress()) .setJmxConnect(JmxConnect.newBuilder() .setIp("127.0.0.1") .setJmxPort(jmxPort) ) .build(); } catch (UnknownHostException e) { throw new RuntimeException(e); } }
Source:
private MessageType getFilteredSchema(MessageType schema, List<String> expectedColumnNames) { List<Type> allColumns = schema.getFields(); List<Type> selectedColumns = new ArrayList<>(); for(String columnName: expectedColumnNames) { selectedColumns.add(allColumns.get(schema.getFieldIndex(columnName))); } MessageType filteredSchema = new MessageType(schema.getName(), selectedColumns); return filteredSchema; }

Target:
private MessageType getFilteredSchema(MessageType schema, List<String> expectedColumnNames) { List<Type> allColumns = schema.getFields(); List<Type> selectedColumns = new ArrayList<>(); for(String columnName: expectedColumnNames) { if(!partitionedColumnsHm.contains(columnName)) { selectedColumns.add(allColumns.get(schema.getFieldIndex(columnName))); } } return new MessageType(schema.getName(), selectedColumns); }
Source:
public void installServiceTask(String serviceTaskId, List<String> parameters, String referenceLink, Command onDone) { String branchName = null; if(workspaceProjectContext != null) { branchName = workspaceProjectContext.getActiveWorkspaceProject().get().getBranch().getName(); } if (parameters.isEmpty()) { serviceTasksService.call((Void) -> { onDone.execute(); fireChangeEvent(); }).installServiceTask(serviceTaskId, getInstallTarget(), null, branchName); } else { ServiceTaskInstallFormPresenter installFormPresenter = iocManager.lookupBean(ServiceTaskInstallFormPresenter.class).newInstance(); installFormPresenter.showView(onDone, serviceTaskId, getInstallTarget(), parameters, referenceLink); } }

Target:
public void installServiceTask(String serviceTaskId, List<String> parameters, String referenceLink, Command onDone) { if (parameters.isEmpty()) { serviceTasksService.call((Void) -> { onDone.execute(); fireChangeEvent(); }).installServiceTask(serviceTaskId, getInstallTarget(), null, getBranchName()); } else { ServiceTaskInstallFormPresenter installFormPresenter = iocManager.lookupBean(ServiceTaskInstallFormPresenter.class).newInstance(); installFormPresenter.showView(onDone, serviceTaskId, getInstallTarget(), parameters, referenceLink); } }
Source:
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for (int index = 0; index < text.length(); index++) { char c = text.charAt(index); if (isStartOfLine) { switch (c) { case ' ': spaces++; break; case '>': quotesThisLine++; spaces = 0; break; case '\n': appendbq(buff, quotesThisLine, quoteDepth); quoteDepth = quotesThisLine; appendsp(buff, spaces); spaces = 0; appendchar(buff, c); isStartOfLine = true; quotesThisLine = 0; break; default: isStartOfLine = false; appendbq(buff, quotesThisLine, quoteDepth); quoteDepth = quotesThisLine; appendsp(buff, spaces); spaces = 0; appendchar(buff, c); isStartOfLine = false; break; } } else { appendchar(buff, c); if (c == '\n') { isStartOfLine = true; quotesThisLine = 0; } } } if (quoteDepth > 0) { for (int i = quoteDepth; i > 0; i--) { buff.append(HTML_BLOCKQUOTE_END); } } text = buff.toString(); text = text.replaceAll( "\\Q" + HTML_NEWLINE + "\\E((\\Q" + HTML_NEWLINE + "\\E)+?)\\Q" + HTML_BLOCKQUOTE_END + "\\E", HTML_BLOCKQUOTE_END + "$1" ); text = ASCII_VERSION_OF_HR.matcher(text).replaceAll("<hr />"); StringBuffer sb = new StringBuffer(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); sb.append(htmlifyMessageHeader()); linkifyText(text, sb); sb.append(htmlifyMessageFooter()); text = sb.toString(); text = text.replaceAll("<gt>", "&gt;"); return text; }

Target:
public static String textToHtml(String text) { if (text.length() > MAX_SMART_HTMLIFY_MESSAGE_LENGTH) { return simpleTextToHtml(text); } StringBuilder buff = new StringBuilder(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); boolean isStartOfLine = true; int spaces = 0; int quoteDepth = 0; int quotesThisLine = 0; for (int index = 0; index < text.length(); index++) { char c = text.charAt(index); if (isStartOfLine) { switch (c) { case ' ': spaces++; break; case '>': quotesThisLine++; spaces = 0; break; case '\n': appendbq(buff, quotesThisLine, quoteDepth); quoteDepth = quotesThisLine; appendsp(buff, spaces); spaces = 0; appendchar(buff, c); isStartOfLine = true; quotesThisLine = 0; break; default: isStartOfLine = false; appendbq(buff, quotesThisLine, quoteDepth); quoteDepth = quotesThisLine; appendsp(buff, spaces); spaces = 0; appendchar(buff, c); isStartOfLine = false; break; } } else { appendchar(buff, c); if (c == '\n') { isStartOfLine = true; quotesThisLine = 0; } } } if (quoteDepth > 0) { for (int i = quoteDepth; i > 0; i--) { buff.append(HTML_BLOCKQUOTE_END); } } text = buff.toString(); text = text.replaceAll( "\\Q" + HTML_NEWLINE + "\\E((\\Q" + HTML_NEWLINE + "\\E)+?)\\Q" + HTML_BLOCKQUOTE_END + "\\E", HTML_BLOCKQUOTE_END + "$1" ); text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", "<hr />"); StringBuffer sb = new StringBuffer(text.length() + TEXT_TO_HTML_EXTRA_BUFFER_LENGTH); sb.append(htmlifyMessageHeader()); linkifyText(text, sb); sb.append(htmlifyMessageFooter()); text = sb.toString(); text = text.replaceAll("<gt>", "&gt;"); return text; }
Source:
public PatchSetComplexDisclosurePanel(final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); detailCache = ChangeCache.get(ps.getId().getParentKey()).getChangeDetailCache(); changeDetail = detailCache.get(); patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); if (gw != null && gw.isLinkableDraft(ps)) { final Anchor revlink = new Anchor(gw.getLinkName(), false, gw.toRevision(changeDetail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { final InlineLabel draftLabel = new InlineLabel(Util.C.draftPatchSetLabel()); draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } if (isOpen) { ensureLoaded(changeDetail.getCurrentPatchSetDetail()); } else { addOpenHandler(this); } }

Target:
public PatchSetComplexDisclosurePanel(final PatchSet ps, boolean isOpen) { super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); detailCache = ChangeCache.get(ps.getId().getParentKey()).getChangeDetailCache(); changeDetail = detailCache.get(); patchSet = ps; body = new FlowPanel(); setContent(body); final GitwebLink gw = Gerrit.getGitwebLink(); final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(revtxt); if (gw != null && gw.canLink(ps)) { final Anchor revlink = new Anchor(gw.getLinkName(), false, gw.toRevision(changeDetail.getChange() .getProject(), ps)); revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); getHeader().add(revlink); } if (ps.isDraft()) { final InlineLabel draftLabel = new InlineLabel(Util.C.draftPatchSetLabel()); draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); getHeader().add(draftLabel); } if (isOpen) { ensureLoaded(changeDetail.getCurrentPatchSetDetail()); } else { addOpenHandler(this); } }
Source:
public Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata) { validatePartitionColumns(tableMetadata); validateBucketColumns(tableMetadata); Optional<HiveBucketProperty> bucketProperty = getBucketProperty(tableMetadata.getProperties()); if (!bucketProperty.isPresent()) { return Optional.empty(); } if (!bucketProperty.get().getSortedBy().isEmpty() && !isSortedWritingEnabled(session)) { throw new PrestoException(NOT_SUPPORTED, "Writing to bucketed sorted Hive tables is disabled"); } HivePartitioningHandle hivePartitioningHandle; List<String> bucketedBy = bucketProperty.get().getBucketedBy(); HiveBucketProperty.BucketingType bucketingType = bucketProperty.get().getBucketingType(); OptionalInt maxCompatibleBucketCount = OptionalInt.of(bucketProperty.get().getBucketCount()); switch (bucketingType) { case HIVETYPE: Map<String, HiveType> hiveTypeMap = tableMetadata.getColumns().stream() .collect(toMap(ColumnMetadata::getName, column -> toHiveType(typeTranslator, column.getType()))); hivePartitioningHandle = createPartitioningHandleWithHiveType( bucketProperty.get().getBucketCount(), bucketedBy.stream() .map(hiveTypeMap::get) .collect(toImmutableList()), maxCompatibleBucketCount); break; case PRESTOTYPE: hivePartitioningHandle = createPartitioningHandleWithPrestoType( bucketProperty.get().getBucketCount(), bucketProperty.get().getTypes().get(), maxCompatibleBucketCount); break; default: throw new IllegalStateException(format("Unsupported bucketing type %s", bucketingType)); } return Optional.of(new ConnectorNewTableLayout(hivePartitioningHandle, bucketedBy)); }

Target:
public Optional<ConnectorNewTableLayout> getNewTableLayout(ConnectorSession session, ConnectorTableMetadata tableMetadata) { validatePartitionColumns(tableMetadata); validateBucketColumns(tableMetadata); Optional<HiveBucketProperty> bucketProperty = getBucketProperty(tableMetadata.getProperties()); if (!bucketProperty.isPresent()) { return Optional.empty(); } checkArgument(bucketProperty.get().getBucketFunctionType().equals(BucketFunctionType.HIVE_COMPATIBLE), "bucketFunctionType is expected to be HIVE_COMPATIBLE, got: %s", bucketProperty.get().getBucketFunctionType()); if (!bucketProperty.get().getSortedBy().isEmpty() && !isSortedWritingEnabled(session)) { throw new PrestoException(NOT_SUPPORTED, "Writing to bucketed sorted Hive tables is disabled"); } List<String> bucketedBy = bucketProperty.get().getBucketedBy(); Map<String, HiveType> hiveTypeMap = tableMetadata.getColumns().stream() .collect(toMap(ColumnMetadata::getName, column -> toHiveType(typeTranslator, column.getType()))); return Optional.of(new ConnectorNewTableLayout( createHiveCompatiblePartitioningHandle( bucketProperty.get().getBucketCount(), bucketedBy.stream() .map(hiveTypeMap::get) .collect(toImmutableList()), OptionalInt.of(bucketProperty.get().getBucketCount())), bucketedBy)); }
Source:
private void runLocalTrain() throws IOException { if(Constants.TENSORFLOW_DNN.equalsIgnoreCase(modelConfig.getAlgorithm())) { runTensorflowLocalTrain(); return; } runAkkaTrain(isForVarSelect ? 1 : modelConfig.getBaggingNum()); }

Target:
private void runLocalTrain() throws IOException { if(Constants.TENSORFLOW.equalsIgnoreCase(modelConfig.getAlgorithm())) { runTensorflowLocalTrain(); return; } else { runAkkaTrain(isForVarSelect ? 1 : modelConfig.getBaggingNum()); } }
Source:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String streamId = StringUtils.substringAfterLast(req.getRequestURI(), "/"); if (!streams.containsKey(streamId)) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); AudioStream stream = streams.get(streamId); String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof DiscreteAudioStream) { Integer size = ((DiscreteAudioStream) stream).size(); if (size != null) { resp.setContentLength(size); } } ServletOutputStream os = resp.getOutputStream(); IOUtils.copy(stream, os); resp.flushBuffer(); IOUtils.closeQuietly(stream); } }

Target:
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String streamId = StringUtils.substringAfterLast(req.getRequestURI(), "/"); if (!streams.containsKey(streamId)) { logger.debug("Received request for invalid stream id at {}", req.getRequestURI()); resp.sendError(HttpServletResponse.SC_NOT_FOUND); } else { logger.debug("Stream to serve is {}", streamId); AudioStream stream = streams.remove(streamId); String mimeType = null; if (stream.getFormat().getCodec() == AudioFormat.CODEC_MP3) { mimeType = "audio/mpeg"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_WAVE) { mimeType = "audio/wav"; } else if (stream.getFormat().getContainer() == AudioFormat.CONTAINER_OGG) { mimeType = "audio/ogg"; } if (mimeType != null) { resp.setContentType(mimeType); } if (stream instanceof DiscreteAudioStream) { Integer size = ((DiscreteAudioStream) stream).size(); if (size != null) { resp.setContentLength(size); } } ServletOutputStream os = resp.getOutputStream(); IOUtils.copy(stream, os); resp.flushBuffer(); IOUtils.closeQuietly(stream); } }
Source:
protected boolean validate() { boolean returnValue = true; Permission p = getPermissionDao().get(getParameters().getPermission().getId()); if (MultiLevelAdministrationHandler.isLastSuperUserPermission(p.getRoleId())) { getReturnValue().getValidationMessages() .add(EngineMessage.ERROR_CANNOT_REMOVE_LAST_SUPER_USER_ROLE.toString()); returnValue = false; } else if (p.getRoleType().equals(RoleType.ADMIN) && !isSystemSuperUser()) { addValidationMessage(EngineMessage.PERMISSION_REMOVE_FAILED_ONLY_SYSTEM_SUPER_USER_CAN_REMOVE_ADMIN_ROLES); returnValue = false; } if((getParameters().getUser() != null && !Objects.equals(p.getAdElementId(), getParameters().getUser().getId())) || (getParameters().getGroup() != null && !Objects.equals(p.getAdElementId(), getParameters().getGroup().getId()))) { addValidationMessage(EngineMessage.INHERITED_PERMISSION_CANT_BE_REMOVED); returnValue = false; } return returnValue; }

Target:
protected boolean validate() { boolean returnValue = true; Permission p = getPermissionDao().get(getParameters().getPermission().getId()); if (MultiLevelAdministrationHandler.isLastSuperUserPermission(p.getRoleId())) { getReturnValue().getValidationMessages() .add(EngineMessage.ERROR_CANNOT_REMOVE_LAST_SUPER_USER_ROLE.toString()); returnValue = false; } else if (p.getRoleType().equals(RoleType.ADMIN) && !isSystemSuperUser()) { addValidationMessage(EngineMessage.PERMISSION_REMOVE_FAILED_ONLY_SYSTEM_SUPER_USER_CAN_REMOVE_ADMIN_ROLES); returnValue = false; } if(getParameters().getTargetId() != null && !Objects.equals(p.getAdElementId(), getParameters().getTargetId())) { addValidationMessage(EngineMessage.INHERITED_PERMISSION_CANT_BE_REMOVED); returnValue = false; } return returnValue; }
Source:
private C4BlobKey storeBytesInDatabase(C4BlobStore store) throws LiteCoreException, IOException { final InputStream contentStream = getContentStream(); if (contentStream == null) { throw new IllegalStateException( "No data available to write for install." + "Please ensure that all blobs in the document have non-null content."); } C4BlobWriteStream blobOut = null; try { blobOut = store.openWriteStream(); final byte[] buffer = new byte[MAX_CACHED_CONTENT_LENGTH]; this.blobLength = 0; int n; while ((n = contentStream.read(buffer)) > 0) { blobOut.write(buffer, n); this.blobLength += n; } blobOut.install(); return blobOut.computeBlobKey(); } finally { try { contentStream.close(); } catch (IOException ignore) { } if (blobOut != null) { blobOut.close(); } } }

Target:
private C4BlobKey storeBytesInDatabase(C4BlobStore store) throws LiteCoreException, IOException { final InputStream contentStream = getContentStream(); if (contentStream == null) { throw new IllegalStateException( "No data available to write for install." + "Please ensure that all blobs in the document have non-null content."); } C4BlobWriteStream blobOut = null; try { blobOut = store.openWriteStream(); final byte[] buffer = new byte[MAX_CACHED_CONTENT_LENGTH]; this.blobLength = 0; int n; while ((n = contentStream.read(buffer)) >= 0) { blobOut.write(buffer, n); this.blobLength += n; } blobOut.install(); return blobOut.computeBlobKey(); } finally { try { contentStream.close(); } catch (IOException ignore) { } if (blobOut != null) { blobOut.close(); } } }
Source:
public Mono<Response<Certificate>> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateConfig) { Objects.requireNonNull(mergeCertificateConfig, "The merge certificate configuration cannot be null."); return withContext(context -> mergeCertificateWithResponse(mergeCertificateConfig, context)); }

Target:
public Mono<Response<Certificate>> mergeCertificateWithResponse(MergeCertificateOptions mergeCertificateConfig) { Objects.requireNonNull(mergeCertificateConfig, "'mergeCertificateConfig' cannot be null."); return withContext(context -> mergeCertificateWithResponse(mergeCertificateConfig, context)); }
Source:
public void setViewCache(ViewCache viewCache) { this.viewCache = viewCache; }

Target:
final void setViewCache(ViewCache viewCache) { this.viewCache = viewCache; }
Source:
public void create(final String name) { try { new JdkRequest(UriBuilder.fromUri(this.home).build()) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .method(Request.GET) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='create']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .method(Request.POST) .body() .set( String.format( "name=%s", URLEncoder.encode(name, CharEncoding.UTF_8) ) ) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }

Target:
public void create(final String name) { try { new JdkRequest(this.home) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .header(HttpHeaders.AUTHORIZATION, this.token) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(XmlResponse.class) .rel("/page/links/link[@rel='create']/@href") .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_XML) .method(Request.POST) .body() .formParam("name", name) .back() .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException(ex); } catch (IOException ex) { throw new IllegalStateException(ex); } }
Source:
public InputStream queryForStream(String query) { key(query); URI uri = uriBuilder.build(); HttpConnection get = Http.GET(uri); get.getConnection().addRequestProperty("Accept", "application/json"); return db.executeRequest(get); }

Target:
public InputStream queryForStream(String query) { key(query); URI uri = uriBuilder.build(); HttpConnection get = Http.GET(uri); get.requestProperties.put("Accept", "application/json"); return db.executeRequest(get); }
Source:
private void performHostVerification(InetAddress inetAddress, X509Certificate certificate) throws CertificateException { try { hostnameVerifier.verify(inetAddress.getHostAddress(), certificate); } catch (SSLException addressVerificationException) { try { LOG.debug("Failed to verify host address, attempting to verify host name with reverse dns lookup", addressVerificationException); hostnameVerifier.verify(inetAddress.getHostName(), certificate); } catch (SSLException hostnameVerificationException) { LOG.error("Failed to verify host address", addressVerificationException); LOG.error("Failed to verify hostname", hostnameVerificationException); throw new CertificateException("Failed to verify both host address and host name", hostnameVerificationException); } } }

Target:
private void performHostVerification(InetAddress inetAddress, X509Certificate certificate) throws CertificateException { String hostAddress = ""; String hostName = ""; try { hostAddress = inetAddress.getHostAddress(); hostnameVerifier.verify(hostAddress, certificate); } catch (SSLException addressVerificationException) { try { LOG.debug("Failed to verify host address: attempting to verify host name with reverse dns lookup", hostAddress, addressVerificationException); hostName = inetAddress.getHostName(); hostnameVerifier.verify(hostName, certificate); } catch (SSLException hostnameVerificationException) { LOG.error("Failed to verify host address: {}", hostAddress, addressVerificationException); LOG.error("Failed to verify hostname: {}", hostName, hostnameVerificationException); throw new CertificateException("Failed to verify both host address and host name", hostnameVerificationException); } } }
Source:
public boolean equals(Object o) { if (EqualityUtils.isSameReference(this, o)) { return true; } if (EqualityUtils.isNullOrNotSameClass(this, o)) { return false; } LineageEntry that = (LineageEntry) o; return EqualityUtils.isEqual(_segmentsFrom, that._segmentsFrom) && EqualityUtils.isEqual(_segmentsTo, that._segmentsTo) && EqualityUtils.isEqual(_state, that._state) && EqualityUtils.isEqual(_timestamp, that._timestamp); }

Target:
public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } LineageEntry that = (LineageEntry) o; return _timestamp == that._timestamp && _segmentsFrom.equals(that._segmentsFrom) && _segmentsTo.equals( that._segmentsTo) && _state == that._state; }
Source:
public static int getBlobPropertiesSerDeSize(BlobProperties properties) { return Version_Field_Size_In_Bytes + TTL_Field_Size_In_Bytes + Private_Field_Size_In_Bytes + CreationTime_Field_Size_In_Bytes + BlobSize_Field_Size_In_Bytes + Variable_Field_Size_In_Bytes + Utils.getNullableStringLength(properties.getContentType()) + Variable_Field_Size_In_Bytes + Utils.getNullableStringLength(properties.getOwnerId()) + Variable_Field_Size_In_Bytes + Utils.getNullableStringLength(properties.getServiceId()) + Short.BYTES + Short.BYTES; }

Target:
public static int getBlobPropertiesSerDeSize(BlobProperties properties) { return VERSION_FIELD_SIZE_IN_BYTES + TTL_FIELD_SIZE_IN_BYTES + PRIVATE_FIELD_SIZE_IN_BYTES + CREATION_TIME_FIELD_SIZE_IN_BYTES + BLOB_SIZE_FIELD_SIZE_IN_BYTES + Utils.getIntStringLength( properties.getContentType()) + Utils.getIntStringLength(properties.getOwnerId()) + Utils.getIntStringLength( properties.getServiceId()) + Short.BYTES + Short.BYTES; }
Source:
public <T> T retryWithHandle(final HandleCallback<T> callback) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().withHandle(callback); } }; final Predicate<Throwable> shouldRetry = new Predicate<Throwable>() { @Override public boolean apply(Throwable e) { return isTransientException(e); } }; final int maxTries = 10; try { return RetryUtils.retry(call, shouldRetry, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public <T> T retryWithHandle(final HandleCallback<T> callback) { final Callable<T> call = new Callable<T>() { @Override public T call() throws Exception { return getDBI().withHandle(callback); } }; final int maxTries = 10; try { return RetryUtils.retry(call, shouldRetry, maxTries); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) { Pair<Boolean, String> result; if (s_logger.isDebugEnabled()) { s_logger.debug("Run command on VR: " + routerIP + ", script: " + script + " with args: " + args); } try { result = SshHelper.sshExecute(routerIP, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/opt/cloud/bin/" + script + " " + args, 60000, 60000, (int)timeout.getMillis()); } catch (final Exception e) { final String msg = "Command failed due to " + e ; s_logger.error(msg); result = new Pair<Boolean, String>(false, msg); } if (s_logger.isDebugEnabled()) { s_logger.debug(script + " execution result: " + result.first().toString()); } return new ExecutionResult(result.first(), result.second()); }

Target:
public ExecutionResult executeInVR(final String routerIP, final String script, final String args, final Duration timeout) { Pair<Boolean, String> result; if (s_logger.isDebugEnabled()) { s_logger.debug("Run command on VR: " + routerIP + ", script: " + script + " with args: " + args); } try { result = SshHelper.sshExecute(routerIP, DEFAULT_DOMR_SSHPORT, "root", getSystemVMKeyFile(), null, "/opt/cloud/bin/" + script + " " + args, VRScripts.CONNECTION_TIMEOUT, VRScripts.CONNECTION_TIMEOUT, timeout); } catch (final Exception e) { final String msg = "Command failed due to " + e ; s_logger.error(msg); result = new Pair<Boolean, String>(false, msg); } if (s_logger.isDebugEnabled()) { s_logger.debug(script + " execution result: " + result.first().toString()); } return new ExecutionResult(result.first(), result.second()); }