auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public void testMultipleDeploy() throws Exception { System.out.println("~~! " + testsCfg.description()); runInAllDataModes(new ServiceTestRunnable(true, new DeployClosure() { @Override public void run(IgniteServices services, String svcName, TestService svc) throws Exception { services.deployMultiple(svcName, (Service)svc, 0, 1); waitForServiceDeploymentIfNeeded(services, svcName); } })); }

Target:
public void testMultipleDeploy() throws Exception { runInAllDataModes(new ServiceTestRunnable(true, new DeployClosure() { @Override public void run(IgniteServices services, String svcName, TestService svc) throws Exception { services.deployMultiple(svcName, (Service)svc, 0, 1); waitForServiceDeploymentIfNeeded(services, svcName); } })); }
Source:
private Quota generateQuotaForNewStoragePool() { boolean isDefaultQuota = (getStoragePool().getQuotaEnforcementType() == QuotaEnforcementTypeEnum.DISABLED); Quota defaultStoragePoolQuota = getQuotaHelper().getUnlimitedQuota(getStoragePool(), isDefaultQuota); return defaultStoragePoolQuota; }

Target:
private Quota generateQuotaForNewStoragePool() { return getQuotaHelper().getUnlimitedQuota(getStoragePool(), true); }
Source:
public void testTableReadonlyHidesAddRemoveButtons() throws NoRendererFoundException, NoPropertyDescriptorFoundExeption, EMFFormsNoRendererException { final TableControlHandle handle = createTableWithTwoTableColumns(); handle.getTableControl().setReadonly(true); shell.open(); final RendererResult result = SWTViewTestHelper.renderControl(handle.getTableControl(), domainElement, shell); assertTrue(result.getControl().isPresent() && result.getControl().get() instanceof Composite); final TableControlSWTRenderer swtRenderer = TableControlSWTRenderer.class.cast(result.getRenderer()); final Optional<Control> addRowButton = swtRenderer.getControlForAction(AddRowAction.ACTION_ID); final Optional<Control> removeRowButton = swtRenderer.getControlForAction(RemoveRowAction.ACTION_ID); final Optional<Control> duplicateRowButton = swtRenderer.getControlForAction(DuplicateRowAction.ACTION_ID); assertTrue(!addRowButton.isPresent()); assertTrue(!removeRowButton.isPresent()); assertTrue(!duplicateRowButton.isPresent()); }

Target:
public void testTableReadonlyHidesAddRemoveButtons() throws NoRendererFoundException, NoPropertyDescriptorFoundExeption, EMFFormsNoRendererException { final TableControlHandle handle = createTableWithTwoTableColumns(); handle.getTableControl().setReadonly(true); shell.open(); final RendererResult result = SWTViewTestHelper.renderControl(handle.getTableControl(), domainElement, shell); assertTrue(result.getControl().isPresent() && result.getControl().get() instanceof Composite); final TableControlSWTRenderer swtRenderer = TableControlSWTRenderer.class.cast(result.getRenderer()); final Optional<Control> addRowButton = swtRenderer.getControlForAction(AddRowAction.ACTION_ID); final Optional<Control> removeRowButton = swtRenderer.getControlForAction(RemoveRowAction.ACTION_ID); final Optional<Control> duplicateRowButton = swtRenderer.getControlForAction(DuplicateRowAction.ACTION_ID); assertFalse(addRowButton.isPresent()); assertFalse(removeRowButton.isPresent()); assertFalse(duplicateRowButton.isPresent()); }
Source:
public void run() { if(isValid()) { if(getRunLocal() == false) { try{ ScpClient scpclient = new ScpClient(); serverfileName = fileName.substring(fileName.lastIndexOf('/')+1); tmpfileName="/tmp/"+ serverfileName; scpclient.transfer(fileName,tmpfileName); }catch(Exception e){e.printStackTrace();} } String[] script = buildScript(); String[] envVars = getEnvironmentVariables(); if(continueRun) { ScriptConsole console; if(getRunLocal() == false) { console = ScriptConsole.getInstance(serverfileName); } else { console = ScriptConsole.getInstance(fileName); } console.run(script, envVars, new PasswordPrompt(IDESessionSettings.password), new StapErrorParser()); } } LogManager.logDebug("End run:", this); }

Target:
public void run() { if(isValid()) { if(getRunLocal() == false) { try{ ScpClient scpclient = new ScpClient(); serverfileName = fileName.substring(fileName.lastIndexOf('/')+1); tmpfileName="/tmp/"+ serverfileName; scpclient.transfer(fileName,tmpfileName); }catch(Exception e){e.printStackTrace();} } String[] script = buildScript(); String[] envVars = getEnvironmentVariables(); if(continueRun) { ScriptConsole console; if(getRunLocal() == false) { console = ScriptConsole.getInstance(serverfileName); } else { console = ScriptConsole.getInstance(fileName); } console.run(script, envVars, new PasswordPrompt(IDESessionSettings.password), new StapErrorParser()); } } }
Source:
public void testCurrentAndNextReturnsCorrect() { ArrayList<CandidateClusterContext> arrayList = new ArrayList<>(); CandidateClusterContext first = createContext(1); arrayList.add(first); CandidateClusterContext second = createContext(2); arrayList.add(second); ClusterDiscoveryService discoveryService = new ClusterDiscoveryService(arrayList, 10, lifecycleService); assertEquals(first, discoveryService.current()); assertEquals(second, searchAndGetNextCluster(1, discoveryService)); assertEquals(second, discoveryService.current()); assertEquals(first, searchAndGetNextCluster(2, discoveryService)); assertEquals(first, discoveryService.current()); }

Target:
public void testCurrentAndNextReturnsCorrect() { ArrayList<CandidateClusterContext> arrayList = new ArrayList<>(); CandidateClusterContext first = createContext(1); arrayList.add(first); CandidateClusterContext second = createContext(2); arrayList.add(second); ClusterDiscoveryService discoveryService = new ClusterDiscoveryService(arrayList, 10, lifecycleService); assertEquals(first, discoveryService.current()); assertEquals(second, getNextCluster(discoveryService)); assertEquals(second, discoveryService.current()); assertEquals(first, getNextCluster(discoveryService)); assertEquals(first, discoveryService.current()); }
Source:
public static void browsePostOrPage(Context context, Blog blog, Post post) { if (blog == null || post == null || TextUtils.isEmpty(post.getPermaLink())) return; String url = post.getPermaLink(); if (!post.isPublished()) { if (-1 == url.indexOf('?')) { url = url.concat("?preview=true"); } else { url = url.concat("&preview=true"); } } WPWebViewActivity.openUrlByUsingBlogCredentials(context, blog, post, url); }

