auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code><START> public FileCopyRecordWriter(Configuration conf) throws Exception { <END> String uriString; if ((uriString = conf.get(FileCopyOutputFormat.FS_HOST_URI, null)) != null) { destFileSystem = FileSystem.get(URI.create(uriString), conf); } else { destFileSystem = FileSystem.get(conf); } basePath = conf.get(FileCopyOutputFormat.BASE_PATH); enableOverwrite = conf.getBoolean(FileCopyOutputFormat.ENABLE_OVERWRITE, false); preserveOwner = conf.getBoolean(FileCopyOutputFormat.PRESERVE_OWNER, false); fsCache = conf.getBoolean(FileCopyOutputFormat.FS_CACHE, true); bufferSize = conf.getInt(FileCopyOutputFormat.BUFFER_SIZE, defaultBufferSize); sourceFilesystemMap = new HashMap<>(); }</code><technical_language>throw specific exception possible. I this IOException</technical_language>

Target:
public FileCopyRecordWriter(Configuration conf) throws IOException { conf.set(String.format("fs.%s.impl.disable.cache", conf.get(FileCopyOutputFormat.FS_SCHEME)), String.valueOf(true)); String uriString = conf.get(FileCopyOutputFormat.FS_HOST_URI, null); if (uriString != null) { destFileSystem = FileSystem.get(URI.create(uriString), conf); } else { destFileSystem = FileSystem.get(conf); } basePath = conf.get(FileCopyOutputFormat.BASE_PATH); enableOverwrite = conf.getBoolean(FileCopyOutputFormat.ENABLE_OVERWRITE, false); preserveOwner = conf.getBoolean(FileCopyOutputFormat.PRESERVE_OWNER, false); bufferSize = conf.getInt(FileCopyOutputFormat.BUFFER_SIZE, DEFAULT_BUFFER_SIZE); sourceFilesystemMap = new HashMap<>(); }
Source:
<code>public void testChannelMustBeClosedRegardlessError() { FileSystemProvider fsProvider = new K8SFileSystemProvider() { @Override public KubernetesClient createKubernetesClient() { return CLIENT_FACTORY.get(); } }; final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create("k8s:/ final Path valid = kfs.getPath("/test"); K8SFileChannel k8sfc = new K8SFileChannel(valid, (CloudClientFactory) fsProvider); assertTrue(k8sfc.isOpen()); k8sfc.ccf = null; try { k8sfc.close(); <START> } catch (Exception e) { <END> } assertFalse(k8sfc.isOpen()); }</code><technical_language>suggestion k8sfc.close(); fail("Channel close throw exception.");</technical_language>

Target:
public void testChannelMustBeClosedRegardlessError() { FileSystemProvider fsProvider = new K8SFileSystemProvider() { @Override public KubernetesClient createKubernetesClient() { return CLIENT_FACTORY.get(); } }; final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create("k8s:/ final Path valid = kfs.getPath("/test"); K8SFileChannel k8sfc = new K8SFileChannel(valid, (CloudClientFactory) fsProvider); assertTrue(k8sfc.isOpen()); k8sfc.ccf = null; try { k8sfc.close(); fail("Channel close should throw an exception."); } catch (Exception e) { } assertFalse(k8sfc.isOpen()); }
Source:
<code>public void update() throws Exception { DomainNameList names = new DomainNameList(Lists.newArrayList("dName1", "dName2")); List<String> namesDTO = Lists.newArrayList("dName1", "dName2"); List<Network3GPP> networks = Lists.newArrayList(new Network3GPP("name", "359", "44")); List<Network3GPPDTO> networkDTOs = Lists.newArrayList(new Network3GPPDTO("name", "359", "44")); List<RoamingConsortium> list = Lists.newArrayList(new RoamingConsortium("name", "0xAAFFAA")); List<RoamingConsortiumDTO> listDTO = Lists.newArrayList(new RoamingConsortiumDTO("name", "0xAAFFAA")); ServiceProviderDTO dto = new ServiceProviderDTO("id", "name", "description", networkDTOs, namesDTO, listDTO); final ServiceProvider provider = new ServiceProvider(new ID("id"), dto.name, dto.description, networks, names, list); Request request = makeRequestThatContains(dto); context.checking(new Expectations() {{ oneOf(repository).update(with(matching(provider))); }}); <START> Reply<?> reply = service.update("id", request); <END> assertThat(reply, isOk()); }</code><technical_language>id this is set in DTO</technical_language>

Target:
public void update() throws Exception { DomainNameList names = new DomainNameList(Lists.newArrayList("dName1", "dName2")); List<String> namesDTO = Lists.newArrayList("dName1", "dName2"); List<Network3GPP> networks = Lists.newArrayList(new Network3GPP("name", "359", "44")); List<Network3GPPDTO> networkDTOs = Lists.newArrayList(new Network3GPPDTO("name", "359", "44")); List<RoamingConsortium> list = Lists.newArrayList(new RoamingConsortium("name", "0xAAFFAA")); List<RoamingConsortiumDTO> listDTO = Lists.newArrayList(new RoamingConsortiumDTO("name", "0xAAFFAA")); ServiceProviderDTO dto = new ServiceProviderDTO("1234", "name", "description", networkDTOs, namesDTO, listDTO); final ServiceProvider provider = new ServiceProvider(new ID("id"), dto.name, dto.description, networks, names, list); Request request = makeRequestThatContains(dto); context.checking(new Expectations() {{ oneOf(repository).update(with(matching(provider))); }}); Reply<?> reply = service.update("id", request); assertThat(reply, isOk()); }
Source:
<code>public void removeObserver(@NonNull Observer<T> observer) { <START> throw new UnsupportedOperationException("removeObserver not supported."); <END> }</code><technical_language>Awww... I wish this work, pretty crash if rotate activity (I wrong, a good idea try it). source code: java public final LifecycleOwner owner; public final Observer<T> observer; LifecycleBoundObserver(LifecycleOwner owner, Observer<T> observer) { this.owner = owner; this.observer = observer; } @Override public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) { if (owner.getLifecycle().getCurrentState() == DESTROYED) { removeObserver(observer); // <-- BOOM! return; } }</technical_language>

Target:
public void removeObserver(@NonNull Observer<T> observer) { super.removeObserver(observer); }
Source:
<code>public void dispose() { SessionManager.INSTANCE.removeSessionsListener(this); session = null; treeViewer = null; manageSessionActionProvider = null; siriusCommonContentProvider = null; <START> menuManager = null; <END> }</code><technical_language>good set null toolkit</technical_language>

Target:
public void dispose() { SessionManager.INSTANCE.removeSessionsListener(this); session = null; treeViewer = null; manageSessionActionProvider = null; siriusCommonContentProvider = null; menuManager = null; toolkit = null; }
Source:
<code>private List<TreeViewGroupMetricsToNodeRule> provideRulesForPlotsNode() { List<TreeViewGroupMetricsToNodeRule> result = new ArrayList<TreeViewGroupMetricsToNodeRule>(); String regex = "^(" + StandardMetricsNamesUtil.THROUGHPUT_ID + "|" + StandardMetricsNamesUtil.THROUGHPUT + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.THROUGHPUT_ID, StandardMetricsNamesUtil.THROUGHPUT, regex)); regex = "^(" + StandardMetricsNamesUtil.VIRTUAL_USERS_ID + "|" + <START> StandardMetricsNamesUtil.VIRTUAL_USERS + ".*" + <END> ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.VIRTUAL_USERS_ID, StandardMetricsNamesUtil.VIRTUAL_USERS, regex)); regex = "^(" + StandardMetricsNamesUtil.LATENCY_ID + "|" + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID + "|" + StandardMetricsNamesUtil.LATENCY + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.LATENCY_ID + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID, StandardMetricsNamesUtil.LATENCY, regex)); regex = "^" + StandardMetricsNamesUtil.LATENCY_PERCENTILE_REGEX + "|" + StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "_id", StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE, regex)); return result; }</code><technical_language>display name is required in regexp? id</technical_language>

