auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void resample() { double[] logWeights = new double[particles.size()]; boolean[] alreadySampled = new boolean[particles.size()]; double maxLogWeight = Double.NEGATIVE_INFINITY; double sumWeights = 0; double[] normalizedWeights = new double[particles.size()]; List<Particle> newParticles = new ArrayList<Particle>(); for (int i = 0; i < particles.size(); i++) { logWeights[i] = particles.get(i).getLatestLogWeight(); maxLogWeight = Math.max(maxLogWeight, logWeights[i]); } if (maxLogWeight == Double.NEGATIVE_INFINITY) { throw new IllegalArgumentException("All particles have zero weight"); } for (int i = 0; i < particles.size(); i++) { normalizedWeights[i] = Math.exp(logWeights[i] - maxLogWeight); if (i > 0) normalizedWeights[i] += normalizedWeights[i - 1]; } sumWeights = normalizedWeights[particles.size() - 1]; double ratio = sumWeights / numParticles; double basis = 0, sampleKey; int selection = 0; for (int i = 0; i < numParticles; i++) { sampleKey = basis + Util.random() * ratio; basis += ratio; while (normalizedWeights[selection] < sampleKey) ++selection; if (!alreadySampled[selection]) { newParticles.add(particles.get(selection)); alreadySampled[selection] = true; } else { newParticles.add(particles.get(selection).copy()); } } particles = newParticles; }

Target:
protected void resample() { double[] logWeights = new double[particles.size()]; boolean[] alreadySampled = new boolean[particles.size()]; double maxLogWeight = Double.NEGATIVE_INFINITY; double sumWeights = 0; double[] normalizedWeights = new double[particles.size()]; List<Particle> newParticles = new ArrayList<Particle>(); for (int i = 0; i < particles.size(); i++) { logWeights[i] = particles.get(i).getLatestLogWeight(); maxLogWeight = Math.max(maxLogWeight, logWeights[i]); } if (maxLogWeight == Double.NEGATIVE_INFINITY) { throw new IllegalArgumentException("All particles have zero weight"); } for (int i = 0; i < particles.size(); i++) { normalizedWeights[i] = Math.exp(logWeights[i] - maxLogWeight); if (i > 0) normalizedWeights[i] += normalizedWeights[i - 1]; } sumWeights = normalizedWeights[particles.size() - 1]; double ratio = sumWeights / numParticles; double basis = 0; double sampleKey = 0; int selection = 0; for (int i = 0; i < numParticles; i++) { sampleKey = basis + Util.random() * ratio; basis += ratio; while (normalizedWeights[selection] < sampleKey) ++selection; if (!alreadySampled[selection]) { newParticles.add(particles.get(selection)); alreadySampled[selection] = true; } else { newParticles.add(particles.get(selection).copy()); } } particles = newParticles; }
Source:
public List<FileSinkCommittable> commit(List<FileSinkCommittable> committables) { List<FileSinkCommittable> needRetry = new ArrayList<>(); for (FileSinkCommittable committable : committables) { if (committable.hasPendingFile()) { try { bucketWriter.recoverPendingFile(committable.getPendingFile()).commitAfterRecovery(); } catch (IOException e) { LOG.error("Failed to commit {}", committable.getPendingFile()); needRetry.add(committable); } } if (committable.hasInProgressFileToCleanup()) { try { bucketWriter.cleanupInProgressFileRecoverable(committable.getInProgressFileToCleanup()); } catch (IOException e) { LOG.error("Failed to cleanup {}", committable.getInProgressFileToCleanup()); needRetry.add(committable); } } } return needRetry; }

Target:
public List<FileSinkCommittable> commit(List<FileSinkCommittable> committables) throws IOException { for (FileSinkCommittable committable : committables) { if (committable.hasPendingFile()) { bucketWriter.recoverPendingFile(committable.getPendingFile()).commitAfterRecovery(); } if (committable.hasInProgressFileToCleanup()) { bucketWriter.cleanupInProgressFileRecoverable(committable.getInProgressFileToCleanup()); } } return Collections.emptyList(); }
Source:
private static Optional<Changeset> getChangeset(Component component, ScmInfo scmInfo, DefaultIssue issue) { Set<Integer> involvedLines = new HashSet<>(); DbIssues.Locations locations = issue.getLocations(); if (locations != null) { if (locations.hasTextRange()) { addLines(involvedLines, locations.getTextRange()); } for (Flow f : locations.getFlowList()) { for (Location l : f.getLocationList()) { if (l.getComponentId().equals(component.getUuid())) { addLines(involvedLines, l.getTextRange()); } } } if (!involvedLines.isEmpty()) { return involvedLines.stream() .map(scmInfo::getChangesetForLine) .max(Comparator.comparingLong(Changeset::getDate)); } } Changeset latestChangeset = scmInfo.getLatestChangeset(); if (latestChangeset != null) { return Optional.of(latestChangeset); } return Optional.empty(); }

Target:
private static Optional<Changeset> getChangeset(Component component, ScmInfo scmInfo, DefaultIssue issue) { Set<Integer> involvedLines = new HashSet<>(); DbIssues.Locations locations = issue.getLocations(); if (locations != null) { if (locations.hasTextRange()) { addLines(involvedLines, locations.getTextRange()); } for (Flow f : locations.getFlowList()) { for (Location l : f.getLocationList()) { if (Objects.equals(l.getComponentId(), component.getUuid())) { addLines(involvedLines, l.getTextRange()); } } } if (!involvedLines.isEmpty()) { return involvedLines.stream() .map(scmInfo::getChangesetForLine) .max(Comparator.comparingLong(Changeset::getDate)); } } Changeset latestChangeset = scmInfo.getLatestChangeset(); if (latestChangeset != null) { return Optional.of(latestChangeset); } return Optional.empty(); }
Source:
public static boolean wouldBeBreakpoint(final byte[] bases) { if ( bases.length <= 1 ) return false; else { for (int i = 0; i < bases.length; i++) { final byte base = bases[i]; if (base == '[' || base == ']') { return true; } } return false; } }

