auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void execute(final String[] args) { Opts opts = new Opts(); opts.parseArgs(Initialize.class.getName(), args); try { AccumuloConfiguration acuConf = SiteConfiguration.getInstance(); SecurityUtil.serverLogin(acuConf); Configuration conf = CachedConfiguration.getInstance(); VolumeManager fs = VolumeManagerImpl.get(acuConf); if (opts.resetSecurity) { AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(HdfsZooInstance.getInstance())); if (isInitialized(fs)) { if (!opts.forceResetSecurity) { String secret = acuConf.get(Property.INSTANCE_SECRET); ConsoleReader c = getConsoleReader(); String userEnteredSecret = c.readLine("WARNING: This will remove all users from Accumulo! If you wish to proceed enter the instance secret: ", '*'); if (userEnteredSecret != null && !secret.equals(userEnteredSecret)) { log.info("Aborted reset security: Instance secret did not match what is in accumulo-site.xml"); return; } log.info("Beginning user initiated reset security on accumulo."); } final String rootUser = getRootUserName(opts); opts.rootpass = getRootPassword(opts, rootUser); initSecurity(context, opts, HdfsZooInstance.getInstance().getInstanceID(), rootUser); } else { log.error("FATAL: Attempted to reset security on accumulo before it was initialized"); } } if (opts.addVolumes) { addVolumes(fs); } if (!opts.resetSecurity && !opts.addVolumes) if (!doInit(opts, conf, fs)) System.exit(-1); } catch (Exception e) { log.error("Fatal exception", e); throw new RuntimeException(e); } }

Target:
public void execute(final String[] args) { Opts opts = new Opts(); opts.parseArgs(Initialize.class.getName(), args); try { AccumuloConfiguration acuConf = SiteConfiguration.getInstance(); SecurityUtil.serverLogin(acuConf); Configuration conf = CachedConfiguration.getInstance(); VolumeManager fs = VolumeManagerImpl.get(acuConf); if (opts.resetSecurity) { log.info("Resetting security on accumulo."); Instance instance = HdfsZooInstance.getInstance(); AccumuloServerContext context = new AccumuloServerContext(new ServerConfigurationFactory(instance)); if (isInitialized(fs)) { if (!opts.forceResetSecurity) { ConsoleReader c = getConsoleReader(); String userEnteredName = c.readLine("WARNING: This will remove all users from Accumulo! If you wish to proceed enter the instance name: "); if (userEnteredName != null && !instance.getInstanceName().equals(userEnteredName)) { log.error("Aborted reset security: Instance name did not match current instance."); return; } } final String rootUser = getRootUserName(opts); opts.rootpass = getRootPassword(opts, rootUser); initSecurity(context, opts, HdfsZooInstance.getInstance().getInstanceID(), rootUser); } else { log.error("FATAL: Attempted to reset security on accumulo before it was initialized"); } } if (opts.addVolumes) { addVolumes(fs); } if (!opts.resetSecurity && !opts.addVolumes) if (!doInit(opts, conf, fs)) System.exit(-1); } catch (Exception e) { log.error("Fatal exception", e); throw new RuntimeException(e); } }
Source:
public static void migrateLegacyIdGenerator( @NonNull Context context, @NonNull WorkDatabase workDatabase) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREFERENCE_FILE_KEY, MODE_PRIVATE); if (sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY) || sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY)) { int nextJobId = sharedPreferences.getInt(NEXT_JOB_SCHEDULER_ID_KEY, INITIAL_ID); int nextAlarmId = sharedPreferences.getInt(NEXT_ALARM_MANAGER_ID_KEY, INITIAL_ID); workDatabase.beginTransaction(); try { IdGenerator idGenerator = new IdGenerator(workDatabase); idGenerator.update(NEXT_JOB_SCHEDULER_ID_KEY, nextJobId); idGenerator.update(NEXT_ALARM_MANAGER_ID_KEY, nextAlarmId); sharedPreferences.edit() .remove(NEXT_JOB_SCHEDULER_ID_KEY) .remove(NEXT_ALARM_MANAGER_ID_KEY) .apply(); workDatabase.setTransactionSuccessful(); } finally { workDatabase.endTransaction(); } } }

Target:
public static void migrateLegacyIdGenerator( @NonNull Context context, @NonNull WorkDatabase workDatabase) { SharedPreferences sharedPreferences = context.getSharedPreferences(PREFERENCE_FILE_KEY, MODE_PRIVATE); if (sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY) || sharedPreferences.contains(NEXT_JOB_SCHEDULER_ID_KEY)) { int nextJobId = sharedPreferences.getInt(NEXT_JOB_SCHEDULER_ID_KEY, INITIAL_ID); int nextAlarmId = sharedPreferences.getInt(NEXT_ALARM_MANAGER_ID_KEY, INITIAL_ID); workDatabase.beginTransaction(); try { IdGenerator idGenerator = new IdGenerator(workDatabase); idGenerator.update(NEXT_JOB_SCHEDULER_ID_KEY, nextJobId); idGenerator.update(NEXT_ALARM_MANAGER_ID_KEY, nextAlarmId); sharedPreferences.edit() .clear() .apply(); workDatabase.setTransactionSuccessful(); } finally { workDatabase.endTransaction(); } } }
Source:
public UDFCollectionValueField(UDFCollectionDefinition udfDefinition, String sortKey, JSONObject value) { super(udfDefinition.getCollectionKey(), udfDefinition.getLabel()); this.sortKey = sortKey; this.value = value; this.udfDef = udfDefinition; this.nameToType = udfDefinition.groupTypesByName(); }

