auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void writeRows(Stream<List<Object>> rows, String sheetName) { try { Sheet sheet = workbook.getSheet(sheetName); rows.forEach( row -> { internalWriteRow(row, sheet, sheet.getLastRowNum() + 1); }); } catch (RuntimeException e) { throw new XlsxWriterException(e); } }

Target:
public void writeRows(Stream<List<Object>> rows, String sheetName) { try { Sheet sheet = workbook.getSheet(sheetName); rows.forEach(row -> writeRow(row, sheet, sheet.getLastRowNum() + 1)); } catch (RuntimeException e) { throw new XlsxWriterException(e); } }
Source:
public void smallerCounterexampleFoundIsCorrectEvenIfOriginalFailureIsNotNamed() { final String propertyName = "mySuperProperty"; final String[] originalArguments = {"first", "second", "third"}; final String[] arguments = {"first"}; final long[] seeds = {12345, 8842}; final AssertionError smallerFailure = new AssertionError(); final AssertionError originalFailure = new AssertionError(); final AssertionError actual = PropertyFalsified.smallerCounterexampleFound( propertyName, originalArguments, arguments, seeds, smallerFailure, originalFailure); final String expected = "Property named 'mySuperProperty' failed:\n" + "With arguments: [first]\n" + "First arguments found to also provoke a failure: [first, second, third]\n" + "Seeds for reproduction: [12345, 8842]"; Assert.assertEquals(expected, actual.getMessage()); }

Target:
public void smallerCounterexampleFoundIsCorrectEvenIfOriginalFailureIsNotNamed() { String propertyName = "mySuperProperty"; String[] originalArguments = {"first", "second", "third"}; String[] arguments = {"first"}; long[] seeds = {12345, 8842}; AssertionError smallerFailure = new AssertionError(); AssertionError originalFailure = new AssertionError(); AssertionError actual = PropertyFalsified.smallerCounterexampleFound( propertyName, originalArguments, arguments, seeds, smallerFailure, originalFailure); String expected = "Property named 'mySuperProperty' failed:\n" + "With arguments: [first]\n" + "First arguments found to also provoke a failure: [first, second, third]\n" + "Seeds for reproduction: [12345, 8842]"; assertEquals(expected, actual.getMessage()); }
Source:
public void testInsertNewFieldIfDataTypeIsStructureWhenDataTypeIsStructureButHasFields() { final DataType dataType = mock(DataType.class); when(dataTypeSelectComponent.getValue()).thenReturn(structure); when(dataType.getSubDataTypes()).thenReturn(asList(mock(DataType.class), mock(DataType.class))); doReturn(dataType).when(listItem).getDataType(); listItem.insertNewFieldIfDataTypeIsStructure(); verify(listItem, never()).insertNestedField(); }

Target:
public void testInsertNewFieldIfDataTypeIsStructureWhenDataTypeIsStructureButHasFields() { final DataType dataType = mock(DataType.class); final String hash = "hash"; when(dataTypeSelectComponent.getValue()).thenReturn(structure); when(dataType.getSubDataTypes()).thenReturn(asList(mock(DataType.class), mock(DataType.class))); doReturn(dataType).when(listItem).getDataType(); listItem.insertNewFieldIfDataTypeIsStructure(hash); verify(dataTypeList, never()).insertNestedField(anyString()); }
Source:
private boolean loadMappingsFromOldWorkspace(Map<String, Integer> map) { String STATE_FILE = ".fileTypes"; IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(STATE_FILE); File f = pluginStateLocation.toFile(); if (!f.exists()) return false; try (DataInputStream input = new DataInputStream(new FileInputStream(f))) { map.putAll(readOldFormatExtensionMappings(input)); } catch (IOException ex) { TeamPlugin.log(IStatus.ERROR, ex.getMessage(), ex); return false; } return true; }

Target:
private boolean loadMappingsFromOldWorkspace(Map<String, Integer> map) { String STATE_FILE = ".fileTypes"; IPath pluginStateLocation = TeamPlugin.getPlugin().getStateLocation().append(STATE_FILE); File f = pluginStateLocation.toFile(); if (!f.exists()) return false; try { DataInputStream input = new DataInputStream(new FileInputStream(f)); try { map.putAll(readOldFormatExtensionMappings(input)); } finally { input.close(); f.delete(); } } catch (IOException ex) { TeamPlugin.log(IStatus.ERROR, ex.getMessage(), ex); return false; } return true; }
Source:
public void error(String message, String sourceName, int line, String lineSource, int lineOffset) { System.out.println("Error : " + message); }

Target:
public void error(String message, String sourceName, int line, String lineSource, int lineOffset) { log.warn("Error : " + message); }
Source:
public void write(LittleEndianOutputStream stream) throws IOException; public void write(final File idxFile) throws IOException; public default void write(final Path indexPath) throws IOException { write(indexPath.toFile()); }

Target:
public void write(LittleEndianOutputStream stream) throws IOException; public default void write(final File idxFile) throws IOException { write(idxFile.toPath()); }
Source:
private static void iteratePublicStaticIntFields(DetailAST objBlock, Consumer<String> consumer) throws CheckstyleException { for (DetailAST member = objBlock.getFirstChild(); member != null; member = member.getNextSibling()) { boolean isVariables = member.getType() == TokenTypes.VARIABLES; if (isVariables && isPublicStaticFinalIntField(member.getFirstChild())) { final DetailAST modifiers = member.getFirstChild().findFirstToken(TokenTypes.MODIFIERS); final String firstJavadocSentence = getFirstJavadocSentence(modifiers); if (firstJavadocSentence != null) { consumer.accept(getName(member.getFirstChild()) + "=" + firstJavadocSentence.trim()); } } } }

