auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public int read(char[] cbuf, int off, int len) throws IOException { <START> buf = cbuf.clone(); <END> bufIndex = off; if (Objects.isNull(tableNames)) { try { tableNames = reader.getTableNames().iterator(); } catch (SQLiteTableReaderException ex) { return -1; } } if (Objects.nonNull(leftOvers) && !leftOvers.isFinished()) { bufIndex += leftOvers.read(cbuf, off, len); } while (bufIndex != len) { if (Objects.isNull(currentTableName) || reader.isFinished()) { if (tableNames.hasNext()) { currentTableName = tableNames.next(); try { totalColumns = reader.getColumnCount(currentTableName); reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } else { if (bufIndex == off) { return -1; } return bufIndex; } } else { try { reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } } return bufIndex; }</code><technical_language>Is caller expecting this method fill cbuf array, filling a clone of it? Frankly, I understand buf is a instance variable - is referenced in this single read method..</technical_language>

Target:
public int read(char[] cbuf, int off, int len) throws IOException { buf = cbuf; bufIndex = off; if (Objects.isNull(tableNames)) { try { tableNames = reader.getTableNames().iterator(); } catch (SQLiteTableReaderException ex) { return -1; } } if (Objects.nonNull(leftOvers) && !leftOvers.isFinished()) { bufIndex += leftOvers.read(cbuf, off, len); } while (bufIndex != len) { if (Objects.isNull(currentTableName) || reader.isFinished()) { if (tableNames.hasNext()) { currentTableName = tableNames.next(); try { totalColumns = reader.getColumnCount(currentTableName); reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } else { if (bufIndex == off) { return -1; } return bufIndex; } } else { try { reader.read(currentTableName, () -> bufIndex == len); } catch (SQLiteTableReaderException ex) { logger.log(Level.WARNING, String.format( "Error attempting to read file table: [%s]" + " for file: [%s] (id=%d).", currentTableName, file.getName(), file.getId()), ex.getMessage()); } } } return bufIndex; }
Source:
<code>public void createClaimWithLogging(String wikidataEntityId, String fileName) { if (wikidataEntityId == null) { Timber.d("Skipping creation of claim as Wikidata entity ID is null"); return; } if (fileName == null) { Timber.d("Skipping creation of claim as fileName entity ID is null"); return; } if (!(directPrefs.getBoolean("Picture_Has_Correct_Location",true))) { <START> Timber.d("Image location and nearby place location missmatched, so wikidata item won't be edited"); <END> return; } editWikidataProperty(wikidataEntityId, fileName); }</code><technical_language>mismatched Wikidata</technical_language>

Target:
public void createClaimWithLogging(String wikidataEntityId, String fileName) { if (wikidataEntityId == null) { Timber.d("Skipping creation of claim as Wikidata entity ID is null"); return; } if (fileName == null) { Timber.d("Skipping creation of claim as fileName entity ID is null"); return; } if (!(directPrefs.getBoolean("Picture_Has_Correct_Location",true))) { Timber.d("Image location and nearby place location mismatched, so Wikidata item won't be edited"); return; } editWikidataProperty(wikidataEntityId, fileName); }
Source:
<code>public void shouldGetLateRecordDropSensor() { final String metricNamePrefix = "late-record-drop"; final String descriptionOfCount = "The total number of dropped late records"; final String descriptionOfRate = "The average number of dropped late records per second"; if (builtInMetricsVersion == Version.FROM_0100_TO_24) { setUpThroughputSensor( metricNamePrefix, descriptionOfRate, descriptionOfCount, RecordingLevel.INFO ); } else { expect(streamsMetrics.nodeLevelSensor( THREAD_ID, TASK_ID, PROCESSOR_NODE_ID, metricNamePrefix, RecordingLevel.INFO <START> )).andReturn(expectedSensor); <END> } verifySensor(() -> ProcessorNodeMetrics.lateRecordDropSensor(THREAD_ID, TASK_ID, PROCESSOR_NODE_ID, streamsMetrics)); }</code><technical_language>is expectedSensor is a mock? I feel state expect called returning anything</technical_language>

Target:
public void shouldGetLateRecordDropSensor() { final String metricNamePrefix = "late-record-drop"; final String descriptionOfCount = "The total number of dropped late records"; final String descriptionOfRate = "The average number of dropped late records per second"; setUpThroughputSensor( metricNamePrefix, descriptionOfRate, descriptionOfCount, RecordingLevel.INFO ); verifySensor(() -> ProcessorNodeMetrics.lateRecordDropSensor(THREAD_ID, TASK_ID, PROCESSOR_NODE_ID, streamsMetrics)); }
Source:
<code>public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { count++; if (count % stepSize == 0) { <START> if (worked-- > 0) <END> monitor.update(stepSize); if (monitor.isCancelled()) cancelled = true; } return !cancelled; }</code><technical_language>this condition true? set worked = total above, subtract 100 times. If 1000 files in DirCache, "end" of iteration worked is 900</technical_language>

Target:
public boolean include(TreeWalk walker) throws MissingObjectException, IncorrectObjectTypeException, IOException { count++; if (count % stepSize == 0) { if (count <= total) monitor.update(stepSize); if (monitor.isCancelled()) throw StopWalkException.INSTANCE; } return true; }
Source:
<code>public void testEquals() throws Exception { <START> File tempFile = File.createTempFile( "pomTest-", ".xml" ); <END> tempFile.deleteOnExit(); FileModelSource instance = new FileModelSource( tempFile ); assertFalse( instance.equals( null ) ); assertFalse( instance.equals( new Object() ) ); assertTrue( instance.equals( instance ) ); assertTrue( instance.equals( new FileModelSource( tempFile ) ) ); }</code><technical_language>If TemporaryFolder File.createTempFile</technical_language>

Target:
public void testEquals() throws Exception { File tempFile = createTempFile( "pomTest" ); FileModelSource instance = new FileModelSource( tempFile ); assertFalse( instance.equals( null ) ); assertFalse( instance.equals( new Object() ) ); assertTrue( instance.equals( instance ) ); assertTrue( instance.equals( new FileModelSource( tempFile ) ) ); }
Source:
<code>public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String spanName = spanName(handler); <START> boolean reuseSpan = getTracer().isTracing(); <END> Span span = reuseSpan ? getTracer().getCurrentSpan() : getTracer().createSpan(spanName); span.logEvent(getTraceKeys().getMvc().getControllerStart()); if (log.isDebugEnabled()) { log.debug("Created new span " + span + " with name [" + spanName + "]"); } addClassMethodTag(handler, span); addClassNameTag(handler, span); setSpanInAttribute(request, span); if (!reuseSpan) { setNewSpanCreatedAttribute(request, span); } return true; }</code><technical_language>I terms join continue? more often? do a 3rd (reuse)</technical_language>

Target:
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { String spanName = spanName(handler); boolean continueSpan = getRootSpanFromAttribute(request) != null; Span span = continueSpan ? getRootSpanFromAttribute(request) : getTracer().createSpan(spanName); if (log.isDebugEnabled()) { log.debug("Created new span " + span + " with name [" + spanName + "]"); } addClassMethodTag(handler, span); addClassNameTag(handler, span); setSpanInAttribute(request, span); if (!continueSpan) { setNewSpanCreatedAttribute(request, span); } return true; }
Source:
<code>public void getThreadExecutionStateDone(ICPUDMContext cpuContext, ICoreDMContext coreContext, IMIExecutionDMContext execContext, IThreadDMData threadData, VisualizerExecutionState state, Object arg) { VisualizerModel model = (VisualizerModel) arg; int cpuID = Integer.parseInt(cpuContext.getId()); VisualizerCPU cpu = model.getCPU(cpuID); int coreID = Integer.parseInt(coreContext.getId()); VisualizerCore core = cpu.getCore(coreID); if (state == null) { state = VisualizerExecutionState.RUNNING; } IMIProcessDMContext processContext = DMContexts.getAncestorOfType(execContext, IMIProcessDMContext.class); int pid = Integer.parseInt(processContext.getProcId()); int tid = execContext.getThreadId(); String osTIDValue = threadData.getId(); int osTid = (osTIDValue == null) ? tid : Integer.parseInt(osTIDValue); <START> if (model.getThread(tid) == null) { <END> model.addThread(new VisualizerThread(core, pid, osTid, tid, state)); } else { VisualizerThread t = model.getThread(tid); t.setState(state); t.setCore(core); } done(1, model); }</code><technical_language>store thread result in a variable avoid potentially searching for twice</technical_language>

Target:
public void getThreadExecutionStateDone(ICPUDMContext cpuContext, ICoreDMContext coreContext, IMIExecutionDMContext execContext, IThreadDMData threadData, VisualizerExecutionState state, Object arg) { VisualizerModel model = (VisualizerModel) arg; int cpuID = Integer.parseInt(cpuContext.getId()); VisualizerCPU cpu = model.getCPU(cpuID); int coreID = Integer.parseInt(coreContext.getId()); VisualizerCore core = cpu.getCore(coreID); if (state == null) { state = VisualizerExecutionState.RUNNING; } IMIProcessDMContext processContext = DMContexts.getAncestorOfType(execContext, IMIProcessDMContext.class); int pid = Integer.parseInt(processContext.getProcId()); int tid = execContext.getThreadId(); String osTIDValue = threadData.getId(); int osTid = (osTIDValue == null) ? tid : Integer.parseInt(osTIDValue); VisualizerThread t = model.getThread(tid); if (t == null) { model.addThread(new VisualizerThread(core, pid, osTid, tid, state)); } else { t.setCore(core); t.setTID(osTid); t.setState(state); } done(1, model); }
Source:
<code>public int hashCode() { <START> return getClass().hashCode(); <END> }</code><technical_language>explain this is necessary</technical_language>

Target:
public int hashCode() { return 1; }
Source:
<code>protected Object setSkipRemoteGetsAndInvokeNextForDataCommand(InvocationContext ctx, DataWriteCommand command, CompletionStage<Void> delay) { <START> if (delay != null) { <END> return asyncValue(delay).thenApply(ctx, command, (rCtx, rCommand, rValue) -> invokeNextAndHandle(ctx, command, handleDataWriteReturn)); } return invokeNextAndHandle(ctx, command, handleDataWriteReturn); }</code><technical_language>checking if delay is completed</technical_language>

Target:
protected Object setSkipRemoteGetsAndInvokeNextForDataCommand(InvocationContext ctx, DataWriteCommand command, CompletionStage<Void> delay) { return makeStage(asyncInvokeNext(ctx, command, delay)).andHandle(ctx, command, handleDataWriteReturn); }
Source:
<code>public AddQuotaCommand(T parameters) { <START> super(parameters); <END> }</code><technical_language>set storagePoolId overwrite getStoragePoolId, permissionSubject method work, dont forget check if quota is null, in case it</technical_language>

Target:
public AddQuotaCommand(T parameters) { super(parameters); setStoragePoolId(parameters.getStoragePoolId()); }
Source:
<code>private static void openInBrowser(FragmentActivity context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(url)); try { context.startActivity(intent); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.cannot_open_url, Toast.LENGTH_SHORT).show(); logger.error(new Exception(String.format("No activity found (browser cannot handle request) for this url: %s, error:\n", url) + e.getMessage()), true); } <START> AnalyticsRegistry analyticsRegistry = environment.getAnalyticsRegistry(); <END> analyticsRegistry.trackBrowserLaunched(url); }</code><technical_language>@farhan Is necessary send analytics raising ActivityNotFoundException</technical_language>

