auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public void beforeShutdown(@Observes final BeforeShutdown bs) { <START> ClassLoader loader; <END> if (!WildFlySecurityManager.isChecking()) { loader = Thread.currentThread().getContextClassLoader(); } else { loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); } TRACERS.remove(loader); }</code><technical_language>This entire block removed instead call WildFlySecurityManager.getCurrentContextClassLoaderPrivileged() Additionally this current approach new classes needed defined loaded achieve a common task</technical_language>

Target:
public void beforeShutdown(@Observes final BeforeShutdown bs) { TRACERS.remove(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()); }
Source:
<code>public void release() { for (RepoWalk repoWalk : repoWalksByProject.values()) { repoWalk.revWalk.release(); <START> repoWalk.repository.close(); <END> } }</code><technical_language>Please clean repoWalksByProject map</technical_language>

Target:
public void release() { Iterator<Map.Entry<Project.NameKey, RepoWalk>> iterator = repoWalksByProject.entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<Project.NameKey, RepoWalk> entry = iterator.next(); entry.getValue().revWalk.release(); entry.getValue().repository.close(); iterator.remove(); } }
Source:
<code>private boolean checkIfImageDiskCanBeAdded(VM vm) { boolean returnValue; DiskValidator diskValidator = getDiskValidator(getParameters().getDiskInfo()); returnValue = validate(new StorageDomainValidator(getStorageDomain()).isDomainExistAndActive()) && <START> checkImageConfiguration() && <END> hasFreeSpace(getStorageDomain()) && checkExceedingMaxBlockDiskSize() && canAddShareableDisk() && validate(diskValidator.isVirtIoScsiValid(vm)); if (returnValue && vm != null) { StoragePool sp = getStoragePool(); returnValue = validate(new StoragePoolValidator(sp).isUp()) && isStoragePoolMatching(vm) && isVmNotLocked() && isVmNotInPreviewSnapshot(); } if (returnValue && getParameters().getDiskInfo().isShareable() && getStorageDomain().getStorageType() == StorageType.GLUSTERFS) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN); } return returnValue; }</code><technical_language>please move this check (Before image configuration), need perform of if relevant.. (for example, do need a message space in domain if add it?) reduce query count here</technical_language>

Target:
private boolean checkIfImageDiskCanBeAdded(VM vm) { boolean returnValue; DiskValidator diskValidator = getDiskValidator(getParameters().getDiskInfo()); returnValue = validate(new StorageDomainValidator(getStorageDomain()).isDomainExistAndActive()) && checkImageConfiguration() && hasFreeSpace(getStorageDomain()) && checkExceedingMaxBlockDiskSize() && canAddShareableDisk() && validate(diskValidator.isVirtIoScsiValid(vm)); if (returnValue && getParameters().getDiskInfo().isShareable() && getStorageDomain().getStorageType() == StorageType.GLUSTERFS) { returnValue = false; addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_SHAREABLE_DISKS_NOT_SUPPORTED_ON_GLUSTER_DOMAIN); } if (returnValue && vm != null) { StoragePool sp = getStoragePool(); returnValue = validate(new StoragePoolValidator(sp).isUp()) && isStoragePoolMatching(vm) && isVmNotLocked() && isVmNotInPreviewSnapshot(); } return returnValue; }
Source:
<code>public void beginContact(Contact contact) { Object dataA = contact.getFixtureA().getBody().getUserData(); Object dataB = contact.getFixtureB().getBody().getUserData(); if (dataA instanceof EntityRef && dataB instanceof EntityRef) { EntityRef entityA = (EntityRef) dataA; EntityRef entityB = (EntityRef) dataB; entitySystemManager.sendEvent(new ContactEvent(entityB, contact), entityA); entitySystemManager.sendEvent(new ContactEvent(entityA, contact), entityB); } if (dataA instanceof EntityRef) { dataA = new SolObjectEntityWrapper((EntityRef) dataA); } if (dataB instanceof EntityRef) { dataB = new SolObjectEntityWrapper((EntityRef) dataB); } <START> SolObject oA = (SolObject) dataA; SolObject oB = (SolObject) dataB; <END> boolean aIsProj = oA instanceof Projectile; if (!aIsProj && !(oB instanceof Projectile)) { return; } Projectile proj = (Projectile) (aIsProj ? oA : oB); SolObject o = aIsProj ? oB : oA; proj.setObstacle(o, myGame); }</code><technical_language>here, removed earlier check dataA dataB SolObjects. for a good reason :)</technical_language>

Target:
public void beginContact(Contact contact) { Object dataA = contact.getFixtureA().getBody().getUserData(); Object dataB = contact.getFixtureB().getBody().getUserData(); if (dataA instanceof EntityRef && dataB instanceof EntityRef) { EntityRef entityA = (EntityRef) dataA; EntityRef entityB = (EntityRef) dataB; entitySystemManager.sendEvent(new ContactEvent(entityB, contact), entityA); entitySystemManager.sendEvent(new ContactEvent(entityA, contact), entityB); } if (dataA instanceof EntityRef) { dataA = new SolObjectEntityWrapper((EntityRef) dataA); } if (dataB instanceof EntityRef) { dataB = new SolObjectEntityWrapper((EntityRef) dataB); } SolObject firstSolObject = (SolObject) dataA; SolObject secondSolObject = (SolObject) dataB; boolean firstSolObjectIsProjectile = firstSolObject instanceof Projectile; if (!firstSolObjectIsProjectile && !(secondSolObject instanceof Projectile)) { return; } Projectile projectile = (Projectile) (firstSolObjectIsProjectile ? firstSolObject : secondSolObject); SolObject solObject = firstSolObjectIsProjectile ? secondSolObject : firstSolObject; projectile.setObstacle(solObject, myGame); }
Source:
<code>private void ensureOpen(final AsyncCompletionHandler<Void> handler) { if (!channelFuture.isDone()) { <START> channelFuture.syncUninterruptibly(); <END> } if (!channelFuture.isSuccess()) { handler.failed(new MongoSocketOpenException("Exception opening socket", address, channelFuture.cause())); } else if (pendingException != null) { handler.failed(pendingException); } else { handler.completed(null); } }</code><technical_language>Instead of Future.syncUninterruptibly, instead call Future#addListener</technical_language>

