auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void registerDefaultRecipes() { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.COBBLESTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.TERRACOTTA, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.OBSIDIAN) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); for (Material terracotta : SlimefunTag.TERRACOTTA.getValues()) { registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(terracotta, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); } for (Material leaves : Tag.LEAVES.getValues()) { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(leaves, 16) }, new ItemStack[] { new ItemStack(Material.WATER_BUCKET) }); } if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { registerRecipe(10, new ItemStack[] {new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 8)}, new ItemStack[] {new ItemStack(Material.LAVA_BUCKET)}); registerRecipe(10, new ItemStack[] {new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 8)}, new ItemStack[] {new ItemStack(Material.LAVA_BUCKET)}); } }

Target:
protected void registerDefaultRecipes() { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.COBBLESTONE, 16) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.TERRACOTTA, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.OBSIDIAN) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); for (Material terracotta : SlimefunTag.TERRACOTTA.getValues()) { registerRecipe(8, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(terracotta, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); } for (Material leaves : Tag.LEAVES.getValues()) { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(leaves, 16) }, new ItemStack[] { new ItemStack(Material.WATER_BUCKET) }); } if (SlimefunPlugin.getMinecraftVersion().isAtLeast(MinecraftVersion.MINECRAFT_1_16)) { registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BLACKSTONE, 8) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); registerRecipe(10, new ItemStack[] { new ItemStack(Material.BUCKET), new ItemStack(Material.BASALT, 12) }, new ItemStack[] { new ItemStack(Material.LAVA_BUCKET) }); } }
Source:
public void testEnDecrypt() throws NoSuchAlgorithmException, IOException, NoSuchProviderException { final KeyGenerator keygen = KeyGenerator.getInstance("AES", "BC"); keygen.init(256); final SecretKey key = keygen.generateKey(); final byte[] keyBytes = key.getEncoded(); final File temp = File.createTempFile("secret", "key"); Files.write(temp.toPath(), keyBytes, StandardOpenOption.APPEND); final EncryptionService encryptionService = new EncryptionService(temp.getPath()); Assert.assertEquals("testje", new String(encryptionService.decrypt(encryptionService.encrypt("testje".getBytes())))); }

Target:
public void testEnDecrypt() throws NoSuchAlgorithmException, IOException, NoSuchProviderException { final KeyGenerator keygen = KeyGenerator.getInstance(AES, BC); keygen.init(256); final SecretKey key = keygen.generateKey(); final byte[] keyBytes = key.getEncoded(); final File temp = File.createTempFile(SECRET, KEY2); Files.write(temp.toPath(), keyBytes, StandardOpenOption.APPEND); final EncryptionService encryptionService = new TestableEncService(temp.getPath()); Assert.assertEquals(TESTJE, new String(encryptionService.decrypt(encryptionService.encrypt(TESTJE.getBytes())))); }
Source:
public void getDependencies_strictTraceId() { List<Span> mixedTrace = asList( Span.builder().traceIdHigh(1L).traceId(1L).id(1L).name("get") .addAnnotation(Annotation.create(TODAY * 1000, SERVER_RECV, WEB_ENDPOINT)) .addAnnotation(Annotation.create((TODAY + 350) * 1000, SERVER_SEND, WEB_ENDPOINT)) .build(), Span.builder().traceId(1L).parentId(1L).id(2L).name("get") .addAnnotation(Annotation.create((TODAY + 100) * 1000, SERVER_RECV, APP_ENDPOINT)) .addAnnotation(Annotation.create((TODAY + 250) * 1000, SERVER_SEND, APP_ENDPOINT)) .build(), Span.builder().traceIdHigh(1L).traceId(1L).parentId(1L).id(2L).name("get") .addAnnotation(Annotation.create((TODAY + 50) * 1000, CLIENT_SEND, WEB_ENDPOINT)) .addAnnotation(Annotation.create((TODAY + 300) * 1000, CLIENT_RECV, WEB_ENDPOINT)) .build() ); processDependencies(mixedTrace); assertThat(store().getDependencies(TODAY + 1000L, null)).containsOnly( DependencyLink.create("web", "app", 1) ); }

Target:
public void getDependencies_strictTraceId() { long traceIdHigh = Long.MAX_VALUE; long traceId = Long.MIN_VALUE; List<Span> mixedTrace = asList( Span.builder().traceIdHigh(traceIdHigh).traceId(traceId).id(1L).name("get") .addAnnotation(Annotation.create(TODAY * 1000, SERVER_RECV, WEB_ENDPOINT)) .addAnnotation(Annotation.create((TODAY + 350) * 1000, SERVER_SEND, WEB_ENDPOINT)) .build(), Span.builder().traceId(traceId).parentId(1L).id(2L).name("get") .addAnnotation(Annotation.create((TODAY + 100) * 1000, SERVER_RECV, APP_ENDPOINT)) .addAnnotation(Annotation.create((TODAY + 250) * 1000, SERVER_SEND, APP_ENDPOINT)) .build(), Span.builder().traceIdHigh(traceIdHigh).traceId(traceId).parentId(1L).id(2L).name("get") .addAnnotation(Annotation.create((TODAY + 50) * 1000, CLIENT_SEND, WEB_ENDPOINT)) .addAnnotation(Annotation.create((TODAY + 300) * 1000, CLIENT_RECV, WEB_ENDPOINT)) .build() ); processDependencies(mixedTrace); assertThat(store().getDependencies(TODAY + 1000L, null)).containsOnly( DependencyLink.create("web", "app", 1) ); }
Source:
void setQuantity(int quantity) throws IllegalArgumentException; int getMaxStackQuantity(); ItemStackSnapshot createSnapshot(); @Override ItemStack copy(); interface Builder extends DataBuilder<ItemStack> { Builder itemType(ItemType itemType); ItemType getCurrentItem(); Builder quantity(int quantity) throws IllegalArgumentException; <E> Builder keyValue(Key<? extends BaseValue<E>> key, E value); Builder itemData(DataManipulator<?, ?> itemData) throws IllegalArgumentException; Builder itemData(ImmutableDataManipulator<?, ?> itemData) throws IllegalArgumentException; <V> Builder add(Key<? extends BaseValue<V>> key, V value) throws IllegalArgumentException; Builder fromItemStack(ItemStack itemStack); default Builder fromBlockState(BlockState blockState) { checkNotNull(blockState); final BlockType blockType= blockState.getType(); checkArgument(blockType.getItem().isPresent(), "Missing valid ItemType for BlockType: " + blockType.getId()); itemType(blockType.getItem().get()); blockState.getContainers().forEach(this::itemData); return this; } Builder fromContainer(DataView container); default Builder fromSnapshot(ItemStackSnapshot snapshot) { return fromItemStack(snapshot.createStack()); } Builder fromBlockSnapshot(BlockSnapshot blockSnapshot); Builder remove(Class<? extends DataManipulator<?, ?>> manipulatorClass); default Builder apply(Predicate<Builder> predicate, Consumer<Builder> consumer) { if (predicate.test(this)) { consumer.accept(this); } return this; } ItemStack build() throws IllegalStateException; }

