auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testPushSimple() throws Exception { JGitTestUtil.writeTrashFile(tdb.getRepository(), "a.bin", "1234567"); git.add().addFilepattern("a.bin").call(); RevCommit commit = git.commit().setMessage("add lfs blob").call(); git.push().call(); ObjectId id = commit.getId(); try(RevWalk walk = new RevWalk(rdb)) { RevCommit rc = walk.parseCommit(id); try (TreeWalk tw = new TreeWalk(walk.getObjectReader())) { tw.addTree(rc.getTree()); tw.setFilter(PathFilter.create("a.bin")); tw.next(); assertEquals(tw.getPathString(), "a.bin"); ObjectLoader ldr = walk.getObjectReader() .open(tw.getObjectId(0), Constants.OBJ_BLOB); try(InputStream is = ldr.openStream()) { assertEquals( "version <LINK_0>\noid sha256:8bb0cf6eb9b17d0f7d22b456f121257dc1254e1f01665370476383ea776df414\nsize 7\n", new String(IO .readWholeStream(is, (int) ldr.getSize()) .array())); } } } assertEquals( "[POST /lfs/objects/batch 200, PUT /lfs/objects/8bb0cf6eb9b17d0f7d22b456f121257dc1254e1f01665370476383ea776df414 200]", server.getRequests().toString()); }

Target:
public void testPushSimple() throws Exception { JGitTestUtil.writeTrashFile(localDb.getRepository(), "a.bin", "1234567"); git.add().addFilepattern("a.bin").call(); RevCommit commit = git.commit().setMessage("add lfs blob").call(); git.push().call(); ObjectId id = commit.getId(); try (RevWalk walk = new RevWalk(remoteDb)) { RevCommit rc = walk.parseCommit(id); try (TreeWalk tw = new TreeWalk(walk.getObjectReader())) { tw.addTree(rc.getTree()); tw.setFilter(PathFilter.create("a.bin")); tw.next(); assertEquals(tw.getPathString(), "a.bin"); ObjectLoader ldr = walk.getObjectReader() .open(tw.getObjectId(0), Constants.OBJ_BLOB); try(InputStream is = ldr.openStream()) { assertEquals( "version <LINK_0>\noid sha256:8bb0cf6eb9b17d0f7d22b456f121257dc1254e1f01665370476383ea776df414\nsize 7\n", new String(IO .readWholeStream(is, (int) ldr.getSize()) .array())); } } } assertEquals( "[POST /lfs/objects/batch 200, PUT /lfs/objects/8bb0cf6eb9b17d0f7d22b456f121257dc1254e1f01665370476383ea776df414 200]", server.getRequests().toString()); }
Source:
private void checkIfAppVersionUpgraded(Context context) { PrefManager.AppInfoPrefManager prefManager = new PrefManager.AppInfoPrefManager(context); long previousVersionCode = prefManager.getAppVersionCode(); final long curVersionCode = (long) BuildConfig.VERSION_CODE; if (previousVersionCode < 0) { prefManager.setAppVersionCode(curVersionCode); prefManager.setAppVersionName(BuildConfig.VERSION_NAME); } else if (previousVersionCode < curVersionCode) { final String previousVersionName = prefManager.getAppVersionName(); prefManager.setAppVersionCode(curVersionCode); prefManager.setAppVersionName(BuildConfig.VERSION_NAME); onAppUpdated(previousVersionCode, curVersionCode, previousVersionName, BuildConfig.VERSION_NAME); } }

Target:
private void checkIfAppVersionUpgraded(Context context) { PrefManager.AppInfoPrefManager prefManager = new PrefManager.AppInfoPrefManager(context); long previousVersionCode = prefManager.getAppVersionCode(); final long curVersionCode = BuildConfig.VERSION_CODE; if (previousVersionCode < 0) { prefManager.setAppVersionCode(curVersionCode); prefManager.setAppVersionName(BuildConfig.VERSION_NAME); logger.debug("App opened first time, VersionCode:"+curVersionCode); } else if (previousVersionCode < curVersionCode) { final String previousVersionName = prefManager.getAppVersionName(); prefManager.setAppVersionCode(curVersionCode); prefManager.setAppVersionName(BuildConfig.VERSION_NAME); logger.debug("App updated, VersionCode:"+previousVersionCode+"->"+curVersionCode); onAppUpdated(previousVersionCode, curVersionCode, previousVersionName, BuildConfig.VERSION_NAME); } }
Source:
public void setUp() throws Exception { super.setUp(); keyValueService.createTable(TABLE_CONS, AtlasDbConstants.GENERIC_TABLE_METADATA); keyValueService.createTable(TABLE_THOR, new TableMetadata(new NameMetadataDescription(), new ColumnMetadataDescription(), ConflictHandler.RETRY_ON_WRITE_WRITE, TableMetadataPersistence.CachePriority.WARM, false, 0, false, TableMetadataPersistence.SweepStrategy.THOROUGH, false, TableMetadataPersistence.LogSafety.UNSAFE) .persistToBytes()); }

Target:
public void setUp() throws Exception { super.setUp(); keyValueService.createTable(TABLE_CONS, AtlasDbConstants.GENERIC_TABLE_METADATA); keyValueService.createTable(TABLE_THOR, TableMetadataPersistence.TableMetadata.newBuilder( TableMetadataPersistence.TableMetadata.parseFrom(AtlasDbConstants.GENERIC_TABLE_METADATA)) .setSweepStrategy(TableMetadataPersistence.SweepStrategy.THOROUGH) .build() .toByteArray()); }
Source:
private void OnVmAndPoolLoad() { if (getvms() != null && getpools() != null) { ArrayList<vm_pools> filteredPools = new ArrayList<vm_pools>(); for (vm_pools pool : getpools()) { boolean found = false; for (VM vm : getvms()) { if (vm.getVmPoolId() != null && vm.getVmPoolId().equals(pool.getvm_pool_id())) { found = true; break; } } if (!found) { filteredPools.add(pool); } } List all = Linq.Concat(getvms(), filteredPools); Linq.Sort(all, new Linq.VmAndPoolByNameComparer()); ArrayList<Model> items = new ArrayList<Model>(); for (Object item : all) { UserPortalItemModel model = new UserPortalItemModel(this); model.setEntity(item); items.add(model); updateConsoleModel(model); } setCanConnectAutomatically(canConnectAutomatically(items)); setItems(items); setvms(null); setpools(null); getSearchCompletedEvent().raise(this, EventArgs.Empty); } }