Target:
private static void iteratePublicStaticIntFields(DetailAST objBlock, Consumer<String> consumer) throws CheckstyleException { for (DetailAST member = objBlock.getFirstChild(); member != null; member = member.getNextSibling()) { final boolean isVariables = member.getType() == TokenTypes.VARIABLES; if (isVariables && isPublicStaticFinalIntField(member.getFirstChild())) { final DetailAST modifiers = member.getFirstChild().findFirstToken(TokenTypes.MODIFIERS); DetailAST variableDef = member.getFirstChild(); while (variableDef.getNextSibling() != null) { final String firstJavadocSentence = getFirstJavadocSentence(modifiers); if (firstJavadocSentence != null) { consumer.accept(getName(variableDef) + "=" + firstJavadocSentence.trim()); } variableDef = variableDef.getNextSibling(); if (variableDef.getType() == TokenTypes.COMMA) { variableDef = variableDef.getNextSibling(); } } } } }
Source:
public static void createFromResourceUrl(Context context, final URL resourceUrl, final AuthenticationParamCallback callback) { if (callback == null) { throw new IllegalArgumentException("callback"); } Logger.v(TAG, "createFromResourceUrl"); final Handler handler = new Handler(context.getMainLooper()); sThreadExecutor.submit(new Runnable() { @Override public void run() { HashMap<String, String> headers = new HashMap<>(); headers.put(WebRequestHandler.HEADER_ACCEPT, WebRequestHandler.HEADER_ACCEPT_JSON); final HttpWebResponse webResponse; try { webResponse = sWebRequest.sendGet(resourceUrl, headers); try { onCompleted(null, parseResponse(webResponse)); } catch (ResourceAuthenticationChallengeException exc) { onCompleted(exc, null); } } catch (IOException e) { onCompleted(e, null); } } void onCompleted(final Exception exception, final AuthenticationParameters param) { handler.post(new Runnable() { @Override public void run() { callback.onCompleted(exception, param); } }); } }); }

Target:
public static void createFromResourceUrl(Context context, final URL resourceUrl, final AuthenticationParamCallback callback) { if (callback == null) { throw new IllegalArgumentException("callback"); } Logger.v(TAG, "createFromResourceUrl"); final Handler handler = new Handler(context.getMainLooper()); sThreadExecutor.submit(new Runnable() { @Override public void run() { final Map<String, String> headers = new HashMap<>(); headers.put(WebRequestHandler.HEADER_ACCEPT, WebRequestHandler.HEADER_ACCEPT_JSON); final HttpWebResponse webResponse; try { webResponse = sWebRequest.sendGet(resourceUrl, headers); try { onCompleted(null, parseResponse(webResponse)); } catch (ResourceAuthenticationChallengeException exc) { onCompleted(exc, null); } } catch (IOException e) { onCompleted(e, null); } } void onCompleted(final Exception exception, final AuthenticationParameters param) { handler.post(new Runnable() { @Override public void run() { callback.onCompleted(exception, param); } }); } }); }
Source:
private Guid getDisksStorageDomainId() { Disk disk = getVm().getDiskMap().values().iterator().next(); if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { return ((DiskImage) disk).getstorage_ids().get(0); } else { return Guid.Empty; } }

Target:
private Guid getDisksStorageDomainId() { for (Disk disk : getVm().getDiskMap().values()) { if (disk.getDiskStorageType() == DiskStorageType.IMAGE) { return ((DiskImage) disk).getstorage_ids().get(0); } } return Guid.Empty; }
Source:
private Object lookupAttribute(long deviceId, String attributeName, boolean lookupServer, boolean lookupConfig) { Object result = null; Device device = getById(deviceId); if (device != null) { result = device.getAttributes().get(attributeName); if (result == null && lookupGroupsAttribute) { long groupId = device.getGroupId(); while (groupId != 0) { Group group = Context.getGroupsManager().getById(groupId); if (group != null) { result = group.getAttributes().get(attributeName); if (result != null) { break; } groupId = group.getGroupId(); } else { groupId = 0; } } } if (result == null) { if (lookupConfig) { result = Context.getConfig().getString(attributeName); } else if (lookupServer) { Server server = Context.getPermissionsManager().getServer(); result = server.getAttributes().get(attributeName); } } } return result; }

Target:
private Object lookupAttribute(long deviceId, String attributeName, boolean lookupServer, boolean lookupConfig) { Object result = null; Device device = getById(deviceId); if (device != null) { result = device.getAttributes().get(attributeName); if (result == null && lookupGroupsAttribute) { long groupId = device.getGroupId(); while (groupId != 0) { Group group = Context.getGroupsManager().getById(groupId); if (group != null) { result = group.getAttributes().get(attributeName); if (result != null) { break; } groupId = group.getGroupId(); } else { groupId = 0; } } } if (result == null && lookupServer) { Server server = Context.getPermissionsManager().getServer(); result = server.getAttributes().get(attributeName); } if (result == null && lookupConfig) { result = Context.getConfig().getString(attributeName); } } return result; }
Source:
public String visitAndExpression(AndFilterExpression expression) { FilterExpression left = expression.getLeft(); FilterExpression right = expression.getRight(); boolean skipLeft = cannotEvaluate(left); boolean skipRight = cannotEvaluate(right); if (skipLeft && skipRight) { throw new IllegalStateException(TWO_NON_FILTERING_EXPRESSIONS); } else if (skipLeft) { return right.accept(this); } else if (skipRight) { return left.accept(this); } return "(" + left.accept(this) + " AND " + right.accept(this) + ")"; }

Target:
public String visitAndExpression(AndFilterExpression expression) { FilterExpression left = expression.getLeft(); FilterExpression right = expression.getRight(); return "(" + left.accept(this) + " AND " + right.accept(this) + ")"; }
Source:
public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 1 && element instanceof CounterTreeViewerEntry && fCheckboxTree.getChecked(element)) { int imageWidth = getTreeViewer().getTree().getColumn(columnIndex).getWidth(); int imageHeight = getTreeViewer().getTree().getItemHeight(); Image image = new Image(Display.getDefault(), imageWidth, imageHeight); GC gc = new GC(image); gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); gc.fillRectangle(0, 0, imageWidth, imageHeight); String seriesName = ((CounterTreeViewerEntry) element).getFullPath(); IYAppearance appearance = fCounterChartViewer.getAppearance(Objects.requireNonNull(seriesName)); RGBColor rgb = appearance.getColor(); Color lineColor = new Color(Display.getDefault(), rgb.getRed(), rgb.getGreen(), rgb.getBlue()); gc.setForeground(lineColor); gc.setLineWidth(LINE_WIDTH); gc.setLineStyle(LineStyle.valueOf(appearance.getStyle()).ordinal()); gc.drawLine(0, imageHeight / 2, imageWidth, imageHeight / 2); gc.dispose(); lineColor.dispose(); return image; } return null; }