Target:
private synchronized void ensureOpen(final AsyncCompletionHandler<Void> handler) { if (pendingException != null) { handler.failed(pendingException); } else if (!channelFuture.isDone()) { channelFuture.addListener(new GenericFutureListener<Future<? super Void>>() { @Override public void operationComplete(final Future<? super Void> future) throws Exception { handleChannelFutureCompletion(handler); } }); } else { handleChannelFutureCompletion(handler); } }
Source:
<code>private int detectCompletionType(IDocument doc, String text, int offset) { if (offset == 0) return COMPLETION_TYPE_HEADER; IRegion lineInfo = null; try { lineInfo = doc.getLineInformationOfOffset(offset); } catch (BadLocationException e) { e.printStackTrace(); return COMPLETION_TYPE_UNKNOWN; } String lineText = text.substring(lineInfo.getOffset(), lineInfo.getOffset() + lineInfo.getLength()); int deltaOffset = offset - lineInfo.getOffset(); String partialLineText = lineText.substring(0, deltaOffset); if (partialLineText.matches(TAG_MATCH_REGEXP)) { <START> Pattern regex = Pattern.compile(TAG_PREFIX_MATCH); <END> Matcher matcher = regex.matcher(partialLineText); matcher.matches(); prefix = matcher.group(1); return COMPLETION_TYPE_TAG; } if (partialLineText.matches(ATTRIBUTE_NAME_MATCH_REGEXP)) { Pattern regex = Pattern.compile(ATTRIBUTE_NAME_PREFIX_MATCH); Matcher matcher = regex.matcher(partialLineText); matcher.matches(); prefix = matcher.group("prefix"); regex = Pattern.compile(ATTRIBUTE_NAME_ACKEY_MATCH); matcher = regex.matcher(partialLineText); matcher.matches(); acKey = matcher.group("ackey"); return COMPLETION_TYPE_ATTRIBUTE_NAME; } if (partialLineText.matches(ATTRIBUTE_VALUE_MATCH_REGEXP)) { Pattern regex = Pattern.compile(ATTRIBUTE_VALUE_PREFIX_MATCH); Matcher matcher = regex.matcher(partialLineText); matcher.matches(); prefix = matcher.group("prefix"); regex = Pattern.compile(ATTRIBUTE_VALUE_ACKEY_MATCH); matcher = regex.matcher(partialLineText); matcher.matches(); acKey = matcher.group("ackey"); return COMPLETION_TYPE_ATTRIBUTE_VALUE; } return COMPLETION_TYPE_UNKNOWN; }</code><technical_language>a bit rusty in regex parsing in Java is Pattern.compile cache a field, especially if fixed patterns</technical_language>

Target:
private int detectCompletionType(IDocument doc, String text, int offset) { if (offset == 0){ return COMPLETION_TYPE_HEADER; } IRegion lineInfo = null; try { lineInfo = doc.getLineInformationOfOffset(offset); } catch (BadLocationException e) { e.printStackTrace(); return COMPLETION_TYPE_UNKNOWN; } String lineText = text.substring(lineInfo.getOffset(), lineInfo.getOffset() + lineInfo.getLength()); int deltaOffset = offset - lineInfo.getOffset(); String partialLineText = lineText.substring(0, deltaOffset); if (partialLineText.matches(TAG_MATCH_REGEXP)) { Matcher matcher = TAG_PREFIX_PATTERN.matcher(partialLineText); matcher.matches(); prefix = matcher.group(1); return COMPLETION_TYPE_TAG; } if (partialLineText.matches(ATTRIBUTE_NAME_MATCH_REGEXP)) { Matcher matcher = ATT_NAME_PREFIX_PATTERN.matcher(partialLineText); matcher.matches(); prefix = matcher.group("prefix"); matcher = ATTR_NAME_ACKEY_MATCH.matcher(partialLineText); matcher.matches(); acKey = matcher.group("ackey"); return COMPLETION_TYPE_ATTRIBUTE_NAME; } if (partialLineText.matches(ATTRIBUTE_VALUE_MATCH_REGEXP)) { Matcher matcher = ATTR_VALUE_PREFIX_PATTERN.matcher(partialLineText); matcher.matches(); prefix = matcher.group("prefix"); matcher = ATTR_VALUE_ACKEY_PATTERN.matcher(partialLineText); matcher.matches(); acKey = matcher.group("ackey"); return COMPLETION_TYPE_ATTRIBUTE_VALUE; } return COMPLETION_TYPE_UNKNOWN; }
Source:
<code><START> void enableSSL(SslSimpleBuilder builder) { <END> sslBuilder = builder; }</code><technical_language>@robbavey reason for changing permissions here</technical_language>

Target:
public void enableSSL(SslSimpleBuilder builder) { sslBuilder = builder; }
Source:
<code><START> public void shortenUrl() throws IOException { <END> Manifests.DEFAULT.put("Nerodesk-BitlyId", "nerodesk"); Manifests.DEFAULT.put( "Nerodesk-BitlyKey", "R_95c4f6c85c67498bba37a73872577410" ); final String label = "shorten"; final CdShortUrl doc = new CdShortUrl(this.createDoc(label, label)); MatcherAssert.assertThat( doc.shortUrl(), Matchers.equalTo("<LINK_0>") ); }</code><technical_language>@dmzaytsev this test more a test of shortUrl AwsDoc caching of CdShortUrl. matter AwsDoc here? decorate Doc check shortUrl is call (even if method returns a new values time)</technical_language>