Target:
public static void browsePostOrPage(Context context, Blog blog, Post post) { if (blog == null || post == null || TextUtils.isEmpty(post.getPermaLink())) return; String url = post.getPermaLink(); url = UrlUtils.appendUrlParameter(url, "preview", "true"); WPWebViewActivity.openUrlByUsingBlogCredentials(context, blog, post, url); }
Source:
public PluginInterface waitForPluginToBeAvailable( Class<? extends PluginTypeInterface> pluginType, String pluginId, int waitLimit ) { int timeToSleep = 1; try { Thread.sleep( timeToSleep ); waitLimit -= timeToSleep; } catch ( InterruptedException e ) { throw new RuntimeException( "Waiting for Plugin to be Available interrupted!", e ); } PluginInterface pluginInterface = findPluginWithId( pluginType, pluginId ); return waitLimit == 0 && pluginInterface == null ? null : pluginInterface != null ? pluginInterface : waitForPluginToBeAvailable( pluginType, pluginId, waitLimit ); }

Target:
private PluginInterface waitForPluginToBeAvailable( Class<? extends PluginTypeInterface> pluginType, String pluginId, int waitLimit ) { int timeToSleep = 50; try { Thread.sleep( timeToSleep ); waitLimit -= timeToSleep; } catch ( InterruptedException e ) { log.logError( e.getLocalizedMessage(), e ); Thread.currentThread().interrupt(); return null; } PluginInterface pluginInterface = findPluginWithId( pluginType, pluginId ); return waitLimit <= 0 && pluginInterface == null ? null : pluginInterface != null ? pluginInterface : waitForPluginToBeAvailable( pluginType, pluginId, waitLimit ); }
Source:
public static Path fromPortableString(String portablePathString) { Objects.requireNonNull(portablePathString, "The given string must not be null"); if (File.separator.equals(PORTABLE_SEPARATOR)) { return Paths.get(portablePathString); } if (portablePathString.contains(WINDOWS_SEPARATOR)) { log.warn( "The given portable path contains occurrences of the Windows separator character '" + WINDOWS_SEPARATOR + "'. This will most likely lead to issues as this character is used as the " + "separator by the local filesystem, meaning the interpretation of the portable " + "path will not match the path on the sender side."); } String localPathString = portablePathString.replace(PORTABLE_SEPARATOR, File.separator); return Paths.get(localPathString); }

Target:
public static Path fromPortableString(String portablePathString) { Objects.requireNonNull(portablePathString, "The given string must not be null"); String localPathString; if (File.separator.equals(PORTABLE_SEPARATOR)) { localPathString = portablePathString; } else { if (portablePathString.contains(File.separator)) { log.warn( "The given portable path contains occurrences of the local separator character '" + File.separator + "'. This character was not seen as a separator on the system where the portable " + "path string was created, meaning resolving it locally will lead to a different " + "path. portable path string: " + portablePathString); } localPathString = portablePathString.replace(PORTABLE_SEPARATOR, File.separator); } Path localPath = Paths.get(localPathString); return normalize(localPath); }
Source:
public ASTNode visit(Term trm, Void _) throws ParseFailedException { boolean error = false; if (strict && !trm.getSort().equals(maxSort)) error = true; if ((!trm.getSort().equals(KSorts.K) && !trm.getSort().equals(KSorts.KITEM) && !trm.getSort().equals(KSorts.KRESULT))) if (!context.isSubsortedEq(maxSort, trm.getSort())) error = true; if (error) { KException kex = new KException( ExceptionType.ERROR, KExceptionGroup.CRITICAL, "type error: unexpected term '" + trm + "' of sort '" + trm.getSort() + "', expected sort '" + maxSort + "'.", getName(), trm.getFilename(), trm.getLocation()); throw new ParseFailedException(kex); } return trm; }

Target:
public ASTNode visit(Term trm, Void _) throws ParseFailedException { boolean error = false; if (strict && !trm.getSort().equals(maxSort)) error = true; if ((!trm.getSort().equals(Sort.K) && !trm.getSort().equals(Sort.KITEM) && !trm.getSort().equals(Sort.KRESULT))) if (!context.isSubsortedEq(maxSort, trm.getSort())) error = true; if (error) { KException kex = new KException( ExceptionType.ERROR, KExceptionGroup.CRITICAL, "type error: unexpected term '" + trm + "' of sort '" + trm.getSort() + "', expected sort '" + maxSort + "'.", getName(), trm.getFilename(), trm.getLocation()); throw new ParseFailedException(kex); } return trm; }
Source:
public ServletContextInitializer servletContextInitializer() { return servletContext -> { WebApplicationContext ctx = getRequiredWebApplicationContext(servletContext); SessionCookieConfig config = servletContext.getSessionCookieConfig(); config.setHttpOnly(true); config.setSecure(true); XRLog.setLevel(XRLog.EXCEPTION, Level.WARNING); XRLog.setLoggingEnabled(false); }; }

Target:
public ServletContextInitializer servletContextInitializer() { return servletContext -> { WebApplicationContext ctx = getRequiredWebApplicationContext(servletContext); ConfigurableEnvironment environment = ctx.getBean(ConfigurableEnvironment.class); SessionCookieConfig config = servletContext.getSessionCookieConfig(); config.setHttpOnly(true); config.setSecure(environment.acceptsProfiles(Initializer.PROFILE_LIVE)); XRLog.setLevel(XRLog.EXCEPTION, Level.WARNING); XRLog.setLoggingEnabled(false); }; }
Source:
public String buildUpdateSelective(ProviderContext context) { final String tableName = context.getMapperType().getAnnotation(BaseMapper.Meta.class).tableName(); Map<String, String> columnMap = getColumnMap(context); StringBuffer sqlBuffer = new StringBuffer(); sqlBuffer.append("<script>"); sqlBuffer.append("update "); sqlBuffer.append(tableName); sqlBuffer.append("<set>"); for (Map.Entry<String, String> entry : columnMap.entrySet()) { sqlBuffer.append("<if test=\"").append(entry.getValue()).append(" != null\">"); sqlBuffer.append(entry.getKey()).append(" = #{").append(entry.getValue()).append("} ,"); sqlBuffer.append("</if>"); } sqlBuffer.append("</set>"); sqlBuffer.append("where id = #{id}"); sqlBuffer.append("</script>"); return sqlBuffer.toString(); }

