auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>private IMessage addMesssage(IResource target, int lineNumber, int offset, int length, int severity, String preferenceKey, String textMessage, String[] messageArguments, int quickFixId) { IMessage message = null; if(messageCounter<=getMaxNumberOfMarkersPerFile(target.getProject())) { if(lineNumber<0) { try { lineNumber = document.getLineOfOffset(offset) + 1; } catch (BadLocationException e) { CommonPlugin.getDefault().logError(e); } } message = addMesssage(validationManager, shouldCleanAllAnnotations(), this.reporter, offset, length, target, lineNumber, severity, textMessage, messageArguments, getMessageBundleName()); if(message!=null && quickFixId != -1) { message.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, quickFixId); } messageCounter++; if(preferenceKey != null){ message.setAttribute(PREFERENCE_KEY_ATTRIBUTE_NAME, preferenceKey); } String type = getProblemType(); if(type!=null) { message.setAttribute(MESSAGE_TYPE_ATTRIBUTE_NAME, type); } <START> if(message != null) { <END> String id = getId(); if(id != null) { message.setAttribute(VALIDATOR_ID_ATTRIBUTE, id); } if(asYouTypeTimestamp != 0) { message.setAttribute(VALIDATOR_TIMESTAMP_ATTRIBUTE, new Integer(asYouTypeTimestamp)); } } } return message; }</code><technical_language>message null</technical_language>

Target:
private IMessage addMesssage(IResource target, int lineNumber, int offset, int length, int severity, String preferenceKey, String textMessage, String[] messageArguments, int quickFixId) { IMessage message = null; if(messageCounter<=getMaxNumberOfMarkersPerFile(target.getProject())) { if(lineNumber<0) { try { lineNumber = document.getLineOfOffset(offset) + 1; } catch (BadLocationException e) { CommonPlugin.getDefault().logError(e); } } message = addMesssage(validationManager, shouldCleanAllAnnotations(), this.reporter, offset, length, target, lineNumber, severity, textMessage, messageArguments, getMessageBundleName()); if(message!=null && quickFixId != -1) { message.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, quickFixId); } messageCounter++; if(preferenceKey != null){ message.setAttribute(PREFERENCE_KEY_ATTRIBUTE_NAME, preferenceKey); } String type = getProblemType(); if(type!=null) { message.setAttribute(MESSAGE_TYPE_ATTRIBUTE_NAME, type); } message.setAttribute(VALIDATOR_ID_ATTRIBUTE, getId()); if(asYouTypeTimestamp != 0) { message.setAttribute(VALIDATOR_TIMESTAMP_ATTRIBUTE, new Integer(asYouTypeTimestamp)); } } return message; }
Source:
<code>public XmlMetaStoreElement( String filename ) throws MetaStoreException { this(); setIdWithFilename( filename ); FileInputStream in = null; try { in = new FileInputStream( filename ); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse( in ); Element dataTypeElement = document.getDocumentElement(); loadElement( dataTypeElement ); loadAttribute( dataTypeElement ); loadSecurity( dataTypeElement ); } catch ( Exception e ) { throw new MetaStoreException( "Unable to load XML metastore attribute from file '" + filename + "'", e ); } finally { try { in.close(); } catch ( Throwable t ) { <START> } <END> } }</code><technical_language>Do typically log a message in case of this type of exceptions? If I try standardize setting variable name "ignored" similar</technical_language>

Target:
public XmlMetaStoreElement( String filename ) throws MetaStoreException { this(); setIdWithFilename( filename ); FileInputStream in = null; try { in = new FileInputStream( filename ); DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.parse( in ); Element dataTypeElement = document.getDocumentElement(); loadElement( dataTypeElement ); loadAttribute( dataTypeElement ); loadSecurity( dataTypeElement ); } catch ( Exception e ) { throw new MetaStoreException( "Unable to load XML metastore attribute from file '" + filename + "'", e ); } finally { try { in.close(); } catch ( Throwable ignored ) { } } }
Source:
<code><START> void handleLabelClick(PickerLabel label) { <END> if (!queryField.isDisabled()) { queryField.setDisable(true); } finalAssignedLabels = updateFinalAssignedLabels(label); populatePanes(new ArrayList<>(), Optional.empty()); }</code><technical_language>this private, passed a callback PickerLabel instead? Also, position in class (under "Event handling" section), flows better</technical_language>

Target:
private void handleLabelClick(PickerLabel label) { queryField.setDisable(true); state.updateAssignedLabels(label); populatePanes(state); }
Source:
<code>public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if(element == null) return; <START> element.replace(GoElementFactory.createExpression(project, DEFAULT_STRING)); <END> }</code><technical_language>element invalid this point. check element is. E.g. in case of batch inspection mode run injected text, get a file element, I want replace file ""</technical_language>