Target:
private List<TreeViewGroupMetricsToNodeRule> provideRulesForPlotsNode() { List<TreeViewGroupMetricsToNodeRule> result = new ArrayList<TreeViewGroupMetricsToNodeRule>(); String regex = "^(" + StandardMetricsNamesUtil.THROUGHPUT_ID + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.THROUGHPUT_ID, StandardMetricsNamesUtil.THROUGHPUT, regex)); regex = "^(" + StandardMetricsNamesUtil.VIRTUAL_USERS_ID + ".*" + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.VIRTUAL_USERS_ID, StandardMetricsNamesUtil.VIRTUAL_USERS, regex)); regex = "^(" + StandardMetricsNamesUtil.LATENCY_ID + "|" + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.LATENCY_ID + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID, StandardMetricsNamesUtil.LATENCY, regex)); regex = "^" + StandardMetricsNamesUtil.LATENCY_PERCENTILE_REGEX + "|" + StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "_id", StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE, regex)); return result; }
Source:
<code>public void testReplaceDuplicateJavaDocComment() { CompilationUnit cu = parse("public class MyClass {" + EOL + EOL + " " + EOL + " public void oneMethod() {" + EOL + " }" + EOL + EOL + " " + EOL + " public void anotherMethod() {" + EOL + " }" + EOL + "}" + EOL); MethodDeclaration methodDeclaration = cu.findFirst(MethodDeclaration.class).get(); Javadoc javadoc = new Javadoc(JavadocDescription.parseText("Change Javadoc")); methodDeclaration.setJavadocComment("", javadoc); <START> assertEquals("public class MyClass {" + EOL + <END> EOL + " " + EOL + " public void oneMethod() {" + EOL + " }" + EOL + EOL + " " + EOL + " public void anotherMethod() {" + EOL + " }" + EOL + "}" + EOL, cu.toString(prettyPrintConfig)); }</code><technical_language>a assertEqualsNoEol (or so) - building unix windows is painful, do comparing eol's :-)</technical_language>

Target:
public void testReplaceDuplicateJavaDocComment() { CompilationUnit cu = parse("public class MyClass {" + EOL + EOL + " " + EOL + " public void oneMethod() {" + EOL + " }" + EOL + EOL + " " + EOL + " public void anotherMethod() {" + EOL + " }" + EOL + "}" + EOL); MethodDeclaration methodDeclaration = cu.findFirst(MethodDeclaration.class).get(); Javadoc javadoc = new Javadoc(JavadocDescription.parseText("Change Javadoc")); methodDeclaration.setJavadocComment("", javadoc); assertEqualsNoEol("public class MyClass {\n" + "\n" + " \n" + " public void oneMethod() {\n" + " }\n" + "\n" + " \n" + " public void anotherMethod() {\n" + " }\n" + "}\n", cu.toString(PRETTY_PRINTER_CONFIG_TWO_INDENT)); }
Source:
<code>protected boolean canDoAction() { boolean returnValue = true; <START> synchronized (_lockObject) { <END> if (GetVmToAttach(getParameters().getVmPoolId()).equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = DbFacade.getInstance().getVmDAO().getAllForUser(getAdUserId()); for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_USER_ATTACHED_TO_POOL); returnValue = false; } } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }</code><technical_language>== for enum comparisons</technical_language>

Target:
protected boolean canDoAction() { boolean returnValue = true; synchronized (_lockObject) { if (GetVmToAttach(getParameters().getVmPoolId()) == (Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = DbFacade.getInstance().getVmDAO().getAllForUser(getAdUserId()); for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_USER_ATTACHED_TO_POOL); returnValue = false; } } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }
Source:
<code>public void enterVariableDeclaration(SwiftParser.VariableDeclarationContext ctx) { ParseTreeWalker walker = new ParseTreeWalker(); if (ctx.patternInitializerList() == null) { return; } for (SwiftParser.PatternInitializerContext context : ctx.patternInitializerList().patternInitializer()) { SwiftParser.PatternContext pattern = context.pattern(); <START> listenerHelper.evaluatePattern(pattern, walker, new VariableDecListener(this.printer, this.maxLengths)); <END> } }</code><technical_language>Code duplication (Lines 164 - 167). extract a separate method</technical_language>