Target:
public Image getColumnImage(Object element, int columnIndex) { if (columnIndex == 1 && element instanceof CounterTreeViewerEntry && fCheckboxTree.getChecked(element)) { int imageWidth = getTreeViewer().getTree().getColumn(columnIndex).getWidth(); int imageHeight = getTreeViewer().getTree().getItemHeight(); Image image = new Image(Display.getDefault(), imageWidth, imageHeight); GC gc = new GC(image); gc.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND)); gc.fillRectangle(0, 0, imageWidth, imageHeight); String seriesName = ((CounterTreeViewerEntry) element).getFullPath(); IYAppearance appearance = fCounterChartViewer.getAppearance(Objects.requireNonNull(seriesName)); RGBColor rgb = appearance.getColor(); Color lineColor = new Color(Display.getDefault(), rgb.getRed(), rgb.getGreen(), rgb.getBlue()); gc.setForeground(lineColor); gc.setLineWidth(appearance.getWidth()); gc.setLineStyle(LineStyle.valueOf(appearance.getStyle()).ordinal()); gc.drawLine(0, imageHeight / 2, imageWidth, imageHeight / 2); gc.dispose(); lineColor.dispose(); return image; } return null; }
Source:
private static final void addConnectorOptions(ConfigDef config) { int orderInGroup = 0; config.define( TABLE_TYPE_CONFIG, Type.LIST, TABLE_TYPE_DEFAULT, Importance.LOW, TABLE_TYPE_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, TABLE_TYPE_DISPLAY ).define( POLL_INTERVAL_MS_CONFIG, Type.INT, POLL_INTERVAL_MS_DEFAULT, Importance.HIGH, POLL_INTERVAL_MS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.SHORT, POLL_INTERVAL_MS_DISPLAY ).define( BATCH_MAX_ROWS_CONFIG, Type.INT, BATCH_MAX_ROWS_DEFAULT, Importance.LOW, BATCH_MAX_ROWS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.SHORT, BATCH_MAX_ROWS_DISPLAY ).define( TABLE_POLL_INTERVAL_MS_CONFIG, Type.LONG, TABLE_POLL_INTERVAL_MS_DEFAULT, Importance.LOW, TABLE_POLL_INTERVAL_MS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.SHORT, TABLE_POLL_INTERVAL_MS_DISPLAY ).define( TOPIC_PREFIX_CONFIG, Type.STRING, Importance.HIGH, TOPIC_PREFIX_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, TOPIC_PREFIX_DISPLAY ).define( TIMESTAMP_DELAY_INTERVAL_MS_CONFIG, Type.LONG, TIMESTAMP_DELAY_INTERVAL_MS_DEFAULT, Importance.HIGH, TIMESTAMP_DELAY_INTERVAL_MS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, TIMESTAMP_DELAY_INTERVAL_MS_DISPLAY ).define( DB_TIMEZONE_CONFIG, Type.STRING, DB_TIMEZONE_DEFAULT, Importance.HIGH, DB_TIMEZONE_CONFIG_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, DB_TIMEZONE_CONFIG_DISPLAY); }

Target:
private static final void addConnectorOptions(ConfigDef config) { int orderInGroup = 0; config.define( TABLE_TYPE_CONFIG, Type.LIST, TABLE_TYPE_DEFAULT, Importance.LOW, TABLE_TYPE_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, TABLE_TYPE_DISPLAY ).define( POLL_INTERVAL_MS_CONFIG, Type.INT, POLL_INTERVAL_MS_DEFAULT, Importance.HIGH, POLL_INTERVAL_MS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.SHORT, POLL_INTERVAL_MS_DISPLAY ).define( BATCH_MAX_ROWS_CONFIG, Type.INT, BATCH_MAX_ROWS_DEFAULT, Importance.LOW, BATCH_MAX_ROWS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.SHORT, BATCH_MAX_ROWS_DISPLAY ).define( TABLE_POLL_INTERVAL_MS_CONFIG, Type.LONG, TABLE_POLL_INTERVAL_MS_DEFAULT, Importance.LOW, TABLE_POLL_INTERVAL_MS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.SHORT, TABLE_POLL_INTERVAL_MS_DISPLAY ).define( TOPIC_PREFIX_CONFIG, Type.STRING, Importance.HIGH, TOPIC_PREFIX_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, TOPIC_PREFIX_DISPLAY ).define( TIMESTAMP_DELAY_INTERVAL_MS_CONFIG, Type.LONG, TIMESTAMP_DELAY_INTERVAL_MS_DEFAULT, Importance.HIGH, TIMESTAMP_DELAY_INTERVAL_MS_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, TIMESTAMP_DELAY_INTERVAL_MS_DISPLAY ).define( DB_TIMEZONE_CONFIG, Type.STRING, DB_TIMEZONE_DEFAULT, TimeZoneValidator.INSTANCE, Importance.MEDIUM, DB_TIMEZONE_CONFIG_DOC, CONNECTOR_GROUP, ++orderInGroup, Width.MEDIUM, DB_TIMEZONE_CONFIG_DISPLAY); }
Source:
public List<Type> getTypes() { return (List<Type>) localExchangeFactory.getTypes(); }

Target:
public List<Type> getTypes() { return localExchangeFactory.getTypes(); }
Source:
public Object visitEntrySetCommand(InvocationContext ctx, EntrySetCommand command) throws Throwable { Object entrySet = super.visitEntrySetCommand(ctx, command); if (enabled && !shouldSkipCacheLoader(command)) { final ConcurrentHashSet<InternalCacheEntry> union = new ConcurrentHashSet<InternalCacheEntry>(); final ConcurrentHashSet<Object> processedKeys = new ConcurrentHashSet<Object>(); for (InternalCacheEntry ice : (Set<InternalCacheEntry>)entrySet) processedKeys.add(ice.getKey()); persistenceManager.processOnAllStores(new CollectionKeyFilter(processedKeys), new AdvancedCacheLoader.CacheLoaderTask() { @Override public void processEntry(MarshalledEntry marshalledEntry, AdvancedCacheLoader.TaskContext taskContext) throws InterruptedException { processedKeys.add(marshalledEntry.getKey()); union.add(iceFactory.create(marshalledEntry.getKey(), marshalledEntry.getValue(), marshalledEntry.getMetadata())); } }, true, true); union.addAll((Set<InternalCacheEntry>)entrySet); return Collections.unmodifiableSet(union); } return entrySet; }