Target:
public void OnVmAndPoolLoad() { if (getvms() != null && getpools() != null) { ArrayList<VmPool> filteredPools = new ArrayList<VmPool>(); for (VmPool pool : getpools()) { boolean found = false; for (VM vm : getvms()) { if (vm.getVmPoolId() != null && vm.getVmPoolId().equals(pool.getVmPoolId())) { found = true; break; } } if (!found) { filteredPools.add(pool); } } List all = Linq.Concat(getvms(), filteredPools); Linq.Sort(all, new Linq.VmAndPoolByNameComparer()); ArrayList<Model> items = new ArrayList<Model>(); for (Object item : all) { UserPortalItemModel model = new UserPortalItemModel(this); model.setEntity(item); items.add(model); updateConsoleModel(model); } setCanConnectAutomatically(canConnectAutomatically(items)); setItems(items); setvms(null); setpools(null); getSearchCompletedEvent().raise(this, EventArgs.Empty); } }
Source:
public int lastIndexOf(Object o) { for (int i = list.size(); i >= 0; ++i) { B b = func.project(list.get(i)); if (b == null) { if (o == null) return i; } else { if (b.equals(o)) return i; } } return -1; }

Target:
public int lastIndexOf(Object o) { for (int i = list.size(); i >= 0; --i) { B b = func.project(list.get(i)); if (b == null) { if (o == null) return i; } else { if (b.equals(o)) return i; } } return -1; }
Source:
public void exchangeToken() throws IOException { StsTokenExchangeRequest stsTokenExchangeRequest = StsTokenExchangeRequest.newBuilder(CREDENTIAL, SUBJECT_TOKEN_TYPE).build(); StsRequestHandler requestHandler = StsRequestHandler.newBuilder( TOKEN_URL, stsTokenExchangeRequest, MOCK_HTTP_TRANSPORT_FACTORY.create().createRequestFactory()) .build(); StsTokenExchangeResponse response = requestHandler.exchangeToken(); MockStsServiceTransport transport = MOCK_HTTP_TRANSPORT_FACTORY.transport; assertThat(response.getAccessToken().getTokenValue()).isEqualTo(transport.getAccessToken()); assertThat(response.getTokenType()).isEqualTo(transport.getTokenType()); assertThat(response.getIssuedTokenType()).isEqualTo(transport.getIssuedTokenType()); assertThat(response.getExpiresIn()).isEqualTo(transport.getExpiresIn()); GenericData expectedRequestContent = new GenericData() .set("grant_type", TOKEN_EXCHANGE_GRANT_TYPE) .set("scope", CLOUD_PLATFORM_SCOPE) .set("requested_token_type", DEFAULT_REQUESTED_TOKEN_TYPE) .set("subject_token_type", stsTokenExchangeRequest.getSubjectTokenType()) .set("subject_token", stsTokenExchangeRequest.getSubjectToken()); MockLowLevelHttpRequest request = transport.getRequest(); Map<String, String> actualRequestContent = TestUtils.parseQuery(request.getContentAsString()); assertThat(actualRequestContent).isEqualTo(expectedRequestContent); }

Target:
public void exchangeToken() throws IOException { StsTokenExchangeRequest stsTokenExchangeRequest = StsTokenExchangeRequest.newBuilder(CREDENTIAL, SUBJECT_TOKEN_TYPE).build(); StsRequestHandler requestHandler = StsRequestHandler.newBuilder( TOKEN_URL, stsTokenExchangeRequest, transport.createRequestFactory()) .build(); StsTokenExchangeResponse response = requestHandler.exchangeToken(); assertThat(response.getAccessToken().getTokenValue()).isEqualTo(transport.getAccessToken()); assertThat(response.getTokenType()).isEqualTo(transport.getTokenType()); assertThat(response.getIssuedTokenType()).isEqualTo(transport.getIssuedTokenType()); assertThat(response.getExpiresIn()).isEqualTo(transport.getExpiresIn()); GenericData expectedRequestContent = new GenericData() .set("grant_type", TOKEN_EXCHANGE_GRANT_TYPE) .set("scope", CLOUD_PLATFORM_SCOPE) .set("requested_token_type", DEFAULT_REQUESTED_TOKEN_TYPE) .set("subject_token_type", stsTokenExchangeRequest.getSubjectTokenType()) .set("subject_token", stsTokenExchangeRequest.getSubjectToken()); MockLowLevelHttpRequest request = transport.getRequest(); Map<String, String> actualRequestContent = TestUtils.parseQuery(request.getContentAsString()); assertThat(actualRequestContent).isEqualTo(expectedRequestContent); }
Source:
public Optional<RequestTypeId> getRequestTypeForCreatingNewRequestsAfterComplete(@NonNull final I_C_Order order) { final I_C_DocType docType = docTypeDAO.getById(order.getC_DocType_ID()); if (docType.getR_RequestType_ID() == 0) { return Optional.empty(); } return Optional.of(RequestTypeId.ofRepoId(docType.getR_RequestType_ID())); }

Target:
public Optional<RequestTypeId> getRequestTypeForCreatingNewRequestsAfterComplete(@NonNull final I_C_Order order) { final I_C_DocType docType = docTypeDAO.getById(order.getC_DocType_ID()); if (docType.getR_RequestType_ID() <= 0) { return Optional.empty(); } return Optional.ofNullable(RequestTypeId.ofRepoIdOrNull(docType.getR_RequestType_ID())); }
Source:
private static String addFullDetailsParam(ParamsMap params, String urlParams) { if (params != null && params.size() > 0 && params.get(FULL_DETAILS_QUERY_PARAM) != null) { return urlParams + FULL_DETAILS_QUERY_PARAM + "="+ params.get(FULL_DETAILS_QUERY_PARAM); } return urlParams; }

Target:
private static String addFullDetailsParam(ParamsMap params, String urlParams) { if (params != null && params.get(FULL_DETAILS_QUERY_PARAM) != null) { return urlParams + FULL_DETAILS_QUERY_PARAM + "="+ params.get(FULL_DETAILS_QUERY_PARAM); } return urlParams; }
Source:
public boolean isUseContributorAgreements() { Set<Project.NameKey> seen = Sets.newHashSet(); seen.add(getProject().getNameKey()); ProjectState s = this; do { switch (s.getProject().getUseContributorAgreements()) { case TRUE: return true; case FALSE: return false; case INHERIT: default: Project.NameKey parent = s.getProject().getParent(); if (parent == null || !seen.add(parent)) { break; } s = projectCache.get(parent); } } while (s != null); return false; }