Target:
public String buildUpdateSelective(ProviderContext context) { final String tableName = context.getMapperType().getAnnotation(BaseMapper.Meta.class).tableName(); Map<String, String> columnMap = getColumnMap(context); StringBuilder sqlBuffer = new StringBuilder(); sqlBuffer.append("<script>"); sqlBuffer.append("update "); sqlBuffer.append(tableName); sqlBuffer.append("<set>"); for (Map.Entry<String, String> entry : columnMap.entrySet()) { sqlBuffer.append("<if test=\"").append(entry.getValue()).append(" != null\">"); sqlBuffer.append(entry.getKey()).append(" = #{").append(entry.getValue()).append("} ,"); sqlBuffer.append("</if>"); } sqlBuffer.append("</set>"); sqlBuffer.append("where id = #{id}"); sqlBuffer.append("</script>"); return sqlBuffer.toString(); }
Source:
private AsyncTimelockService createRawAsyncTimelockService( String client, Supplier<ManagedTimestampService> timestampServiceSupplier) { log.info("Creating async timelock service."); ScheduledExecutorService reaperExecutor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("async-lock-reaper-" + client + "-%d") .setDaemon(true) .build()); ScheduledExecutorService timeoutExecutor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("async-lock-timeouts-" + client + "-%d") .setDaemon(true) .build()); return new AsyncTimelockServiceImpl( AsyncLockService.createDefault(reaperExecutor, timeoutExecutor), timestampServiceSupplier.get()); }

Target:
private AsyncTimelockService createRawAsyncTimelockService( String client, Supplier<ManagedTimestampService> timestampServiceSupplier) { ScheduledExecutorService reaperExecutor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("async-lock-reaper-" + client + "-%d") .setDaemon(true) .build()); ScheduledExecutorService timeoutExecutor = Executors.newSingleThreadScheduledExecutor( new ThreadFactoryBuilder() .setNameFormat("async-lock-timeouts-" + client + "-%d") .setDaemon(true) .build()); return new AsyncTimelockServiceImpl( AsyncLockService.createDefault(reaperExecutor, timeoutExecutor), timestampServiceSupplier.get()); }
Source:
public void testDisconnectedEventFactHandle() { String drl = "declare String \n" + " @role(event)\n" + "end\n"; KieSession ksession = new KieHelper().addContent(drl, ResourceType.DRL) .build() .newKieSession(); DefaultFactHandle helloHandle = (DefaultFactHandle) ksession.insert("hello"); DefaultFactHandle goodbyeHandle = (DefaultFactHandle) ksession.insert("goodbye"); FactHandle key = DefaultFactHandle.createFromExternalFormat(helloHandle.toExternalForm()); assertThat(key).isInstanceOf(EventFactHandle.class); assertThat(ksession.getObject(key)).isEqualTo("hello"); key = DefaultFactHandle.createFromExternalFormat(goodbyeHandle.toExternalForm()); assertThat(key).isInstanceOf(EventFactHandle.class); assertThat(ksession.getObject(key)).isEqualTo("goodbye"); }

Target:
public void testDisconnectedEventFactHandle() { final String drl = "declare String \n" + " @role(event)\n" + "end\n"; final KieSession ksession = new KieHelper().addContent(drl, ResourceType.DRL) .build() .newKieSession(); final DefaultFactHandle helloHandle = (DefaultFactHandle) ksession.insert("hello"); final DefaultFactHandle goodbyeHandle = (DefaultFactHandle) ksession.insert("goodbye"); final SoftAssertions softly = new SoftAssertions(); FactHandle key = DefaultFactHandle.createFromExternalFormat(helloHandle.toExternalForm()); softly.assertThat(key).isInstanceOf(EventFactHandle.class); softly.assertThat(ksession.getObject(key)).isEqualTo("hello"); key = DefaultFactHandle.createFromExternalFormat(goodbyeHandle.toExternalForm()); softly.assertThat(key).isInstanceOf(EventFactHandle.class); softly.assertThat(ksession.getObject(key)).isEqualTo("goodbye"); softly.assertAll(); }
Source:
public ReviewerInfo format(ReviewerResource rsrc) throws OrmException, NoSuchChangeException { ReviewerInfo out = new ReviewerInfo(); Account account = rsrc.getAccount(); out.id = account.getId().toString(); out.email = account.getPreferredEmail(); out.name = account.getFullName(); Change change = rsrc.getChange(); PatchSet.Id psId = change.currentPatchSetId(); List<PatchSetApproval> approvals = db.get().patchSetApprovals() .byPatchSetUser(psId, account.getId()).toList(); ChangeControl control = controlFactory.controlFor(change, userFactory.create(account.getId())); FunctionState fs = functionState.create(control, psId, approvals); for (ApprovalType at : approvalTypes.getApprovalTypes()) { CategoryFunction.forCategory(at.getCategory()).run(at, fs); } out.approvals = Maps.newHashMapWithExpectedSize(approvals.size()); for (PatchSetApproval ca : approvals) { for (PermissionRange pr : control.getLabelRanges()) { if (pr.getMin() != 0 || pr.getMax() != 0) { ApprovalType at = approvalTypes.byId(ca.getCategoryId()); out.approvals.put(at.getCategory().getLabelName(), ApprovalCategoryValue.formatValue(ca.getValue())); } } } return out; }

Target:
public List<ReviewerInfo> format(ReviewerResource rsrc) throws OrmException, NoSuchChangeException { return format(ImmutableList.<ReviewerResource> of(rsrc)); }
Source:
private void prepareDescription(final Description description) { if (description == null || TextUtils.isEmpty(description.getContent()) || description == Description.emptyDescription) { return; } if (description.getType() == Description.HTML) { disposables.add(Single.just(description.getContent()) .map((@NonNull String descriptionText) -> HtmlCompat.fromHtml(descriptionText, HtmlCompat.FROM_HTML_MODE_LEGACY)) .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((@NonNull Spanned spanned) -> { videoDescriptionView.setText(spanned); videoDescriptionView.setVisibility(View.VISIBLE); })); } else if (description.getType() == Description.MARKDOWN) { final Markwon markwon = Markwon.builder(getContext()) .usePlugin(LinkifyPlugin.create()) .build(); markwon.setMarkdown(videoDescriptionView, description.getContent()); videoDescriptionView.setVisibility(View.VISIBLE); } else { videoDescriptionView.setAutoLinkMask(Linkify.WEB_URLS); videoDescriptionView.setText(description.getContent(), TextView.BufferType.SPANNABLE); videoDescriptionView.setVisibility(View.VISIBLE); } }

