auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public org.hpccsystems.ws.client.gen.wsworkunits.v1_73.ECLException[] getRawExceptions() <END> { if (this.exceptions.size()==0) { return null; } org.hpccsystems.ws.client.gen.wsworkunits.v1_73.ECLException[] raw= new org.hpccsystems.ws.client.gen.wsworkunits.v1_73.ECLException[this.exceptions.size()]; for (int i=0; i < exceptions.size();i++) { raw[i]=exceptions.get(i).getRaw(); } return raw; }</code><technical_language>eclexceptioninfo eclexceptionwrapper</technical_language>

Target:
public org.hpccsystems.ws.client.gen.wsworkunits.v1_73.ECLException[] getRawExceptions() { if (this.exceptions.size()==0) { return null; } org.hpccsystems.ws.client.gen.wsworkunits.v1_73.ECLException[] raw= new org.hpccsystems.ws.client.gen.wsworkunits.v1_73.ECLException[this.exceptions.size()]; for (int i=0; i < exceptions.size();i++) { raw[i]=exceptions.get(i).getRawVersion1_73(); } return raw; }
Source:
<code>private void assignWidget() { if (options.getWidget() != null) { widget = options.getWidget(); } else if (options.getWidgetContentProvider() != null) { <START> if (widget == null) { <END> widget = options.getWidgetContentProvider().getContent($element.get(0)); } } }</code><technical_language>problem else :-)</technical_language>

Target:
private void assignWidget() { if (options.getWidget() != null) { widget = options.getWidget(); detachWidget(); } else if (options.getWidgetContentProvider() != null) { detachWidget(); widget = options.getWidgetContentProvider().getContent($element.get(0)); } }
Source:
<code>private static Boolean isRooted() { if (android.os.Build.TAGS != null && android.os.Build.TAGS.contains("test-keys")) { return true; } String[] probableRootPaths = { "/data/local/bin/su", "/data/local/su", "/data/local/xbin/su", "/sbin/su", "/su/bin", "/su/bin/su", "/system/app/SuperSU", "/system/app/SuperSU.apk", "/system/app/Superuser", "/system/app/Superuser.apk", "/system/bin/failsafe/su", "/system/bin/su", "/system/sd/xbin/su", "/system/xbin/daemonsu", "/system/xbin/su" }; try { for (String probableRootPath : probableRootPaths) { if (new File(probableRootPath).exists()) { return true; } } <START> } catch (Exception e) { <END> Log.e(TAG, "Exception while attempting to detect whether the device is rooted", e); } return false; }</code><technical_language>this catch *inside* loop ensure iterator is exhausted, wrapping it? specific expected catch here</technical_language>