Target:
public boolean isUseContributorAgreements() { return getInheritedBoolean(new Function<Project, InheritedBoolean>() { @Override public InheritedBoolean apply(Project input) { return input.getUseContributorAgreements(); } }); }
Source:
public List<Path> getFileSegmentPaths() { Set<String> skippedFilePrefix = new HashSet<>(Arrays.asList("readme")); Set<String> skippedDirs = new HashSet<>(Arrays.asList("cr", "dtd", "dtds")); return discover(path, skippedFilePrefix, EMPTY_SET, EMPTY_SET, EMPTY_SET, skippedDirs); }

Target:
public List<Path> getFileSegmentPaths() { return discover(path, EMPTY_SET, EMPTY_SET, EMPTY_SET, EMPTY_SET, EMPTY_SET); }
Source:
public void requestsAreParallel() throws Exception { final int port = new Ports().allocate(); final String uri = String.format("http://localhost:%d", port); final int count = 3; final CountDownLatch started = new CountDownLatch(count); final CountDownLatch completed = new CountDownLatch(count); final Take take = new Take() { @Override public Response act(final Request req) throws IOException { started.countDown(); try { started.await(); } catch (final InterruptedException ex) { throw new IllegalStateException(ex); } completed.countDown(); return new TkEmpty().act(req); } }; new Thread( new Runnable() { @Override public void run() { try { new FtBasic( new BkParallel( new BkBasic(take), BkParallelTest.size(count) ), port ).start( new Exit() { @Override public boolean ready() { return completed.getCount() == 0; } } ); } catch (final IOException ex) { throw new IllegalStateException(ex); } } } ).start(); for (int idx = 0; idx < count; ++idx) { new Thread( new Runnable() { @Override public void run() { try { new JdkRequest(uri) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (final IOException ex) { throw new IllegalStateException(ex); } } } ).start(); } completed.await(1L, TimeUnit.MINUTES); MatcherAssert.assertThat(started.getCount(), Matchers.equalTo(0L)); MatcherAssert.assertThat(completed.getCount(), Matchers.equalTo(0L)); new Ports().release(port); }

Target:
public void requestsAreParallel() throws Exception { final int port = new Ports().allocate(); final String uri = String.format("http://localhost:%d", port); final int count = 3; final CountDownLatch started = new CountDownLatch(count); final CountDownLatch completed = new CountDownLatch(count); final Take take = new Take() { @Override public Response act(final Request req) throws IOException { started.countDown(); try { started.await(); } catch (final InterruptedException ex) { throw new IllegalStateException(ex); } completed.countDown(); return new TkEmpty().act(req); } }; new Thread( new Runnable() { @Override public void run() { try { new FtBasic( new BkParallel( new BkBasic(take), count ), port ).start( new Exit() { @Override public boolean ready() { return completed.getCount() == 0; } } ); } catch (final IOException ex) { throw new IllegalStateException(ex); } } } ).start(); for (int idx = 0; idx < count; ++idx) { new Thread( new Runnable() { @Override public void run() { try { new JdkRequest(uri) .fetch() .as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK); } catch (final IOException ex) { throw new IllegalStateException(ex); } } } ).start(); } completed.await(1L, TimeUnit.MINUTES); MatcherAssert.assertThat(started.getCount(), Matchers.equalTo(0L)); MatcherAssert.assertThat(completed.getCount(), Matchers.equalTo(0L)); new Ports().release(port); }
Source:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); textViewTitle.setVisibility(View.VISIBLE); textViewTitle.setText(discussionThread.getTitle()); DiscussionTextUtils.linkifyTextView(textViewResponse, discussionThread.getRenderedBody()); AuthorLayoutViewHolder authorLayoutViewHolder = new AuthorLayoutViewHolder(getView().findViewById(R.id.discussion_user_profile_row)); authorLayoutViewHolder.populateViewHolder(config, discussionThread, discussionThread, System.currentTimeMillis(), new Runnable() { @Override public void run() { router.showUserProfile(getActivity(), discussionThread.getAuthor()); } }); buttonAddComment.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { createComment(); } }); buttonAddComment.setEnabled(false); editTextNewComment.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { buttonAddComment.setEnabled(s.toString().trim().length() > 0); } }); }

Target:
public void onViewCreated(View view, Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); textViewTitle.setVisibility(View.VISIBLE); textViewTitle.setText(discussionThread.getTitle()); DiscussionTextUtils.renderHtml(textViewResponse, discussionThread.getRenderedBody()); AuthorLayoutViewHolder authorLayoutViewHolder = new AuthorLayoutViewHolder(getView().findViewById(R.id.discussion_user_profile_row)); authorLayoutViewHolder.populateViewHolder(config, discussionThread, discussionThread, System.currentTimeMillis(), new Runnable() { @Override public void run() { router.showUserProfile(getActivity(), discussionThread.getAuthor()); } }); buttonAddComment.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { createComment(); } }); buttonAddComment.setEnabled(false); editTextNewComment.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { buttonAddComment.setEnabled(s.toString().trim().length() > 0); } }); }
Source:
public String toString() { return String.format("timestamp = %d, is_integer=%s, long:%d, " + "double:value = %g", timestamp, is_integer, long_value, double_value); }

Target:
public String toString() { return String.format("MutableDataPoint(timestamp = %d, is_integer=%s, " + "long:%d, double:value = %g)", timestamp, is_integer, long_value, double_value); }
Source:
protected void executeVdsBrokerCommand() { _result = getBroker().getVGInfo(getParameters().getVGID()); proceedProxyReturnValue(); String vgName = (String) _result.vgInfo.get("name"); Object[] temp = (Object[]) _result.vgInfo.get("pvlist"); Map<String, Object>[] pvList = new Map[0]; if (temp != null) { pvList = new Map[temp.length]; for (int i = 0; i < temp.length; i++) { pvList[i] = (Map<String, Object>) temp[i]; pvList[i].put("vgName", vgName); } } Version compatibilityVersion = DbFacade.getInstance().getStoragePoolDao().getForVds(getParameters().getVdsId()) .getCompatibilityVersion(); setReturnValue(GetDeviceListVDSCommand.parseLUNList(pvList, compatibilityVersion)); }

