auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void testAddPartition(URI uri, String tableName, String partitionName) throws Exception { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName(DB_NAME + "." + tableName); alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION); Path path = new Path(uri.getPath(), partitionName); PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); String[] partitionNames = partitionName.split("/"); for (String partitionName1 : partitionNames) { String[] eachPartitionName = partitionName1.split("="); PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(eachPartitionName[0]); builder.setPartitionValue(eachPartitionName[1]); partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath(path.toString()); alterTableDesc.setPartitionDesc(partitionDesc); store.alterTable(alterTableDesc.getProto()); CatalogProtos.PartitionDescProto resultDesc = store.getPartition(DB_NAME, NATION, partitionName); assertNotNull(resultDesc); assertEquals(resultDesc.getPartitionName(), partitionName); assertEquals(resultDesc.getPath(), uri.toString() + "/" + partitionName); assertEquals(resultDesc.getPartitionKeysCount(), 2); for (int i = 0; i < resultDesc.getPartitionKeysCount(); i++) { CatalogProtos.PartitionKeyProto keyProto = resultDesc.getPartitionKeys(i); String[] eachName = partitionNames[i].split("="); assertEquals(keyProto.getPartitionValue(), eachName[1]); } }

Target:
private void testAddPartition(URI uri, String tableName, String partitionName) throws Exception { AlterTableDesc alterTableDesc = new AlterTableDesc(); alterTableDesc.setTableName(DB_NAME + "." + tableName); alterTableDesc.setAlterTableType(AlterTableType.ADD_PARTITION); Path path = new Path(uri.getPath(), partitionName); PartitionDesc partitionDesc = new PartitionDesc(); partitionDesc.setPartitionName(partitionName); List<PartitionKeyProto> partitionKeyList = new ArrayList<>(); String[] partitionNames = partitionName.split("/"); for (String aName : partitionNames) { String[] eachPartitionName = aName.split("="); PartitionKeyProto.Builder builder = PartitionKeyProto.newBuilder(); builder.setColumnName(eachPartitionName[0]); builder.setPartitionValue(eachPartitionName[1]); partitionKeyList.add(builder.build()); } partitionDesc.setPartitionKeys(partitionKeyList); partitionDesc.setPath(path.toString()); alterTableDesc.setPartitionDesc(partitionDesc); store.alterTable(alterTableDesc.getProto()); CatalogProtos.PartitionDescProto resultDesc = store.getPartition(DB_NAME, NATION, partitionName); assertNotNull(resultDesc); assertEquals(resultDesc.getPartitionName(), partitionName); assertEquals(resultDesc.getPath(), uri.toString() + "/" + partitionName); assertEquals(resultDesc.getPartitionKeysCount(), 2); for (int i = 0; i < resultDesc.getPartitionKeysCount(); i++) { CatalogProtos.PartitionKeyProto keyProto = resultDesc.getPartitionKeys(i); String[] eachName = partitionNames[i].split("="); assertEquals(keyProto.getPartitionValue(), eachName[1]); } }
Source:
public List<?> getOutput(List<List<Map<String, Object>>> accumulatedValue) { if (setters == null) { createSetters(); keySetStream2 = new HashSet<>(); keySetStream1 = new HashSet<>(); for (int i = 0; i < keys.length; i = i + 2) { keySetStream1.add(keys[i]); keySetStream2.add(keys[i + 1]); } } List<Map<String, Object>> result = getAllCombo(0, accumulatedValue, null); List<Object> out = new ArrayList<>(); for (Map<String, Object> resultMap : result) { Object o; try { o = outClass.newInstance(); } catch (Throwable e) { throw Throwables.propagate(e); } for (KeyValPair<String, PojoUtils.Setter> setter : setters) { if (resultMap.get(setter.getKey()) != null) { setter.getValue().set(o, resultMap.get(setter.getKey())); } } out.add(o); } return out; }

Target:
public List<?> getOutput(List<List<Map<String, Object>>> accumulatedValue) { if (setters == null) { createSetters(); keySetStream2 = new HashSet<>(); keySetStream1 = new HashSet<>(); for (int i = 0; i < keys.length; i = i + 2) { keySetStream1.add(keys[i]); keySetStream2.add(keys[i + 1]); } } List<Map<String, Object>> result = getAllCombo(0, accumulatedValue, null); List<Object> out = new ArrayList<>(); for (Map<String, Object> resultMap : result) { Object o; try { o = outClass.newInstance(); } catch (Throwable e) { throw Throwables.propagate(e); } for (Map.Entry<String, PojoUtils.Setter> setter : setters.entrySet()) { if (resultMap.get(setter.getKey()) != null) { setter.getValue().set(o, resultMap.get(setter.getKey())); } } out.add(o); } return out; }
Source:
private void applyNewPermissions(Application.Permission updatedPermission, boolean addRole) { Permissions permissions = updatedPermission.getPermissions(); Map<Authorization, List<String>> data = new HashMap<>(); for (Authorization auth : Authorization.values()) { List<String> roles = new ArrayList<>(permissions.get(auth)); if (auth == Authorization.READ || auth == Authorization.WRITE) { if (addRole) { roles.add(properties.getUserRole()); } else { roles.remove(properties.getUserRole()); } } data.put(auth, roles); } Permissions newPermissions = Permissions.factory(data); updatedPermission.setPermissions(newPermissions); }

Target:
private void applyNewPermissions(Application.Permission updatedPermission, boolean addRole) { Permissions permissions = updatedPermission.getPermissions(); Map<Authorization, List<String>> unpackedPermissions = permissions.unpack(); unpackedPermissions.forEach( (key, value) -> { List<String> roles = new ArrayList<>(value); if (key == Authorization.READ || key == Authorization.WRITE) { if (addRole) { roles.add(properties.getUserRole()); } else { roles.remove(properties.getUserRole()); } } unpackedPermissions.put(key, roles); }); Permissions newPermissions = Permissions.factory(unpackedPermissions); updatedPermission.setPermissions(newPermissions); }
Source:
void unionType() { GraphQLUnionType PetType = newUnionType() .name("Pet") .possibleType(CatType) .possibleType(DogType) .typeResolver(object -> { if (object instanceof GarfieldSchema.Cat) { return CatType; } if (object instanceof GarfieldSchema.Dog) { return DogType; } return null; }) .build(); }