Target:
public UDFCollectionValueField(UDFCollectionDefinition udfDefinition, String sortKey, JSONObject value) { super(udfDefinition.getCollectionKey(), udfDefinition.getLabel()); this.sortKey = sortKey; this.value = value; this.udfDef = udfDefinition; this.subFieldDefinitionsByName = udfDefinition.groupTypesByName(); }
Source:
public void clearCacheForTable(RpcController controller, ClearCacheForTableRequest request, RpcCallback<ClearCacheForTableResponse> done) { ByteString tenantId = request.getTenantId(); ByteString schemaName = request.getSchemaName(); ByteString tableName = request.getTableName(); byte[] tableKey = SchemaUtil.getTableKey(tenantId.toByteArray(), schemaName.toByteArray() , tableName.toByteArray()); ImmutableBytesPtr key = new ImmutableBytesPtr(tableKey); Cache<ImmutableBytesPtr, PTable> metaDataCache = GlobalCache.getInstance(this.env).getMetaDataCache(); PTable table = metaDataCache.getIfPresent(key); long ts = table.getTimeStamp() + 1; HRegion region = env.getRegion(); List<Mutation> mutations = new ArrayList<Mutation>(); Put p = new Put(tableKey); p.add(TABLE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, ts, ByteUtil.EMPTY_BYTE_ARRAY); mutations.add(p); try { region.mutateRowsWithLocks(mutations, Collections.<byte[]> emptySet()); } catch (Throwable t) { logger.error("clearCacheForTable failed to update the latest ts ", t); ProtobufUtil.setControllerException(controller, ServerUtil.createIOException( SchemaUtil.getTableName(schemaName.toString(), tableName.toString()), t)); } metaDataCache.invalidate(key); }

Target:
public void clearCacheForTable(RpcController controller, ClearCacheForTableRequest request, RpcCallback<ClearCacheForTableResponse> done) { ByteString tenantId = request.getTenantId(); ByteString schemaName = request.getSchemaName(); ByteString tableName = request.getTableName(); byte[] tableKey = SchemaUtil.getTableKey(tenantId.toByteArray(), schemaName.toByteArray(), tableName.toByteArray()); ImmutableBytesPtr key = new ImmutableBytesPtr(tableKey); try { PTable table = doGetTable(tableKey, request.getClientTimestamp()); if (table != null) { Cache<ImmutableBytesPtr, PTable> metaDataCache = GlobalCache.getInstance(this.env).getMetaDataCache(); long ts = table.getTimeStamp() + 1; HRegion region = env.getRegion(); List<Mutation> mutations = new ArrayList<Mutation>(); Put p = new Put(tableKey); p.add(TABLE_FAMILY_BYTES, QueryConstants.EMPTY_COLUMN_BYTES, ts, ByteUtil.EMPTY_BYTE_ARRAY); mutations.add(p); region.mutateRowsWithLocks(mutations, Collections.<byte[]> emptySet()); metaDataCache.invalidate(key); } } catch (Throwable t) { logger.error("clearCacheForTable failed to update the latest ts ", t); ProtobufUtil.setControllerException(controller, ServerUtil.createIOException( SchemaUtil.getTableName(schemaName.toString(), tableName.toString()), t)); } }
Source:
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { log.debug("handleApiAction " + name + " " + params.toString()); if (ACTION_DOWNLOAD_LATEST_RELEASE.equals(name)) { if (this.downloadLatestRelease()) { return ApiResponseElement.OK; } else { return ApiResponseElement.FAIL; } } else if (ACTION_INSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getAddOn(id); if (ao == null) { throw new ApiException(Type.DOES_NOT_EXIST); } else { Vector<String> v = new Vector<String>(); v.add(id); extension.installAddOns(v); return ApiResponseElement.OK; } } else if (ACTION_UNINSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getAddOn(id); if (ao == null || ! extension.getInstalledAddOns().contains(ao)) { throw new ApiException(Type.DOES_NOT_EXIST); } else { Vector<String> v = new Vector<String>(); v.add(id); extension.uninstallAddOns(v); return ApiResponseElement.OK; } } else { throw new ApiException(ApiException.Type.BAD_ACTION); } }

Target:
public ApiResponse handleApiAction(String name, JSONObject params) throws ApiException { log.debug("handleApiAction " + name + " " + params.toString()); if (ACTION_DOWNLOAD_LATEST_RELEASE.equals(name)) { if (this.downloadLatestRelease()) { return ApiResponseElement.OK; } else { return ApiResponseElement.FAIL; } } else if (ACTION_INSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getAddOn(id); if (ao == null) { throw new ApiException(Type.DOES_NOT_EXIST); } else { List<String> l = new ArrayList<String>(); l.add(id); String errorMessages = extension.installAddOns(l); if (errorMessages.length() == 0) { return ApiResponseElement.OK; } else { throw new ApiException(ApiException.Type.INTERNAL_ERROR, errorMessages); } } } else if (ACTION_UNINSTALL_ADDON.equals(name)) { String id = params.getString(PARAM_ID); AddOn ao = extension.getLocalVersionInfo().getAddOn(id); if (ao == null) { throw new ApiException(Type.DOES_NOT_EXIST); } else { List<String> l = new ArrayList<String>(); l.add(id); String errorMessages = extension.uninstallAddOns(l); if (errorMessages.length() == 0) { return ApiResponseElement.OK; } else { throw new ApiException(ApiException.Type.INTERNAL_ERROR, errorMessages); } } } else { throw new ApiException(ApiException.Type.BAD_ACTION); } }
Source:
private void onPlaybackParameterChanged(final PlaybackParameters parameters) { if (parameters != null) { if (menu != null && player != null) { MenuItem item = menu.findItem(R.id.action_playback_speed); item.setTitle(formatSpeed(parameters.speed)); } } }

Target:
private void onPlaybackParameterChanged(final PlaybackParameters parameters) { if (parameters != null) { if (menu != null && player != null) { final MenuItem item = menu.findItem(R.id.action_playback_speed); item.setTitle(formatSpeed(parameters.speed)); } } }
Source:
private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); this.dialog = PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); }

Target:
private UriSchemeHandlerPreferencePage openPreferenceAndGetPage() { Shell shell = Display.getCurrent().getActiveShell(); this.dialog = PreferencesUtil.createPreferenceDialogOn(shell, "org.eclipse.ui.preferencePages.General.LinkHandlers", null, null); this.dialog.setBlockOnOpen(false); this.dialog.open(); return (UriSchemeHandlerPreferencePage) this.dialog.getSelectedPage(); }
Source:
public static void startup(Properties p) { try { Context.addProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); Context.getSchedulerService().onStartup(); } finally { Context.removeProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); } }