Target:
private static Boolean isRooted() { if (android.os.Build.TAGS != null && android.os.Build.TAGS.contains("test-keys")) { return true; } String[] probableRootPaths = { "/data/local/bin/su", "/data/local/su", "/data/local/xbin/su", "/sbin/su", "/su/bin", "/su/bin/su", "/system/app/SuperSU", "/system/app/SuperSU.apk", "/system/app/Superuser", "/system/app/Superuser.apk", "/system/bin/failsafe/su", "/system/bin/su", "/system/sd/xbin/su", "/system/xbin/daemonsu", "/system/xbin/su" }; for (String probableRootPath : probableRootPaths) { try { if (new File(probableRootPath).exists()) { return true; } } catch (Exception e) { Log.e(TAG, "Exception while attempting to detect whether the device is rooted", e); } } return false; }
Source:
<code>public boolean imageExistsRemotely(String imageName) { try { final DockerImageURI imageURI = new DockerImageURI(imageName); final String repo = imageURI.getUriWithoutTag(); final List<IDockerImageSearchResult> matchingImages = dockerConnection.searchImages(repo); <START> final Optional<IDockerImageSearchResult> imageMatch = matchingImages.stream() <END> .filter(i -> i.getName().equals(repo)).findAny(); if (imageMatch.isPresent()) { return true; } } catch (DockerException e) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Failed to search Docker Image", e.getMessage()); } return false; }</code><technical_language>I need check if tag matches too, if defined in imageName</technical_language>

Target:
public boolean imageExistsRemotely(String imageName) { try { final DockerImageURI imageURI = new DockerImageURI(imageName); final String repo = imageURI.getUriWithoutTag(); final List<String> registryTags = new DockerHubRegistry().getTags(repo); if(registryTags.contains(imageURI.getTag())) { return true; } } catch (OpenShiftException e) { MessageDialog.openError(Display.getDefault().getActiveShell(), "Failed to search Docker Image", e.getMessage()); } return false; }
Source:
<code>public byte[] toByteArray() throws IOException { if (DEBUG) LOG.debug("read all "+ byteCount + " bytes"); if (buf != null) { return buf; } <START> this.buf = new byte[byteCount]; <END> new DataInputStream(in).readFully(buf); return buf; }</code><technical_language>treat BytesInput reusable. writeAllTo() line 243. This is of remaining copies get rid of. This change forces copy content heap</technical_language>

Target:
public byte[] toByteArray() throws IOException { if (DEBUG) LOG.debug("read all "+ byteCount + " bytes"); byte[] buf = new byte[byteCount]; new DataInputStream(in).readFully(buf); return buf; }
Source:
<code>protected void executeCommand() { getNetwork().setId(Guid.newGuid()); NetworkUtils.setNetworkVdsmName(getNetwork()); TransactionSupport.executeInNewTransaction(() -> { networkDao.save(getNetwork()); if (getNetwork().isVmNetwork() && getParameters().isVnicProfileRequired()) { vnicProfileDao.save(networkHelper.createVnicProfile(getNetwork())); } networkHelper.addPermissionsOnNetwork(getUserId(), getNetwork().getId()); return null; }); Guid <START> networkId = <END> getNetwork().getId(); List<NetworkCluster> networkAttachments = getParameters().getNetworkClusterList(); boolean clusterAttachmentsSucceeded = true; if (networkAttachments != null) { clusterAttachmentsSucceeded = attachToClusters(networkAttachments).getSucceeded(); } runInternalAction(ActionType.AutodefineExternalNetwork, new IdParameters(networkId)); getReturnValue().setActionReturnValue(clusterAttachmentsSucceeded ? networkId : null); setSucceeded(clusterAttachmentsSucceeded); }</code><technical_language>Please move line 91, runInternalAction(ActionType.AutodefineExternalNetwork, new IdParameters(networkId));</technical_language>

Target:
protected void executeCommand() { getNetwork().setId(Guid.newGuid()); NetworkUtils.setNetworkVdsmName(getNetwork()); TransactionSupport.executeInNewTransaction(() -> { networkDao.save(getNetwork()); if (getNetwork().isVmNetwork() && getParameters().isVnicProfileRequired()) { vnicProfileDao.save(networkHelper.createVnicProfile(getNetwork())); } networkHelper.addPermissionsOnNetwork(getUserId(), getNetwork().getId()); return null; }); List<NetworkCluster> networkAttachments = getParameters().getNetworkClusterList(); boolean clusterAttachmentsSucceeded = true; if (networkAttachments != null) { clusterAttachmentsSucceeded = attachToClusters(networkAttachments).getSucceeded(); } Guid networkId = getNetwork().getId(); if (getNetwork().isVmNetwork() && !getNetwork().isExternal()) { runInternalAction(ActionType.AutodefineExternalNetwork, new IdParameters(networkId)); } getReturnValue().setActionReturnValue(clusterAttachmentsSucceeded ? networkId : null); setSucceeded(clusterAttachmentsSucceeded); }
Source:
<code>public GridCacheContextInfo(GridCacheContext<K, V> cctx, boolean clientCache) { <START> config = new CacheConfiguration(cctx.config()); <END> dynamicDeploymentId = null; groupId = cctx.groupId(); cacheId = cctx.cacheId(); this.clientCache = clientCache; this.cctx = cctx; }</code><technical_language>new CacheConfiguration<> remove compiler warning</technical_language>

Target:
public GridCacheContextInfo(GridCacheContext<K, V> cctx, boolean clientCache) { config = cctx.config(); dynamicDeploymentId = null; groupId = cctx.groupId(); cacheId = cctx.cacheId(); this.clientCache = clientCache; this.cctx = cctx; }
Source:
<code>public void testDdlWrongColumnName() throws Exception { checkSqlErrorMessage("create index idx1 on test (wrong)", "Column doesn't exist: WRONG"); checkSqlErrorMessage("alter table test drop column wrong", "Failed to parse query. Column \"WRONG\" not found"); checkSqlErrorMessage("create table test(id integer primary key, AgE integer, AGe integer)", "Duplicate column name: AGE"); checkSqlErrorMessage("create table test(\"id\" integer primary key, \"age\" integer, \"age\" integer)", <START> "Duplicate column name: age"); <END> }</code><technical_language>add another check type of columns name</technical_language>

Target:
public void testDdlWrongColumnName() throws Exception { checkSqlErrorMessage("create index idx1 on test (wrong)", "Column doesn't exist: WRONG"); checkSqlErrorMessage("alter table test drop column wrong", "Failed to parse query. Column \"WRONG\" not found"); checkSqlErrorMessage("create table test(id integer primary key, AgE integer, AGe integer)", "Duplicate column name: AGE"); checkSqlErrorMessage("create table test(\"id\" integer primary key, \"age\" integer, \"age\" integer)", "Duplicate column name: age"); checkSqlErrorMessage("create table test(id integer primary key, age integer, age varchar)", "Duplicate column name: AGE"); }
Source:
<code>public static RawText load(ObjectLoader ldr, int threshold) throws IOException, BinaryBlobException { long sz = ldr.getSize(); if (sz > threshold) { throw new BinaryBlobException(); } if (sz <= FIRST_FEW_BYTES) { byte[] data = ldr.getCachedBytes(FIRST_FEW_BYTES); if (isBinary(data)) { throw new BinaryBlobException(); } return new RawText(data); } byte[] head = new byte[FIRST_FEW_BYTES]; try (InputStream stream = ldr.openStream()) { int off = 0; int left = head.length; while (left > 0) { int n = stream.read(head, off, left); if (n < 0) { throw new EOFException(); } <START> <END> left -= n; off += n; } if (isBinary(head)) { throw new BinaryBlobException(); } byte data[]; try { data = new byte[(int)sz]; } catch (OutOfMemoryError e) { throw new LargeObjectException.OutOfMemory(e); } System.arraycopy(head, 0, data, 0, head.length); IO.readFully(stream, data, off, (int) (sz-off)); return new RawText(data); } }</code><technical_language>check isBinary(head, off,n) read chunk contained a null? avoid loading header in multiple chunks if chunk contains null</technical_language>

Target:
public static RawText load(ObjectLoader ldr, int threshold) throws IOException, BinaryBlobException { long sz = ldr.getSize(); if (sz > threshold) { throw new BinaryBlobException(); } if (sz <= FIRST_FEW_BYTES) { byte[] data = ldr.getCachedBytes(FIRST_FEW_BYTES); if (isBinary(data)) { throw new BinaryBlobException(); } return new RawText(data); } byte[] head = new byte[FIRST_FEW_BYTES]; try (InputStream stream = ldr.openStream()) { int off = 0; int left = head.length; while (left > 0) { int n = stream.read(head, off, left); if (n < 0) { throw new EOFException(); } left -= n; while (n > 0) { if (head[off] == '\0') { throw new BinaryBlobException(); } off++; n--; } } byte data[]; try { data = new byte[(int)sz]; } catch (OutOfMemoryError e) { throw new LargeObjectException.OutOfMemory(e); } System.arraycopy(head, 0, data, 0, head.length); IO.readFully(stream, data, off, (int) (sz-off)); return new RawText(data); } }
Source:
<code>private void postExpandNotify() { <START> notifyTree(SWT.Expand, createEventXY(0, <END> SWT.NONE, 0)); notifyTree(SWT.MouseMove, createMouseEvent(0, SWT.NONE, 0)); notifyTree(SWT.Activate, super.createEvent()); notifyTree(SWT.FocusIn, super.createEvent()); notifyTree(SWT.MouseDown, createMouseEvent(1, SWT.NONE, 1)); notifyTree(SWT.MeasureItem, createEventXY()); notifyTree(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 1)); notifyTree(SWT.MouseExit, createMouseEvent(0, SWT.NONE, 0)); notifyTree(SWT.Deactivate, super.createEvent()); notifyTree(SWT.FocusOut, super.createEvent()); }</code><technical_language>I timing of setExpanded() is real cause, is currently done in correct order. some other timing issue patch is modifying helping. is in Eclipse platform is ready time events received, is computed in a deferred thread? needs investigation understand is missing properly set tree item label get set</technical_language>