Target:
void unionType() { GraphQLUnionType PetType = newUnionType() .name("Pet") .possibleType(CatType) .possibleType(DogType) .typeResolver(new TypeResolver() { @Override public GraphQLObjectType getType(Object object) { if (object instanceof GarfieldSchema.Cat) { return CatType; } if (object instanceof GarfieldSchema.Dog) { return DogType; } return null; } }) .build(); }
Source:
private GridGenerator(Dimension size, int numPlayers, Random r){ this.r = r; grid = new Grid(size); List<Point> points = new ArrayList<>(grid.keySet()); for (Point point : points){ if (canPlaceNonHidable(point) && pillarLoc(point)){ grid.set(new Pillar(), point); } } for (Point point : points){ if (chance(WALL_DENSITY) && canPlaceNonHidable(point)){ grid.set(new Wall(), point); } } boolean placed = false; while (!placed){ Point p = points.get(r.nextInt(points.size())); grid.set(new Door(), p); placed = true; } int playersPlaced = 0; while (playersPlaced < numPlayers){ Point p = points.get(r.nextInt(points.size())); if (canPlaceNonHidable(p)){ grid.set(new Player("Player " + ++playersPlaced), p); } } }

Target:
private GridGenerator(Dimension size, int numPlayers, Random r){ this.r = r; grid = new Grid(size); List<Point> points = new ArrayList<>(grid.keySet()); for (Point point : points){ if (grid.isPassable(point) && pillarLoc(point)){ grid.set(new Pillar(), point); } } for (Point point : points){ if (chance(WALL_DENSITY) && grid.isPassable(point)){ grid.set(new Wall(), point); } } boolean placed = false; while (!placed){ Point p = points.get(r.nextInt(points.size())); placed = grid.set(new Door(), p); } int playersPlaced = 0; while (playersPlaced < numPlayers){ Point p = points.get(r.nextInt(points.size())); if (grid.isPassable(p)){ grid.set(new Player("Player " + ++playersPlaced), p); } } }
Source:
protected String[] getRequiredMinishiftHomeChildren() { return new String[] { CDKConstants.CDK_RESOURCE_CDK, "config", "config/config.json" }; }

Target:
protected String[] getRequiredMinishiftHomeChildren() { return new String[] { CDKConstants.CDK_RESOURCE_CDK, CONFIG, CONFIG + "/" + CONFIG_JSON }; }
Source:
private Map<String, Object> getGrpcServiceConfig() { Map<String, Object> name = ImmutableMap.of("service", readOptions.getGrpcServiceName()); Map<String, Object> retryPolicy = ImmutableMap.<String, Object>builder() .put("maxAttempts", GRPC_MAX_RETRY_ATTEMPTS) .put( "initialBackoff", Durations.fromMillis(readOptions.getBackoffInitialIntervalMillis()).toString()) .put( "maxBackoff", Durations.fromMillis(readOptions.getBackoffMaxIntervalMillis()).toString()) .put("backoffMultiplier", readOptions.getBackoffMultiplier()) .put("retryableStatusCodes", ImmutableList.of("UNAVAILABLE", "RESOURCE_EXHAUSTED")) .build(); Map<String, Object> methodConfig = ImmutableMap.of("name", ImmutableList.of(name), "retryPolicy", retryPolicy); Map<String, Object> pickFirstStrategy = ImmutableMap.of("pick_first", ImmutableMap.of()); Map<String, Object> childPolicy = ImmutableMap.of("childPolicy", ImmutableList.of(pickFirstStrategy)); Map<String, Object> grpcLbPolicy = ImmutableMap.of("grpclb", childPolicy); return ImmutableMap.of( "methodConfig", ImmutableList.of(methodConfig), "loadBalancingConfig", ImmutableList.of(grpcLbPolicy)); }

Target:
private Map<String, Object> getGrpcServiceConfig() { Map<String, Object> name = ImmutableMap.of("service", "google.storage.v1.Storage"); Map<String, Object> retryPolicy = ImmutableMap.<String, Object>builder() .put("maxAttempts", GRPC_MAX_RETRY_ATTEMPTS) .put( "initialBackoff", Durations.fromMillis(readOptions.getBackoffInitialIntervalMillis()).toString()) .put( "maxBackoff", Durations.fromMillis(readOptions.getBackoffMaxIntervalMillis()).toString()) .put("backoffMultiplier", readOptions.getBackoffMultiplier()) .put("retryableStatusCodes", ImmutableList.of("UNAVAILABLE", "RESOURCE_EXHAUSTED")) .build(); Map<String, Object> methodConfig = ImmutableMap.of("name", ImmutableList.of(name), "retryPolicy", retryPolicy); Map<String, Object> pickFirstStrategy = ImmutableMap.of("pick_first", ImmutableMap.of()); Map<String, Object> childPolicy = ImmutableMap.of("childPolicy", ImmutableList.of(pickFirstStrategy)); Map<String, Object> grpcLbPolicy = ImmutableMap.of("grpclb", childPolicy); return ImmutableMap.of( "methodConfig", ImmutableList.of(methodConfig), "loadBalancingConfig", ImmutableList.of(grpcLbPolicy)); }
Source:
public GroupedAccumulator createGroupedAccumulator() { GroupedAccumulator accumulator; if (distinct) { accumulator = instantiateGroupedAccumulator( inputChannels.stream() .map(value -> value + 1) .collect(Collectors.toList()), Optional.of(0)); List<Type> argumentTypes = new ArrayList<>(); for (int input : inputChannels) { argumentTypes.add(sourceTypes.get(input)); } accumulator = new SpillableGroupedAccumulator( sourceTypes, new DistinctingGroupedAccumulator(accumulator, argumentTypes, inputChannels, maskChannel, session, joinCompiler)); } else { accumulator = instantiateGroupedAccumulator(inputChannels, maskChannel); } if (!hasOrderBy()) { return accumulator; } return new SpillableGroupedAccumulator( sourceTypes, new OrderingGroupedAccumulator(accumulator, sourceTypes, orderByChannels, orderings, pagesIndexFactory)); }