Target:
public static void startup(Properties p) { String val = p.getProperty("scheduler.username", null); if (val != null) { SchedulerConstants.SCHEDULER_DEFAULT_USERNAME = val; log.warn("Deprecated runtime property: scheduler.username. Value set in global_property in database now."); } val = p.getProperty("scheduler.password", null); if (val != null) { SchedulerConstants.SCHEDULER_DEFAULT_PASSWORD = val; log.warn("Deprecated runtime property: scheduler.username. Value set in global_property in database now."); } try { Context.addProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); Context.getSchedulerService().onStartup(); } finally { Context.removeProxyPrivilege(PrivilegeConstants.MANAGE_SCHEDULER); } }
Source:
public static void replaceFile(File src, File target) throws IOException { if (!src.renameTo(target)) { int retries = 5; while (target.exists() && !target.delete() && retries-- >= 0) { try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IOException("replaceFile interrupted"); } } if (!src.renameTo(target)) { throw new IOException("Unable to rename " + src + " to " + target); } } }

Target:
public static void replaceFile(File src, File target) throws IOException { if (!src.renameTo(target)) { int retries = 5; while (target.exists() && !target.delete() && retries-- >= 0) { try { Thread.sleep(1000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new InterruptedIOException("replaceFile interrupted"); } } if (!src.renameTo(target)) { throw new IOException("Unable to rename " + src + " to " + target); } } }
Source:
protected IXYPresentationProvider getPresentationProvider() { IXYPresentationProvider presentationProvider = fXYPresentationProvider.get(getTrace()); if (presentationProvider == null) { return new XYPresentationProvider(); } return presentationProvider; }

Target:
protected IXYPresentationProvider getPresentationProvider() { IXYPresentationProvider presentationProvider = fXYPresentationProvider.get(getTrace()); if (presentationProvider == null) { presentationProvider = new XYPresentationProvider(); fXYPresentationProvider.putIfAbsent(getTrace(), presentationProvider); } return presentationProvider; }
Source:
public int callJavaUserDefinedAggregateCoordinatorEnd() { m_udfBuffer.clear(); m_udfBuffer.getInt(); int functionId = m_udfBuffer.getInt(); UserDefinedAggregateFunctionRunner udafRunner = m_functionManager.getAggregateFunctionRunnerById(functionId); Throwable throwable = null; Object returnValue = null; try { assert(udafRunner != null); returnValue = udafRunner.end(); VoltType returnType = udafRunner.getReturnType(); if (returnType.isVariableLength() && ! VoltType.isVoltNullValue(returnValue)) { int sizeRequired = 1 + 4; switch(returnType) { case VARBINARY: if (returnValue instanceof byte[]) { sizeRequired += ((byte[])returnValue).length; } else if (returnValue instanceof Byte[]) { sizeRequired += ((Byte[])returnValue).length; } break; case STRING: sizeRequired += ((String)returnValue).getBytes(Constants.UTF8ENCODING).length; break; case GEOGRAPHY: sizeRequired += ((GeographyValue)returnValue).getLengthInBytes(); break; default: } if (sizeRequired > m_udfBuffer.capacity()) { resizeUDFBuffer(sizeRequired); } } m_udfBuffer.clear(); UserDefinedFunctionRunner.writeValueToBuffer(m_udfBuffer, returnType, returnValue); return 0; } catch (InvocationTargetException ex1) { throwable = ex1.getCause(); } catch (Throwable ex2) { throwable = ex2; } try { assert(throwable != null); byte[] errorMsg = throwable.toString().getBytes(Constants.UTF8ENCODING); if (errorMsg.length + 4 > m_udfBuffer.capacity()) { resizeUDFBuffer(errorMsg.length + 4); } m_udfBuffer.clear(); SerializationHelper.writeVarbinary(errorMsg, m_udfBuffer); } catch (IOException e) { throw new RuntimeException(e); } return -1; }

Target:
public int callJavaUserDefinedAggregateCoordinatorEnd() { UserDefinedAggregateFunctionRunner udafRunner = getUdafRunner(); int udafIndex = m_udfBuffer.getInt(); Object returnValue = null; try { assert(udafRunner != null); returnValue = udafRunner.end(udafIndex); VoltType returnType = udafRunner.getReturnType(); resizeUDAFBuffer(returnValue, returnType); m_udfBuffer.clear(); UserDefinedAggregateFunctionRunner.writeValueToBuffer(m_udfBuffer, returnType, returnValue); return 0; } catch (InvocationTargetException ex1) { handleUDAFError(ex1.getCause()); } catch (Throwable ex2) { handleUDAFError(ex2); } return -1; }
Source:
public void beforeTemplating(PreparedStatement stmt, StatementContext ctx) throws SQLException { final Set<String> alreadyDefined = ctx.getAttributes().keySet(); final Binding binding = ctx.getBinding(); final Handler handler = new Handler(); binding.getNames().stream() .filter(name -> !alreadyDefined.contains(name)) .forEach(name -> binding.findForName(name, ctx).ifPresent( a -> handler.define(name, a, ctx))); }

Target:
public void beforeTemplating(PreparedStatement stmt, StatementContext ctx) { final Set<String> alreadyDefined = ctx.getAttributes().keySet(); final Binding binding = ctx.getBinding(); final SetNullHandler handler = new SetNullHandler(); binding.getNames().stream() .filter(name -> !alreadyDefined.contains(name)) .forEach(name -> binding.findForName(name, ctx).ifPresent( a -> handler.define(name, a, ctx))); }
Source:
public Object perform(InvocationContext ctx) throws Throwable { Configuration cacheConfig = null; if (cacheConfigurationName != null) { cacheConfig = cacheManager.getCacheConfiguration(cacheConfigurationName); if (cacheConfig == null) { if (MapReduceTask.DEFAULT_TMP_CACHE_CONFIGURATION_NAME.equals(cacheConfigurationName)) { cacheConfig = new ConfigurationBuilder().unsafe().unreliableReturnValues(true).clustering() .cacheMode(CacheMode.DIST_SYNC).hash().numOwners(2).sync().build(); log.debugf("Using default tmp cache configuration, defined as ", cacheNameToCreate); } else { throw new IllegalStateException("Cache configuration " + cacheConfigurationName + " is not defined on node " + this.cacheManager.getAddress()); } } } cacheManager.defineConfiguration(cacheNameToCreate, cacheConfig); cacheManager.getCache(cacheNameToCreate); final long startTime = System.nanoTime(); final long maxRunTime = TimeUnit.MILLISECONDS.toNanos(cacheConfig.clustering().stateTransfer().timeout()); int expectedSize = cacheManager.getTransport().getMembers().size(); while (stm.getCacheTopology().getMembers().size() != expectedSize && stm.getCacheTopology().getPendingCH() != null) { Thread.sleep(50); long estimatedRunTime = System.nanoTime() - startTime; if (estimatedRunTime > maxRunTime) { String message = String.format( "Creating tmp cache %s timed out waiting for rebalancing to complete on node %s ", cacheNameToCreate, cacheManager.getAddress()); log.error(message); throw new RuntimeException(message); } } log.debugf("Defined and started cache %s", cacheNameToCreate); return true; }

Target:
public Object perform(InvocationContext ctx) throws Throwable { Configuration cacheConfig = null; if (cacheConfigurationName != null) { cacheConfig = cacheManager.getCacheConfiguration(cacheConfigurationName); if (cacheConfig == null) { if (MapReduceTask.DEFAULT_TMP_CACHE_CONFIGURATION_NAME.equals(cacheConfigurationName)) { cacheConfig = new ConfigurationBuilder().unsafe().unreliableReturnValues(true).clustering() .cacheMode(CacheMode.DIST_SYNC).hash().numOwners(2).sync().build(); log.debugf("Using default tmp cache configuration, defined as ", cacheNameToCreate); } else { throw new IllegalStateException("Cache configuration " + cacheConfigurationName + " is not defined on node " + this.cacheManager.getAddress()); } } } cacheManager.defineConfiguration(cacheNameToCreate, cacheConfig); cacheManager.getCache(cacheNameToCreate); final long startTime = System.nanoTime(); final long maxRunTime = TimeUnit.MILLISECONDS.toNanos(cacheConfig.clustering().stateTransfer().timeout()); int expectedSize = cacheManager.getTransport().getMembers().size(); while (stm.getCacheTopology().getMembers().size() != expectedSize && stm.getCacheTopology().getPendingCH() != null) { Thread.sleep(50); long estimatedRunTime = System.nanoTime() - startTime; if (estimatedRunTime > maxRunTime) { throw log.creatingTmpCacheTimedOut(cacheNameToCreate, cacheManager.getAddress()); } } log.debugf("Defined and started cache %s", cacheNameToCreate); return true; }
Source:
public void networkNameTakenByVdsmName() { when(network.getName()).thenReturn("vdsm-name"); when(network.getId()).thenReturn(DEFAULT_GUID); Network network2 = new Network(); network2.setVdsmName("vdsm-name"); network2.setId(OTHER_GUID); when(networkDao.getAllForDataCenter(any())).thenReturn(Arrays.asList(network, network2)); assertThat(validator.networkNameNotUsedAsVdsmName(), failsWith(EngineMessage.NETWORK_NAME_USED_AS_INTERFACE_NAME)); }

Target:
public void networkNameTakenByVdsmName() { when(network.getName()).thenReturn("vdsm-name"); when(network.getId()).thenReturn(DEFAULT_GUID); Network network2 = new Network(); network2.setVdsmName("vdsm-name"); network2.setId(OTHER_GUID); when(networkDao.getAllForDataCenter(any())).thenReturn(Arrays.asList(network, network2)); assertThat(validator.networkNameNotUsedAsVdsmName(), failsWith(EngineMessage.NETWORK_NAME_USED_AS_VDSM_INTERFACE_NAME)); }
Source:
private boolean checkClusterFeaturesSupported(List<VDS> vdss, Set<SupportedAdditionalClusterFeature> newFeaturesEnabled) { Set<String> featuresNamesEnabled = new HashSet<>(); for (SupportedAdditionalClusterFeature feature : newFeaturesEnabled) { featuresNamesEnabled.add(feature.getFeature().getName()); } for (VDS vds : vdss) { Set<String> featuresSupportedByVds = vdsDynamicDao.getSupportedHostFeaturesByVdsId(vds.getId()); if (!featuresSupportedByVds.containsAll(featuresNamesEnabled)) { return false; } } return true; }

Target:
private boolean checkClusterFeaturesSupported(List<VDS> vdss, Set<SupportedAdditionalClusterFeature> newFeaturesEnabled) { Set<String> featuresNamesEnabled = new HashSet<>(); for (SupportedAdditionalClusterFeature feature : newFeaturesEnabled) { featuresNamesEnabled.add(feature.getFeature().getName()); } for (VDS vds : vdss) { Set<String> featuresSupportedByVds = hostFeatureDao.getSupportedHostFeaturesByHostId(vds.getId()); if (!featuresSupportedByVds.containsAll(featuresNamesEnabled)) { return false; } } return true; }
Source:
public void updateUserId(String id,String newEmail) { try { List<String> locksSucceeded = new ArrayList<String>(); List<String> locks = new ArrayList<String>(); locks.add(SECURE_UPDATE_USER_ANY); locks.add(SECURE_UPDATE_USER_OWN); locks.add(SECURE_UPDATE_USER_OWN_EMAIL); locksSucceeded = unlock(locks, userReference(id)); if(locksSucceeded.contains(SECURE_UPDATE_USER_ANY) || locksSucceeded.contains(SECURE_UPDATE_USER_OWN_EMAIL )|| locksSucceeded.contains(SECURE_UPDATE_USER_OWN)) { UserEdit user = m_storage.edit(id); if (user == null) { M_log.error("Unexpected error when trying to validate the user"); return; } user.setEid(newEmail); user.setEmail(newEmail); commitEdit(user); } else { M_log.error("User edit did not pass permission checks"); return; } } catch (UserAlreadyDefinedException e) { M_log.error(e.getStackTrace()); } catch (UserPermissionException e) { M_log.error(e.getStackTrace()); } }

Target:
public boolean updateUserId(String id,String newEmail) { try { List<String> locksSucceeded = new ArrayList<String>(); List<String> locks = new ArrayList<String>(); locks.add(SECURE_UPDATE_USER_ANY); locks.add(SECURE_UPDATE_USER_OWN); locks.add(SECURE_UPDATE_USER_OWN_EMAIL); locksSucceeded = unlock(locks, userReference(id)); if(!locksSucceeded.isEmpty()) { UserEdit user = m_storage.edit(id); if (user == null) { M_log.warn("Can't find user " + id + " when trying to update email address"); return false; } user.setEid(newEmail); user.setEmail(newEmail); commitEdit(user); return true; } else { M_log.warn("User with id: "+id+" failed permission checks" ); return false; } } catch (UserPermissionException e) { M_log.warn("You do not have sufficient permission to edit the user with Id: "+id, e); return false; } catch (UserAlreadyDefinedException e) { M_log.error("A users already exists with EID of: "+id +"having email :"+ newEmail, e); return false; } }
Source:
void onResponseReceive() { networkMetrics.requestResponseRoundTripTime.update(System.currentTimeMillis() - requestSentTimeMs); networkMetrics.requestResponseTotalTime.update(System.currentTimeMillis() - requestQueuedTimeMs); }

Target:
void onResponseReceive() { networkMetrics.requestResponseRoundTripTime.update(System.currentTimeMillis() - requestDequeuedAtMs); networkMetrics.requestResponseTotalTime.update(System.currentTimeMillis() - requestQueuedAtMs); }
Source:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitIndexOrSliceExpr(@NotNull GoIndexOrSliceExpr o) { Trinity<GoExpression, GoExpression, GoExpression> indexes = o.getIndices(); if (indexes.third == null && indexes.second instanceof GoCallExpr && o.getExpression() != null && o.getExpression().getReference() != null) { if (o.getExpression() instanceof GoReferenceExpression && ((GoReferenceExpression)o.getExpression()).getQualifier() != null) { return; } GoCallExpr callExpr = (GoCallExpr)indexes.second; if (callExpr.getExpression().textMatches("len") && callExpr.getArgumentList().getExpressionList().size() == 1) { GoExpression secondRightExpr = callExpr.getArgumentList().getExpressionList().get(0); if (secondRightExpr.getReference() != null && o.getExpression().getReference().resolve() == secondRightExpr.getReference().resolve()) { holder.registerProblem(callExpr, "Redundant index", ProblemHighlightType.LIKE_UNUSED_SYMBOL, DELETE_REDUNDANT_INDEX_QUICK_FIX); } } } } }; }