Target:
public static boolean wouldBeBreakpoint(final byte[] bases) { if (bases.length <= 1) { return false; } for (int i = 0; i < bases.length; i++) { final byte base = bases[i]; if (base == BREAKEND_EXTENDING_LEFT || base == BREAKEND_EXTENDING_RIGHT) { return true; } } return false; }
Source:
public Optional<Schedule> parse(String scheduleString) { return delegates.stream() .map(NotThrowingParser::of) .map(it -> it.parse(scheduleString)) .filter(Optional::isPresent).map(Optional::get) .findFirst(); }

Target:
public Optional<Schedule> parse(String scheduleString) { return delegates.stream() .map(it -> it.parse(scheduleString)) .filter(Optional::isPresent).map(Optional::get) .findFirst(); }
Source:
public void closeJob(GeneralSecurityException gse) { callback.onCompletion(new EncryptJobResult(null, null, null), gse); }

Target:
public void closeJob(GeneralSecurityException gse) { callback.onCompletion(null, gse); }
Source:
public void jobsGridPortlet_fillColumnsFirst() throws MalformedURLException { createFreeStyleJob(); createFreeStyleJob(); createFreeStyleJob(); createFreeStyleJob(); DashboardView v = createDashboardView(); JobsGridPortlet jobsGridPortlet = v.addBottomPortlet(JobsGridPortlet.class); jobsGridPortlet.setNumberOfColumns(3); jobsGridPortlet.setFillColumnFirst(true); v.save(); assertThat(jobsGridPortlet.getJob(1, 3), nullValue()); assertThat(jobsGridPortlet.getJob(2, 2), notNullValue()); }

Target:
public void jobsGridPortlet_fillColumnsFirst() { createFreeStyleJob(); createFreeStyleJob(); createFreeStyleJob(); createFreeStyleJob(); DashboardView v = createDashboardView(); JobsGridPortlet jobsGridPortlet = v.addBottomPortlet(JobsGridPortlet.class); jobsGridPortlet.setNumberOfColumns(3); jobsGridPortlet.setFillColumnFirst(true); v.save(); assertThat(jobsGridPortlet.getJob(1, 3), nullValue()); assertThat(jobsGridPortlet.getJob(2, 2), notNullValue()); }
Source:
private void initView(Context context) { View view = inflate(context, R.layout.reader_comments_post_header_view, this); }

Target:
private void initView(Context context) { inflate(context, R.layout.reader_comments_post_header_view, this); }
Source:
protected Channel buildChannel(final ServerConfig serverConfig, final ChannelHandler handlerAdapter) throws InterruptedException { SSLContext sslContext = serverConfig.getSSLContext(); this.ssl = sslContext != null ? true : false; return new ServerBootstrap() .group(execController.getEventLoopGroup()) .channel(ChannelImplDetector.getServerSocketChannelImpl()) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslContext != null) { SSLEngine sslEngine = sslContext.createSSLEngine(); sslEngine.setUseClientMode(false); pipeline.addLast("ssl", new SslHandler(sslEngine)); } pipeline.addLast("decoder", new HttpRequestDecoder(4096, 8192, 8192, false)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("aggregator", new HttpObjectAggregator(serverConfig.getMaxContentLength())); pipeline.addLast("deflater", new SmartHttpContentCompressor()); pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("adapter", handlerAdapter); } }) .bind(buildSocketAddress(serverConfig)) .sync() .channel(); }

Target:
protected Channel buildChannel(final ServerConfig serverConfig, final ChannelHandler handlerAdapter) throws InterruptedException { SSLContext sslContext = serverConfig.getSSLContext(); this.useSsl = sslContext != null; return new ServerBootstrap() .group(execController.getEventLoopGroup()) .channel(ChannelImplDetector.getServerSocketChannelImpl()) .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT) .childHandler(new ChannelInitializer<SocketChannel>() { @Override protected void initChannel(SocketChannel ch) throws Exception { ChannelPipeline pipeline = ch.pipeline(); if (sslContext != null) { SSLEngine sslEngine = sslContext.createSSLEngine(); sslEngine.setUseClientMode(false); pipeline.addLast("ssl", new SslHandler(sslEngine)); } pipeline.addLast("decoder", new HttpRequestDecoder(4096, 8192, 8192, false)); pipeline.addLast("encoder", new HttpResponseEncoder()); pipeline.addLast("aggregator", new HttpObjectAggregator(serverConfig.getMaxContentLength())); pipeline.addLast("deflater", new SmartHttpContentCompressor()); pipeline.addLast("chunkedWriter", new ChunkedWriteHandler()); pipeline.addLast("adapter", handlerAdapter); } }) .bind(buildSocketAddress(serverConfig)) .sync() .channel(); }
Source:
public PrimitiveToStringConversion(Class<?> sourceType) { super( sourceType ); if ( !sourceType.isPrimitive() ) { throw new IllegalArgumentException( sourceType + " is not primitive type." ); } }

Target:
public PrimitiveToStringConversion(Class<?> sourceType) { super( sourceType ); if ( !sourceType.isPrimitive() ) { throw new IllegalArgumentException( sourceType + " is no primitive type." ); } }
Source:
public void updateProjectConfig(Project project, ProjectConfig projectConfig) throws ServerException, ValueStorageException, ProjectTypeConstraintException, ForbiddenException { List<ProjectConfigDto> modules = new ArrayList<>(); for (ProjectConfig config : projectConfig.getModules()) { getModulesRecursive(config, modules); } final ProjectConfigDto projectConfigDto = DtoFactory.getInstance().createDto(ProjectConfigDto.class) .withPath(project.getPath()) .withName(project.getName()) .withModules(modules) .withSource(DtoFactory.getInstance().createDto(SourceStorageDto.class)); ProjectTypes types = new ProjectTypes(project, projectConfig.getType(), projectConfig.getMixins(), this); types.removeTransient(); projectConfigDto.setType(types.getPrimary().getId()); projectConfigDto.setDescription(projectConfig.getDescription()); ArrayList<String> ms = new ArrayList<>(); ms.addAll(types.getMixins().keySet()); projectConfigDto.setMixins(ms); projectConfigDto.setAttributes(projectConfig.getAttributes()); try { final VirtualFileEntry codenvyDir = project.getBaseFolder().getChild(CODENVY_DIR); if (codenvyDir == null || !codenvyDir.isFolder()) { project.getBaseFolder().createFolder(CODENVY_DIR); } } catch (ForbiddenException | ConflictException e) { throw new ServerException(e.getServiceError()); } filterAttributesRecursive(projectConfigDto, types, project.getBaseFolder()); updateProjectInWorkspace(project.getWorkspace(), projectConfigDto); }