Target:
public void shortenUrl() throws IOException { final Doc doc = Mockito.mock(Doc.class); final String first = "<LINK_1>"; Mockito.when(doc.shortUrl()).thenReturn(first) .thenReturn("<LINK_2>"); final Doc cdd = new CdShortUrl(doc); MatcherAssert.assertThat( cdd.shortUrl(), Matchers.equalTo(first) ); MatcherAssert.assertThat( cdd.shortUrl(), Matchers.equalTo(first) ); }
Source:
<code>public Observable<List<SearchedEntity>> searchResources(final String query, String resources, final Boolean exactMatch) { switch (PrefManager.getUserStatus()) { case 0: return baseApiManager.getSearchApi().searchResources(query, resources, exactMatch); case 1: if (resources.equals(Constants.ENTITY_TYPE_CLIENTS)) { return mDatabaseHelperClient.readAllClientsByQuery(query, exactMatch); } else if (resources.equals(Constants.ENTITY_TYPE_GROUPS)) { return mDatabaseHelperGroup.readAllGroupsByQuery(query, exactMatch) <START> .mergeWith(mDatabaseHelperCenter.readAllCentersByQuery(query, <END> exactMatch)); } else if (resources.equals(Constants.ENTITY_TYPE_LOANS)) { return mDatabaseHelperLoan.readAllLoansByQuery(query, exactMatch); } else if (resources.equals(Constants.ENTITY_TYPE_SAVINGS)) { return mDatabaseHelperSaving.readAllSavingsByQuery(query, exactMatch); } else { return mDatabaseHelperClient.readAllClientsByQuery(query, exactMatch) .mergeWith(mDatabaseHelperGroup.readAllGroupsByQuery(query, exactMatch)) .mergeWith(mDatabaseHelperLoan.readAllLoansByQuery(query, exactMatch)) .mergeWith(mDatabaseHelperSaving.readAllSavingsByQuery(query, exactMatch)); } default: return Observable.just((List<SearchedEntity>) new ArrayList<SearchedEntity>()); } }</code><technical_language>@mayank-kgp <LINK_0> merge observables of type. I is in Rxjava 1 Rxjava 2</technical_language>

Target:
public Observable<List<SearchedEntity>> searchResources(final String query, String resources, final Boolean exactMatch) { switch (PrefManager.getUserStatus()) { case 0: return baseApiManager.getSearchApi().searchResources(query, resources, exactMatch); case 1: if (resources.equals(Constants.ENTITY_TYPE_CLIENTS)) { return mDatabaseHelperClient.readAllClientsByQuery(query, exactMatch); } else if (resources.equals(Constants.ENTITY_TYPE_GROUPS)) { return Observable.merge(mDatabaseHelperGroup.readAllGroupsByQuery(query, exactMatch), mDatabaseHelperCenter.readAllCentersByQuery(query, exactMatch)); } else if (resources.equals(Constants.ENTITY_TYPE_LOANS)) { return mDatabaseHelperLoan.readAllLoansByQuery(query, exactMatch); } else if (resources.equals(Constants.ENTITY_TYPE_SAVINGS)) { return mDatabaseHelperSaving.readAllSavingsByQuery(query, exactMatch); } else { return Observable.merge(mDatabaseHelperClient.readAllClientsByQuery(query, exactMatch), (mDatabaseHelperGroup.readAllGroupsByQuery(query, exactMatch)), (mDatabaseHelperLoan.readAllLoansByQuery(query, exactMatch)), (mDatabaseHelperSaving.readAllSavingsByQuery(query, exactMatch))); } default: return Observable.just((List<SearchedEntity>) new ArrayList<SearchedEntity>()); } }
Source:
<code>public void testAdditionalProtocols() { Validator validator = getValidator(); assertNumberOfViolations( validator.validate( new Bar( "<img src='data:image/png;base64,100101' />" ) ), 0 ); assertNumberOfViolations( validator.validate( new Bar( "<img/>" ) ), 0 ); assertNumberOfViolations( validator.validate( new Bar( "<img src='not_data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<img not_src='data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<div src='data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<div src='data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<custom>" + " <img src='data:image/png;base64,100101' />" + " <custom attr1='strange_protocol:some_text' />" + " <custom attr3='some_protocol:some_text' />" + " <custom><img /></custom>" + " <section id='sec1' attr='val'></section>" + " <custom attr1='dataprotocol:some_text' attr2='strange_protocol:some_text' />" + <START> "</custom>" ) ), 0 ); <END> }</code><technical_language>nice check unsupported protocol other protocols defined</technical_language>

Target:
public void testAdditionalProtocols() { Validator validator = getValidator(); assertNumberOfViolations( validator.validate( new Bar( "<img src='data:image/png;base64,100101' />" ) ), 0 ); assertNumberOfViolations( validator.validate( new Bar( "<img/>" ) ), 0 ); assertNumberOfViolations( validator.validate( new Bar( "<img src='not_data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<img not_src='data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<div src='data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<div src='data:image/png;base64,100101' />" ) ), 1 ); assertNumberOfViolations( validator.validate( new Bar( "<custom>" + " <img src='data:image/png;base64,100101' />" + " <custom attr1='strange_protocol:some_text' />" + " <custom attr3='some_protocol:some_text' />" + " <custom><img /></custom>" + " <section id='sec1' attr='val'></section>" + " <custom attr1='dataprotocol:some_text' attr2='strange_protocol:some_text' />" + "</custom>" ) ), 0 ); assertNumberOfViolations( validator.validate( new Bar( "<div>" + "<img src='not_data:image/png;base64,100101' />" + "<custom attr1='strange_protocol:some_text' />" + "/<div>" ) ), 1 ); }
Source:
<code>public void hashFirstNRowComponents(int numberOfComponents) { <START> Preconditions.checkState(state == State.DEFINING_ROW_NAME, <END> "Can only indicate hashFirstNRowComponents() inside the rowName scope."); Preconditions.checkState(rowNameComponents.isEmpty(), "hashFirstNRowComponents must be the first row component"); numberOfComponentsHashed = numberOfComponents; ignoreHotspottingChecks = true; }</code><technical_language>Extract preconditions a method checkHashRowComponentsPreconditions(String methodname)</technical_language>

Target:
public void hashFirstNRowComponents(int numberOfComponents) { Preconditions.checkState(numberOfComponents >= 0, "Need to specify a non-negative number of components to hash."); checkHashRowComponentsPreconditions("hashFirstNRowComponents"); numberOfComponentsHashed = numberOfComponents; ignoreHotspottingChecks = true; }
Source:
<code>public void write() { Document doc = createDocument(); Element rootElement = doc.createElement("options"); doc.appendChild(rootElement); Element sound = doc.createElement("sound"); sound.appendChild(doc.createTextNode(Integer.toString(this.sound))); rootElement.appendChild(sound); Element controls = doc.createElement("controls"); rootElement.appendChild(controls); Element left = doc.createElement("left"); left.appendChild(doc.createTextNode(this.left.getName())); controls.appendChild(left); Element right = doc.createElement("right"); right.appendChild(doc.createTextNode(this.right.getName())); controls.appendChild(right); Element shoot = doc.createElement("shoot"); shoot.appendChild(doc.createTextNode(this.shoot.getName())); controls.appendChild(shoot); try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(file)); transformer.transform(source, result); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); <START> } <END> }</code><technical_language>This method is long. try split in smaller parts</technical_language>