Target:
protected void executeVdsBrokerCommand() { _result = getBroker().getVGInfo(getParameters().getVGID()); proceedProxyReturnValue(); String vgName = (String) _result.vgInfo.get("name"); Object[] temp = (Object[]) _result.vgInfo.get("pvlist"); Map<String, Object>[] pvList = new Map[0]; if (temp != null) { pvList = new Map[temp.length]; for (int i = 0; i < temp.length; i++) { pvList[i] = (Map<String, Object>) temp[i]; pvList[i].put("vgName", vgName); } } Version compatibilityVersion = storagePoolDao.getForVds(getParameters().getVdsId()).getCompatibilityVersion(); setReturnValue(GetDeviceListVDSCommand.parseLUNList(pvList, compatibilityVersion)); }
Source:
protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable { if (!ctx.isOriginLocal()) { return invokeNextInterceptor(ctx, command); } Transaction tx; if (transactionManager.getTransaction() != null || (tx = batchContainer.getBatchTransaction()) == null) { return invokeNextInterceptor(ctx, command); } try { transactionManager.resume(tx); InvocationContext invocationContext = ctx; if (!ctx.isInTxScope()) { log.warnf("Called with a non-tx invocation context: %s", ctx); invocationContext = invocationContextFactory.createInvocationContext(true, -1); } return invokeNextInterceptor(invocationContext, command); } finally { if (transactionManager.getTransaction() != null && batchContainer.isSuspendTxAfterInvocation()) transactionManager.suspend(); } }

Target:
protected Object handleDefault(InvocationContext ctx, VisitableCommand command) throws Throwable { if (!ctx.isOriginLocal()) { return invokeNextInterceptor(ctx, command); } Transaction tx; if (transactionManager.getTransaction() != null || (tx = batchContainer.getBatchTransaction()) == null) { return invokeNextInterceptor(ctx, command); } try { transactionManager.resume(tx); InvocationContext invocationContext = ctx; if (!ctx.isInTxScope()) { log.tracef("Called with a non-tx invocation context: %s", ctx); invocationContext = invocationContextFactory.createInvocationContext(true, -1); } return invokeNextInterceptor(invocationContext, command); } finally { if (transactionManager.getTransaction() != null && batchContainer.isSuspendTxAfterInvocation()) transactionManager.suspend(); } }
Source:
@Config(reportSdk = ICE_CREAM_SANDWICH) @Test public void cacheOnlyInstalledOnce() throws Exception { UrlConnectionDownloader.cache = null; server.enqueue(new MockResponse()); loader.load(URL, false); Object cache = UrlConnectionDownloader.cache; assertThat(cache).isNotNull(); server.enqueue(new MockResponse()); loader.load(URL, false); assertThat(UrlConnectionDownloader.cache).isSameAs(cache); }

Target:
@Test public void cacheOnlyInstalledOnce() throws Exception { UrlConnectionDownloader.cache = null; server.enqueue(new MockResponse()); loader.load(URL, false); Object cache = UrlConnectionDownloader.cache; assertThat(cache).isNotNull(); server.enqueue(new MockResponse()); loader.load(URL, false); assertThat(UrlConnectionDownloader.cache).isSameAs(cache); }
Source:
public Collection<Achievement> getAll() { return ImmutableSet.copyOf(this.achievementMappings.values()); }

Target:
public Collection<Achievement> getAll() { if (this.achievements == null) { this.achievements = ImmutableSet.copyOf(this.achievementMappings.values()); } return this.achievements; }
Source:
public void define(NewController context) { NewAction action = context.createAction("update") .setDescription("Update a group.<br>" + "Requires the following permission: 'Administer System'.") .setHandler(this) .setPost(true) .setResponseExample(getClass().getResource("example-update.json")) .setSince("5.2") .setChangelog(new Change("6.4", "The default group is no more editable")); action.createParam(PARAM_GROUP_ID) .setDescription("Identifier of the group.") .setExampleValue("42") .setRequired(true); action.createParam(PARAM_GROUP_NAME) .setDescription(String.format("New optional name for the group. A group name cannot be larger than %d characters and must be unique. " + "Value 'anyone' and '%s' (whatever the case) is reserved and cannot be used. If value is empty or not defined, then name is not changed.", GROUP_NAME_MAX_LENGTH, SONAR_USERS_GROUP_NAME)) .setExampleValue("my-group"); action.createParam(PARAM_GROUP_DESCRIPTION) .setDescription(String.format("New optional description for the group. A group description cannot be larger than %d characters. " + "If value is not defined, then description is not changed.", DESCRIPTION_MAX_LENGTH)) .setExampleValue("Default group for new users"); }

Target:
public void define(NewController context) { NewAction action = context.createAction("update") .setDescription("Update a group.<br>" + "Requires the following permission: 'Administer System'.") .setHandler(this) .setPost(true) .setResponseExample(getClass().getResource("example-update.json")) .setSince("5.2") .setChangelog(new Change("6.4", "The default group is no longer editable")); action.createParam(PARAM_GROUP_ID) .setDescription("Identifier of the group.") .setExampleValue("42") .setRequired(true); action.createParam(PARAM_GROUP_NAME) .setDescription(String.format("New optional name for the group. A group name cannot be larger than %d characters and must be unique. " + "Value 'anyone' and '%s' (whatever the case) are reserved and cannot be used. If value is empty or not defined, then name is not changed.", GROUP_NAME_MAX_LENGTH, SONAR_USERS_GROUP_NAME)) .setExampleValue("my-group"); action.createParam(PARAM_GROUP_DESCRIPTION) .setDescription(String.format("New optional description for the group. A group description cannot be larger than %d characters. " + "If value is not defined, then description is not changed.", DESCRIPTION_MAX_LENGTH)) .setExampleValue("Default group for new users"); }
Source:
private void loadRaster() { Raster raster = new Raster( new File("/storage/emulated/0/ArcGIS/samples/raster/Shasta.tif").getAbsolutePath()); final RasterLayer rasterLayer = new RasterLayer(raster); ArcGISMap map = new ArcGISMap(Basemap.createImagery()); mMapView.setMap(map); map.getOperationalLayers().add(rasterLayer); rasterLayer.addDoneLoadingListener(new Runnable() { @Override public void run() { mMapView.setViewpointGeometryAsync(rasterLayer.getFullExtent(), 50); } }); }