Target:
public void enterVariableDeclaration(SwiftParser.VariableDeclarationContext ctx) { if (ctx.patternInitializerList() == null) { return; } listenerHelper.evaluatePatternInitializerList(ctx.patternInitializerList(), new VariableDecListener(this.printer, this.maxLengths)); }
Source:
<code>public void shouldSaveRuleAction() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final Host host = new SiteDataGen().nextPersisted(); final Rule rule = new RuleDataGen().host(host).nextPersisted(); this.addPermission(role, host, true); final RuleAction ruleAction = new RuleActionDataGen().rule(rule).next(); rulesAPI.saveRuleAction(ruleAction, user, false); final List<Rule> allRules = rulesAPI.getAllRules(user, false); <START> assertEquals(1, allRules.size()); <END> final List<RuleAction> ruleActions = allRules.get(0).getRuleActions(); assertEquals(1, ruleActions.size()); assertEquals(ruleAction.getActionDefinition(), ruleAction.getActionDefinition()); }</code><technical_language>assert needed</technical_language>

Target:
public void shouldSaveRuleAction() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final Host host = new SiteDataGen().nextPersisted(); final Rule rule = new RuleDataGen().host(host).nextPersisted(); this.addPermission(role, host, true); final RuleAction ruleAction = new RuleActionDataGen().rule(rule).next(); rulesAPI.saveRuleAction(ruleAction, user, false); final List<Rule> allRules = rulesAPI.getAllRules(user, false); final List<RuleAction> ruleActions = allRules.get(0).getRuleActions(); assertEquals(1, ruleActions.size()); assertEquals(ruleAction.getActionDefinition(), ruleActions.get(0).getActionDefinition()); }
Source:
<code>void setupConnection(final Connection connection, final long connectionTimeout) throws SQLException { if (isUseJdbc4Validation && !isJdbc4ValidationSupported(connection)) { throw new SQLException("Connection.isValid() is not supported, configure connection test query."); } networkTimeout = getAndSetNetworkTimeout(connection, connectionTimeout); connection.setAutoCommit(isAutoCommit); connection.setReadOnly(isReadOnly); <START> if (transactionIsolation == -1) { <END> transactionIsolation = connection.getTransactionIsolation(); } else if (transactionIsolation != Connection.TRANSACTION_NONE) { connection.setTransactionIsolation(transactionIsolation); } if (catalog != null) { connection.setCatalog(catalog); } executeSql(connection, config.getConnectionInitSql(), isAutoCommit); setNetworkTimeout(connection, networkTimeout); }</code><technical_language>This connection default isolation..</technical_language>

Target:
void setupConnection(final Connection connection, final long connectionTimeout) throws SQLException { if (isUseJdbc4Validation && !isJdbc4ValidationSupported(connection)) { throw new SQLException("Connection.isValid() is not supported, configure connection test query."); } networkTimeout = getAndSetNetworkTimeout(connection, connectionTimeout); connection.setAutoCommit(isAutoCommit); connection.setReadOnly(isReadOnly); final int defaultLevel = connection.getTransactionIsolation(); transactionIsolation = (transactionIsolation < 0 || defaultLevel == Connection.TRANSACTION_NONE) ? defaultLevel : transactionIsolation; if (transactionIsolation != defaultLevel) { connection.setTransactionIsolation(transactionIsolation); } if (catalog != null) { connection.setCatalog(catalog); } executeSql(connection, config.getConnectionInitSql(), isAutoCommit); setNetworkTimeout(connection, networkTimeout); }
Source:
<code>public void sendToJail(final IUser user, final String jail) throws Exception { CompletableFuture<Exception> eFuture = new CompletableFuture<>(); CompletableFuture<Boolean> future = new CompletableFuture<>(); <START> sendToJail(user, jail, eFuture, future); if (!future.get()) { throw eFuture.get(); } <END> }</code><technical_language>if a 3rd party plugin calls this deadlock server. more clear talking 'deadlocking' in discord. this is case - imagine following: 1) sendToJail is called 2) server a 'cache miss', resulting in a chunk load. 3) wait! paper, a cool async chunk load 4) server loads chunk in a separate thread 5) Server continue 126 - is blocked a lock. Main thread is dependent async thread completing (which is want, this is maintaining legacy behavior) 6) Server is done 'loading' chunk IO, load chunk internal chunk map, includes loading entities 7) Entities loaded in sync figure out bounding box stuff calls big block methods worlds a whole, chunk 8) I assume Paper waits for next sync chunk load entities declare chunk 'loaded' this point, deadlocked sync thread is unable progress in order process final chunk load, in order progress chunk loaded</technical_language>

Target:
public void sendToJail(final IUser user, final String jail) throws Exception { acquireReadLock(); try { if (user.getBase().isOnline()) { Location loc = getJail(jail); user.getTeleport().now(loc, false, TeleportCause.COMMAND); } user.setJail(jail); } finally { unlock(); } }
Source:
<code>public void requestEmailSignIn(SignIn signIn) { long startTime = System.currentTimeMillis(); Validate.entityThrowingException(SignInValidator.EMAIL_SIGNIN_REQUEST, signIn); Study study = studyService.getStudy(signIn.getStudyId()); if (!study.isEmailSignInEnabled()) { throw new UnauthorizedException("Email-based sign in not enabled for study: " + study.getName()); } String cacheKey = getEmailSignInCacheKey(study, signIn.getEmail()); if (cacheProvider.getString(cacheKey) != null) { throw new LimitExceededException("Email currently pending confirmation."); } if (accountDao.getAccountWithEmail(study, signIn.getEmail()) == null) { try { <START> LOG.info("Email submitted for sign in that is not registered: " + signIn.getEmail()); <END> TimeUnit.MILLISECONDS.sleep(emailSignInRequestInMillis.get()); } catch(InterruptedException e) { } return; } String token = getVerificationToken(); cacheProvider.setString(cacheKey, token, SESSION_SIGNIN_TIMEOUT); BasicEmailProvider provider = new BasicEmailProvider.Builder() .withEmailTemplate(study.getEmailSignInTemplate()) .withStudy(study) .withRecipientEmail(signIn.getEmail()) .withToken("email", BridgeUtils.encodeURIComponent(signIn.getEmail())) .withToken("token", token).build(); sendMailService.sendEmail(provider); this.emailSignInRequestInMillis.set(System.currentTimeMillis()-startTime); }</code><technical_language>if logging this. hand, this logs email addresses _not_ part of study. other hand, logging email addresses logs in general</technical_language>