Target:
private void prepareDescription(final Description description) { if (description == null || TextUtils.isEmpty(description.getContent()) || description == Description.emptyDescription) { return; } if (description.getType() == Description.HTML) { disposables.add(Single.just(description.getContent()) .map((@NonNull final String descriptionText) -> HtmlCompat.fromHtml(descriptionText, HtmlCompat.FROM_HTML_MODE_LEGACY)) .subscribeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) .subscribe((@NonNull final Spanned spanned) -> { videoDescriptionView.setText(spanned); videoDescriptionView.setVisibility(View.VISIBLE); })); } else if (description.getType() == Description.MARKDOWN) { final Markwon markwon = Markwon.builder(requireContext()) .usePlugin(LinkifyPlugin.create()) .build(); markwon.setMarkdown(videoDescriptionView, description.getContent()); videoDescriptionView.setVisibility(View.VISIBLE); } else { videoDescriptionView.setAutoLinkMask(Linkify.WEB_URLS); videoDescriptionView.setText(description.getContent(), TextView.BufferType.SPANNABLE); videoDescriptionView.setVisibility(View.VISIBLE); } }
Source:
public boolean connectHostToDomainsInActiveOrUnknownStatus(VDS vds) { StoragePool sp = DbFacade.getInstance().getStoragePoolDao().getForVds(vds.getId()); ConnectHostToStoragePoolServersParameters params = new ConnectHostToStoragePoolServersParameters(sp, vds, false); return backend .runInternalAction(VdcActionType.ConnectHostToStoragePoolServers, params) .getSucceeded(); }

Target:
public boolean connectHostToDomainsInActiveOrUnknownStatus(VDS vds) { StoragePool sp = storagePoolDao.getForVds(vds.getId()); ConnectHostToStoragePoolServersParameters params = new ConnectHostToStoragePoolServersParameters(sp, vds, false); return backend .runInternalAction(VdcActionType.ConnectHostToStoragePoolServers, params) .getSucceeded(); }
Source:
void handleDirectoryWebhook(Map<String, List<String>> headers, String body, String method, String path) throws AuthException { try { WebhookPackage webhookPackage = directoryClient.handleWebhook(headers, body, method, path); if (webhookPackage instanceof DirectoryUserDeviceLinkCompletionWebhookPackage) { DeviceLinkCompletionResponse response = ((DirectoryUserDeviceLinkCompletionWebhookPackage) webhookPackage).getDeviceLinkCompletionResponse(); LOG.info("Directory User Device link completion:"); LOG.info(" Device ID: " + naForNull(response.getDeviceId().toString())); LOG.info(" Public Key ID: " + naForNull(response.getDevicePublicKeyId())); LOG.info(" Public Key: " + naForNull(response.getDevicePublicKey())); deviceLinkCompletionMap.put(response.getDeviceId().toString(), response); } } catch (BaseException apiException) { throw new AuthException("Error handling Directory webhook", apiException); } }

Target:
void handleDirectoryWebhook(Map<String, List<String>> headers, String body, String method, String path) throws AuthException { try { WebhookPackage webhookPackage = directoryClient.handleWebhook(headers, body, method, path); if (webhookPackage instanceof DirectoryUserDeviceLinkCompletionWebhookPackage) { DeviceLinkCompletionResponse response = ((DirectoryUserDeviceLinkCompletionWebhookPackage) webhookPackage).getDeviceLinkCompletionResponse(); LOG.info("Directory User Device link completion:"); LOG.info(" Device ID: " + safeNull(response.getDeviceId().toString())); LOG.info(" Public Key ID: " + safeNull(response.getDevicePublicKeyId())); LOG.info(" Public Key: " + safeNull(response.getDevicePublicKey())); deviceLinkCompletionMap.put(response.getDeviceId().toString(), response); } } catch (BaseException apiException) { throw new AuthException("Error handling Directory webhook", apiException); } }
Source:
public synchronized void onBecomeOnlineFromOffline(Message message, NotificationContext context) { if (_numOfSuccessBeforeFail-- > 0) { System.out.println("State transition from Offline to Online"); return; } throw new HelixException("Number of Success reached"); }

Target:
public synchronized void onBecomeOnlineFromOffline(Message message, NotificationContext context) { if (_numOfSuccessBeforeFail-- > 0) { LOG.info("State transition from Offline to Online"); return; } throw new HelixException("Number of Success reached"); }
Source:
private boolean isStorageNotLow(Context context) { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_OK); intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_LOW); Intent intent = context.registerReceiver(null, intentFilter); if (intent == null || intent.getAction() == null) { return true; } else { switch (intent.getAction()) { case Intent.ACTION_DEVICE_STORAGE_OK: return true; case Intent.ACTION_DEVICE_STORAGE_LOW: return false; default: return true; } } }

Target:
private boolean isStorageNotLow(Context context) { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Intent.ACTION_DEVICE_STORAGE_LOW); @Nullable Intent intent = context.registerReceiver(null, new IntentFilter(Intent.ACTION_DEVICE_STORAGE_LOW)); return intent == null; }
Source:
public boolean setTransactionTimeout(int seconds) throws XAException { log.infof("setTransactionTimeout: setting timeout: %s", seconds); this.transactionTimeout = seconds; return true; }