Target:
public void updateProjectConfig(Project project, ProjectConfig projectConfig) throws ServerException, ValueStorageException, ProjectTypeConstraintException, ForbiddenException { List<ProjectConfigDto> modules = new ArrayList<>(); for (ProjectConfig config : projectConfig.getModules()) { getModulesRecursive(config, modules); } final ProjectConfigDto projectConfigDto = DtoFactory.getInstance().createDto(ProjectConfigDto.class) .withPath(project.getPath()) .withName(project.getName()) .withModules(modules) .withSource(DtoFactory.getInstance().createDto(SourceStorageDto.class)); ProjectTypes types = new ProjectTypes(project, projectConfig.getType(), projectConfig.getMixins(), this); types.removeTransient(); projectConfigDto.setType(types.getPrimary().getId()); projectConfigDto.setDescription(projectConfig.getDescription()); projectConfigDto.setMixins(new ArrayList<>(types.getMixins().keySet())); projectConfigDto.setAttributes(projectConfig.getAttributes()); try { final VirtualFileEntry codenvyDir = project.getBaseFolder().getChild(CODENVY_DIR); if (codenvyDir == null || !codenvyDir.isFolder()) { project.getBaseFolder().createFolder(CODENVY_DIR); } } catch (ForbiddenException | ConflictException e) { throw new ServerException(e.getServiceError()); } filterAttributesRecursive(projectConfigDto, types, project.getBaseFolder()); updateProjectInWorkspace(project.getWorkspace(), projectConfigDto); }
Source:
private String sortTableColumns(String sql) { int posColDef = sql.indexOf('('); String colsStr = sql.substring(posColDef+1, sql.length()-1); String[] cols = colsStr.split(" *, *(?![^\\(]*\\))"); Arrays.sort(cols); return sql.substring(0, posColDef+1) + TextUtils.join(", ", cols) + ")"; }

Target:
private String sortTableColumns(String sql) { int positionOfColumnDefinitions = sql.indexOf('('); String columnDefinitionsSql = sql.substring(positionOfColumnDefinitions + 1, sql.length() - 1); String[] columnDefinitions = columnDefinitionsSql.split(" *, *(?![^(]*\\))"); Arrays.sort(columnDefinitions); String sqlPrefix = sql.substring(0, positionOfColumnDefinitions + 1); String sortedColumnDefinitionsSql = TextUtils.join(", ", columnDefinitions); return sqlPrefix + sortedColumnDefinitionsSql + ")"; }
Source:
private void updateEid() { Map<Integer, Integer> slotMapping = mTelephonyManager.getLogicalToPhysicalSlotMapping(); Integer physicalSlotId = slotMapping.get(mSlotId); if (physicalSlotId != null) { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); for (UiccCardInfo info : infos) { if (info != null && info.getSlotIndex() == physicalSlotId.intValue()) { if (info.isEuicc()) { String eid = info.getEid(); if (!TextUtils.isEmpty(eid)) { mDialog.setText(EID_INFO_VALUE_ID, eid); } } else { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } break; } } } }

Target:
private void updateEid() { boolean shouldHaveEid = false; String eid = null; if (mTelephonyManager.getPhoneCount() > PhoneConstants.MAX_PHONE_COUNT_SINGLE_SIM) { Map<Integer, Integer> slotMapping = mTelephonyManager.getLogicalToPhysicalSlotMapping(); Integer physicalSlotId = slotMapping.get(mSlotId); if (physicalSlotId != null) { List<UiccCardInfo> infos = mTelephonyManager.getUiccCardsInfo(); for (UiccCardInfo info : infos) { if (info.getSlotIndex() == physicalSlotId.intValue()) { if (info.isEuicc()) { shouldHaveEid = true; eid = info.getEid(); if (TextUtils.isEmpty(eid)) { eid = mEuiccManager.createForCardId(info.getCardId()).getEid(); } } break; } } } } else { if (mEuiccManager.isEnabled()) { shouldHaveEid = true; eid = mEuiccManager.getEid(); } } if (TextUtils.isEmpty(eid)) { if (!shouldHaveEid) { mDialog.removeSettingFromScreen(EID_INFO_LABEL_ID); mDialog.removeSettingFromScreen(EID_INFO_VALUE_ID); } } else { mDialog.setText(EID_INFO_VALUE_ID, eid); } }
Source:
public ScanRuntimeProvider getScanRuntimeProvider(ScanContext context) { boolean isBounded = numberOfRows == null; return SourceFunctionProvider.of(createSource(), isBounded); }

Target:
public ScanRuntimeProvider getScanRuntimeProvider(ScanContext context) { boolean isBounded = numberOfRows != null; return SourceFunctionProvider.of(createSource(), isBounded); }
Source:
public static ModeInfo findMode(String mime, String path) { ModeInfo m = byMime.get(mime); if (m != null) { return m; } int s = path.lastIndexOf('/'); int d = path.lastIndexOf('.'); if (s > d) { return null; } if (byExt == null) { byExt = NativeMap.create(); for (ModeInfo mode : Natives.asList(all())) { for (String ext : Natives.asList(mode.ext())) { byExt.put(ext, mode); } } } return byExt.get(path.substring(d + 1)); }