Target:
public void requestEmailSignIn(SignIn signIn) { long startTime = System.currentTimeMillis(); Validate.entityThrowingException(SignInValidator.EMAIL_SIGNIN_REQUEST, signIn); Study study = studyService.getStudy(signIn.getStudyId()); if (!study.isEmailSignInEnabled()) { throw new UnauthorizedException("Email-based sign in not enabled for study: " + study.getName()); } String cacheKey = getEmailSignInCacheKey(study, signIn.getEmail()); if (cacheProvider.getString(cacheKey) != null) { throw new LimitExceededException("Email currently pending confirmation."); } if (accountDao.getAccountWithEmail(study, signIn.getEmail()) == null) { try { TimeUnit.MILLISECONDS.sleep(emailSignInRequestInMillis.get()); } catch(InterruptedException e) { } return; } String token = getVerificationToken(); cacheProvider.setString(cacheKey, token, SESSION_SIGNIN_TIMEOUT); BasicEmailProvider provider = new BasicEmailProvider.Builder() .withEmailTemplate(study.getEmailSignInTemplate()) .withStudy(study) .withRecipientEmail(signIn.getEmail()) .withToken("email", BridgeUtils.encodeURIComponent(signIn.getEmail())) .withToken("token", token).build(); sendMailService.sendEmail(provider); this.emailSignInRequestInMillis.set(System.currentTimeMillis()-startTime); }
Source:
<code>private KinesisSequenceNumber(@NotNull String sequenceNumber, boolean isExclusive) { super(sequenceNumber, isExclusive); if (OrderedPartitionableRecord.END_OF_SHARD_MARKER.equals(sequenceNumber) || SeekableStreamPartitions.NO_END_SEQUENCE_NUMBER.equals(sequenceNumber)) { isMaxSequenceNumber = true; this.intSequence = null; } else { isMaxSequenceNumber = false; <START> this.intSequence = new BigInteger(sequenceNumber); <END> } }</code><technical_language>Is safe assume sequenceNumbers in string format BigInteger allows? If so, instead of String</technical_language>

Target:
private KinesisSequenceNumber(@NotNull String sequenceNumber, boolean isExclusive) { super(sequenceNumber, isExclusive); if (END_OF_SHARD_MARKER.equals(sequenceNumber) || SeekableStreamPartitions.NO_END_SEQUENCE_NUMBER.equals(sequenceNumber)) { isMaxSequenceNumber = true; this.intSequence = null; } else { isMaxSequenceNumber = false; this.intSequence = new BigInteger(sequenceNumber); } }
Source:
<code><START> public Set<String> getRunningTaskIds() <END> { return getRunningTasks().keySet(); }</code><technical_language>this need Set</technical_language>

Target:
public Collection<String> getRunningTaskIds() { return getRunningTasks().keySet(); }
Source:
<code>public void onSaveFile() { final SaveFilePanel outfilePanel = new SaveFilePanel( "bshConsoleOutFile", I18N.tr("Save script")); outfilePanel.addFilter("bsh", I18N.tr("BeanShell Script (*.bsh)")); <START> outfilePanel.setConfirmOverwrite(true); <END> outfilePanel.loadState(); if (UIFactory.showDialog(outfilePanel)) { try { FileUtils.write(outfilePanel.getSelectedFile(), scriptPanel.getText()); } catch (IOException e1) { LOGGER.error(I18N.tr("IO error."), e1); return; } setStatusMessage(I18N.tr("The file has been saved.")); } else { setStatusMessage(""); } }</code><technical_language>Instead of call setConfirmOverwrite(true) time, I change default of SaveFilePanel#confirmOverwrite false true</technical_language>

Target:
public void onSaveFile() { final SaveFilePanel outfilePanel = new SaveFilePanel( "bshConsoleOutFile", I18N.tr("Save script")); outfilePanel.addFilter("bsh", I18N.tr("BeanShell Script (*.bsh)")); outfilePanel.loadState(); if (UIFactory.showDialog(outfilePanel)) { try { FileUtils.write(outfilePanel.getSelectedFile(), scriptPanel.getText()); } catch (IOException e1) { LOGGER.error(I18N.tr("IO error."), e1); return; } setStatusMessage(I18N.tr("The file has been saved.")); } else { setStatusMessage(""); } }
Source:
<code>Mono<Response<Void>> submitBatchWithResponse(BlobBatch batch, boolean throwOnAnyFailure, Context context) { <START> return postProcessResponse(this.client.services().submitBatchWithRestResponseAsync( <END> batch.getBody(), batch.getContentLength(), batch.getContentType(), context)) .flatMap(response -> BlobBatchHelper.mapBatchResponse(batch, response, throwOnAnyFailure)); }</code><technical_language>postProcessResponse [](start = 15, length = 19) This, I think, is in process of removed</technical_language>

