auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private boolean connectFileStorageServers(StorageType storageType, List<StorageServerConnections> connections) { Map<StorageDomainType, List<StorageServerConnections>> connByType = connections.stream() .collect(Collectors.groupingBy(c -> storageDomainDao.getAllByConnectionId(Guid.createGuidFromString( c.getId())).get(0) .getStorageDomainType())); boolean connectSucceeded = connectStorageServer(storageType, connByType.get(StorageDomainType.Data), true); try { connectStorageServer(storageType, connByType.get(StorageDomainType.ISO), false); connectStorageServer(storageType, connByType.get(StorageDomainType.ImportExport), false); } catch (EngineException e) { log.info("Ignoring failed connection to domain of type ISO/Import-Export.'"); } return connectSucceeded; }

Target:
private boolean connectFileStorageServers(StorageType storageType, List<StorageServerConnections> connections) { Map<StorageDomainType, List<StorageServerConnections>> connByType = connections.stream() .collect(Collectors.groupingBy(c -> storageDomainDao.getAllByConnectionId(Guid.createGuidFromString( c.getId())).get(0) .getStorageDomainType())); boolean connectSucceeded = connectStorageServer(storageType, connByType.get(StorageDomainType.Data), true); connectStorageServerIgnoreFailure(storageType, connByType.get(StorageDomainType.ISO), StorageDomainType.ISO); connectStorageServerIgnoreFailure(storageType, connByType.get(StorageDomainType.ImportExport), StorageDomainType.ImportExport); return connectSucceeded; }
Source:
public Registration update(Registration registration) { Identity identity = this.identity != null ? this.identity : registration.getIdentity(); Link[] linkObject = this.objectLinks != null ? this.objectLinks : registration.getObjectLinks(); long lifeTimeInSec = this.lifeTimeInSec != null ? this.lifeTimeInSec : registration.getLifeTimeInSec(); BindingMode bindingMode = this.bindingMode != null ? this.bindingMode : registration.getBindingMode(); String smsNumber = this.smsNumber != null ? this.smsNumber : registration.getSmsNumber(); Map<String, String> additionalAttributes = this.additionalAttributes != null ? updateAdditionalAttributes(registration.getAdditionalRegistrationAttributes()) : registration.getAdditionalRegistrationAttributes(); Date lastUpdate = new Date(); Registration.Builder builder = new Registration.Builder(registration.getId(), registration.getEndpoint(), identity, registration.getRegistrationEndpointAddress()); builder.lwM2mVersion(registration.getLwM2mVersion()).lifeTimeInSec(lifeTimeInSec).smsNumber(smsNumber) .bindingMode(bindingMode).objectLinks(linkObject).registrationDate(registration.getRegistrationDate()) .lastUpdate(lastUpdate).additionalRegistrationAttributes(additionalAttributes); return builder.build(); }

Target:
public Registration update(Registration registration) { Identity identity = this.identity != null ? this.identity : registration.getIdentity(); Link[] linkObject = this.objectLinks != null ? this.objectLinks : registration.getObjectLinks(); long lifeTimeInSec = this.lifeTimeInSec != null ? this.lifeTimeInSec : registration.getLifeTimeInSec(); BindingMode bindingMode = this.bindingMode != null ? this.bindingMode : registration.getBindingMode(); String smsNumber = this.smsNumber != null ? this.smsNumber : registration.getSmsNumber(); Map<String, String> additionalAttributes = this.additionalAttributes.isEmpty() ? registration.getAdditionalRegistrationAttributes() : updateAdditionalAttributes(registration.getAdditionalRegistrationAttributes()); Date lastUpdate = new Date(); Registration.Builder builder = new Registration.Builder(registration.getId(), registration.getEndpoint(), identity, registration.getRegistrationEndpointAddress()); builder.lwM2mVersion(registration.getLwM2mVersion()).lifeTimeInSec(lifeTimeInSec).smsNumber(smsNumber) .bindingMode(bindingMode).objectLinks(linkObject).registrationDate(registration.getRegistrationDate()) .lastUpdate(lastUpdate).additionalRegistrationAttributes(additionalAttributes); return builder.build(); }
Source:
public Set<RebalanceOperation> getRebalanceOperations() { synchronized (this.inProgressRebalanceOperationsLock) { return new HashSet<>(this.inProgressRebalanceOperations); } }

Target:
public Set<RebalanceOperation> getRebalanceOperations() { return Collections.unmodifiableSet(inProgressRebalanceOperations.keySet()); }
Source:
private void monitorProgress(Connection connection, Long rowId) throws SQLException { addMonitorShutdownHook(rowId); long rowCount = getTotalRowCount(connection, rowId); long initialRowCount, insertedRowsCount; initialRowCount = getInsertedRowsCount(connection, rowId); Long startedTimeMillis = null; insertedRowsCount = initialRowCount; while ( !isComplete ) { if ( insertedRowsCount < rowCount ) { if ( startedTimeMillis == null && insertedRowsCount > 0 ) { startedTimeMillis = System.currentTimeMillis(); } insertedRowsCount = getInsertedRowsCount(connection, rowId); } isComplete = getIsComplete(connection, rowId); displayProgress(rowCount, insertedRowsCount, initialRowCount, startedTimeMillis); try { Thread.sleep(UPDATE_PERIOD_MILLIS); } catch ( InterruptedException e) } displayLine(""); }

Target:
private void monitorProgress(Connection connection, Long rowId) throws SQLException, MissingBootstrapRowException { addMonitorShutdownHook(rowId); long rowCount = getTotalRowCount(connection, rowId); long initialRowCount, insertedRowsCount; initialRowCount = getInsertedRowsCount(connection, rowId); Long startedTimeMillis = null; insertedRowsCount = initialRowCount; while ( !isComplete ) { if ( insertedRowsCount < rowCount ) { if ( startedTimeMillis == null && insertedRowsCount > 0 ) { startedTimeMillis = System.currentTimeMillis(); } insertedRowsCount = getInsertedRowsCount(connection, rowId); } isComplete = getIsComplete(connection, rowId); displayProgress(rowCount, insertedRowsCount, initialRowCount, startedTimeMillis); try { Thread.sleep(UPDATE_PERIOD_MILLIS); } catch ( InterruptedException e) } displayLine(""); }
Source:
private void releaseYoutubePlayer(){ try { if (youTubePlayer != null){ youTubePlayer.release(); youTubePlayer = null; } } catch (IllegalStateException ex) { logger.error(ex); } }