Target:
public void write() { Document doc = appendElements(); try { TransformerFactory transformerFactory = TransformerFactory.newInstance(); Transformer transformer = transformerFactory.newTransformer(); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(new File(file)); transformer.transform(source, result); } catch (TransformerConfigurationException e) { e.printStackTrace(); } catch (TransformerException e) { e.printStackTrace(); } }
Source:
<code>public NonBlockingRouterFactory(VerifiableProperties verifiableProperties, ClusterMap clusterMap, NotificationSystem notificationSystem) { if (verifiableProperties != null && clusterMap != null && notificationSystem != null) { routerConfig = new RouterConfig(verifiableProperties); registry = clusterMap.getMetricRegistry(); routerMetrics = new NonBlockingRouterMetrics(registry); <START> this.clusterMap = clusterMap; <END> this.notificationSystem = notificationSystem; } else { StringBuilder errorMessage = new StringBuilder("Null arg(s) received during instantiation of CoordinatorBackedRouterFactory -"); if (verifiableProperties == null) { errorMessage.append(" [VerifiableProperties] "); } if (clusterMap == null) { errorMessage.append(" [ClusterMap] "); } if (notificationSystem == null) { errorMessage.append(" [NotificationSystem] "); } throw new IllegalArgumentException(errorMessage.toString()); } logger.trace("Instantiated NonBlockingRouterFactory"); }</code><technical_language>"this" for some of all</technical_language>

Target:
public NonBlockingRouterFactory(VerifiableProperties verifiableProperties, ClusterMap clusterMap, NotificationSystem notificationSystem) throws Exception { if (verifiableProperties != null && clusterMap != null && notificationSystem != null) { routerConfig = new RouterConfig(verifiableProperties); MetricRegistry registry = clusterMap.getMetricRegistry(); routerMetrics = new NonBlockingRouterMetrics(registry); this.clusterMap = clusterMap; this.notificationSystem = notificationSystem; networkConfig = new NetworkConfig(verifiableProperties); networkMetrics = new NetworkMetrics(registry); SSLConfig sslConfig = new SSLConfig(verifiableProperties); sslFactory = sslConfig.sslEnabledDatacenters.length() > 0 ? new SSLFactory(sslConfig) : null; this.time = SystemTime.getInstance(); } else { throw new IllegalArgumentException("Null argument passed in"); } logger.trace("Instantiated NonBlockingRouterFactory"); }
Source:
<code>protected int getMaxResults() { if (getUriInfo()!=null && QueryHelper.hasMatrixParam(getUriInfo(), MAX)) { HashMap<String,String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), MAX); String maxString = matrixConstraints.get(MAX); try { return Integer.valueOf(maxString); } catch (NumberFormatException e) { LOG.error("Max number of results is not a valid number: '" + maxString + "'. Resorting to default behavior - no limit on number of query results."); <START> return Integer.MAX_VALUE; <END> } } else { return Integer.MAX_VALUE; } }</code><technical_language>return -1 instead List.size if returned -1, reusing code aware of MAX_VALUE returned get IndexOutOfBoundsException</technical_language>

Target:
protected int getMaxResults() { if (getUriInfo()!=null && QueryHelper.hasMatrixParam(getUriInfo(), MAX)) { HashMap<String,String> matrixConstraints = QueryHelper.getMatrixConstraints(getUriInfo(), MAX); String maxString = matrixConstraints.get(MAX); try { return Integer.valueOf(maxString); } catch (NumberFormatException e) { LOG.error("Max number of results is not a valid number: '" + maxString + "'. Resorting to default behavior - no limit on number of query results."); return NO_LIMIT; } } else { return NO_LIMIT; } }
Source:
<code>protected String getSoqlForRemoteIds() { String fullQuery = getQuery(0); StringBuffer soql = new StringBuffer(); soql.append("SELECT ").append(getIdFieldName()).append(" FROM"); StringTokenizer tokenizer = new StringTokenizer(fullQuery, " ", false); int depth = 0; boolean afterFrom = false; while (tokenizer.hasMoreElements()) { String token = tokenizer.nextToken(); if (afterFrom) { soql.append(" ").append(token); } if (token.startsWith("(")) { depth++; } else if (token.endsWith(")")) { depth--; <START> } else if (depth == 0 && afterFrom == false && token.toLowerCase().equals("from")) { <END> afterFrom = true; } } return soql.toString(); }</code><technical_language><table data-meta="generated_by_SmartSync"> <tbody> <tr> <td>:warning:</td> <td width="100%" data-sticky="false"><span data-href="<LINK_0>"></span>Implicitly default locale is a common source of bugs: <code>toLowerCase(Locale)</code> instead. For strings meant internal <code>Locale.ROOT</code>, <code>Locale.getDefault()</code>.</td> </tr> </tbody> </table></technical_language>

Target:
protected String getSoqlForRemoteIds() { String fullQuery = getQuery(0); StringBuffer soql = new StringBuffer(); soql.append("SELECT ").append(getIdFieldName()).append(" FROM"); StringTokenizer tokenizer = new StringTokenizer(fullQuery, " ", false); int depth = 0; boolean afterFrom = false; while (tokenizer.hasMoreElements()) { String token = tokenizer.nextToken(); if (afterFrom) { soql.append(" ").append(token); } if (token.startsWith("(")) { depth++; } else if (token.endsWith(")")) { depth--; } else if (depth == 0 && !afterFrom && token.toLowerCase(Locale.US).equals("from")) { afterFrom = true; } } return soql.toString(); }
Source:
<code>private void processPenaltyCodes(Settings s) { updates.add(new WSUpdate("ScoreBoard.PenaltyCode", null)); String file = s.get(PenaltyCodesManager.PenaltiesFileSetting); if(file != null && !file.isEmpty()) { try { PenaltyCodesDefinition penalties = pm.loadFromJSON(file); for(PenaltyCode p : penalties.getPenalties()) { updates.add(new WSUpdate("ScoreBoard.PenaltyCode."+p.getCode(), p.CuesForWS(p))); } updates.add(new WSUpdate("ScoreBoard.PenaltyCode.?","Unknown")); <START> } catch (Exception e) { <END> throw new RuntimeException(e); } } }</code><technical_language>exception is this catching? loadFromJSON checked exceptions</technical_language>