Target:
Mono<Response<Void>> submitBatchWithResponse(BlobBatch batch, boolean throwOnAnyFailure, Context context) { return postProcessResponse(client.services().submitBatchWithRestResponseAsync( batch.getBody(), batch.getContentLength(), batch.getContentType(), context)) .flatMap(response -> BlobBatchHelper.mapBatchResponse(batch, response, throwOnAnyFailure, logger)); }
Source:
<code>private String getCaller() { String userName = "admin"; PeopleQueryEvaluator pqe = HumanTaskServiceComponent.getHumanTaskServer(). getTaskEngine().getPeopleQueryEvaluator(); if (StringUtils.isNotEmpty(pqe.getLoggedInUser())) { userName = pqe.getLoggedInUser(); } if (StringUtils.isEmpty(userName)) { throw new HumanTaskRuntimeException("Cannot determine the user name of the user " + "performing the task operation!"); } <START> List<String> roleList = pqe.getRoleNameListForUser(pqe.getLoggedInUser()); <END> for (String roleName : roleList) { List<String> userList = pqe.getUserNameListForRole(roleName); for (String user : userList) { if (user.equalsIgnoreCase(userName)) { return user; } } } return userName; }</code><technical_language>here? loggedInUser -> rolesAssignedToTheUser -> AllUsersThatAllRolesAreAssignedTo if atleast user matches loggedInUser return matched user, if not, return logged in user</technical_language>

Target:
private String getCaller() { String userName = "admin"; PeopleQueryEvaluator pqe = HumanTaskServiceComponent.getHumanTaskServer(). getTaskEngine().getPeopleQueryEvaluator(); if (StringUtils.isNotEmpty(pqe.getLoggedInUser())) { userName = pqe.getLoggedInUser(); } if (StringUtils.isEmpty(userName)) { throw new HumanTaskRuntimeException("Cannot determine the user name of the user " + "performing the task operation!"); } return userName; }
Source:
<code>public void test2() { DynamicGraph<Node> dg = new DynamicGraph<>(); Node a1 = new Node("a1"); Node a2 = new Node("a2"); Node b1 = new Node("b1"); dg.addNode(a1); dg.addNode(a2); dg.addNode(b1); dg.addEdge(1, b1, a1, a2); dg.addEdge(0, a2, a1, b1); Node x = new Node("x"); dg.addNode(x); dg.addEdge(0, a1, x); dg.addEdge(0, b1, x); assertFreeNodesEquals(dg, x); dg.setStatus(dg.getFreeNodes(), Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(x, Status.FINISHED); <START> assertFreeNodesEquals(dg,a1); <END> dg.setStatus(dg.getFreeNodes(), Status.RUNNING); dg.setStatus(a1, Status.FINISHED); assertFreeNodesEquals(dg,a2); dg.setStatus(a2, Status.FINISHED); assertFreeNodesEquals(dg, b1); Node b2 = new Node("b2"); dg.setStatus(b2, Status.RUNNING); dg.setStatus(b1, Status.FINISHED); assertFreeNodesEquals(dg); }</code><technical_language>Typo: a space is missing</technical_language>

Target:
public void test2() { DynamicGraph<Node> dg = new DynamicGraph<>(); Node a1 = new Node("a1"); Node a2 = new Node("a2"); Node b1 = new Node("b1"); dg.addNode(a1); dg.addNode(a2); dg.addNode(b1); dg.addEdge(1, b1, a1, a2); dg.addEdge(0, a2, a1, b1); Node x = new Node("x"); dg.addNode(x); dg.addEdge(0, a1, x); dg.addEdge(0, b1, x); assertFreeNodesEquals(dg, x); dg.setStatus(x, Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(x, Status.FINISHED); assertFreeNodesEquals(dg, a1); dg.setStatus(a1, Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(a1, Status.FINISHED); assertFreeNodesEquals(dg, a2); dg.setStatus(a2, Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(a2, Status.FINISHED); assertFreeNodesEquals(dg, b1); Node b2 = new Node("b2"); dg.setStatus(b2, Status.RUNNING); dg.setStatus(b1, Status.FINISHED); assertFreeNodesEquals(dg); }
Source:
<code>private String getJumbuneScheduleTaskInfo(String scheduledJobDateTime, String jumbuneScheduleTaskCommand) { StringBuilder jumbuneSchedulerdBuilder = new StringBuilder( scheduledJobDateTime).append(SPACE) .append(jumbuneScheduleTaskCommand).append(NEW_LINE) .append("#"); <START> LOGGER.info("jumbuneTaskCommand " + jumbuneSchedulerdBuilder.toString()); <END> return jumbuneSchedulerdBuilder.toString(); }</code><technical_language>Info Log</technical_language>

Target:
private String getJumbuneScheduleTaskInfo(String scheduledJobDateTime, String jumbuneScheduleTaskCommand) { StringBuilder jumbuneSchedulerdBuilder = new StringBuilder( scheduledJobDateTime).append(SPACE) .append(jumbuneScheduleTaskCommand).append(NEW_LINE) .append("#"); return jumbuneSchedulerdBuilder.toString(); }
Source:
<code>public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<String> backendQuery, QueryParameters queryParameters) { Map<String, Object> parameters = getNamedParameterValuesConvertedByGridType( queryParameters ); String nativeQuery = buildNativeQuery( backendQuery, queryParameters ); Result result = dataBase.execute( nativeQuery, parameters ); if ( backendQuery.isSingleEntity() ) { OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( backendQuery.getSingleIndexedTypeNameOrNull() ); <START> return new NodesTupleIterator( result, backendQuery.getSingleEntityKeyMetadataOrNull(), persister.getTupleContext() ); <END> } return new MapsTupleIterator( result ); }</code><technical_language>sense add a parameter executeBackendQuery well? need in future get id of running transaction. QueryContext (equivalent TupleContext) return additional information need</technical_language>

Target:
public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<String> backendQuery, QueryParameters queryParameters) { Map<String, Object> parameters = getNamedParameterValuesConvertedByGridType( queryParameters ); String nativeQuery = buildNativeQuery( backendQuery, queryParameters ); Result result = dataBase.execute( nativeQuery, parameters ); EntityMetadataInformation entityMetadataInformation = backendQuery.getSingleEntityMetadataInformationOrNull(); if ( entityMetadataInformation != null ) { OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( entityMetadataInformation.getTypeName() ); return new NodesTupleIterator( result, entityMetadataInformation.getEntityKeyMetadata(), persister.getTupleContext() ); } return new MapsTupleIterator( result ); }
Source:
<code>void initialize(XMLReader xmlReader, Transformer transformer) throws IOException; } private Transformer buildTransformer(Site site, XMLReader xmlReader, TransformerInitialization initialization) throws IOException { Theme theme = site.getTheme(); <START> log.debug("Building transformer for: {}", site); <END> TransformerFactory factory = newTransformerFactory(); Transformer transformer; try (ThemeUriResolver resolver = new ThemeUriResolver(theme); InputStream transformFile = theme.getStaticResource(TRANSFORM_TEMPLATE_PATH)) { factory.setURIResolver(resolver); transformer = factory.newTransformer(new StreamSource(transformFile)); } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } initialization.initialize(xmlReader, transformer); return transformer; }</code><technical_language>for debug logging, checking intentionally included this :)</technical_language>