Target:
protected GoVisitor buildGoVisitor(@NotNull final ProblemsHolder holder, @NotNull LocalInspectionToolSession session) { return new GoVisitor() { @Override public void visitIndexOrSliceExpr(@NotNull GoIndexOrSliceExpr o) { if (!(o.getExpression() instanceof GoReferenceExpression) || o.getExpression().getReference() == null || ((GoReferenceExpression)o.getExpression()).getQualifier() != null) { return; } Trinity<GoExpression, GoExpression, GoExpression> indexes = o.getIndices(); if (indexes.third == null && indexes.second instanceof GoCallExpr) { GoCallExpr callExpr = (GoCallExpr)indexes.second; GoExpression function = callExpr.getExpression(); if (function.textMatches("len") && function instanceof GoReferenceExpression && GoPsiImplUtil.builtin(((GoReferenceExpression)function).resolve()) && callExpr.getArgumentList().getExpressionList().size() == 1) { GoExpression secondRightExpr = callExpr.getArgumentList().getExpressionList().get(0); if (secondRightExpr.getReference() != null && o.getExpression().getReference().resolve() == secondRightExpr.getReference().resolve()) { holder.registerProblem(callExpr, "Redundant index", ProblemHighlightType.LIKE_UNUSED_SYMBOL, DELETE_REDUNDANT_INDEX_QUICK_FIX); } } } } }; }
Source:
public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, 1); final IFileInfo sourceInfo = fetchInfo(EFS.NONE, null); if (sourceInfo.isDirectory()) { copyDirectory(sourceInfo, destination, options, subMonitor.split(1)); } else { copyFile(sourceInfo, destination, options, subMonitor.split(1)); } }