Target:
private static void openInBrowser(FragmentActivity context, String url) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.addCategory(Intent.CATEGORY_BROWSABLE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setData(Uri.parse(url)); try { context.startActivity(intent); AnalyticsRegistry analyticsRegistry = environment.getAnalyticsRegistry(); analyticsRegistry.trackBrowserLaunched(url); } catch (ActivityNotFoundException e) { Toast.makeText(context, R.string.cannot_open_url, Toast.LENGTH_SHORT).show(); logger.error(new Exception(String.format("No activity found (browser cannot handle request) for this url: %s, error:\n", url) + e.getMessage()), true); } }
Source:
<code>private static synchronized void init() { if (cacheManager == null) { try { distributed = Boolean.valueOf(HawkularProperties.getProperty(ALERTS_DISTRIBUTED, ALERTS_DISTRIBUTED_ENV, ALERTS_DISTRIBUTED_DEFAULT)); <START> String configPath = System.getProperty(CONFIG_PATH); <END> InputStream is = null; if (configPath != null) { File configFile = new File(configPath, distributed ? ISPN_CONFIG_DISTRIBUTED : ISPN_CONFIG_LOCAL); if (configFile.exists() && configFile.isDirectory()) { is = new FileInputStream(configFile); } } if (is == null) { is = IspnCacheManager.class.getResourceAsStream("/" + (distributed ? ISPN_CONFIG_DISTRIBUTED : ISPN_CONFIG_LOCAL)); } cacheManager = new DefaultCacheManager(is); } catch (IOException e) { log.error(e); } } }</code><technical_language>for this PR. Inventory is ${jboss.server.config.dir}/hawkular read config files read config files. good unify some point. (If found, read classloader). I this configuration 2.x 1.8 context is different, necessary change</technical_language>