Target:
void initialize(XMLReader xmlReader, Transformer transformer) throws IOException; } private Transformer buildTransformer(Site site, XMLReader xmlReader, TransformerInitializer initialization) throws IOException { Theme theme = site.getTheme(); log.debug("Building transformer for: {}", site); TransformerFactory factory = newTransformerFactory(); Transformer transformer; try (ThemeUriResolver resolver = new ThemeUriResolver(theme); InputStream transformFile = theme.getStaticResource(TRANSFORM_TEMPLATE_PATH)) { factory.setURIResolver(resolver); transformer = factory.newTransformer(new StreamSource(transformFile)); } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } initialization.initialize(xmlReader, transformer); return transformer; }
Source:
<code>public void testBackgroundUpdater() throws Exception { helixConfigProps.setProperty( HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "account.service.polling.interval.ms", "1"); vHelixConfigProps = new VerifiableProperties(helixConfigProps); storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps); MockHelixAccountServiceFactory mockHelixAccountServiceFactory = new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, shouldUseMockHelixStore); accountService = mockHelixAccountServiceFactory.getAccountService(); <START> Thread.sleep(2); <END> assertTrue("Wrong number of reads to the store.", ((MockHelixPropertyStore) mockHelixAccountServiceFactory.getHelixStore(storeConfig)).getReadCount() > 1); }</code><technical_language>tests deterministic latches. numThreadsByName method in TestUtils check for existence of thread</technical_language>

Target:
public void testBackgroundUpdater() throws Exception { helixConfigProps.setProperty( HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "account.updater.polling.interval.ms", "1"); vHelixConfigProps = new VerifiableProperties(helixConfigProps); storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps); String updaterThreadPrefix = UUID.randomUUID().toString(); MockHelixAccountServiceFactory mockHelixAccountServiceFactory = new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, updaterThreadPrefix); accountService = mockHelixAccountServiceFactory.getAccountService(); CountDownLatch latch = new CountDownLatch(1); mockHelixAccountServiceFactory.getHelixStore(storeConfig).setReadLatch(latch); assertEquals("Wrong number of thread for account updater.", 1, numThreadsByThisName(updaterThreadPrefix)); awaitLatchOrTimeout(latch, 100); }
Source:
<code>private static List<AbstractContainerEnvVar> combineEnvVars(ContainerTemplate parent, ContainerTemplate template) { <START> List<AbstractContainerEnvVar> combinedSimpleEnvVars = new ArrayList<>(); <END> combinedSimpleEnvVars.addAll(parent.getEnvVars()); combinedSimpleEnvVars.addAll(template.getEnvVars()); return combinedSimpleEnvVars.stream().filter(envVar -> !Strings.isNullOrEmpty(envVar.getKey())).collect(Collectors.toList()); }</code><technical_language>I name is misleading, right? talking env vars simple, right</technical_language>

Target:
private static List<TemplateEnvVar> combineEnvVars(ContainerTemplate parent, ContainerTemplate template) { List<TemplateEnvVar> combinedEnvVars = new ArrayList<>(); combinedEnvVars.addAll(parent.getEnvVars()); combinedEnvVars.addAll(template.getEnvVars()); return combinedEnvVars.stream().filter(envVar -> !Strings.isNullOrEmpty(envVar.getKey())).collect(toList()); }
Source:
<code>void handleResponseObject(Object response) throws ArgumentException; } private static final int BufferSize = 4096; <START> public static boolean logAllWireBytes = false; <END> private IHandleResponseObject responseHandler; private HttpWebRequest response; private HttpWebRequest request; private EwsServiceMultiResponseXmlReader ewsXmlReader; protected int heartbeatFrequencyMilliseconds; public interface IHangingRequestDisconnectHandler { void hangingRequestDisconnectHandler(Object sender, HangingRequestDisconnectEventArgs args); }</code><technical_language>this private implement a setter</technical_language>

Target:
void handleResponseObject(Object response) throws ArgumentException; } public static final int BUFFER_SIZE = 4096; private static volatile boolean logAllWireBytes = false; private IHandleResponseObject responseHandler; private HttpWebRequest response; protected int heartbeatFrequencyMilliseconds; public interface IHangingRequestDisconnectHandler { void hangingRequestDisconnectHandler(Object sender, HangingRequestDisconnectEventArgs args); }
Source:
<code>String adjustPath(String path) throws Exception { if ( protectedMode.doProtected() ) { ZKPaths.PathAndNode pathAndNode = ZKPaths.getPathAndNode(path); <START> String name = ProtectedUtils.getProtectedPrefix(protectedMode.protectedId()) + pathAndNode.getNode(); <END> path = ZKPaths.makePath(pathAndNode.getPath(), name); } return path; }</code><technical_language>move this ProtectedUtils. ProtectedUtils.toProtectedZNode(String znodeName)</technical_language>