Target:
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (element == null || !element.isValid()) return; if (element instanceof GoExpression) { element.replace(GoElementFactory.createExpression(project, DEFAULT_STRING)); } }
Source:
<code>public Location getDefaultLocation() throws APIException { Location location = null; String locationGP = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCATION_NAME); if (StringUtils.hasText(locationGP)) { location = Context.getLocationService().getLocation(locationGP); <START> } else if(location == null){ location = getDefaultLocation(null, locationGP); } return location; <END> }</code><technical_language>This is a pretty drastic change in logic this is want do. change, this check if locationGP text if does, try load location. if locationGP text location locationGP found, try get default location calling private getDefaultLocation() function. If of methods returned a location, try get Location 1 (whatever is) return it. this change, this check if locationGP text if does, attempts return location. If locationGP text (the check location == null is redundant this point, location is null), call private getDefaultLocation() function. function return result of getLocation(locationGP) (if locationGP text) result of getDefaultLocation(null, locationGP) (if locationGP text. In other words, I simplify logic in change this: java return StringUtils.hasText(locationGP) ? Context.getLocationService().getLocation(locationGP) : getDefaultLocation(null, ""); I gain simplify this method more is... a point, methods get "simple" logic hard follow</technical_language>

Target:
public Location getDefaultLocation() throws APIException { Location location = null; String locationGP = Context.getAdministrationService().getGlobalProperty( OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCATION_NAME); if (StringUtils.hasText(locationGP)) { location = Context.getLocationService().getLocation(locationGP); } return StringUtils.hasText(locationGP) ? Context.getLocationService().getLocation(locationGP) : getDefaultLocation(null, ""); }
Source:
<code>public int getSizeEstimate() { byte[] tempData = data; if (tempData != null) { <START> return tempData.length + metadataMap.size() + DataType.values().length; <END> } else if (lastKnownSize != NOT_KNOWN) { return lastKnownSize; } log.warn("getSizeEstimate: LogData size estimate is defaulting to 1," + " this might cause leaks in the cache!"); return 1; }</code><technical_language>metadataMap.size() is number of entries, size</technical_language>

Target:
public int getSizeEstimate() { if (lastKnownSize != NOT_KNOWN) { return lastKnownSize; } return 1; }
Source:
<code>private void refreshViewer() { if (viewer.getControl().isDisposed()) { return; } <START> viewer.getControl().getDisplay().asyncExec(new Runnable() { <END> @Override public void run() { if (viewer.getControl().isDisposed()) { return; } viewer.refresh(); } }); }</code><technical_language>a lambda</technical_language>

Target:
private void refreshViewer() { if (fViewer.getControl().isDisposed()) { return; } fViewer.getControl().getDisplay().asyncExec(() -> { if (!fViewer.getControl().isDisposed()) { fViewer.refresh(); } }); }
Source:
<code>private void copyVmPermissions(UniquePermissionsSet permissionsToAdd) { if (!isVmInDb || !getParameters().isCopyVmPermissions()) { return; } PermissionDAO dao = getDbFacade().getPermissionDao(); <START> List<Permissions> vmPermissions = dao.getAllForEntity(getVmId(), getCurrentUser().getId(), getSessionId(), false); <END> for (Permissions vmPermission : vmPermissions) { permissionsToAdd.addPermission(vmPermission.getad_element_id(), vmPermission.getrole_id(), getParameters().getVmTemplateId(), VdcObjectType.VmTemplate); } }</code><technical_language>do need getCurrentUser().getId() if session</technical_language>

Target:
private void copyVmPermissions(UniquePermissionsSet permissionsToAdd) { if (!isVmInDb || !getParameters().isCopyVmPermissions()) { return; } PermissionDAO dao = getDbFacade().getPermissionDao(); List<Permissions> vmPermissions = dao.getAllForEntity(getVmId(), getSessionId(), false); for (Permissions vmPermission : vmPermissions) { permissionsToAdd.addPermission(vmPermission.getad_element_id(), vmPermission.getrole_id(), getParameters().getVmTemplateId(), VdcObjectType.VmTemplate); } }
Source:
<code>private void doStagefrightTest(int rid) throws Exception { Context ctx = getContext(); File pocdir = new File(ctx.getFilesDir(), "pocs"); pocdir.mkdir(); final String name = ctx.getResources().getResourceEntryName(rid); File pocfile = new File(pocdir, name + ".mp4"); <START> extractRaw(ctx, rid, pocfile); <END> Log.i(TAG, "Testing file: " + name); class MediaPlayerCrashListener implements MediaPlayer.OnErrorListener { @Override public boolean onError(MediaPlayer mp, int what, int extra) { Log.i(TAG, "In error handler with error " + what); if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) { crashed = true; } return true; } public boolean hasCrashed() { return crashed; } private boolean crashed = false; } MediaPlayer mp = new MediaPlayer(); MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(); mp.setOnErrorListener(mpcl); mp.setDataSource(pocfile.getPath()); try { mp.prepare(); } catch (IOException e) { } pocfile.delete(); String cve = name.replace("_", "-").toUpperCase(); assertFalse("Device *IS* vulnerable to " + cve, mpcl.hasCrashed()); }</code><technical_language>get rid of code, extractRaw method below, setDataSource() method takes a filedescriptor, offset length: AssetFileDescriptor fd = ctx.getResources().openRawResourceFd(res); mp.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), fd.getLength());</technical_language>

Target:
private void doStagefrightTest(int rid) throws Exception { Context ctx = getContext(); AssetFileDescriptor fd = ctx.getResources().openRawResourceFd(rid); String name = ctx.getResources().getResourceEntryName(rid); Log.i(TAG, "Testing file: " + name); class MediaPlayerCrashListener implements MediaPlayer.OnErrorListener { @Override public boolean onError(MediaPlayer mp, int what, int extra) { Log.i(TAG, "In error handler with error " + what); if (what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) { crashed = true; } return true; } public boolean hasCrashed() { return crashed; } private boolean crashed = false; } MediaPlayer mp = new MediaPlayer(); MediaPlayerCrashListener mpcl = new MediaPlayerCrashListener(); mp.setOnErrorListener(mpcl); mp.setDataSource(fd.getFileDescriptor(), fd.getStartOffset(), fd.getLength()); try { mp.prepare(); } catch (IOException e) { } String cve = name.replace("_", "-").toUpperCase(); assertFalse("Device *IS* vulnerable to " + cve, mpcl.hasCrashed()); }
Source:
<code>public void testProject() throws Exception { StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment(); EnvironmentSettings envSettings = EnvironmentSettings.newInstance() .useBlinkPlanner() .inStreamingMode() .build(); StreamTableEnvironment tEnv = StreamTableEnvironment.create(env, envSettings); tEnv.executeSql( "CREATE TABLE " + INPUT_TABLE + "(" + "id BIGINT," + "timestamp6_col TIMESTAMP(6)," + "timestamp9_col TIMESTAMP(9)," + "time_col TIME," + "real_col FLOAT," + "double_col DOUBLE," + "decimal_col DECIMAL(10, 4)" + ") WITH (" + " 'connector'='jdbc'," + " 'url'='" + DB_URL + "'," + " 'table-name'='" + INPUT_TABLE + "'," + " 'scan.partition.column'='id'," + " 'scan.partition.num'='2'," + " 'scan.partition.lower-bound'='0'," + " 'scan.partition.upper-bound'='100'" + ")" ); <START> Iterator<Row> collected = tEnv.executeSql("SELECT id,timestamp6_col,decimal_col FROM " + INPUT_TABLE + " LIMIT 1").collect(); <END> List<String> result = CollectionUtil.iteratorToList(collected).stream() .map(Row::toString) .sorted() .collect(Collectors.toList()); List<String> expected = Stream.of( "1,2020-01-01T15:35:00.123456,100.1234", "2,2020-01-01T15:36:01.123456,101.1234") .sorted().collect(Collectors.toList()); assertEquals(expected, result); }</code><technical_language>This break test</technical_language>