Target:
public Object visitEntrySetCommand(InvocationContext ctx, EntrySetCommand command) throws Throwable { Object entrySet = super.visitEntrySetCommand(ctx, command); if (enabled && !shouldSkipCacheLoader(command)) { final ConcurrentHashSet<InternalCacheEntry> union = new ConcurrentHashSet<InternalCacheEntry>(); final ConcurrentHashSet<Object> processedKeys = new ConcurrentHashSet<Object>(); for (InternalCacheEntry ice : (Set<InternalCacheEntry>)entrySet) processedKeys.add(ice.getKey()); persistenceManager.processOnAllStores(new CollectionKeyFilter(processedKeys), new AdvancedCacheLoader.CacheLoaderTask() { @Override public void processEntry(MarshalledEntry marshalledEntry, AdvancedCacheLoader.TaskContext taskContext) throws InterruptedException { union.add(iceFactory.create(marshalledEntry.getKey(), marshalledEntry.getValue(), marshalledEntry.getMetadata())); } }, true, true); for (InternalCacheEntry ice : (Set<InternalCacheEntry>) entrySet) union.add(ice); return Collections.unmodifiableSet(union); } return entrySet; }
Source:
static UriSource from(final URI uri) { Preconditions.notNull(uri, "uri must not be null"); try { URI pathBasedUri = uri; String query = pathBasedUri.getQuery(); if (StringUtils.isNotBlank(query)) { String s = pathBasedUri.toString(); pathBasedUri = URI.create(s.substring(0, s.indexOf('?'))); } Path path = Paths.get(pathBasedUri); if (Files.isRegularFile(path)) { return FileSource.from(path.toFile(), FilePosition.fromQuery(query).orElse(null)); } if (Files.isDirectory(path)) { return DirectorySource.from(path.toFile()); } } catch (IllegalArgumentException e) { LoggerFactory.getLogger(UriSource.class).debug(e, () -> "uri not path-based: " + uri); } return new DefaultUriSource(uri); }

Target:
static UriSource from(final URI uri) { Preconditions.notNull(uri, "URI must not be null"); try { URI pathBasedUriWithoutQuery = uri; String query = uri.getQuery(); if (StringUtils.isNotBlank(query)) { String uriAsString = uri.toString(); pathBasedUriWithoutQuery = URI.create(uriAsString.substring(0, uriAsString.indexOf('?'))); } Path path = Paths.get(pathBasedUriWithoutQuery); if (Files.isRegularFile(path)) { return FileSource.from(path.toFile(), FilePosition.fromQuery(query).orElse(null)); } if (Files.isDirectory(path)) { return DirectorySource.from(path.toFile()); } } catch (RuntimeException e) { LoggerFactory.getLogger(UriSource.class).debug(e, () -> String.format( "The supplied URI [%s] is not path-based. Falling back to default UriSource implementation.", uri)); } return new DefaultUriSource(uri); }
Source:
private IntervalFunction validateWaitIntervalFunctionInOpenState() { if (waitIntervalFunctionInOpenStateAlreadySet) { throw new IllegalStateException("You have already the durationInOpenState value from the waitDurationInOpenState method." + "Please don't use waitIntervalFunctionInOpenState with waitDurationInOpenState"); } return waitIntervalFunctionInOpenState; }

Target:
private IntervalFunction validateWaitIntervalFunctionInOpenState() { if (createWaitIntervalFunctionCounter > 1) { throw new IllegalStateException("The waitIntervalFunction was configured multiple times " + "which could result in an undesired state. Please verify that waitIntervalFunctionInOpenState " + "and waitDurationInOpenState are not used together."); } return waitIntervalFunctionInOpenState; }
Source:
public static List<Map<Integer,TieredBlock>> getConsumableInArrearTieredBlocks(final Usage usage, final String unitType) { Preconditions.checkArgument(usage.getBillingMode() == BillingMode.IN_ARREAR && usage.getUsageType() == UsageType.CONSUMABLE); Preconditions.checkArgument(usage.getTiers().length > 0); final List<Map<Integer,TieredBlock>> result = Lists.newLinkedList(); int tierNum = 0; for (Tier tier : usage.getTiers()) { tierNum++; for (TieredBlock tierBlock : tier.getTieredBlocks()) { if (tierBlock.getUnit().getName().equals(unitType)) { Map<Integer, TieredBlock> tieredBlockWithTierNum = new HashMap<>(); tieredBlockWithTierNum.put(tierNum, tierBlock); result.add(tieredBlockWithTierNum); } } } return result; }

Target:
public static List<TieredBlock> getConsumableInArrearTieredBlocks(final Usage usage, final String unitType) { Preconditions.checkArgument(usage.getBillingMode() == BillingMode.IN_ARREAR && usage.getUsageType() == UsageType.CONSUMABLE); Preconditions.checkArgument(usage.getTiers().length > 0); final List<TieredBlock> result = Lists.newLinkedList(); for (Tier tier : usage.getTiers()) { for (TieredBlock tierBlock : tier.getTieredBlocks()) { if (tierBlock.getUnit().getName().equals(unitType)) { result.add(tierBlock); } } } return result; }
Source:
public SSymbol getIdentifier() { if (identifier == null) { CompilerDirectives.transferToInterpreterAndInvalidate(); identifier = Symbols.symbolFor(mixinDef.getIdentifier()); } return identifier; }

Target:
public SSymbol getIdentifier() { return mixinDef.getIdentifier(); }
Source:
protected boolean chProfileMatchesHints(CHProfile p, HintsMap hintsMap) { Boolean edgeBased = getEdgeBased(hintsMap); Integer uTurnCosts = getUTurnCosts(hintsMap); return (edgeBased == null || p.isEdgeBased() == edgeBased) && (uTurnCosts == null || p.getWeighting().getTurnCostProvider().getName().equals(uTurnCosts.toString())) && (hintsMap.getWeighting().isEmpty() || p.getWeighting().getName().equals(hintsMap.getWeighting())) && (hintsMap.getVehicle().isEmpty() || p.getWeighting().getFlagEncoder().toString().equals(hintsMap.getVehicle())); }