Target:
public static ModeInfo findMode(String mime, String path) { ModeInfo m = byMime.get(mime); if (m != null) { return m; } int s = path.lastIndexOf('/'); int d = path.lastIndexOf('.'); if (d == -1 || s > d) { return null; } if (byExt == null) { byExt = NativeMap.create(); for (ModeInfo mode : Natives.asList(all())) { for (String ext : Natives.asList(mode.ext())) { byExt.put(ext, mode); } } } return byExt.get(path.substring(d + 1)); }
Source:
private void initializeMap() { mapView.setStyleUrl("asset://mapstyle.json"); mapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE); mapView.setOnMyLocationChangeListener(new MapView.OnMyLocationChangeListener() { @Override public void onMyLocationChange(@Nullable Location location) { makeUseOfNewLocation(location); if (!firstLocationLock) { goToUserLocation(); firstLocationLock = true; } } }); mapView.setOnScrollListener(new MapView.OnScrollListener() { @Override public void onScroll() { fetchNearbyPages(); } }); mapView.setOnMarkerClickListener(new MapView.OnMarkerClickListener() { @Override public boolean onMarkerClick(@NonNull Marker marker) { for (NearbyPage page : lastResult.getList()) { if (page.getTitle().equals(marker.getTitle())) { PageTitle title = new PageTitle(page.getTitle(), site, page.getThumblUrl()); ((PageActivity) getActivity()).showLinkPreview(title, HistoryEntry.SOURCE_NEARBY); } } return true; } }); }

Target:
private void initializeMap() { mapView.setStyleUrl("asset://mapstyle.json"); mapView.setMyLocationTrackingMode(MyLocationTracking.TRACKING_NONE); mapView.setOnMyLocationChangeListener(new MapView.OnMyLocationChangeListener() { @Override public void onMyLocationChange(@Nullable Location location) { makeUseOfNewLocation(location); if (!firstLocationLock) { goToUserLocation(); firstLocationLock = true; } } }); mapView.setOnScrollListener(new MapView.OnScrollListener() { @Override public void onScroll() { fetchNearbyPages(); } }); mapView.setOnMarkerClickListener(new MapView.OnMarkerClickListener() { @Override public boolean onMarkerClick(@NonNull Marker marker) { NearbyPage page = findNearbyPageFromMarker(marker); if (page != null) { PageTitle title = new PageTitle(page.getTitle(), site, page.getThumblUrl()); ((PageActivity) getActivity()).showLinkPreview(title, HistoryEntry.SOURCE_NEARBY); return true; } else { return false; } } }); }
Source:
private double calculateVarianceOfCopyNeutralSegmentMeans(final List<ACNVModeledSegment> segments, final double meanBiasInCR) { Utils.nonNull(segments); final Variance varianceCalculator = new Variance(); return varianceCalculator.evaluate(segments.stream() .filter(s -> Math.abs(s.getSegmentMeanInCRSpace() - 1 + meanBiasInCR) < 0.1) .mapToDouble(s -> s.getSegmentMeanInCRSpace()).toArray()); }

Target:
private double calculateVarianceOfCopyNeutralSegmentMeans(final List<ACNVModeledSegment> segments, final double meanBiasInCR) { Utils.nonNull(segments); final double neutralCR = 1 + meanBiasInCR; final double[] neutralSegmentMeans = segments.stream() .mapToDouble(ACNVModeledSegment::getSegmentMeanInCRSpace) .filter(m -> Math.abs(m - neutralCR) < CLOSE_ENOUGH_TO_COPY_NEUTRAL_IN_CR).toArray(); return new Variance().evaluate(neutralSegmentMeans); }
Source:
private String attachUserToSession(String authzName, ExtMap principalRecord) { DirectoryUtils.flatGroups(principalRecord); DbUser dbUser = DirectoryUtils.mapPrincipalRecordToDbUser(authzName, principalRecord); if (dbUser == null) { throw new RuntimeException("User not found in database"); } String engineSessionId; try { byte s[] = new byte[64]; SecureRandom.getInstance("SHA1PRNG").nextBytes(s); engineSessionId = new Base64(0).encodeToString(s); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } sessionDataContainer.setUser(engineSessionId, dbUser); sessionDataContainer.refresh(engineSessionId); sessionDataContainer.setPrincipalRecord(engineSessionId, principalRecord); return engineSessionId; }

Target:
private String attachUserToSession(String authzName, ExtMap principalRecord) { DirectoryUtils.flatGroups(principalRecord); DbUser dbUser = new DbUser(DirectoryUtils.mapPrincipalRecordToDirectoryUser(authzName, principalRecord)); dbUser.setId(Guid.newGuid()); String engineSessionId; try { byte s[] = new byte[64]; SecureRandom.getInstance("SHA1PRNG").nextBytes(s); engineSessionId = new Base64(0).encodeToString(s); } catch (NoSuchAlgorithmException e) { throw new RuntimeException(e); } sessionDataContainer.setUser(engineSessionId, dbUser); sessionDataContainer.refresh(engineSessionId); sessionDataContainer.setPrincipalRecord(engineSessionId, principalRecord); return engineSessionId; }
Source:
private Object[] mapExpandedElements(AbstractHistoryCategory[] categories, Object[] expandedElements) { HashSet<String> names = new HashSet<>(); for (Object expandedElement : expandedElements) { names.add(((DateHistoryCategory) expandedElement).getName()); } ArrayList<AbstractHistoryCategory> expandable = new ArrayList<>(); for (AbstractHistoryCategory categorie : categories) { if (names.contains(categorie.getName())) { expandable.add(categorie); } } return expandable.toArray(new Object[expandable.size()]); }

Target:
private Object[] mapExpandedElements(AbstractHistoryCategory[] categories, Object[] expandedElements) { HashSet<String> names = new HashSet<>(); for (Object expandedElement : expandedElements) { names.add(((DateHistoryCategory) expandedElement).getName()); } ArrayList<AbstractHistoryCategory> expandable = new ArrayList<>(); for (AbstractHistoryCategory category : categories) { if (names.contains(category.getName())) { expandable.add(category); } } return expandable.toArray(new Object[expandable.size()]); }
Source:
public GlueHiveMetastore(HdfsEnvironment hdfsEnvironment, GlueHiveMetastoreConfig glueConfig) { this(hdfsEnvironment, glueConfig, new GlueClientFactory(glueConfig).newClient()); }

Target:
public GlueHiveMetastore(HdfsEnvironment hdfsEnvironment, GlueHiveMetastoreConfig glueConfig) { this(hdfsEnvironment, glueConfig, createAsyncGlueClient(glueConfig)); }
Source:
public static int enumToBinary(final CigarOperator e) { return e.ordinal(); }