Target:
public void testProject() throws Exception { tEnv.executeSql( "CREATE TABLE " + INPUT_TABLE + "(" + "id BIGINT," + "timestamp6_col TIMESTAMP(6)," + "timestamp9_col TIMESTAMP(9)," + "time_col TIME," + "real_col FLOAT," + "double_col DOUBLE," + "decimal_col DECIMAL(10, 4)" + ") WITH (" + " 'connector'='jdbc'," + " 'url'='" + DB_URL + "'," + " 'table-name'='" + INPUT_TABLE + "'," + " 'scan.partition.column'='id'," + " 'scan.partition.num'='2'," + " 'scan.partition.lower-bound'='0'," + " 'scan.partition.upper-bound'='100'" + ")" ); Iterator<Row> collected = tEnv.executeSql("SELECT id,timestamp6_col,decimal_col FROM " + INPUT_TABLE).collect(); List<String> result = CollectionUtil.iteratorToList(collected).stream() .map(Row::toString) .sorted() .collect(Collectors.toList()); List<String> expected = Stream.of( "1,2020-01-01T15:35:00.123456,100.1234", "2,2020-01-01T15:36:01.123456,101.1234") .sorted().collect(Collectors.toList()); assertEquals(expected, result); }
Source:
<code>private void mapExpandedElements(Object[] expandedElements) { HashMap elementMap = new HashMap(); for (Object expandedElement : expandedElements) { elementMap.put(((DateHistoryCategory) expandedElement).getName(), null); } ArrayList expandable = new ArrayList(); for (AbstractHistoryCategory <START> categorie : <END> categories) { if (elementMap.containsKey(categorie.getName())) { expandable.add(categorie); } } elementsToExpand = new Object[expandable.size()]; elementsToExpand = expandable.toArray(new Object[expandable.size()]); }</code><technical_language>category</technical_language>

Target:
private void mapExpandedElements(Object[] expandedElements) { HashMap elementMap = new HashMap(); for (Object expandedElement : expandedElements) { elementMap.put(((DateHistoryCategory) expandedElement).getName(), null); } ArrayList expandable = new ArrayList(); for (AbstractHistoryCategory category : categories) { if (elementMap.containsKey(category.getName())) { expandable.add(category); } } elementsToExpand = new Object[expandable.size()]; elementsToExpand = expandable.toArray(new Object[expandable.size()]); }
Source:
<code><START> protected GlusterVolumeTaskStatusEntity updateStatusEntity(GlusterVolumeTaskStatusEntity status) { <END> setStartAndStopTime(status); updateLatestStatus(status); return updateHostDetails(status); }</code><technical_language>is wong indentation, please fix</technical_language>

Target:
protected GlusterVolumeTaskStatusEntity updateStatusEntity(GlusterVolumeTaskStatusEntity status) { if (status != null) { setStartAndStopTime(status); updateLatestStatus(status); return updateHostDetails(status); } else { return null; } }
Source:
<code>protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().denyAll() .and() .exceptionHandling() .defaultAccessDeniedHandlerFor(new TeapotAccessDeniedHandler(), new HelloRequestMatcher()) .defaultAccessDeniedHandlerFor(new AccessDeniedHandlerImpl(), AnyRequestMatcher.INSTANCE) .and() <START> .csrf().disable(); <END> }</code><technical_language>csrf need disabled</technical_language>

Target:
protected void configure(HttpSecurity http) throws Exception { http .authorizeRequests() .anyRequest().denyAll() .and() .exceptionHandling() .defaultAccessDeniedHandlerFor( this.teapotDeniedHandler, new AntPathRequestMatcher("/hello/**")) .defaultAccessDeniedHandlerFor( new AccessDeniedHandlerImpl(), AnyRequestMatcher.INSTANCE); }
Source:
<code>public Response retrieveDetailsForIp(@QueryParam("ip") String ipAddress) { if (!isUserInRole("cp,ops")) { return ResponseFactory.accessDenied(); } VirtualIpLoadbalancerDetails rLbDetails; try { rLbDetails = virtualIpService.getLoadbalancerDetailsForIp(ipAddress); } catch (Exception e) { return ResponseFactory.getErrorResponse(e, null, null); } if (rLbDetails.getAccountId() == null) { return Response.status(Response.Status.NO_CONTENT).build(); } <START> return Response.status(200).entity(rLbDetails).build(); <END> }</code><technical_language><LINK_0></technical_language>

Target:
public Response retrieveDetailsForIp(@QueryParam("ip") String ipAddress) { if (!isUserInRole("cp,ops")) { return ResponseFactory.accessDenied(); } VirtualIpLoadbalancerDetails rLbDetails; try { rLbDetails = virtualIpService.getLoadbalancerDetailsForIp(ipAddress); } catch (Exception e) { return ResponseFactory.getErrorResponse(e, null, null); } if (rLbDetails.getAccountId() == null) { return Response.status(Response.Status.NO_CONTENT).build(); } return Response.status(Response.Status.OK).entity(rLbDetails).build(); }
Source:
<code>public boolean isAjax(final WebContext context) { final boolean xmlHttpRequest = AJAX_HEADER_VALUE.equalsIgnoreCase(context.getRequestHeader(AJAX_HEADER_NAME).orElse(null)); final boolean hasDynamicAjaxParameter = Boolean.TRUE.toString() .equalsIgnoreCase(context.getRequestHeader(IS_AJAX_REQUEST).orElse(null)); <START> final boolean hasDynamicAjaxHeader = Boolean.TRUE.toString() <END> .equalsIgnoreCase(context.getRequestParameter(IS_AJAX_REQUEST).orElse(null)); return xmlHttpRequest || hasDynamicAjaxParameter || hasDynamicAjaxHeader; }</code><technical_language>I orElse(null) :)</technical_language>