Target:
protected boolean chProfileMatchesHints(CHProfile p, HintsMap hintsMap) { Boolean edgeBased = getEdgeBased(hintsMap); Integer uTurnCosts = getUTurnCosts(hintsMap); return (edgeBased == null || p.isEdgeBased() == edgeBased) && (uTurnCosts == null || p.isEdgeBased()) && (hintsMap.getWeighting().isEmpty() || p.getWeighting().getName().equals(hintsMap.getWeighting())) && (hintsMap.getVehicle().isEmpty() || p.getWeighting().getFlagEncoder().toString().equals(hintsMap.getVehicle())); }
Source:
public void testAll() throws Exception { testGetStudentForEmail(); testGetStudentForRegistrationKey(); testGetStudentsForGoogleId(); testGetStudentForCourseIdAndGoogleId(); testGetStudentsForCourse(); testGetEncryptedKeyForStudent(); testIsStudentInAnyCourse(); testIsStudentInCourse(); testIsStudentInTeam(); testIsStudentsInSameTeam(); testGetTeamForStudent(); testEnrollStudent(); testAdjustFeedbackResponseForEnrollments(); testValidateSections(); testupdateStudentCascade(); testEnrollLinesChecking(); testEnrollStudents(); testDeleteStudent(); }

Target:
public void testAll() throws Exception { testGetStudentForEmail(); testGetStudentForRegistrationKey(); testGetStudentsForGoogleId(); testGetStudentForCourseIdAndGoogleId(); testGetStudentsForCourse(); testGetEncryptedKeyForStudent(); testIsStudentInAnyCourse(); testIsStudentInCourse(); testIsStudentInTeam(); testIsStudentsInSameTeam(); testGetTeamForStudent(); testEnrollStudent(); testAdjustFeedbackResponseForEnrollments(); testValidateSections(); testUpdateStudentCascade(); testEnrollLinesChecking(); testEnrollStudents(); testDeleteStudent(); }
Source:
public SweepTaskRunner provideSweepTaskRunner(SerializableTransactionManager txm, @Named("kvs") KeyValueService kvs, TransactionService transactionService, SweepStrategyManager sweepStrategyManager, Follower follower) { LongSupplier unreadable = unreadableTs.isPresent() ? unreadableTs.get() : txm::getUnreadableTimestamp; LongSupplier immutable = immutableTs.isPresent() ? immutableTs.get() : txm::getImmutableTimestamp; return new SweepTaskRunner( kvs, unreadable, immutable, transactionService, sweepStrategyManager, new CellsSweeper(txm, kvs, ImmutableList.of(follower))); }

Target:
public SweepTaskRunner provideSweepTaskRunner(SerializableTransactionManager txm, @Named("kvs") KeyValueService kvs, TransactionService transactionService, SweepStrategyManager sweepStrategyManager, Follower follower) { LongSupplier unreadable = unreadableTs.or(txm::getUnreadableTimestamp); LongSupplier immutable = immutableTs.or(txm::getImmutableTimestamp); return new SweepTaskRunner( kvs, unreadable, immutable, transactionService, sweepStrategyManager, new CellsSweeper(txm, kvs, ImmutableList.of(follower))); }
Source:
public VdcBllMessages providerNetworkUsedValidationMessage(int numberOfNetworks) { boolean singular = numberOfNetworks == 1; return singular ? VdcBllMessages.ACTION_TYPE_FAILED_PROVIDER_NETWORKS_USED_ONCE : VdcBllMessages.ACTION_TYPE_FAILED_PROVIDER_NETWORKS_USED_MULTIPLE_TIMES; }

Target:
protected VdcBllMessages providerNetworkUsedValidationMessage(int numberOfNetworks) { boolean singular = numberOfNetworks == 1; if (singular) { return VdcBllMessages.ACTION_TYPE_FAILED_PROVIDER_NETWORKS_USED_ONCE; } else { return VdcBllMessages.ACTION_TYPE_FAILED_PROVIDER_NETWORKS_USED_MULTIPLE_TIMES; } }
Source:
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { base.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState); }

Target:
@Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { base.onViewCreated(new ViewCreated(view, savedInstanceState)); super.onViewCreated(view, savedInstanceState); }
Source:
public void testNaming() { Random random = new Random(); String baseName = getString(random); MultipleInputTransformation<Long> transformation = new MultipleInputTransformation<>(baseName, unsupportedOperatorFactory(), TypeInformation.of(Long.class), 1); for (int i = 0; i < 10; i++) { transformation.addInput(new SourceTransformation<>(getString(random), new NumberSequenceSource(0, 1), WatermarkStrategy.noWatermarks(), TypeInformation.of(Long.class), 1)); } assertTrue(transformation.getName().contains(baseName)); transformation.getInputs().forEach(input -> assertTrue(transformation.getName().contains(input.getName()))); System.out.println(transformation.getName()); }

Target:
public void testNaming() { Random random = new Random(); MultipleInputTransformation<Long> transformation = new MultipleInputTransformation<>(getString(random), unsupportedOperatorFactory(), TypeInformation.of(Long.class), 1); for (int i = 0; i < 10; i++) { transformation.addInput(new SourceTransformation<>(getString(random), new NumberSequenceSource(0, 1), WatermarkStrategy.noWatermarks(), TypeInformation.of(Long.class), 1)); } transformation.getInputs().forEach(input -> assertTrue(transformation.getName().contains(input.getName()))); }
Source:
private void populateExchangeWithBreadcrumbFromMessageContext(MessageContext messageContext, Exchange exchange) { SaajSoapMessage saajSoap = (SaajSoapMessage) messageContext.getRequest(); SOAPMessage soapMesssageRequest = null; if (saajSoap != null) { soapMesssageRequest = saajSoap.getSaajMessage(); if (soapMesssageRequest != null) { MimeHeaders mimeHeaders = soapMesssageRequest.getMimeHeaders(); if (mimeHeaders != null) { String[] breadcrumbIdHeaderValues = mimeHeaders.getHeader(Exchange.BREADCRUMB_ID); if (breadcrumbIdHeaderValues != null && breadcrumbIdHeaderValues.length >= 1) { exchange.getIn().setHeader(Exchange.BREADCRUMB_ID, breadcrumbIdHeaderValues[0]); } } } } }