Target:
private void loadRaster() { Raster raster = new Raster(buildRasterPath()); final RasterLayer rasterLayer = new RasterLayer(raster); ArcGISMap map = new ArcGISMap(Basemap.createImagery()); mMapView.setMap(map); map.getOperationalLayers().add(rasterLayer); rasterLayer.addDoneLoadingListener(new Runnable() { @Override public void run() { mMapView.setViewpointGeometryAsync(rasterLayer.getFullExtent(), 50); } }); }
Source:
private IncrementalIndex makeIncrementalIndex(Bucket theBucket, AggregatorFactory[] aggs) { int aggsSize = 0; for (AggregatorFactory agg : aggs) { aggsSize += agg.getMaxIntermediateSize(); } int bufferSize = aggsSize * config.getSchema().getTuningConfig().getRowFlushBoundary(); return new IncrementalIndex( new IncrementalIndexSchema.Builder() .withMinTimestamp(theBucket.time.getMillis()) .withDimensionsSpec(config.getSchema().getDataSchema().getParser()) .withQueryGranularity(config.getSchema().getDataSchema().getGranularitySpec().getQueryGranularity()) .withMetrics(aggs) .build(), new OffheapBufferPool(bufferSize) ); }

Target:
private IncrementalIndex makeIncrementalIndex(Bucket theBucket, AggregatorFactory[] aggs) { int aggsSize = 0; for (AggregatorFactory agg : aggs) { aggsSize += agg.getMaxIntermediateSize(); } final HadoopTuningConfig tuningConfig = config.getSchema().getTuningConfig(); int bufferSize = aggsSize * tuningConfig.getRowFlushBoundary(); final IncrementalIndexSchema indexSchema = new IncrementalIndexSchema.Builder() .withMinTimestamp(theBucket.time.getMillis()) .withDimensionsSpec(config.getSchema().getDataSchema().getParser()) .withQueryGranularity(config.getSchema().getDataSchema().getGranularitySpec().getQueryGranularity()) .withMetrics(aggs) .build(); if (tuningConfig.isIngestOffheap()) { return new OffheapIncrementalIndex( indexSchema, new OffheapBufferPool(bufferSize) ); } else { return new IncrementalIndex( indexSchema, new OffheapBufferPool(bufferSize) ); } }
Source:
private void init( OutputStream output, VCFHeader header, final boolean writeHeader) throws IOException { final BCFStoppableOutputStream stopOut = new BCFStoppableOutputStream(!writeHeader, output); writer = new VariantContextWriterBuilder().clearOptions() .setOutputBCFStream(stopOut).build(); writer.writeHeader(header); stopOut.stopped = false; setInputHeader(header); }

Target:
private void init( OutputStream output, VCFHeader header, final boolean writeHeader) throws IOException { final BCFStoppableOutputStream stopOut = new BCFStoppableOutputStream(!writeHeader, output); writer = new VariantContextWriterBuilder().clearOptions() .setOption(Options.FORCE_BCF) .setOutputBCFStream(stopOut).build(); writer.writeHeader(header); stopOut.stopped = false; setInputHeader(header); }
Source:
public boolean startDriverForWithProfile(String browser, Map<String, String> profile) throws Exception { if (OVERRIDE_ACTIVE) { return true; } boolean result = false; String browserName = browser.toLowerCase(); if ("firefox".equals(browserName)) { result = startDriver(FirefoxDriver.class.getName(), profile); } else if ("safari".equals(browserName)) { result = startDriver(SafariDriver.class.getName(), profile); } else if ("chrome".equals(browserName)) { String driverPath = getExecutable("chromedriver"); setPropertyValue("webdriver.chrome.driver", driverPath); result = startDriver(ChromeDriver.class.getName(), profile); } else if ("internet explorer".equals(browserName)) { String driverPath = getExecutable("IEDriverServer"); setPropertyValue("webdriver.ie.driver", driverPath); result = startDriver(InternetExplorerDriver.class.getName(), profile); } else if ("phantomjs".equals(browserName)) { String driverPath = getExecutable("phantomjs"); setPropertyValue("phantomjs.binary.path", driverPath); result = startDriver(PhantomJSDriver.class.getName(), profile); } else { throw new IllegalArgumentException("No defaults known for: " + browser); } return result; }

Target:
public boolean startDriverForWithProfile(String browser, Map<String, String> profile) throws Exception { if (OVERRIDE_ACTIVE) { return true; } boolean result = false; String browserName = browser.toLowerCase(); if ("firefox".equals(browserName)) { result = startDriver(FirefoxDriver.class.getName(), profile); } else if ("safari".equals(browserName)) { result = startDriver(SafariDriver.class.getName()); } else if ("chrome".equals(browserName)) { String driverPath = getExecutable("chromedriver"); setPropertyValue("webdriver.chrome.driver", driverPath); result = startDriver(ChromeDriver.class.getName()); } else if ("internet explorer".equals(browserName)) { String driverPath = getExecutable("IEDriverServer"); setPropertyValue("webdriver.ie.driver", driverPath); result = startDriver(InternetExplorerDriver.class.getName()); } else if ("phantomjs".equals(browserName)) { String driverPath = getExecutable("phantomjs"); setPropertyValue("phantomjs.binary.path", driverPath); result = startDriver(PhantomJSDriver.class.getName()); } else { throw new IllegalArgumentException("No defaults known for: " + browser); } return result; }
Source:
private int[] getStartandEndBucket(final double position) { double thumbSize = miniMapController.getMiniMap().getVisibleAmount(); double leftHalf = position - thumbSize; double rightHalf = position + thumbSize; if (leftHalf < 0) { leftHalf = position - thumbSize / 2; } if (rightHalf > scrollPane.getHmax()) { rightHalf = position + thumbSize / 2; } int[] buckets = new int[] { getStartBucketPosition(leftHalf), Math.min(model.getBucketCache().getNumberBuckets(), getEndBucketPosition(rightHalf) + 2) }; return buckets; }