Target:
private void releaseYoutubePlayer() { if (youTubePlayer != null) { youTubePlayer.release(); youTubePlayer = null; } }
Source:
public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof XBee64BitAddress)) return false; XBee64BitAddress addr = (XBee64BitAddress)obj; return Arrays.equals(addr.getValue(), getValue()); }

Target:
public boolean equals(Object obj) { if (!(obj instanceof XBee64BitAddress)) return false; XBee64BitAddress addr = (XBee64BitAddress)obj; return Arrays.equals(addr.getValue(), getValue()); }
Source:
public Stream<DocumentWriteOperation> splitWriteOperations(JsonParser input, String inputName) { if (input == null) { throw new IllegalArgumentException("Input cannot be null"); } if (getUriMaker() == null) { JSONSplitter.UriMakeImpl uriMaker = new UriMakeImpl(); setUriMaker(uriMaker); } getUriMaker().setInputName(inputName); if (getUriMaker().getInputName() == null) { ((JSONSplitter.UriMakeImpl) getUriMaker()).setExtension("json"); } JSONSplitter.DocumentWriteOperationSpliterator spliterator = new JSONSplitter.DocumentWriteOperationSpliterator<>(this, input); return StreamSupport.stream(spliterator, true); }

Target:
public Stream<DocumentWriteOperation> splitWriteOperations(JsonParser input, String inputName) { if (input == null) { throw new IllegalArgumentException("Input cannot be null"); } count = 0; this.inputName = inputName; JSONSplitter.DocumentWriteOperationSpliterator spliterator = new JSONSplitter.DocumentWriteOperationSpliterator<>(this, input); return StreamSupport.stream(spliterator, true); }
Source:
String format(int invocationIndex, Object... arguments) { String result = namePattern.replace("{index}", String.valueOf(invocationIndex)); if (result.contains("{arguments}")) { String replacement = IntStream.range(0, arguments.length) .mapToObj(index -> "{" + index + "}") .collect(joining(", ")); result = result.replace("{arguments}", replacement); } for (int i = 0; i < arguments.length; i++) { arguments[i] = StringUtils.nullSafeToString(arguments[i]); } try { return MessageFormat.format(result, arguments); } catch (IllegalArgumentException ex) { String message = "The naming pattern defined for the parameterized tests is invalid: " + ex.getMessage(); throw new JUnitException(message, ex); } }

Target:
String format(int invocationIndex, Object... arguments) { String result = namePattern.replace("{index}", String.valueOf(invocationIndex)); if (result.contains("{arguments}")) { String replacement = IntStream.range(0, arguments.length) .mapToObj(index -> "{" + index + "}") .collect(joining(", ")); result = result.replace("{arguments}", replacement); } Object[] humanReadableArguments = new String[arguments.length]; for (int i = 0; i < arguments.length; i++) { humanReadableArguments[i] = StringUtils.nullSafeToString(arguments[i]); } try { return MessageFormat.format(result, humanReadableArguments); } catch (IllegalArgumentException ex) { String message = "The naming pattern defined for the parameterized tests is invalid. " + "The nested exception contains more details."; throw new JUnitException(message, ex); } }
Source:
private void generateUpperRangeCheck(Versions ifVersions, Versions ifNotVersions, CodeBuffer buffer) { if (ifMember != null) { buffer.printf("if (version <= %d) {%n", containingVersions.highest()); buffer.incrementIndent(); ifMember.generate(ifVersions); buffer.decrementIndent(); if (ifNotMember != null) { buffer.printf("} else {%n"); buffer.incrementIndent(); ifNotMember.generate(ifNotVersions); buffer.decrementIndent(); buffer.printf("}%n"); } else { buffer.printf("}%n"); } } else if (ifNotMember != null) { buffer.printf("if (version > %d) {%n", containingVersions.highest()); buffer.incrementIndent(); ifNotMember.generate(ifNotVersions); buffer.decrementIndent(); buffer.printf("}%n"); } }

Target:
private void generateUpperRangeCheck(Versions ifVersions, Versions ifNotVersions, CodeBuffer buffer) { if (ifMember != null) { buffer.printf("if (version <= %d) {%n", containingVersions.highest()); buffer.incrementIndent(); ifMember.generate(ifVersions); buffer.decrementIndent(); if (ifNotMember != null) { buffer.printf("} else {%n"); buffer.incrementIndent(); ifNotMember.generate(ifNotVersions); buffer.decrementIndent(); } buffer.printf("}%n"); } else if (ifNotMember != null) { buffer.printf("if (version > %d) {%n", containingVersions.highest()); buffer.incrementIndent(); ifNotMember.generate(ifNotVersions); buffer.decrementIndent(); buffer.printf("}%n"); } }
Source:
public Holiday get(UniqueId uniqueId) { Holiday holiday = _calendarHolidays.get(ExternalId.of(uniqueId.getScheme(), uniqueId.getValue())); if (holiday == null) { throw new DataNotFoundException("Holiday with id " + uniqueId + " not found"); } return holiday; }

Target:
public Holiday get(UniqueId uniqueId) { Holiday holiday = _calendarHolidays.get(ExternalId.of(uniqueId.getScheme(), uniqueId.getValue())); if (holiday == null) { throw new DataNotFoundException("Calendar with id " + uniqueId + " not found"); } return holiday; }
Source:
public void run() { try { Resource resource = moduleResolver.resolve(groupId, artifactId, version, "exec", "jar"); JarFileArchive jarFileArchive = new JarFileArchive(resource.getFile()); ModuleJarLauncher jarLauncher = new ModuleJarLauncher(jarFileArchive); jarLauncher.launch(args); } catch (IOException e) { e.printStackTrace(); } }