Target:
private void processPenaltyCodes(Settings s) { updates.add(new WSUpdate("ScoreBoard.PenaltyCode", null)); String file = s.get(PenaltyCodesManager.PenaltiesFileSetting); if(file != null && !file.isEmpty()) { PenaltyCodesDefinition penalties = pm.loadFromJSON(file); for(PenaltyCode p : penalties.getPenalties()) { updates.add(new WSUpdate("ScoreBoard.PenaltyCode."+p.getCode(), p.CuesForWS(p))); } updates.add(new WSUpdate("ScoreBoard.PenaltyCode.?","Unknown")); } }
Source:
<code><START> public DictionaryInterface setString(String key, String value) { <END> return setObject(key, value); }</code><technical_language>I return Dictionary here</technical_language>

Target:
public Dictionary setString(String key, String value) { return setObject(key, value); }
Source:
<code>public void testLookSensorValues() throws InterpretationException { Formula lookXPositionFormula = getFormulaBySensor(Sensors.OBJECT_X); assertEquals(LOOK_X_POSITION, lookXPositionFormula.interpretDouble(testSprite), DELTA); Formula lookYPositionFormula = getFormulaBySensor(Sensors.OBJECT_Y); assertEquals(LOOK_Y_POSITION, lookYPositionFormula.interpretDouble(testSprite), DELTA); Formula lookAlphaValueFormula = getFormulaBySensor(Sensors.OBJECT_TRANSPARENCY); assertEquals(LOOK_ALPHA, lookAlphaValueFormula.interpretDouble(testSprite), DELTA); Formula lookBrightnessFormula = getFormulaBySensor(Sensors.OBJECT_BRIGHTNESS); assertEquals(LOOK_BRIGHTNESS, lookBrightnessFormula.interpretDouble(testSprite), DELTA); Formula lookScaleFormula = getFormulaBySensor(Sensors.OBJECT_SIZE); assertEquals(LOOK_SCALE, lookScaleFormula.interpretDouble(testSprite), DELTA); Formula lookRotateFormula = getFormulaBySensor(Sensors.OBJECT_ROTATION); assertEquals(LOOK_ROTATION, lookRotateFormula.interpretDouble(testSprite), DELTA); Formula lookZPositionFormula = getFormulaBySensor(Sensors.OBJECT_LAYER); <START> assertEquals(1, lookZPositionFormula.interpretInteger(testSprite).intValue()); <END> }</code><technical_language>Please a double here. interpretInteger [Double.html#intValue()](<LINK_0> casts double int removing digits decimal point. 1.3 -> 1 (and test miss a bug). suggestion assertEquals(1.0, lookZPositionFormula.interpretDouble(testSprite));</technical_language>

Target:
public void testLookSensorValues() throws InterpretationException { Formula lookXPositionFormula = getFormulaBySensor(Sensors.OBJECT_X); assertEquals(LOOK_X_POSITION, lookXPositionFormula.interpretDouble(testSprite), DELTA); Formula lookYPositionFormula = getFormulaBySensor(Sensors.OBJECT_Y); assertEquals(LOOK_Y_POSITION, lookYPositionFormula.interpretDouble(testSprite), DELTA); Formula lookAlphaValueFormula = getFormulaBySensor(Sensors.OBJECT_TRANSPARENCY); assertEquals(LOOK_ALPHA, lookAlphaValueFormula.interpretDouble(testSprite), DELTA); Formula lookBrightnessFormula = getFormulaBySensor(Sensors.OBJECT_BRIGHTNESS); assertEquals(LOOK_BRIGHTNESS, lookBrightnessFormula.interpretDouble(testSprite), DELTA); Formula lookScaleFormula = getFormulaBySensor(Sensors.OBJECT_SIZE); assertEquals(LOOK_SCALE, lookScaleFormula.interpretDouble(testSprite), DELTA); Formula lookRotateFormula = getFormulaBySensor(Sensors.OBJECT_ROTATION); assertEquals(LOOK_ROTATION, lookRotateFormula.interpretDouble(testSprite), DELTA); Formula lookZPositionFormula = getFormulaBySensor(Sensors.OBJECT_LAYER); assertEquals(1.0, lookZPositionFormula.interpretDouble(testSprite)); }
Source:
<code>private RemoteServerDialog(RemoteServerDialogForm form, Http http) { this.form = form; this.form.onConnect(server -> { Response<Boolean> response = server.testPull(http); if (response.isSuccess()) { triggerConnect(server); form.hideDialog(); } else { String error = response.isRedirection() <START> ? "Redirection detected.\n\nPlease, review the connection parameters and try again." <END> : response.isUnauthorized() ? "Wrong credentials.\n\nPlease, review the connection parameters and try again." : response.isNotFound() ? "Aggregate not found.\n\nPlease, review the connection parameters and try again." : "Please, review the connection parameters and try again."; showErrorDialog(form, error, "Wrong connection parameters"); } }); }</code><technical_language>commas "please"es</technical_language>

Target:
private RemoteServerDialog(RemoteServerDialogForm form, Http http) { this.form = form; this.form.onConnect(server -> { form.setTestingConnection(); new Thread(() -> { try { Response<Boolean> response = server.testPull(http); if (response.isSuccess()) { triggerConnect(server); form.hideDialog(); } else showError( response.isRedirection() ? "Redirection detected" : response.isUnauthorized() ? "Wrong credentials" : response.isNotFound() ? "Aggregate not found" : "", response.isRedirection() ? "Unexpected error" : "Configuration error" ); } catch (HttpException e) { showError(e.getMessage(), "Unexpected error"); } finally { form.unsetTestingConnection(); } }).start(); }); }
Source:
<code>public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { if (mDue != null && mStart.isAllDay() != mDue.isAllDay()) { throw new IllegalArgumentException("'start' and 'due' must have the same all-day flag"); } DateTime start = mStart; <START> if (mDue != null && !TimeZoneEqualator.INSTANCE.areEqual(mStart, mDue)) <END> { start = mStart.shiftTimeZone(mDue.getTimeZone()); } return doUpdateBuilder(start, mDue, mDuration, builder); }</code><technical_language>is need for this Equalator. DateTime is smart enough return instance if timezone is considered same</technical_language>

Target:
public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) { if (mDue.isPresent() && mStart.isAllDay() != mDue.value().isAllDay()) { throw new IllegalArgumentException("'start' and 'due' must have the same all-day flag"); } DateTime start = mStart; if (mDue.isPresent() && !mDue.value().isAllDay()) { start = mStart.shiftTimeZone(mDue.value().getTimeZone()); } return doUpdateBuilder(start, mDue, mDuration, builder); }
Source:
<code>boolean isInternalUser() { CommandResult gitRes = RunUtil.getDefault().runTimedCmd(60000L, "git", "config", "--get", "user.email"); if (CommandStatus.SUCCESS.equals(gitRes.getStatus())) { String stdout = gitRes.getStdout(); if (stdout != null && stdout.trim().endsWith(INTERNAL_EMAIL)) { return true; } } try { String hostname = InetAddress.getLocalHost().getHostName(); if <START> (hostname.endsWith(INTERNAL_HOSTNAME)) { <END> return true; } } catch (UnknownHostException e) { } return false; }</code><technical_language>nit: atest's logic is: if INTERNAL_HOSTNAME in hostname</technical_language>