Target:
private int[] getStartandEndBucket(final double position) { double thumbSize = miniMapController.getMiniMap().getVisibleAmount(); double leftHalf = position - thumbSize; double rightHalf = position + thumbSize; if (leftHalf < 0) { leftHalf /= 2; } if (rightHalf > scrollPane.getHmax()) { rightHalf /= 2; } int[] buckets = new int[] { getStartBucketPosition(leftHalf), Math.min(model.getBucketCache().getNumberBuckets(), getEndBucketPosition(rightHalf) + 2) }; return buckets; }
Source:
public void testErrorHandlerIsCalledWhenSubmissionFails() throws Exception { final Tuple1<Boolean> clusterShutdown = new Tuple1<>(false); final TestingDispatcherGateway.Builder dispatcherBuilder = new TestingDispatcherGateway.Builder() .setSubmitFunction(jobGraph -> { throw new FlinkRuntimeException("Nope!"); }) .setClusterShutdownFunction(status -> { if (clusterShutdown.f0) { throw new FlinkRuntimeException("This should be called only once"); } clusterShutdown.f0 = true; return CompletableFuture.completedFuture(Acknowledge.get()); }); final CompletableFuture<Void> errorHandlerFuture = new CompletableFuture<>(); final TestingDispatcherGateway dispatcherGateway = dispatcherBuilder.build(); final ApplicationDispatcherBootstrap bootstrap = createApplicationDispatcherBootstrap( 3, dispatcherGateway, scheduledExecutor, errorHandlerFuture::completeExceptionally); final CompletableFuture<Acknowledge> shutdownFuture = bootstrap.getClusterShutdownFuture(); assertException(errorHandlerFuture, ApplicationExecutionException.class); assertException(shutdownFuture, ApplicationExecutionException.class); assertFalse(clusterShutdown.f0); dispatcherGateway.shutDownCluster(ApplicationStatus.SUCCEEDED); assertTrue(clusterShutdown.f0); }

Target:
public void testErrorHandlerIsCalledWhenSubmissionFails() throws Exception { final TestingDispatcherGateway.Builder dispatcherBuilder = new TestingDispatcherGateway.Builder() .setSubmitFunction(jobGraph -> { throw new FlinkRuntimeException("Nope!"); }) .setClusterShutdownFunction(status -> { fail("We should not call shutdownCluster()"); return CompletableFuture.completedFuture(Acknowledge.get()); }); final CompletableFuture<Void> errorHandlerFuture = new CompletableFuture<>(); final TestingDispatcherGateway dispatcherGateway = dispatcherBuilder.build(); final ApplicationDispatcherBootstrap bootstrap = createApplicationDispatcherBootstrap( 3, dispatcherGateway, scheduledExecutor, errorHandlerFuture::completeExceptionally); final CompletableFuture<Acknowledge> shutdownFuture = bootstrap.getClusterShutdownFuture(); assertException(errorHandlerFuture, ApplicationExecutionException.class); assertException(shutdownFuture, ApplicationExecutionException.class); }
Source:
public SpellResult perform(CastContext context) { if (context.getTargetEntity() == null) { return SpellResult.NO_TARGET; } targetMage = context.getController().getMage(context.getTargetEntity()); originalCostFree = targetMage.isCostFree(); originalCooldownFree = targetMage.isCooldownFree(); targetMage.setCostFree(costFree); targetMage.setCooldownFree(cooldownFree); try { targetMage.getSpell(spell).cast(spellParameters); } catch (NullPointerException exception) { exception.printStackTrace(); } return SpellResult.CAST; }

Target:
public SpellResult perform(CastContext context) { if (context.getTargetEntity() == null) { return SpellResult.NO_TARGET; } Mage targetMage = context.getController().getMage(context.getTargetEntity()); boolean originalCostFree = targetMage.isCostFree(); boolean originalCooldownFree = targetMage.isCooldownFree(); targetMage.setCostFree(costFree); targetMage.setCooldownFree(cooldownFree); try { MageSpell mageSpell = targetMage.getSpell(spell); if (mageSpell == null) { return SpellResult.FAIL; } boolean casted = mageSpell.cast(spellParameters); if (!casted) { return SpellResult.FAIL; } } catch (Exception exception) { exception.printStackTrace(); } targetMage.setCostFree(originalCostFree); targetMage.setCooldownFree(originalCooldownFree); return SpellResult.CAST; }
Source:
public IPropertyDescriptor[] getPropertyDescriptors() { return new IPropertyDescriptor[] { new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME), new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME)}; }

Target:
public IPropertyDescriptor[] getPropertyDescriptors() { if (fDomain.getBufferType().equals(BufferTypeConstants.BUFFER_TYPE_UNKNOWN)) { return new IPropertyDescriptor[] { new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME) }; } return new IPropertyDescriptor[] { new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME), new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME) }; }
Source:
private boolean checkedIfValid(ReadHeadInfo readHead, VKmer neighbor) { int neighborPositionOnRead = getVertexValue().walkSize - getVertexValue().index; return readHead.getThisReadSequence().getGeneCodeAtPosition(neighborPositionOnRead) == neighbor .getGeneCodeAtPosition(kmerSize - 1); }

Target:
private boolean checkedIfValid(ReadHeadInfo readHead, VKmer neighbor) { int neighborPositionOnRead = getVertexValue().walkSize - getVertexValue().index; for (int i = 0; i < kmerSize; i++) { if (readHead.getThisReadSequence().getGeneCodeAtPosition(neighborPositionOnRead + i) != neighbor .getGeneCodeAtPosition(i)) { return false; } } return true; }
Source:
public void addChangeListener_returnedObjectOfCopyToRealmOrUpdate() { looperThread.realm.beginTransaction(); looperThread.realm.createObject(AllTypesPrimaryKey.class, 1); AllTypesPrimaryKey allTypesPrimaryKey = new AllTypesPrimaryKey(); allTypesPrimaryKey.setColumnLong(1); allTypesPrimaryKey.setColumnFloat(42f); allTypesPrimaryKey = looperThread.realm.copyToRealmOrUpdate(allTypesPrimaryKey); looperThread.realm.commitTransaction(); allTypesPrimaryKey.addChangeListener(new RealmChangeListener<AllTypesPrimaryKey>() { @Override public void onChange(AllTypesPrimaryKey element) { assertEquals(42.0f, element.getColumnFloat(), 0f); looperThread.testComplete(); } }); }