Target:
String adjustPath(String path) throws Exception { return ProtectedUtils.toProtectedZNodePath(path, protectedMode.protectedId()); }
Source:
<code>private short undeleteIfNeeded(BlobId blobId, short lifeVersion) throws CloudStorageException { if (!checkCacheState(blobId.getID(), lifeVersion, BlobState.CREATED)) { short newLifeVersion = cloudDestination.undeleteBlob(blobId, lifeVersion, <START> (metadata, key, updateFields) -> preUndeleteValidation(metadata, key, updateFields)); <END> addToCache(blobId.getID(), newLifeVersion, BlobState.CREATED); return newLifeVersion; } else { throw new CloudStorageException("Error updating blob metadata", new StoreException("Id " + blobId.getID() + " is already undeleted in cloud", StoreErrorCodes.ID_Undeleted)); } }</code><technical_language>simplify lambda this::preUndeleteValidation? in other places this method is used</technical_language>

Target:
private short undeleteIfNeeded(BlobId blobId, short lifeVersion) throws CloudStorageException, StoreException { if (!checkCacheState(blobId.getID(), lifeVersion, BlobState.CREATED)) { short newLifeVersion = cloudDestination.undeleteBlob(blobId, lifeVersion, this::preUndeleteValidation); addToCache(blobId.getID(), newLifeVersion, BlobState.CREATED); return newLifeVersion; } else { throw new StoreException("Id " + blobId.getID() + " is already undeleted in cloud", StoreErrorCodes.ID_Undeleted); } }
Source:
<code>protected boolean validateCqlNamesPresent(List<? extends VariableElement> parameters) { boolean valid = true; if (isFromClassFile()) { for (VariableElement parameter : parameters) { CqlName cqlName = parameter.getAnnotation(CqlName.class); if (cqlName == null) { context .getMessager() .error( parameter, "Method %s: parameter %s is declared in a compiled method " + "and refers to a bind marker " <START> + "and thus must be annotated with @CqlName", <END> methodElement, parameter.getSimpleName()); valid = false; } } } return valid; }</code><technical_language>I include name of child interface, this wait for [JAVA-2302](<LINK_0> (currently a reference DaoImplementationGenerator.interfaceElement in this class, of ticket address)</technical_language>

Target:
protected boolean validateCqlNamesPresent(List<? extends VariableElement> parameters) { boolean valid = true; if (isFromClassFile()) { for (VariableElement parameter : parameters) { CqlName cqlName = parameter.getAnnotation(CqlName.class); if (cqlName == null) { context .getMessager() .error( parameter, "Method %s: parameter %s is declared in a compiled method " + "and refers to a bind marker " + "and thus must be annotated with @%s", methodElement, parameter.getSimpleName(), CqlName.class.getSimpleName()); valid = false; } } } return valid; }
Source:
<code>public ListMultimap<String, ParameterValue> getConfiguration() { ListMultimap<String, ParameterValue> conf = ArrayListMultimap.create(); String crsAsString = null; if (crsDef != null) { if (crsDef instanceof CodeDefinition) { crsAsString = ((CodeDefinition)crsDef).getCode(); } else if (crsDef instanceof WKTDefinition) { crsAsString = ((WKTDefinition)crsDef).getWkt(); } } <START> conf.put(PARAMETER_REFERENCE_SYSTEM, new ParameterValue(crsAsString)); <END> return conf; }</code><technical_language>a minor improvement suggestion - easily create a String representation for a CRSDefinition CRSDefinitionManager. Advantage is care encoding additional kinds of CRSDefinitions added in future. A call this: String crsAsString = CRSDefinitionManager.getInstance().asString(crsDef)) reading parameter in function implementation, well: CRSDefinition crsDef = CRSDefinitionManager.getInstance().parse(crsString)</technical_language>

Target:
public ListMultimap<String, ParameterValue> getConfiguration() { ListMultimap<String, ParameterValue> conf = ArrayListMultimap.create(); String crsAsString = null; if (crsDef != null) { crsAsString = CRSDefinitionManager.getInstance().asString(crsDef); } conf.put(PARAMETER_REFERENCE_SYSTEM, new ParameterValue(crsAsString)); return conf; }
Source:
<code>protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree argument = mit.arguments().get(1); Type type = argument.symbolType(); <START> if (type.isUnknown()) { <END> return; } if (ExpressionsHelper.isNotSerializable(argument)) { String andParameters = JUtils.isParametrized(type) ? " and its parameters" : ""; reportIssue(argument, "Make \"" + type + "\"" + andParameters + " serializable or don't store it in the session."); } }</code><technical_language>means argument unknown type is considered serializable? consider making unknown check isNotSerializable provide behavior for rules it? this other rule (S2118) isNotSerializable is reporting arguable issue a similar message if run unknown type. > "!Unknown!" class "Serializable" write it</technical_language>

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree argument = mit.arguments().get(1); Type type = argument.symbolType(); if (ExpressionsHelper.isNotSerializable(argument)) { String andParameters = JUtils.isParametrized(type) ? " and its parameters" : ""; reportIssue(argument, "Make \"" + type.name() + "\"" + andParameters + " serializable or don't store it in the session."); } }
Source:
<code>public void setUp() throws Exception { System.out.println("projectManagerTest: create temp dir"); <START> synchronized (this) { <END> workingDir = new File("_AzkabanTestDir_" + System.currentTimeMillis()); if (workingDir.exists()) { FileUtils.deleteDirectory(workingDir); } workingDir.mkdirs(); } }</code><technical_language>need synchronized</technical_language>

