auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void buildVmVirtioScsi() { List<VmDevice> vmDevices = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSCSI.getName()); Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.Scsi); struct.put(VdsProperties.Model, VdsProperties.VirtioScsi); struct.put(VdsProperties.Index, Integer.toString(virtioScsiIndex)); if (vm.getNumOfIoThreads() > 0) { struct.put(VdsProperties.ioTrheadId, Integer.toString(virtioScsiIndex)); virtioScsiIndex++; } vmInfoBuildUtils.addAddress(vmDevice, struct); virtioScsiIndex++; addDevice(struct, vmDevice, null); } }

Target:
public void buildVmVirtioScsi() { List<VmDevice> vmDevices = vmDeviceDao.getVmDeviceByVmIdTypeAndDevice( vm.getId(), VmDeviceGeneralType.CONTROLLER, VmDeviceType.VIRTIOSCSI.getName()); Map<DiskInterface, Integer> controllerIndexMap = ArchStrategyFactory.getStrategy(vm.getClusterArch()).run(new GetControllerIndices()).returnValue(); int virtioScsiIndex = controllerIndexMap.get(DiskInterface.VirtIO_SCSI); for (VmDevice vmDevice : vmDevices) { Map<String, Object> struct = new HashMap<>(); struct.put(VdsProperties.Type, VmDeviceGeneralType.CONTROLLER.getValue()); struct.put(VdsProperties.Device, VdsProperties.Scsi); struct.put(VdsProperties.Model, VdsProperties.VirtioScsi); struct.put(VdsProperties.Index, Integer.toString(virtioScsiIndex)); if (vm.getNumOfIoThreads() > 0) { struct.put(VdsProperties.ioTrheadId, Integer.toString(virtioScsiIndex)); } vmInfoBuildUtils.addAddress(vmDevice, struct); virtioScsiIndex++; addDevice(struct, vmDevice, null); } }
Source:
public void stop() { if (this.runningState != State.RUNNING && this.runningState != State.SUSPENDED) { throw new IllegalStateException("Stopwatch is not running. "); } if (this.runningState == State.RUNNING) { this.stopTime = System.nanoTime(); split(""); } this.runningState = State.STOPPED; }

Target:
public void stop() { if (this.runningState != State.RUNNING && this.runningState != State.SUSPENDED) { throw new IllegalStateException("Stopwatch is not running. "); } if (this.runningState == State.RUNNING) { this.stopTime = System.nanoTime(); split(StringUtils.EMPTY); } this.runningState = State.STOPPED; }
Source:
public void stop() { LOG.info("Stopping Samza kafkaConsumer " + this); if (!stopped.compareAndSet(false, true)) { LOG.warn("attempting to stop stopped consumer."); return; } if (proxy != null) { LOG.info("Stopping proxy " + proxy); proxy.stop(TimeUnit.MINUTES.toMillis(5)); } try { synchronized (kafkaConsumer) { LOG.info("Closing kafka consumer " + kafkaConsumer); kafkaConsumer.close(); } } catch (Exception e) { LOG.warn("failed to stop SamzaRawKafkaConsumer + " + this, e); } }

Target:
public void stop() { if (!stopped.compareAndSet(false, true)) { LOG.warn("{}: Attempting to stop stopped consumer.", this); return; } LOG.info("{}: Stopping Samza kafkaConsumer ", this); if (proxy != null) { LOG.info("{}: Stopping proxy {}", this, proxy); proxy.stop(TimeUnit.SECONDS.toMillis(60)); } try { synchronized (kafkaConsumer) { LOG.info("{}: Closing kafkaSystemConsumer {}", this, kafkaConsumer); kafkaConsumer.close(); } } catch (Exception e) { LOG.warn("{}: Failed to stop KafkaSystemConsumer.", this, e); } }
Source:
public void createDocumentWithDebugLevel() throws Exception { final StringWriter consoleWriter = new StringWriter(); addAppenderAndLogger(NETWORK_LOGGING_CATEGORY, Level.DEBUG, APPENDER_NAME, consoleWriter); Logger logger = LoggerFactory.getLogger(NETWORK_LOGGING_CATEGORY); Assert.assertTrue(logger.isDebugEnabled()); CosmosClient client = clientBuilder().build(); try { CosmosItemProperties docDefinition = getDocumentDefinition(); Mono<CosmosItemResponse> createObservable = createdCollection.createItem(docDefinition, new CosmosItemRequestOptions()); CosmosResponseValidator<CosmosItemResponse> validator = new CosmosResponseValidator.Builder<CosmosItemResponse>() .withId(docDefinition.id()).build(); validateSuccess(createObservable, validator); assertThat(consoleWriter.toString()).isEmpty(); } finally { safeClose(client); } }

Target:
public void createDocumentWithDebugLevel() throws Exception { final StringWriter consoleWriter = new StringWriter(); addAppenderAndLogger(NETWORK_LOGGING_CATEGORY, Level.DEBUG, APPENDER_NAME, consoleWriter); final Logger logger = LoggerFactory.getLogger(NETWORK_LOGGING_CATEGORY); assertThat(logger.isDebugEnabled()).isTrue(); CosmosClient client = clientBuilder().build(); try { CosmosItemProperties docDefinition = getDocumentDefinition(); Mono<CosmosItemResponse> createObservable = createdCollection.createItem(docDefinition, new CosmosItemRequestOptions()); CosmosResponseValidator<CosmosItemResponse> validator = new CosmosResponseValidator.Builder<CosmosItemResponse>() .withId(docDefinition.id()).build(); validateSuccess(createObservable, validator); assertThat(consoleWriter.toString()).isEmpty(); } finally { safeClose(client); } }
Source:
private JnlpEndpointResolver createEndpointResolver(List<String> jenkinsUrls) { JnlpEndpointResolver resolver; if (instanceIdentity == null) { SSLSocketFactory sslSocketFactory = null; try { sslSocketFactory = getSSLSocketFactory(); } catch (Exception e) { events.error(e); } resolver = new JnlpAgentEndpointResolver(jenkinsUrls, credentials, proxyCredentials, tunnel, sslSocketFactory, disableHttpsCertValidation); } else { resolver = new JnlpAgentEndpointConfigurator(directUrl, instanceIdentity, protocols); } return resolver; }