Target:
public GroupedAccumulator createGroupedAccumulator() { GroupedAccumulator accumulator; if (hasDistinct()) { accumulator = instantiateGroupedAccumulator( inputChannels.stream() .map(value -> value + 1) .collect(Collectors.toList()), Optional.of(0)); List<Type> argumentTypes = new ArrayList<>(); for (int input : inputChannels) { argumentTypes.add(sourceTypes.get(input)); } accumulator = new DistinctingGroupedAccumulator(accumulator, argumentTypes, inputChannels, maskChannel, session, joinCompiler); } else { accumulator = instantiateGroupedAccumulator(inputChannels, maskChannel); } if (orderByChannels.isEmpty()) { return accumulator; } return new OrderingGroupedAccumulator(accumulator, sourceTypes, orderByChannels, orderings, pagesIndexFactory); }
Source:
public void shouldGetExpirationTime() throws Exception { Date expectedDate = new Date(1477592 * 1000); Clock clock = mock(Clock.class); when(clock.getNow()).thenReturn(expectedDate.toInstant()); String token = "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0Nzc1OTJ9.x_ZjkPkKYUV5tdvc0l8go6D_z2kez1MQcOxokXrDc3k"; JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWT.require(Algorithm.HMAC256("secret")); DecodedJWT jwt = verification .build(clock) .verify(token); assertThat(jwt, is(notNullValue())); assertThat(jwt.getExpiresAt(), is(instanceOf(Date.class))); assertThat(jwt.getExpiresAt(), is(notNullValue())); assertThat(jwt.getExpiresAt(), is(equalTo(expectedDate))); }

Target:
public void shouldGetExpirationTime() throws Exception { Instant expectedInstant = Instant.ofEpochSecond(1477592); Clock clock = mock(Clock.class); when(clock.getNow()).thenReturn(expectedInstant); String token = "eyJhbGciOiJIUzI1NiJ9.eyJleHAiOjE0Nzc1OTJ9.x_ZjkPkKYUV5tdvc0l8go6D_z2kez1MQcOxokXrDc3k"; JWTVerifier.BaseVerification verification = (JWTVerifier.BaseVerification) JWT.require(Algorithm.HMAC256("secret")); DecodedJWT jwt = verification .build(clock) .verify(token); assertThat(jwt, is(notNullValue())); assertThat(jwt.getExpiresAt(), is(instanceOf(Date.class))); assertThat(jwt.getExpiresAt(), is(notNullValue())); assertThat(jwt.getExpiresAt(), is(equalTo(Date.from(expectedInstant)))); }
Source:
public GroupedExecutionProperties visitRowNumber(RowNumberNode node, Void context) { return visitWindowFunctionNodeInternal(node); }

Target:
public GroupedExecutionProperties visitRowNumber(RowNumberNode node, Void context) { return visitWindowFunctionNode(node); }
Source:
public void write(List<? extends List<Annotation>> annotations) throws Exception { BulkOperations bulk = mongoOperations.bulkOps(BulkOperations.BulkMode.UNORDERED, collection); for (List<Annotation> annotationList : annotations) { prepareBulk(annotationList, bulk); bulk.execute(); } }

Target:
public void write(List<? extends List<Annotation>> annotations) throws Exception { for (List<Annotation> annotationList : annotations) { BulkOperations bulk = mongoOperations.bulkOps(BulkOperations.BulkMode.UNORDERED, collection); prepareBulk(annotationList, bulk); bulk.execute(); } }
Source:
public HPCCFile setProjectList(String projectList) throws Exception { this.columnPruner = new ColumnPruner(projectList); this.projectedRecordDefinition = this.columnPruner.pruneRecordDefinition(this.recordDefinition); return this; }

Target:
public HPCCFile setProjectList(String projectList) throws Exception { this.columnPruner = new ColumnPruner(projectList); if (this.recordDefinition != null) { this.projectedRecordDefinition = this.columnPruner.pruneRecordDefinition(this.recordDefinition); } return this; }
Source:
public void testValidateModifiedBondSlavesWhenSlaveInterfaceDoesNotExist() throws Exception { Bond bond = createBond(); bond.setSlaves(Arrays.asList("slaveA", "slaveB")); HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder() .setParams(new ParametersBuilder().addBonds(CreateOrUpdateBond.fromBond(bond))) .build(); doTestValidateModifiedBondSlaves( spy(validator), new ValidationResult(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST), ValidationResult.VALID, failsWith(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST)); }

Target:
public void testValidateModifiedBondSlavesWhenSlaveInterfaceDoesNotExist() throws Exception { CreateOrUpdateBond createOrUpdateBond = createNewCreateOrUpdateBond(Guid.newGuid(), "bond1", "slaveA", "slaveB"); HostSetupNetworksValidator validator = new HostSetupNetworksValidatorBuilder() .setParams(new ParametersBuilder().addBonds(createOrUpdateBond)) .build(); doTestValidateModifiedBondSlaves( spy(validator), new ValidationResult(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST), ValidationResult.VALID, failsWith(EngineMessage.HOST_NETWORK_INTERFACE_NOT_EXIST)); }
Source:
public void updatePurchasedNumber() throws UnauthorizedException, GeneralException, NotFoundException { final String phoneNumber = "15625267429"; final String url = String.format("%s/v1/phone-numbers/%s", NUMBERS_CALLS_BASE_URL, phoneNumber); PurchasedNumber updatedNumberMock = new PurchasedNumber(); MessageBirdService messageBirdServiceMock = mock(MessageBirdService.class); MessageBirdClient messageBirdClientMock = new MessageBirdClient(messageBirdServiceMock); final Map<String, List<String>> payload = new HashMap<String, List<String>>(); payload.put("tags", Arrays.asList("tag")); when(messageBirdServiceMock.sendPayLoad("PATCH", url, payload, PurchasedNumber.class)) .thenReturn(updatedNumberMock); final PurchasedNumber response = messageBirdClientMock.updateNumber(phoneNumber, "tag"); verify(messageBirdServiceMock, times(1)).sendPayLoad("PATCH", url, payload, PurchasedNumber.class); assertNotNull(response); assertEquals(response, updatedNumberMock); }

Target:
public void updatePurchasedNumber() throws UnauthorizedException, GeneralException { final String phoneNumber = "15625267429"; final String url = String.format("%s/phone-numbers/%s", NUMBERS_CALLS_BASE_URL, phoneNumber); PurchasedNumber updatedNumberMock = new PurchasedNumber(); MessageBirdService messageBirdServiceMock = mock(MessageBirdService.class); MessageBirdClient messageBirdClientMock = new MessageBirdClient(messageBirdServiceMock); final Map<String, List<String>> payload = new HashMap<String, List<String>>(); payload.put("tags", Collections.singletonList("tag")); when(messageBirdServiceMock.sendPayLoad("PATCH", url, payload, PurchasedNumber.class)) .thenReturn(updatedNumberMock); final PurchasedNumber response = messageBirdClientMock.updateNumber(phoneNumber, "tag"); verify(messageBirdServiceMock, times(1)).sendPayLoad("PATCH", url, payload, PurchasedNumber.class); assertNotNull(response); assertEquals(response, updatedNumberMock); }
Source:
public BoDCharacter(int id, Point2D position, double width, double height, int speed, Image image) { super(id); this.body = new Body(this, position, width, height, TYPE); this.physics = new Physics(this, speed); this.view = new View(this, image); this.weapon = new Weapon(this, 5, 20, 9); this.health = new Health(100); score = 0; }