Target:
public void setUp() throws Exception { Props props = new Props(); loader = mock(ProjectLoader.class); manager = new ProjectManager(loader, props); user = new User(TEST_USER); Project project1 = new Project(PROJECT_ID, PROJECT_NAME); project1.setDescription(PROJECT_DESCRIPTION); project1.setActive(true); project1.setVersion(PROJECT_VERSION); when(loader.createNewProject(PROJECT_NAME, PROJECT_DESCRIPTION, user)).thenReturn(project1); when(loader.fetchProjectById(PROJECT_ID)).thenReturn(project1); when(loader.fetchProjectByName(PROJECT_NAME)).thenReturn(project1); when(loader.fetchAllProjectFlows(project1)).thenReturn(new ArrayList<>()); when(loader.getLatestProjectVersion(project1)).thenReturn(PROJECT_VERSION); doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { project1.setActive(false); return null; } }).when(loader).removeProject(project1, user.getUserId()); doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { project1.setVersion(PROJECT_VERSION + 1); return null; } }).when(loader).changeProjectVersion(project1, PROJECT_VERSION + 1, user.getUserId()); doThrow(ProjectManagerException.class).when(loader).fetchAllProjectFlows(null); }
Source:
<code>public void start(Platform platform, WorkerStatusTracker status, KafkaFutureImpl<String> doneFuture) throws Exception { if (!running.compareAndSet(false, true)) { throw new IllegalStateException("ProducerBenchWorker is already running."); } log.info("{}: Activating ProduceBenchWorker with {}", id, spec); <START> this.executor = Executors.newScheduledThreadPool(3, <END> ThreadUtils.createThreadFactory("ProduceBenchWorkerThread%d", false)); this.status = status; this.doneFuture = doneFuture; executor.submit(new Prepare()); }</code><technical_language>bump this 3 if partition refresh is enabled</technical_language>

Target:
public void start(Platform platform, WorkerStatusTracker status, KafkaFutureImpl<String> doneFuture) throws Exception { if (!running.compareAndSet(false, true)) { throw new IllegalStateException("ProducerBenchWorker is already running."); } log.info("{}: Activating ProduceBenchWorker with {}", id, spec); if (spec.partitionRefreshRateMs() > 0) { this.executor = Executors.newScheduledThreadPool(3, ThreadUtils.createThreadFactory("ProduceBenchWorkerThread%d", false)); } else { this.executor = Executors.newScheduledThreadPool(2, ThreadUtils.createThreadFactory("ProduceBenchWorkerThread%d", false)); } this.status = status; this.doneFuture = doneFuture; executor.submit(new Prepare()); }
Source:
<code>public void handleEvent(JSONObject event) { if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PING)) { lastPing = LocalDateTime.now(); interconnect.dispatch(getName(), new JSONObject().fluentPut(MESSAGE_TYPE, TYPE_PONG) .fluentPut(MESSAGE_NAME, CallContext.getNodeName()) .fluentPut(MESSAGE_ADDRESS, getLocalAddress())); } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PONG)) { String address = event.getString(MESSAGE_ADDRESS); if (!Strings.areEqual(address, getLocalAddress()) && Strings.isFilled(address)) { String nodeName = event.getString(MESSAGE_NAME); if (!Strings.areEqual(members.put(nodeName, address), address)) { Cluster.LOG.INFO("Discovered a new node: %s - %s", nodeName, address); <START> members.put(nodeName, address); <END> } } } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_KILL)) { members.remove(event.getString(MESSAGE_NAME)); } }</code><technical_language>removed</technical_language>

Target:
public void handleEvent(JSONObject event) { if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PING)) { lastPing = LocalDateTime.now(); interconnect.dispatch(getName(), new JSONObject().fluentPut(MESSAGE_TYPE, TYPE_PONG) .fluentPut(MESSAGE_NAME, CallContext.getNodeName()) .fluentPut(MESSAGE_ADDRESS, getLocalAddress())); } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PONG)) { String address = event.getString(MESSAGE_ADDRESS); if (!Strings.areEqual(address, getLocalAddress()) && Strings.isFilled(address)) { String nodeName = event.getString(MESSAGE_NAME); if (!Strings.areEqual(members.put(nodeName, address), address)) { Cluster.LOG.INFO("Discovered a new node: %s - %s", nodeName, address); } } } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_KILL)) { members.remove(event.getString(MESSAGE_NAME)); } }
Source:
<code>public void run() { synchronized (localMonitor) { subscriptionTaskRunning = true; } connection = connectionFactory.getConnection(); try { if (connection.isSubscribed()) { throw new IllegalStateException("Retrieved connection is already subscribed; aborting listening"); } synchronized (monitor) { monitor.notify(); } if (!channelMapping.isEmpty()) { if (!patternMapping.isEmpty()) { subscriptionExecutor.execute(new PatternSubscriptionTask()); } connection.subscribe(new DispatchMessageListener(), unwrap(channelMapping.keySet())); } else { connection.pSubscribe(new DispatchMessageListener(), unwrap(patternMapping.keySet())); } } catch (Throwable t) { if (logger.isErrorEnabled()) { logger.error("PatternSubscriptionTask abort with exception:", t); } <START> handleSubscriptionTaskException(t); <END> } finally { synchronized (localMonitor) { subscriptionTaskRunning = false; localMonitor.notify(); } } }</code><technical_language>need check for isErrorEnabled() here. Also, log message "SubscriptionTask" instead of "PatternSubscriptionTask"</technical_language>

Target:
public void run() { synchronized (localMonitor) { subscriptionTaskRunning = true; } connection = connectionFactory.getConnection(); try { if (connection.isSubscribed()) { throw new IllegalStateException("Retrieved connection is already subscribed; aborting listening"); } synchronized (monitor) { monitor.notify(); } if (!channelMapping.isEmpty()) { if (!patternMapping.isEmpty()) { subscriptionExecutor.execute(new PatternSubscriptionTask()); } connection.subscribe(new DispatchMessageListener(), unwrap(channelMapping.keySet())); } else { connection.pSubscribe(new DispatchMessageListener(), unwrap(patternMapping.keySet())); } } catch (Throwable t) { logger.error("SubscriptionTask abort with exception:", t); refreshConnectionUntilSuccessful(t); } finally { synchronized (localMonitor) { subscriptionTaskRunning = false; localMonitor.notify(); } } }