Target:
public boolean isAjax(final WebContext context) { final boolean xmlHttpRequest = context.getRequestHeader(AJAX_HEADER_NAME) .map(h -> AJAX_HEADER_VALUE.equalsIgnoreCase(h)) .orElse(false); final boolean hasDynamicAjaxParameter = context.getRequestHeader(IS_AJAX_REQUEST) .map(dap -> Boolean.TRUE.toString().equalsIgnoreCase(dap)) .orElse(false); final boolean hasDynamicAjaxHeader = context.getRequestParameter(IS_AJAX_REQUEST) .map(h -> Boolean.TRUE.toString().equalsIgnoreCase(h)) .orElse(false); return xmlHttpRequest || hasDynamicAjaxParameter || hasDynamicAjaxHeader; }
Source:
<code>private void processIdent(DetailAST ast) { final DetailAST parent = ast.getParent(); final int parentType = parent.getType(); if ((parentType != TokenTypes.DOT && parentType != TokenTypes.METHOD_DEF || parentType == TokenTypes.DOT && ast.getNextSibling() != null) <START> && !innerInterfaceOrClass(parentType)) { <END> referenced.add(ast.getText()); } }</code><technical_language>innerInterfaceOrClass checks parentType, in line 236 similar check is performed. merged in method</technical_language>

Target:
private void processIdent(DetailAST ast) { final DetailAST parent = ast.getParent(); final int parentType = parent.getType(); if ((parentType != TokenTypes.DOT && parentType != TokenTypes.METHOD_DEF || parentType == TokenTypes.DOT && ast.getNextSibling() != null) && !isEnumDefinitionOrType(ast) && !isAnnotation(ast) && !isInnerInterfaceOrClass(parentType)) { referenced.add(ast.getText()); } }
Source:
<code>public void addItem(final Element enumerationItem) { <START> enumerationItem.setAttribute("data-position", items.childNodes.length); <END> items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); }</code><technical_language>I extract "data-position" string a constant, widely :-)</technical_language>

Target:
public void addItem(final Element enumerationItem) { enumerationItem.setAttribute(DATA_POSITION, items.childNodes.length); items.appendChild(enumerationItem); getDragAndDropHelper().refreshItemsPosition(); }
Source:
<code>protected void doRun() throws Exception { <START> URL url = Trigger.all().get(GitHubPushTrigger.DescriptorImpl.class).getHookUrl(); <END> List<AbstractProject> jobs = Jenkins.getInstance().getAllItems(AbstractProject.class); List<GitHubRepositoryName> aliveRepos = from(jobs) .filter(withTrigger(GitHubPushTrigger.class)) .transformAndConcat(associatedNames()).toList(); while (!сleanQueue.isEmpty()) { GitHubRepositoryName name = сleanQueue.poll(); WebhookManager.forHookUrl(url).unregisterFor(name, aliveRepos); } }</code><technical_language>Skip run if queue empty allow end previous run</technical_language>

Target:
protected void doRun() throws Exception { URL url = Trigger.all().get(GitHubPushTrigger.DescriptorImpl.class).getHookUrl(); List<AbstractProject> jobs = Jenkins.getInstance().getAllItems(AbstractProject.class); List<GitHubRepositoryName> aliveRepos = from(jobs) .filter(isAlive()) .transformAndConcat(associatedNames()).toList(); while (!сleanQueue.isEmpty()) { GitHubRepositoryName name = сleanQueue.poll(); WebhookManager.forHookUrl(url).unregisterFor(name, aliveRepos); } }
Source:
<code>public float getPrefHeight() { <START> return Editor.getWidth() * this.width; <END> }</code><technical_language>getStage().getWidth()</technical_language>

Target:
public float getPrefHeight() { return this.viewport.x * this.width; }
Source:
<code>public void reloadsConfiguration() throws Exception { Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS); final File path = this.temp.newFolder(); final SSHD sshd = new SSHD(path); try { <START> sshd.start(); <END> final File key = this.temp.newFile(); FileUtils.write(key, sshd.key()); this.manifest(path, sshd.login(), sshd.port(), key); final String bin = String.format( "%s.sh", RandomStringUtils.randomAlphanumeric(128) ); final File script = this.temp.newFile(bin); final File marker = this.temp.newFile(); FileUtils.writeStringToFile( script, Joiner.on("\n").join( "#!/bin/bash", "function sighup(){", String.format(" echo restarted > %s", marker.toString()), " exit 0", "}", String.format(" echo running > %s", marker.toString()), "trap 'sighup' HUP", "sleep 30", String.format(" echo stopped > %s", marker.toString()) ) ); final ProcessBuilder builder = new ProcessBuilder( "/bin/bash", script.toString() ); builder.redirectInput(new File("/dev/null")); builder.redirectOutput(new File("/dev/null")); builder.redirectError(new File("/dev/null")); final Process process = builder.start(); new Nginx(bin).update("", 1, "", 2); process.waitFor(); MatcherAssert.assertThat( FileUtils.readFileToString(marker), Matchers.equalTo("restarted\n") ); } finally { sshd.stop(); } }</code><technical_language>I this line try. is need stop if failed start, right</technical_language>

Target:
public void reloadsConfiguration() throws Exception { Assume.assumeFalse(SystemUtils.IS_OS_WINDOWS); final SSHD sshd = new SSHD(temp); sshd.start(); final File key = File.createTempFile("ssh", "key", temp); FileUtils.write(key, sshd.key()); this.manifest(temp, sshd.login(), sshd.port(), key); final String bin = String.format( "%s.sh", RandomStringUtils.randomAlphanumeric(128) ); final File script = File.createTempFile("script", bin, temp); final File marker = File.createTempFile("marker", "temp", temp); FileUtils.writeStringToFile( script, Joiner.on("\n").join( "#!/bin/bash", "function sighup(){", String.format(" echo restarted > %s", marker.toString()), " exit 0", "}", String.format(" echo running > %s", marker.toString()), "trap 'sighup' HUP", "sleep 30", String.format(" echo stopped > %s", marker.toString()) ) ); final ProcessBuilder builder = new ProcessBuilder( "/bin/bash", script.toString() ); builder.redirectInput(new File("/dev/null")); builder.redirectOutput(new File("/dev/null")); builder.redirectError(new File("/dev/null")); final Process process = builder.start(); try { new Nginx(bin).update("", 1, "", 2); process.waitFor(); } finally { sshd.stop(); } MatcherAssert.assertThat( FileUtils.readFileToString(marker), Matchers.equalTo("restarted\n") ); }
Source:
<code>public void createWithPrimaryKeyField_invalidClassNameThrows() { <START> String[] names = { null, "", TestHelper.getRandomString(57) }; <END> for (String name : names) { try { realmSchema.createWithPrimaryKeyField(name, "pkField", int.class); fail(); } catch (IllegalArgumentException ignored) { } assertFalse(String.format("'%s' failed", name), realmSchema.contains(name)); } }</code><technical_language>avoid U+0000 other chars valid for table name in name? I update TestHelper.getRandomString(int) exclude U+0000 least</technical_language>