Target:
private static synchronized void init() { if (cacheManager == null) { try { distributed = Boolean.valueOf(HawkularProperties.getProperty(ALERTS_DISTRIBUTED, ALERTS_DISTRIBUTED_ENV, ALERTS_DISTRIBUTED_DEFAULT)); String configFilename = distributed ? ISPN_CONFIG_DISTRIBUTED : ISPN_CONFIG_LOCAL; Path configPath = Paths.get(System.getProperty("jboss.server.config.dir"), "hawkular"); File cacheConfigFile = new File(configPath.toFile(), configFilename); if (cacheConfigFile.exists()) { cacheManager = new DefaultCacheManager(cacheConfigFile.getPath()); } else { cacheManager = new DefaultCacheManager( IspnCacheManager.class.getResourceAsStream("/" + configFilename)); } } catch (IOException e) { log.error(e); } } }
Source:
<code>public void jobStatusChanged(JobInstance job) { JobIdentifier identifier = job.getIdentifier(); if (job.getState().isScheduled()) { consoleActivityMonitor.jobScheduledMap.putIfAbsent(identifier, consoleActivityMonitor.timeProvider.currentTimeMillis()); } else if (job.getState().isActiveOnAgent() || job.isCompleted()) { consoleActivityMonitor.jobScheduledMap.remove(identifier); <START> consoleActivityMonitor.removeHungJobWarning(identifier); <END> } }</code><technical_language>remove warning if jobScheduledMap identifier. wanted do clear out warnings added jobLastActivityMap</technical_language>

Target:
public void jobStatusChanged(JobInstance job) { JobIdentifier identifier = job.getIdentifier(); if (job.getState().isScheduled()) { consoleActivityMonitor.jobScheduledMap.putIfAbsent(identifier, consoleActivityMonitor.timeProvider.currentTimeMillis()); } else if (job.getState().isActiveOnAgent() || job.isCompleted()) { Long timestamp = consoleActivityMonitor.jobScheduledMap.remove(identifier); if (timestamp != null) { consoleActivityMonitor.removeHungJobWarning(identifier); } } }
Source:
<code>public int read() { int data = -1; if (loadData()) { <START> data = currentChunk.get() & 0xFF; <END> bytesAvailable--; } return data; }</code><technical_language>ByteBuffer get() return 1 byte, "&0xFF" then</technical_language>

Target:
public int read() throws IOException { int data = -1; if (loadData()) { data = currentChunk.get() & 0xFF; bytesAvailable--; } return data; }
Source:
<code>public void push(Run run) { if (enabled) { if (run != null) { Run clone = partialCopy(run); if (clone != null) { applyListeners(clone); if (!runs.containsKey(run.getId())) { runs.put(run.getId(), clone); } <START> } <END> } } else { log.warn("Alerting system disabled."); } }</code><technical_language>debug messages kind of match other in class. stay removed. elect I useful troubleshooting alerts</technical_language>

Target:
public void push(Run run) { if (enabled) { if (run != null) { Run clone = partialCopy(run); if (clone != null) { applyListeners(clone); if (runs.containsKey(run.getId())) { if (clone.getHealth() != null) { log.debug("Not replacing Run " + clone.getId() + ": " + clone.getHealth().name()); } } if (!runs.containsKey(run.getId())) { runs.put(run.getId(), clone); if (clone.getHealth() != null) { log.debug("Queued Run " + clone.getId() + ": " + clone.getHealth().name()); } } } } } else { log.warn("Alerting system disabled."); } }
Source:
<code><START> public ValidationJob(Object family, Runnable runnable) { <END> super(VALIDATION_JOB_NAME); this.family = family; this.runnable = runnable; }</code><technical_language>Add a null check family runnable arguments</technical_language>

Target:
public ValidationJob(Object family, Runnable runnable) { super(VALIDATION_JOB_NAME); Preconditions.checkNotNull(family); Preconditions.checkNotNull(runnable); this.family = family; this.runnable = runnable; }
Source:
<code>public void setLockDuration(Duration lockDuration) { if (lockDuration == null) { <START> throw new IllegalArgumentException("Value cannot be null."); <END> } this.lockDuration = lockDuration; if (this.lockDuration.compareTo(ManagementClientConstants.MAX_DURATION) > 0) { this.lockDuration = ManagementClientConstants.MAX_DURATION; } }</code><technical_language>Replace Objects.requireNotNull</technical_language>