Target:
private void postExpandNotify() { notifyTree(SWT.Expand, createEvent()); notifyTree(SWT.MouseUp, createMouseEvent(1, SWT.BUTTON1, 1)); }
Source:
<code>public void onClick(View view) { <START> Toast toast = Toast.makeText(view.getContext(), "bonjour", Toast.LENGTH_SHORT); <END> toast.show(); switch (view.getId()) { case R.id.from: { onAddSenderToContacts(); break; } case R.id.to: case R.id.cc: { expand((TextView)view, ((TextView)view).getEllipsize() != null); layoutChanged(); } } }</code><technical_language>Left debugging</technical_language>

Target:
public void onClick(View view) { switch (view.getId()) { case R.id.from: { onAddSenderToContacts(); break; } case R.id.to: case R.id.cc: { expand((TextView)view, ((TextView)view).getEllipsize() != null); layoutChanged(); } } }
Source:
<code>public void testZeroLenghtLSAttributeStorage() throws Exception { RepositoryItemUid uid = getRepositoryItemUidFactory().createUid( repository, "a/b/c.txt" ); File attFile = new File( localStorageDirectory, ".nexus/attributes/" + uid.getPath() ); attFile.getParentFile().mkdirs(); attFile.delete(); new File( localStorageDirectory, ".nexus/trash/.nexus/attributes/" + uid.getPath() ).delete(); attFile.createNewFile(); assertThat( attFile, FileMatchers.sized( 0L ) ); final DefaultLSAttributeStorage lsStorage = new DefaultLSAttributeStorage(); Attributes att = lsStorage.getAttributes( uid ); assertThat( att, nullValue() ); assertThat( attFile, not( FileMatchers.exists() ) ); DefaultStorageFileItem file = new DefaultStorageFileItem( repository, new ResourceStoreRequest( uid.getPath() ), true, true, new StringContentLocator( "CONTENT" ) ); attFile.createNewFile(); long creationTime = new Date().getTime(); assertThat( attFile, FileMatchers.sized( 0L ) ); att = file.getRepositoryItemAttributes(); lsStorage.putAttributes( uid, att ); assertThat( attFile, FileMatchers.exists() ); <START> assertThat( attFile.lastModified(), greaterThan( creationTime ) ); <END> Attributes retAtt = lsStorage.getAttributes( uid ); assertThat( retAtt, notNullValue() ); }</code><technical_language>This fail depending filesystem timestamp resolution (ext3 1s IIRC)</technical_language>

Target:
public void testZeroLenghtLSAttributeStorage() throws Exception { RepositoryItemUid uid = getRepositoryItemUidFactory().createUid( repository, "a/b/c.txt" ); File attFile = new File( localStorageDirectory, ".nexus/attributes/" + uid.getPath() ); attFile.getParentFile().mkdirs(); attFile.delete(); new File( localStorageDirectory, ".nexus/trash/.nexus/attributes/" + uid.getPath() ).delete(); attFile.createNewFile(); assertThat( attFile, FileMatchers.sized( 0L ) ); final DefaultLSAttributeStorage lsStorage = new DefaultLSAttributeStorage(); Attributes att = lsStorage.getAttributes( uid ); assertThat( att, nullValue() ); assertThat( attFile, not( FileMatchers.exists() ) ); DefaultStorageFileItem file = new DefaultStorageFileItem( repository, new ResourceStoreRequest( uid.getPath() ), true, true, new StringContentLocator( "CONTENT" ) ); long creationTime = createFile( attFile ); assertThat( attFile, FileMatchers.sized( 0L ) ); att = file.getRepositoryItemAttributes(); lsStorage.putAttributes( uid, att ); assertThat( attFile, FileMatchers.exists() ); assertThat( attFile.lastModified(), greaterThan( creationTime ) ); Attributes retAtt = lsStorage.getAttributes( uid ); assertThat( retAtt, notNullValue() ); }
Source:
<code>private Map<String, Long>[] createTestMap(int... entryCounts) { Map<String, Long>[] result = new Map[entryCounts.length]; for (int rowNumber = 0; rowNumber < entryCounts.length; rowNumber++) { int entryCount = entryCounts[rowNumber]; <START> HashMap<String, Long> map = new HashMap<>(); <END> for (int entryNumber = 0; entryNumber < entryCount; entryNumber++) { map.put("key" + entryNumber, entryNumber == 5 ? null : rowNumber * 100L + entryNumber); } result[rowNumber] = map; } return result; }</code><technical_language>Declare Map</technical_language>

Target:
private Map<String, Long>[] createTestMap(int... entryCounts) { Map<String, Long>[] result = new Map[entryCounts.length]; for (int rowNumber = 0; rowNumber < entryCounts.length; rowNumber++) { int entryCount = entryCounts[rowNumber]; Map<String, Long> map = new HashMap<>(); for (int entryNumber = 0; entryNumber < entryCount; entryNumber++) { map.put("key" + entryNumber, entryNumber == 5 ? null : rowNumber * 100L + entryNumber); } result[rowNumber] = map; } return result; }
Source:
<code>private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); MessageInterpolator interpolator; try { interpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); } <START> catch(ValidationException ve) { <END> if(!log.getMissingELDependenciesException().getMessage().equals(ve.getMessage())) { interpolator = new NonElMessageInterpolator(); } else { throw ve; } } this.defaultMessageInterpolator = interpolator; }</code><technical_language>transparently fall back? I this interpolator active choice, especially handle default constraints out of box</technical_language>