Target:
public BoDCharacter(int id, Point2D position, double width, double height, int speed, Image image) { super(id); this.body = new Body(this, position, width, height, TYPE); this.physics = new Physics(this, speed); this.view = new View(this, image); this.weapon = new Weapon(this, 5, 20, 9); this.health = new Health(100); }
Source:
public static double singleNewtonArgmaxUpdate(final Function<Double, Double> function, final double min, final double max, final double guess) { final double fx = function.apply(guess); final double fxPlusEps = function.apply(guess + EPSILON); final double fxMinusEps = function.apply(guess - EPSILON); final double secondDerivative = (fxPlusEps + fxMinusEps - 2 * fx) / (EPSILON * EPSILON); final double firstDerivative = (fxPlusEps - fxMinusEps)/(2*EPSILON); final double argmax = guess - firstDerivative / secondDerivative; if (Math.abs(firstDerivative) < 1e-8) { return guess; } return argmax < min ? min : (argmax > max ? max : argmax); }

Target:
public static double singleNewtonArgmaxUpdate(final Function<Double, Double> function, final double min, final double max, final double guess) { return singleNewtonArgmaxUpdate(function, min, max, guess, DEFAULT_EPSILON_FOR_NUMERIC_DERIVATIVES, DEFAULT_DERIVATIVE_THRESHOLD); }
Source:
protected void releaseInternal() { synchronized (lock) { isFinished = true; if (readers.isEmpty()) { if (resultFile != null) { resultFile.deleteQuietly(); resultFile = null; } } } }

Target:
protected void releaseInternal() { synchronized (lock) { if (resultFile == null) { fileWriter.releaseQuietly(); } if (readers.isEmpty()) { if (resultFile != null) { resultFile.deleteQuietly(); resultFile = null; } } } }
Source:
public static void checkValidPath(String path) throws InvalidPathException { boolean isWindows = SystemReader.getInstance().isWindows(); boolean isOSX = SystemReader.getInstance().isMacOS(); boolean ignCase = isOSX || isWindows; byte[] bytes; try { bytes = path.getBytes(Constants.CHARACTER_ENCODING); } catch (UnsupportedEncodingException e) { throw new Error(e); } int p0 = 0; int p1; L0: while (p0 < bytes.length) { p1 = p0 + 1; while (p1 < bytes.length) { if (bytes[p1] == '/') { checkValidPathSegment(isWindows, ignCase, bytes, p0, p1, path); p0 = p1 + 1; continue L0; } p1++; } checkValidPathSegment(isWindows, ignCase, bytes, p0, p1, path); p0 = p1; } }

Target:
public static void checkValidPath(String path) throws InvalidPathException { boolean isWindows = SystemReader.getInstance().isWindows(); boolean isOSX = SystemReader.getInstance().isMacOS(); boolean ignCase = isOSX || isWindows; byte[] bytes; try { bytes = path.getBytes(Constants.CHARACTER_ENCODING); } catch (UnsupportedEncodingException e) { throw new Error(e); } int segmentStart = 0; for (int i = 0; i < bytes.length; i++) { if (bytes[i] == '/') { checkValidPathSegment(isWindows, ignCase, bytes, segmentStart, i, path); segmentStart = i + 1; } } if (segmentStart < bytes.length) checkValidPathSegment(isWindows, ignCase, bytes, segmentStart, bytes.length, path); }
Source:
private void createProject() throws OrmException { final Project.NameKey newProjectNameKey = new Project.NameKey(projectName); final RefRight.Key prk = new RefRight.Key(newProjectNameKey, new RefRight.RefPattern("refs/*"), ApprovalCategory.OWN, ownerId); final RefRight pr = new RefRight(prk); pr.setMaxValue((short) 1); pr.setMinValue((short) 1); db.refRights().insert(Collections.singleton(pr)); final Project newProject = new Project(newProjectNameKey); newProject.setDescription(projectDescription); newProject.setSubmitType(submitType); newProject.setUseContributorAgreements(contributorAgreements); newProject.setUseSignedOffBy(signedOffBy); newProject.setParent(wildProject); db.projects().insert(Collections.singleton(newProject)); }

Target:
private void createProject() throws OrmException { final Project.NameKey newProjectNameKey = new Project.NameKey(projectName); final RefRight.Key prk = new RefRight.Key(newProjectNameKey, new RefRight.RefPattern("refs/*"), ApprovalCategory.OWN, ownerId); final RefRight pr = new RefRight(prk); pr.setMaxValue((short) 1); pr.setMinValue((short) 1); db.refRights().insert(Collections.singleton(pr)); final Project newProject = new Project(newProjectNameKey); newProject.setDescription(projectDescription); newProject.setSubmitType(submitType); newProject.setUseContributorAgreements(contributorAgreements); newProject.setUseSignedOffBy(signedOffBy); db.projects().insert(Collections.singleton(newProject)); }
Source:
public void update(StructuredRecord record) { Object val = record.get(fieldName); if (val == null) { return; } sum += ((Number) val).doubleValue(); count++; }

Target:
public void update(StructuredRecord record) { Object val = record.get(fieldName); if (val == null) { return; } count++; avg = avg + (((Number) val).doubleValue() - avg) / count; }
Source:
public String reportProblemForAll() { for (Task s : this.steps) { this.currentStep = s; this.myDav.uploadFromHome(this.currentStep.getProcess()); serviceManager.getWorkflowService().setProblem(getProblem()); try { setCurrentStep(serviceManager.getWorkflowService().reportProblem(this.currentStep, this.problemTask)); } catch (DataException e) { logger.error("Problem couldn't be reported: " + e); } saveStep(); } this.problem.setMessage(""); this.problemTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }

Target:
public String reportProblemForAll() { for (Task s : this.steps) { this.currentStep = s; this.myDav.uploadFromHome(this.currentStep.getProcess()); serviceManager.getWorkflowService().setProblem(getProblem()); try { setCurrentStep(serviceManager.getWorkflowService().reportProblem(this.currentStep, this.problemTask)); saveStep(); } catch (DataException e) { logger.error("Problem couldn't be reported: " + e); } } this.problem.setMessage(""); this.problemTask = ""; AktuelleSchritteForm asf = (AktuelleSchritteForm) Helper.getManagedBeanValue("#{AktuelleSchritteForm}"); return asf.filterAll(); }
Source:
private void updateProperties() { VM vm = (VM) getEntity(); this.setClientIp(vm.getClientIp()); this.setConsoleUserName(vm.getConsoleCurentUserName()); this.setGuestUserName(vm.getGuestCurentUserName()); this.setGuestOsArch(vm.getGuestOsArch()); this.setGuestOsCodename(vm.getGuestOsCodename()); this.setGuestOsDistribution(vm.getGuestOsDistribution()); this.setGuestOsKernelVersion(vm.getGuestOsKernelVersion()); this.setGuestOsType(vm.getGuestOsType()); this.setGuestOsVersion(vm.getGuestOsVersion()); this.setTimezoneName(vm.getTimezoneName()); this.setTimezoneOffset(vm.getTimezoneOffset()); StringBuilder builder = new StringBuilder(); if(guestOsType == OsType.Linux) { builder.append(guestOsDistribution); builder.append(' '); builder.append(guestOsVersion); if(!StringUtils.isEmpty(guestOsCodename)) { builder.append(" ("); builder.append(guestOsCodename); builder.append(')'); } } else if(guestOsType == OsType.Windows && guestOs.startsWith("Win ")) { builder.append("Microsoft Windows "); builder.append(guestOs.substring(4)); if(guestOs.startsWith("Win 20")) { builder.append(" Server"); } builder.append(" ("); builder.append(guestOsVersion); builder.append(')'); } guestOsNamedVersion = builder.toString(); builder = new StringBuilder(); builder.append(timezoneName); builder.append(" (UTC"); if(timezoneOffset >= 0) { builder.append('+'); } else { builder.append('-'); } builder.append(NumberFormat.getFormat("00").format(timezoneOffset / 60.)); builder.append(':'); builder.append(NumberFormat.getFormat("00").format(timezoneOffset % 60)); builder.append(')'); guestOsTimezone = builder.toString(); }

Target:
private void updateProperties() { VM vm = (VM) getEntity(); setClientIp(vm.getClientIp()); setConsoleUserName(vm.getConsoleCurentUserName()); setGuestUserName(vm.getGuestCurentUserName()); setGuestOsArch(vm.getGuestOsArch()); setGuestOsCodename(vm.getGuestOsCodename()); setGuestOsDistribution(vm.getGuestOsDistribution()); setGuestOsKernelVersion(vm.getGuestOsKernelVersion()); setGuestOsType(vm.getGuestOsType()); setGuestOsVersion(vm.getGuestOsVersion()); setTimezoneName(vm.getGuestOsTimezoneName()); setTimezoneOffset(vm.getGuestOsTimezoneOffset()); if(guestOsType == OsType.Linux) { String optional = ""; if(!StringUtils.isEmpty(guestOsCodename)) { optional = messages.guestOSVersionOptional(guestOsCodename); } guestOsNamedVersion = messages.guestOSVersionLinux(guestOsDistribution, guestOsVersion, optional); } else if(guestOsType == OsType.Windows && guestOs.startsWith("Win ")) { if(guestOs.startsWith("Win 20")) { guestOsNamedVersion = messages.guestOSVersionWindowsServer(guestOs.substring(4), guestOsVersion); } else { guestOsNamedVersion = messages.guestOSVersionWindows(guestOs.substring(4), guestOsVersion); } } String hours = NumberFormat.getFormat("00").format(timezoneOffset / 60.); String minutes = NumberFormat.getFormat("00").format(timezoneOffset % 60); if(timezoneOffset >= 0) { guestOsTimezone = messages.positiveTimezoneOffset(timezoneName, hours, minutes); } else { guestOsTimezone = messages.negativeTimezoneOffset(timezoneName, hours, minutes); } }
Source:
public void checkFillSelectionAfterSelectingDatasetAuthentication() throws Exception { enableService(); Bundle clientState = new Bundle(); clientState.putCharSequence("clientStateKey", "clientStateValue"); final IntentSender authentication = AuthenticationActivity.createSender(getContext(), 1, new CannedDataset.Builder() .setField(ID_USERNAME, "dude") .setField(ID_PASSWORD, "sweet") .setPresentation(createPresentation("Dataset")) .build()); sReplier.addResponse(new CannedFillResponse.Builder().addDataset( new CannedDataset.Builder() .setField(ID_USERNAME, "username") .setId("name") .setPresentation(createPresentation("authentication")) .setAuthentication(authentication) .build()) .setExtras(clientState).build()); mActivity.onUsername(View::requestFocus); sUiBot.selectDataset("authentication"); sReplier.getNextFillRequest(); eventually(() -> { FillEventHistory selection = InstrumentedAutoFillService.peekInstance() .getFillEventHistory(); assertThat(selection.getClientState().getCharSequence("clientStateKey")).isEqualTo( "clientStateValue"); assertThat(selection.getEvents().size()).isEqualTo(2); FillEventHistory.Event event = selection.getEvents().get(0); assertThat(event.getType()).isEqualTo(TYPE_DATASET_AUTHENTICATION_SELECTED); assertThat(event.getDatasetId()).isEqualTo("name"); }); }

Target:
public void checkFillSelectionAfterSelectingDatasetAuthentication() throws Exception { enableService(); Bundle clientState = new Bundle(); clientState.putCharSequence("clientStateKey", "clientStateValue"); final IntentSender authentication = AuthenticationActivity.createSender(getContext(), 1, new CannedDataset.Builder() .setField(ID_USERNAME, "dude") .setField(ID_PASSWORD, "sweet") .setPresentation(createPresentation("Dataset")) .build()); sReplier.addResponse(new CannedFillResponse.Builder().addDataset( new CannedDataset.Builder() .setField(ID_USERNAME, "username") .setId("name") .setPresentation(createPresentation("authentication")) .setAuthentication(authentication) .build()) .setExtras(clientState).build()); mActivity.onUsername(View::requestFocus); sUiBot.selectDataset("authentication"); sReplier.getNextFillRequest(); eventually(() -> { FillEventHistory selection = InstrumentedAutoFillService.peekInstance() .getFillEventHistory(); assertThat(selection.getClientState().getCharSequence("clientStateKey")).isEqualTo( "clientStateValue"); assertThat(selection.getEvents().size()).isEqualTo(2); FillEventHistory.Event event1 = selection.getEvents().get(0); assertThat(event1.getType()).isEqualTo(TYPE_DATASET_AUTHENTICATION_SELECTED); assertThat(event1.getDatasetId()).isEqualTo("name"); FillEventHistory.Event event2 = selection.getEvents().get(1); assertThat(event2.getType()).isEqualTo(TYPE_DATASET_SELECTED); assertThat(event2.getDatasetId()).isNull(); }); }
Source:
public void onEditorFragmentInitialized() { boolean shouldFinishInit = true; if (getIntent().hasExtra(EXTRA_INSERT_MEDIA)) { List<MediaModel> mediaList = (List<MediaModel>) getIntent().getSerializableExtra(EXTRA_INSERT_MEDIA); if (mediaList != null && !mediaList.isEmpty()) { shouldFinishInit = false; mMediaInsertedOnCreation = true; for (MediaModel media : mediaList) { addExistingMediaToEditor(media.getMediaId()); } savePostAsync(new AfterSavePostListener() { @Override public void onPostSave() { runOnUiThread(new Runnable() { @Override public void run() { onEditorFinalTouchesBeforeShowing(); } }); } }); } } if (shouldFinishInit) { onEditorFinalTouchesBeforeShowing(); } }