Target:
public void setLockDuration(Duration lockDuration) { Objects.requireNonNull(lockDuration, "'lockDuration' cannot be null."); this.lockDuration = lockDuration; if (this.lockDuration.compareTo(ManagementClientConstants.MAX_DURATION) > 0) { this.lockDuration = ManagementClientConstants.MAX_DURATION; } }
Source:
<code>private static String learnedConstraintMessage(Constraint lc, ExplodedGraph.Node currentNode, ExplodedGraph.Node parent) { Tree nodeTree = parent.programPoint.syntaxTree(); String name = SyntaxTreeNameFinder.getName(nodeTree); if (nodeTree.is(Tree.Kind.METHOD_INVOCATION)) { List<MethodYield> usedMethodYields = currentNode.usedMethodYields(parent); if (!usedMethodYields.isEmpty()) { Type exceptionType = usedMethodYields.get(0).exceptionType(); <START> if (exceptionType != null) { <END> return exceptionType.isUnknown() ? String.format("Exception thrown by '%s'", name) : String.format("Exception '%s' thrown by '%s'", exceptionType.name(), name); } } return String.format("'%s' returns %s", name, lc.valueAsString()); } if (nodeTree.is(Tree.Kind.NEW_CLASS)) { return String.format("Constructor call creates '%s'", lc.valueAsString()); } return name == null ? lc.valueAsString() : String.format("Implies '%s' is %s", name, lc.valueAsString()); }</code><technical_language>Wondering this limitation in fact. addressed in another ticket</technical_language>

Target:
private static String learnedConstraintMessage(Constraint lc, ExplodedGraph.Node currentNode, ExplodedGraph.Node parent) { Tree nodeTree = parent.programPoint.syntaxTree(); String name = SyntaxTreeNameFinder.getName(nodeTree); if (nodeTree.is(Tree.Kind.METHOD_INVOCATION)) { MethodYield selectedMethodYield = currentNode.selectedMethodYield(parent); if (selectedMethodYield != null) { Type exceptionType = selectedMethodYield.exceptionType(); if (exceptionType != null) { return exceptionType.isUnknown() ? String.format("Exception thrown by '%s'", name) : String.format("Exception '%s' thrown by '%s'", exceptionType.name(), name); } } return String.format("'%s' returns %s", name, lc.valueAsString()); } if (nodeTree.is(Tree.Kind.NEW_CLASS)) { return String.format("Constructor call creates '%s'", lc.valueAsString()); } return name == null ? lc.valueAsString() : String.format("Implies '%s' is %s", name, lc.valueAsString()); }
Source:
<code>public Collection<Map.Entry<K, V>> scanAndFilterByEntry( Predicate<? super Map.Entry<K, V>> entryPredicate) { <START> return mainMap.entryStream().parallel() <END> .filter(entryPredicate) .collect(Collectors.toCollection(ArrayList::new)); }</code><technical_language>is a difference parallelStream() entryStream().parallel()</technical_language>

Target:
public Collection<Map.Entry<K, V>> scanAndFilterByEntry( Predicate<? super Map.Entry<K, V>> entryPredicate) { return mainMap.entryStream() .filter(entryPredicate) .collect(Collectors.toCollection(ArrayList::new)); }
Source:
<code>public org.ovirt.engine.api.model.Cluster update(org.ovirt.engine.api.model.Cluster incoming) { <START> <END> return performUpdate(incoming, new QueryIdResolver<>(VdcQueryType.GetClusterById, IdQueryParameters.class), VdcActionType.UpdateCluster, new UpdateParametersProvider(this)); }</code><technical_language>please remove new empty line</technical_language>

Target:
public org.ovirt.engine.api.model.Cluster update(org.ovirt.engine.api.model.Cluster incoming) { return performUpdate(incoming, new QueryIdResolver<>(VdcQueryType.GetClusterById, IdQueryParameters.class), ActionType.UpdateCluster, new UpdateParametersProvider(this)); }
Source:
<code>protected void addAnnotation(AnnotationProxy annotation) { if (map == null) { return; } TiMarker tiMarker = annotation.getTiMarker(); if (tiMarker != null) { timarkers.remove(tiMarker); tiMarker.getMarker().remove(); } if (map != null) { annotation.processOptions(); if (annotation.getProperty(MapModule.PROPERTY_CLUSTER_IDENTIFIER) == null) { Marker marker = mMarkerManager.getCollection(DEFAULT_COLLECTION_ID).addMarker(annotation.getMarkerOptions()); tiMarker = new TiMarker(marker, annotation); } else { tiMarker = new TiMarker(null, annotation); if (mClusterManager != null) { mClusterManager.addItem((TiMarker)tiMarker); } <START> mClusterManager.cluster(); <END> } annotation.setTiMarker(tiMarker); timarkers.add(tiMarker); } }</code><technical_language>Java if (mClusterManager != null) {</technical_language>

Target:
protected void addAnnotation(AnnotationProxy annotation) { if (map == null) { return; } TiMarker tiMarker = annotation.getTiMarker(); if (tiMarker != null) { timarkers.remove(tiMarker); tiMarker.getMarker().remove(); } if (map != null) { annotation.processOptions(); if (annotation.getProperty(MapModule.PROPERTY_CLUSTER_IDENTIFIER) == null) { Marker marker = mMarkerManager.getCollection(DEFAULT_COLLECTION_ID).addMarker(annotation.getMarkerOptions()); tiMarker = new TiMarker(marker, annotation); } else { tiMarker = new TiMarker(null, annotation); if (mClusterManager != null) { mClusterManager.addItem((TiMarker)tiMarker); mClusterManager.cluster(); } } annotation.setTiMarker(tiMarker); timarkers.add(tiMarker); } }
Source:
<code>public static BuySell parseBuySell(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "BUY": case "B": return BuySell.BUY; case "SELL": case "S": return BuySell.SELL; default: <START> throw new IllegalArgumentException("Unknown BuySell value, must 'Buy' or 'Sell' but was '" + str + "'"); <END> } }</code><technical_language>Missing "be" "must". error message is a bit misleading</technical_language>