Target:
public void run() { try { Resource resource = moduleResolver.resolve(coordinates.groupId, coordinates.artifactId, coordinates.extension, coordinates.classifier, coordinates.version); JarFileArchive jarFileArchive = new JarFileArchive(resource.getFile()); ModuleJarLauncher jarLauncher = new ModuleJarLauncher(jarFileArchive); jarLauncher.launch(args); } catch (IOException e) { e.printStackTrace(); } }
Source:
public void testStatsBeingAutomaticallyRefreshed() { ExecutorService executor = Executors.newFixedThreadPool(4); LoadingCache<GuidePostsKey, GuidePostsInfo> cache = CacheBuilder.newBuilder() .refreshAfterWrite(1000, TimeUnit.MILLISECONDS) .maximumWeight(QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE) .weigher(new Weigher<GuidePostsKey, GuidePostsInfo>() { @Override public int weigh(GuidePostsKey key, GuidePostsInfo info) { return info.getEstimatedSize(); } }) .removalListener(new GuidePostsCache.PhoenixStatsCacheRemovalListener()) .build(new PhoenixStatsCacheLoader(new TestStatsLoaderImpl(), executor)); GuidePostsKey guidePostsKey = new GuidePostsKey(new byte[4], new byte[4]); GuidePostsInfo guidePostsInfo = getStats(cache, guidePostsKey); assertTrue(guidePostsInfo.getMaxLength() == 1); sleep(3000); guidePostsInfo = getStats(cache, guidePostsKey); assertTrue(guidePostsInfo.getMaxLength() == 1); sleep(3000); guidePostsInfo = getStats(cache, guidePostsKey); assertTrue(guidePostsInfo.getMaxLength() == 2); }

Target:
public void testStatsBeingAutomaticallyRefreshed() { ExecutorService executor = Executors.newFixedThreadPool(4); CountDownLatch firstTimeRefreshedSignal = new CountDownLatch(1); CountDownLatch secondTimeRefreshedSignal = new CountDownLatch(2); Configuration config = HBaseFactoryProvider.getConfigurationFactory().getConfiguration(); LoadingCache<GuidePostsKey, GuidePostsInfo> cache = CacheBuilder.newBuilder() .refreshAfterWrite(100, TimeUnit.MILLISECONDS) .maximumWeight(QueryServicesOptions.DEFAULT_STATS_MAX_CACHE_SIZE) .weigher(new Weigher<GuidePostsKey, GuidePostsInfo>() { @Override public int weigh(GuidePostsKey key, GuidePostsInfo info) { return info.getEstimatedSize(); } }) .removalListener(new GuidePostsCache.PhoenixStatsCacheRemovalListener()) .build(new PhoenixStatsCacheLoader(new TestStatsLoaderImpl( firstTimeRefreshedSignal, secondTimeRefreshedSignal), config)); try { GuidePostsKey guidePostsKey = new GuidePostsKey(new byte[4], new byte[4]); GuidePostsInfo guidePostsInfo = getStats(cache, guidePostsKey); assertTrue(guidePostsInfo.getMaxLength() == 1); sleep(150); guidePostsInfo = getStats(cache, guidePostsKey); assertTrue(guidePostsInfo.getMaxLength() >= 1); firstTimeRefreshedSignal.await(); sleep(150); guidePostsInfo = getStats(cache, guidePostsKey); assertTrue(guidePostsInfo.getMaxLength() >= 2); secondTimeRefreshedSignal.await(); } catch (InterruptedException e) { assertFalse(true); } }
Source:
protected Composite getComposite(final Composite parent) { parent.setBackgroundMode(SWT.INHERIT_FORCE); final PGroup group = new PGroup(parent, SWT.SMOOTH); if (getVElement().getName() != null) { group.setText(getVElement().getName()); } group.addExpandListener(new ExpandListener() { @Override public void itemCollapsed(ExpandEvent e) { EMFFormsSWTLayoutUtil.adjustParentSize(group); getVElement().setCollapsed(true); } @Override public void itemExpanded(ExpandEvent e) { EMFFormsSWTLayoutUtil.adjustParentSize(group); getVElement().setCollapsed(false); } }); group.setExpanded(!getVElement().isCollapsed()); return group; }

Target:
protected Composite getComposite(final Composite parent) { parent.setBackgroundMode(SWT.INHERIT_FORCE); final PGroup group = new PGroup(parent, SWT.SMOOTH); if (getVElement().getLabel() != null) { group.setText(getVElement().getLabel()); } group.addExpandListener(new ExpandListener() { @Override public void itemCollapsed(ExpandEvent e) { EMFFormsSWTLayoutUtil.adjustParentSize(group); getVElement().setCollapsed(true); } @Override public void itemExpanded(ExpandEvent e) { EMFFormsSWTLayoutUtil.adjustParentSize(group); getVElement().setCollapsed(false); } }); group.setExpanded(!getVElement().isCollapsed()); return group; }
Source:
private void closeConnection() { try { stat.close(); conn.close(); } catch (SQLException e) { e.printStackTrace(); } }

Target:
private void closeConnection() { try { statement.close(); connection.close(); } catch (SQLException e) { e.printStackTrace(); } }
Source:
public Constraint getRequiredConstraint(Action.ActionEffect actionEffect, JmxAction action, JmxTarget target) { return isAuditOperation(action.composeAction()) ? AUDIT : NOT_AUDIT; }

Target:
public Constraint getRequiredConstraint(Action.ActionEffect actionEffect, JmxAction action, JmxTarget target) { return NOT_AUDIT; }
Source:
public void setUp() throws Exception { activityActivityTestRule.getActivity() .getSupportFragmentManager().beginTransaction(); context = getInstrumentation().getTargetContext(); }

Target:
public void setUp() throws Exception { context = getInstrumentation().getTargetContext(); }
Source:
public Record beforeAppend(Record record) { if (record.getData().length <= getThresholdSize()) { return record; } log.debug("Record: overflow value of size: {}", record.getKey(), record.getData().length); EnumSet<Record.Flag> flags = EnumSet.copyOf(record.getFlags()); flags.add(Record.Flag.INTERNAL1); storeValue(record.getKey(), record.getData()); return new Record(record.getKey(), null, record.getWatermark(), flags); }

Target:
public Record beforeAppend(Record record) { if (record.getData().length <= getThresholdSize()) { return record; } if (log.isDebugEnabled()) { log.debug(String.format("Record: %s overflow value of size: %d", record.getKey(), record.getData().length)); } EnumSet<Record.Flag> flags = EnumSet.copyOf(record.getFlags()); flags.add(Record.Flag.EXTERNAL_VALUE); storeValue(record.getKey(), record.getData()); return new Record(record.getKey(), null, record.getWatermark(), flags); }
Source:
public Capable canUpload() { Capable result = projectControl.canPushToAtLeastOneRef(); if (result != Capable.OK) { return result; } result = MagicBranch.checkMagicBranchRefs(repo, project); return Capable.OK; }