Target:
public void onEditorFragmentInitialized() { boolean shouldFinishInit = true; if (getIntent().hasExtra(EXTRA_INSERT_MEDIA)) { List<MediaModel> mediaList = (List<MediaModel>) getIntent().getSerializableExtra(EXTRA_INSERT_MEDIA); getIntent().removeExtra(EXTRA_INSERT_MEDIA); if (mediaList != null && !mediaList.isEmpty()) { shouldFinishInit = false; mMediaInsertedOnCreation = true; for (MediaModel media : mediaList) { addExistingMediaToEditor(media.getMediaId()); } savePostAsync(new AfterSavePostListener() { @Override public void onPostSave() { runOnUiThread(new Runnable() { @Override public void run() { onEditorFinalTouchesBeforeShowing(); } }); } }); } } if (shouldFinishInit) { onEditorFinalTouchesBeforeShowing(); } }
Source:
public String toString() { return "QueuedRequestImpl [requestTicket=" + requestTicket + ", downlinkRequest=" + downlinkRequest + ", endpoint=" + endpoint + ", requestId=" + requestId + "]"; }

Target:
public String toString() { return new StringBuilder().append("QueuedRequestImpl [requestTicket=").append(requestTicket) .append(", downlinkRequest=").append(downlinkRequest).append(", endpoint=" + endpoint) .append(", requestId=").append(requestId).append("]").toString(); }
Source:
private void printStats(String result) { printHeadings(); if (result == null) { if (verbose) { context.err.println("printStats(): got NULL result string."); } return; } JsonObject queuesAsJsonObject = JsonUtil.readJsonObject(result); JsonArray array = (JsonArray) queuesAsJsonObject.get("data"); for (int i = 0; i < array.size(); i++) { printQueueStats(array.getJsonObject(i)); } if (maxRows == null && array.size() == DEFAULT_MAX_ROWS) { context.out.println(String.format("WARNING: the displayed queues are limited to %d by default, set maxRows to display more queues.", DEFAULT_MAX_ROWS)); } }

Target:
private void printStats(String result) { printHeadings(); if (result == null) { if (verbose) { context.err.println("printStats(): got NULL result string."); } return; } JsonObject queuesAsJsonObject = JsonUtil.readJsonObject(result); int count = queuesAsJsonObject.getInt("count"); JsonArray array = queuesAsJsonObject.getJsonArray("data"); for (int i = 0; i < array.size(); i++) { printQueueStats(array.getJsonObject(i)); } if (count > maxRows) { context.out.println(String.format("WARNING: the displayed queues are %d/%d, set maxRows to display more queues.", maxRows, count)); } }
Source:
public String updateEndpointRegistry(String registryId, EndpointRegistryInfo endpointRegistry) throws APIManagementException { String query = SQLConstants.UPDATE_ENDPOINT_REGISTRY_SQL; String uuid = UUID.randomUUID().toString(); try (Connection connection = APIMgtDBUtil.getConnection(); PreparedStatement ps = connection.prepareStatement(query)) { connection.setAutoCommit(false); ps.setString(1, endpointRegistry.getName()); ps.setString(2, endpointRegistry.getType()); ps.setString(3, endpointRegistry.getMode()); ps.setString(4, ""); ps.setString(5, ""); ps.setString(6, registryId); ps.executeUpdate(); connection.commit(); } catch (SQLException e) { handleException("Error while updating endpoint registry: " + endpointRegistry.getName(), e); } return uuid; }

Target:
public void updateEndpointRegistry(String registryId, EndpointRegistryInfo endpointRegistry) throws APIManagementException { String query = SQLConstants.UPDATE_ENDPOINT_REGISTRY_SQL; try (Connection connection = APIMgtDBUtil.getConnection(); PreparedStatement ps = connection.prepareStatement(query)) { connection.setAutoCommit(false); ps.setString(1, endpointRegistry.getName()); ps.setString(2, endpointRegistry.getType()); ps.setString(3, endpointRegistry.getMode()); ps.setString(4, ""); ps.setString(5, ""); ps.setString(6, registryId); ps.executeUpdate(); connection.commit(); } catch (SQLException e) { handleException("Error while updating endpoint registry: " + endpointRegistry.getName(), e); } return; }
Source:
public void getThreadData() throws InterruptedException{ final String THREAD_ID = "1"; final DataRequestMonitor<IThreadDMData> rm = new DataRequestMonitor<IThreadDMData>(fSession.getExecutor(), null) { @Override protected void handleCompleted() { if (isSuccess()) { fWait.setReturnInfo(getData()); } fWait.waitFinished(getStatus()); } }; final IProcessDMContext processContext = DMContexts.getAncestorOfType(SyncUtil.getContainerContext(), IProcessDMContext.class); fProcService.getExecutor().submit(new Runnable() { @Override public void run() { IThreadDMContext threadDmc = fProcService.createThreadContext(processContext, THREAD_ID); fProcService.getExecutionData(threadDmc, rm); } }); fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); assertTrue(fWait.getMessage(), fWait.isOK()); IThreadDMData threadData = (IThreadDMData)fWait.getReturnInfo(); Assert.assertNotNull("Thread data not returned for thread id = " + THREAD_ID, threadData); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(threadData.getId()); assertTrue("Thread ID is a series of number", matcher.find()); String expectedThreadName = threadNamesSupported() ? EXEC_NAME : ""; assertEquals("main thread's name is the name of the executable", expectedThreadName, threadData.getName()); fWait.waitReset(); }