Target:
private JnlpEndpointResolver createEndpointResolver(List<String> jenkinsUrls) { JnlpEndpointResolver resolver; if (directConnection == null) { SSLSocketFactory sslSocketFactory = null; try { sslSocketFactory = getSSLSocketFactory(); } catch (Exception e) { events.error(e); } resolver = new JnlpAgentEndpointResolver(jenkinsUrls, credentials, proxyCredentials, tunnel, sslSocketFactory, disableHttpsCertValidation); } else { resolver = new JnlpAgentEndpointConfigurator(directConnection, instanceIdentity, protocols); } return resolver; }
Source:
private synchronized void drainQueueForRequests() { final PrefetchRecordsRetrieved recordsToDeliver = (PrefetchRecordsRetrieved) peekNextResult(); if (publisherSession.hasDemandToPublish() && canDispatchRecord(recordsToDeliver)) { subscriber.onNext(recordsToDeliver.prepareForPublish()); recordsToDeliver.dispatched(); lastEventDeliveryTime = Instant.now(); } }

Target:
synchronized void drainQueueForRequests() { final PrefetchRecordsRetrieved recordsToDeliver = peekNextResult(); if (publisherSession.hasDemandToPublish() && canDispatchRecord(recordsToDeliver)) { subscriber.onNext(recordsToDeliver.prepareForPublish()); recordsToDeliver.dispatched(); lastEventDeliveryTime = Instant.now(); } }
Source:
private RelDataType decimalOf2(RelDataType type) { assert SqlTypeUtil.isNumeric(type) || SqlTypeUtil.isNull(type); SqlTypeName typeName = type.getSqlTypeName(); assert typeName != null; switch (typeName) { case DECIMAL: return RelDataTypeFactoryImpl.isJavaType(type) ? createSqlType(SqlTypeName.DECIMAL) : type; case TINYINT: return createSqlType(SqlTypeName.DECIMAL, 3, 0); case SMALLINT: return createSqlType(SqlTypeName.DECIMAL, 5, 0); case INTEGER: return createSqlType(SqlTypeName.DECIMAL, 10, 0); case BIGINT: return createSqlType(SqlTypeName.DECIMAL, 38, 0); case REAL: return createSqlType(SqlTypeName.DECIMAL, 14, 7); case FLOAT: return createSqlType(SqlTypeName.DECIMAL, 14, 7); case DOUBLE: return createSqlType(SqlTypeName.DECIMAL, 30, 15); default: return createSqlType(SqlTypeName.DECIMAL); } }

Target:
private RelDataType decimalOf2(RelDataType type) { assert SqlTypeUtil.isNumeric(type) || SqlTypeUtil.isNull(type); SqlTypeName typeName = type.getSqlTypeName(); assert typeName != null; switch (typeName) { case DECIMAL: return RelDataTypeFactoryImpl.isJavaType(type) ? SqlTypeUtil.getMaxPrecisionScaleDecimal(this) : type; case TINYINT: return createSqlType(SqlTypeName.DECIMAL, 3, 0); case SMALLINT: return createSqlType(SqlTypeName.DECIMAL, 5, 0); case INTEGER: return createSqlType(SqlTypeName.DECIMAL, 10, 0); case BIGINT: return createSqlType(SqlTypeName.DECIMAL, 38, 0); case REAL: return createSqlType(SqlTypeName.DECIMAL, 14, 7); case FLOAT: return createSqlType(SqlTypeName.DECIMAL, 14, 7); case DOUBLE: return createSqlType(SqlTypeName.DECIMAL, 30, 15); default: return createSqlType(SqlTypeName.DECIMAL); } }
Source:
public void addItem(ContextMenuItem item) { try { String id = item.getId(); if (id != null) { item.setHidden(isItemHidden(id)); item.setOrder(getItemOrder(id, item.getOrder())); } items.add(item.getPos(), item); } catch (IndexOutOfBoundsException ex) { items.add(item); } sortItemsByOrder(); }

Target:
public void addItem(ContextMenuItem item) { String id = item.getId(); if (id != null) { item.setHidden(isItemHidden(id)); item.setOrder(getItemOrder(id, item.getOrder())); } items.add(item); sortItemsByOrder(); }
Source:
static void resolveAttribute(OperationContext context, AttributeDefinition attribute, String attributeSyntax, boolean defaults, boolean enhancedSyntax) throws OperationFailedException { final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS, false); final ModelNode subModel = resource.getModel(); if (enhancedSyntax) { context.getResult().set(EnhancedSyntaxSupport.resolveEnhancedSyntax(attributeSyntax, subModel)); } else if (subModel.hasDefined(attribute.getName())) { final ModelNode result = subModel.get(attribute.getName()); context.getResult().set(result); } else if (defaults && attribute.getDefaultValue() != null) { context.getResult().set(attribute.getDefaultValue()); if (attribute.getAlternatives() != null) { final ModelNode undefined = new ModelNode(); for(String alternative : attribute.getAlternatives()) { if(!undefined.equals(subModel.get(alternative))) { context.getResult().set(undefined); break; } } } } else { context.getResult(); } }

Target:
static void resolveAttribute(OperationContext context, AttributeDefinition attribute, String attributeSyntax, boolean defaults, boolean enhancedSyntax) throws OperationFailedException { final Resource resource = context.readResource(PathAddress.EMPTY_ADDRESS, false); final ModelNode subModel = resource.getModel(); if (enhancedSyntax) { context.getResult().set(EnhancedSyntaxSupport.resolveEnhancedSyntax(attributeSyntax, subModel)); } else if (subModel.hasDefined(attribute.getName())) { final ModelNode result = subModel.get(attribute.getName()); context.getResult().set(result); } else if (defaults && attribute.getDefaultValue() != null) { if(!attribute.hasAlternative(subModel)) { context.getResult().set(attribute.getDefaultValue()); } else { final ModelNode undefined = new ModelNode(); for(final String alternative : attribute.getAlternatives()) { if(!undefined.equals(subModel.get(alternative))) { context.getResult().set(undefined); break; } } } } else { context.getResult(); } }
Source:
protected boolean isValidateChainOfTrust() { try { return propertyAccessor.getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, "ValiateChainOfTrust"); } catch (PropertyAccessException ex) { LOG.error("Unable to read the Validate Chain of Trust logging property: {}", ex.getLocalizedMessage(), ex); } return false; }

Target:
protected boolean isValidateChainOfTrust() { try { return propertyAccessor.getPropertyBoolean(NhincConstants.GATEWAY_PROPERTY_FILE, "ValidateChainOfTrust"); } catch (PropertyAccessException ex) { LOG.error("Unable to read the Validate Chain of Trust logging property " + ex.getLocalizedMessage(), ex); } return false; }
Source:
public void should_set_entries_to_mdc_from_two_spans1() throws Exception { Scope scope = this.slf4jCurrentTraceContext.newScope(this.span.context()); assertMDCInfoEqualToSpanInfo(span.context()); Scope scopeInner = this.slf4jCurrentTraceContext.newScope(null); assertMDCInfoNullOrEmpty(); scopeInner.close(); assertMDCInfoEqualToSpanInfo(span.context()); scope.close(); assertMDCInfoNullOrEmpty(); }