Target:
public void copy(IFileStore destination, int options, IProgressMonitor monitor) throws CoreException { final IFileInfo sourceInfo = fetchInfo(EFS.NONE, null); if (sourceInfo.isDirectory()) { copyDirectory(sourceInfo, destination, options, monitor); } else { copyFile(sourceInfo, destination, options, monitor); } }
Source:
public static TimeZoneKey getTimeZoneKeyForOffset(long offsetMinutes) { if (offsetMinutes == 0) { return UTC_KEY; } if (offsetMinutes < OFFSET_TIME_ZONE_MIN || offsetMinutes > OFFSET_TIME_ZONE_MAX) { throw new PrestoException(INVALID_FUNCTION_ARGUMENT, "Invalid offset minutes " + offsetMinutes); } TimeZoneKey timeZoneKey = OFFSET_TIME_ZONE_KEYS[((int) offsetMinutes) - OFFSET_TIME_ZONE_MIN]; if (timeZoneKey == null) { throw new TimeZoneNotSupportedException(zoneIdForOffset(offsetMinutes)); } return timeZoneKey; }

Target:
public static TimeZoneKey getTimeZoneKeyForOffset(long offsetMinutes) { if (offsetMinutes == 0) { return UTC_KEY; } checkArgument(offsetMinutes >= OFFSET_TIME_ZONE_MIN && offsetMinutes <= OFFSET_TIME_ZONE_MAX, "Invalid offset minutes %s", offsetMinutes); TimeZoneKey timeZoneKey = OFFSET_TIME_ZONE_KEYS[((int) offsetMinutes) - OFFSET_TIME_ZONE_MIN]; if (timeZoneKey == null) { throw new TimeZoneNotSupportedException(zoneIdForOffset(offsetMinutes)); } return timeZoneKey; }
Source:
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { AggregatedCalledFunctionStatistics statistics=((FlamegraphEvent) event).getStatistics(); ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>(); builder.put(String.valueOf(Messages.FlameGraph_Duration), String.format("%s", FORMATTER.format(event.getDuration()))); builder.put(String.valueOf(Messages.FlameGraph_SelfTime), String.format("%s", FORMATTER.format(((FlamegraphEvent) event).getSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_NbCalls), String.valueOf(NumberFormat.getIntegerInstance().format(statistics.getNbCalls()))); builder.put(String.valueOf(Messages.FlameGraph_MaxDuration), String.format("%s", FORMATTER.format((statistics.getMaxDuration())))); builder.put(String.valueOf(Messages.FlameGraph_MinDuration), String.format("%s", FORMATTER.format(statistics.getMinDuration()))); builder.put(String.valueOf(Messages.FlameGraph_AverageDuration), String.format("%s", FORMATTER.format(statistics.getAverage()))); builder.put(String.valueOf(Messages.FlameGraph_MaxSelfTime), String.format("%s", FORMATTER.format(statistics.getMaxSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_MinSelfTime), String.format("%s", FORMATTER.format(statistics.getMinSelfTime()))); if(statistics.getStdDev()!= Double.NaN){ builder.put(String.valueOf(Messages.FlameGraph_MinSelfTime+1), String.format("%s", FORMATTER.format(statistics.getStdDev()))); } return builder.build(); }

Target:
public Map<String, String> getEventHoverToolTipInfo(ITimeEvent event, long hoverTime) { AggregatedCalledFunctionStatistics statistics = ((FlamegraphEvent) event).getStatistics(); ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<>(); builder.put(String.valueOf(Messages.FlameGraph_Duration), String.format("%s", FORMATTER.format(event.getDuration()))); builder.put(String.valueOf(Messages.FlameGraph_SelfTime), String.format("%s", FORMATTER.format(((FlamegraphEvent) event).getSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_NbCalls), String.valueOf(NumberFormat.getIntegerInstance().format(statistics.getNbCalls()))); builder.put(String.valueOf(Messages.FlameGraph_MaxDuration), String.format("%s", FORMATTER.format((statistics.getMaxDuration())))); builder.put(String.valueOf(Messages.FlameGraph_MinDuration), String.format("%s", FORMATTER.format(statistics.getMinDuration()))); builder.put(String.valueOf(Messages.FlameGraph_AverageDuration), String.format("%s", FORMATTER.format(statistics.getAverage()))); builder.put(String.valueOf(Messages.FlameGraph_MaxSelfTime), String.format("%s", FORMATTER.format(statistics.getMaxSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_MinSelfTime), String.format("%s", FORMATTER.format(statistics.getMinSelfTime()))); builder.put(String.valueOf(Messages.FlameGraph_Deviation), String.format("%s", FORMATTER.format(statistics.getStdDev()))); return builder.build(); }
Source:
private static JMXServer startJMXServerWithPortRanges(Iterator<Integer> ports) { JMXServer successfullyStartedServer = null; while (ports.hasNext() && successfullyStartedServer == null) { JMXServer server = new JMXServer(); int port = ports.next(); if (port == 0) { port = tryPokeForNewPort(); } try { server.start(port); LOG.info("Started JMX server on port " + port + "."); successfullyStartedServer = server; } catch (IOException ioe) { LOG.debug("Could not start JMX server on port " + port + ".", ioe); try { server.stop(); } catch (Exception e) { LOG.debug("Could not stop JMX server.", e); } } } return successfullyStartedServer; }

Target:
private static JMXServer startJMXServerWithPortRanges(Iterator<Integer> ports) { JMXServer successfullyStartedServer = null; while (ports.hasNext() && successfullyStartedServer == null) { JMXServer server = new JMXServer(); int port = ports.next(); try { server.start(port); LOG.info("Started JMX server on port " + port + "."); successfullyStartedServer = server; } catch (IOException ioe) { LOG.debug("Could not start JMX server on port " + port + ".", ioe); try { server.stop(); } catch (Exception e) { LOG.debug("Could not stop JMX server.", e); } } } return successfullyStartedServer; }
Source:
private static void handleTraceContentChanged(TmfTraceElement traceElement) { Display.getDefault().asyncExec(() -> { boolean opened = false; for (ITmfTrace openedTrace : TmfTraceManager.getInstance().getOpenedTraces()) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(openedTrace)) { if (traceElement.getResource().equals(trace.getResource())) { opened = true; break; } } } if (!opened) { traceElement.deleteSupplementaryResources(); return; } if (!promptQueue.isEmpty()) { if (!promptQueue.contains(traceElement)) { promptQueue.add(traceElement); } return; } promptQueue.add(traceElement); TmfTraceElement prompting = traceElement; while (prompting != null) { boolean always = Activator.getDefault().getPreferenceStore().getBoolean(ITmfUIPreferences.ALWAYS_CLOSE_ON_RESOURCE_CHANGE); if (always) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } else { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog messageDialog = new MessageDialog(shell, Messages.TmfProjectRegistry_TraceChangedDialogTitle, null, NLS.bind(Messages.TmfProjectRegistry_TraceChangedDialogMessage, prompting.getElementPath()), MessageDialog.QUESTION, 2, IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL, Messages.TmfProjectRegistry_Always); int returnCode = messageDialog.open(); if (returnCode >= 1) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } if (returnCode == 2) { Activator.getDefault().getPreferenceStore().setValue(ITmfUIPreferences.ALWAYS_CLOSE_ON_RESOURCE_CHANGE, true); } } prompting = promptQueue.poll(); } }); }