Target:
public void createWithPrimaryKeyField_invalidClassNameThrows() { String[] invalidNames = { null, "", TestHelper.getRandomString(57) }; for (String name : invalidNames) { try { realmSchema.createWithPrimaryKeyField(name, "pkField", int.class); fail(); } catch (IllegalArgumentException ignored) { } assertFalse(String.format("'%s' failed", name), realmSchema.contains(name)); } }
Source:
<code>public ConnectivityReceiver() { MerlinsBeardRetriever merlinsBeardRetriever = new MerlinsBeardRetriever() { @Override <START> public MerlinsBeard getMerlinsBeard(Context context) { <END> return MerlinsBeard.from(context); } }; MerlinBinderRetriever merlinBinderRetriever = new MerlinBinderRetriever() { @Override public IBinder getBinder(Context context) { return peekService(context, new Intent(context, MerlinService.class)); } }; ConnectivityChangeEventCreator creator = new ConnectivityChangeEventCreator(); connectivityChangeNotifier = new ConnectivityChangeNotifier(merlinsBeardRetriever, merlinBinderRetriever, creator); }</code><technical_language>createMerlinsBeard .. peekService do ? :D highlight a new time, expect a getX method</technical_language>

Target:
public ConnectivityReceiver() { MerlinsBeardCreator merlinsBeardCreator = new MerlinsBeardCreator() { @Override public MerlinsBeard createMerlinsBeard(Context context) { return MerlinsBeard.from(context); } }; MerlinBinderRetriever merlinBinderRetriever = new MerlinBinderRetriever() { @Override public IBinder retrieveMerlinLocalServiceBinderIfAvailable(Context context) { return peekService(context, new Intent(context, MerlinService.class)); } }; ConnectivityChangeEventCreator creator = new ConnectivityChangeEventCreator(); connectivityChangeNotifier = new ConnectivityChangeNotifier(merlinsBeardCreator, merlinBinderRetriever, creator); }
Source:
<code>public static <V> V get(Future<V> future, Timeout millis) { try { return com.google.common.util.concurrent.Futures.makeUninterruptible(future).get(millis.getValue(), TimeUnit.MILLISECONDS); } catch (ExecutionException e) { <START> log.error("Execution failed {}", Throwables.getStackTraceAsString(e)); <END> throw Throwables.propagate(e); } catch (TimeoutException e) { log.error("Timeout of failed \n{}", millis.toString(), Throwables.getStackTraceAsString(e)); throw Throwables.propagate(e); } }</code><technical_language>this</technical_language>

Target:
public static <V> V get(Future<V> future, Timeout millis) { try { return com.google.common.util.concurrent.Futures.makeUninterruptible(future).get(millis.getValue(), TimeUnit.MILLISECONDS); } catch (ExecutionException e) { log.error("Execution failed {}", e); throw Throwables.propagate(e); } catch (TimeoutException e) { log.error("Timeout of failed \n{}", millis.toString(), e); throw Throwables.propagate(e); } }
Source:
<code>public void preProcess(INDArray array, MinMaxStats stats) { if (array.rank() == 2) { <START> array.subiRowVector(stats.getLower()); <END> array.diviRowVector(stats.getRange()); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getLower(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, stats.getUpper(), array, 1)); } array.muli(maxRange - minRange); array.addi(minRange); }</code><technical_language>isMatrix()? row vector case? ran in bugs in subiRowVector applied row vector. want this explicit</technical_language>

Target:
public void preProcess(INDArray array, MinMaxStats stats) { if (array.rank() <= 2) { array.subiRowVector(stats.getLower()); array.diviRowVector(stats.getRange()); } else { Nd4j.getExecutioner().execAndReturn(new BroadcastSubOp(array, stats.getLower(), array, 1)); Nd4j.getExecutioner().execAndReturn(new BroadcastDivOp(array, stats.getRange(), array, 1)); } array.muli(maxRange - minRange); array.addi(minRange); }
Source:
<code>protected ResourceManager registerInRM(final Credentials credentials, final String rmURL, final String nodeName, final List<Node> nodes) { RMAuthentication auth = joinResourceManager(rmURL); final ResourceManager rm = loginToResourceManager(credentials, auth); if(!disabledMonitoring) { SigarExposer sigarExposer = new SigarExposer(nodeName); final RMAuthentication rmAuth = auth; sigarExposer.boot(auth, false, new PermissionChecker() { @Override public boolean checkPermission(Credentials cred) { ResourceManager rm = null; try { rm = rmAuth.login(cred); if (NB_OF_ADD_NODE_ATTEMPTS == 0) return true; boolean isAdmin = rm.isNodeAdmin(nodes.get(0).getNodeInformation().getURL()) .getBooleanValue(); if (!isAdmin) { throw new SecurityException("Permission denied"); } return true; } catch (LoginException e) { throw new SecurityException(e); } finally { if (rm != null) { rm.disconnect(); } } } }); for (final Node node : nodes) { try { node.setProperty(JMX_URL + JMXTransportProtocol.RMI, sigarExposer.getAddress( JMXTransportProtocol.RMI).toString()); node.setProperty(JMX_URL + JMXTransportProtocol.RO, sigarExposer.getAddress( JMXTransportProtocol.RO).toString()); } catch (Exception e) { logger.error("", e); } } }else { logger.info("JMX monitoring is disabled."); } <START> for (final Node node : nodes) { <END> addNodeToResourceManager(rmURL, node, rm); } return rm; }</code><technical_language>In a performance point of view, in case nodes, this for loop out of disabledMonitoring condition (like currently is), add a if (!disabledMonitoring)... Inside. discussed/confirmed.</technical_language>