Target:
public void should_set_entries_to_mdc_from_two_spans1() throws Exception { try (Scope scope = this.slf4jCurrentTraceContext.newScope(this.span.context())) { assertMDCInfoEqualToSpanInfo(span.context()); try (Scope scopeInner = this.slf4jCurrentTraceContext.newScope(null)) { assertMDCInfoNullOrEmpty(); } assertMDCInfoEqualToSpanInfo(span.context()); } assertMDCInfoNullOrEmpty(); }
Source:
public void addDefaultRoute() { if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) && mDefaultRouteSet == false) { if (DBG) { Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); } InetAddress inetAddress = NetworkUtils.intToInetAddress(mDefaultGatewayAddr); if (inetAddress == null) { if (DBG) Log.d(TAG, " Unable to add default route."); } else { NetworkUtils.addRoute(mInterfaceName, inetAddress, 0); mDefaultRouteSet = true; } } }

Target:
public void addDefaultRoute() { if ((mInterfaceName != null) && (mDefaultGatewayAddr != 0) && mDefaultRouteSet == false) { if (DBG) { Log.d(TAG, "addDefaultRoute for " + mNetworkInfo.getTypeName() + " (" + mInterfaceName + "), GatewayAddr=" + mDefaultGatewayAddr); } InetAddress inetAddress = NetworkUtils.intToInetAddress(mDefaultGatewayAddr); if (inetAddress == null) { if (DBG) Log.d(TAG, " Unable to add default route. mDefaultGatewayAddr Error"); } else { if (NetworkUtils.addRoute(mInterfaceName, inetAddress, 0)) { mDefaultRouteSet = true; } else { if (DBG) Log.d(TAG, " Unable to add default route."); } } } }
Source:
public void journalAttachDb() throws Exception { mClusterResource.start(); LocalAlluxioCluster mCluster = mClusterResource.get(); TableMaster tableMaster = mCluster.getLocalAlluxioMaster().getMasterProcess().getMaster(TableMaster.class); mException.expect(IOException.class); tableMaster.getDatabase(DB_NAME); tableMaster .attachDatabase(TestUdbFactory.TYPE, "connect", DB_NAME, DB_NAME, Collections.emptyMap()); assertEquals(DB_NAME, tableMaster.getDatabase(DB_NAME).getDbName()); List<String> oldTableNames = tableMaster.getAllTables(DB_NAME); Table tableOld = tableMaster.getTable(DB_NAME, oldTableNames.get(0)); mCluster.stopMasters(); TestDatabase.genTable(2, 2); mCluster.startMasters(); TableMaster tableMasterRestart = mCluster.getLocalAlluxioMaster().getMasterProcess().getMaster(TableMaster.class); List<String> newTableNames = tableMaster.getAllTables(DB_NAME); assertEquals(oldTableNames, newTableNames); Table tableNew = tableMasterRestart.getTable(DB_NAME, newTableNames.get(0)); assertEquals(tableOld.getName(), tableNew.getName()); }

Target:
public void journalAttachDb() throws Exception { mClusterResource.start(); LocalAlluxioCluster mCluster = mClusterResource.get(); TableMaster tableMaster = mCluster.getLocalAlluxioMaster().getMasterProcess().getMaster(TableMaster.class); try { tableMaster.getDatabase(DB_NAME); fail(); } catch (IOException e) { assertEquals("Database " + DB_NAME + " does not exist", e.getMessage()); } tableMaster .attachDatabase(TestUdbFactory.TYPE, "connect", DB_NAME, DB_NAME, Collections.emptyMap()); assertEquals(DB_NAME, tableMaster.getDatabase(DB_NAME).getDbName()); List<String> oldTableNames = tableMaster.getAllTables(DB_NAME); Table tableOld = tableMaster.getTable(DB_NAME, oldTableNames.get(0)); mCluster.stopMasters(); TestDatabase.genTable(2, 2); mCluster.startMasters(); TableMaster tableMasterRestart = mCluster.getLocalAlluxioMaster().getMasterProcess().getMaster(TableMaster.class); List<String> newTableNames = tableMaster.getAllTables(DB_NAME); assertEquals(oldTableNames, newTableNames); Table tableNew = tableMasterRestart.getTable(DB_NAME, newTableNames.get(0)); assertEquals(tableOld.getName(), tableNew.getName()); }
Source:
public boolean saveQuery(final AvroDag avroDag) { final String queryId = avroDag.getQueryId(); try { final File storedFile = getQueryStoreFile(queryId); if (storedFile.exists()) { storedFile.delete(); LOG.log(Level.INFO, "Deleting a duplicate query file"); } storedFile.getParentFile().mkdirs(); final DataFileWriter<AvroDag> dataFileWriter = new DataFileWriter<>(avroDagDatumWriter); dataFileWriter.create(avroDag.getSchema(), storedFile); dataFileWriter.append(avroDag); dataFileWriter.close(); LOG.log(Level.INFO, "Query {0} has been stored to disk.", queryId); return true; } catch (final Exception e) { e.printStackTrace(); return false; } }

Target:
public boolean saveQuery(final AvroDag avroDag) { final String queryId = avroDag.getQueryId(); try { final File storedFile = getQueryStoreFile(queryId); if (storedFile.exists()) { storedFile.delete(); LOG.log(Level.INFO, "Deleting a duplicate query file"); } final DataFileWriter<AvroDag> dataFileWriter = new DataFileWriter<>(avroDagDatumWriter); dataFileWriter.create(avroDag.getSchema(), storedFile); dataFileWriter.append(avroDag); dataFileWriter.close(); LOG.log(Level.INFO, "Query {0} has been stored to disk.", queryId); return true; } catch (final Exception e) { e.printStackTrace(); return false; } }
Source:
public void testCreateTags() throws Exception { List<Tag> newTagsList = ImmutableList.of( new Tag.Builder() .name("Cloudsigma2 New tag") .meta(new HashMap<String, String>()) .build() , new Tag.Builder() .name("Cloudsigma2 tag with resource") .meta(new HashMap<String, String>()) .resources(ImmutableList.of( new TagResource.Builder() .uuid(createdDrive.getUuid()) .build() )) .build()); createdTags = api.createTags(newTagsList); Assert.assertEquals(newTagsList.size(), createdTags.size()); for(int i = 0; i < newTagsList.size(); i++){ checkTag(newTagsList.get(i), createdTags.get(i)); } }