Target:
void setQuantity(int quantity) throws IllegalArgumentException; int getMaxStackQuantity(); ItemStackSnapshot createSnapshot(); boolean equalTo(ItemStack that); @Override ItemStack copy(); interface Builder extends DataBuilder<ItemStack> { @Override Builder from(ItemStack value); Builder itemType(ItemType itemType); ItemType getCurrentItem(); Builder quantity(int quantity) throws IllegalArgumentException; <E> Builder keyValue(Key<? extends BaseValue<E>> key, E value); Builder itemData(DataManipulator<?, ?> itemData) throws IllegalArgumentException; Builder itemData(ImmutableDataManipulator<?, ?> itemData) throws IllegalArgumentException; <V> Builder add(Key<? extends BaseValue<V>> key, V value) throws IllegalArgumentException; Builder fromItemStack(ItemStack itemStack); default Builder fromBlockState(BlockState blockState) { checkNotNull(blockState); final BlockType blockType= blockState.getType(); checkArgument(blockType.getItem().isPresent(), "Missing valid ItemType for BlockType: " + blockType.getId()); itemType(blockType.getItem().get()); blockState.getContainers().forEach(this::itemData); return this; } Builder fromContainer(DataView container); default Builder fromSnapshot(ItemStackSnapshot snapshot) { return fromItemStack(snapshot.createStack()); } Builder fromBlockSnapshot(BlockSnapshot blockSnapshot); Builder remove(Class<? extends DataManipulator<?, ?>> manipulatorClass); default Builder apply(Predicate<Builder> predicate, Consumer<Builder> consumer) { if (predicate.test(this)) { consumer.accept(this); } return this; } ItemStack build() throws IllegalStateException; }
Source:
private List<MethodCallExpr> getMethodCallExprList(BlockStmt blockStmt, int expectedSize, String scope, String method) { Stream<Statement> statementStream = getStatementStream(blockStmt, expectedSize); return statementStream .filter(Statement::isExpressionStmt) .map(expressionStmt -> ((ExpressionStmt) expressionStmt).getExpression()) .filter(expression -> expression instanceof MethodCallExpr) .map(expression -> (MethodCallExpr) expression) .filter(methodCallExpr -> methodCallExpr.getScope().isPresent() && methodCallExpr.getScope().get().isNameExpr() && ((NameExpr) methodCallExpr.getScope().get()).getName().asString().equals(scope) && methodCallExpr.getName().asString().equals(method)) .collect(Collectors.toList()); }

Target:
private List<MethodCallExpr> getMethodCallExprList(BlockStmt blockStmt, int expectedSize, String scope, String method) { Stream<Statement> statementStream = getStatementStream(blockStmt, expectedSize); return statementStream .filter(Statement::isExpressionStmt) .map(expressionStmt -> ((ExpressionStmt) expressionStmt).getExpression()) .filter(expression -> expression instanceof MethodCallExpr) .map(expression -> (MethodCallExpr) expression) .filter(methodCallExpr -> evaluateMethodCallExpr(methodCallExpr, scope, method)) .collect(Collectors.toList()); }
Source:
public DefaultWorkerBehaviorConfig( @JsonProperty("selectStrategy") WorkerSelectStrategy selectStrategy, @Deprecated @JsonProperty("autoScaler") AutoScaler autoScaler, @JsonProperty("autoScalers") List<AutoScaler> autoScalers ) { this.selectStrategy = selectStrategy; if (autoScaler != null && autoScalers != null) { throw new IllegalArgumentException("The autoScaler and autoScalers properties are mutually exclusive"); } if (autoScaler == null && autoScalers == null) { throw new IllegalArgumentException("Either autoScaler or autoScalers property must be provided"); } if (autoScaler != null) { this.autoScalers = Collections.singletonList(autoScaler); } else { if (autoScalers.size() != autoScalers.stream().map(AutoScaler::getCategory).distinct().count()) { throw new IllegalArgumentException("Each autoScaler element must have a different category"); } this.autoScalers = autoScalers; } }

Target:
public DefaultWorkerBehaviorConfig( @JsonProperty("selectStrategy") WorkerSelectStrategy selectStrategy, @Deprecated @JsonProperty("autoScaler") AutoScaler autoScaler, @JsonProperty("autoScalers") List<AutoScaler> autoScalers ) { this.selectStrategy = selectStrategy; if ((autoScaler == null) == (autoScalers == null)) { throw new IllegalArgumentException("Either(and only one of) autoScaler or autoScalers property must be provided"); } if (autoScaler != null) { this.autoScalers = Collections.singletonList(autoScaler); } else { if (autoScalers.size() != autoScalers.stream().map(AutoScaler::getCategory).distinct().count()) { throw new IllegalArgumentException("Each autoScaler element must have a different category"); } this.autoScalers = autoScalers; } }
Source:
public static Announcement parseAnnouncementParams (ActionParameters params) throws JSONException, ActionParamsException { JSONObject jsonParams = params.getPayLoadJSON(); Announcement Announcement = new Announcement(); if (jsonParams.has(KEY_ID)) { Announcement.setId(jsonParams.getInt(KEY_ID)); } if (jsonParams.has(KEY_TITLE)) { Announcement.setTitle(jsonParams.getString(KEY_TITLE)); } if (jsonParams.has(KEY_CONTENT)) { Announcement.setContent(jsonParams.getString(KEY_CONTENT)); } if (jsonParams.has(KEY_BEGIN_DATE)) { Announcement.setBeginDate(jsonParams.getString(KEY_BEGIN_DATE)); } if (jsonParams.has(KEY_END_DATE)) { Announcement.setEndDate(jsonParams.getString(KEY_END_DATE)); } if (jsonParams.has(KEY_ACTIVE)) { Announcement.setActive(jsonParams.getBoolean(KEY_ACTIVE)); } return Announcement; }