Target:
public void getThreadData() throws InterruptedException{ final String THREAD_ID = "1"; final DataRequestMonitor<IThreadDMData> rm = new DataRequestMonitor<IThreadDMData>(fSession.getExecutor(), null) { @Override protected void handleCompleted() { if (isSuccess()) { fWait.setReturnInfo(getData()); } fWait.waitFinished(getStatus()); } }; final IProcessDMContext processContext = DMContexts.getAncestorOfType(SyncUtil.getContainerContext(), IProcessDMContext.class); fProcService.getExecutor().submit(new Runnable() { @Override public void run() { IThreadDMContext threadDmc = fProcService.createThreadContext(processContext, THREAD_ID); fProcService.getExecutionData(threadDmc, rm); } }); fWait.waitUntilDone(TestsPlugin.massageTimeout(2000)); assertTrue(fWait.getMessage(), fWait.isOK()); IThreadDMData threadData = (IThreadDMData)fWait.getReturnInfo(); Assert.assertNotNull("Thread data not returned for thread id = " + THREAD_ID, threadData); Pattern pattern = Pattern.compile("\\d*", Pattern.MULTILINE); Matcher matcher = pattern.matcher(threadData.getId()); assertTrue("Thread ID is a series of number", matcher.find()); String expectedThreadName = threadNamesSupported() ? EXEC_NAME : ""; assertEquals("main thread's name is wrong", expectedThreadName, threadData.getName()); fWait.waitReset(); }
Source:
public S3NotebookRepo(ZeppelinConfiguration conf) throws IOException { this.conf = conf; bucketName = conf.getBucketName(); user = conf.getUser(); useServerSideEncryption = conf.isS3ServerSideEncryption(); saveAndCommit = conf.isPersistOnCommit(); AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain(); CryptoConfiguration cryptoConf = null; String keyRegion = conf.getS3KMSKeyRegion(); if (StringUtils.isNotBlank(keyRegion)) { cryptoConf = new CryptoConfiguration(); cryptoConf.setAwsKmsRegion(Region.getRegion(Regions.fromName(keyRegion))); } String kmsKeyID = conf.getS3KMSKeyID(); if (kmsKeyID != null) { KMSEncryptionMaterialsProvider emp = new KMSEncryptionMaterialsProvider(kmsKeyID); if (cryptoConf != null) { this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp, cryptoConf); } else { this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp); } } else if (conf.getS3EncryptionMaterialsProviderClass() != null) { EncryptionMaterialsProvider emp = createCustomProvider(conf); this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp); } else { this.s3client = new AmazonS3Client(credentialsProvider); } s3client.setEndpoint(conf.getEndpoint()); }

Target:
public S3NotebookRepo(ZeppelinConfiguration conf) throws IOException { this.conf = conf; bucketName = conf.getBucketName(); user = conf.getUser(); useServerSideEncryption = conf.isS3ServerSideEncryption(); AWSCredentialsProvider credentialsProvider = new DefaultAWSCredentialsProviderChain(); CryptoConfiguration cryptoConf = null; String keyRegion = conf.getS3KMSKeyRegion(); if (StringUtils.isNotBlank(keyRegion)) { cryptoConf = new CryptoConfiguration(); cryptoConf.setAwsKmsRegion(Region.getRegion(Regions.fromName(keyRegion))); } String kmsKeyID = conf.getS3KMSKeyID(); if (kmsKeyID != null) { KMSEncryptionMaterialsProvider emp = new KMSEncryptionMaterialsProvider(kmsKeyID); if (cryptoConf != null) { this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp, cryptoConf); } else { this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp); } } else if (conf.getS3EncryptionMaterialsProviderClass() != null) { EncryptionMaterialsProvider emp = createCustomProvider(conf); this.s3client = new AmazonS3EncryptionClient(credentialsProvider, emp); } else { this.s3client = new AmazonS3Client(credentialsProvider); } s3client.setEndpoint(conf.getEndpoint()); }
Source:
public Map<byte[], byte[]> all() { try { List<String> zkSubDirectories = zkClient.getChildren(zkBaseDir); Map<byte[], byte[]> result = new HashMap<>(); for (String zkSubDir : zkSubDirectories) { String completeZkPath = String.format("%s/%s", zkBaseDir, zkSubDir); byte[] value = zkClient.readData(completeZkPath, true); result.put(completeZkPath.getBytes("UTF-8"), value); } return result; } catch (Exception e) { LOG.error("Exception occurred on reading the path: from zookeeper.", zkBaseDir, e); throw new SamzaException(e); } }

Target:
public Map<byte[], byte[]> all() { try { List<String> zkSubDirectories = zkClient.getChildren(zkBaseDir); Map<byte[], byte[]> result = new HashMap<>(); for (String zkSubDir : zkSubDirectories) { String completeZkPath = String.format("%s/%s", zkBaseDir, zkSubDir); byte[] value = zkClient.readData(completeZkPath, true); if (value != null) { result.put(completeZkPath.getBytes("UTF-8"), value); } } return result; } catch (Exception e) { String errorMsg = String.format("Error reading path: %s from zookeeper.", zkBaseDir); LOG.error(errorMsg, e); throw new SamzaException(errorMsg, e); } }
Source:
public static String getClassName(String beanName){ int lastDotPosition = beanName.lastIndexOf("."); if(lastDotPosition < 0 || beanName.length() < lastDotPosition){ lastDotPosition = 0; } if(beanName.length() > 0) { beanName = beanName.substring(lastDotPosition, lastDotPosition+1).toUpperCase() + beanName.substring(lastDotPosition+1); } return beanName; }

Target:
public static String getClassName(String beanName){ int lastDotPosition = beanName.lastIndexOf("."); String beforeLastDot = ""; if(lastDotPosition >= 0 && beanName.length() > lastDotPosition){ beforeLastDot = beanName.substring(0, lastDotPosition+1); lastDotPosition++; }else{ lastDotPosition = 0; } if(beanName.length() > lastDotPosition) { beanName = beforeLastDot+beanName.substring(lastDotPosition, lastDotPosition+1).toUpperCase() + beanName.substring(lastDotPosition+1); } return beanName; }
Source:
private boolean runVmAsStateless(VM vmToRunAsStateless) { log.infoFormat("Running Vm {0} as stateless", vmToRunAsStateless); RunVmParams runVmParams = new RunVmParams(vmToRunAsStateless.getId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToRunAsStateless.getId())); runVmParams.setRunAsStateless(true); VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RunVm, runVmParams, ExecutionHandler.createInternalJobContext()); boolean prestartingVmSucceeded = vdcReturnValue.getSucceeded(); if (!prestartingVmSucceeded) { AuditLogableBase log = new AuditLogableBase(); log.setVmId(vmToRunAsStateless.getId()); log.addCustomValue("VmName", vmToRunAsStateless.getName()); log.addCustomValue("VmPoolName", vmToRunAsStateless.getVmPoolName()); AuditLogDirector.log(log, AuditLogType.VM_FAILED_TO_PRESTART_IN_POOL); } log.infoFormat("Running Vm {0} as stateless {1}", vmToRunAsStateless, prestartingVmSucceeded ? "succeeded" : "failed"); return prestartingVmSucceeded; }