Target:
private ConfigurationImpl() { this.validationBootstrapParameters = new ValidationBootstrapParameters(); this.defaultResourceBundleLocator = new PlatformResourceBundleLocator( ResourceBundleMessageInterpolator.USER_VALIDATION_MESSAGES ); this.defaultTraversableResolver = new DefaultTraversableResolver(); this.defaultConstraintValidatorFactory = new ConstraintValidatorFactoryImpl(); this.defaultParameterNameProvider = new DefaultParameterNameProvider(); this.defaultMessageInterpolator = new ResourceBundleMessageInterpolator( defaultResourceBundleLocator ); }
Source:
<code>private synchronized void runHook(final Repository repo, final List<String> args) { if (repo == null) { log.error("No repo found for hook."); return; } hookQueue.schedule(new Runnable() { @Override public void run() { try { final ProcessBuilder pb = new ProcessBuilder(args); pb.redirectErrorStream(true); pb.directory(repo.getDirectory()); final Map<String, String> env = pb.environment(); env.put("GIT_DIR", repo.getDirectory().getAbsolutePath()); Process ps = pb.start(); ps.getOutputStream().close(); BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream())); try { String line; while ((line = br.readLine()) != null) { log.info("hook output: " + line); } } finally { try { br.close(); } catch (IOException e2) { } ps.waitFor(); } } catch (Throwable e) { log.error("Unexpected error during hook execution", e); } finally { repo.close(); } } <START> }, 1, TimeUnit.SECONDS); <END> }</code><technical_language>delay a full second? execute allow hook run soon can</technical_language>

Target:
private synchronized void runHook(final Repository repo, final List<String> args) { if (repo == null) { log.error("No repo found for hook."); return; } hookQueue.schedule(new Runnable() { @Override public void run() { try { if (new File(args.get(0)).exists()) { final ProcessBuilder pb = new ProcessBuilder(args); pb.redirectErrorStream(true); pb.directory(repo.getDirectory()); final Map<String, String> env = pb.environment(); env.put("GIT_DIR", repo.getDirectory().getAbsolutePath()); Process ps = pb.start(); ps.getOutputStream().close(); BufferedReader br = new BufferedReader(new InputStreamReader(ps.getInputStream())); try { String line; while ((line = br.readLine()) != null) { log.info("hook output: " + line); } } finally { try { br.close(); } catch (IOException e2) { } ps.waitFor(); } } } catch (Throwable e) { log.error("Unexpected error during hook execution", e); } finally { repo.close(); } } }, 0, TimeUnit.SECONDS); }
Source:
<code>public void shareSnippet(CharSequence input, boolean preferUrl) { final PageViewFragmentInternal curPageFragment = activity.getCurPageFragment(); if (curPageFragment == null) { return; } String selectedText = sanitizeText(input.toString()); final int minTextSnippetLength = 2; final PageTitle title = curPageFragment.getTitle(); <START> String snippetText; <END> if (selectedText.length() <= minTextSnippetLength || ShareUtils.isStringEmpty(selectedText)) { snippetText = getFirstParagraphText(curPageFragment).toString(); } else { snippetText = selectedText; } String introText = activity.getString(R.string.snippet_share_intro, title.getDisplayText(), title.getCanonicalUri() + "?wprov=sfia1"); Bitmap resultBitmap = new SnippetImage(activity, curPageFragment.getLeadImageBitmap(), curPageFragment.getLeadImageFocusY(), title.getDisplayText(), curPageFragment.getPage().getPageProperties().isMainPage() ? "" : title.getDescription(), snippetText).createImage(); if (shareDialog != null) { shareDialog.dismiss(); } shareDialog = new PreviewDialog(activity, resultBitmap, title.getDisplayText(), introText, snippetText, preferUrl ? title.getCanonicalUri() : selectedText, funnel); shareDialog.show(); }</code><technical_language>Consider writing "emptyIfBlank()" method removing condition minimize branching. this: if (emptyIfNull(selectedText).trim().length() <= minTextSnippetLength) ... ... private String emptyIfNull(String value) { return == null ? "" : value; }</technical_language>

Target:
public void shareSnippet(CharSequence input, boolean preferUrl) { final PageViewFragmentInternal curPageFragment = activity.getCurPageFragment(); if (curPageFragment == null) { return; } String selectedText = sanitizeText(input.toString()); final int minTextSnippetLength = 2; final PageTitle title = curPageFragment.getTitle(); String snippetText; if (selectedText.length() < minTextSnippetLength || ShareUtils.isStringEmpty(selectedText)) { snippetText = getFirstParagraphText(curPageFragment).toString(); } else { snippetText = selectedText; } String introText = activity.getString(R.string.snippet_share_intro, title.getDisplayText(), title.getCanonicalUri() + "?wprov=sfia1"); Bitmap resultBitmap = new SnippetImage(activity, curPageFragment.getLeadImageBitmap(), curPageFragment.getLeadImageFocusY(), title.getDisplayText(), curPageFragment.getPage().getPageProperties().isMainPage() ? "" : title.getDescription(), snippetText).createImage(); if (shareDialog != null) { shareDialog.dismiss(); } shareDialog = new PreviewDialog(activity, resultBitmap, title.getDisplayText(), introText, snippetText, preferUrl ? title.getCanonicalUri() : selectedText, funnel); shareDialog.show(); }
Source:
<code>public static void pullArchivedFormsFromFile(String filePath, final FormRecordListActivity activity, final CommCarePlatform platform) { File file = new File(filePath); if (file != null && file.exists()) { LocalFilePullResponseFactory.setRequestPayloads(new File[]{file}); requestForms(activity, platform, "fake-server-that-is-never-used", LocalFilePullResponseFactory.INSTANCE, true); } else { <START> Toast.makeText(activity, "Restore file doesn't exist", Toast.LENGTH_LONG).show(); <END> } }</code><technical_language>Small, message "Payload file exist" instead of "Restore file"</technical_language>

Target:
public static void pullArchivedFormsFromFile(String filePath, final FormRecordListActivity activity, final CommCarePlatform platform) { if (filePath != null && !filePath.isEmpty()) { File file = new File(filePath); if (file.exists()) { LocalFilePullResponseFactory.setRequestPayloads(new File[]{file}); requestForms(activity, platform, "fake-server-that-is-never-used", LocalFilePullResponseFactory.INSTANCE, true); } else { Toast.makeText(activity, Localization.get("payload.file.not.exist"), Toast.LENGTH_LONG).show(); } } else { Toast.makeText(activity, Localization.get("payload.file.not.set"), Toast.LENGTH_LONG).show(); } }
Source:
<code>private void initViewFields(View root) { mUrl = (EditText) root.findViewById(R.id.loginUrlField); mUsername = (EditText) root.findViewById(R.id.loginUsernameField); mUsername.setText(OpenMRS.getInstance().getUsername()); mPassword = (EditText) root.findViewById(R.id.loginPasswordField); <START> mPassword.setCompoundDrawablesWithIntrinsicBounds(0 , 0,R.drawable.ic_password_hidden , 0); <END> mLoginButton = (Button) root.findViewById(R.id.loginButton); mSpinner = (ProgressBar) root.findViewById(R.id.loginLoading); mLoginFormView = (LinearLayout) root.findViewById(R.id.loginFormView); mLoginSyncButton = ((AppCompatImageView) root.findViewById(R.id.loginSyncButton)); mSyncStateLabel = ((TextView) root.findViewById(R.id.syncLabel)); mDropdownLocation = (Spinner) root.findViewById(R.id.locationSpinner); mForgotPass = (TextView) root.findViewById(R.id.forgotPass); mLocationLoadingProgressBar = (ProgressBar) root.findViewById(R.id.locationLoadingProgressBar); }</code><technical_language>I do this in xml layout running app</technical_language>