Target:
public static Announcement parseAnnouncementParams (ActionParameters params) throws JSONException, ActionParamsException { JSONObject jsonParams = params.getPayLoadJSON(); Announcement announcement = new Announcement(); if (jsonParams.has(KEY_ID)) { announcement.setId(jsonParams.getInt(KEY_ID)); } if (jsonParams.has(KEY_TITLE)) { announcement.setTitle(jsonParams.getString(KEY_TITLE)); } if (jsonParams.has(KEY_CONTENT)) { announcement.setContent(jsonParams.getString(KEY_CONTENT)); } if (jsonParams.has(KEY_BEGIN_DATE)) { announcement.setBeginDate(jsonParams.getString(KEY_BEGIN_DATE)); } if (jsonParams.has(KEY_END_DATE)) { announcement.setEndDate(jsonParams.getString(KEY_END_DATE)); } if (jsonParams.has(KEY_ACTIVE)) { announcement.setActive(jsonParams.getBoolean(KEY_ACTIVE)); } return announcement; }
Source:
public void getField() { assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.GEOMETRY, false, Collections.EMPTY_MAP), is("unknown_geo_index")); assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.XML, false, Collections.EMPTY_MAP), is("unknown_xml_tpt")); assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.STRING, false, Collections.EMPTY_MAP), is("unknown_txt_tokenized")); }

Target:
public void getField() { assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.GEOMETRY, false, Collections.EMPTY_MAP), is("unknown_geo_index")); assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.XML, false, Collections.EMPTY_MAP), is("unknown_xml_tpt")); assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.STRING, false, Collections.EMPTY_MAP), is("unknown_txt_tokenized")); Map<String, Serializable> enabledFeatures = new HashMap<String, Serializable>(); enabledFeatures.put(DynamicSchemaResolver.PHONETICS_FEATURE, Boolean.TRUE); assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.STRING, false, enabledFeatures), is("unknown_txt_phonetics")); enabledFeatures.put(DynamicSchemaResolver.PHONETICS_FEATURE, Boolean.FALSE); assertThat( new DynamicSchemaResolver() .getField("unknown", AttributeFormat.STRING, false, enabledFeatures), is("unknown_txt_tokenized")); }
Source:
void synchronizeAllUsersDeleteWorkloadUser() { Set<String> users = Set.of(USER_CRN); String deletedWorkloadUser = "workload-user"; SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest(); request.setEnvironments(Set.of()); request.setUsers(users); request.setDeletedWorkloadUser(deletedWorkloadUser); Operation operation = mock(Operation.class); when(userSyncService.synchronizeUsersWithCustomPermissionCheck(any(), any(), any(), any(), any())).thenReturn(operation); SyncOperationStatus status = mock(SyncOperationStatus.class); when(operationToSyncOperationStatus.convert(operation)).thenReturn(status); assertEquals(status, ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.synchronizeAllUsers(request))); UserSyncRequestFilter userSyncFilter = new UserSyncRequestFilter(users, Set.of(), Optional.of(deletedWorkloadUser)); verify(userSyncService, times(1)).synchronizeUsersWithCustomPermissionCheck(ACCOUNT_ID, USER_CRN, Set.of(), userSyncFilter, AuthorizationResourceAction.DESCRIBE_ENVIRONMENT); }

Target:
void synchronizeAllUsersDeleteWorkloadUser() { Set<String> users = Set.of(USER_CRN); String deletedWorkloadUser = "workload-user"; SynchronizeAllUsersRequest request = new SynchronizeAllUsersRequest(); request.setEnvironments(Set.of()); request.setUsers(users); request.setDeletedWorkloadUsers(Set.of(deletedWorkloadUser)); Operation operation = mock(Operation.class); when(userSyncService.synchronizeUsersWithCustomPermissionCheck(any(), any(), any(), any(), any())).thenReturn(operation); SyncOperationStatus status = mock(SyncOperationStatus.class); when(operationToSyncOperationStatus.convert(operation)).thenReturn(status); assertEquals(status, ThreadBasedUserCrnProvider.doAs(USER_CRN, () -> underTest.synchronizeAllUsers(request))); UserSyncRequestFilter userSyncFilter = new UserSyncRequestFilter(users, Set.of(), Optional.of(deletedWorkloadUser)); verify(userSyncService, times(1)).synchronizeUsersWithCustomPermissionCheck(ACCOUNT_ID, USER_CRN, Set.of(), userSyncFilter, AuthorizationResourceAction.DESCRIBE_ENVIRONMENT); }
Source:
public <T extends View> T onErrorUse(Class<T> view) { if (!hasErrors()) { return new MockResult(proxifier).use(view); } result.include("errors", getErrors()); outjector.outjectRequestMap(); logger.debug("there are errors on result: {}", messages.handleErrors()); return viewsFactory.instanceFor(view, messages.handleErrors()); }

Target:
public <T extends View> T onErrorUse(Class<T> view) { if (!hasErrors()) { return new MockResult(proxifier).use(view); } result.include("errors", getErrors()); outjector.outjectRequestMap(); logger.debug("there are errors on result: {}", getErrors()); return viewsFactory.instanceFor(view, messages.handleErrors()); }
Source:
public void testHttpSensor() throws Exception { new HttpRequestSensor<String>(ConfigBag.newInstance() .configure(HttpRequestSensor.SENSOR_NAME, SENSOR_STRING.getName()) .configure(HttpRequestSensor.JSON_PATH, "$.myKey") .configure(HttpRequestSensor.SENSOR_URI, "<LINK_0>")) .apply(entity); entity.setAttribute(Attributes.SERVICE_UP, true); succeedsEventually(new Runnable() { public void run() { String val = entity.getAttribute(SENSOR_STRING); assertTrue(val != null); } }); String val = entity.getAttribute(SENSOR_STRING); assertEquals(val, "myValue", "val=" + val); }