Target:
private static void handleTraceContentChanged(TmfTraceElement traceElement) { Display.getDefault().asyncExec(() -> { boolean opened = false; for (ITmfTrace openedTrace : TmfTraceManager.getInstance().getOpenedTraces()) { for (ITmfTrace trace : TmfTraceManager.getTraceSet(openedTrace)) { if (traceElement.getResource().equals(trace.getResource())) { opened = true; break; } } } if (!opened) { traceElement.deleteSupplementaryResources(); return; } if (!promptQueue.isEmpty()) { if (!promptQueue.contains(traceElement)) { promptQueue.add(traceElement); } return; } TmfTraceElement prompting = traceElement; while (prompting != null) { boolean always = Activator.getDefault().getPreferenceStore().getBoolean(ITmfUIPreferences.ALWAYS_CLOSE_ON_RESOURCE_CHANGE); if (always) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } else { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); MessageDialog messageDialog = new MessageDialog(shell, Messages.TmfProjectRegistry_TraceChangedDialogTitle, null, NLS.bind(Messages.TmfProjectRegistry_TraceChangedDialogMessage, prompting.getElementPath()), MessageDialog.QUESTION, 2, IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL, Messages.TmfProjectRegistry_Always); int returnCode = messageDialog.open(); if (returnCode >= 1) { prompting.closeEditors(); prompting.deleteSupplementaryResources(); } if (returnCode == 2) { Activator.getDefault().getPreferenceStore().setValue(ITmfUIPreferences.ALWAYS_CLOSE_ON_RESOURCE_CHANGE, true); } } prompting = promptQueue.poll(); } }); }
Source:
public EntrySplitter build() { return new EntrySplitter(this); }