Target:
private void populateExchangeWithBreadcrumbFromMessageContext(MessageContext messageContext, Exchange exchange) { SaajSoapMessage saajSoap = (SaajSoapMessage) messageContext.getRequest(); SOAPMessage soapMessageRequest = null; if (saajSoap != null) { soapMessageRequest = saajSoap.getSaajMessage(); if (soapMessageRequest != null) { MimeHeaders mimeHeaders = soapMessageRequest.getMimeHeaders(); if (mimeHeaders != null) { String[] breadcrumbIdHeaderValues = mimeHeaders.getHeader(Exchange.BREADCRUMB_ID); if (breadcrumbIdHeaderValues != null && breadcrumbIdHeaderValues.length >= 1) { exchange.getIn().setHeader(Exchange.BREADCRUMB_ID, breadcrumbIdHeaderValues[0]); } } } } }
Source:
public void testExplicitCloseFrameSentWhenClientChannelClosed() throws Exception { WebSocketCloseStatus closeStatus = WebSocketCloseStatus.INVALID_PAYLOAD_DATA; EmbeddedChannel client = createClient(); EmbeddedChannel server = createServer(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.writeInbound(server.readOutbound())); client.writeOutbound(new CloseWebSocketFrame(closeStatus)); client.close(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.isOpen()); assertFalse(server.isOpen()); CloseWebSocketFrame closeMessage = decode(server.<ByteBuf>readOutbound(), CloseWebSocketFrame.class); assertEquals(closeMessage.statusCode(), closeStatus.code()); closeMessage.release(); assertFalse(client.finishAndReleaseAll()); assertFalse(server.finishAndReleaseAll()); }

Target:
public void testExplicitCloseFrameSentWhenClientChannelClosed() throws Exception { WebSocketCloseStatus closeStatus = WebSocketCloseStatus.INVALID_PAYLOAD_DATA; EmbeddedChannel client = createClient(); EmbeddedChannel server = createServer(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.writeInbound(server.readOutbound())); assertTrue(client.writeOutbound(new CloseWebSocketFrame(closeStatus))); client.close(); assertFalse(server.writeInbound(client.readOutbound())); assertFalse(client.isOpen()); assertFalse(server.isOpen()); CloseWebSocketFrame closeMessage = decode(server.<ByteBuf>readOutbound(), CloseWebSocketFrame.class); assertEquals(closeMessage.statusCode(), closeStatus.code()); closeMessage.release(); assertFalse(client.finishAndReleaseAll()); assertFalse(server.finishAndReleaseAll()); }
Source:
public static boolean isAvailable(PathFragment binary) { Subprocess process; try { process = new SubprocessBuilder() .setArgv(binary.getPathString(), "-h") .setStdout(StreamAction.STREAM) .redirectErrorStream(true) .setWorkingDirectory(new File(".")) .start(); } catch (IOException e) { log.warning("Windows sandbox binary at " + binary + " seems to be missing; got error " + e); return false; } ByteArrayOutputStream outErrBytes = new ByteArrayOutputStream(); try { ByteStreams.copy(process.getInputStream(), outErrBytes); } catch (IOException e) { try { outErrBytes.write(("Failed to read stdout: " + e).getBytes()); } catch (IOException e2) { } } String outErr = outErrBytes.toString().replaceFirst("\n$", ""); int exitCode = waitForProcess(process); if (exitCode == 0) { return true; } else { log.warning( "Windows sandbox binary at " + binary + " returned non-zero exit code " + exitCode + " and output " + outErr); return false; } }

Target:
public static boolean isAvailable(PathFragment binary) { Subprocess process; try { process = new SubprocessBuilder() .setArgv(binary.getPathString(), "-h") .setStdout(StreamAction.STREAM) .redirectErrorStream(true) .setWorkingDirectory(new File(".")) .start(); } catch (IOException e) { log.warning("Windows sandbox binary at " + binary + " seems to be missing; got error: " + e); return false; } ByteArrayOutputStream outErrBytes = new ByteArrayOutputStream(); try { ByteStreams.copy(process.getInputStream(), outErrBytes); } catch (IOException e) { try { outErrBytes.write(("Failed to read stdout: " + e).getBytes("UTF-8")); } catch (IOException e2) { } } String outErr = outErrBytes.toString().replaceFirst("\n$", ""); int exitCode = SandboxHelpers.waitForProcess(process); if (exitCode == 0) { return true; } else { log.warning( "Windows sandbox binary at " + binary + " returned non-zero exit code " + exitCode + " and output " + outErr); return false; } }
Source:
private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { waitForData(); } if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { statusPrinter.printFinalInfo(); } if (client.isClientAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isClientError()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); renderWarnings(errorChannel); if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }

Target:
private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, boolean interactive) { StatusPrinter statusPrinter = null; @SuppressWarnings("resource") PrintStream errorChannel = interactive ? out : System.err; WarningsPrinter warningsPrinter = new PrintStreamWarningsPrinter(System.err); if (interactive) { statusPrinter = new StatusPrinter(client, out, debug); statusPrinter.printInitialStatusUpdates(); } else { processInitialStatusUpdates(warningsPrinter); } if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) { QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo(); if (results.getUpdateType() != null) { renderUpdate(errorChannel, results); } else if (results.getColumns() == null) { errorChannel.printf("Query %s has no columns\n", results.getId()); return false; } else { renderResults(out, outputFormat, interactive, results.getColumns()); } } checkState(!client.isRunning()); if (statusPrinter != null) { new PrintStreamWarningsPrinter(System.err).print(client.finalStatusInfo().getWarnings(), true, true); statusPrinter.printFinalInfo(); } else { warningsPrinter.print(client.finalStatusInfo().getWarnings(), true, true); } if (client.isClientAborted()) { errorChannel.println("Query aborted by user"); return false; } if (client.isClientError()) { errorChannel.println("Query is gone (server restarted?)"); return false; } verify(client.isFinished()); if (client.finalStatusInfo().getError() != null) { renderFailure(errorChannel); return false; } return true; }
Source:
public Object writeReplace(final Object original) { if (original instanceof URIAffinity) { return Affinity.NONE; } else if (original == Affinity.LOCAL) { return new NodeAffinity(connection.getRemoteEndpointName()); } else if (original instanceof AbstractEJBMetaData) { return new EJBMetaDataImpl((AbstractEJBMetaData<?, ?>) original); } else if (original instanceof RemoteExceptionCause) { return ((RemoteExceptionCause) original).toPlainThrowable(); } return original; }