Target:
public void testHttpSensor() throws Exception { HttpRequestSensor<Integer> sensor = new HttpRequestSensor<Integer>(ConfigBag.newInstance() .configure(HttpRequestSensor.SENSOR_NAME, SENSOR_STRING.getName()) .configure(HttpRequestSensor.SENSOR_TYPE, TARGET_TYPE) .configure(HttpRequestSensor.JSON_PATH, "$.myKey") .configure(HttpRequestSensor.SENSOR_URI, "<LINK_0>")); sensor.apply(entity); entity.setAttribute(Attributes.SERVICE_UP, true); EntityTestUtils.assertAttributeEqualsEventually(entity, SENSOR_STRING, SENSOR_STRING.getName()); String val = entity.getConfig(HttpRequestSensor.SENSOR_NAME); assertEquals(val, "myValue", "val=" + val); }
Source:
public boolean test() { currentThreads = Thread.getAllStackTraces().keySet(); Iterator<Thread> itThread = currentThreads.iterator(); boolean threadNotFound = true; boolean hasState = false; while(threadNotFound && itThread.hasNext()){ Thread thread = itThread.next(); System.out.println("*********" + thread.getName() + ":" + thread.getState()); if (nameMatcher.matches(thread.getName())){ threadNotFound = false; hasState = thread.getState().equals(state); } } return hasState || (threadNotFound && returnTrueIfDoesNotExist); }

Target:
public boolean test() { currentThreads = Thread.getAllStackTraces().keySet(); Iterator<Thread> itThread = currentThreads.iterator(); boolean threadNotFound = true; boolean hasState = false; while(threadNotFound && itThread.hasNext()){ Thread thread = itThread.next(); if (nameMatcher.matches(thread.getName())){ threadNotFound = false; hasState = thread.getState().equals(state); } } return hasState || (threadNotFound && returnTrueIfDoesNotExist); }
Source:
public <C extends ReplicaCollection<? extends C>> C sortedByProximity(final InetAddressAndPort address, C unsortedAddresses) { assert address.equals(FBUtilities.getBroadcastAddressAndPort()); for (Replica unsortedAddress : unsortedAddresses) markRequested(unsortedAddress.endpoint()); return dynamicBadnessThreshold == 0 ? sortedByProximityWithScore(address, unsortedAddresses) : sortedByProximityWithBadness(address, unsortedAddresses); }

Target:
public <C extends ReplicaCollection<? extends C>> C sortedByProximity(final InetAddressAndPort address, C unsortedAddresses) { assert address.equals(FBUtilities.getBroadcastAddressAndPort()); for (Replica replica: unsortedAddresses) { AnnotatedMeasurement measurement = samples.get(replica.endpoint()); if (measurement != null && measurement.millisSinceLastRequest.get() > 0) measurement.millisSinceLastRequest.lazySet(0); } Map<InetAddressAndPort, Double> aliasedScores = this.scores; return dynamicBadnessThreshold == 0 ? sortedByProximityWithScore(address, unsortedAddresses, aliasedScores) : sortedByProximityWithBadness(address, unsortedAddresses, aliasedScores); }
Source:
public void setFromReference(Reference ref) { databaseName = getReferenceProperty(ref, "databaseName"); String ports = getReferenceProperty(ref, "portNumber"); if (ports != null) { String[] ps = ports.split(","); portNumbers = new int[ps.length]; for (int i = 0; i < ps.length; i++) { portNumbers[i] = Integer.parseInt(ps[i]); } } serverNames = getReferenceProperty(ref, "serverName").split(","); for (PGProperty property : PGProperty.values()) { setProperty(property, getReferenceProperty(ref, property.getName())); } }

Target:
public void setFromReference(Reference ref) { databaseName = getReferenceProperty(ref, "databaseName"); String portNumberString = getReferenceProperty(ref, "portNumber"); if (portNumberString != null) { String[] ps = portNumberString.split(","); int[] ports = new int[ps.length]; for (int i = 0; i < ps.length; i++) { try { ports[i] = Integer.parseInt(ps[i]); } catch (NumberFormatException e) { ports[i] = 0; } } setPortNumbers(ports); } else { setPortNumbers(null); } setServerNames(getReferenceProperty(ref, "serverName").split(",")); for (PGProperty property : PGProperty.values()) { setProperty(property, getReferenceProperty(ref, property.getName())); } }
Source:
protected List<String> listFiles() { GetImagesListParameters queryParams = new GetImagesListParameters(asGuid(storageDomainId), ImageFileType.All); queryParams.setForceRefresh(true); List<RepoImage> files = getBackendCollection(RepoImage.class, VdcQueryType.GetImagesList, queryParams); return files.stream().map(RepoImage::getRepoImageId).collect(Collectors.toCollection(LinkedList::new)); }