Target:
public void testCreateTags() throws Exception { List<Tag> newTagsList = ImmutableList.of( new Tag.Builder().name("Cloudsigma2 New tag " + System.currentTimeMillis()) .meta(new HashMap<String, String>()).build(), new Tag.Builder().name("Cloudsigma2 tag with resource " + System.currentTimeMillis()) .meta(new HashMap<String, String>()) .resources(ImmutableList.of(new TagResource.Builder().uuid(createdDrive.getUuid()).build())).build()); createdTags = api.createTags(newTagsList); assertEquals(createdTags.size(), newTagsList.size()); for (int i = 0; i < newTagsList.size(); i++) { checkTag(newTagsList.get(i), createdTags.get(i)); } }
Source:
public AdvancedCache<String, V> getCache(String name, MediaType requestedMediaType) { if (isCacheIgnored.test(name)) { throw new ServiceUnavailableException("Cache with name '" + name + "' is temporarily unavailable."); } if (requestedMediaType == null) { throw new NullPointerException("requestedMediaType cannot be null"); } AdvancedCache<String, V> registered = knownCaches.get(name + requestedMediaType.getTypeSubtype()); if (registered != null) return registered; checkCacheAvailable(name); AdvancedCache<String, V> cache = instance.<String, V>getCache(name).getAdvancedCache(); tryRegisterMigrationManager(cache); if (name.equals(PROTOBUF_METADATA_CACHE_NAME)) { cache = (AdvancedCache<String, V>) cache.withEncoding(UTF8CompatEncoder.class); } else { Configuration cacheConfiguration = cache.getCacheConfiguration(); if (cacheConfiguration.memory().storageType() == StorageType.OFF_HEAP) { cache = (AdvancedCache<String, V>) cache.withKeyEncoding(UTF8Encoder.class); } cache = (AdvancedCache<String, V>) cache.withMediaType(TEXT_PLAIN_TYPE, requestedMediaType.toString()); } knownCaches.putIfAbsent(name + requestedMediaType.getTypeSubtype(), cache); return cache; }

Target:
public AdvancedCache<String, V> getCache(String name, MediaType requestedMediaType) { if (isCacheIgnored.test(name)) { throw logger.cacheUnavailable(name); } if (requestedMediaType == null) { throw logger.missingRequiredMediaType(name); } AdvancedCache<String, V> registered = knownCaches.get(name + requestedMediaType.getTypeSubtype()); if (registered != null) return registered; checkCacheAvailable(name); AdvancedCache<String, V> cache = instance.<String, V>getCache(name).getAdvancedCache(); tryRegisterMigrationManager(cache); if (name.equals(PROTOBUF_METADATA_CACHE_NAME)) { cache = (AdvancedCache<String, V>) cache.withEncoding(UTF8CompatEncoder.class); } else { Configuration cacheConfiguration = cache.getCacheConfiguration(); if (cacheConfiguration.memory().storageType() == StorageType.OFF_HEAP) { cache = (AdvancedCache<String, V>) cache.withKeyEncoding(UTF8Encoder.class); } cache = (AdvancedCache<String, V>) cache.withMediaType(TEXT_PLAIN_TYPE, requestedMediaType.toString()); } knownCaches.putIfAbsent(name + requestedMediaType.getTypeSubtype(), cache); return cache; }
Source:
protected Bitmap doInBackground(String... params) { Bitmap result = null; if (params.length != 1) return result; String storagePath = params[0]; try { File picture = new File(storagePath); if (picture != null) { result = BitmapFactory.decodeStream(new FlushedInputStream (new BufferedInputStream(new FileInputStream(picture)))); } if (result == null) { mErrorMessageId = R.string.preview_image_error_unknown_format; Log_OC.e(TAG, "File could not be loaded as a bitmap: " + storagePath); } } catch (OutOfMemoryError e) { Log_OC.e(TAG, "Out of memory occured for file " + storagePath, e); result = loadScaledImage(storagePath); if (result == null) { mErrorMessageId = R.string.preview_image_error_unknown_format; Log_OC.e(TAG, "File could not be loaded as a bitmap: " + storagePath); } } catch (NoSuchFieldError e) { mErrorMessageId = R.string.common_error_unknown; Log_OC.e(TAG, "Error from access to unexisting field despite protection; file " + storagePath, e); } catch (Throwable t) { mErrorMessageId = R.string.common_error_unknown; Log_OC.e(TAG, "Unexpected error loading " + getFile().getStoragePath(), t); } result = ThumbnailsCacheManager.rotateImage(result, storagePath); return result; }

Target:
protected Bitmap doInBackground(String... params) { Bitmap result = null; if (params.length != 1) return result; String storagePath = params[0]; try { File picture = new File(storagePath); if (picture != null) { result = BitmapFactory.decodeStream(new FlushedInputStream (new BufferedInputStream(new FileInputStream(picture)))); } if (result == null) { mErrorMessageId = R.string.preview_image_error_unknown_format; Log_OC.e(TAG, "File could not be loaded as a bitmap: " + storagePath); } } catch (OutOfMemoryError e) { Log_OC.e(TAG, "Out of memory occured for file " + storagePath, e); result = loadScaledImage(storagePath); if (result == null) { mErrorMessageId = R.string.preview_image_error_unknown_format; Log_OC.e(TAG, "File could not be loaded as a bitmap: " + storagePath); } } catch (NoSuchFieldError e) { mErrorMessageId = R.string.common_error_unknown; Log_OC.e(TAG, "Error from access to unexisting field despite protection; file " + storagePath, e); } catch (Throwable t) { mErrorMessageId = R.string.common_error_unknown; Log_OC.e(TAG, "Unexpected error loading " + getFile().getStoragePath(), t); } result = BitmapUtils.rotateImage(result, storagePath); return result; }
Source:
private boolean fixValue(StringProperty property) { if (property == null) { return false; } boolean modified = false; String value = property.getValue(); for (Map.Entry<String, String> translation : this.translations.entrySet()) { if (StringUtils.equals(value, translation.getKey())) { R54690PhenoTips1195DataMigration.this.logger.debug( "Replacing with {}", translation.getKey(), translation.getValue()); property.setValue(translation.getValue()); modified = true; } } return modified; }