Target:
boolean isInternalUser() { CommandResult gitRes = RunUtil.getDefault().runTimedCmd(60000L, "git", "config", "--get", "user.email"); if (CommandStatus.SUCCESS.equals(gitRes.getStatus())) { String stdout = gitRes.getStdout(); if (stdout != null && stdout.trim().endsWith(INTERNAL_EMAIL)) { return true; } } try { String hostname = InetAddress.getLocalHost().getHostName(); if (hostname.contains(INTERNAL_HOSTNAME)) { return true; } } catch (UnknownHostException e) { } return false; }
Source:
<code>public void test_p_TestDescribeTable() throws InterruptedException, ExecutionException { RiakClient client = new RiakClient(cluster); Query query = new Query.Builder("DESCRIBE " + tableName).build(); final RiakFuture<QueryResult, String> resultFuture = client.executeAsync(query); resultFuture.await(); assertFutureSuccess(resultFuture); final QueryResult tableDescription = resultFuture.get(); assertEquals(7, tableDescription.getRowsCount()); <START> assertEquals(7, tableDescription.getColumnDescriptionsCopy().size()); <END> }</code><technical_language>Throws failure TS 1.3.1, actual = 5</technical_language>

Target:
public void test_p_TestDescribeTable() throws InterruptedException, ExecutionException { RiakClient client = new RiakClient(cluster); Query query = new Query.Builder("DESCRIBE " + tableName).build(); final RiakFuture<QueryResult, String> resultFuture = client.executeAsync(query); resultFuture.await(); assertFutureSuccess(resultFuture); final QueryResult tableDescription = resultFuture.get(); assertEquals(7, tableDescription.getRowsCount()); int numColumnDesc = tableDescription.getColumnDescriptionsCopy().size(); assertTrue(numColumnDesc == 5 || numColumnDesc == 7); }
Source:
<code>public LifecycleInjector createInjector(Stage stage, Module module) { final GovernatorFeatureSetImpl featureSet = new GovernatorFeatureSetImpl(features); final LifecycleManager manager = new LifecycleManager(); try { onBeforeInjectorCreate(); Injector injector = Guice.createInjector( stage, new LifecycleModule(), new LifecycleListenerModule(), new LegacyScopesModule(), new AbstractModule() { @Override protected void configure() { bind(GovernatorFeatureSet.class).toInstance(featureSet); bind(LifecycleManager.class).toInstance(manager); bind(new TypeLiteral<Set<String>>() {}).annotatedWith(Profiles.class).toInstance(profiles); bind(String[].class).annotatedWith(Arguments.class).toInstance(args); requestInjection(LifecycleInjectorCreator.this); } }, module ); manager.notifyStarted(); LifecycleInjector lifecycleInjector = LifecycleInjector.wrapInjector(injector, manager); onSuccessfulInjectorCreate(); return lifecycleInjector; } catch (Exception e) { <START> LOG.error(String.format("Failed to create injector - %s@%d", e.getClass().getSimpleName(), System.identityHashCode(e)), e); <END> onFailedInjectorCreate(e); try { manager.notifyStartFailed(e); } catch (Exception e2) { LOG.error("Failed to notify injector creation failure", e2 ); } if (!featureSet.get(GovernatorFeatures.SHUTDOWN_ON_ERROR)) { return LifecycleInjector.createFailedInjector(manager); } else { throw e; } } finally { onCompletedInjectorCreate(); } }</code><technical_language>SLF4J syntax instead of String.format I need update a version of SLF4J pass in a new Object[]{}</technical_language>