Target:
protected List<String> listFiles() { GetImagesListParameters queryParams = new GetImagesListParameters(asGuid(storageDomainId), ImageFileType.All); queryParams.setForceRefresh(true); List<RepoImage> files = getBackendCollection(RepoImage.class, VdcQueryType.GetImagesList, queryParams); return files.stream().map(RepoImage::getRepoImageId).collect(Collectors.toList()); }
Source:
public void show() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( this.activity); alertDialogBuilder.setTitle(this.titleResId); String[] itemNames = new String[items.size()]; boolean[] states = new boolean[items.size()]; for (int ii = 0; ii < items.size(); ii++) { itemNames[ii] = this.formatter.format(items.get(ii)); states[ii] = false; } final Set<Integer> selectedInds = new HashSet<Integer>(); alertDialogBuilder .setCancelable(true) .setMultiChoiceItems(itemNames, states, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (isChecked) { selectedInds.add(which); } else { selectedInds.remove(which); } } }) .setPositiveButton(this.okButtonResId, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { List<T> selectedItems = new ArrayList<T>(); for (int ind : selectedInds) { selectedItems.add(items.get(ind)); } onClickListener.onItemsClick(selectedItems); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }

Target:
public void show() { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( this.activity); alertDialogBuilder.setTitle(this.titleResId); String[] itemNames = new String[items.size()]; boolean[] states = new boolean[items.size()]; for (int ii = 0; ii < items.size(); ii++) { itemNames[ii] = this.formatter.format(items.get(ii)); states[ii] = false; } final Set<Integer> selectedIndices = new HashSet<Integer>(); alertDialogBuilder .setCancelable(true) .setMultiChoiceItems(itemNames, states, new DialogInterface.OnMultiChoiceClickListener() { public void onClick(DialogInterface dialog, int which, boolean isChecked) { if (isChecked) { selectedIndices.add(which); } else { selectedIndices.remove(which); } } }) .setPositiveButton(this.okButtonResId, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { List<T> selectedItems = new ArrayList<T>(); for (int ind : selectedIndices) { selectedItems.add(items.get(ind)); } onClickListener.onItemsClick(selectedItems); } }); AlertDialog alertDialog = alertDialogBuilder.create(); alertDialog.show(); }
Source:
public PlanWithProperties visitTopN(TopNNode node, Context context) { PlanWithProperties child; switch (node.getStep()) { case SINGLE: case FINAL: child = planChild(node, context.withPreferredProperties(PreferredProperties.any())); if (!child.getProperties().isSingleNode()) { child = withDerivedProperties( gatheringExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } break; case PARTIAL: child = planChild(node, context.withPreferredProperties(PreferredProperties.any())); break; default: throw new UnsupportedOperationException(format("Unsupported step for TopN [%s]", node.getStep())); } return rebaseAndDeriveProperties(node, child); }

Target:
public PlanWithProperties visitTopN(TopNNode node, Context context) { PlanWithProperties child; switch (node.getStep()) { case SINGLE: case FINAL: child = planChild(node, context.withPreferredProperties(PreferredProperties.undistributed())); if (!child.getProperties().isSingleNode()) { child = withDerivedProperties( gatheringExchange(idAllocator.getNextId(), REMOTE, child.getNode()), child.getProperties()); } break; case PARTIAL: child = planChild(node, context.withPreferredProperties(PreferredProperties.any())); break; default: throw new UnsupportedOperationException(format("Unsupported step for TopN [%s]", node.getStep())); } return rebaseAndDeriveProperties(node, child); }
Source:
public long getTimePeriodInSeconds(String timePeriod) { try { String timeValueString = timePeriod.substring(0, timePeriod.length() - 1); String timeUnitString = timePeriod.substring(timePeriod.length() - 1); Long timeValue = Long.parseLong(timeValueString); MetricReader.TimeUnit timeUnit = MetricReader.TimeUnit.fromString(timeUnitString); long timePeriodInSeconds = timeValue * timeUnit.getValue() / 1000; return timePeriodInSeconds; } catch (Exception e) { throw new IllegalArgumentException("Invalid expression for time period constant."); } }

Target:
public long getTimePeriodInSeconds(String timePeriod) { try { int timeUnitIndex = timePeriod.length() - 1; String timeValueString = timePeriod.substring(0, timeUnitIndex); String timeUnitString = timePeriod.substring(timeUnitIndex); Long timeValue = Long.parseLong(timeValueString); MetricReader.TimeUnit timeUnit = MetricReader.TimeUnit.fromString(timeUnitString); long timePeriodInSeconds = timeValue * timeUnit.getValue() / 1000; return timePeriodInSeconds; } catch (Exception e) { throw new IllegalArgumentException("Invalid expression for time period constant."); } }
Source:
public SolrPasswordUpdateImpl( UuidGenerator uuidGenerator, ClientFactoryFactory clientFactoryFactory, EncryptionService encryptionService) { this.encryptionService = encryptionService; this.uuidGenerator = uuidGenerator; this.restClientFactoryFactory = clientFactoryFactory; properties = AccessController.doPrivileged( (PrivilegedAction<java.util.Properties>) System::getProperties); }

Target:
public SolrPasswordUpdateImpl( UuidGenerator uuidGenerator, ClientFactoryFactory clientFactoryFactory, EncryptionService encryptionService) { this.encryptionService = encryptionService; this.uuidGenerator = uuidGenerator; this.restClientFactoryFactory = clientFactoryFactory; }
Source:
private static LRAStatus fromString(String status) { if (status != null) { return LRAStatus.valueOf(status); } return null; }

Target:
private static LRAStatus fromString(String status) { if (status == null) { throw new IllegalArgumentException("The status parameter is null"); } return LRAStatus.valueOf(status); }
Source:
static InstallState getNextInstallState(final InstallState current) { List<Function<Provider<InstallState>,InstallState>> installStateFilterChain = new ArrayList<>(); for (final InstallStateFilter setupExtension : InstallStateFilter.all()) { installStateFilterChain.add(new Function<Provider<InstallState>, InstallState>() { @Override public InstallState apply(Provider<InstallState> next) { return setupExtension.getNextInstallState(current, next); } }); } installStateFilterChain.add(new Function<Provider<InstallState>, InstallState>() { @Override public InstallState apply(Provider<InstallState> input) { if (current == null || InstallState.UNKNOWN.equals(current)) { return getDefaultInstallState(); } final Map<InstallState, InstallState> states = new HashMap<InstallState, InstallState>(); { states.put(InstallState.CREATE_ADMIN_USER, InstallState.INITIAL_SETUP_COMPLETED); states.put(InstallState.INITIAL_PLUGINS_INSTALLING, InstallState.CREATE_ADMIN_USER); states.put(InstallState.INITIAL_SECURITY_SETUP, InstallState.NEW); states.put(InstallState.RESTART, InstallState.RUNNING); states.put(InstallState.UPGRADE, InstallState.INITIAL_SETUP_COMPLETED); states.put(InstallState.DOWNGRADE, InstallState.INITIAL_SETUP_COMPLETED); } return states.get(current); } }); ProviderChain<InstallState> chain = new ProviderChain<>(installStateFilterChain.iterator()); return chain.get(); }

Target:
static InstallState getNextInstallState(final InstallState current) { List<Function<Provider<InstallState>,InstallState>> installStateFilterChain = new ArrayList<>(); for (final InstallStateFilter setupExtension : InstallStateFilter.all()) { installStateFilterChain.add(new Function<Provider<InstallState>, InstallState>() { @Override public InstallState apply(Provider<InstallState> next) { return setupExtension.getNextInstallState(current, next); } }); } installStateFilterChain.add(new Function<Provider<InstallState>, InstallState>() { @Override public InstallState apply(Provider<InstallState> input) { if (current == null || InstallState.UNKNOWN.equals(current)) { return getDefaultInstallState(); } final Map<InstallState, InstallState> states = new HashMap<InstallState, InstallState>(); { states.put(InstallState.CREATE_ADMIN_USER, InstallState.INITIAL_SETUP_COMPLETED); states.put(InstallState.INITIAL_PLUGINS_INSTALLING, InstallState.CREATE_ADMIN_USER); states.put(InstallState.INITIAL_SECURITY_SETUP, InstallState.NEW); states.put(InstallState.RESTART, InstallState.RUNNING); states.put(InstallState.UPGRADE, InstallState.INITIAL_SETUP_COMPLETED); states.put(InstallState.DOWNGRADE, InstallState.INITIAL_SETUP_COMPLETED); states.put(InstallState.INITIAL_SETUP_COMPLETED, InstallState.RUNNING); } return states.get(current); } }); ProviderChain<InstallState> chain = new ProviderChain<>(installStateFilterChain.iterator()); return chain.get(); }
Source:
public ListenableFuture<URI> requestCodeReview(Path path, String message) throws TmcCoreException { Command<URI> requestCodeReview = getRequestCodeReviewCmd(settings, path, message); return threadPool.submit(requestCodeReview); }

Target:
public ListenableFuture<URI> requestCodeReview(Path path, String message) throws TmcCoreException { return threadPool.submit(getRequestCodeReviewCmd(settings, path, message)); }
Source:
private String getXmlObjectValue(XMLObject xmlObject) { if (xmlObject == null) { return null; } if (xmlObject instanceof XSString) { ((XSString) xmlObject).getValue(); } if (xmlObject instanceof XSAnyImpl) { return ((XSAnyImpl) xmlObject).getTextContent(); } return xmlObject.toString(); }

Target:
private Object getXmlObjectValue(XMLObject xmlObject) { if (xmlObject == null) { return null; } if (xmlObject instanceof XSAny) { return getXSAnyObjectValue((XSAny) xmlObject); } if (xmlObject instanceof XSString) { return ((XSString) xmlObject).getValue(); } if (xmlObject instanceof XSInteger) { return ((XSInteger) xmlObject).getValue(); } if (xmlObject instanceof XSURI) { return ((XSURI) xmlObject).getValue(); } if (xmlObject instanceof XSBoolean) { XSBooleanValue xsBooleanValue = ((XSBoolean) xmlObject).getValue(); return xsBooleanValue != null ? xsBooleanValue.getValue() : null; } if (xmlObject instanceof XSDateTime) { DateTime dateTime = ((XSDateTime) xmlObject).getValue(); return dateTime != null ? Instant.ofEpochMilli(dateTime.getMillis()) : null; } return null; }
Source:
public void varStatus() { System.out.println("======================================="); System.out.println("nativeHeight: " + nativeHeight); System.out.println("nativeWidth: " + nativeWidth); System.out.println("webviewHeight: " + webviewHeight); System.out.println("webviewWidth: " + webviewWidth); System.out.println("ratio (nativeWidth / appWebviewWidth): " + ratio); System.out.println("======================================="); System.out.println("taskbarNativeHeight: " + taskbarNativeHeight); System.out.println("taskbarNativeWidth: " + taskbarNativeWidth); System.out.println("taskbarWebviewHeight: " + taskbarWebviewHeight); System.out.println("taskbarWebviewWidth: " + taskbarWebviewWidth); System.out.println("======================================="); System.out.println("appNativeWidth: " + appNativeWidth); System.out.println("appNativeHeight: " + appNativeHeight); System.out.println("appWebviewHeight: " + appWebviewHeight); System.out.println("appWebviewWidth: " + appWebviewWidth); System.out.println("======================================="); System.out.println("loadedPageHeight: " + loadedPageHeight); System.out.println("loadedPageWidth: " + loadedPageWidth); System.out.println("======================================="); }

Target:
public void varStatus() { System.out.println("======================================="); System.out.println("nativeHeight: " + nativeHeight); System.out.println("nativeWidth: " + nativeWidth); System.out.println("webviewHeight: " + webviewHeight); System.out.println("webviewWidth: " + webviewWidth); System.out.println("ratio (nativeWidth / appWebviewWidth): " + ratio); System.out.println("======================================="); System.out.println("taskbarNativeHeight: " + taskbarNativeHeight); System.out.println("taskbarNativeWidth: " + taskbarNativeWidth); System.out.println("taskbarWebviewHeight: " + taskbarWebviewHeight); System.out.println("taskbarWebviewWidth: " + taskbarWebviewWidth); System.out.println("======================================="); System.out.println("appNativeWidth: " + appNativeWidth); System.out.println("appNativeHeight: " + appNativeHeight); System.out.println("appWebviewHeight: " + appWebviewHeight); System.out.println("appWebviewWidth: " + appWebviewWidth); System.out.println("======================================="); System.out.println("addressbarNativeHeight: " + addressbarNativeHeight); System.out.println("addressbarNativeWidth: " + addressbarNativeWidth); System.out.println("addressbarWebviewHeight: " + addressbarWebviewHeight); System.out.println("addressbarWebviewWidth: " + addressbarWebviewWidth); System.out.println("======================================="); System.out.println("loadedPageHeight: " + loadedPageHeight); System.out.println("loadedPageWidth: " + loadedPageWidth); System.out.println("======================================="); }
Source:
public JAXRS2Contract() { super.registerParameterAnnotation(Suspended.class, (ann, data, i) -> true); super.registerParameterAnnotation(Context.class, (ann, data, i) -> true); }

Target:
public JAXRS2Contract() { super.registerParameterAnnotation(Suspended.class, (ann, data, i) -> data.ignoreParamater(i)); super.registerParameterAnnotation(Context.class, (ann, data, i) -> data.ignoreParamater(i)); }
Source:
public <VELEMENT extends VElement> AbstractSWTRenderer<VElement> getRendererInstance(VELEMENT vElement, ViewModelContext viewModelContext) throws EMFFormsNoRendererException { if (rendererServices.isEmpty()) { throw new EMFFormsNoRendererException("No EMFFormsRendererService available!"); } double highestPriority = -1; EMFFormsRendererService<VElement> bestService = null; for (final EMFFormsRendererService<VElement> rendererService : rendererServices) { final double priority = rendererService.isApplicable(vElement, viewModelContext); if (priority > highestPriority) { highestPriority = priority; bestService = rendererService; } } if (bestService == null) { throw new EMFFormsNoRendererException(String.format( "No fitting EMFFormsRendererService for %1$s available!", vElement.eClass().getName())); } final AbstractSWTRenderer<VElement> rendererInstance = bestService.getRendererInstance(vElement, viewModelContext); if (rendererInstance == null) { throw new EMFFormsNoRendererException(String.format( "No fitting EMFFormsRendererService for %1$s available!", vElement.eClass().getName())); } try { rendererInstance.init(); } catch (final IllegalStateException e) { throw new EMFFormsNoRendererException(e); } return rendererInstance; }

Target:
public <VELEMENT extends VElement> AbstractSWTRenderer<VElement> getRendererInstance(VELEMENT vElement, ViewModelContext viewModelContext) throws EMFFormsNoRendererException { if (rendererServices.isEmpty()) { throw new EMFFormsNoRendererException("No EMFFormsRendererService available!"); } double highestPriority = -1; EMFFormsRendererService<VElement> bestService = null; for (final EMFFormsRendererService<VElement> rendererService : rendererServices) { final double priority = rendererService.isApplicable(vElement, viewModelContext); if (priority > highestPriority) { highestPriority = priority; bestService = rendererService; } } if (bestService == null) { throw new EMFFormsNoRendererException(String.format( "No fitting EMFFormsRendererService for %1$s available!", vElement.eClass().getName())); } final AbstractSWTRenderer<VElement> rendererInstance = bestService.getRendererInstance(vElement, viewModelContext); if (rendererInstance == null) { throw new EMFFormsNoRendererException(String.format( "No fitting EMFFormsRendererService for %1$s available!", vElement.eClass().getName())); } try { rendererInstance.init(); } catch (final RuntimeException e) { throw new EMFFormsNoRendererException(e); } END SUPRESS CATCH EXCEPTION return rendererInstance; }
Source:
public void shouldConvertAllFieldsInVariant() throws Exception { DBObject dbo = constructDbo(VariantData.getVariantWithoutAnnotation()); ItemProcessor<DBObject, VariantWrapper> processor = new AnnotationProcessor(); VariantWrapper variant = processor.process(dbo); assertEquals("+", variant.getStrand()); assertEquals("20", variant.getChr()); assertEquals("G/A", variant.getRefAlt()); assertEquals(60343, variant.getEnd()); assertEquals(60343, variant.getStart()); }

Target:
public void shouldConvertAllFieldsInVariant() throws Exception { DBObject dbo = constructDbObject(VariantData.getVariantWithoutAnnotation()); ItemProcessor<DBObject, VariantWrapper> processor = new AnnotationProcessor(); VariantWrapper variant = processor.process(dbo); assertEquals("+", variant.getStrand()); assertEquals("20", variant.getChr()); assertEquals("G/A", variant.getRefAlt()); assertEquals(60343, variant.getEnd()); assertEquals(60343, variant.getStart()); }
Source:
public String toString(){ StringBuilder sb = new StringBuilder(); sb.append("{ regEx=\"").append(regExString). append("\", className=\"").append(someClass.getCanonicalName()). append("}"); return sb.toString(); }

Target:
public String toString() { StringBuilder sb = new StringBuilder(); return "{ regEx=\"" + regExString + "\", className=\"" + someClass.getCanonicalName() + "}"; }
Source:
public void testMaxSpillPerNodeLimit() throws Exception { Map<String, String> properties = ImmutableMap.<String, String>builder() .put("experimental.spiller-spill-path", spillPath.getAbsolutePath()) .put("experimental.spill-enabled", "true") .put("experimental.operator-memory-limit-before-spill", "1B") .put("experimental.max-spill-per-node", "10B") .put("experimental.spiller-max-used-space-threshold", "1.0") .build(); try (QueryRunner queryRunner = createLocalQueryRunner( new NodeSpillConfig().setMaxSpillPerNode(DataSize.succinctBytes(10)))) { queryRunner.execute(queryRunner.getDefaultSession(), "SELECT COUNT(DISTINCT clerk) as count, orderdate FROM orders GROUP BY orderdate ORDER BY count, orderdate"); } }

Target:
public void testMaxSpillPerNodeLimit() throws Exception { Map<String, String> properties = ImmutableMap.<String, String>builder() .put("experimental.spiller-spill-path", spillPath.getAbsolutePath()) .put("experimental.spill-enabled", "true") .put("experimental.aggregation-operator-unspill-memory-limit", "1B") .put("experimental.max-spill-per-node", "10B") .put("experimental.spiller-max-used-space-threshold", "1.0") .build(); try (QueryRunner queryRunner = createLocalQueryRunner(new NodeSpillConfig().setMaxSpillPerNode(DataSize.succinctBytes(10)))) { queryRunner.execute(queryRunner.getDefaultSession(), "SELECT COUNT(DISTINCT clerk) as count, orderdate FROM orders GROUP BY orderdate ORDER BY count, orderdate"); } }
Source:
private void create(String projectName, OpenShiftClient client) throws InfrastructureException { try { client .projectrequests() .createNew() .withNewMetadata() .withName(projectName) .endMetadata() .done(); waitServiceAccountReadiness(projectName, client); } catch (KubernetesClientException e) { throw new InfrastructureException(e.getMessage(), e); } }

Target:
private void create(String projectName, OpenShiftClient client) throws InfrastructureException { try { client .projectrequests() .createNew() .withNewMetadata() .withName(projectName) .endMetadata() .done(); waitDefaultServiceAccount(projectName, client); } catch (KubernetesClientException e) { throw new InfrastructureException(e.getMessage(), e); } }
Source:
public void shouldRightProjectionOrElseRightProjectionFromSupplier() { final RightProjection<Object, Integer> rightRight = Either.right(1).right(); final RightProjection<Object, Integer> leftRight = Either.<Object, Integer>left(1).right(); final Supplier<RightProjection<Object, Integer>> rightProjectionSupplier = () -> Either.right(2).right(); assertThat(rightRight.orElse(rightProjectionSupplier).get()).isEqualTo(1); assertThat(leftRight.orElse(rightProjectionSupplier).get()).isEqualTo(2); }

Target:
public void shouldRightProjectionOrElseRightProjectionFromSupplier() { final RightProjection<Integer, Integer> elseProjection = API.<Integer, Integer>Right(2).right(); assertThat(Right(1).right().orElse(() -> elseProjection).get()).isEqualTo(1); assertThat(Left(1).right().orElse(() -> elseProjection).get()).isEqualTo(2); }
Source:
private void ensureProgramWorkflowIsSet(ProgramWorkflowState state, ProgramWorkflow workflow) throws APIException { if (state.getConcept() == null || state.getInitial() == null || state.getTerminal() == null) { throw new APIException("ProgramWorkflowState.requires", (Object[]) null); } if (state.getProgramWorkflow() == null) { state.setProgramWorkflow(workflow); } else if (!state.getProgramWorkflow().equals(workflow)) { throw new APIException("ProgramWorkflow.error.contains.state", new Object[] { workflow.getProgram() }); } }

Target:
private void ensureProgramWorkflowIsSet(ProgramWorkflowState state, ProgramWorkflow workflow) { if (state.getProgramWorkflow() == null) { state.setProgramWorkflow(workflow); } else if (!state.getProgramWorkflow().equals(workflow)) { throw new APIException("ProgramWorkflow.error.contains.state", new Object[] { workflow.getProgram() }); } }
Source:
private Get toGet(final Mutation mutation) throws IOException { assert mutation instanceof Increment || mutation instanceof Append; Get get = new Get(mutation.getRow()); CellScanner cellScanner = mutation.cellScanner(); while (!cellScanner.advance()) { Cell cell = cellScanner.current(); get.addColumn(CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell)); } if (mutation instanceof Increment) { Increment increment = (Increment) mutation; get.setTimeRange(increment.getTimeRange().getMin(), increment.getTimeRange().getMax()); } else { Append append = (Append) mutation; get.setTimeRange(append.getTimeRange().getMin(), append.getTimeRange().getMax()); } for (Entry<String, byte[]> entry : mutation.getAttributesMap().entrySet()) { get.setAttribute(entry.getKey(), entry.getValue()); } return get; }