Target:
public boolean setTransactionTimeout(int seconds) throws XAException { log.tracef("setTransactionTimeout: setting timeout: %s", seconds); this.transactionTimeout = seconds; return true; }
Source:
public NetworkRequest pendingRequestForNetwork(NetworkCapabilities networkCapabilities, PendingIntent operation) { checkNotNull(operation, "PendingIntent cannot be null."); networkCapabilities = new NetworkCapabilities(networkCapabilities); enforceNetworkRequestPermissions(networkCapabilities); enforceMeteredApnPolicy(networkCapabilities); ensureRequestableCapabilities(networkCapabilities); MatchAllNetworkSpecifier.checkNotMatchAllNetworkSpecifier( networkCapabilities.getNetworkSpecifier()); if (networkCapabilities.getNetworkSpecifier() instanceof NetworkSpecifier.UidContainer) { if (((NetworkSpecifier.UidContainer) networkCapabilities.getNetworkSpecifier()).getUid() != Binder.getCallingUid()) { throw new SecurityException("Invalid UID provided by caller"); } } NetworkRequest networkRequest = new NetworkRequest(networkCapabilities, TYPE_NONE, nextNetworkRequestId(), NetworkRequest.Type.REQUEST); NetworkRequestInfo nri = new NetworkRequestInfo(networkRequest, operation); if (DBG) log("pendingRequest for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_REQUEST_WITH_INTENT, nri)); return networkRequest; }

Target:
public NetworkRequest pendingRequestForNetwork(NetworkCapabilities networkCapabilities, PendingIntent operation) { checkNotNull(operation, "PendingIntent cannot be null."); networkCapabilities = new NetworkCapabilities(networkCapabilities); enforceNetworkRequestPermissions(networkCapabilities); enforceMeteredApnPolicy(networkCapabilities); ensureRequestableCapabilities(networkCapabilities); MatchAllNetworkSpecifier.checkNotMatchAllNetworkSpecifier( networkCapabilities.getNetworkSpecifier()); if (networkCapabilities.getNetworkSpecifier() != null) { networkCapabilities.getNetworkSpecifier().checkUidIfNecessary(Binder.getCallingUid()); } NetworkRequest networkRequest = new NetworkRequest(networkCapabilities, TYPE_NONE, nextNetworkRequestId(), NetworkRequest.Type.REQUEST); NetworkRequestInfo nri = new NetworkRequestInfo(networkRequest, operation); if (DBG) log("pendingRequest for " + nri); mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_REQUEST_WITH_INTENT, nri)); return networkRequest; }
Source:
public void handleChildChange(String barrierParticipantPath, List<String> participantIds) { if (notAValidEvent()) { return; } if (participantIds == null) { LOG.info("Received notification with null participants for barrier: {}. Ignoring it.", barrierParticipantPath); return; } LOG.info(String.format("Current participants in barrier version: %s = %s.", barrierVersion, participantIds)); LOG.info(String.format("Expected participants in barrier version: %s = %s.", barrierVersion, expectedParticipantIds)); if (participantIds.size() == expectedParticipantIds.size() && CollectionUtils.containsAll(participantIds, expectedParticipantIds)) { String barrierStatePath = keyBuilder.getBarrierStatePath(barrierVersion); State barrierState = zkUtils.getZkClient().readData(barrierStatePath); if (Objects.equals(barrierState, State.NEW)) { LOG.info(String.format("Expected participants has joined the barrier version: %s. Marking the barrier state: %s as %s.", barrierVersion, barrierStatePath, State.DONE)); zkUtils.writeData(barrierStatePath, State.DONE); } LOG.info("Unsubscribing child changes for the path: {}.", barrierParticipantPath); zkUtils.unsubscribeChildChanges(barrierParticipantPath, this); } }

Target:
public void handleChildChange(String barrierParticipantPath, List<String> participantIds) { if (notAValidEvent()) { return; } if (participantIds == null) { LOG.info("Received notification with null participants for barrier: {}. Ignoring it.", barrierParticipantPath); return; } LOG.info(String.format("Current participants in barrier version: %s = %s.", barrierVersion, participantIds)); LOG.info(String.format("Expected participants in barrier version: %s = %s.", barrierVersion, expectedParticipantIds)); if (participantIds.size() == expectedParticipantIds.size() && CollectionUtils.containsAll(participantIds, expectedParticipantIds)) { String barrierStatePath = keyBuilder.getBarrierStatePath(barrierVersion); State barrierState = zkUtils.getZkClient().readData(barrierStatePath); if (Objects.equals(barrierState, State.NEW)) { LOG.info(String.format("Expected participants has joined the barrier version: %s. Marking the barrier state: %s as %s.", barrierVersion, barrierStatePath, State.DONE)); zkUtils.writeData(barrierStatePath, State.DONE); } else { LOG.debug(String.format("Barrier version: %s is at: %s state. Not marking barrier as %s.", barrierVersion, barrierState, State.DONE)); } LOG.info("Unsubscribing child changes on the path: for barrier version: {}.", barrierParticipantPath, barrierVersion); zkUtils.unsubscribeChildChanges(barrierParticipantPath, this); } }
Source:
public JsonPatchDocument appendCopy(String from, String path) { operations.add(new JsonPatchOperation(JsonPatchOperationKind.COPY, Objects.requireNonNull(path, "'path' cannot be null."), Objects.requireNonNull(from, "'from' cannot be null."), null)); return this; }

Target:
public JsonPatchDocument appendCopy(String from, String path) { Objects.requireNonNull(from, "'from' cannot be null."); Objects.requireNonNull(path, "'path' cannot be null."); operations.add(new JsonPatchOperation(JsonPatchOperationKind.COPY, path, from, null)); return this; }
Source:
boolean deregisterHardDeleteMetric(String storeId) { String prefix = storeId + SEPERATOR; return registry.remove(MetricRegistry.name(PersistentIndex.class, prefix + "CurrentHardDeleteProgress")) && registry .remove(MetricRegistry.name(Log.class, prefix + "PercentageHardDeleteCompleted")) && registry.remove( MetricRegistry.name(PersistentIndex.class, prefix + "HardDeleteThreadRunning")) && registry.remove( MetricRegistry.name(PersistentIndex.class, prefix + "HardDeleteCaughtUp")); }

Target:
private boolean deregisterHardDeleteMetric(String storeId) { String prefix = storeId + SEPERATOR; return registry.remove(MetricRegistry.name(PersistentIndex.class, prefix + "CurrentHardDeleteProgress")) && registry .remove(MetricRegistry.name(Log.class, prefix + "PercentageHardDeleteCompleted")) && registry.remove( MetricRegistry.name(PersistentIndex.class, prefix + "HardDeleteThreadRunning")) && registry.remove( MetricRegistry.name(PersistentIndex.class, prefix + "HardDeleteCaughtUp")); }
Source:
public static Gson getGson(){ if(null==gson){ gson=new Gson(); } return gson; }

Target:
public static Gson getGson() { return ApplicationlessInjection.getInstance(CommonsApplication.getInstance()).getCommonsApplicationComponent().gson(); }
Source:
public MPartStack createStack(String id, boolean visible) { MPartStack newStack = modelService.createModelElement(MPartStack.class); newStack.getTags().add("newtablook"); newStack.setElementId(id); newStack.setToBeRendered(visible); return newStack; }