Target:
public Object writeReplace(final Object original) { if (original instanceof URIAffinity) { return Affinity.NONE; } else if (original == Affinity.LOCAL) { return thisNodeAffinity; } else if (original instanceof AbstractEJBMetaData) { return new EJBMetaDataImpl((AbstractEJBMetaData<?, ?>) original); } else if (original instanceof RemoteExceptionCause) { return ((RemoteExceptionCause) original).toPlainThrowable(); } return original; }
Source:
private void partitionDimensionList( QueryableIndex index, StorageAdapter storageAdapter, List<DimensionSpec> dimensions, List<DimensionSpec> bitmapDims, List<DimensionSpec> nonBitmapDims ) { List<DimensionSpec> dimsToSearch; if (dimensions == null || dimensions.isEmpty()) { dimsToSearch = Lists.newArrayList(Iterables.transform( storageAdapter.getAvailableDimensions(), Druids.DIMENSION_IDENTITY )); } else { dimsToSearch = dimensions; } if (index != null) { for (DimensionSpec spec : dimsToSearch) { if (spec.getDimension().equals(Column.TIME_COLUMN_NAME)) { bitmapDims.add(spec); continue; } ColumnCapabilities capabilities = storageAdapter.getColumnCapabilities(spec.getDimension()); if (capabilities == null) { continue; } if (capabilities.hasBitmapIndexes()) { bitmapDims.add(spec); } else { nonBitmapDims.add(spec); } } } else { nonBitmapDims.addAll(dimsToSearch); } }

Target:
private void partitionDimensionList( QueryableIndex index, StorageAdapter storageAdapter, List<DimensionSpec> dimensions, List<DimensionSpec> bitmapDims, List<DimensionSpec> nonBitmapDims ) { List<DimensionSpec> dimsToSearch; if (dimensions == null || dimensions.isEmpty()) { dimsToSearch = Lists.newArrayList(Iterables.transform( storageAdapter.getAvailableDimensions(), Druids.DIMENSION_IDENTITY )); } else { dimsToSearch = dimensions; } if (index != null) { for (DimensionSpec spec : dimsToSearch) { ColumnCapabilities capabilities = storageAdapter.getColumnCapabilities(spec.getDimension()); if (capabilities == null) { continue; } if (capabilities.hasBitmapIndexes()) { bitmapDims.add(spec); } else { nonBitmapDims.add(spec); } } } else { nonBitmapDims.addAll(dimsToSearch); } }
Source:
protected void onResume() { Timber.d("onResume()"); super.onResume(); mActivityPaused = false; if (mSyncOnResume) { Timber.i("Performing Sync on Resume"); sync(); mSyncOnResume = false; } else if (colIsOpen()) { selectNavigationItem(R.id.nav_decks); updateDeckList(); setTitle(getResources().getString(R.string.app_name)); } getCol().loadAfterGUIInBackground(); }

Target:
protected void onResume() { Timber.d("onResume()"); super.onResume(); mActivityPaused = false; if (mSyncOnResume) { Timber.i("Performing Sync on Resume"); sync(); mSyncOnResume = false; } else if (colIsOpen()) { selectNavigationItem(R.id.nav_decks); updateDeckList(); setTitle(getResources().getString(R.string.app_name)); } CollectionTask.launchCollectionTask(CollectionTask.TASK_TYPE_LOAD_LAZY_COLLECTION); }
Source:
private ArrayList<ArrayList> loadFromEf(int efType) { ArrayList<ArrayList> results = new ArrayList<ArrayList>(); List<AdnRecord> adnRecords = null; if (DBG) log("loadFromEf: efType=" + efType); try { IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface( ServiceManager.getService("simphonebook")); if (iccIpb != null) { adnRecords = iccIpb.getAdnRecordsInEf(efType); } } catch (RemoteException ex) { } catch (SecurityException ex) { if (DBG) log(ex.toString()); } if (adnRecords != null) { int N = adnRecords.size(); if (DBG) log("adnRecords.size=" + N); List<AdnRecord> newAdn = new ArrayList<AdnRecord>(); for (int i = 0; i < N; i++) { AdnRecord record = adnRecords.get(i); if (!record.isEmpty()) { newAdn.add(record); } } Collections.sort(newAdn, mAdnComparator); if (DBG) log("loadFromEf: results =" + newAdn); N = newAdn.size(); for (int i = 0; i < N; i++) { loadRecord((AdnRecord) newAdn.get(i), results); } } else { Log.w(TAG, "Cannot load ADN records"); results.clear(); } if (DBG) log("loadFromEf: return results"); return results; }

Target:
private ArrayList<ArrayList> loadFromEf(int efType) { ArrayList<ArrayList> results = new ArrayList<ArrayList>(); List<AdnRecord> adnRecords = null; AdnComparator adnComparator = new AdnComparator(); if (DBG) log("loadFromEf: efType=" + efType); try { IIccPhoneBook iccIpb = IIccPhoneBook.Stub.asInterface( ServiceManager.getService("simphonebook")); if (iccIpb != null) { adnRecords = iccIpb.getAdnRecordsInEf(efType); } } catch (RemoteException ex) { } catch (SecurityException ex) { if (DBG) log(ex.toString()); } if (adnRecords != null) { int N = adnRecords.size(); if (DBG) log("adnRecords.size=" + N); List<AdnRecord> newAdn = new ArrayList<AdnRecord>(); for (int i = 0; i < N; i++) { AdnRecord record = adnRecords.get(i); if (!record.isEmpty()) { newAdn.add(record); } } Collections.sort(newAdn, adnComparator); if (DBG) log("loadFromEf: results =" + newAdn); N = newAdn.size(); for (int i = 0; i < N; i++) { loadRecord((AdnRecord) newAdn.get(i), results); } } else { Log.w(TAG, "Cannot load ADN records"); results.clear(); } if (DBG) log("loadFromEf: return results"); return results; }
Source:
public void testSimple() throws SQLException { PostgreSQLContainer postgres = new PostgreSQLContainer(); postgres.start(); try { ResultSet resultSet = performQuery(postgres,"SELECT 1"); int resultSetInt = resultSet.getInt(1); assertEquals("A basic SELECT query succeeds", 1, resultSetInt); } finally { postgres.stop(); } }