Target:
private static Get toGet(final Mutation mutation) throws IOException { if(!(mutation instanceof Increment) && !(mutation instanceof Append)) { throw new AssertionError("mutation must be a instance of Increment or Append"); } Get get = new Get(mutation.getRow()); CellScanner cellScanner = mutation.cellScanner(); while (!cellScanner.advance()) { Cell cell = cellScanner.current(); get.addColumn(CellUtil.cloneFamily(cell), CellUtil.cloneQualifier(cell)); } if (mutation instanceof Increment) { Increment increment = (Increment) mutation; get.setTimeRange(increment.getTimeRange().getMin(), increment.getTimeRange().getMax()); } else { Append append = (Append) mutation; get.setTimeRange(append.getTimeRange().getMin(), append.getTimeRange().getMax()); } for (Entry<String, byte[]> entry : mutation.getAttributesMap().entrySet()) { get.setAttribute(entry.getKey(), entry.getValue()); } return get; }
Source:
public static RecordWriter createParquetWriter(Path target, JobConf conf, Properties properties, boolean compress) throws IOException, ReflectiveOperationException { Object outputFormat = MapredParquetOutputFormat.class.getConstructor().newInstance(); RecordWriter recordWriter = ((HiveOutputFormat<?, ?>) outputFormat) .getHiveRecordWriter(conf, target, Text.class, compress, properties, Reporter.NULL); Object realWriter = REAL_WRITER_FIELD.get(recordWriter); Object internalWriter = INTERNAL_WRITER_FIELD.get(realWriter); ParquetFileWriter fileWriter = (ParquetFileWriter) FILE_WRITER_FIELD.get(internalWriter); return new ExtendedRecordWriter() { private long length; @Override public long getWrittenBytes() { return length; } @Override public void write(Writable value) throws IOException { recordWriter.write(value); length = fileWriter.getPos(); } @Override public void close(boolean abort) throws IOException { recordWriter.close(abort); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } }; }