Target:
private MPartStack createStack(String id, boolean visible) { MPartStack newStack = modelService.createModelElement(MPartStack.class); newStack.getTags().add("newtablook"); newStack.setElementId(id); newStack.setToBeRendered(visible); return newStack; }
Source:
public void onClick(View v) { switch (v.getId()) { case R.id.facebookButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_1>"))); break; case R.id.websiteButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_0>"))); break; case R.id.twitterButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_2>"))); break; case R.id.youtubeButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("<LINK_3>"))); break; default: break; } }

Target:
public void onClick(View v) { switch (v.getId()) { case R.id.facebookButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.facebook_url)))); break; case R.id.websiteButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.website_url)))); break; case R.id.twitterButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.twitter_url)))); break; case R.id.youtubeButton: v.startAnimation(buttonClick); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.youtube_url)))); break; default: break; } }
Source:
public String render(ArrayList<ValueLabel<V>> widgets) { StringBuilder formattedStr = new StringBuilder(""); for (int i = 0; i < widgets.size(); i++) { formattedStr.append(widgets.get(i).getElement().getInnerHTML()).append(" ").append(delimiters[i]); if (i < widgets.size() - 1) { formattedStr.append(", "); } } return formattedStr.toString(); }

Target:
public String render(ArrayList<ValueLabel<V>> widgets) { StringBuilder formattedStr = new StringBuilder(); for (int i = 0; i < widgets.size(); i++) { formattedStr.append(widgets.get(i).getElement().getInnerHTML()).append(" ").append(delimiters[i]); if (i < widgets.size() - 1) { formattedStr.append(", "); } } return formattedStr.toString(); }
Source:
public void addTest(Class<?> testClass) { System.out.println("Adding class without a run: " + testClass.getName()); allTestClasses.add(testClass); }

Target:
public void addTest(Class<?> testClass) { allTestClasses.add(testClass); }
Source:
static boolean shouldServiceVersionBeTested(CertificateServiceVersion serviceVersion) { if (Configuration.getGlobalConfiguration().get(AZURE_TEST_SERVICE_VERSIONS) == null) { return CertificateServiceVersion.getLatest().equals(serviceVersion); } return true; }

Target:
private static boolean shouldServiceVersionBeTested(CertificateServiceVersion serviceVersion) { if (CoreUtils.isNullOrEmpty(SERVICE_VERSION_FROM_ENV)) { return CertificateServiceVersion.getLatest().equals(serviceVersion); } if (AZURE_TEST_SERVICE_VERSIONS_VALUE_ALL.equalsIgnoreCase(SERVICE_VERSION_FROM_ENV)) { return true; } String[] configuredServiceVersionList = SERVICE_VERSION_FROM_ENV.split(","); return Arrays.stream(configuredServiceVersionList).anyMatch(configuredServiceVersion -> serviceVersion.toString().equals(configuredServiceVersion.trim())); }
Source:
public IBlockState getBlockState(BlockPos pos) { if (((IMixinBlockPos) pos).isInvalidYPosition()) { return Blocks.AIR.getDefaultState(); } else { net.minecraft.world.chunk.Chunk chunk; if (!this.activeConfig.getConfig().getWorld().getDenyTEChunkRequests()) { final boolean forceChunkRequests = this.mixinChunkProviderServer.getForceChunkRequests(); final PhaseTracker phaseTracker = PhaseTracker.getInstance(); final IPhaseState<?> currentState = phaseTracker.getCurrentState(); if (currentState == TickPhase.Tick.TILE_ENTITY) { ((IMixinChunkProviderServer) this.getChunkProvider()).setForceChunkRequests(true); } chunk = this.getChunkFromBlockCoords(pos); this.mixinChunkProviderServer.setForceChunkRequests(forceChunkRequests); } else { chunk = this.getChunkFromBlockCoords(pos); } return chunk.getBlockState(pos); } }

Target:
public IBlockState getBlockState(BlockPos pos) { if (((IMixinBlockPos) pos).isInvalidYPosition()) { return Blocks.AIR.getDefaultState(); } else { final boolean forceChunkRequests = ((IMixinChunkProviderServer) this.getChunkProvider()).getForceChunkRequests(); final PhaseTracker phaseTracker = PhaseTracker.getInstance(); final IPhaseState<?> currentState = phaseTracker.getCurrentState(); if (currentState == TickPhase.Tick.TILE_ENTITY) { ((IMixinChunkProviderServer) this.getChunkProvider()).setForceChunkRequests(true); } net.minecraft.world.chunk.Chunk chunk = this.getChunk(pos); ((IMixinChunkProviderServer) this.getChunkProvider()).setForceChunkRequests(forceChunkRequests); return chunk.getBlockState(pos); } }
Source:
void givenBeanAnnotatedMethod_whenBindingProperties_thenAllFieldsAreSet() { assertEquals("192.168.0.2", configFactory.getDefaultConfigs().getAddress().getIp()); Map<String, String> expectedResourcesPath = new HashMap<>(); expectedResourcesPath.put("imgs", "/root/def/imgs"); assertEquals(expectedResourcesPath, configFactory.getDefaultConfigs().getResourcesPath()); }

Target:
void givenBeanAnnotatedMethod_whenBindingProperties_thenAllFieldsAreSet() { assertEquals("192.168.0.2", serverConfig.getAddress() .getIp()); Map<String, String> expectedResourcesPath = new HashMap<>(); expectedResourcesPath.put("imgs", "/root/def/imgs"); assertEquals(expectedResourcesPath, serverConfig.getResourcesPath()); }
Source:
public EObject updateCreatedObject(EObject newObject, String loadedVersion) { if (Version.parseVersion(loadedVersion).compareTo(MIGRATION_VERSION) < 0 && newObject instanceof EdgeStyleDescription) { if (newObject instanceof EdgeStyleDescription) { ((EdgeStyleDescription) newObject).setSizeComputationExpression(NEW_SIZE_COMPUTATION_EXPRESSION); } } return newObject; }

Target:
public EObject updateCreatedObject(EObject newObject, String loadedVersion) { if (Version.parseVersion(loadedVersion).compareTo(MIGRATION_VERSION) < 0 && newObject instanceof EdgeStyleDescription) { ((EdgeStyleDescription) newObject).setSizeComputationExpression(OLD_SIZE_COMPUTATION_EXPRESSION_DEFAULT_VALUE); } return newObject; }
Source:
public Collection<PhysicalAddress> fetchClusterMembers(String clusterName) { if (pingDao == null) { log.info("No PingDao set, returning empty set for current cluster members"); return Collections.emptyList(); } getAndSavePhysicalAddress(clusterName); final Map<Address, PhysicalAddress> existing_mbrs = pingDao.getAddresses(clusterName); return existing_mbrs.values(); }