Target:
private boolean fixValue(StringProperty property) { if (property == null) { return false; } boolean modified = false; String value = property.getValue(); if (this.translations.containsKey(value)) { R54690PhenoTips1195DataMigration.this.logger.debug( "Replacing with {}", value, this.translations.get(value)); property.setValue(this.translations.get(value)); modified = true; } return modified; }
Source:
public int getLengthInBytes() { return ReadHeadInfo.ITEM_SIZE + mate0ReadSequence.getLength() + mate1ReadSequence.getLength(); }

Target:
public int getLengthInBytes() { int totalBytes = 0; totalBytes += 1; totalBytes += ReadHeadInfo.ITEM_SIZE; totalBytes += thisReadSequence != null ? thisReadSequence.getLength() : 0; totalBytes += mateReadSequence != null ? mateReadSequence.getLength() : 0; return totalBytes; }
Source:
protected DirectiveDefinition(String name, Description description, List<InputValueDefinition> inputValueDefinitions, List<DirectiveLocation> directiveLocations, SourceLocation sourceLocation, List<Comment> comments, IgnoredChars ignoredChars, Map<String, String> additionalData) { super(sourceLocation, comments, ignoredChars, additionalData, description); this.name = name; this.description = description; this.inputValueDefinitions = inputValueDefinitions; this.directiveLocations = directiveLocations; }

Target:
protected DirectiveDefinition(String name, Description description, List<InputValueDefinition> inputValueDefinitions, List<DirectiveLocation> directiveLocations, SourceLocation sourceLocation, List<Comment> comments, IgnoredChars ignoredChars, Map<String, String> additionalData) { super(sourceLocation, comments, ignoredChars, additionalData, description); this.name = name; this.inputValueDefinitions = inputValueDefinitions; this.directiveLocations = directiveLocations; }
Source:
public void stop() { _log.info("Stopping coordinator"); _shutdown = true; _eventQueue.put(CoordinatorEvent.NO_OP_EVENT); if (waitForEventThreadToJoin()) { return; } if (stopEventThread()) { return; } for (String connectorType : _connectors.keySet()) { try { _connectors.get(connectorType).getConnector().stop(); } catch (Exception ex) { _log.warn(String.format( "Connector stop threw an exception for connectorType %s, " + "Swallowing it and continuing shutdown.", connectorType), ex); } } for (DatastreamTask task : _assignedDatastreamTasks.values()) { ((EventProducer) task.getEventProducer()).shutdown(); } _adapter.disconnect(); _log.info("Coordinator stopped"); }

Target:
public void stop() { _log.info("Stopping coordinator"); _shutdown = true; _eventQueue.put(CoordinatorEvent.NO_OP_EVENT); if (waitForEventThreadToJoin()) { return; } if (stopEventThread()) { return; } for (String connectorType : _connectors.keySet()) { try { _connectors.get(connectorType).getConnector().stop(); } catch (Exception ex) { _log.warn(String.format( "Connector stop threw an exception for connectorType %s, " + "Swallowing it and continuing shutdown.", connectorType), ex); } } for (DatastreamTask task : _assignedDatastreamTasks.values()) { ((EventProducer) task.getEventProducer()).shutdown(false); } _adapter.disconnect(); _log.info("Coordinator stopped"); }
Source:
private Map<SystemStreamPartition, TaskSideInputHandler> createSideInputHandlers(Clock clock) { Map<TaskName, Map<String, SideInputsProcessor>> taskSideInputProcessors = createSideInputProcessors(new StorageConfig(config), this.containerModel, this.taskInstanceMetrics); Map<SystemStreamPartition, TaskSideInputHandler> handlers = new HashMap<>(); if (this.hasSideInputs) { containerModel.getTasks().forEach((taskName, taskModel) -> { Map<String, StorageEngine> sideInputStores = getSideInputStores(taskName); Map<String, Set<SystemStreamPartition>> sideInputStoresToSSPs = new HashMap<>(); CountDownLatch taskCountDownLatch = new CountDownLatch(1); this.sideInputTaskLatches.put(taskName, taskCountDownLatch); for (String storeName : sideInputStores.keySet()) { Set<SystemStreamPartition> storeSSPs = this.taskSideInputStoreSSPs.get(taskName).get(storeName); sideInputStoresToSSPs.put(storeName, storeSSPs); } TaskSideInputHandler taskSideInputHandler = new TaskSideInputHandler(taskName, taskModel.getTaskMode(), loggedStoreBaseDirectory, sideInputStores, sideInputStoresToSSPs, taskSideInputProcessors.get(taskName), this.systemAdmins, this.streamMetadataCache, taskCountDownLatch, clock); sideInputStoresToSSPs.values().stream().flatMap(Set::stream).forEach(ssp -> { handlers.put(ssp, taskSideInputHandler); }); LOG.info("Created TaskSideInputHandler for task {}, sideInputStores and loggedStoreBaseDirectory {}", taskName, sideInputStores, loggedStoreBaseDirectory); }); } return handlers; }

Target:
private Map<SystemStreamPartition, TaskSideInputHandler> createSideInputHandlers(Clock clock) { Map<TaskName, Map<String, SideInputsProcessor>> taskSideInputProcessors = createSideInputProcessors(new StorageConfig(config), this.containerModel, this.taskInstanceMetrics); Map<SystemStreamPartition, TaskSideInputHandler> handlers = new HashMap<>(); if (this.hasSideInputs) { containerModel.getTasks().forEach((taskName, taskModel) -> { Map<String, StorageEngine> sideInputStores = getSideInputStores(taskName); Map<String, Set<SystemStreamPartition>> sideInputStoresToSSPs = new HashMap<>(); boolean taskHasSideInputs = false; for (String storeName : sideInputStores.keySet()) { Set<SystemStreamPartition> storeSSPs = this.taskSideInputStoreSSPs.get(taskName).get(storeName); taskHasSideInputs = taskHasSideInputs || !storeSSPs.isEmpty(); sideInputStoresToSSPs.put(storeName, storeSSPs); } if (taskHasSideInputs) { CountDownLatch taskCountDownLatch = new CountDownLatch(1); this.sideInputTaskLatches.put(taskName, taskCountDownLatch); TaskSideInputHandler taskSideInputHandler = new TaskSideInputHandler(taskName, taskModel.getTaskMode(), loggedStoreBaseDirectory, sideInputStores, sideInputStoresToSSPs, taskSideInputProcessors.get(taskName), this.systemAdmins, this.streamMetadataCache, taskCountDownLatch, clock); sideInputStoresToSSPs.values().stream().flatMap(Set::stream).forEach(ssp -> { handlers.put(ssp, taskSideInputHandler); }); LOG.info("Created TaskSideInputHandler for task {}, sideInputStores and loggedStoreBaseDirectory {}", taskName, sideInputStores, loggedStoreBaseDirectory); } }); } return handlers; }
Source:
public void close() { checkState(initialized.get(), "Driver is not initialized"); if (!state.compareAndSet(State.ALIVE, State.NEED_DESTRUCTION)) { return; } exclusiveLock.interruptCurrentOwner(); tryWithLock(() -> TRUE); }