Target:
public Capable canUpload() { Capable result = projectControl.canPushToAtLeastOneRef(); if (result != Capable.OK) { return result; } return MagicBranch.checkMagicBranchRefs(repo, project); }
Source:
private Action getConfigureSymbolsAction() { if (fConfigureSymbolsAction != null) { return fConfigureSymbolsAction; } fConfigureSymbolsAction = new Action("get symbols") { @Override public void run() { SymbolProviderConfigDialog dialog = new SymbolProviderConfigDialog(getSite().getShell(), getProviderPages()); if (dialog.open() == IDialogConstants.OK_ID) { } } }; fConfigureSymbolsAction.setToolTipText("get symbols"); fConfigureSymbolsAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(SYMBOL_MAPPING_ICON_PATH)); fConfigureSymbolsAction.setEnabled(true); return fConfigureSymbolsAction; }

Target:
private Action getConfigureSymbolsAction() { if (fConfigureSymbolsAction != null) { return fConfigureSymbolsAction; } fConfigureSymbolsAction = new Action(Messages.FlameGraphView_ConfigureSymbolProvidersText) { @Override public void run() { SymbolProviderConfigDialog dialog = new SymbolProviderConfigDialog(getSite().getShell(), getProviderPages()); if (dialog.open() == IDialogConstants.OK_ID) { } } }; fConfigureSymbolsAction.setToolTipText(Messages.FlameGraphView_ConfigureSymbolProvidersTooltip); fConfigureSymbolsAction.setImageDescriptor(Activator.getDefault().getImageDescripterFromPath(SYMBOL_MAPPING_ICON_PATH)); fConfigureSymbolsAction.setEnabled(true); return fConfigureSymbolsAction; }
Source:
private byte[] getBytesFromStream(@NonNull InputStream in) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buff = new byte[MAX_CACHED_CONTENT_LENGTH]; try { int n; while ((n = in.read(buff)) > 0) { out.write(buff, 0, n); } buff = out.toByteArray(); } catch (IOException e) { final String msg = "Failed reading blob content stream: " + in; Log.w(DOMAIN, msg, e); throw new IllegalStateException(msg, e); } finally { try { out.close(); } catch (IOException ignore) { } } blobLength = cacheContent(buff); return buff; }