Target:
public static RecordWriter createParquetWriter(Path target, JobConf conf, Properties properties, boolean compress) throws IOException, ReflectiveOperationException { RecordWriter recordWriter = new MapredParquetOutputFormat() .getHiveRecordWriter(conf, target, Text.class, compress, properties, Reporter.NULL); Object realWriter = REAL_WRITER_FIELD.get(recordWriter); Object internalWriter = INTERNAL_WRITER_FIELD.get(realWriter); ParquetFileWriter fileWriter = (ParquetFileWriter) FILE_WRITER_FIELD.get(internalWriter); return new ExtendedRecordWriter() { private long length; @Override public long getWrittenBytes() { return length; } @Override public void write(Writable value) throws IOException { recordWriter.write(value); length = fileWriter.getPos(); } @Override public void close(boolean abort) throws IOException { recordWriter.close(abort); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } }; }
Source:
private String getColumnText(Object element, int columnIndex) { TaskReview reviewContainer = (TaskReview) element; switch (columnIndex) { case 0: return reviewContainer.getSummary(); case 1: return reviewContainer.getCrString(); case 2: return reviewContainer.getVString(); case 3: return reviewContainer.getIncomingChanges(); default: return ""; } }

Target:
private String getColumnText(Object element, int columnIndex) { TaskReview reviewContainer = (TaskReview) element; switch (columnIndex) { case 0: return reviewContainer.getSummary(); case 3: return reviewContainer.getIncomingChanges(); default: return ""; } }