Target:
public EntrySplitter build() { if (entrySeparator == keyValueSeparator) { throw new IllegalArgumentException("entrySeparator == keyValueSeparator"); } return new EntrySplitter(this); }
Source:
public void executeJsTests() { int totalCases = page.getTotalCases(); int failedCases = page.getFailedCases(); print("Executed " + totalCases + " JavaScript Unit tests..."); int expectedFailedCases = "firefox".equals(TestProperties.BROWSER) ? 0 : 4; assertEquals(expectedFailedCases, failedCases); assertTrue(totalCases != 0); print("As expected, 0 failed tests out of " + totalCases + " tests."); float coverage = page.getCoverage(); print(coverage + "% of scripts covered, the minimum requirement is " + MIN_COVERAGE_REQUIREMENT + "%"); assertTrue(coverage >= MIN_COVERAGE_REQUIREMENT); }

Target:
public void executeJsTests() { int totalCases = page.getTotalCases(); int failedCases = page.getFailedCases(); print("Executed " + totalCases + " JavaScript Unit tests..."); int expectedFailedCases = "firefox".equals(TestProperties.BROWSER) ? 0 : 4; assertEquals(expectedFailedCases, failedCases); assertTrue(totalCases != 0); print("As expected, " + expectedFailedCases + " failed tests out of " + totalCases + " tests."); float coverage = page.getCoverage(); print(coverage + "% of scripts covered, the minimum requirement is " + MIN_COVERAGE_REQUIREMENT + "%"); assertTrue(coverage >= MIN_COVERAGE_REQUIREMENT); }
Source:
public Response returnToAuthor(@PathParam("id") String idSupplied, String jsonBody) { if (jsonBody == null || jsonBody.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must supply JSON to this API endpoint and it must contain a reason for returning the dataset."); } StringReader rdr = new StringReader(jsonBody); JsonObject json = Json.createReader(rdr).readObject(); try { Dataset dataset = findDatasetOrDie(idSupplied); String reasonForReturn = null; try { reasonForReturn = json.getString("reasonForReturn"); } catch (NullPointerException ex) { return error(Response.Status.BAD_REQUEST, "The JSON you supplied does not contain a reason for returning the dataset to the author(s)."); } if (reasonForReturn == null || reasonForReturn.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must enter a reason for returning a dataset to the author(s)."); } int numCharsAllowed = 200; int numCharsProvided = reasonForReturn.length(); if (numCharsProvided > numCharsAllowed) { return error(Response.Status.BAD_REQUEST, "You supplied " + numCharsProvided + " in the reason for return but only " + numCharsAllowed + " characters are allowed."); } DatasetVersion datasetVersion = dataset.getLatestVersion(); Dataset updatedDataset = execCommand(new ReturnDatasetToAuthorCommand(createDataverseRequest(findUserOrDie()), dataset)); DatasetVersion latestVersion = updatedDataset.getLatestVersion(); Comment comment = new Comment(reasonForReturn, latestVersion); datasetSvc.saveComment(comment); boolean inReview = latestVersion.isInReview(); JsonObjectBuilder result = Json.createObjectBuilder(); result.add("inReview", inReview); result.add("message", "Dataset id " + updatedDataset.getId() + " has been sent back to the author(s)."); return ok(result); } catch (WrappedResponse wr) { return wr.getResponse(); } }