Target:
private byte[] getBytesFromStream(@NonNull InputStream in) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); byte[] buff = new byte[MAX_CACHED_CONTENT_LENGTH]; try { int n; while ((n = in.read(buff)) >= 0) { out.write(buff, 0, n); } buff = out.toByteArray(); } catch (IOException e) { final String msg = "Failed reading blob content stream: " + in; Log.w(DOMAIN, msg, e); throw new IllegalStateException(msg, e); } finally { try { out.close(); } catch (IOException ignore) { } } blobLength = cacheContent(buff); return buff; }
Source:
protected String getLaunchDebugCommand(JBossServer jbossServer) throws CoreException { String programArguments = getLaunchProgramArgs(); String vmArguments = getLaunchVMArgs(); String jar = getJar(jbossServer.getServer()); String debugPort = getDebugPort(); String debugArgs = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" + debugPort + " -Xdebug "; String command = "java " + debugArgs + vmArguments + " -jar " + jar + " " + IJBossRuntimeConstants.SPACE + programArguments + "&"; return command; }

Target:
protected String getLaunchDebugCommand(JBossServer jbossServer) throws CoreException { String programArguments = getLaunchProgramArgs(); String vmArguments = getLaunchVMArgs(); String jar = getJar(jbossServer.getServer()); String debugPort = getDebugPort(); String debugArgs = "-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=" + debugPort + " -Xdebug "; String command = "java " + debugArgs + vmArguments + " -jar " + jar + IJBossRuntimeConstants.SPACE + programArguments + "&"; return command; }
Source:
public void handleTask(Task task) throws InterruptedException { var time = task.getTime(); Thread.sleep(time); System.out.println("It takes " + time + " milliseconds to finish the task"); task.setFinished(); }

Target:
public void handleTask(Task task) throws InterruptedException { var time = task.getTime(); Thread.sleep(time); LOGGER.info("It takes " + time + " milliseconds to finish the task"); task.setFinished(); }
Source:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (!(item instanceof SwitchItem || item instanceof RollershutterItem || item instanceof NumberItem || item instanceof ContactItem || item instanceof StringItem)) { throw new BindingConfigParseException("item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "', this Item is not allowed - please check your *.items configuration" + ", only SwitchItem, RollershutterItem, NumberItem ContactItem and StringItem are allowed / supported for now"); } }

Target:
public void validateItemType(Item item, String bindingConfig) throws BindingConfigParseException { if (!(item instanceof SwitchItem || item instanceof RollershutterItem || item instanceof NumberItem || item instanceof ContactItem || item instanceof StringItem)) { throw new BindingConfigParseException( "item '" + item.getName() + "' is of type '" + item.getClass().getSimpleName() + "'. This Item is not allowed - please check your *.items configuration." + "Only SwitchItem, RollershutterItem, NumberItem ContactItem and StringItem are allowed."); } }
Source:
public Node visitDropCheckConstraint(SqlBaseParser.DropCheckConstraintContext context) { Table table = (Table) visit(context.alterTableDefinition()); StringLiteral ident = (StringLiteral) visit(context.ident()); return new DropCheckConstraint<>(table, ident.getValue()); }

Target:
public Node visitDropCheckConstraint(SqlBaseParser.DropCheckConstraintContext context) { Table<?> table = (Table<?>) visit(context.alterTableDefinition()); return new DropCheckConstraint<>(table, getIdentText(context.ident())); }
Source:
protected void handleRemoteBrowseSelected() { IHost currentConnectionSelected = getCurrentConnection(); SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl() .getShell(), Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title, currentConnectionSelected); dlg.setBlockOnOpen(true); if (dlg.open() == Window.OK) { Object retObj = dlg.getSelectedObject(); if (retObj instanceof IRemoteFile) { IRemoteFile selectedFile = (IRemoteFile) retObj; String absPath = selectedFile.getAbsolutePath(); if (selectedFile.isDirectory()) { IPath appPath = new Path(fProgText.getText().trim()); String lastSegment = appPath.lastSegment(); if (lastSegment != null && lastSegment.trim().length() > 0) { IPath remotePath = new Path(selectedFile.getAbsolutePath()).append(lastSegment.trim()); absPath = remotePath.toOSString(); } } remoteProgText.setText(absPath); } } }

Target:
protected void handleRemoteBrowseSelected() { IHost currentConnectionSelected = getCurrentConnection(); SystemRemoteFileDialog dlg = new SystemRemoteFileDialog(getControl() .getShell(), Messages.RemoteCMainTab_Remote_Path_Browse_Button_Title, currentConnectionSelected); dlg.setBlockOnOpen(true); if (dlg.open() == Window.OK) { Object retObj = dlg.getSelectedObject(); if (retObj instanceof IRemoteFile) { IRemoteFile selectedFile = (IRemoteFile) retObj; String absPath = selectedFile.getAbsolutePath(); if (selectedFile.isDirectory()) { IPath appPath = new Path(fProgText.getText().trim()); String lastSegment = appPath.lastSegment(); if (lastSegment != null && lastSegment.trim().length() > 0) { IPath remotePath = new Path(selectedFile.getAbsolutePath()).append(lastSegment.trim()); absPath = remotePath.toPortableString(); } } remoteProgText.setText(absPath); } } }
Source:
static void transformMappedBys(EntityType entityType, Map<String, Attribute> newAttributes) { if (newAttributes.isEmpty()) { return; } stream(entityType.getAtomicAttributes()) .filter(attr -> attr.getDataType() == ONE_TO_MANY) .forEach(attr -> transformMappedBy(attr, newAttributes)); }

Target:
static void transformMappedBys(EntityType entityType, Map<String, Attribute> newAttributes) { if (newAttributes.isEmpty()) { return; } stream(entityType.getAtomicAttributes()) .filter(Attribute::isMappedBy) .forEach(attr -> transformMappedBy(attr, newAttributes)); }
Source:
public <N, EK, EV> StateMapView<N, EK, EV> getStateMapView( String stateName, boolean supportNullKey, TypeSerializer<EK> keySerializer, TypeSerializer<EV> valueSerializer) { final MapStateDescriptor<EK, EV> mapStateDescriptor = new MapStateDescriptor<>( stateName, keySerializer, valueSerializer); if (stateTtlConfig.isEnabled()) { mapStateDescriptor.enableTimeToLive(stateTtlConfig); } final MapState<EK, EV> mapState = ctx.getMapState(mapStateDescriptor); if (supportNullKey) { final ValueStateDescriptor<EV> nullStateDescriptor = new ValueStateDescriptor<>( stateName + NULL_STATE_POSTFIX, valueSerializer); final ValueState<EV> nullState = ctx.getState(nullStateDescriptor); return new StateMapView.KeyedStateMapViewWithKeysNullable<>(mapState, nullState); } else { return new StateMapView.KeyedStateMapViewWithKeysNotNull<>(mapState); } }

Target:
public <N, EK, EV> StateMapView<N, EK, EV> getStateMapView( String stateName, boolean supportNullKey, TypeSerializer<EK> keySerializer, TypeSerializer<EV> valueSerializer) { final MapStateDescriptor<EK, EV> mapStateDescriptor = new MapStateDescriptor<>( stateName, keySerializer, valueSerializer); if (stateTtlConfig.isEnabled()) { mapStateDescriptor.enableTimeToLive(stateTtlConfig); } final MapState<EK, EV> mapState = ctx.getMapState(mapStateDescriptor); if (supportNullKey) { final ValueStateDescriptor<EV> nullStateDescriptor = new ValueStateDescriptor<>( stateName + NULL_STATE_POSTFIX, valueSerializer); if (stateTtlConfig.isEnabled()) { nullStateDescriptor.enableTimeToLive(stateTtlConfig); } final ValueState<EV> nullState = ctx.getState(nullStateDescriptor); return new StateMapView.KeyedStateMapViewWithKeysNullable<>(mapState, nullState); } else { return new StateMapView.KeyedStateMapViewWithKeysNotNull<>(mapState); } }
Source:
public void setUp() throws IOException { conf = new Configuration(); conf.setBoolean("dfs.client.block.write.replace-datanode-on-failure.enable", true); conf.set("dfs.client.block.write.replace-datanode-on-failure.policy", "NEVER"); cluster = createDFSCluster(conf); cluster.waitActive(); url = "hdfs://" + cluster.getNameNode().getClientNamenodeAddress(); fs = cluster.getFileSystem(); Properties props = createProps(); connectorConfig = new HdfsSinkConnectorConfig(props); topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); }

Target:
public void setUp() throws Exception { conf = new Configuration(); if (dfsCluster) { cluster = createDFSCluster(conf); cluster.waitActive(); url = "hdfs://" + cluster.getNameNode().getClientNamenodeAddress(); fs = cluster.getFileSystem(); } else { url = "memory://"; } Properties props = createProps(); connectorConfig = new HdfsSinkConnectorConfig(props); topicsDir = connectorConfig.getString(HdfsSinkConnectorConfig.TOPIC_DIR_CONFIG); int schemaCacheSize = connectorConfig.getInt(HdfsSinkConnectorConfig.SCHEMA_CACHE_SIZE_CONFIG); avroData = new AvroData(schemaCacheSize); assignment = new HashSet<>(); assignment.add(TOPIC_PARTITION); assignment.add(TOPIC_PARTITION2); context = new MockSinkTaskContext(); }
Source:
public static void main(String[] argArray) throws IOException { long now = System.nanoTime(); Arguments arguments = new Arguments(); arguments.parse(argArray); int result = run(arguments); if (result != 0) { System.exit(result); } if (args.profileConcurrency) { System.out.println("DX TIME: " + ((System.nanoTime() - now)/1000000L)); } }

Target:
public static void main(String[] argArray) throws IOException { Arguments arguments = new Arguments(); arguments.parse(argArray); int result = run(arguments); if (result != 0) { System.exit(result); } }
Source:
public static FileUtils.FileCopyResult unzip(final File pulledFile, final File outDir) throws IOException { if (!(outDir.exists() && outDir.isDirectory())) { throw new ISE("outDir[%s] must exist and be a directory", outDir); } log.info("Unzipping file[%s] to [%s]", pulledFile, outDir); final ArrayList<FileUtils.FileCopyResult> children = new ArrayList<>(); try (final ZipFile zipFile = new ZipFile(pulledFile)) { final Enumeration<? extends ZipEntry> enumeration = zipFile.entries(); while (enumeration.hasMoreElements()) { final ZipEntry entry = enumeration.nextElement(); children.add( FileUtils.retryCopy( new ByteSource() { @Override public InputStream openStream() throws IOException { return new BufferedInputStream(zipFile.getInputStream(entry)); } }, FileUtils.MD5ERROR, Paths.get(outDir.getAbsolutePath(), entry.getName()).toFile(), DEFAULT_RETRY_COUNT ) ); } } return new FileUtils.FileCopyResult(outDir.toPath(), children); }

Target:
public static FileUtils.FileCopyResult unzip(final File pulledFile, final File outDir) throws IOException { if (!(outDir.exists() && outDir.isDirectory())) { throw new ISE("outDir[%s] must exist and be a directory", outDir); } log.info("Unzipping file[%s] to [%s]", pulledFile, outDir); final FileUtils.FileCopyResult result = new FileUtils.FileCopyResult(); try (final ZipFile zipFile = new ZipFile(pulledFile)) { final Enumeration<? extends ZipEntry> enumeration = zipFile.entries(); while (enumeration.hasMoreElements()) { final ZipEntry entry = enumeration.nextElement(); result.addFiles( FileUtils.retryCopy( new ByteSource() { @Override public InputStream openStream() throws IOException { return new BufferedInputStream(zipFile.getInputStream(entry)); } }, new File(outDir, entry.getName()), FileUtils.IS_EXCEPTION, DEFAULT_RETRY_COUNT ).getFiles() ); } } return result; }
Source:
public long deserialize(DataTree dt, Map<Long, Integer> sessions) throws IOException { List<File> snapList = findNValidSnapshots(100); if (snapList.size() == 0) { return -1L; } File snap = null; long snapZxid = 0; boolean foundValid = false; for (int i = 0, snapListSize = snapList.size(); i < snapListSize; i++) { snap = snapList.get(i); LOG.info("Reading snapshot {}", snap); snapZxid = Util.getZxidFromName(snap.getName(), SNAPSHOT_FILE_PREFIX); try (CheckedInputStream snapIS = SnapStream.getInputStream(snap)) { InputArchive ia = BinaryInputArchive.getArchive(snapIS); deserialize(dt, sessions, ia); SnapStream.checkSealIntegrity(snapIS, ia); if (dt.deserializeZxidDigest(ia, snapZxid)) { SnapStream.checkSealIntegrity(snapIS, ia); } foundValid = true; break; } catch (IOException e) { LOG.warn("problem reading snap file {}", snap, e); } } if (!foundValid) { throw new IOException("Not able to find valid snapshots in " + snapDir); } dt.lastProcessedZxid = snapZxid; lastSnapshotInfo = new SnapshotInfo(dt.lastProcessedZxid, snap.lastModified() / 1000); if (dt.getDigestFromLoadedSnapshot() != null) { dt.compareSnapshotDigests(dt.lastProcessedZxid); } return dt.lastProcessedZxid; }

Target:
public long deserialize(DataTree dt, Map<Long, Integer> sessions) throws IOException { List<File> snapList = findNValidSnapshots(100); if (snapList.size() == 0) { return -1L; } File snap = null; long snapZxid = -1; boolean foundValid = false; for (int i = 0, snapListSize = snapList.size(); i < snapListSize; i++) { snap = snapList.get(i); LOG.info("Reading snapshot {}", snap); snapZxid = Util.getZxidFromName(snap.getName(), SNAPSHOT_FILE_PREFIX); try (CheckedInputStream snapIS = SnapStream.getInputStream(snap)) { InputArchive ia = BinaryInputArchive.getArchive(snapIS); deserialize(dt, sessions, ia); SnapStream.checkSealIntegrity(snapIS, ia); if (dt.deserializeZxidDigest(ia, snapZxid)) { SnapStream.checkSealIntegrity(snapIS, ia); } foundValid = true; break; } catch (IOException e) { LOG.warn("problem reading snap file {}", snap, e); } } if (!foundValid) { throw new IOException("Not able to find valid snapshots in " + snapDir); } dt.lastProcessedZxid = snapZxid; lastSnapshotInfo = new SnapshotInfo(dt.lastProcessedZxid, snap.lastModified() / 1000); if (dt.getDigestFromLoadedSnapshot() != null) { dt.compareSnapshotDigests(dt.lastProcessedZxid); } return dt.lastProcessedZxid; }
Source:
public <K, V> Ehcache<K, V> createCache(Class<K> keyClazz, Class<V> valueClazz, ServiceConfiguration<?>... config) { return new HeapCache<K, V>(LoggerFactory.getLogger(Ehcache.class + "HeapCache")); }

Target:
public <K, V> Ehcache<K, V> createCache(Class<K> keyClazz, Class<V> valueClazz, ServiceConfiguration<?>... config) { return new HeapCache<K, V>(LoggerFactory.getLogger(Ehcache.class + "-" + "HeapCache")); }
Source:
protected void updateFollowFilter() { if (currentWalk instanceof FollowingSWTWalk) { List<DiffEntry> renamedEntries = ((FollowingSWTWalk) currentWalk).getRenamedEntries(); List<String> pathList = new ArrayList<String>(renamedEntries.size()); for (DiffEntry entry : renamedEntries) { if (!pathList.contains(entry.getOldPath())) { pathList.add(entry.getOldPath()); } if (!pathList.contains(entry.getNewPath())) { pathList.add(entry.getNewPath()); } } if (pathList.size() > 0) { TreeWalk fileWalker = fileViewer.getTreeWalk(); fileWalker.setFilter(AndTreeFilter.create(PathFilterGroup .createFromStrings(pathList), TreeFilter.ANY_DIFF)); } } }

Target:
protected void updateFollowFilter() { if (currentWalk instanceof FollowingSWTWalk) { List<DiffEntry> renamedEntries = ((FollowingSWTWalk) currentWalk).getRenamedEntries(); List<String> pathList = new ArrayList<String>(renamedEntries.size()); for (DiffEntry entry : renamedEntries) { if (!pathList.contains(entry.getOldPath())) pathList.add(entry.getOldPath()); if (!pathList.contains(entry.getNewPath())) pathList.add(entry.getNewPath()); } if (pathList.size() > 0) { TreeWalk fileWalker = fileViewer.getTreeWalk(); fileWalker.setFilter(AndTreeFilter.create(PathFilterGroup .createFromStrings(pathList), TreeFilter.ANY_DIFF)); } } }
Source:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result; OCShare share = getStorageManager().getShareById(mLocalId); if (share != null) { RemoveRemoteShareOperation operation = new RemoveRemoteShareOperation((int) share.getRemoteId()); result = operation.execute(client); OCFile file = getStorageManager().getFileByPath(share.getPath()); if (result.isSuccess()) { Log_OC.d(TAG, "Share id = " + share.getRemoteId() + " deleted"); ShareType shareType = share.getShareType(); if (ShareType.PUBLIC_LINK.equals(shareType)) { file.setSharedViaLink(false); } else if (ShareType.USER.equals(shareType) || ShareType.GROUP.equals(shareType) || ShareType.FEDERATED.equals(shareType)){ ArrayList <OCShare> sharesWith = getStorageManager(). getPrivateSharesForAFile(share.getPath(), getStorageManager().getAccount().name); if (sharesWith.size() == 1) { file.setSharedWithSharee(false); } } getStorageManager().saveFile(file); getStorageManager().removeShare(share); } else if (result.getCode() != ResultCode.SERVICE_UNAVAILABLE && !existsFile(client, share.getPath())) { getStorageManager().removeFile(file, true, true); } } else { result = new RemoteOperationResult(ResultCode.SHARE_NOT_FOUND); } return result; }