Target:
public static int enumToBinary(final CigarOperator e) { return e.bamEncoding; }
Source:
public static BlobProperties buildBlobProperties(Map<String, Object> args) throws RestServiceException { Account account = getAccountFromArgs(args); Container container = getContainerFromArgs(args); String serviceId = getHeader(args, Headers.SERVICE_ID, true); String contentType = getHeader(args, Headers.AMBRY_CONTENT_TYPE, true); String ownerId = getHeader(args, Headers.OWNER_ID, false); long ttl = Utils.Infinite_Time; String ttlStr = getHeader(args, Headers.TTL, false); if (ttlStr != null) { try { ttl = Long.parseLong(ttlStr); if (ttl < -1) { throw new RestServiceException(Headers.TTL + "[" + ttl + "] is not valid (has to be >= -1)", RestServiceErrorCode.InvalidArgs); } } catch (NumberFormatException e) { throw new RestServiceException(Headers.TTL + "[" + ttlStr + "] could not parsed into a number", RestServiceErrorCode.InvalidArgs); } } boolean isPrivate = !container.isCacheable(); return new BlobProperties(-1, serviceId, ownerId, contentType, isPrivate, ttl, account.getId(), container.getId(), false); }

Target:
public static BlobProperties buildBlobProperties(Map<String, Object> args) throws RestServiceException { Account account = getAccountFromArgs(args); Container container = getContainerFromArgs(args); String serviceId = getHeader(args, Headers.SERVICE_ID, true); String contentType = getHeader(args, Headers.AMBRY_CONTENT_TYPE, true); String ownerId = getHeader(args, Headers.OWNER_ID, false); long ttl = Utils.Infinite_Time; String ttlStr = getHeader(args, Headers.TTL, false); if (ttlStr != null) { try { ttl = Long.parseLong(ttlStr); if (ttl < -1) { throw new RestServiceException(Headers.TTL + "[" + ttl + "] is not valid (has to be >= -1)", RestServiceErrorCode.InvalidArgs); } } catch (NumberFormatException e) { throw new RestServiceException(Headers.TTL + "[" + ttlStr + "] could not parsed into a number", RestServiceErrorCode.InvalidArgs); } } boolean isPrivate = !container.isCacheable(); return new BlobProperties(-1, serviceId, ownerId, contentType, isPrivate, ttl, account.getId(), container.getId(), container.isEncrypted()); }
Source:
public void testJWTIssuedAtFuture() throws Exception { String url = getContextBaseUrl() + "/users"; NumericDate tokenIssuedAtNumericDate = NumericDate.now(); tokenIssuedAtNumericDate.addSeconds(300); String token = securityTokenProvider.getToken("admin", Collections.emptyMap(), 10, tokenIssuedAtNumericDate); given().header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(token)) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.UNAUTHORIZED.value()) .body("error", equalTo("invalid.token")); }

Target:
public void testJWTIssuedAtFuture() throws Exception { String url = getContextBaseUrl() + "/users"; NumericDate futureNumericDate = NumericDate.now(); futureNumericDate.addSeconds(300); String token = securityTokenProvider.getToken("admin", Collections.emptyMap(), 10, futureNumericDate); given().header(HttpHeaders.AUTHORIZATION, getAuthorizationHeader(token)) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE) .when() .get(url) .then() .statusCode(HttpStatus.UNAUTHORIZED.value()) .body("error", equalTo("invalid.token")); }
Source:
public AbandonChangeDialog(final PatchSet.Id psi, final AsyncCallback<?> callback) { super(false, true); psid = psi; appCallback = callback; addStyleName("gerrit-AbandonChangeDialog"); panel = new VerticalPanel(); add(panel); panel.add(new SmallHeading(Util.C.headingAbandonMessage())); final VerticalPanel mwrap = new VerticalPanel(); mwrap.setStyleName("gerrit-AbandonMessage"); panel.add(mwrap); message = new TextArea(); message.setCharacterWidth(60); message.setVisibleLines(10); DOM.setElementPropertyBoolean(message.getElement(), "spellcheck", true); mwrap.add(message); final FlowPanel buttonPanel = new FlowPanel(); buttonPanel.setStyleName("gerrit-CommentEditor-Buttons"); panel.add(buttonPanel); sendButton = new Button(Util.C.buttonAbandonChangeSend()); sendButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { sendButton.setEnabled(false); PatchUtil.DETAIL_SVC.abandonChange(message.getText().trim(), psid, new GerritCallback<VoidResult>() { public void onSuccess(VoidResult result) { if (appCallback != null) { appCallback.onSuccess(null); } hide(); } @Override public void onFailure(Throwable caught) { sendButton.setEnabled(true); super.onFailure(caught); } }); } }); buttonPanel.add(sendButton); cancelButton = new Button(Util.C.buttonAbandonChangeCancel()); cancelButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { if (appCallback != null) { appCallback.onFailure(null); } hide(); } }); buttonPanel.add(cancelButton); }