Target:
private void initViewFields(View root) { mUrl = (EditText) root.findViewById(R.id.loginUrlField); mUsername = (EditText) root.findViewById(R.id.loginUsernameField); mUsername.setText(OpenMRS.getInstance().getUsername()); mPassword = (EditText) root.findViewById(R.id.loginPasswordField); mShowPassword = (CheckBox) root.findViewById(R.id.checkboxShowPassword); mLoginButton = (Button) root.findViewById(R.id.loginButton); mSpinner = (ProgressBar) root.findViewById(R.id.loginLoading); mLoginFormView = (LinearLayout) root.findViewById(R.id.loginFormView); mLoginSyncButton = ((AppCompatImageView) root.findViewById(R.id.loginSyncButton)); mSyncStateLabel = ((TextView) root.findViewById(R.id.syncLabel)); mDropdownLocation = (Spinner) root.findViewById(R.id.locationSpinner); mForgotPass = (TextView) root.findViewById(R.id.forgotPass); mLocationLoadingProgressBar = (ProgressBar) root.findViewById(R.id.locationLoadingProgressBar); }
Source:
<code>public int onStartCommand(Intent intent, int flags, int startId) { Log.i(TAG, "%% onStartCommand"); if (intent == null) { Log.e(TAG, "%% onStartCommand after having been killed"); } if (intent != null && intent.getAction() != null) { String intentAction = intent.getAction(); <START> if (intentAction.equals(ACTION_IS_FCM)){ <END> setLogLevel(Log.VERBOSE); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { Notification notification = new Notification.Builder(this).getNotification(); startForeground(1337, notification); } if (!isServiceInitialized) { storageManagerPreferences = new StorageManagerPreferences(this); HashMap<String, Object> parameters = StorageUtils.getParams(storageManagerPreferences); try { initialize(parameters); } catch (RCException e) { RCLogger.e(TAG, e.toString()); } } } else { if (intentAction.equals(ACTION_NOTIFICATION_CALL_DEFAULT) || intentAction.equals(ACTION_NOTIFICATION_CALL_ACCEPT_VIDEO) || intentAction.equals(ACTION_NOTIFICATION_CALL_ACCEPT_AUDIO) || intentAction.equals(ACTION_NOTIFICATION_CALL_DECLINE) || intentAction.equals(ACTION_NOTIFICATION_CALL_DELETE) || intentAction.equals(ACTION_NOTIFICATION_MESSAGE_DEFAULT) || intentAction.equals(ACTION_NOTIFICATION_CALL_DISCONNECT) || intentAction.equals(ACTION_NOTIFICATION_CALL_MUTE_AUDIO)) { onNotificationIntent(intent); } } } return START_NOT_STICKY; }</code><technical_language>this ACTION_FCM for consistency</technical_language>

Target:
public int onStartCommand(Intent intent, int flags, int startId) { Log.i(TAG, "%% onStartCommand"); if (intent == null) { Log.e(TAG, "%% onStartCommand after having been killed"); } if (intent != null && intent.getAction() != null) { String intentAction = intent.getAction(); if (intentAction.equals(ACTION_FCM)){ setLogLevel(Log.VERBOSE); if (!isServiceInitialized) { storageManagerPreferences = new StorageManagerPreferences(this); HashMap<String, Object> parameters = StorageUtils.getParams(storageManagerPreferences); try { initialize(null, parameters, null); } catch (RCException e) { RCLogger.e(TAG, e.toString()); } } } else { if (intentAction.equals(ACTION_NOTIFICATION_CALL_DEFAULT) || intentAction.equals(ACTION_NOTIFICATION_CALL_ACCEPT_VIDEO) || intentAction.equals(ACTION_NOTIFICATION_CALL_ACCEPT_AUDIO) || intentAction.equals(ACTION_NOTIFICATION_CALL_DECLINE) || intentAction.equals(ACTION_NOTIFICATION_CALL_DELETE) || intentAction.equals(ACTION_NOTIFICATION_MESSAGE_DEFAULT) || intentAction.equals(ACTION_NOTIFICATION_CALL_DISCONNECT) || intentAction.equals(ACTION_NOTIFICATION_CALL_MUTE_AUDIO)) { onNotificationIntent(intent); } } } return START_NOT_STICKY; }
Source:
<code>public Pair<String, ServerDiscoverySelector> getDefaultLookup() { final String brokerServiceName = tierConfig.getDefaultBrokerServiceName(); <START> final ServerDiscoverySelector retVal = selectorMap.get(brokerServiceName); <END> return new Pair<>(brokerServiceName, retVal); }</code><technical_language>revert this</technical_language>

Target:
public Pair<String, ServerDiscoverySelector> getDefaultLookup() { final String brokerServiceName = tierConfig.getDefaultBrokerServiceName(); final ServerDiscoverySelector retVal = selectorMap.get(CuratorServiceUtils.makeCanonicalServiceName(brokerServiceName)); return new Pair<>(brokerServiceName, retVal); }
Source:
<code>default Tuple2<Stream<T>, Stream<T>> splitAtInclusive(Predicate<? super T> predicate) { <START> Tuple2<Stream<T>, Stream<T>> split = splitAt(predicate); <END> if(split._2.isEmpty()) { return split; } else { return Tuple.of(split._1.append(split._2.head()), split._2.tail()); } }</code><technical_language>please final</technical_language>