Target:
public static BuySell parseBuySell(String str) { switch (str.toUpperCase(Locale.ENGLISH)) { case "BUY": case "B": return BuySell.BUY; case "SELL": case "S": return BuySell.SELL; default: throw new IllegalArgumentException( "Unknown BuySell value, must be 'Buy' or 'Sell' but was '" + str + "'; " + "parser is case insensitive and also accepts 'B' and 'S'"); } }
Source:
<code>public void iterateByPageSnippet() { PagedFlux<Integer> pagedFlux = createAnInstance(); PagedIterable<Integer> pagedIterableResponse = new PagedIterable<>(pagedFlux); pagedIterableResponse.iterableByPage().forEach(resp -> { if (resp.statusCode() == HttpURLConnection.HTTP_OK) { <START> System.out.printf("Response headers are %s. Url %s \n", resp.headers(), resp.request().url()); <END> resp.items().forEach(value -> { System.out.printf("Response value is %d \n", value); }); } else { System.out.printf("Failed with status is %d and url is %s \n", resp.statusCode(), resp.request().url()); } }); END: com.azure.core.http.rest.pagedIterable.iterableByPage }</code><technical_language>IIRC, %n is preferred \n string.format() produces a platform specific line ending. Spotbugs entry: FS: Format string %n \n (VA_FORMAT_STRING_USES_NEWLINE) This format string include a newline character (\n). In format strings, is generally preferable %n, produce platform-specific line separator</technical_language>

Target:
public void iterateByPageSnippet() { PagedFlux<Integer> pagedFlux = createAnInstance(); PagedIterable<Integer> pagedIterableResponse = new PagedIterable<>(pagedFlux); pagedIterableResponse.iterableByPage().forEach(resp -> { System.out.printf("Response headers are %s. Url %s and status code %d %n", resp.headers(), resp.request().url(), resp.statusCode()); resp.items().forEach(value -> { System.out.printf("Response value is %d %n", value); }); }); END: com.azure.core.http.rest.pagedIterable.iterableByPage }
Source:
<code>public void setFilters(@NonNull ViewerFilter[] filters) { fFilters.clear(); if (filters != null) { fFilters.addAll(Arrays.asList(filters)); <START> } <END> }</code><technical_language>do do listeners here... some filters added, some removed, some changed, some unchanged... over-engineering this? Double-hmm :(</technical_language>

Target:
public void setFilters(@NonNull ViewerFilter[] filters) { fFilters.clear(); if (filters != null) { List<@NonNull ViewerFilter> filtersList = Arrays.asList(filters); fFilters.addAll(filtersList); fireFiltersAdded(filtersList); } }
Source:
<code>public void cleanupTest() throws InterruptedException { for (String db : _dbs) { _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, db); Thread.sleep(20); } _dbs.clear(); Thread.sleep(50); for (int i = 0; i < _participants.length; i++) { _participants[i].syncStop(); _participants[i] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, _participants[i].getInstanceName()); } <START> DelayedTransition.clearThrottleRecord(); <END> }</code><technical_language>Is a strong reason modifying this method</technical_language>

Target:
public void cleanupTest() throws InterruptedException { for (String db : _dbs) { _gSetupTool.dropResourceFromCluster(CLUSTER_NAME, db); Thread.sleep(20); } _dbs.clear(); Thread.sleep(50); HelixDataAccessor dataAccessor = new ZKHelixDataAccessor(CLUSTER_NAME, new ZkBaseDataAccessor<>(_gZkClient)); for (int i = 0; i < _participants.length; i++) { _participants[i].syncStop(); _participants[i] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, _participants[i].getInstanceName()); } try { Assert.assertTrue(TestHelper.verify(() -> dataAccessor.getChildNames(dataAccessor.keyBuilder().liveInstances()).isEmpty(), 1000)); } catch (Exception e) { e.printStackTrace(); System.out.println("There're live instances not cleaned up yet"); assert false; } DelayedTransition.clearThrottleRecord(); }
Source:
<code>public void shouldNotRemoveAllNonMatchedElementsFromNonNil() { final Seq<Integer> t = of(1, 2, 3); final Predicate<Integer> isTooBig = i -> i >= 4; <START> assertThat(t.reject(isTooBig)).isSameAs(t); <END> }</code><technical_language>removeAll</technical_language>

Target:
public void shouldNotRemoveAllNonMatchedElementsFromNonNil() { final Seq<Integer> t = of(1, 2, 3); final Predicate<Integer> isTooBig = i -> i >= 4; assertThat(t.removeAll(isTooBig)).isSameAs(t); }
Source:
<code>void openNoRightsPopup() { <START> InfoPopup.generate( ts.getTranslation( LibraryConstants.Error_NoAccessRights ) ); <END> }</code><technical_language>this performed View (presumably showing a "popup")</technical_language>

Target:
void openNoRightsPopup() { view.openNoRightsPopup(); }
Source:
<code>public void setSampleIds(Map<String, Integer> sampleIds) { <START> this.sampleIds = sampleIds; <END> this.idSamples = new HashMap<>(sampleIds.size()); for (Map.Entry<String, Integer> entry : sampleIds.entrySet()) { idSamples.put(entry.getValue(), entry.getKey()); } assert sampleIds.size() == idSamples.size(); }</code><technical_language>is dangerous, change structure is passed this function modify also</technical_language>

Target:
public void setSampleIds(Map<String, Integer> sampleIds) { this.sampleIds = new HashMap<String, Integer>(sampleIds); this.idSamples = new HashMap<>(this.sampleIds.size()); for (Map.Entry<String, Integer> entry : this.sampleIds.entrySet()) { idSamples.put(entry.getValue(), entry.getKey()); } assert sampleIds.size() == idSamples.size(); }
Source:
<code>private void convertTestFailureIgnore(ReportOptions option, Xpp3Dom configuration) { List<String> testFailureIgnoreList = extractStrings("testFailureIgnore", configuration); <START> if (!testFailureIgnoreList.isEmpty()) { <END> String testFailureIgnore = testFailureIgnoreList.iterator().next(); option.setSkipFailingTests(Boolean.parseBoolean(testFailureIgnore)); } }</code><technical_language>if list contains more 1 element? is ignored? log</technical_language>

Target:
private void convertTestFailureIgnore(ReportOptions option, Xpp3Dom configuration) { Xpp3Dom testFailureIgnore = configuration.getChild("testFailureIgnore"); if (testFailureIgnore != null) { option.setSkipFailingTests(Boolean.parseBoolean(testFailureIgnore.getValue())); } }
Source:
<code>private ServiceHealthKey getServiceHealthKeyFromCache(ServiceHealthCache cache, String serviceId, int port) { return cache.getMap().keySet() .stream() .filter(key -> serviceId.equals(key.getServiceId()) && (port == key.getPort())) .findFirst() <START> .orElse(null); <END> }</code><technical_language>Option instead of null</technical_language>