Target:
public Collection<PhysicalAddress> fetchClusterMembers(String clusterName) { if (pingDao == null) { log.info("No PingDao set, returning empty set for current cluster members"); return Collections.emptyList(); } final Map<Address, PhysicalAddress> existing_mbrs = pingDao.getAddresses(clusterName); getAndSavePhysicalAddress(clusterName); return existing_mbrs.values(); }
Source:
NativeSchemaIndexPopulator<SpatialSchemaKey,NativeSchemaValue> createPopulator( IndexSamplingConfig samplingConfig ) { fileLayout = new SpatialIndexFiles.SpatialFileLayout( CoordinateReferenceSystem.WGS84, settings, super.getIndexFile() ); return new SpatialIndexPopulator.PartPopulator( pageCache, fs, fileLayout, monitor, schemaIndexDescriptor, indexId, samplingConfig, new StandardConfiguration() ); }

Target:
NativeSchemaIndexPopulator<SpatialSchemaKey,NativeSchemaValue> createPopulator( IndexSamplingConfig samplingConfig ) { fileLayout = new SpatialIndexFiles.SpatialFileLayout( crs, settings, super.getIndexFile() ); return new SpatialIndexPopulator.PartPopulator( pageCache, fs, fileLayout, monitor, schemaIndexDescriptor, indexId, samplingConfig, new StandardConfiguration() ); }
Source:
default void checkSqliteAndFileDataDirectoriesAreNotPossiblyShared() { sqlitePersistence().ifPresent(sqlite -> { try { Preconditions.checkArgument(!sqlite.dataDirectory().equals(dataDirectory()), "SQLite and file-based data directories must be different!"); Preconditions.checkArgument(!sqlite.dataDirectory().getCanonicalPath().startsWith( dataDirectory().getCanonicalPath() + File.separator), "SQLite data directory can't be a subdirectory of the file-based data directory!" ); Preconditions.checkArgument(!dataDirectory().getCanonicalPath().startsWith( sqlite.dataDirectory().getCanonicalPath() + File.separator), "File-based data directory can't be a subdirectory of the SQLite data directory!" ); } catch (IOException e) { throw new RuntimeException(e); } }); }

Target:
default void checkSqliteAndFileDataDirectoriesAreNotPossiblyShared() { try { Preconditions.checkArgument(!sqlitePersistence().dataDirectory().equals(dataDirectory()), "SQLite and file-based data directories must be different!"); Preconditions.checkArgument(!sqlitePersistence().dataDirectory().getCanonicalPath().startsWith( dataDirectory().getCanonicalPath() + File.separator), "SQLite data directory can't be a subdirectory of the file-based data directory!" ); Preconditions.checkArgument(!dataDirectory().getCanonicalPath().startsWith( sqlitePersistence().dataDirectory().getCanonicalPath() + File.separator), "File-based data directory can't be a subdirectory of the SQLite data directory!" ); } catch (IOException e) { throw new RuntimeException(e); } }
Source:
public Collection<TimerJobInstance> getTimerJobInstances(long id) { Collection<TimerJobInstance> timers = new ArrayList<TimerJobInstance>(); List<GlobalJobHandle> jobs = timerJobsPerSession.get(id); { if (jobs != null) { for (GlobalJobHandle job : jobs) { JobContext jobContext = job.getTimerJobInstance().getJobContext(); jobContext = (jobContext instanceof SelfRemovalJobContext) ? ((SelfRemovalJobContext) jobContext).getJobContext() : jobContext; if (job != null && schedulerService.isValid(job) && jobContext instanceof ProcessJobContext) { timers.add(job.getTimerJobInstance()); } } } } logger.debug("Returning timers for session {}", timers, id); return timers; }

Target:
public Collection<TimerJobInstance> getTimerJobInstances(long id) { Collection<TimerJobInstance> timers = new ArrayList<TimerJobInstance>(); List<GlobalJobHandle> jobs = timerJobsPerSession.get(id); { if (jobs != null) { for (GlobalJobHandle job : jobs) { if (job == null) { continue; } JobContext jobContext = job.getTimerJobInstance().getJobContext(); jobContext = (jobContext instanceof SelfRemovalJobContext) ? ((SelfRemovalJobContext) jobContext).getJobContext() : jobContext; if (schedulerService.isValid(job) && jobContext instanceof ProcessJobContext) { timers.add(job.getTimerJobInstance()); } } } } logger.debug("Returning timers for session {}", timers, id); return timers; }
Source:
public void sanitizingFile() throws IOException { File file = testFolder.newFile(); assertThatThrownBy(() -> PersistentStorageFactories.sanitizeStoragePath(file.getAbsolutePath())) .isInstanceOf(SafeIllegalArgumentException.class); }

Target:
public void sanitizingFile() throws IOException { File file = testFolder.newFile(); assertThatThrownBy(() -> PersistentStorageFactories.sanitizeStoragePath(file.getAbsolutePath())) .isInstanceOf(SafeIllegalArgumentException.class) .hasMessageContaining("has to point to a directory"); }
Source:
public Point indexCenterPoint(int index){ if(index < 0 || index > Constants.INVENTORY_SIZE){ throw new IndexOutOfBoundsException(); } final Point base = component().screenPoint(); final int x = base.x - 3 + (index % 4) * WIDTH; final int y = base.y - 2 + (index / 4) * HEIGHT; return new Point(x + WIDTH / 2, y + HEIGHT / 2); }

Target:
public Point indexCenterPoint(int index){ if(index < 0 || index > Constants.INVENTORY_SIZE - 1){ throw new IndexOutOfBoundsException(); } final Point base = component().screenPoint(); final int x = base.x - 3 + (index % 4) * WIDTH; final int y = base.y - 2 + (index / 4) * HEIGHT; return new Point(x + WIDTH / 2, y + HEIGHT / 2); }
Source:
public List<Integer> getProtectedSeqNums() { LeftToRightBitSet maskWithoutKBits = getMaskWithoutKBits(maskWithKBits); List<Integer> protectedSeqNums = new ArrayList<>(); for (int i = 0; i < this.sizeBytes * 8; ++i) { if (maskWithoutKBits.get(i)) { protectedSeqNums.add(baseSeqNum + i); } } return protectedSeqNums; }