Target:
public LifecycleInjector createInjector(Stage stage, Module module) { final GovernatorFeatureSetImpl featureSet = new GovernatorFeatureSetImpl(features); final LifecycleManager manager = new LifecycleManager(); try { onBeforeInjectorCreate(); Injector injector = Guice.createInjector( stage, new LifecycleModule(), new LifecycleListenerModule(), new LegacyScopesModule(), new AbstractModule() { @Override protected void configure() { bind(GovernatorFeatureSet.class).toInstance(featureSet); bind(LifecycleManager.class).toInstance(manager); bind(new TypeLiteral<Set<String>>() {}).annotatedWith(Profiles.class).toInstance(profiles); bind(String[].class).annotatedWith(Arguments.class).toInstance(args); requestInjection(LifecycleInjectorCreator.this); } }, module ); manager.notifyStarted(); LifecycleInjector lifecycleInjector = LifecycleInjector.wrapInjector(injector, manager); onSuccessfulInjectorCreate(); return lifecycleInjector; } catch (Exception e) { LOG.error("Failed to create injector - {}@{}", e.getClass().getSimpleName(), System.identityHashCode(e), e); onFailedInjectorCreate(e); try { manager.notifyStartFailed(e); } catch (Exception e2) { LOG.error("Failed to notify injector creation failure", e2 ); } if (!featureSet.get(GovernatorFeatures.SHUTDOWN_ON_ERROR)) { return LifecycleInjector.createFailedInjector(manager); } else { throw e; } } finally { onCompletedInjectorCreate(); } }
Source:
<code>public String getStrValue() { String key = strValue.toLowerCase().replace(" " , "_"); <START> if(getDatasetFieldType().getMetadataBlock() == null){ <END> return strValue; } else { return BundleUtil.getStringFromPropertyFile("controlledvocabulary." + this.datasetFieldType.getName() + "." + key, getDatasetFieldType().getMetadataBlock().getName()); } }</code><technical_language>this null</technical_language>

Target:
public String getStrValue() { String key = strValue.toLowerCase().replace(" " , "_"); key = StringUtils.stripAccents(key); if(getDatasetFieldType().getMetadataBlock() == null){ return strValue; } else { return BundleUtil.getStringFromPropertyFile("controlledvocabulary." + this.datasetFieldType.getName() + "." + key, getDatasetFieldType().getMetadataBlock().getName()); } }
Source:
<code>public void testOpenSessionEditorByDoubleClick4() { designerProject.convertToModelingProject(); <START> SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); SWTBotTreeItem expandedNode = packageExplorerViewBot.tree().expandNode("DesignerTestProject", true); SWTBotTreeItem node = expandedNode.getNode("My.aird"); node.doubleClick(); bot.waitUntil(new DefaultCondition() { @Override public boolean test() throws Exception { return PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor() != null; } @Override public String getFailureMessage() { return "Wrong Active editor is : " + PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId(); } }); assertEquals("The session editor has not opened.", "org.eclipse.sirius.ui.editor.session", PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage().getActiveEditor().getEditorSite().getId()); } <END></code><technical_language>"longest copy paste code" competition</technical_language>

Target:
public void testOpenSessionEditorByDoubleClick4() { designerProject.convertToModelingProject(); SWTBotPerspective javaPerspective = bot.perspectiveByLabel("Java"); javaPerspective.activate(); SWTBotView packageExplorerView = bot.viewById("org.eclipse.jdt.ui.PackageExplorer"); packageExplorerView.setFocus(); SWTBot packageExplorerViewBot = packageExplorerView.bot(); assertSessionEditorOpened(packageExplorerViewBot); }
Source:
<code>void restartServerOnVM(int index) { <START> cluster.startServerVM(index, getProperties(), locatorPort); <END> }</code><technical_language>again, need 2nd parameter</technical_language>

Target:
void restartServerOnVM(int index) { cluster.startServerVM(index, locatorPort); }
Source:
<code>private TrackerClient getTrackerClientFromRing(Request request, RequestContext requestContext, Ring<URI> ring, Map<URI, TrackerClient> trackerClients) { <START> if (ring == null) <END> { return null; } Set<URI> excludedUris = LoadBalancerStrategy.ExcludedHostHints.getRequestContextExcludedHosts(requestContext); int hashCode = _requestHashFunction.hash(request); URI uri = ring.get(hashCode); TrackerClient trackerClient = trackerClients.get(uri); if (excludedUris == null) { excludedUris = new HashSet<>(); } if (trackerClient == null || excludedUris.contains(uri)) { Iterator<URI> ringIterator = ring.getIterator(hashCode); while (ringIterator.hasNext()) { uri = ringIterator.next(); trackerClient = trackerClients.get(uri); if (trackerClient != null && !excludedUris.contains(uri)) { break; } } } return trackerClient; }</code><technical_language>check if</technical_language>

Target:
private TrackerClient getTrackerClientFromRing(Request request, RequestContext requestContext, Ring<URI> ring, Map<URI, TrackerClient> trackerClients) { Set<URI> excludedUris = LoadBalancerStrategy.ExcludedHostHints.getRequestContextExcludedHosts(requestContext) == null ? new HashSet<>() : LoadBalancerStrategy.ExcludedHostHints.getRequestContextExcludedHosts(requestContext); int hashCode = _requestHashFunction.hash(request); URI uri = ring.get(hashCode); TrackerClient trackerClient = trackerClients.get(uri); if (trackerClient == null || excludedUris.contains(uri)) { Iterator<URI> ringIterator = ring.getIterator(hashCode); while (ringIterator.hasNext()) { uri = ringIterator.next(); trackerClient = trackerClients.get(uri); if (trackerClient != null && !excludedUris.contains(uri)) { break; } } trackerClient = null; } if (trackerClient == null) { trackerClient = trackerClients.values().stream() .filter(latestTrackerClient -> !excludedUris.contains(latestTrackerClient.getUri())) .findAny().orElse(null); if (trackerClient != null) { LOG.warn("Did not find a valid client from the ring, picked instead", trackerClient.getUri()); } } addToExcludedHosts(trackerClient, requestContext); return trackerClient; }
Source:
<code><START> public void testIsStageNode() throws Exception { <END> setupForStage(); assertTrue(CaseManagementCommandUtil.isStageNode(child)); }</code><technical_language>Exception is thrown. please more descriptive name of test method</technical_language>

Target:
public void testIsStageNode() { setupForStage(); assertTrue(CaseManagementCommandUtil.isStageNode(child)); }
Source:
<code>public LockStep(String resource) { if (resource == null || resource.isEmpty()) { throw new IllegalArgumentException("must specify resource"); } if (LockableResourcesManager.get().fromName(resource) == null) { <START> throw new IllegalArgumentException("resource [" + resource + "] does not exist, missing global definition?"); <END> } this.resource = resource; }</code><technical_language>I mentioned in file, I if automatically create resources in step, a create: true option like, scripts self-contained</technical_language>