Target:
private static Optional<ServiceHealthKey> getServiceHealthKeyFromCache(ServiceHealthCache cache, String serviceId, int port) { return cache.getMap().keySet() .stream() .filter(key -> serviceId.equals(key.getServiceId()) && (port == key.getPort())) .findFirst(); }
Source:
<code>protected void injectSshKeysIntoSystemVmIsoPatch(String publicKeyPath, String privKeyPath) { s_logger.info("Trying to inject public and private keys into systemvm iso"); String injectScript = getInjectScript(); String scriptPath = Script.findScript("", injectScript); String systemVmIsoPath = Script.findScript("", "vms/systemvm.iso"); if (scriptPath == null) { throw new CloudRuntimeException("Unable to find key inject script " + injectScript); } if (systemVmIsoPath == null) { throw new CloudRuntimeException("Unable to find systemvm iso vms/systemvm.iso"); } Script command = null; if(isOnWindows()) { command = new Script("python", s_logger); } else { command = new Script("/bin/bash", s_logger); } <START> String osname = System.getProperty("os.name"); <END> if (osname.startsWith("Windows")) { scriptPath = scriptPath.replaceAll("\\\\" ,"/" ); systemVmIsoPath = systemVmIsoPath.replaceAll("\\\\" ,"/" ); publicKeyPath = publicKeyPath.replaceAll("\\\\" ,"/" ); privKeyPath = privKeyPath.replaceAll("\\\\" ,"/" ); } command.add(scriptPath); command.add(publicKeyPath); command.add(privKeyPath); command.add(systemVmIsoPath); final String result = command.execute(); s_logger.info("Injected public and private keys into systemvm iso with result : " + result); if (result != null) { s_logger.warn("Failed to inject generated public key into systemvm iso " + result); throw new CloudRuntimeException("Failed to inject generated public key into systemvm iso " + result); } }</code><technical_language>is isOnWindows() function in this class reused</technical_language>

Target:
protected void injectSshKeysIntoSystemVmIsoPatch(String publicKeyPath, String privKeyPath) { s_logger.info("Trying to inject public and private keys into systemvm iso"); String injectScript = getInjectScript(); String scriptPath = Script.findScript("", injectScript); String systemVmIsoPath = Script.findScript("", "vms/systemvm.iso"); if (scriptPath == null) { throw new CloudRuntimeException("Unable to find key inject script " + injectScript); } if (systemVmIsoPath == null) { throw new CloudRuntimeException("Unable to find systemvm iso vms/systemvm.iso"); } Script command = null; if(isOnWindows()) { command = new Script("python", s_logger); } else { command = new Script("/bin/bash", s_logger); } if (this.isOnWindows()) { scriptPath = scriptPath.replaceAll("\\\\" ,"/" ); systemVmIsoPath = systemVmIsoPath.replaceAll("\\\\" ,"/" ); publicKeyPath = publicKeyPath.replaceAll("\\\\" ,"/" ); privKeyPath = privKeyPath.replaceAll("\\\\" ,"/" ); } command.add(scriptPath); command.add(publicKeyPath); command.add(privKeyPath); command.add(systemVmIsoPath); final String result = command.execute(); s_logger.info("Injected public and private keys into systemvm iso with result : " + result); if (result != null) { s_logger.warn("Failed to inject generated public key into systemvm iso " + result); throw new CloudRuntimeException("Failed to inject generated public key into systemvm iso " + result); } }
Source:
<code>} catch (Exception e) { <START> logger.error("Error in initializing es test container , error :", e); <END> }</code><technical_language>Throw it, test some weird zombie state</technical_language>

Target:
} catch (Exception e) { log.error("Error in initializing es test container , error :", e); throw e; }
Source:
<code><START> public void testFailOverflow() throws IOException { <END> final List<Pass> list = new ArrayList<Pass>(2); list.add(new PsFake(true)); list.add(new PsFake(true)); final Opt<Identity> identity = new PsAll(list, 2).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(false) ); }</code><technical_language>@lautarobock declare throws Exception well</technical_language>

Target:
public void testFailOverflow() throws Exception { final List<Pass> list = new ArrayList<Pass>(2); list.add(new PsFake(true)); list.add(new PsFake(true)); final Opt<Identity> identity = new PsAll(list, 2).enter(new RqFake()); MatcherAssert.assertThat( identity.has(), Matchers.is(false) ); }
Source:
<code>private String getSimModsLabelContent(ObservableMap<String, String> simMods) { List<String> modNames = simMods.entrySet().stream() .limit(2) .map(Entry::getValue) .collect(Collectors.toList()); if (simMods.size() > 2) { <START> return i18n.get("game.mods.twoAndMore", modNames.get(0), simMods.size() - 1); <END> } return Joiner.on(i18n.get("textSeparator")).join(modNames); }</code><technical_language>ticket I expected size-2</technical_language>

Target:
private String getSimModsLabelContent(ObservableMap<String, String> simMods) { List<String> modNames = simMods.entrySet().stream() .limit(2) .map(Entry::getValue) .collect(Collectors.toList()); if (simMods.size() > 2) { return i18n.get("game.mods.twoAndMore", modNames.get(0), modNames.get(1), simMods.size() - 2); } return Joiner.on(i18n.get("textSeparator")).join(modNames); }
Source:
<code>public ZibaseBindingConfig(String[] configParameters) { this.values = configParameters; <START> logger.debug("Item Constructor - saved valued : {}", StringUtils.join(this.values, ",")); <END> }</code><technical_language>"saved value" ? "saved values"</technical_language>

Target:
public ZibaseBindingConfig(String[] configParameters) { this.values = configParameters; logger.debug("Item Constructor - saved value(s) : {}", StringUtils.join(this.values, ",")); }
Source:
<code>public void noMoreBubble() { config.setProperty(PARTITION_OPERATION_THREAD_COUNT.getName(), "1"); initExecutor(); final DummyPartitionTaskFactory taskFactory = new DummyPartitionTaskFactory(); taskFactory.delayMs = 1000; executor.executeOnPartitions(taskFactory, newPartitions()); final DummyOperation op = new DummyOperation(); executor.execute(op); assertTrueEventually(new AssertTask() { @Override public void run() { assertTrue(op.completed); } <START> }, SECONDS.toMillis(5)); <END> }</code><technical_language>SECONDS.toMillis(5) -> 5. Timeout parameter of assertTrueEventually(..) is in seconds, milliseconds</technical_language>