Target:
default Tuple2<Stream<T>, Stream<T>> splitAtInclusive(Predicate<? super T> predicate) { final Tuple2<Stream<T>, Stream<T>> split = splitAt(predicate); if(split._2.isEmpty()) { return split; } else { return Tuple.of(split._1.append(split._2.head()), split._2.tail()); } }
Source:
<code>protected void prepareCache(final CountDownLatch releaseLocksLatch) { RpcManager rpcManager = new ControlledRpcManager(advancedCache(1).getRpcManager()) { @Override <START> public Map<Address, Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpcCommand, boolean sync, boolean usePriorityQueue) { <END> if (rpcCommand instanceof TxCompletionNotificationCommand) { releaseLocksLatch.countDown(); return null; } else { return realOne.invokeRemotely(recipients, rpcCommand, sync, usePriorityQueue); } } @Override public Map<Address, Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpc, RpcOptions options) { if (rpc instanceof TxCompletionNotificationCommand) { releaseLocksLatch.countDown(); return null; } else { return realOne.invokeRemotely(recipients, rpc, options); } } }; final TransactionTable transactionTable = TestingUtil.getTransactionTable(cache(1)); TestingUtil.replaceField(rpcManager, "rpcManager", transactionTable, TransactionTable.class); TxControlInterceptor txControlInterceptor = new TxControlInterceptor(); txControlInterceptor.prepareProgress.countDown(); txControlInterceptor.commitProgress.countDown(); advancedCache(1).addInterceptor(txControlInterceptor, 1); }</code><technical_language>remove this</technical_language>

Target:
protected void prepareCache(final CountDownLatch releaseLocksLatch) { RpcManager rpcManager = new ControlledRpcManager(advancedCache(1).getRpcManager()) { @Override public Map<Address, Response> invokeRemotely(Collection<Address> recipients, ReplicableCommand rpc, RpcOptions options) { if (rpc instanceof TxCompletionNotificationCommand) { releaseLocksLatch.countDown(); return null; } else { return realOne.invokeRemotely(recipients, rpc, options); } } }; final TransactionTable transactionTable = TestingUtil.getTransactionTable(cache(1)); TestingUtil.replaceField(rpcManager, "rpcManager", transactionTable, TransactionTable.class); TxControlInterceptor txControlInterceptor = new TxControlInterceptor(); txControlInterceptor.prepareProgress.countDown(); txControlInterceptor.commitProgress.countDown(); advancedCache(1).addInterceptor(txControlInterceptor, 1); }
Source:
<code>public static List<String> getTables(Connection conn, Set<String> types) throws SQLException { DatabaseMetaData metadata = conn.getMetaData(); ResultSet rs = metadata.getTables(null, null, "%", null); List<String> tableNames = new ArrayList<>(); <START> try { <END> while (rs.next()) { if (types.contains(rs.getString(GET_TABLES_TYPE_COLUMN))) { String colName = rs.getString(GET_TABLES_NAME_COLUMN); if (metadata.getDatabaseProductName().equals("SQLite") && colName.startsWith("sqlite_")) { continue; } tableNames.add(colName); } } } finally { rs.close(); } return tableNames; }</code><technical_language>able a "try resources" block</technical_language>

Target:
public static List<String> getTables(Connection conn, Set<String> types) throws SQLException { DatabaseMetaData metadata = conn.getMetaData(); try (ResultSet rs = metadata.getTables(null, null, "%", null)) { List<String> tableNames = new ArrayList<>(); while (rs.next()) { if (types.contains(rs.getString(GET_TABLES_TYPE_COLUMN))) { String colName = rs.getString(GET_TABLES_NAME_COLUMN); if (metadata.getDatabaseProductName().equals("SQLite") && colName.startsWith("sqlite_")) { continue; } tableNames.add(colName); } } return tableNames; } }
Source:
<code>public void verifyTopbarButton(WebElement element) { waitForElementByElement(topbarLoginButton); <START> element.click(); <END> Assertion.assertEquals("block", curtain.getCssValue("display"), "menu is not opened"); element.click(); Assertion.assertEquals("none", curtain.getCssValue("display"), "menu is not closed"); }</code><technical_language>add waiting click</technical_language>

Target:
private void verifyTopbarButton(WebElement element) { waitForElementByElement(topbarLoginButton); element.click(); waitForElementNotPresent(curtainNotOpened); Assertion.assertEquals("block", curtain.getCssValue("display"), "menu is not opened"); element.click(); waitForElementByElement(curtainClosed); Assertion.assertEquals("none", curtain.getCssValue("display"), "menu is not closed"); }
Source:
<code>public Long getActiveJobCountForUser(@NotBlank final String user) throws GenieException { log.debug("Called for jobs with user {}", user); if (StringUtils.isEmpty(StringUtils.trimToEmpty(user))) { throw new IllegalArgumentException("User cannot be null or empty"); } <START> return this.jobRepository.countJobsByUserAndStatusIn(user, JobStatus.getActiveStatuses()); <END> }</code><technical_language>returning Nullable Long want check for null dereference primitive long 0L if null clients this service worry performing null check themselves</technical_language>

Target:
public long getActiveJobCountForUser(@NotBlank final String user) throws GenieException { log.debug("Called for jobs with user {}", user); final Long count = this.jobRepository.countJobsByUserAndStatusIn(user, JobStatus.getActiveStatuses()); if (count == null || count < 0) { throw new GenieServerException( "Count query for user " + user + "produced an unexpected result: " + count ); } return count; }
Source:
<code>public synchronized void updatePoolDomains(Set<Guid> domains) { for (Guid domainId : domains) { if (!domainsVisibility.containsKey(domainId)) { domainsVisibility.put(domainId, new HashMap<Guid, Status>()); } } Iterator<Guid> domainsIterator = domainsVisibility.keySet().iterator(); while (domainsIterator.hasNext()) { if (!domains.contains(domainsIterator.next())) { domainsIterator.remove(); } <START> } <END> }</code><technical_language>IIUC, this entire block replaced domainsVisibility.retainAll(domains)</technical_language>