Target:
public LockStep(String resource) { if (resource == null || resource.isEmpty()) { throw new IllegalArgumentException("must specify resource"); } this.resource = resource; }
Source:
<code>public void bbCodesWithTextThatShouldPass(String postBody, String messageIfTestFails) throws Exception { info("Running a test case [" + messageIfTestFails + "]"); try { Topics.postAnswer(TEST_TOPIC, new Post(postBody)); } catch (ValidationException e) { fail(messageIfTestFails); } catch (CouldNotOpenPageException e) { <START> fail("Something went wrong and user was thrown out of topic."); <END> } }</code><technical_language>I reason catch exception if throw it.</technical_language>

Target:
public void bbCodesWithTextThatShouldPass(String postBody, String messageIfTestFails) throws Exception { info("Running a test case [" + messageIfTestFails + "]"); try { Topics.postAnswer(TEST_TOPIC, new Post(postBody)); } catch (ValidationException e) { fail(messageIfTestFails); } }
Source:
<code>public JiraSite getSite() { <START> List<JiraSite> sites = JiraGlobalConfiguration.getInstance().getSites(); <END> if (siteName == null && sites.size() > 0) { return sites.get(0); } for (JiraSite site : sites) { if (site.getName().equals(siteName)) { return site; } } ItemGroup itemGroup = owner.getParent(); if (itemGroup instanceof AbstractFolder<?>) { do { AbstractFolder<?> folder = (AbstractFolder<?>) itemGroup; JiraFolderProperty jiraFolderProperty = folder.getProperties() .get(JiraFolderProperty.class); if (jiraFolderProperty != null) { for (JiraSite site : jiraFolderProperty.getSites()) { if (site.getName().equals(siteName)) { return site; } } } itemGroup = folder.getParent(); } while (itemGroup instanceof AbstractFolder<?>); } return null; }</code><technical_language>piece of code lines above, extract re-use it</technical_language>

Target:
public JiraSite getSite() { List<JiraSite> sites = JiraGlobalConfiguration.get().getSites(); if (siteName == null && sites.size() > 0) { return sites.get(0); } Stream<JiraSite> streams = sites.stream(); if (owner != null) { Stream<JiraSite> stream2 = JiraFolderProperty.getSitesFromFolders(owner.getParent()) .stream(); streams = Stream.concat(streams, stream2).parallel(); } return streams.filter(jiraSite -> jiraSite.getName().equals(siteName)) .findFirst().orElse(null); }
Source:
<code>public Tracer getTracer(StagemonitorPlugin.InitArguments initArguments) { <START> final brave.Tracer braveTracer = brave.Tracer.newBuilder() <END> .localServiceName(initArguments.getMeasurementSession().getApplicationName()) .reporter(getZipkinReporterBuilder(initArguments).build()) .sampler(getSampler()) .build(); return BraveTracer.newBuilder(braveTracer) .textMapPropagation(B3HeaderFormat.INSTANCE, Propagation.B3_STRING) .build(); }</code><technical_language>this same, Tracing tracer. allows control default propagation brave</technical_language>

Target:
public Tracer getTracer(StagemonitorPlugin.InitArguments initArguments) { final Tracing braveTracer = Tracing.newBuilder() .localServiceName(initArguments.getMeasurementSession().getApplicationName()) .reporter(getZipkinReporterBuilder(initArguments).build()) .sampler(getSampler()) .build(); return BraveTracer.newBuilder(braveTracer) .textMapPropagation(B3HeaderFormat.INSTANCE, Propagation.B3_STRING) .build(); }
Source:
<code>public static void initializeSPA() { final String METHOD_NAME = "initializeSPA()"; specialAbilities = new Hashtable<>(); edgeTriggers = new Hashtable<>(); implants = new Hashtable<>(); Document xmlDoc = null; try { <START> InputStream is = new FileInputStream("data/universe/defaultspa.xml"); <END> DocumentBuilder db = MekHqXmlUtil.newSafeDocumentBuilder(); xmlDoc = db.parse(is); is.close(); } catch (Exception ex) { MekHQ.getLogger().error(SpecialAbility.class, METHOD_NAME, ex); } Element spaEle = xmlDoc.getDocumentElement(); NodeList nl = spaEle.getChildNodes(); spaEle.normalize(); PersonnelOptions options = new PersonnelOptions(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); if (wn.getParentNode() != spaEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("ability") || xn.equalsIgnoreCase("edgeTrigger") || xn.equalsIgnoreCase("implant")) { SpecialAbility.generateInstanceFromXML(wn, options, null); } } } SpecialAbility.trackDefaultSPA(); }</code><technical_language>try-with-resources</technical_language>

Target:
public static void initializeSPA() { final String METHOD_NAME = "initializeSPA()"; specialAbilities = new Hashtable<>(); edgeTriggers = new Hashtable<>(); implants = new Hashtable<>(); Document xmlDoc = null; try (InputStream is = new FileInputStream("data/universe/defaultspa.xml")) { DocumentBuilder db = MekHqXmlUtil.newSafeDocumentBuilder(); xmlDoc = db.parse(is); } catch (Exception ex) { MekHQ.getLogger().error(SpecialAbility.class, METHOD_NAME, ex); } Element spaEle = xmlDoc.getDocumentElement(); NodeList nl = spaEle.getChildNodes(); spaEle.normalize(); PersonnelOptions options = new PersonnelOptions(); for (int x = 0; x < nl.getLength(); x++) { Node wn = nl.item(x); if (wn.getParentNode() != spaEle) continue; int xc = wn.getNodeType(); if (xc == Node.ELEMENT_NODE) { String xn = wn.getNodeName(); if (xn.equalsIgnoreCase("ability") || xn.equalsIgnoreCase("edgeTrigger") || xn.equalsIgnoreCase("implant")) { SpecialAbility.generateInstanceFromXML(wn, options, null); } } } SpecialAbility.trackDefaultSPA(); }
Source:
<code>private boolean isDisabledByStorage(ThingUID thingUID) { <START> return storage == null || Boolean.FALSE.equals(storage.get(thingUID.getAsString())); <END> }</code><technical_language>this return true in case storage is defined. I want suggestion return storage != null && Boolean.FALSE.equals(storage.get(thingUID.getAsString()));</technical_language>

Target:
private boolean isDisabledByStorage(ThingUID thingUID) { return storage != null && Boolean.FALSE.equals(storage.get(thingUID.getAsString())); }