Target:
public void addChangeListener_returnedObjectOfCopyToRealmOrUpdate() { Realm realm = looperThread.realm; realm.beginTransaction(); realm.createObject(AllTypesPrimaryKey.class, 1); AllTypesPrimaryKey allTypesPrimaryKey = new AllTypesPrimaryKey(); allTypesPrimaryKey.setColumnLong(1); allTypesPrimaryKey.setColumnFloat(42f); allTypesPrimaryKey = realm.copyToRealmOrUpdate(allTypesPrimaryKey); realm.commitTransaction(); allTypesPrimaryKey.addChangeListener(new RealmChangeListener<AllTypesPrimaryKey>() { @Override public void onChange(AllTypesPrimaryKey element) { assertEquals(42.0f, element.getColumnFloat(), 0f); looperThread.testComplete(); } }); }
Source:
private void printScope(final Scope scope) { final Map<String, Set<ContextKey>> grouped = scope.keys().stream() .collect(Collectors.groupingBy(ContextKey::getContext, TreeMap::new, Collectors.toCollection(TreeSet::new))); for (final Map.Entry<String, Set<ContextKey>> group : grouped.entrySet()) { System.out.printf("%s:\n", group.getKey()); for (final ContextKey contextKey : group.getValue()) { System.out.printf(" %s='%s'\n", contextKey.getKey(), scope.get(contextKey).isPresent() ? scope.get(contextKey).get() : ""); } } }

Target:
private void printScope(final Scope scope) { final Map<String, Set<ContextKey>> grouped = scope.keys().stream() .collect(Collectors.groupingBy(ContextKey::getContext, TreeMap::new, Collectors.toCollection(TreeSet::new))); for (final Map.Entry<String, Set<ContextKey>> group : grouped.entrySet()) { System.out.printf("%s:\n", group.getKey()); for (final ContextKey contextKey : group.getValue()) { System.out.printf(" %s='%s'\n", contextKey.getKey(), scope.get(contextKey).orElse("")); } } }
Source:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { VM vm = vmDao.getVmsWithPlugInfo(diskImage.getId()).stream(). map(Pair::getFirst). findFirst().get(); setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, vm.getRunOnVds()); }

Target:
protected void setQcowCompatByQemuImageInfo(Guid storagePoolId, Guid newImageGroupId, Guid newImageId, Guid newStorageDomainID, DiskImage diskImage) { Guid hostIdToExecuteQemuImageInfo = null; List<Pair<VM, VmDevice>> attachedVmsInfo = vmDao.getVmsWithPlugInfo(diskImage.getId()); Optional<Pair<VM, VmDevice>> pair = attachedVmsInfo.stream().findFirst(); if (pair.isPresent()) { VM vm = pair.get().getFirst(); if (Boolean.TRUE.equals(pair.get().getSecond().isPlugged())) { if (!vm.isDown()) { hostIdToExecuteQemuImageInfo = vm.getRunOnVds(); } } } setQcowCompat(diskImage.getImage(), storagePoolId, newImageGroupId, newImageId, newStorageDomainID, hostIdToExecuteQemuImageInfo); }
Source:
private byte[] performKeyDerivationFunction(X509Certificate certificate, byte[] sharedSecret) throws Exception { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); byteArrayOutputStream.write(COUNTER); byteArrayOutputStream.write(sharedSecret); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES.length); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES); byteArrayOutputStream.write(APPLE_OEM); byteArrayOutputStream.write(HexBin.decode(new String((certificate.getExtensionValue("1.2.840.113635.100.6.32")), UTF_8).substring(4))); return MessageDigest.getInstance("SHA256", "BC") .digest(byteArrayOutputStream.toByteArray()); }

Target:
private byte[] performKeyDerivationFunction(X509Certificate certificate, byte[] sharedSecret) throws Exception { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); byteArrayOutputStream.write(COUNTER); byteArrayOutputStream.write(sharedSecret); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES.length); byteArrayOutputStream.write(ALG_IDENTIFIER_BYTES); byteArrayOutputStream.write(APPLE_OEM); byteArrayOutputStream.write(Hex.decode(new String((certificate.getExtensionValue(MERCHANT_ID_CERTIFICATE_OID)), UTF_8).substring(4))); return MessageDigest.getInstance("SHA256", "BC") .digest(byteArrayOutputStream.toByteArray()); }
Source:
void doSerializeInternal(ByteBuf buf) { ICorfuPayload.serialize(buf, type); if (type == DataType.DATA) { if (data == null) { int lengthIndex = buf.writerIndex(); buf.writeInt(0); if (hasPayloadCodec()) { ByteBuf serializeBuf = Unpooled.buffer(); Serializers.CORFU.serialize(payload.get(), serializeBuf); ByteBuffer wrappedByteBuf = ByteBuffer.wrap(serializeBuf.array(), 0, serializeBuf.readableBytes()); ByteBuffer compressedBuf = getPayloadCodecType().getInstance().compress(wrappedByteBuf); ICorfuPayload.serialize(buf, Unpooled.wrappedBuffer(compressedBuf)); setCompressedFlag(); } else { Serializers.CORFU.serialize(payload.get(), buf); } int size = buf.writerIndex() - (lengthIndex + 4); buf.writerIndex(lengthIndex); buf.writeInt(size); buf.writerIndex(lengthIndex + size + 4); } else { if (hasPayloadCodec() && !isCompressed()) { ByteBuffer compressedBuf = getPayloadCodecType().getInstance().compress(ByteBuffer.wrap(data)); ICorfuPayload.serialize(buf, Unpooled.wrappedBuffer(compressedBuf)); setCompressedFlag(); } else { ICorfuPayload.serialize(buf, data); } } } if (type.isMetadataAware()) { ICorfuPayload.serialize(buf, metadataMap); } }