Target:
public void noMoreBubble() { config.setProperty(PARTITION_OPERATION_THREAD_COUNT.getName(), "1"); initExecutor(); final DummyPartitionTaskFactory taskFactory = new DummyPartitionTaskFactory(); taskFactory.delayMs = 1000; executor.executeOnPartitions(taskFactory, newPartitions()); final DummyOperation op = new DummyOperation(); executor.execute(op); assertTrueEventually(new AssertTask() { @Override public void run() { assertTrue(op.completed); } }, 5); }
Source:
<code>private void testGeneralQuestionOperations() throws Exception { testCancelAddingNewQuestion(); testCancelEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testEditQuestionLink(); testEditQuestionAction(); <START> testToggleFeedbackPathDisplayLink(); <END> testCopyQuestion(); testChangeFeedbackRecipient(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testDeleteQuestionAction(1); testEditNonExistentQuestion(); testResponseRate(); }</code><technical_language>standardize naming clickToggleCustomFeedbackPath... add word custom</technical_language>

Target:
private void testGeneralQuestionOperations() throws Exception { testCancelAddingNewQuestion(); testCancelEditQuestion(); testNewQuestionLink(); testInputValidationForQuestion(); testAddQuestionAction(); testEditQuestionLink(); testEditQuestionAction(); testToggleCustomFeedbackPathDisplayLink(); testCopyQuestion(); testChangeFeedbackRecipient(); testEditQuestionNumberAction(); testAjaxOnVisibilityMessageButton(); testDeleteQuestionAction(2); testDeleteQuestionAction(1); testEditNonExistentQuestion(); testResponseRate(); }
Source:
<code>protected ACE getACE(String username, String permission) { <START> return new ACE(username, permission, Boolean.TRUE); <END> }</code><technical_language>suggestion return new ACE(username, permission, true);</technical_language>

Target:
protected ACE getACE(String username, String permission) { return new ACE(username, permission, true); }
Source:
<code>private String extension(String filePath) { <START> int extensionPos = filePath.indexOf("."); <END> if (extensionPos > 0) { return filePath.substring(extensionPos + 1); } else { return ""; } }</code><technical_language>lastIndexOf (to avoid problems filenames multiple dots)</technical_language>

Target:
private String extension(String filePath) { int extensionPos = filePath.lastIndexOf("."); if (extensionPos > 0) { return filePath.substring(extensionPos + 1); } else { return ""; } }
Source:
<code>public long estimatedInMemorySizeInBytes() { <START> return INSTANCE_SIZE + sizeOf(weight) + sizeOf(mean) + sizeOf(tempWeight) + sizeOf(tempMean); <END> }</code><technical_language>add order this estimate</technical_language>

Target:
public long estimatedInMemorySizeInBytes() { return INSTANCE_SIZE + sizeOf(weight) + sizeOf(mean) + sizeOf(tempWeight) + sizeOf(tempMean) + sizeOf(order); }
Source:
<code>public Channel createChannel(boolean transactional) { try { Channel channel = this.delegate.createChannel(); if (transactional) { <START> Assert.state(channel != null, "Can't start the transaction - channel is null."); <END> channel.txSelect(); } return channel; } catch (IOException e) { throw RabbitExceptionTranslator.convertRabbitAccessException(e); } }</code><technical_language>I assertion if, a message "Client returned a null channel - maxChannels exceeded?"</technical_language>

Target:
public Channel createChannel(boolean transactional) { try { Channel channel = this.delegate.createChannel(); if (transactional) { Assert.state(channel != null, "Can't start the transaction - no channel is available."); channel.txSelect(); } return channel; } catch (IOException e) { throw RabbitExceptionTranslator.convertRabbitAccessException(e); } }
Source:
<code>public void recoverGroup(final String groupId) throws IOException { final Map<String, QueryCheckpoint> queryCheckpointMap; final List<AvroDag> dagList; final QueryManager queryManager = queryManagerFuture.get(); try { queryCheckpointMap = checkpointStore.loadSavedGroupState(groupId).getQueryCheckpointMap(); final List<String> queryIdListInGroup = new ArrayList<>(); for (final String queryId : queryCheckpointMap.keySet()) { queryIdListInGroup.add(queryId); } dagList = checkpointStore.loadSavedQueries(queryIdListInGroup); } catch (final FileNotFoundException ie) { <START> LOG.log(Level.WARNING, "Failed in loading app {0}, this app may not exist in the checkpoint store.", <END> new Object[]{groupId}); return; } for (final AvroDag avroDag : dagList) { final QueryCheckpoint queryCheckpoint = queryCheckpointMap.get(avroDag.getQueryId()); queryManager.createQueryWithCheckpoint(avroDag, queryCheckpoint); } }</code><technical_language>Please fix this log message</technical_language>

Target:
public void recoverGroup(final String groupId) throws IOException { final Map<String, QueryCheckpoint> queryCheckpointMap; final List<AvroDag> dagList; final QueryManager queryManager = queryManagerFuture.get(); try { queryCheckpointMap = checkpointStore.loadSavedGroupState(groupId).getQueryCheckpointMap(); final List<String> queryIdListInGroup = new ArrayList<>(); for (final String queryId : queryCheckpointMap.keySet()) { queryIdListInGroup.add(queryId); } dagList = checkpointStore.loadSavedQueries(queryIdListInGroup); } catch (final FileNotFoundException ie) { LOG.log(Level.WARNING, "Failed in loading group {0}, this group may not exist in the checkpoint store.", new Object[]{groupId}); return; } for (final AvroDag avroDag : dagList) { final QueryCheckpoint queryCheckpoint = queryCheckpointMap.get(avroDag.getQueryId()); queryManager.createQueryWithCheckpoint(avroDag, queryCheckpoint); } }
Source:
<code>private static void readyForNextRequest(HttpConnectionContext context) { LOG.info().$("Request complete, ").$(context.getTotalBytesSent()).$(" bytes sent [fd=").$(context.getFd()).$(']').$(); context.clear(); <START> context.getDispatcher().registerChannel(context, IOOperation.READ); <END> }</code><technical_language>useful track network usage connection try find offenders. total usage up, do do? - log structure is "action done/doing [context_variable=value, context_variable2=value, ....]"</technical_language>

Target:
private static void readyForNextRequest(HttpConnectionContext context) { LOG.info().$("all sent [fd=").$(context.getFd()).$(", lastRequestBytesSent=").$(context.getLastRequestBytesSent()).$(", nCompletedRequests=").$(context.getNCompletedRequests() + 1) .$(", totalBytesSent=").$(context.getTotalBytesSent()).$(']').$(); context.clear(); context.getDispatcher().registerChannel(context, IOOperation.READ); }
Source:
<code>public void testAbuseFilterTriggerStop() { PageTitle title = new PageTitle(null, ABUSE_FILTER_ERROR_PAGE_TITLE, TEST_WIKI_SITE); String wikitext = "== Section 2 ==\n\nTriggering AbuseFilter number 2 by saying poop many" + "times at " + System.currentTimeMillis(); service.edit(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new Edit.Callback() { @Override public void success(@NonNull EditingResult result) { assertThat(result, instanceOf(AbuseFilterEditResult.class)); <START> assertThat(((AbuseFilterEditResult) result).getType(), <END> is(AbuseFilterEditResult.TYPE_ERROR)); } @Override public void failure(@NonNull Throwable caught) { throw new RuntimeException(caught); } }); }</code><technical_language>latch</technical_language>

Target:
public void testAbuseFilterTriggerStop() { PageTitle title = new PageTitle(null, ABUSE_FILTER_ERROR_PAGE_TITLE, TEST_WIKI_SITE); String wikitext = "== Section 2 ==\n\nTriggering AbuseFilter number 2 by saying poop many" + "times at " + System.currentTimeMillis(); final TestLatch latch = new TestLatch(); client.request(TEST_WIKI_SITE, title, DEFAULT_SECTION_ID, wikitext, ANONYMOUS_TOKEN, DEFAULT_SUMMARY, false, null, null, new EditClient.Callback() { @Override public void success(@NonNull Call<Edit> call, @NonNull EditingResult result) { assertThat(result, instanceOf(AbuseFilterEditResult.class)); assertThat(((AbuseFilterEditResult) result).getType(), is(AbuseFilterEditResult.TYPE_ERROR)); latch.countDown(); } @Override public void failure(@NonNull Call<Edit> call, @NonNull Throwable caught) { throw new RuntimeException(caught); } }); latch.await(); }
Source:
<code>public void serialize(final OVXPort port, final JsonGenerator jgen, final SerializerProvider sp) throws IOException, JsonProcessingException { jgen.writeStartObject(); <START> jgen.writeStringField("dpid", port.getParentSwitch().getSwitchName()); <END> jgen.writeStringField("port", String.valueOf(port.getPortNumber())); jgen.writeEndObject(); }</code><technical_language>dpid, port, vdpid vport for a virtual port? vdpid vport, serialize mapping physical world else</technical_language>

Target:
public void serialize(final OVXPort port, final JsonGenerator jgen, final SerializerProvider sp) throws IOException, JsonProcessingException { jgen.writeStartObject(); jgen.writeStringField("vdpid", port.getParentSwitch().getSwitchName()); jgen.writeNumberField("vport", port.getPortNumber()); jgen.writeEndObject(); }
Source:
<code><START> static <T> Future<T> ofSupplier(Supplier<? extends T> computation) { <END> return of(DEFAULT_EXECUTOR_SERVICE, computation::get); }</code><technical_language>Please add a java Objects.requireNonNull(computation, "computation is null");</technical_language>

Target:
static <T> Future<T> ofSupplier(Supplier<? extends T> computation) { Objects.requireNonNull(computation, "computation is null"); return of(DEFAULT_EXECUTOR_SERVICE, computation::get); }
Source:
<code>public static ItemStack tryActivateAndGet(@Nonnull Event e, @Nonnull SlimefunItem item) { if (!(item instanceof Talisman)) { return null; } Talisman talisman = (Talisman) item; if (ThreadLocalRandom.current().nextInt(100) > talisman.getChance()) { return null; } Player p = getPlayerByEventType(e); if (p == null || !pass(p, talisman)) { return null; } <START> if (!Slimefun.hasUnlocked(p, talisman, true)) { return null; } <END> ItemStack possibleTalisman = retrieveTalismanFromInventory(p.getInventory(), talisman); if (possibleTalisman != null) { activateTalisman(e, p, p.getInventory(), talisman); return possibleTalisman; } possibleTalisman = retrieveTalismanFromInventory(p.getEnderChest(), talisman); if (possibleTalisman != null) { activateTalisman(e, p, p.getEnderChest(), talisman); return possibleTalisman; } return possibleTalisman; }</code><technical_language>This send a message player, want this if Player carrying talisman</technical_language>

Target:
public static ItemStack tryActivateAndGet(@Nonnull Event e, @Nonnull SlimefunItem item) { if (!(item instanceof Talisman)) { return null; } Talisman talisman = (Talisman) item; if (ThreadLocalRandom.current().nextInt(100) > talisman.getChance()) { return null; } Player p = getPlayerByEventType(e); if (p == null || !pass(p, talisman)) { return null; } ItemStack possibleTalisman = retrieveTalismanFromInventory(p.getInventory(), talisman.getItem()); if (possibleTalisman != null) { if (Slimefun.hasUnlocked(p, talisman, true)) { activateTalisman(e, p, p.getInventory(), talisman, possibleTalisman); return possibleTalisman; } else { return null; } } possibleTalisman = retrieveTalismanFromInventory(p.getEnderChest(), talisman.getEnderVariant()); if (possibleTalisman != null) { if (Slimefun.hasUnlocked(p, talisman, true)) { activateTalisman(e, p, p.getEnderChest(), talisman, possibleTalisman); return possibleTalisman; } else { return null; } } return null; }