Target:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result; OCShare share = getStorageManager().getShareById(mLocalId); if (share != null) { RemoveRemoteShareOperation operation = new RemoveRemoteShareOperation((int) share.getRemoteId()); result = operation.execute(client); OCFile file = getStorageManager().getFileByPath(share.getPath()); if (result.isSuccess()) { Log_OC.d(TAG, "Share id = " + share.getRemoteId() + " deleted"); ShareType shareType = share.getShareType(); if (ShareType.PUBLIC_LINK.equals(shareType)) { ArrayList<OCShare> publicShares = getStorageManager(). getPublicSharesForAFile(share.getPath(), getStorageManager().getAccount().name); if (publicShares.size() == 1) { file.setSharedViaLink(false); } } else if (ShareType.USER.equals(shareType) || ShareType.GROUP.equals(shareType) || ShareType.FEDERATED.equals(shareType)){ ArrayList <OCShare> sharesWith = getStorageManager(). getPrivateSharesForAFile(share.getPath(), getStorageManager().getAccount().name); if (sharesWith.size() == 1) { file.setSharedWithSharee(false); } } getStorageManager().saveFile(file); getStorageManager().removeShare(share); } else if (result.getCode() != ResultCode.SERVICE_UNAVAILABLE && notExistFile(client, share.getPath())) { getStorageManager().removeFile(file, true, true); } } else { result = new RemoteOperationResult(ResultCode.SHARE_NOT_FOUND); } return result; }
Source:
public String mimeType() { return "multipart/form-data; boundary=" + boundary; }