Target:
protected ResourceManager registerInRM(final Credentials credentials, final String rmURL, final String nodeName, final List<Node> nodes) { RMAuthentication auth = joinResourceManager(rmURL); final ResourceManager rm = loginToResourceManager(credentials, auth); SigarExposer sigarExposer = null; if(!disabledMonitoring) { sigarExposer = new SigarExposer(nodeName); final RMAuthentication rmAuth = auth; sigarExposer.boot(auth, false, new PermissionChecker() { @Override public boolean checkPermission(Credentials cred) { ResourceManager rm = null; try { rm = rmAuth.login(cred); if (NB_OF_ADD_NODE_ATTEMPTS == 0) return true; boolean isAdmin = rm.isNodeAdmin(nodes.get(0).getNodeInformation().getURL()) .getBooleanValue(); if (!isAdmin) { throw new SecurityException("Permission denied"); } return true; } catch (LoginException e) { throw new SecurityException(e); } finally { if (rm != null) { rm.disconnect(); } } } }); }else { logger.info("JMX monitoring is disabled."); } for (final Node node : nodes) { nodeSetJmxUrl(sigarExposer, node); addNodeToResourceManager(rmURL, node, rm); } return rm; }
Source:
<code>BlobBatchAsyncClient(String accountUrl, HttpPipeline pipeline, BlobServiceVersion version) { this.client = new AzureBlobStorageBuilder() .url(accountUrl) .pipeline(pipeline) <START> .version(version.getVersionString()) <END> .build(); }</code><technical_language>is public API worry changing that, get @alzimmermsft / @jianghaolu review this ensure builders a serviceVersion API version other naming convention</technical_language>

Target:
BlobBatchAsyncClient(String accountUrl, HttpPipeline pipeline, BlobServiceVersion version) { this.client = new AzureBlobStorageBuilder() .url(accountUrl) .pipeline(pipeline) .version(version.getVersion()) .build(); }
Source:
<code>public void saveOrder_shouldFailDiscontinueNonCodedDrugOrderIfOrderableOfPreviousAndNewOrderDontMatch() throws Exception { executeDataSet("org/openmrs/api/include/OrderServiceTest-nonCodedDrugs.xml"); DrugOrder previousOrder = (DrugOrder) orderService.getOrder(584); DrugOrder drugOrder = previousOrder.cloneForDiscontinuing(); <START> drugOrder.setDrugNonCoded("non coded drug paracetemol"); <END> drugOrder.setPreviousOrder(previousOrder); drugOrder.setDateActivated(new Date()); drugOrder.setOrderer(providerService.getProvider(1)); drugOrder.setEncounter(encounterService.getEncounter(6)); expectedException.expect(APIException.class); expectedException.expectMessage("The orderable of the previous order and the new one order don't match"); orderService.saveOrder(drugOrder, null); }</code><technical_language>Copy this previous ensure previous' null</technical_language>

Target:
public void saveOrder_shouldFailDiscontinueNonCodedDrugOrderIfOrderableOfPreviousAndNewOrderDontMatch() throws Exception { executeDataSet("org/openmrs/api/include/OrderServiceTest-nonCodedDrugs.xml"); DrugOrder previousOrder = (DrugOrder) orderService.getOrder(584); DrugOrder drugOrder = previousOrder.cloneForDiscontinuing(); drugOrder.setDrugNonCoded("non coded drug citrigine"); drugOrder.setPreviousOrder(previousOrder); drugOrder.setDateActivated(new Date()); drugOrder.setOrderer(providerService.getProvider(1)); drugOrder.setEncounter(encounterService.getEncounter(6)); expectedException.expect(APIException.class); expectedException.expectMessage("The orderable of the previous order and the new one order don't match"); orderService.saveOrder(drugOrder, null); }
Source:
<code>private int getAbsoluteVolumeIndex(int index) { if (index == 0) { index = 0; } <START> else if (index == 1) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[0]) /10; } else if (index == 2) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[1]) /10; } else if (index == 3) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[2]) /10; } else <END> { index = (mIndexMax + 5)/10; } return index; }</code><technical_language>else if ((index > 0) && (index =< 3)) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[index-1]) /10; }</technical_language>

Target:
private int getAbsoluteVolumeIndex(int index) { if (index == 0) { index = 0; } else if (index > 0 && index <= 3) { index = (int)(mIndexMax * mPrescaleAbsoluteVolume[index - 1]) /10; } else { index = (mIndexMax + 5)/10; } return index; }
Source:
<code>OrcFileWriter( List<Long> columnIds, List<Type> columnTypes, File target, boolean writeMetadata, boolean validate, OrcWriterStats stats, TypeManager typeManager) { checkArgument(requireNonNull(columnIds, "columnIds is null").size() == requireNonNull(columnTypes, "columnTypes is null").size(), "ids and types mismatch"); checkArgument(isUnique(columnIds), "ids must be unique"); StorageTypeConverter converter = new StorageTypeConverter(typeManager); List<Type> storageTypes = columnTypes.stream() .map(converter::toStorageType) .collect(toImmutableList()); List<String> columnNames = columnIds.stream().map(Object::toString).collect(toImmutableList()); try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(FileSystem.class.getClassLoader())) { Map<String, String> userMetadata = ImmutableMap.of(); if (writeMetadata) { ImmutableMap.Builder<Long, TypeSignature> columnTypesMap = ImmutableMap.builder(); for (int i = 0; i < columnIds.size(); i++) { <START> columnTypesMap.put(columnIds.get(i), storageTypes.get(i).getTypeSignature()); <END> } userMetadata = ImmutableMap.of(OrcFileMetadata.KEY, METADATA_CODEC.toJson(new OrcFileMetadata(columnTypesMap.build()))); } orcWriter = new OrcWriter( new OutputStreamOrcDataSink(new FileOutputStream(target)), columnNames, storageTypes, ORC, SNAPPY, DEFAULT_OPTION, userMetadata, DEFAULT_STORAGE_TIMEZONE, validate, HASHED, stats); } catch (IOException e) { throw new PrestoException(RAPTOR_ERROR, "Failed to create writer", e); } }</code><technical_language>actual column type instead of storageType here. bug in OrcStorageManager.java:getColumnInfo()</technical_language>