Target:
void doSerializeInternal(ByteBuf buf) { ICorfuPayload.serialize(buf, type); if (type == DataType.DATA) { if (data == null) { int lengthIndex = buf.writerIndex(); buf.writeInt(0); if (hasPayloadCodec()) { ByteBuf serializeBuf = Unpooled.buffer(); Serializers.CORFU.serialize(payload.get(), serializeBuf); doCompressInternal(serializeBuf, buf); } else { Serializers.CORFU.serialize(payload.get(), buf); } int size = buf.writerIndex() - (lengthIndex + 4); buf.writerIndex(lengthIndex); buf.writeInt(size); buf.writerIndex(lengthIndex + size + 4); } else { if (hasPayloadCodec() && !isCompressed()) { doCompressInternal(Unpooled.wrappedBuffer(data), buf); } else { ICorfuPayload.serialize(buf, data); } } } if (type.isMetadataAware()) { ICorfuPayload.serialize(buf, metadataMap); } }
Source:
public synchronized void reportResults(List<Survey> newSurveys, List<InAppNotification> newNotifications, JSONArray eventBindings, JSONArray variants) { boolean newContent = false; mUpdatesFromMixpanel.setEventBindings(eventBindings); for (final Survey s : newSurveys) { final int id = s.getId(); if (! mSurveyIds.contains(id)) { mSurveyIds.add(id); mUnseenSurveys.add(s); newContent = true; } } for (final InAppNotification n : newNotifications) { final int id = n.getId(); if (! mNotificationIds.contains(id)) { mNotificationIds.add(id); mUnseenNotifications.add(n); newContent = true; } } if (variants.length() > 0) { newContent = true; } mVariants = variants; if (MPConfig.DEBUG) { Log.v(LOGTAG, "New Decide content has become available. " + newSurveys.size() + " surveys and " + newNotifications.size() + " notifications and " + variants.length() + " experiments have been added."); } if (newContent && hasUpdatesAvailable() && null != mListener) { mListener.onNewResults(); } }

Target:
public synchronized void reportResults(List<Survey> newSurveys, List<InAppNotification> newNotifications, JSONArray eventBindings, JSONArray variants) { boolean newContent = false; mUpdatesFromMixpanel.setEventBindings(eventBindings); for (final Survey s : newSurveys) { final int id = s.getId(); if (! mSurveyIds.contains(id)) { mSurveyIds.add(id); mUnseenSurveys.add(s); newContent = true; } } for (final InAppNotification n : newNotifications) { final int id = n.getId(); if (! mNotificationIds.contains(id)) { mNotificationIds.add(id); mUnseenNotifications.add(n); newContent = true; } } if (variants.length() > 0) { mVariants = variants; newContent = true; } if (MPConfig.DEBUG) { Log.v(LOGTAG, "New Decide content has become available. " + newSurveys.size() + " surveys and " + newNotifications.size() + " notifications and " + variants.length() + " experiments have been added."); } if (newContent && hasUpdatesAvailable() && null != mListener) { mListener.onNewResults(); } }
Source:
public static Object jsonValueAny(Object input, SqlJsonValueEmptyOrErrorBehavior emptyBehavior, Object defaultValueOnEmpty, SqlJsonValueEmptyOrErrorBehavior errorBehavior, Object defaultValueOnError) { PathContext context = (PathContext) input; Exception exc; if (context.exc != null) { exc = context.exc; } else { Object value = context.pathReturned; if (value == null || context.mode == PathMode.LAX && !isScalarObject(value)) { switch (emptyBehavior) { case ERROR: throw new RuntimeException("empty json value"); case NULL: return null; case DEFAULT: return defaultValueOnEmpty; default: throw new RuntimeException("illegal empty behavior: " + emptyBehavior); } } else if (context.mode == PathMode.STRICT && !isScalarObject(value)) { exc = new RuntimeException("not a json value: " + value); } else { return value; } } switch (errorBehavior) { case ERROR: throw new RuntimeException(exc); case NULL: return null; case DEFAULT: return defaultValueOnError; default: throw new RuntimeException("illegal error behavior: " + errorBehavior); } }

Target:
public static Object jsonValueAny(Object input, SqlJsonValueEmptyOrErrorBehavior emptyBehavior, Object defaultValueOnEmpty, SqlJsonValueEmptyOrErrorBehavior errorBehavior, Object defaultValueOnError) { PathContext context = (PathContext) input; Exception exc; if (context.exc != null) { exc = context.exc; } else { Object value = context.pathReturned; if (value == null || context.mode == PathMode.LAX && !isScalarObject(value)) { switch (emptyBehavior) { case ERROR: throw RESOURCE.emptyResultOfJsonValueFuncNotAllowed().ex(); case NULL: return null; case DEFAULT: return defaultValueOnEmpty; default: throw RESOURCE.illegalEmptyBehaviorInJsonValueFunc(emptyBehavior.toString()).ex(); } } else if (context.mode == PathMode.STRICT && !isScalarObject(value)) { exc = RESOURCE.scalarValueRequiredInStrictModeOfJsonValueFunc(value.toString()).ex(); } else { return value; } } switch (errorBehavior) { case ERROR: throw toUnchecked(exc); case NULL: return null; case DEFAULT: return defaultValueOnError; default: throw RESOURCE.illegalErrorBehaviorInJsonValueFunc(errorBehavior.toString()).ex(); } }
Source:
public void setUserMetadata(String userMetadata) { if (userMetadata == null) { throw new IllegalArgumentException("Value cannot be null."); } if (userMetadata.length() > ManagementClientConstants.MAX_USERMETADATA_LENGTH) { throw new IllegalArgumentException("Length cannot cross " + ManagementClientConstants.MAX_USERMETADATA_LENGTH + " characters"); } this.userMetadata = userMetadata; }

Target:
public void setUserMetadata(String userMetadata) { Objects.requireNonNull(userMetadata, "'userMetadata' cannot be null."); if (userMetadata.length() > ManagementClientConstants.MAX_USERMETADATA_LENGTH) { throw new IllegalArgumentException("Length cannot cross " + ManagementClientConstants.MAX_USERMETADATA_LENGTH + " characters"); } this.userMetadata = userMetadata; }
Source:
static public void saveFile(String str, File file) throws IOException { File temp = File.createTempFile(file.getName(), null, file.getParentFile()); PApplet.saveStrings(temp, new String[] { str }); try { File canon = file.getCanonicalFile(); file = canon; } catch (IOException e) { } if (file.exists()) { boolean result = file.delete(); if (!result) { throw new IOException( I18n.format( tr("Could not remove old version of {0}"), file.getAbsolutePath())); } } boolean result = temp.renameTo(file); if (!result) { throw new IOException( I18n.format( tr("Could not replace {0}"), file.getAbsolutePath())); } }

Target:
static public void saveFile(String str, File file) throws IOException { File temp = File.createTempFile(file.getName(), null, file.getParentFile()); PApplet.saveStrings(temp, new String[] { str }); try { file = file.getCanonicalFile(); } catch (IOException e) { } if (file.exists()) { boolean result = file.delete(); if (!result) { throw new IOException( I18n.format( tr("Could not remove old version of {0}"), file.getAbsolutePath())); } } boolean result = temp.renameTo(file); if (!result) { throw new IOException( I18n.format( tr("Could not replace {0}"), file.getAbsolutePath())); } }