Target:
@Override public String mimeType() { return "multipart/form-data; boundary=" + boundary; }
Source:
protected void EndSuccessfully() { setVm(DbFacade.getInstance().getVmDAO().getById(getVmId())); if (getVm() != null) { vm_pools vmPool = getVmPool(); if (DbFacade.getInstance().getDiskImageDAO().getAllStatelessVmImageMapsForVm(getVm().getvm_guid()).size() > 0) { setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, getParameters().getImagesParameters().get(0), getCompensationContext()).getSucceeded()); if (!getSucceeded()) { log.warn("EndSuccessfully: EndAction of RunVm failed, detaching user from Vm"); detachUserFromVmFromPool(); getReturnValue().setEndActionTryAgain(false); } } else { log.warn("EndSuccessfully: No images were created for Vm, detaching user from Vm"); detachUserFromVmFromPool(); getReturnValue().setEndActionTryAgain(false); } } else { setCommandShouldBeLogged(false); log.warn("AttachUserToVmFromPoolAndRunCommand::EndSuccessfully: Vm is null - not performing full EndAction"); setSucceeded(true); } }

Target:
protected void EndSuccessfully() { if (getVm() != null) { vm_pools vmPool = getVmPool(); if (DbFacade.getInstance().getDiskImageDAO().getAllStatelessVmImageMapsForVm(getVm().getvm_guid()).size() > 0) { setSucceeded(Backend.getInstance().endAction(VdcActionType.RunVm, getParameters().getImagesParameters().get(0), getCompensationContext()).getSucceeded()); if (!getSucceeded()) { log.warn("EndSuccessfully: EndAction of RunVm failed, detaching user from Vm"); detachUserFromVmFromPool(); getReturnValue().setEndActionTryAgain(false); } } else { log.warn("EndSuccessfully: No images were created for Vm, detaching user from Vm"); detachUserFromVmFromPool(); getReturnValue().setEndActionTryAgain(false); } } else { setCommandShouldBeLogged(false); log.warn("AttachUserToVmFromPoolAndRunCommand::EndSuccessfully: Vm is null - not performing full EndAction"); setSucceeded(true); } }
Source:
private DocumentReference createDocRef(DocumentReference baseDocRef, long num) { String name = baseDocRef.getName() + num; SpaceReference parent = References.extractRef(baseDocRef, SpaceReference.class).get(); return References.create(DocumentReference.class, name, parent); }

Target:
private DocumentReference createDocRef(DocumentReference baseDocRef, long num) { String name = new StringBuilder(baseDocRef.getName()).append(num).toString(); SpaceReference parent = References.extractRef(baseDocRef, SpaceReference.class).get(); return References.create(DocumentReference.class, name, parent); }
Source:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } boolean changed = false; if (serialPortname != (String) config.get("serialPort")) { serialPortname = (String) config.get("serialPort"); changed = true; } String dummy = (String) config.get("baud"); try { if (serialBaudrate != Integer.parseInt(dummy)) { serialBaudrate = Integer.parseInt(dummy); changed = true; } } catch (NumberFormatException e) { logger.info("reading exception"); } if (changed | (baseStation == null)) { if (baseStation != null) baseStation.closeSerialPort(); baseStation = new BaseStation(serialPortname, serialBaudrate, this); logger.debug("Smarthomatic Binding:update creates new basestation"); } Enumeration<String> keys = config.keys(); for (int i = 0; i < config.size(); i++) { String key = keys.nextElement(); StringTokenizer tokens = new StringTokenizer(key, ":"); if (tokens.nextToken().equals("device")) { if (tokens.hasMoreElements()) { dummy = tokens.nextToken(); int deviceID = Integer.parseInt(dummy); String name = (String) config.get(key); SmarthomaticGenericBindingProvider.addDevice(name, deviceID); logger.debug("Smarthomatic device can be indexed by name {}", new String[] { dummy, name }); } } logger.debug("KEY:" + key); } setProperlyConfigured(true); } }