Target:
private boolean runVmAsStateless(VM vmToRunAsStateless) { log.infoFormat("Running Vm {0} as stateless", vmToRunAsStateless); RunVmParams runVmParams = new RunVmParams(vmToRunAsStateless.getId()); runVmParams.setEntityInfo(new EntityInfo(VdcObjectType.VM, vmToRunAsStateless.getId())); runVmParams.setRunAsStateless(true); VdcReturnValueBase vdcReturnValue = Backend.getInstance().runInternalAction(VdcActionType.RunVm, runVmParams, ExecutionHandler.createInternalJobContext()); boolean prestartingVmSucceeded = vdcReturnValue.getSucceeded(); if (!prestartingVmSucceeded) { AuditLogableBase log = new AuditLogableBase(); log.setVmId(vmToRunAsStateless.getId()); log.addCustomValue("VmPoolName", vmToRunAsStateless.getVmPoolName()); AuditLogDirector.log(log, AuditLogType.VM_FAILED_TO_PRESTART_IN_POOL); } log.infoFormat("Running Vm {0} as stateless {1}", vmToRunAsStateless, prestartingVmSucceeded ? "succeeded" : "failed"); return prestartingVmSucceeded; }
Source:
public static synchronized IgnoreEntryOccurrence deserialize(@NotNull DataInput in) throws IOException { final String url = in.readUTF(); if (StringUtils.isEmpty(url)) { return null; } final int size = in.readInt(); final ArrayList<Pair<Pattern, Boolean>> items = ContainerUtil.newArrayList(); for (int i = 0; i < size; i++) { final Pattern pattern = Pattern.compile(in.readUTF()); Boolean isNegated = in.readBoolean(); items.add(Pair.create(pattern, isNegated)); } return new IgnoreEntryOccurrence(url, ContainerUtil.immutableList(items)); }

Target:
public static synchronized IgnoreEntryOccurrence deserialize(@NotNull DataInput in) throws IOException { final String url = in.readUTF(); final ArrayList<Pair<String, Boolean>> items = ContainerUtil.newArrayList(); if (!StringUtils.isEmpty(url)) { final int size = in.readInt(); for (int i = 0; i < size; i++) { String pattern = in.readUTF(); Boolean isNegated = in.readBoolean(); items.add(Pair.create(pattern, isNegated)); } } return new IgnoreEntryOccurrence(url, items); }
Source:
private void setupWALAndReplication() throws IOException { boolean isMasterNoTableOrSystemTableOnly = this instanceof HMaster && !LoadBalancer.isMasterCanHostUserRegions(conf); WALFactory factory = new WALFactory(conf, serverName.toString(), (Server) this, !isMasterNoTableOrSystemTableOnly); if (!isMasterNoTableOrSystemTableOnly) { Path oldLogDir = new Path(walRootDir, HConstants.HREGION_OLDLOGDIR_NAME); String logName = AbstractFSWALProvider.getWALDirectoryName(this.serverName.toString()); Path logDir = new Path(walRootDir, logName); LOG.debug("logDir={}", logDir); if (this.walFs.exists(logDir)) { throw new RegionServerRunningException( "Region server has already created directory at " + this.serverName.toString()); } if (!this.walFs.mkdirs(logDir)) { throw new IOException("Can not create wal directory " + logDir); } createNewReplicationInstance(conf, this, this.walFs, logDir, oldLogDir, factory.getWALProvider()); } this.walFactory = factory; }

Target:
private void setupWALAndReplication() throws IOException { boolean isMasterNoTableOrSystemTableOnly = this instanceof HMaster && !LoadBalancer.isMasterCanHostUserRegions(conf); WALFactory factory = new WALFactory(conf, serverName.toString(), this, !isMasterNoTableOrSystemTableOnly); if (!isMasterNoTableOrSystemTableOnly) { Path oldLogDir = new Path(walRootDir, HConstants.HREGION_OLDLOGDIR_NAME); String logName = AbstractFSWALProvider.getWALDirectoryName(this.serverName.toString()); Path logDir = new Path(walRootDir, logName); LOG.debug("logDir={}", logDir); if (this.walFs.exists(logDir)) { throw new RegionServerRunningException( "Region server has already created directory at " + this.serverName.toString()); } if (!this.walFs.mkdirs(logDir)) { throw new IOException("Can not create wal directory " + logDir); } createNewReplicationInstance(conf, this, this.walFs, logDir, oldLogDir, factory.getWALProvider()); } this.walFactory = factory; }
Source:
public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiget_slice(List<ByteBuffer> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { try (CloseableTrace trace = startLocalTrace( "client.multiget_slice(table {}, number of keys {}, number of columns {}, consistency {})", LoggingArgs.safeInternalTableNameOrPlaceholder(column_parent.column_family), keys.size(), predicate.slice_range.count, toString(consistency_level))) { return registerDuration( () -> delegate.multiget_slice(keys, column_parent, predicate, consistency_level), MULTIGET_SLICE_TIMER); } }

Target:
public Map<ByteBuffer, List<ColumnOrSuperColumn>> multiget_slice(List<ByteBuffer> keys, ColumnParent column_parent, SlicePredicate predicate, ConsistencyLevel consistency_level) throws InvalidRequestException, UnavailableException, TimedOutException, TException { String internalTableReference = column_parent.column_family; int numberOfKeys = keys.size(); int numberOfColumns = predicate.slice_range.count; try (CloseableTrace trace = startLocalTrace( "client.multiget_slice(table {}, number of keys {}, number of columns {}, consistency {})", LoggingArgs.safeInternalTableNameOrPlaceholder(internalTableReference), numberOfKeys, numberOfColumns, consistency_level)) { return registerDuration( () -> delegate.multiget_slice(keys, column_parent, predicate, consistency_level), MULTIGET_SLICE_TIMER, logger -> logger.warn("client.multiget_slice({}, {}, {}, {})", LoggingArgs.safeInternalTableNameOrPlaceholder(internalTableReference), SafeArg.of("number of keys", numberOfKeys), SafeArg.of("number of columns", numberOfColumns), SafeArg.of("consistency", consistency_level.toString()))); } }