Target:
public void close() { if (!state.compareAndSet(State.ALIVE, State.NEED_DESTRUCTION)) { return; } exclusiveLock.interruptCurrentOwner(); tryWithLock(() -> TRUE); }
Source:
public String interpolate( String path, ProfileActivationContext context ) throws InterpolationException { if ( path == null ) { return null; } RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); final File basedir = context.getProjectDirectory(); if ( basedir != null ) { interpolator.addValueSource( new AbstractValueSource( false ) { @Override public Object getValue( String expression ) { if ( "basedir".equals( expression ) ) { return basedir.getAbsolutePath(); } return null; } } ); } else if ( path.contains( "${basedir}" ) ) { return null; } interpolator.addValueSource( new MapBasedValueSource( context.getProjectProperties() ) ); interpolator.addValueSource( new MapBasedValueSource( context.getUserProperties() ) ); interpolator.addValueSource( new MapBasedValueSource( context.getSystemProperties() ) ); path = interpolator.interpolate( path, "" ); return pathTranslator.alignToBaseDirectory( path, basedir ); }

Target:
public String interpolate( String path, ProfileActivationContext context ) throws InterpolationException { if ( path == null ) { return null; } RegexBasedInterpolator interpolator = new RegexBasedInterpolator(); final File basedir = context.getProjectDirectory(); if ( basedir != null ) { interpolator.addValueSource( new AbstractValueSource( false ) { @Override public Object getValue( String expression ) { if ( "basedir".equals( expression ) ) { return basedir.getAbsolutePath(); } return null; } } ); } else if ( path.contains( "${basedir}" ) ) { return null; } interpolator.addValueSource( new MapBasedValueSource( context.getProjectProperties() ) ); interpolator.addValueSource( new MapBasedValueSource( context.getUserProperties() ) ); interpolator.addValueSource( new MapBasedValueSource( context.getSystemProperties() ) ); String absolutePath = interpolator.interpolate( path, "" ); return pathTranslator.alignToBaseDirectory( absolutePath, basedir ); }
Source:
public NamespacedMBeanServer createMBeanServer(String namespace, MBeanServer parent) throws KeyAlreadyExistsException { requireNonNull(namespace, "namespace is null"); requireNonNull(parent, "parent is null"); String fullNamespace = namespace; if (baseNamespace != null && !baseNamespace.equals(GLOBAL)) { fullNamespace = baseNamespace + NamespacedMBeanServer.SEPARATOR + namespace; } if (registeredEntries.containsKey(namespace)) { throw new KeyAlreadyExistsException(String.format("MBean namespace %s already registered in %s!", namespace, baseNamespace)); } NamespacedMBeanServer namespaceManager = new NamespacedMBeanServer(fullNamespace, parent); registeredEntries.put(namespace, namespaceManager); return namespaceManager; }

Target:
public NamespacedMBeanServer createMBeanServer(String namespace, MBeanServer parent) { requireNonNull(namespace, "namespace is null"); requireNonNull(parent, "parent is null"); String fullNamespace = namespace; if (!isGlobal(baseNamespace)) { fullNamespace = baseNamespace + NamespacedMBeanServer.SEPARATOR + namespace; } NamespacedMBeanServer namespaceManager = new NamespacedMBeanServer(fullNamespace, parent); if (registeredEntries.putIfAbsent(namespace, namespaceManager) != null) { throw new KeyAlreadyExistsException(format("MBean namespace %s already registered in %s", namespace, baseNamespace)); } return namespaceManager; }
Source:
private static Timer timer( MeterRegistry meterRegistry, String interactionModel, SignalType signalType, Tag... tags) { return meterRegistry.timer( String.format("rsocket.%s", interactionModel), Tags.of(tags).and("signal.type", signalType.name())); }

Target:
private static Timer timer( MeterRegistry meterRegistry, String interactionModel, SignalType signalType, Tag... tags) { return meterRegistry.timer( "rsocket." + interactionModel, Tags.of(tags).and("signal.type", signalType.name())); }
Source:
private SampleTissue buildTissue() { SampleTissue tissue = new SampleTissueImpl(); tissue.setTimesReceived(timesReceived); tissue.setTubeNumber(tubeNumber); tissue.setPassageNumber(passageNumber); tissue.setTissueType(tissueType); tissue.setTissueOrigin(tissueOrigin); tissue.setExternalInstituteIdentifier(externalInstituteIdentifier); tissue.setLab(lab); return tissue; }

Target:
private SampleTissue buildTissue() { SampleTissue tissue = new SampleTissueImpl(); tissue.setTimesReceived(timesReceived); tissue.setTubeNumber(tubeNumber); tissue.setPassageNumber(passageNumber); tissue.setTissueType(tissueType); tissue.setTissueOrigin(tissueOrigin); tissue.setExternalInstituteIdentifier(externalInstituteIdentifier); tissue.setLab(lab); tissue.setTissueMaterial(tissueMaterial); tissue.setRegion(region); return tissue; }
Source:
private void setCowVirtualSizeAndQcowCompat(DiskImage diskImage, Image glanceImage) { byte[] imgContent = new byte[72]; ImageDownload downloadImage = getClient().images().download(glanceImage.getId()).execute(); try (InputStream inputStream = downloadImage.getInputStream()) { int bytesRead = inputStream.read(imgContent, 0, imgContent.length); if (bytesRead != imgContent.length) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to read image header: " + bytesRead); } } catch (IOException e) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to download image"); } ByteBuffer b = ByteBuffer.wrap(imgContent); int qcow2Signature = b.getInt(); int qcow2Version = b.getInt(); if (qcow2Signature == QCOW2_SIGNATURE && QCOW2_VERSIONS.contains(qcow2Version)) { b.position(QCOW2_SIZE_OFFSET); diskImage.setSize(b.getLong()); if (qcow2Version == 2) { diskImage.setQcowCompat(QcowCompat.QCOW2_V2); } else { diskImage.setQcowCompat(QcowCompat.QCOW2_V3); } } else { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNRECOGNIZED_IMAGE_FORMAT, "Unable to recognize QCOW2 format"); } }