Target:
public Response returnToAuthor(@PathParam("id") String idSupplied, String jsonBody) { if (jsonBody == null || jsonBody.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must supply JSON to this API endpoint and it must contain a reason for returning the dataset."); } StringReader rdr = new StringReader(jsonBody); JsonObject json = Json.createReader(rdr).readObject(); try { Dataset dataset = findDatasetOrDie(idSupplied); String reasonForReturn = null; reasonForReturn = json.getString("reasonForReturn"); if (reasonForReturn == null || reasonForReturn.isEmpty()) { return error(Response.Status.BAD_REQUEST, "You must enter a reason for returning a dataset to the author(s)."); } AuthenticatedUser authenticatedUser = findAuthenticatedUserOrDie(); Dataset updatedDataset = execCommand(new ReturnDatasetToAuthorCommand(createDataverseRequest(authenticatedUser), dataset, reasonForReturn )); DatasetVersion latestVersion = updatedDataset.getLatestVersion(); boolean inReview = latestVersion.isInReview(); JsonObjectBuilder result = Json.createObjectBuilder(); result.add("inReview", inReview); result.add("message", "Dataset id " + updatedDataset.getId() + " has been sent back to the author(s)."); return ok(result); } catch (WrappedResponse wr) { return wr.getResponse(); } }
Source:
public Connection createConnection(String userName, String password) throws JMSException { Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (JMSException e) { logger.error( "JMS Exception while creating connection through factory '" + this.connectionFactoryString + "' " + e.getMessage(), e); if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }

Target:
public Connection createConnection(String userName, String password) throws JMSException { Connection connection = null; try { if (JMSConstants.JMS_SPEC_VERSION_1_1.equals(jmsSpec)) { if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { connection = ((QueueConnectionFactory) (this.connectionFactory)) .createQueueConnection(userName, password); } else if (this.destinationType.equals(JMSConstants.JMSDestinationType.TOPIC)) { connection = ((TopicConnectionFactory) (this.connectionFactory)) .createTopicConnection(userName, password); if (isDurable) { connection.setClientID(clientId); } } return connection; } else { QueueConnectionFactory qConFac = null; TopicConnectionFactory tConFac = null; if (this.destinationType.equals(JMSConstants.JMSDestinationType.QUEUE)) { qConFac = (QueueConnectionFactory) this.connectionFactory; } else { tConFac = (TopicConnectionFactory) this.connectionFactory; } if (null != qConFac) { connection = qConFac.createQueueConnection(userName, password); } else if (null != tConFac) { connection = tConFac.createTopicConnection(userName, password); } if (isDurable && !isSharedSubscription) { connection.setClientID(clientId); } return connection; } } catch (JMSException e) { if (null != connection) { try { connection.close(); } catch (Exception ex) { logger.error("Error while closing the connection", ex); } } throw e; } }
Source:
private Result runJUnit(final String... args) { return jUnitCore.runMain(new RealSystem(), args); }

Target:
private Result runJUnit(final String... args) { return jUnitCore.runMain(new TestSystem(), args); }
Source:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionManager functionManager) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); MethodHandle methodHandle; if (keyType.getJavaType() == boolean.class) { methodHandle = METHOD_HANDLE_BOOLEAN; } else if (keyType.getJavaType() == long.class) { methodHandle = METHOD_HANDLE_LONG; } else if (keyType.getJavaType() == double.class) { methodHandle = METHOD_HANDLE_DOUBLE; } else if (keyType.getJavaType() == Slice.class) { methodHandle = METHOD_HANDLE_SLICE; } else { methodHandle = METHOD_HANDLE_OBJECT; } methodHandle = MethodHandles.insertArguments(methodHandle, 0, legacyMissingKey); MissingKeyExceptionFactory missingKeyExceptionFactory = new MissingKeyExceptionFactory(functionManager, keyType); methodHandle = methodHandle.bindTo(missingKeyExceptionFactory).bindTo(keyType).bindTo(valueType); methodHandle = methodHandle.asType(methodHandle.type().changeReturnType(Primitives.wrap(valueType.getJavaType()))); return new ScalarFunctionImplementation( true, ImmutableList.of( valueTypeArgumentProperty(RETURN_NULL_ON_NULL), valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), methodHandle, isDeterministic()); }

Target:
public ScalarFunctionImplementation specialize(BoundVariables boundVariables, int arity, TypeManager typeManager, FunctionManager functionManager) { Type keyType = boundVariables.getTypeVariable("K"); Type valueType = boundVariables.getTypeVariable("V"); MethodHandle methodHandle; if (keyType.getJavaType() == boolean.class) { methodHandle = METHOD_HANDLE_BOOLEAN; } else if (keyType.getJavaType() == long.class) { methodHandle = METHOD_HANDLE_LONG; } else if (keyType.getJavaType() == double.class) { methodHandle = METHOD_HANDLE_DOUBLE; } else if (keyType.getJavaType() == Slice.class) { methodHandle = METHOD_HANDLE_SLICE; } else { methodHandle = METHOD_HANDLE_OBJECT; } methodHandle = MethodHandles.insertArguments(methodHandle, 0, legacyMissingKey); MissingKeyExceptionFactory missingKeyExceptionFactory = new MissingKeyExceptionFactory(functionManager, keyType); methodHandle = methodHandle.bindTo(missingKeyExceptionFactory).bindTo(valueType); methodHandle = methodHandle.asType(methodHandle.type().changeReturnType(Primitives.wrap(valueType.getJavaType()))); return new ScalarFunctionImplementation( true, ImmutableList.of( valueTypeArgumentProperty(RETURN_NULL_ON_NULL), valueTypeArgumentProperty(RETURN_NULL_ON_NULL)), methodHandle, isDeterministic()); }
Source:
public Mono<Response<BlockBlobItem>> uploadWithResponse(BlobParallelUploadOptions options) { try { Objects.requireNonNull(options); final Map<String, String> metadataFinal = options.getMetadata() == null ? new HashMap<>() : options.getMetadata(); options.setMetadata(metadataFinal); Flux<ByteBuffer> data = options.getDataFlux() == null ? Utility.convertStreamToByteBuffer( options.getDataStream(), options.getLength(), BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : options.getDataFlux(); Mono<Flux<ByteBuffer>> dataFinal = prepareToSendEncryptedRequest(data, metadataFinal); return dataFinal.flatMap(df -> super.uploadWithResponse(new BlobParallelUploadOptions(df) .setParallelTransferOptions(options.getParallelTransferOptions()).setHeaders(options.getHeaders()) .setMetadata(options.getMetadata()).setTags(options.getTags()).setTier(options.getTier()) .setRequestConditions(options.getRequestConditions()).setTimeout(options.getTimeout()))); } catch (RuntimeException ex) { return monoError(logger, ex); } }

Target:
public Mono<Response<BlockBlobItem>> uploadWithResponse(BlobParallelUploadOptions options) { try { StorageImplUtils.assertNotNull("options", options); final Map<String, String> metadataFinal = options.getMetadata() == null ? new HashMap<>() : options.getMetadata(); Flux<ByteBuffer> data = options.getDataFlux() == null ? Utility.convertStreamToByteBuffer( options.getDataStream(), options.getLength(), BLOB_DEFAULT_UPLOAD_BLOCK_SIZE) : options.getDataFlux(); Mono<Flux<ByteBuffer>> dataFinal = prepareToSendEncryptedRequest(data, metadataFinal); return dataFinal.flatMap(df -> super.uploadWithResponse(new BlobParallelUploadOptions(df) .setParallelTransferOptions(options.getParallelTransferOptions()).setHeaders(options.getHeaders()) .setMetadata(metadataFinal).setTags(options.getTags()).setTier(options.getTier()) .setRequestConditions(options.getRequestConditions()))); } catch (RuntimeException ex) { return monoError(logger, ex); } }