Target:
public AbandonChangeDialog(final PatchSet.Id psi, final AsyncCallback<?> callback) { super(false, true); psid = psi; appCallback = callback; addStyleName("gerrit-AbandonChangeDialog"); panel = new FlowPanel(); add(panel); panel.add(new SmallHeading(Util.C.headingAbandonMessage())); final FlowPanel mwrap = new FlowPanel(); mwrap.setStyleName("gerrit-AbandonMessage"); panel.add(mwrap); message = new TextArea(); message.setCharacterWidth(60); message.setVisibleLines(10); DOM.setElementPropertyBoolean(message.getElement(), "spellcheck", true); mwrap.add(message); final FlowPanel buttonPanel = new FlowPanel(); buttonPanel.setStyleName("gerrit-CommentEditor-Buttons"); panel.add(buttonPanel); sendButton = new Button(Util.C.buttonAbandonChangeSend()); sendButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { sendButton.setEnabled(false); PatchUtil.DETAIL_SVC.abandonChange(psid, message.getText().trim(), new GerritCallback<VoidResult>() { public void onSuccess(VoidResult result) { if (appCallback != null) { appCallback.onSuccess(null); } hide(); } @Override public void onFailure(Throwable caught) { sendButton.setEnabled(true); super.onFailure(caught); } }); } }); buttonPanel.add(sendButton); cancelButton = new Button(Util.C.buttonAbandonChangeCancel()); cancelButton.addClickListener(new ClickListener() { public void onClick(Widget sender) { hide(); } }); buttonPanel.add(cancelButton); }
Source:
protected void onPostExecute(Integer[] result){ System.out.println("onPostExecute"); if(result[0] == SUCCESS) { Toast.makeText(EncryptedSharedHealthRecordSyncTask.context, "Uploaded " + result[1] +" SHR Data items", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(EncryptedSharedHealthRecordSyncTask.context, "Error Uploading SHR Data. Uploaded " + result[1] + ", Failed " + result[2], Toast.LENGTH_SHORT).show(); } syncInProgress = false; }

Target:
protected void onPostExecute(Integer[] result){ if(result[0] == SUCCESS) { Toast.makeText(EncryptedSharedHealthRecordSyncTask.context, "Uploaded " + result[1] +" SHR Data items", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(EncryptedSharedHealthRecordSyncTask.context, "Error Uploading SHR Data. Uploaded " + result[1] + ", Failed " + result[2], Toast.LENGTH_SHORT).show(); } syncInProgress = false; }
Source:
public String getRoomCode(String displayName) { UI.doubleClick(driver.findElement(By.xpath(" return roomCodeTxtBox.getAttribute("value"); }

Target:
public String getRoomCode(String displayName) { UI.doubleClick(driver.findElement(By.xpath(" + displayName + "')and@class='ng-binding']"))); return roomCodeTxtBox.getAttribute("value"); }
Source:
public boolean canEdit(Context context, Item item) throws SQLException { if (authorizeService.authorizeActionBoolean(context, item, Constants.WRITE)) { return true; } if (item.getOwningCollection() == null) { if (!isAnInprogressSubmission(context, item)) { return true; } else { return false; } } return collectionService.canEditBoolean(context, item.getOwningCollection(), false); }

Target:
public boolean canEdit(Context context, Item item) throws SQLException { if (authorizeService.authorizeActionBoolean(context, item, Constants.WRITE)) { return true; } if (item.getOwningCollection() == null) { if (!isInProgressSubmission(context, item)) { return true; } else { return false; } } return collectionService.canEditBoolean(context, item.getOwningCollection(), false); }
Source:
public byte[] getFirmwareImage(final String firmwareIdentification) throws FirmwareImageFactoryException { try { URL downloadUrl = new URL(this.url + firmwareIdentification); this.checkUrl(downloadUrl); return this.download(downloadUrl); } catch (final MalformedURLException e) { throw new FirmwareImageFactoryException(EXCEPTION_MSG_MALFORMED_URL + this.url + firmwareIdentification); } catch (final IOException e) { throw new FirmwareImageFactoryException(EXCEPTION_MSG_FIRMWARE_NOT_RETRIEVED, e); } }

Target:
public byte[] getFirmwareImage(final String firmwareIdentification) throws FirmwareImageFactoryException { try { URL downloadUrl = new URL(this.url + firmwareIdentification); this.checkUrl(downloadUrl); return this.download(downloadUrl); } catch (final MalformedURLException e) { throw new FirmwareImageFactoryException(EXCEPTION_MSG_MALFORMED_URL + this.url + firmwareIdentification, e); } catch (final IOException e) { throw new FirmwareImageFactoryException(EXCEPTION_MSG_FIRMWARE_NOT_RETRIEVED, e); } }
Source:
protected EMFModelElement doCreateFromSource(Object sourceElement, DataContextElement context) { final EObject source = EMFHelper.getEObject(sourceElement); if (null == source) { Activator.log.warn("Unable to resolve the selected element to a Table"); return null; } final IMatrixTableWidgetManager manager = MatrixHelper.getMatrixTableWidgetModelManagerFromCurrentEditor(); if(null != manager) { final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(manager.getTable()); if (null != manager && null != domain) { return new GenericUMLRelationshipMatrixModelElement(manager, domain); } } return super.doCreateFromSource(sourceElement, context); }

Target:
protected EMFModelElement doCreateFromSource(Object sourceElement, DataContextElement context) { final EObject source = EMFHelper.getEObject(sourceElement); if (null == source) { Activator.log.warn("Unable to resolve the selected element to a Table"); return null; } final IMatrixTableWidgetManager manager = MatrixHelper.getMatrixTableWidgetModelManagerFromCurrentEditor(); if (null != manager) { final TransactionalEditingDomain domain = TableEditingDomainUtils.getTableEditingDomain(manager.getTable()); if (null != domain) { return new GenericUMLRelationshipMatrixModelElement(manager, domain); } } return super.doCreateFromSource(sourceElement, context); }
Source:
public void testServiceLoader() throws Exception { CompoundJdbcEventListener compoundJdbcEventListener = (CompoundJdbcEventListener) P6Core.getJdbcEventListener(); final List<JdbcEventListener> eventListeners = compoundJdbcEventListener.getEventListeners(); assertTrue(containsClass(TestJdbcEventListener.class, eventListeners)); assertFalse(containsClass(JdbcEventListener.class, eventListeners)); assertTrue(containsClass(TestLoggingEventListener.class, eventListeners)); assertFalse(containsClass(LoggingEventListener.class, eventListeners)); }

Target:
public void testServiceLoader() throws Exception { JdbcEventListener eventListener = P6Core.getJdbcEventListener(); assertTrue(eventListener instanceof CompoundJdbcEventListener); CompoundJdbcEventListener compoundJdbcEventListener = (CompoundJdbcEventListener) eventListener; final List<JdbcEventListener> eventListeners = compoundJdbcEventListener.getEventListeners(); assertTrue(containsClass(TestJdbcEventListener.class, eventListeners)); assertFalse(containsClass(JdbcEventListener.class, eventListeners)); assertTrue(containsClass(TestLoggingEventListener.class, eventListeners)); assertFalse(containsClass(LoggingEventListener.class, eventListeners)); }
Source:
public Retryer<HttpResponse> getHttpRequestRetryer() { Predicate<HttpResponse> predicate = new Predicate<HttpResponse>() { public boolean apply(HttpResponse resposne) { if (resposne.statusCode() >= 500) { return true; } else { return false; } } }; return RetryerBuilder.<HttpResponse>newBuilder() .retryIfExceptionOfType(IOException.class) .retryIfRuntimeException() .withWaitStrategy(WaitStrategies.exponentialWait(100, SLEEP_DURATION, TimeUnit.MILLISECONDS)) .withStopStrategy(StopStrategies.neverStop()) .retryIfResult(predicate) .build(); }

Target:
public static Retryer<HttpResponse> getHttpRequestRetryer() { Predicate<HttpResponse> responseCodeIsEqualOrHigherThan500 = new Predicate<HttpResponse>() { public boolean apply(HttpResponse response) { return response.statusCode() >= 500; } }; return RetryerBuilder.<HttpResponse>newBuilder() .retryIfExceptionOfType(IOException.class) .retryIfRuntimeException() .withWaitStrategy(WaitStrategies.exponentialWait(100, SLEEP_DURATION.toMillis(), TimeUnit.MILLISECONDS)) .withStopStrategy(StopStrategies.neverStop()) .retryIfResult(responseCodeIsEqualOrHigherThan500) .build(); }
Source:
public void handleClose(CloseEvent event, List<DashboardPanel> panels) { String id = event.getComponent().getId(); for (DashboardPanel panel : panels) { if (panel.getType().replace(" ", "_").toLowerCase(Locale.ENGLISH).equals(id)) { panel.close(); break; } } }

Target:
public void handleClose(CloseEvent event, List<DashboardPanel> panels) { String id = event.getComponent().getId(); for (DashboardPanel panel : panels) { if (id.equalsIgnoreCase(panel.getType().replace(" ", "_"))) { panel.close(); break; } } }
Source:
public void testGetElapsedAfterStop() { final org.slf4j.Logger logger = createSlf4jLoggerMock(); final AtomicBoolean isOpen = new AtomicBoolean(true); @SuppressWarnings("resource") final TsdTimer timer = new TsdTimer("timerName", isOpen, logger); Mockito.verify(logger, Mockito.never()).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); timer.getValue(); Mockito.verify(logger).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); Mockito.verify(logger, Mockito.times(1)).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); }

Target:
public void testGetElapsedAfterStop() { final org.slf4j.Logger logger = createSlf4jLoggerMock(); final AtomicBoolean isOpen = new AtomicBoolean(true); @SuppressWarnings("resource") final TsdTimer timer = new TsdTimer("timerName", isOpen, logger); Mockito.verify(logger, Mockito.never()).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); timer.getValue(); Mockito.verify(logger).warn(MockitoHamcrest.argThat(Matchers.any(String.class))); }
Source:
public boolean isApplicable(Class<? extends Item> itemClass) { if (itemClass.isAssignableFrom(MavenModule.class) || itemClass.isAssignableFrom(MavenModuleSet.class)) { return true; } else { return false; } }

Target:
public boolean isApplicable(Class<? extends Item> itemClass) { return itemClass.isAssignableFrom(MavenModule.class) || itemClass.isAssignableFrom(MavenModuleSet.class); }
Source:
public void testSingleColumnValueFilterNotEqualEmptyString() throws IOException { byte[] rowKey1 = dataHelper.randomData("scvfrk1"); byte[] rowKey2 = dataHelper.randomData("scvfrk2"); byte[] qualifier1 = dataHelper.randomData("scvfq1"); byte[] value1_1 = dataHelper.randomData("val1.1"); byte[] value1_2 = "".getBytes(); Table table = getDefaultTable(); Put put = new Put(rowKey1); put.addColumn(COLUMN_FAMILY, qualifier1, value1_1); table.put(put); put = new Put(rowKey2); put.addColumn(COLUMN_FAMILY, qualifier1, value1_2); table.put(put); Result[] results; Scan scan = new Scan(); scan.addColumn(COLUMN_FAMILY, qualifier1); scanAddVersion(scan,3); ByteArrayComparable valueComparable1 = new BinaryComparator(value1_2); SingleColumnValueFilter filter = new SingleColumnValueFilter(COLUMN_FAMILY, qualifier1, CompareOp.NOT_EQUAL, valueComparable1); filter.setFilterIfMissing(false); filter.setLatestVersionOnly(true); scan.setFilter(filter); results = table.getScanner(scan).next(10); Assert.assertEquals(1, results.length); Assert.assertEquals(1,results[0].listCells().size()); }

Target:
public void testSingleColumnValueFilterNotEqualEmptyString() throws IOException { byte[] rowKey1 = dataHelper.randomData("scvfrk1"); byte[] rowKey2 = dataHelper.randomData("scvfrk2"); byte[] qualifier1 = dataHelper.randomData("scvfq1"); byte[] qualifier2 = dataHelper.randomData("scvfq2"); byte[] nonEmptyStringValue = dataHelper.randomData("val1.1"); byte[] emptyStringValue = "".getBytes(); Table table = getDefaultTable(); Put put = new Put(rowKey1); put.addColumn(COLUMN_FAMILY, qualifier1, nonEmptyStringValue); put.addColumn(COLUMN_FAMILY, qualifier2, nonEmptyStringValue); table.put(put); put = new Put(rowKey2); put.addColumn(COLUMN_FAMILY, qualifier1, nonEmptyStringValue); put.addColumn(COLUMN_FAMILY, qualifier2, emptyStringValue); table.put(put); Result[] results; Scan scan = new Scan(); scan.addColumn(COLUMN_FAMILY, qualifier1); scan.setRowPrefixFilter(Bytes.toBytes("scvfrk")); scanAddVersion(scan, 3); ByteArrayComparable emptyStringValueComparable = new BinaryComparator(emptyStringValue); SingleColumnValueFilter filter = new SingleColumnValueFilter(COLUMN_FAMILY, qualifier2, CompareOp.NOT_EQUAL, emptyStringValueComparable); scan.setFilter(filter); results = table.getScanner(scan).next(10); Assert.assertEquals(1, results.length); Assert.assertArrayEquals(rowKey1, results[0].getRow()); }
Source:
public void checkAutocompleteFeature() { editor.selectTabByName(GO_FILE_NAME); editor.goToPosition(21, 58); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditor("fmt."); editor.launchAutocompleteAndWaitContainer(); editor.checkProposalDocumentation("No documentation found."); editor.waitTextIntoAutocompleteContainer("Print"); editor.waitTextIntoAutocompleteContainer("Println"); editor.waitTextIntoAutocompleteContainer("Printf"); editor.deleteCurrentLine(); editor.waitAllMarkersInvisibility(ERROR); }

Target:
public void checkAutocompleteFeature() { editor.selectTabByName(GO_FILE_NAME); editor.goToPosition(21, 58); editor.typeTextIntoEditor(Keys.ENTER.toString()); editor.typeTextIntoEditor("fmt."); editor.launchAutocompleteAndWaitContainer(); editor.checkProposalDocumentation("No documentation found."); editor.waitProposalsIntoAutocompleteContainer(expectedProposals); editor.deleteCurrentLine(); editor.waitAllMarkersInvisibility(ERROR); }
Source:
private void addIntegerStatistics(long valueCount, IntegerStatistics value) { requireNonNull(value, "value is null"); requireNonNull(value.getMin(), "value.getMin() is null"); requireNonNull(value.getMax(), "value.getMax() is null"); nonNullValueCount += valueCount; minimum = Math.min(value.getMin(), minimum); maximum = Math.max(value.getMax(), maximum); if (value.getSum() != null) { try { sum = addExact(sum, value.getSum()); } catch (ArithmeticException e) { overflow = true; } } }

Target:
private void addIntegerStatistics(long valueCount, IntegerStatistics value) { requireNonNull(value, "value is null"); requireNonNull(value.getMin(), "value.getMin() is null"); requireNonNull(value.getMax(), "value.getMax() is null"); nonNullValueCount += valueCount; minimum = Math.min(value.getMin(), minimum); maximum = Math.max(value.getMax(), maximum); if (value.getSum() == null) { overflow = true; } else if (!overflow) { try { sum = addExact(sum, value.getSum()); } catch (ArithmeticException e) { overflow = true; } } }
Source:
public void testCaptureObject() { com.alliander.osgp.domain.core.valueobjects.smartmetering.CaptureObject captureObjectVo = this .makeCaptureObjectVo(); CaptureObject captureObject = this.monitoringMapper.map(captureObjectVo, CaptureObject.class); Assert.assertTrue(captureObject != null); }

Target:
public void testCaptureObject() { com.alliander.osgp.domain.core.valueobjects.smartmetering.CaptureObject captureObjectVo = this .makeCaptureObjectVo(); CaptureObject captureObject = this.monitoringMapper.map(captureObjectVo, CaptureObject.class); assertNotNull("mapping ProfileGenericDataResponse should not return null", captureObject); }
Source:
public void createRule() { final HttpMockRule rule = this.stubbing.createRule(); assertThat(rule, is(notNullValue())); }

Target:
public void createRule() { this.stubbing.thenRespond(); final HttpMockRule rule = this.stubbing.createRule(); assertThat(rule, is(notNullValue())); }
Source:
public boolean isUserBooked(final String eventId, final Long userId) throws SegueDatabaseException { try { final EventBooking bookingByEventAndUser = dao.findBookingByEventAndUser(eventId, userId); List<BookingStatus> bookedStatuses = Arrays.asList( BookingStatus.CONFIRMED, BookingStatus.ATTENDED, BookingStatus.ABSENT, BookingStatus.RESERVED); return bookingByEventAndUser != null && bookedStatuses.contains(bookingByEventAndUser.getBookingStatus()); } catch (ResourceNotFoundException e) { return false; } }

Target:
public boolean isUserBooked(final String eventId, final Long userId) throws SegueDatabaseException { try { final EventBooking bookingByEventAndUser = dao.findBookingByEventAndUser(eventId, userId); List<BookingStatus> bookedStatuses = Arrays.asList( BookingStatus.CONFIRMED, BookingStatus.ATTENDED, BookingStatus.ABSENT); return bookingByEventAndUser != null && bookedStatuses.contains(bookingByEventAndUser.getBookingStatus()); } catch (ResourceNotFoundException e) { return false; } }
Source:
public void install() { OsDetails osDetails = getMachine().getMachineDetails().getOsDetails(); if (osDetails.isLinux()) { String apt = BashCommands.chainGroup( "which apt-get", "export DEBIAN_FRONTEND=noninteractive", BashCommands.sudo("wget -O/etc/apt/sources.list.d/couchbase.list <LINK_0>"), "wget -O- <LINK_1> | sudo apt-key add - ", BashCommands.sudo("apt-get update"), BashCommands.sudo("apt-get install -y libcouchbase2-libevent libcouchbase-dev libcouchbase2-bin") ); String yum = BashCommands.chainGroup( "which yum", BashCommands.sudo("wget -O/etc/yum.repos.d/couchbase.repo <LINK_2>"), BashCommands.ok(BashCommands.sudo("yum check-update")), BashCommands.sudo("yum install -y libcouchbase2-libevent libcouchbase-devel libcouchbase2-bin") ); List<String> commands = ImmutableList.<String>builder() .add(BashCommands.INSTALL_WGET) .add(BashCommands.alternatives(apt, yum)) .build(); newScript(INSTALLING) .body.append(commands).execute(); } }

Target:
public void install() { OsDetails osDetails = getMachine().getMachineDetails().getOsDetails(); if (osDetails.isLinux()) { String aptSetup = BashCommands.ifExecutableElse0("apt-get", BashCommands.chainGroup( BashCommands.sudo("wget -O/etc/apt/sources.list.d/couchbase.list <LINK_0>"), "wget -O- <LINK_1> | sudo apt-key add - " )); String yumSetup = BashCommands.ifExecutableElse0("yum", BashCommands.sudo("wget -O/etc/yum.repos.d/couchbase.repo <LINK_2>") ); String installPackage = BashCommands.installPackage(ImmutableMap.of( "apt-get", "libcouchbase2-libevent libcouchbase-dev libcouchbase2-bin", "yum", "libcouchbase2-libevent libcouchbase-devel libcouchbase2-bin" ), null); List<String> commands = ImmutableList.<String>builder() .add(BashCommands.INSTALL_WGET) .add(BashCommands.alternatives(aptSetup, yumSetup, installPackage)) .build(); newScript(INSTALLING) .body.append(commands).execute(); } }