Target:
public synchronized void updatePoolDomains(Set<Guid> domains) { for (Guid domainId : domains) { if (!domainsVisibility.containsKey(domainId)) { domainsVisibility.put(domainId, new HashMap<Guid, Status>()); } } domainsVisibility.keySet().retainAll(domains); }
Source:
<code>protected void handleStartupFailure(BackOffExecution backOffExecution) throws Exception { <START> long recoveryInterval = backOffExecution != null ? backOffExecution.nextBackOff() : DEFAULT_RECOVERY_INTERVAL; <END> if (BackOffExecution.STOP == recoveryInterval) { synchronized (this) { if (isActive()) { logger.warn("stopping container - restart recovery attempts exhausted"); stop(); } } return; } try { if (logger.isDebugEnabled() && isActive()) { logger.debug("Recovering consumer in " + recoveryInterval + " ms."); } long timeout = System.currentTimeMillis() + recoveryInterval; while (isActive() && System.currentTimeMillis() < timeout) { Thread.sleep(200); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Unrecoverable interruption on consumer restart"); } }</code><technical_language>this - ListenFromAutoDeleteQueueTests.testAutoDeclareFalse(): BlockingQueueConsumer consumer = mock(BlockingQueueConsumer.class); doThrow(RuntimeException.class).when(consumer).start(); when(listenerContainer.createBlockingQueueConsumer()).thenReturn(consumer); SimpleMessageListenerContainer.createBlockingQueueConsumer() this piece of code: consumer.setBackOffExecution(this.recoveryBackOff.start()); fix test-case instead of strange NPE check here</technical_language>

Target:
protected void handleStartupFailure(BackOffExecution backOffExecution) throws Exception { long recoveryInterval = backOffExecution.nextBackOff(); if (BackOffExecution.STOP == recoveryInterval) { synchronized (this) { if (isActive()) { logger.warn("stopping container - restart recovery attempts exhausted"); stop(); } } return; } try { if (logger.isDebugEnabled() && isActive()) { logger.debug("Recovering consumer in " + recoveryInterval + " ms."); } long timeout = System.currentTimeMillis() + recoveryInterval; while (isActive() && System.currentTimeMillis() < timeout) { Thread.sleep(200); } } catch (InterruptedException e) { Thread.currentThread().interrupt(); throw new IllegalStateException("Unrecoverable interruption on consumer restart"); } }
Source:
<code>private void createPathwayEdgesAndAddThemToGraph(Graph graph) { for (Pathway pathway : transitService.getAllPathways()) { Vertex fromVertex = stopNodes.get(pathway.getFromStop()); Vertex toVertex = stopNodes.get(pathway.getToStop()); if (fromVertex != null && toVertex != null) { if (pathway.getPathwayMode() == 5) { createElevatorEdgesAndAddThemToGraph(graph, pathway, fromVertex, toVertex); } else { new PathwayEdge( fromVertex, toVertex, pathway.getName(), pathway.getTraversalTime(), pathway.getLength(), pathway.getStairCount(), pathway.getSlope(), <START> pathway.getPathwayMode() != 2 && pathway.getPathwayMode() != 4 <END> ); if (pathway.isBidirectional()) { new PathwayEdge( toVertex, fromVertex, pathway.getReversedName(), pathway.getTraversalTime(), pathway.getLength(), -1 * pathway.getStairCount(), -1 * pathway.getSlope(), pathway.getPathwayMode() != 2 && pathway.getPathwayMode() != 4 ); } } } else { if (fromVertex == null) { LOG.warn("The 'fromVertex' is missing for pathway from stop: " + pathway .getFromStop() .getId()); } if (toVertex == null) { LOG.warn("The 'toVertex' is missing for pathway to stop: " + pathway .getToStop() .getId()); } } } }</code><technical_language>Add method internal Pathway class avoid of numeric constants</technical_language>

Target:
private void createPathwayEdgesAndAddThemToGraph(Graph graph) { for (Pathway pathway : transitService.getAllPathways()) { Vertex fromVertex = stationElementNodes.get(pathway.getFromStop()); Vertex toVertex = stationElementNodes.get(pathway.getToStop()); if (fromVertex != null && toVertex != null) { if (pathway.getPathwayMode() == 5) { createElevatorEdgesAndAddThemToGraph(graph, pathway, fromVertex, toVertex); } else { new PathwayEdge( fromVertex, toVertex, pathway.getName(), pathway.getTraversalTime(), pathway.getLength(), pathway.getStairCount(), pathway.getSlope(), pathway.isPathwayModeWheelchairAccessible() ); if (pathway.isBidirectional()) { new PathwayEdge( toVertex, fromVertex, pathway.getReversedName(), pathway.getTraversalTime(), pathway.getLength(), -1 * pathway.getStairCount(), -1 * pathway.getSlope(), pathway.isPathwayModeWheelchairAccessible() ); } } } else { if (fromVertex == null) { LOG.warn("The 'fromVertex' is missing for pathway from stop: " + pathway .getFromStop() .getId()); } if (toVertex == null) { LOG.warn("The 'toVertex' is missing for pathway to stop: " + pathway .getToStop() .getId()); } } } }
Source:
<code>private void checkGetter(String fieldName, MethodTree methodTree) { Symbol.TypeSymbol getterOwner = ((Symbol.TypeSymbol) methodTree.symbol().owner()); <START> if (getterOwner.lookupSymbols(fieldName).stream() <END> .filter(Symbol::isPrivate) .noneMatch(symbol -> fieldName.equals(symbol.name()))) { return; } firstAndOnlyStatement(methodTree) .filter(statementTree -> statementTree.is(Tree.Kind.RETURN_STATEMENT)) .map(statementTree -> ((ReturnStatementTree) statementTree).expression()) .flatMap(GettersSettersOnRightFieldCheck::symbolFromExpression) .filter(returnSymbol -> !fieldName.equals(returnSymbol.name())) .ifPresent(returnedSymbol -> context.reportIssue(this, methodTree.simpleName(), "Refactor this getter so that it actually refers to the field \"" + fieldName + "\".")); }</code><technical_language>This condition in setter refactored method a proper name : (something lines of : hasPrivateFieldNamed )</technical_language>

Target:
private void checkGetter(String fieldName, MethodTree methodTree) { Symbol.TypeSymbol getterOwner = ((Symbol.TypeSymbol) methodTree.symbol().owner()); if (!hasPrivateFieldWithName(fieldName, getterOwner)) { return; } firstAndOnlyStatement(methodTree) .filter(statementTree -> statementTree.is(Tree.Kind.RETURN_STATEMENT)) .map(statementTree -> ((ReturnStatementTree) statementTree).expression()) .flatMap(GettersSettersOnRightFieldCheck::symbolFromExpression) .filter(returnSymbol -> !fieldName.equals(returnSymbol.name())) .ifPresent(returnedSymbol -> context.reportIssue(this, methodTree.simpleName(), "Refactor this getter so that it actually refers to the field \"" + fieldName + "\".")); }
Source:
<code>public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); try { final IFile buildFile = Central.getWorkspaceBuildFile(); if (buildFile == null) { MessageDialog.openError(window.getShell(), "Error", "Unable to refresh repositories: workspace build file is missing."); return null; } window.run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { buildFile.getWorkspace().run(new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { List<RepositoryPlugin> repos = RepositoryUtils.listRepositories(true); for (RepositoryPlugin i : repos) { if (i instanceof RemoteRepositoryPlugin) { <START> ((RemoteRepositoryPlugin) i).refreshCacheMetadata(); <END> } } buildFile.touch(monitor); } }, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } } }); } catch (Exception e) { logger.logError("Error refreshing repositories.", e); } return null; }</code><technical_language>I this method is present RRP</technical_language>

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); try { final IFile buildFile = Central.getWorkspaceBuildFile(); if (buildFile == null) { MessageDialog.openError(window.getShell(), "Error", "Unable to refresh repositories: workspace build file is missing."); return null; } window.run(true, false, new IRunnableWithProgress() { public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { buildFile.getWorkspace().run(new IWorkspaceRunnable() { public void run(IProgressMonitor monitor) throws CoreException { List<RepositoryPlugin> repos = RepositoryUtils.listRepositories(true); for (RepositoryPlugin i : repos) { if (i instanceof Refreshable) { boolean success = false; try { success = ((Refreshable) i).refresh(); } catch (Exception e) { logger.logError("Exception while refreshing repository: " + i.getName(), e); } if (!success) { logger.logError("Failed to refresh repository: " + i.getName(), null); } } } buildFile.touch(monitor); } }, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } } }); } catch (Exception e) { logger.logError("Error refreshing repositories.", e); } return null; }
Source:
<code>public RawType(byte[] bytes) { <START> this(bytes, null); <END> }</code><technical_language>Kai stated mime type optional</technical_language>