Target:
public void testSimple() throws SQLException { try (PostgreSQLContainer postgres = new PostgreSQLContainer<>()) { postgres.start(); ResultSet resultSet = performQuery(postgres, "SELECT 1"); int resultSetInt = resultSet.getInt(1); assertEquals("A basic SELECT query succeeds", 1, resultSetInt); } }
Source:
private Builder createMetaBuilder(MessageTemplate config) { Integer ttl = config == null ? null : config.getTtl(); return new MetaMessage.Builder(ttl, clock.instant(), this.serviceDetails, clock); }

Target:
private Builder createMetaBuilder(MessageTemplate config) { Integer ttl = (config == null) ? null : config.getTtl(); return new MetaMessage.Builder(ttl, clock.instant(), this.serviceDetails, clock); }
Source:
public boolean isPluginLoaded(String pluginId) { for (GoPluginExtension extension : extensions) { if (extension.canHandlePlugin(pluginId)) { return true; } } return false; }

Target:
public boolean isPluginLoaded(String pluginId) { return pluginManager.isPluginLoaded(pluginId); }
Source:
public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); UnionInputStream union = new UnionInputStream( lo.openStream(), new ByteArrayInputStream(sep), lt.openStream()); ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); union.close(); return new Note(ours, noteData); }

Target:
public Note merge(Note base, Note ours, Note theirs, ObjectReader reader, ObjectInserter inserter) throws IOException { if (ours == null) { return theirs; } if (theirs == null) { return ours; } if (ours.getData().equals(theirs.getData())) { return ours; } ObjectLoader lo = reader.open(ours.getData()); byte[] sep = new byte[] {'\n'}; ObjectLoader lt = reader.open(theirs.getData()); try (UnionInputStream union = new UnionInputStream( lo.openStream(), new ByteArrayInputStream(sep), lt.openStream())) { ObjectId noteData = inserter.insert(Constants.OBJ_BLOB, lo.getSize() + sep.length + lt.getSize(), union); return new Note(ours, noteData); } }
Source:
public void onPartitionsRevoked(final Collection<TopicPartition> partitions) { log.debug("Current state {}: revoked partitions because of consumer rebalance.\n" + "\tcurrently assigned active tasks: {}\n" + "\tcurrently assigned standby tasks: {}\n", streamThread.state(), partitions, taskManager.activeTaskIds(), taskManager.standbyTaskIds()); if (streamThread.setState(State.PARTITIONS_REVOKED) != null && !partitions.isEmpty()) { final long start = time.milliseconds(); try { taskManager.handleRevocation(partitions); } catch (final Throwable t) { throw new TaskMigratedException("Error caught during partitions revocation", t); } finally { log.info("partition revocation took ms.", time.milliseconds() - start); } } }

Target:
public void onPartitionsRevoked(final Collection<TopicPartition> partitions) { log.debug("Current state {}: revoked partitions because of consumer rebalance.\n" + "\tcurrently assigned active tasks: {}\n" + "\tcurrently assigned standby tasks: {}\n", streamThread.state(), partitions, taskManager.activeTaskIds(), taskManager.standbyTaskIds()); if (streamThread.setState(State.PARTITIONS_REVOKED) != null && !partitions.isEmpty()) { final long start = time.milliseconds(); try { taskManager.handleRevocation(partitions); } finally { log.info("partition revocation took ms.", time.milliseconds() - start); } } }
Source:
public static void assertException(Class<? extends Throwable> exceptionClass, String messageRegex, Throwable t) { assertException(exceptionClass, t); Pattern pattern = Pattern.compile(messageRegex); if (!pattern.matcher(t.getMessage()).matches()) { t.printStackTrace(); fail("Wrong exception message: expected:<" + messageRegex + ">, actual:<" + t.getMessage() + ">"); } }

Target:
public static void assertException(Class<? extends Throwable> exceptionClass, String messageRegex, Throwable t) { assertException(exceptionClass, t); Pattern pattern = Pattern.compile(messageRegex); if (!pattern.matcher(t.getMessage()).matches()) { throw new AssertionError( "Wrong exception message: expected:<" + messageRegex + ">, actual:<" + t.getMessage() + ">", t); } }
Source:
public void test_fxml_construction_of_area() { Object obj = null; try { obj = FXMLLoader.load( getClass().getResource( "FxmlTest.fxml" ) ); } catch ( Exception EX ) { EX.printStackTrace(); } org.junit.Assert.assertNotNull( obj ); }

Target:
public void test_fxml_construction_of_area() throws IOException, LoadException { Object obj = FXMLLoader.load( getClass().getResource( "FxmlTest.fxml" ) ); org.junit.Assert.assertNotNull( obj ); }
Source:
public void doWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { if (createDatabase) influxDB.createDatabase(database); BatchPoints batchPoints = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, server.getSource()).consistency(writeConsistency).build(); for (Result result : results) { HashMap<String, Object> filteredValues = newHashMap(Maps.filterValues(result.getValues(), isNotNaN)); if (!filteredValues.isEmpty()) { Map<String, String> resultTagsToApply = buildResultTagMap(result); resultTagsToApply.put("_jmx_port", server.getPort()); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(filteredValues).build(); batchPoints.point(point); } } influxDB.write(batchPoints); }

Target:
public void doWrite(Server server, Query query, ImmutableList<Result> results) throws Exception { if (createDatabase) influxDB.createDatabase(database); BatchPoints batchPoints = BatchPoints.database(database).retentionPolicy(retentionPolicy) .tag(TAG_HOSTNAME, server.getSource()).consistency(writeConsistency).build(); for (Result result : results) { HashMap<String, Object> filteredValues = newHashMap(Maps.filterValues(result.getValues(), isNotNaN)); if (!filteredValues.isEmpty()) { filteredValues.put("_jmx_port", Integer.parseInt(server.getPort())); Map<String, String> resultTagsToApply = buildResultTagMap(result); Point point = Point.measurement(result.getKeyAlias()).time(result.getEpoch(), MILLISECONDS) .tag(resultTagsToApply).fields(filteredValues).build(); batchPoints.point(point); } } influxDB.write(batchPoints); }
Source:
public String getUploaderRetries() { return getString("secor.upload.retries", "5"); }

Target:
public String getUploaderRetries() { return getString("secor.upload.retries"); }