Target:
public List<Integer> getProtectedSeqNums() { FlexFec03BitSet maskWithoutKBits = getMaskWithoutKBits(maskWithKBits); List<Integer> protectedSeqNums = new ArrayList<>(); for (int i = 0; i < maskWithoutKBits.sizeBits(); ++i) { if (maskWithoutKBits.get(i)) { protectedSeqNums.add(RTPUtils.applySequenceNumberDelta(baseSeqNum, i)); } } return protectedSeqNums; }
Source:
private void doStartThread() { assert thread == null; executor.execute(new Runnable() { @Override public void run() { thread = Thread.currentThread(); if (interrupted) { thread.interrupt(); } boolean success = false; updateLastExecutionTime(); try { SingleThreadEventExecutor.this.run(); success = true; } catch (Throwable t) { logger.warn("Unexpected exception from an event executor: ", t); } finally { for (;;) { int oldState = state; if (oldState >= ST_SHUTTING_DOWN || STATE_UPDATER.compareAndSet( SingleThreadEventExecutor.this, oldState, ST_SHUTTING_DOWN)) { break; } } if (success && gracefulShutdownStartTime == 0) { if (logger.isErrorEnabled()) { logger.error("Buggy " + EventExecutor.class.getSimpleName() + " implementation; " + SingleThreadEventExecutor.class.getSimpleName() + ".confirmShutdown() must " + "be called before run() implementation terminates."); } } try { for (;;) { if (confirmShutdown()) { break; } } for (;;) { int oldState = state; if (oldState >= ST_SHUTDOWN || STATE_UPDATER.compareAndSet( SingleThreadEventExecutor.this, oldState, ST_SHUTDOWN)) { break; } } confirmShutdown(); } finally { try { cleanup(); } finally { FastThreadLocal.removeAll(); STATE_UPDATER.set(SingleThreadEventExecutor.this, ST_TERMINATED); threadLock.countDown(); if (logger.isWarnEnabled()) { int numUserTasks = drainTasks(); if (numUserTasks > 0) { logger.warn("An event executor terminated with " + "non-empty task queue (" + numUserTasks + ')'); } } terminationFuture.setSuccess(null); } } } } }); }

Target:
private void doStartThread() { assert thread == null; executor.execute(new Runnable() { @Override public void run() { thread = Thread.currentThread(); if (interrupted) { thread.interrupt(); } boolean success = false; updateLastExecutionTime(); try { SingleThreadEventExecutor.this.run(); success = true; } catch (Throwable t) { logger.warn("Unexpected exception from an event executor: ", t); } finally { for (;;) { int oldState = state; if (oldState >= ST_SHUTTING_DOWN || STATE_UPDATER.compareAndSet( SingleThreadEventExecutor.this, oldState, ST_SHUTTING_DOWN)) { break; } } if (success && gracefulShutdownStartTime == 0) { if (logger.isErrorEnabled()) { logger.error("Buggy " + EventExecutor.class.getSimpleName() + " implementation; " + SingleThreadEventExecutor.class.getSimpleName() + ".confirmShutdown() must " + "be called before run() implementation terminates."); } } try { for (;;) { if (confirmShutdown()) { break; } } for (;;) { int oldState = state; if (oldState >= ST_SHUTDOWN || STATE_UPDATER.compareAndSet( SingleThreadEventExecutor.this, oldState, ST_SHUTDOWN)) { break; } } confirmShutdown(); } finally { try { cleanup(); } finally { FastThreadLocal.removeAll(); STATE_UPDATER.set(SingleThreadEventExecutor.this, ST_TERMINATED); threadLock.countDown(); int numUserTasks = drainTasks(); if (numUserTasks > 0 && logger.isWarnEnabled()) { logger.warn("An event executor terminated with " + "non-empty task queue (" + numUserTasks + ')'); } terminationFuture.setSuccess(null); } } } } }); }
Source:
public static BigDecimal convertToBigDecimal(String value) { BigDecimal result = null; if (value != null && !value.isEmpty() && !value.equalsIgnoreCase("N/A") && !value.equalsIgnoreCase("NA") && !value.equals("-") && !value.equals("--")) { result = new BigDecimal(value); } return result; }

Target:
public static BigDecimal convertToBigDecimal(String value) { BigDecimal result = null; if (isValid(value)) { result = new BigDecimal(value.trim()); } return result; }
Source:
private static boolean isJpeg(byte[] data) { return (data[0] == (byte) 0xFF && data[1] == (byte) 0xD8 && data[data.length - 2] == (byte) 0xFF && data[data.length - 1] == (byte) 0xD9); }

Target:
private static boolean isJpeg(byte[] data) { return (data.length >= 2 && data[0] == (byte) 0xFF && data[1] == (byte) 0xD8 && data[data.length - 2] == (byte) 0xFF && data[data.length - 1] == (byte) 0xD9); }
Source:
public SystemContextMetric() { osName = System.getProperty("os.name"); osVersion = System.getProperty("os.version"); osArchitecture = System.getProperty("os.arch"); javaVendor = System.getProperty("java.vendor"); javaVersion = System.getProperty("java.version"); jvmName = System.getProperty("java.vm.name"); jvmVersion = System.getProperty("java.vm.version"); openGLVendor = GL11.glGetString(GL11.GL_VENDOR); openGLVersion = GL11.glGetString(GL11.GL_VERSION); openGLRenderer = GL11.glGetString(GL11.GL_RENDERER); processorNumbers = Runtime.getRuntime().availableProcessors(); long memoryMaxByte = Runtime.getRuntime().maxMemory(); memoryMaxMb = (int) (memoryMaxByte / (1024 * 1024)); }

Target:
public SystemContextMetric() { osName = System.getProperty("os.name"); osVersion = System.getProperty("os.version"); osArchitecture = System.getProperty("os.arch"); javaVendor = System.getProperty("java.vendor"); javaVersion = System.getProperty("java.version"); jvmName = System.getProperty("java.vm.name"); jvmVersion = System.getProperty("java.vm.version"); openGLVendor = GL11.glGetString(GL11.GL_VENDOR); openGLVersion = GL11.glGetString(GL11.GL_VERSION); openGLRenderer = GL11.glGetString(GL11.GL_RENDERER); processorNumbers = Runtime.getRuntime().availableProcessors(); memoryMaxByte = Runtime.getRuntime().maxMemory(); }