Target:
public RawType(byte[] bytes) { this(bytes, DEFAULT_MIME_TYPE); }
Source:
<code><START> public void responseBoB(BoBIQ requestBoBIQ, BoBData bobData) <END> throws NotConnectedException, InterruptedException, NotLoggedInException { BoBIQ responseBoBIQ = new BoBIQ(requestBoBIQ.getBoBHash(), bobData); responseBoBIQ.setType(Type.result); responseBoBIQ.setTo(requestBoBIQ.getFrom()); XMPPConnection connection = getAuthenticatedConnectionOrThrow(); connection.sendStanza(responseBoBIQ); }</code><technical_language>idiomatic BobManager install a IQHandler for BoB requests. BobManager provide methods add remove BoBs, e.g. addBob(byte[] bob), removeBob(byte[] bob)</technical_language>

Target:
private BoBIQ responseBoB(BoBIQ requestBoBIQ, BoBData bobData) throws NotConnectedException, InterruptedException, NotLoggedInException { BoBIQ responseBoBIQ = new BoBIQ(requestBoBIQ.getBoBHash(), bobData); responseBoBIQ.setType(Type.result); responseBoBIQ.setTo(requestBoBIQ.getFrom()); return responseBoBIQ; }
Source:
<code>public synchronized void connectionLost(@Nullable Throwable exception) { <START> assert exception != null; <END> if (exception instanceof MqttException) { MqttException e = (MqttException) exception; logger.info("MQTT connection to '{}' was lost: : ReasonCode : Cause : {}", host, e.getMessage(), e.getReasonCode(), (e.getCause() == null ? "Unknown" : e.getCause().getMessage())); } else { logger.info("MQTT connection to '{}' was lost: {}", host, exception.getMessage()); } connectionObservers.forEach(o -> o.connectionStateChanged(MqttConnectionState.DISCONNECTED, exception)); if (reconnectStrategy != null) { reconnectStrategy.lostConnection(); } }</code><technical_language>exception null a legit case. hard throw errors here. do assert in ESH all: Assertions need switched compilation do. removed resulting class files. in this case is hiding a NPE exception _is_ null. Please review other occurrences replace throwing IllegalArgumentException IllegalStateException</technical_language>

Target:
public synchronized void connectionLost(@Nullable Throwable exception) { if (exception instanceof MqttException) { MqttException e = (MqttException) exception; logger.info("MQTT connection to '{}' was lost: : ReasonCode : Cause : {}", host, e.getMessage(), e.getReasonCode(), (e.getCause() == null ? "Unknown" : e.getCause().getMessage())); } else if (exception != null) { logger.info("MQTT connection to '{}' was lost: {}", host, exception.getMessage()); } connectionObservers.forEach(o -> o.connectionStateChanged(MqttConnectionState.DISCONNECTED, exception)); if (reconnectStrategy != null) { reconnectStrategy.lostConnection(); } }
Source:
<code>public List<ProcessDTO> findLinkableParentProcesses(String searchInput, int projectId, int rulesetId) throws DataException { BoolQueryBuilder query = new BoolQueryBuilder() .should(new MatchQueryBuilder(ProcessTypeField.ID.getKey(), searchInput)) <START> .should(new MatchQueryBuilder(ProcessTypeField.TITLE.getKey(), "*" + searchInput + "*")) <END> .must(new MatchQueryBuilder(ProcessTypeField.PROJECT_ID.getKey(), projectId)) .must(new MatchQueryBuilder(ProcessTypeField.RULESET.getKey(), rulesetId)); List<ProcessDTO> linkableParentProcesses = findByQuery(query, false); return linkableParentProcesses; }</code><technical_language>please createSimpleWildcardQuery(ProcessTypeField.TITLE.getKey(), searchQuery); instead of manually adding *</technical_language>

Target:
public List<ProcessDTO> findLinkableParentProcesses(String searchInput, int projectId, int rulesetId) throws DataException { BoolQueryBuilder query = new BoolQueryBuilder() .must(new BoolQueryBuilder().should(new MatchQueryBuilder(ProcessTypeField.ID.getKey(), searchInput)) .should(createSimpleWildcardQuery(ProcessTypeField.TITLE.getKey(), searchInput))) .must(new MatchQueryBuilder(ProcessTypeField.PROJECT_ID.getKey(), projectId)) .must(new MatchQueryBuilder(ProcessTypeField.RULESET.getKey(), rulesetId)); List<ProcessDTO> linkableParentProcesses = findByQuery(query, false); return linkableParentProcesses; }