Target:
public void updated(Dictionary<String, ?> config) throws ConfigurationException { if (config != null) { String refreshIntervalString = (String) config.get("refresh"); if (StringUtils.isNotBlank(refreshIntervalString)) { refreshInterval = Long.parseLong(refreshIntervalString); } boolean changed = false; if (serialPortname != (String) config.get("serialPort")) { serialPortname = (String) config.get("serialPort"); changed = true; } String dummy = (String) config.get("baud"); try { if (serialBaudrate != Integer.parseInt(dummy)) { serialBaudrate = Integer.parseInt(dummy); changed = true; } } catch (NumberFormatException e) { logger.info("reading exception"); } if (changed | (baseStation == null)) { if (baseStation != null) baseStation.closeSerialPort(); baseStation = new BaseStation(serialPortname, serialBaudrate, this); logger.debug("Smarthomatic Binding:update creates new basestation"); } Enumeration<String> keys = config.keys(); for (int i = 0; i < config.size(); i++) { String key = keys.nextElement(); StringTokenizer tokens = new StringTokenizer(key, ":"); if (tokens.nextToken().equals("device")) { if (tokens.hasMoreElements()) { dummy = tokens.nextToken(); int deviceID = Integer.parseInt(dummy); String name = (String) config.get(key); SmarthomaticGenericBindingProvider.addDevice(name, deviceID); logger.debug("Smarthomatic device can be indexed by name {}", new String[] { dummy, name }); } } logger.debug("KEY: {}", key); } setProperlyConfigured(true); } }
Source:
private Map<Integer, List<InstanceId>> getRoundRobinAllocation( int numContainer, Map<String, Integer> parallelismMap) { Map<Integer, List<InstanceId>> allocation = new HashMap<>(); int totalInstance = parallelismMap.values().stream().collect(Collectors.summingInt(Integer::intValue)); if (numContainer > totalInstance) { throw new RuntimeException("More containers allocated than instance."); } for (int i = 1; i <= numContainer; ++i) { allocation.put(i, new ArrayList<InstanceId>()); } int index = 1; int globalTaskIndex = 1; for (String component : parallelismMap.keySet()) { int numInstance = parallelismMap.get(component); for (int i = 0; i < numInstance; ++i) { allocation.get(index).add(new InstanceId(component, globalTaskIndex, i)); index = (index == numContainer) ? 1 : index + 1; globalTaskIndex++; } } return allocation; }

Target:
private Map<Integer, List<InstanceId>> getRoundRobinAllocation( int numContainer, Map<String, Integer> parallelismMap) { Map<Integer, List<InstanceId>> allocation = new HashMap<>(); int totalInstance = TopologyUtils.getTotalInstance(parallelismMap); if (numContainer > totalInstance) { throw new RuntimeException("More containers allocated than instance."); } for (int i = 1; i <= numContainer; ++i) { allocation.put(i, new ArrayList<InstanceId>()); } int index = 1; int globalTaskIndex = 1; for (String component : parallelismMap.keySet()) { int numInstance = parallelismMap.get(component); for (int i = 0; i < numInstance; ++i) { allocation.get(index).add(new InstanceId(component, globalTaskIndex, i)); index = (index == numContainer) ? 1 : index + 1; globalTaskIndex++; } } return allocation; }
Source:
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { for (SecretServiceVersion serviceVersion : SecretServiceVersion.values()) { argumentsList.add(Arguments.of(httpClient, serviceVersion)); } }); return argumentsList.stream(); }

Target:
static Stream<Arguments> getTestParameters() { List<Arguments> argumentsList = new ArrayList<>(); getHttpClients() .forEach(httpClient -> { Arrays.stream(SecretServiceVersion.values()).filter(SecretClientTestBase::shouldServiceVersionBeTested) .forEach(serviceVersion -> argumentsList.add(Arguments.of(httpClient, serviceVersion))); }); return argumentsList.stream(); }
Source:
public List<StoreKeyAndSizeAndOffset> getStoreKeysInByteRange(long start, long end) { if (end < start || start < 0L || end >= totalSize) { throw new IllegalArgumentException("Bad input parameters, start="+start+" end="+end+" totalSize="+totalSize); } int idx = Collections.binarySearch(offsets, start); if (idx < 0) { idx = -idx-2; } List<StoreKeyAndSizeAndOffset> ans = new ArrayList<>(); while(idx < keys.size() && offsets.get(idx) <= end) { ans.add(keysAndSizesAndOffsets.get(idx)); idx++; } return ans; }

Target:
public List<ChunkMetadata> getStoreKeysInByteRange(long start, long end) { if (end < start || start < 0L || end >= totalSize) { throw new IllegalArgumentException( "Bad input parameters, start=" + start + " end=" + end + " totalSize=" + totalSize); } int startIdx = Collections.binarySearch(offsets, start); if (startIdx < 0) { startIdx = -startIdx - 2; } int endIdx = Collections.binarySearch(offsets, end); if (endIdx < 0) { endIdx = -endIdx - 2; } endIdx++; return chunkMetadataList.subList(startIdx, endIdx); }
Source:
public void skip() { try { in.skipFully(length); } catch (IOException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } catch (RuntimeException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } }

Target:
public void skip() { try { in.skipFully(length); } catch (IOException | RuntimeException e) { throw new ParquetDecodingException("could not skip bytes at offset " + in.position(), e); } }
Source:
private void startSleepyThread(){ Thread sleepyThread = new Thread(new Runnable() { private static final long SOME_POINTLESS_AMOUNT_OF_TIME = 50; @Override public void run() { sleepyMethod(SOME_POINTLESS_AMOUNT_OF_TIME); } @DebugLog private void sleepyMethod(long milliseconds){ try { Thread.sleep(milliseconds); } catch (InterruptedException e) { e.printStackTrace(); } } }); sleepyThread.setName("I'm a lazy thr.. bah! whatever!"); sleepyThread.start(); }

Target:
private void startSleepyThread() { Thread sleepyThread = new Thread(new Runnable() { private static final long SOME_POINTLESS_AMOUNT_OF_TIME = 50; @Override public void run() { sleepyMethod(SOME_POINTLESS_AMOUNT_OF_TIME); } @DebugLog private void sleepyMethod(long milliseconds) { SystemClock.sleep(milliseconds); } }, "I'm a lazy thr.. bah! whatever!").start(); }