Target:
private void setCowVirtualSizeAndQcowCompat(DiskImage diskImage, Image glanceImage) { byte[] imgContent = new byte[72]; ImageDownload downloadImage = getClient().images().download(glanceImage.getId()).execute(); try (InputStream inputStream = downloadImage.getInputStream()) { int bytesRead = inputStream.read(imgContent, 0, imgContent.length); if (bytesRead != imgContent.length) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to read image header: " + bytesRead); } } catch (IOException e) { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNABLE_TO_DOWNLOAD_IMAGE, "Unable to download image"); } ByteBuffer b = ByteBuffer.wrap(imgContent); int qcow2Signature = b.getInt(); int qcow2Version = b.getInt(); if (qcow2Signature == QCOW2_SIGNATURE && QCOW2_VERSIONS.contains(qcow2Version)) { b.position(QCOW2_SIZE_OFFSET); diskImage.setSize(b.getLong()); diskImage.setQcowCompat(QcowCompat.forQcowHeaderVersion(qcow2Version)); } else { throw new OpenStackImageException( OpenStackImageException.ErrorType.UNRECOGNIZED_IMAGE_FORMAT, "Unable to recognize QCOW2 format"); } }
Source:
public LibraryContextSwitchEvent( EventType eventType ) { this.eventType = eventType; }

Target:
public LibraryContextSwitchEvent( EventType eventType ) { checkNotNull( "eventType", eventType ); this.eventType = eventType; }
Source:
private Cache<KeyValuePair<String, Class>, Object> getCache() { if (cache == null) { synchronized (this) { if (cache == null) { if (cacheManager.getCacheConfiguration(QUERY_CACHE_NAME) == null) { cacheManager.defineConfiguration(QUERY_CACHE_NAME, getDefaultQueryCacheConfig().build()); } cache = cacheManager.getCache(QUERY_CACHE_NAME); } } } return cache; }

Target:
private Cache<KeyValuePair<String, Class>, Object> getCache() { Cache<KeyValuePair<String, Class>, Object> cache = lazyCache; if (cache == null) { synchronized (this) { if (lazyCache == null) { if (cacheManager.getCacheConfiguration(QUERY_CACHE_NAME) == null) { cacheManager.defineConfiguration(QUERY_CACHE_NAME, getDefaultQueryCacheConfig().build()); } cache = lazyCache = cacheManager.getCache(QUERY_CACHE_NAME); } } } return cache; }
Source:
public void start() { int INTERVAL = 1; expirationExecutor.scheduleAtFixedRate(() -> doDataExpiration(dataRegion), INTERVAL, INTERVAL, SECONDS); }

Target:
public void start() { int INTERVAL = 1; expirationExecutor.scheduleWithFixedDelay(() -> doDataExpiration(dataRegion), INTERVAL, INTERVAL, SECONDS); }
Source:
public LuceneQueryParsingResult<TypeMetadata> transform(FilterParsingResult<TypeMetadata> parsingResult, Map<String, Object> namedParameters, Class<?> targetedType) { this.namedParameters = namedParameters; queryBuilder = queryContextBuilder.forEntity(targetedType).get(); entityType = parsingResult.getTargetEntityMetadata(); AnalyzerReference analyzerReference = ((ExtendedSearchIntegrator) searchFactory).getAnalyzerReference(targetedType); if(analyzerReference.is(LuceneAnalyzerReference.class)) { entityAnalyzer = analyzerReference.unwrap(LuceneAnalyzerReference.class).getAnalyzer(); } else { isAnalyzerRemote = true; } Query query = makeQuery(parsingResult.getWhereClause()); if (query instanceof BooleanQuery) { BooleanQuery booleanQuery = (BooleanQuery) query; boolean allClausesAreMustNot = true; for (BooleanClause clause : booleanQuery.clauses()) { if (clause.getOccur() != BooleanClause.Occur.MUST_NOT) { allClausesAreMustNot = false; break; } } if (allClausesAreMustNot) { BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (BooleanClause clause : booleanQuery.clauses()) { builder.add(clause.getQuery(), BooleanClause.Occur.MUST_NOT); } builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.FILTER); query = builder.build(); } } Sort sort = makeSort(parsingResult.getSortFields()); return new LuceneQueryParsingResult<>(query, parsingResult.getTargetEntityName(), parsingResult.getTargetEntityMetadata(), parsingResult.getProjections(), sort); }

Target:
public LuceneQueryParsingResult<TypeMetadata> transform(FilterParsingResult<TypeMetadata> parsingResult, Map<String, Object> namedParameters, Class<?> targetedType) { this.namedParameters = namedParameters; queryBuilder = queryContextBuilder.forEntity(targetedType).get(); entityType = parsingResult.getTargetEntityMetadata(); AnalyzerReference analyzerReference = ((ExtendedSearchIntegrator) searchFactory).getAnalyzerReference(targetedType); if(analyzerReference.is(LuceneAnalyzerReference.class)) { entityAnalyzer = analyzerReference.unwrap(LuceneAnalyzerReference.class).getAnalyzer(); } else { isAnalyzerRemote = true; } Query query = makeQuery(parsingResult.getWhereClause()); if (query instanceof BooleanQuery) { BooleanQuery booleanQuery = (BooleanQuery) query; boolean allClausesAreMustNot = booleanQuery.clauses().stream().allMatch(c -> c.getOccur() == BooleanClause.Occur.MUST_NOT); if (allClausesAreMustNot) { BooleanQuery.Builder builder = new BooleanQuery.Builder(); for (BooleanClause clause : booleanQuery.clauses()) { builder.add(clause.getQuery(), BooleanClause.Occur.MUST_NOT); } builder.add(new MatchAllDocsQuery(), BooleanClause.Occur.FILTER); query = builder.build(); } } Sort sort = makeSort(parsingResult.getSortFields()); return new LuceneQueryParsingResult<>(query, parsingResult.getTargetEntityName(), parsingResult.getTargetEntityMetadata(), parsingResult.getProjections(), sort); }
Source:
public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { context.getHeaders().putSingle("BookWriter", "TheBook"); final Object property = context.getProperty("x-book"); if (property != null) { context.getHeaders().putSingle("X-Book-Header", property); } context.proceed(); }

Target:
public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException { context.getHeaders().putSingle("BookWriter", "TheBook"); final Object property = context.getProperty("property"); if (property != null) { context.getHeaders().putSingle("X-Property-WriterInterceptor", property); } context.proceed(); }
Source:
public Response get(@PathParam("userId") String userId, @QueryParam("howMany") int howMany, @QueryParam("offset") int offset, @QueryParam("considerKnownItems") boolean considerKnownItems, @QueryParam("rescorerParams") List<String> rescorerParams) { return Response.status(Response.Status.OK.getStatusCode()).entity("").build(); }

Target:
public Response get(@PathParam("userId") String userId, @QueryParam("howMany") int howMany, @QueryParam("offset") int offset, @QueryParam("considerKnownItems") boolean considerKnownItems, @QueryParam("rescorerParams") List<String> rescorerParams) { return Response.ok().entity("").build(); }
Source:
public O compute(final Iterable<I> input, final O output) { if (sumFunc == null) { sumFunc = (Sum<Iterable<I>, DoubleType>) ops.op(Sum.class, output, input); } if (sizeFunc == null) { sizeFunc = (Size<Iterable<I>>) ops.op(Size.class, output, input); } final LongType size = sizeFunc.compute(input, new LongType()); final DoubleType sum = sumFunc.compute(input, new DoubleType()); output.setReal( sum.get()/size.get()); return output; }

Target:
public O compute(final Iterable<I> input, final O output) { if (sumFunc == null) { sumFunc = (Sum<Iterable<I>, O>) ops.op(Sum.class, output, input); } if (sizeFunc == null) { sizeFunc = (Size<Iterable<I>>) ops.op(Size.class, output, input); } final O result; if (output == null) { final Object o = new DoubleType(); @SuppressWarnings("unchecked") final O newOutput = (O) o; result = newOutput; } else result = output; final LongType size = sizeFunc.compute(input, new LongType()); final O sum = sumFunc.compute(input, result.createVariable()); double mean = sum.getRealDouble() / size.getRealDouble(); result.setReal(mean); return result; }
Source:
public void clearSelection() { List<Integer> selection = getSelectedItems(); selectedItems.clear(); for (Integer i : selection) { notifyItemChanged(i); } }

Target:
public void clearSelection() { List<Integer> selection = getSelectedItems(); selectedItems.clear(); for (Integer i : selection) { notifyItemRemoved(i); } }
Source:
public BPELSituationAwareBuildProcessBuilder() { try { this.planHandler = new BPELPlanHandler(); this.serviceInstanceInitializer = new SimplePlanBuilderServiceInstanceHandler(); this.nodeRelationInstanceHandler = new NodeRelationInstanceVariablesHandler(this.planHandler); this.sitRegistrationPlugin = new SituationTriggerRegistration(); this.correlationHandler = new CorrelationIDInitializer(); this.fragments = new BPELProcessFragments(); } catch (final ParserConfigurationException e) { BPELSituationAwareBuildProcessBuilder.LOG.error("Error while initializing BuildPlanHandler", e); } this.propertyInitializer = new PropertyVariableHandler(this.planHandler); this.propertyOutputInitializer = new ServiceTemplateBoundaryPropertyMappingsToOutputHandler(); this.finalizer = new BPELFinalizer(); }

Target:
public BPELSituationAwareBuildProcessBuilder() { try { this.planHandler = new BPELPlanHandler(); this.serviceInstanceInitializer = new SimplePlanBuilderServiceInstanceHandler(); this.nodeRelationInstanceHandler = new NodeRelationInstanceVariablesHandler(this.planHandler); this.sitRegistrationPlugin = new SituationTriggerRegistration(); this.correlationHandler = new CorrelationIDInitializer(); this.fragments = new BPELProcessFragments(); this.propertyInitializer = new PropertyVariableHandler(this.planHandler); } catch (final ParserConfigurationException e) { BPELSituationAwareBuildProcessBuilder.LOG.error("Error while initializing BuildPlanHandler, couldn't initialize internal parser", e); } this.propertyOutputInitializer = new ServiceTemplateBoundaryPropertyMappingsToOutputHandler(); this.finalizer = new BPELFinalizer(); }
Source:
protected void writeEntityToNBT(NBTTagCompound tags) { if(type == null) setDead(); else { tags.setString("Type", type.shortName); if(player != null) tags.setString("Player", player.get().getName()); tags.setFloat("RotationYaw", axes.getYaw()); tags.setFloat("RotationPitch", axes.getPitch()); } }

Target:
protected void writeEntityToNBT(NBTTagCompound tags) { if(type == null) setDead(); else { tags.setString("Type", type.shortName); if(player.isPresent()) tags.setString("Player", player.get().getName()); tags.setFloat("RotationYaw", axes.getYaw()); tags.setFloat("RotationPitch", axes.getPitch()); } }
Source:
private void finishDownloading() { DownloadManager.Query downloadQuery = new DownloadManager.Query() .setFilterById(downloadId); Cursor downloadInformation = getDownloadManager(context).query(downloadQuery); downloadInformation.moveToFirst(); int downloadStatus = downloadInformation.getInt( downloadInformation.getColumnIndex(DownloadManager.COLUMN_STATUS)); if (downloadStatus == DownloadManager.STATUS_SUCCESSFUL) { String downloadUri = downloadInformation.getString( downloadInformation.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)); try { URI uri = new URI(downloadUri); downloadUri = uri.getPath(); } catch (URISyntaxException e) { e.printStackTrace(); } File file = new File(downloadUri); Uri contentUri = FileProvider.getUriForFile(context, "org.amahi.anywhere.fileprovider", file); BusProvider.getBus().post(new FileDownloadedEvent(contentUri)); } else { BusProvider.getBus().post(new FileDownloadFailedEvent()); } downloadInformation.close(); }

Target:
private void finishDownloading() { DownloadManager.Query downloadQuery = new DownloadManager.Query() .setFilterById(downloadId); Cursor downloadInformation = getDownloadManager(context).query(downloadQuery); downloadInformation.moveToFirst(); int downloadStatus = downloadInformation.getInt( downloadInformation.getColumnIndex(DownloadManager.COLUMN_STATUS)); if (downloadStatus == DownloadManager.STATUS_SUCCESSFUL) { String downloadUri = downloadInformation.getString( downloadInformation.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)); if (downloadUri.substring(0, 7).matches("file://")) { downloadUri = downloadUri.substring(7); } try { URI uri = new URI(downloadUri); downloadUri = uri.getPath(); } catch (URISyntaxException e) { Log.e("Downloader", "Invalid Uri: " + downloadUri); } File file = new File(downloadUri); Uri contentUri = FileProvider.getUriForFile(context, "org.amahi.anywhere.fileprovider", file); BusProvider.getBus().post(new FileDownloadedEvent(contentUri)); } else { BusProvider.getBus().post(new FileDownloadFailedEvent()); } downloadInformation.close(); }