Target:
OrcFileWriter( List<Long> columnIds, List<Type> columnTypes, File target, boolean writeMetadata, boolean validate, OrcWriterStats stats, TypeManager typeManager) { checkArgument(requireNonNull(columnIds, "columnIds is null").size() == requireNonNull(columnTypes, "columnTypes is null").size(), "ids and types mismatch"); checkArgument(isUnique(columnIds), "ids must be unique"); StorageTypeConverter converter = new StorageTypeConverter(typeManager); List<Type> storageTypes = columnTypes.stream() .map(converter::toStorageType) .collect(toImmutableList()); List<String> columnNames = columnIds.stream().map(Object::toString).collect(toImmutableList()); try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(FileSystem.class.getClassLoader())) { Map<String, String> userMetadata = ImmutableMap.of(); if (writeMetadata) { ImmutableMap.Builder<Long, TypeSignature> columnTypesMap = ImmutableMap.builder(); for (int i = 0; i < columnIds.size(); i++) { columnTypesMap.put(columnIds.get(i), columnTypes.get(i).getTypeSignature()); } userMetadata = ImmutableMap.of(OrcFileMetadata.KEY, METADATA_CODEC.toJson(new OrcFileMetadata(columnTypesMap.build()))); } orcWriter = new OrcWriter( new OutputStreamOrcDataSink(new FileOutputStream(target)), columnNames, storageTypes, ORC, SNAPPY, DEFAULT_OPTION, userMetadata, DEFAULT_STORAGE_TIMEZONE, validate, HASHED, stats); } catch (IOException e) { throw new PrestoException(RAPTOR_ERROR, "Failed to create writer", e); } }
Source:
<code>private Optional<Vertex> getPredicateValueTypeVertexFor(Vre vre) { <START> return graph.traversal().V() <END> .has(T.label, LabelP.of(Vre.DATABASE_LABEL)) .has(Vre.VRE_NAME_PROPERTY_NAME, vre.getVreName()) .out(Vre.HAS_PREDICATE_VALUE_TYPE_VERTEX_RELATION_NAME) .toStream() .findAny(); }</code><technical_language>re-use getVreTraversal here</technical_language>

Target:
private Optional<Vertex> getPredicateValueTypeVertexFor(Vre vre) { return getVreTraversal(vre.getVreName()) .out(Vre.HAS_PREDICATE_VALUE_TYPE_VERTEX_RELATION_NAME) .toStream() .findAny(); }
Source:
<code>public Principal createIdentity(String username) throws LoginException { log.debug("createIdentity: " + username); try { NuxeoPrincipal[] principals = new NuxeoPrincipal[1]; if (manager == null) { principals[0] = new NuxeoPrincipalImpl(username); } else { <START> Framework.doPrivileged(() -> principals[0] = manager.getPrincipal(username)); <END> if (principals[0] == null) { throw new LoginException(String.format("principal %s does not exist", username)); } } NuxeoPrincipal principal = principals[0]; String principalId = String.valueOf(random.nextLong()); principal.setPrincipalId(principalId); return principal; } catch (LoginException e) { log.error("createIdentity failed", e); LoginException le = new LoginException("createIdentity failed for user " + username); le.initCause(e); throw le; } }</code><technical_language>changed Framework#doPrivileged(Supplier)</technical_language>

Target:
public Principal createIdentity(String username) throws LoginException { log.debug("createIdentity: " + username); try { NuxeoPrincipal principal; if (manager == null) { principal = new NuxeoPrincipalImpl(username); } else { principal = Framework.doPrivileged(() -> manager.getPrincipal(username)); if (principal == null) { throw new LoginException(String.format("principal %s does not exist", username)); } } String principalId = String.valueOf(random.nextLong()); principal.setPrincipalId(principalId); return principal; } catch (LoginException e) { log.error("createIdentity failed", e); LoginException le = new LoginException("createIdentity failed for user " + username); le.initCause(e); throw le; } }
Source:
<code>private String read(String prompt, Character mask) { Prompt origPrompt = null; if (!console.getPrompt().getPromptAsString().equals(prompt)) { origPrompt = console.getPrompt(); console.setPrompt(new Prompt(prompt, mask)); } try { return console.getInputLine(); } catch (InterruptedException e) { <START> e.printStackTrace(); <END> } finally { if (origPrompt != null) { console.setPrompt(origPrompt); } } return null; }</code><technical_language>want set interrupt state</technical_language>

Target:
private String read(String prompt, Character mask) { Prompt origPrompt = null; if (!console.getPrompt().getPromptAsString().equals(prompt)) { origPrompt = console.getPrompt(); console.setPrompt(new Prompt(prompt, mask)); } try { return console.getInputLine(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } finally { if (origPrompt != null) { console.setPrompt(origPrompt); } } return null; }
Source:
<code>private Set<Publisher> getPublishers(String publisher, Application application) { if (!Strings.isNullOrEmpty(publisher)) { return Sets.intersection(publishersFrom(publisher), application.getConfiguration().getEnabledReadSources()); } if (application.getConfiguration().isPrecedenceEnabled()) { <START> return ImmutableSet.of(application.getConfiguration().getEnabledReadSources().asList().get(0)); <END> } throw new IllegalArgumentException("Need precedence enabled"); }</code><technical_language>asList() give sources in correct order. need sort ordering first</technical_language>

Target:
private Set<Publisher> getPublishers(String publisher, Application application) { if (!Strings.isNullOrEmpty(publisher)) { return Sets.intersection( publishersFrom(publisher), application.getConfiguration().getEnabledReadSources() ); } if (application.getConfiguration().isPrecedenceEnabled()) { return ImmutableSet.of( application.getConfiguration() .getReadPrecedenceOrdering() .sortedCopy(application.getConfiguration().getEnabledReadSources()) .get(0) ); } throw new IllegalArgumentException("Need precedence enabled"); }
Source:
<code>public final String getContent() throws IOException { if (content == null) { return null; } <START> ByteArrayOutputStream out = new ByteArrayOutputStream(); <END> ByteStreams.copy(new ByteArrayInputStream(content), out); return out.toString(charset.name()); }</code><technical_language>this work return new String(content, charset.name())</technical_language>

Target:
public final String getContent() { if (content == null) { return null; } try { return new String(content, charset.name()); } catch (UnsupportedEncodingException exception) { } return null; }
Source:
<code>public WifiSsidPreference(Context context, AttributeSet attrs) { super(context, attrs); <START> setDialogLayoutResource(R.layout.preference_wifi_ssids); <END> }</code><technical_language>Is a reason a custom layout? Nexus 5, a bit weird free space bottom. I default layout (same for list items)</technical_language>

Target:
public WifiSsidPreference(Context context, AttributeSet attrs) { super(context, attrs); }
Source:
<code>public void updateGenericPomNoOptionalJson() { String prj = "/target/test-classes/generic_no_json/"; Path path = Paths.get("file:" + currentDir + prj + "pom.xml"); Path pathCopy = Paths.get("file:" + currentDir + prj + "copy_pom.xml"); Files.copy(path, pathCopy); try { Model original = editor.getModel(path); assertEquals(original.getPackaging(), "jar"); assertTrue(original.getBuild().getPlugins().size() == 1); assertTrue(original.getDependencies().size() == 3); assertTrue(original.getRepositories().size() == 2); assertTrue(original.getPluginRepositories().size() == 1); Model modelUpdated = editor.updatePomWithoutWrite(path); assertNotNull(modelUpdated); assertEquals(modelUpdated.getPackaging(), "kjar"); assertTrue(modelUpdated.getBuild().getPlugins().size() == 1); assertTrue(modelUpdated.getDependencies().size() == 6); assertTrue(modelUpdated.getRepositories().size() == 0); assertTrue(modelUpdated.getPluginRepositories().size() == 0); <START> } catch (Exception e) { <END> logger.error(e.getMessage(), e); throw new AssertionError(e.getMessage()); } finally { Files.delete(path); Files.copy(pathCopy, path); Files.delete(pathCopy); } }</code><technical_language>This try-catch-finally is redundant in tests. catch exception do cleanup in finally, remove try-catch wrapping do cleanup in @After cleanup method</technical_language>

Target:
public void updateGenericPomNoOptionalJson() { String prj = "/target/test-classes/generic_no_json/"; path = Paths.get("file:" + currentDir + prj + "pom.xml"); pathCopy = Paths.get("file:" + currentDir + prj + "copy_pom.xml"); Files.copy(path, pathCopy); try { Model original = editor.getModel(path); assertThat(original.getPackaging()).isEqualToIgnoringCase("jar"); assertThat(original.getBuild().getPlugins()).hasSize(1); assertThat(original.getDependencies()).hasSize(3); assertThat(original.getRepositories()).hasSize(2); assertThat(original.getPluginRepositories()).hasSize(1); Model modelUpdated = editor.updatePomWithoutWrite(path); assertThat(modelUpdated).isNotNull(); assertThat(modelUpdated.getPackaging()).isEqualToIgnoringCase("kjar"); assertThat(modelUpdated.getBuild().getPlugins()).hasSize(1); assertThat(modelUpdated.getDependencies()).hasSize(6); assertThat(modelUpdated.getRepositories()).hasSize(0); assertThat(modelUpdated.getPluginRepositories()).hasSize(0); } catch (Exception e) { logger.error(e.getMessage(), e); throw new AssertionError(e.getMessage()); } }
Source:
<code>private void updateActionAvailability() { boolean allowCreateSnapshot = true; if (getEntity() == null || getEntity().getStatus() == GlusterStatus.DOWN) { allowCreateSnapshot = false; } getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); <START> boolean allowEditSnapshotSchedule = false; <END> if (getEntity() != null && getEntity().getStatus() == GlusterStatus.UP && getEntity().getSnapshotScheduled()) { allowEditSnapshotSchedule = true; } getEditSnapshotScheduleCommand().setIsAvailable(allowEditSnapshotSchedule); }</code><technical_language>please this declaration boolean allowCreateSnapshot = true;</technical_language>

Target:
private void updateActionAvailability() { boolean allowCreateSnapshot = true; boolean allowEditSnapshotSchedule = false; if (getEntity() == null || getEntity().getStatus() == GlusterStatus.DOWN) { allowCreateSnapshot = false; } if (getEntity() != null && getEntity().getStatus() == GlusterStatus.UP && getEntity().getSnapshotScheduled()) { allowEditSnapshotSchedule = true; } getNewSnapshotCommand().setIsAvailable(allowCreateSnapshot); getEditSnapshotScheduleCommand().setIsAvailable(allowEditSnapshotSchedule); }
Source:
<code>protected void close(boolean flushBeforeClose) { synchronized (lock) { closed = true; if(flushBeforeClose && responseFlushed) { ResteasyContext.pushContextDataMap(contextDataMap); try { AsyncOutputStream aos = response.getAsyncOutputStream(); aos.asyncFlush().toCompletableFuture().get(); }catch(IOException | InterruptedException | ExecutionException x) { }finally { ResteasyContext.removeContextDataLevel(); } } if (asyncContext.isSuspended()) { ResteasyAsynchronousResponse asyncResponse = asyncContext.getAsyncResponse(); if (asyncResponse != null) { try { asyncResponse.complete(); } catch(RuntimeException x) { Throwable cause = x; while(cause.getCause() != null) cause = cause.getCause(); <START> if(cause instanceof IOException) { <END> }else { throw x; } } } } clearContextData(); } }</code><technical_language>cause.getCause() != null && cause.getCause() !=</technical_language>

Target:
protected void close(boolean flushBeforeClose) { synchronized (lock) { closed = true; if(flushBeforeClose && responseFlushed) { ResteasyContext.pushContextDataMap(contextDataMap); try { AsyncOutputStream aos = response.getAsyncOutputStream(); aos.asyncFlush().toCompletableFuture().get(); }catch(IOException | InterruptedException | ExecutionException x) { }finally { ResteasyContext.removeContextDataLevel(); } } if (asyncContext.isSuspended()) { ResteasyAsynchronousResponse asyncResponse = asyncContext.getAsyncResponse(); if (asyncResponse != null) { try { asyncResponse.complete(); } catch(RuntimeException x) { Throwable cause = x; while(cause.getCause() != null) cause = cause.getCause(); if(cause instanceof IOException) { }else { LOG.debug(cause.getMessage()); return; } } } } clearContextData(); } }