auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected RuleResultMetadata createRuleResultMetadata(final PasswordData password) { final Map<String, Object> m = new LinkedHashMap<>(); m.put( "whitespaceCharacterCount", PasswordUtils.countMatchingCharacters(String.valueOf(whitespaceCharacters), password.getPassword())); return new RuleResultMetadata(m); }

Target:
protected RuleResultMetadata createRuleResultMetadata(final PasswordData password) { return new RuleResultMetadata( RuleResultMetadata.CountCategory.Whitespace, PasswordUtils.countMatchingCharacters(String.valueOf(whitespaceCharacters), password.getPassword())); }
Source:
public void testCheckpointWriteErrorCount() throws Exception { int checkpointInterval = 1000; FileChannel channel = createFileChannel(Collections.singletonMap( FileChannelConfiguration.CHECKPOINT_INTERVAL, String.valueOf(checkpointInterval))); channel.start(); Transaction tx = channel.getTransaction(); tx.begin(); channel.put(EventBuilder.withBody("test".getBytes())); tx.commit(); tx.close(); long beforeCheckpointWrite = System.currentTimeMillis(); Thread.sleep(checkpointInterval + 100); assertEquals(0, channel.getChannelCounter().getCheckpointWriteErrorCount()); assertTrue(new File(checkpointDir, "checkpoint").lastModified() > beforeCheckpointWrite); FileUtils.deleteDirectory(baseDir); Thread.sleep(checkpointInterval + 100); assertEquals(1, channel.getChannelCounter().getCheckpointWriteErrorCount()); }

Target:
public void testCheckpointWriteErrorCount() throws Exception { int checkpointInterval = 1500; final FileChannel channel = createFileChannel(Collections.singletonMap( FileChannelConfiguration.CHECKPOINT_INTERVAL, String.valueOf(checkpointInterval))); channel.start(); Transaction tx = channel.getTransaction(); tx.begin(); channel.put(EventBuilder.withBody("test".getBytes())); tx.commit(); tx.close(); final long beforeCheckpointWrite = System.currentTimeMillis(); assertEventuallyTrue("checkpoint should have been written", new BooleanPredicate() { @Override public boolean get() { return new File(checkpointDir, "checkpoint").lastModified() > beforeCheckpointWrite; } }, checkpointInterval * 3); assertEquals(0, channel.getChannelCounter().getCheckpointWriteErrorCount()); FileUtils.deleteDirectory(baseDir); assertEventuallyTrue("checkpointWriterErrorCount should be 1", new BooleanPredicate() { @Override public boolean get() { return channel.getChannelCounter().getCheckpointWriteErrorCount() == 1; } }, checkpointInterval * 3); }
Source:
public static Block toArray(ArrayType arrayType, BlockBuilderAppender elementAppender, ConnectorSession connectorSession, Slice json) { try (JsonParser jsonParser = createJsonParser(JSON_FACTORY, json)) { jsonParser.nextToken(); if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) { return null; } checkState(jsonParser.currentToken() == JsonToken.START_ARRAY, "Expected a json array"); BlockBuilder blockBuilder = arrayType.getElementType().createBlockBuilder(new BlockBuilderStatus(), 20); while (jsonParser.nextValue() != JsonToken.END_ARRAY) { elementAppender.append(jsonParser, blockBuilder); } return blockBuilder.build(); } catch (RuntimeException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast '%s' to %s", json.toStringUtf8(), arrayType), e); } catch (IOException e) { throw Throwables.propagate(e); } }

Target:
public static Block toArray(ArrayType arrayType, BlockBuilderAppender elementAppender, ConnectorSession connectorSession, Slice json) { try (JsonParser jsonParser = createJsonParser(JSON_FACTORY, json)) { jsonParser.nextToken(); if (jsonParser.getCurrentToken() == JsonToken.VALUE_NULL) { return null; } if (jsonParser.getCurrentToken() != START_ARRAY) { throw new JsonCastException(format("Expected a json array, but got %s", jsonParser.getText())); } BlockBuilder blockBuilder = arrayType.getElementType().createBlockBuilder(new BlockBuilderStatus(), 20); while (jsonParser.nextToken() != JsonToken.END_ARRAY) { elementAppender.append(jsonParser, blockBuilder); } if (jsonParser.nextToken() != null) { throw new JsonCastException(format("Unexpected trailing token: %s", jsonParser.getText())); } return blockBuilder.build(); } catch (PrestoException | JsonCastException e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast to %s. %s\n%s", arrayType, e.getMessage(), truncateIfNecessaryForErrorMessage(json)), e); } catch (Exception e) { throw new PrestoException(INVALID_CAST_ARGUMENT, format("Cannot cast to %s.\n%s", arrayType, truncateIfNecessaryForErrorMessage(json)), e); } }
Source:
public void openCore(DataSetProcessor dsp) throws StandardException{ try { submittedTime = new SimpleDateFormat(timeStampFormat).format(new Date()); if (LOG.isTraceEnabled()) LOG.trace(String.format("openCore %s", this)); isOpen = true; String sql = activation.getPreparedStatement().getSource(); if (!(this instanceof ExplainOperation || activation.isMaterialized())) activation.materialize(); long txnId=getCurrentTransaction().getTxnId(); sql=sql==null?this.toString():sql; String userId=activation.getLanguageConnectionContext().getCurrentUserId(activation); activation.getLanguageConnectionContext().setControlExecutionLimiter(EngineDriver.driver().processorFactory().getControlExecutionLimiter(activation)); returnedRows = false; engineName = (dsp.getType() == DataSetProcessor.Type.SPARK) ? "SPARK" : "CONTROL"; if (dsp.getType() == DataSetProcessor.Type.SPARK) { this.jobName = userId + " <" + txnId + ">"; dsp.setJobGroup(jobName, sql); } dsp.clearBroadcastedOperation(); this.execRowIterator =getDataSet(dsp).toLocalIterator(); } catch (ResubmitDistributedException e) { resubmitDistributed(e); }catch(Exception e){ checkInterruptedException(e); throw Exceptions.parseException(e); } }

Target:
public void openCore(DataSetProcessor dsp) throws StandardException{ try { if (LOG.isTraceEnabled()) LOG.trace(String.format("openCore %s", this)); isOpen = true; String sql = activation.getPreparedStatement().getSource(); if (!(this instanceof ExplainOperation || activation.isMaterialized())) activation.materialize(); long txnId=getCurrentTransaction().getTxnId(); sql=sql==null?this.toString():sql; String userId=activation.getLanguageConnectionContext().getCurrentUserId(activation); activation.getLanguageConnectionContext().setControlExecutionLimiter(EngineDriver.driver().processorFactory().getControlExecutionLimiter(activation)); returnedRows = false; if (dsp.getType() == DataSetProcessor.Type.SPARK) { this.jobName = userId + " <" + txnId + ">"; dsp.setJobGroup(jobName, sql); } dsp.clearBroadcastedOperation(); this.execRowIterator =getDataSet(dsp).toLocalIterator(); } catch (ResubmitDistributedException e) { resubmitDistributed(e); }catch(Exception e){ checkInterruptedException(e); throw Exceptions.parseException(e); } }
Source:
public static Jenkins getInstance() { Jenkins instance = HOLDER.getInstance(); if (instance == null) { IllegalStateException ise = new IllegalStateException("Jenkins has not been started, or was already shut down"); if (Boolean.getBoolean(Jenkins.class.getName() + ".disableExceptionOnNullInstance")) { LOGGER.log(Level.WARNING, "Perhaps you meant to use Jenkins.getInstanceOrNull?", ise); } else { throw ise; } } return instance; }

Target:
public static Jenkins getInstance() { Jenkins instance = HOLDER.getInstance(); if (instance == null) { IllegalStateException ise = new IllegalStateException("Jenkins has not been started, or was already shut down"); if (Boolean.getBoolean(Jenkins.class.getName() + ".disableExceptionOnNullInstance")) { LOGGER.log(Level.WARNING, "Use Jenkins.getInstanceOrNull if potentially running just before startup, or in asynchronous code just before shutdown; use JenkinsJVM.isJenkinsJVM if potentially running in an agent JVM.", ise); } else { throw ise; } } return instance; }
Source:
private void confirmSSLCertificateDialog(Shell shell) { try { DefaultShell certificateDialog = new DefaultShell(shell); certificateDialog.setFocus(); log.info("SSL Certificate Dialog appeared during " + getLabel().getState().toString()); new PushButton(certificateDialog, "Yes").click(); new WaitWhile(new ShellIsAvailable(certificateDialog)); setCertificateAccepted(true); } catch (WaitTimeoutExpiredException ex) { String message ="WaitTimeoutExpiredException occured when handling Certificate dialog. " + "Dialog has not been shown"; log.error(message); throw new CDKServerException(message, ex); } }

Target:
private void confirmSSLCertificateDialog(Shell shell) { try { DefaultShell certificateDialog = new DefaultShell(shell); certificateDialog.setFocus(); log.info("SSL Certificate Dialog appeared during " + getLabel().getState().toString()); new PushButton(certificateDialog, CDKLabel.Buttons.YES).click(); new WaitWhile(new ShellIsAvailable(certificateDialog)); setCertificateAccepted(true); } catch (WaitTimeoutExpiredException ex) { String message ="WaitTimeoutExpiredException occured when handling Certificate dialog. " + "Dialog has not been shown"; log.error(message); throw new CDKServerException(message, ex); } }
Source:
public static Observable<Boolean> observeInternetConnectivity() { return observeInternetConnectivity(DEFAULT_PING_INTERVAL_IN_MS, DEFAULT_PING_INTERVAL_IN_MS, DEFAULT_PING_HOST, DEFAULT_PING_PORT, DEFAULT_PING_TIMEOUT_IN_MS); }

Target:
public static Observable<Boolean> observeInternetConnectivity() { return observeInternetConnectivity(DEFAULT_INITIAL_PING_INTERVAL_IN_MS, DEFAULT_PING_INTERVAL_IN_MS, DEFAULT_PING_HOST, DEFAULT_PING_PORT, DEFAULT_PING_TIMEOUT_IN_MS); }
Source:
private String assembleInfo(final AppInfo appInfo, final ServiceInfo serviceInfo) { final Integer instanceNo = appInfo.getInstanceNumber(); final String instance = instanceNo != null ? String.format("instance-%s", instanceNo) : null; return Stream.of( serviceInfo.getName(), appInfo.getBuildTag(), instance, appInfo.getTaskHost() ) .filter(Objects::nonNull) .collect(Collectors.joining("/")); }

Target:
private Map<String, String> assembleInfo(final AppInfo appInfo, final ServiceInfo serviceInfo) { final ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); builder.put(named("Service-Name"), serviceInfo.getName()); if (appInfo.getBuildTag() != null) { builder.put(named("Build-Tag"), appInfo.getBuildTag()); } final Integer instanceNo = appInfo.getInstanceNumber(); if (instanceNo != null) { builder.put(named("Instance-No"), instanceNo.toString()); } if (appInfo.getTaskHost() != null) { builder.put(named("Task-Host"), appInfo.getTaskHost()); } return builder.build(); }
Source:
public void supportForConcurrentUseOfChildThreads() throws Exception { final int threads = 20; final Allure lifecycle = Allure.LIFECYCLE; String suiteUid = UUID.randomUUID().toString(); fireTestSuiteStart(suiteUid); fireTestCaseStart(suiteUid); ExecutorService service = Executors.newFixedThreadPool(threads); final List<Callable<Object>> tasks = new ArrayList<>(); for (int i = 0; i < threads; i++) { tasks.add(new Callable<Object>() { @Override public Object call() throws Exception { for (int i = 0; i < 1000; i++) { lifecycle.fire(new StepStartedEvent("test-step")); lifecycle.fire(new StepFinishedEvent()); } return ""; } }); } List<Future<Object>> futures = service.invokeAll(tasks); for (Future<Object> future : futures) { future.get(); } assertThat(lifecycle.getStepStorage().pollLast().getSteps(), hasSize(20000)); }

Target:
public void supportForConcurrentUseOfChildThreads() throws Exception { final int threads = 20; final int stepsCount = 1000; final Allure lifecycle = Allure.LIFECYCLE; String suiteUid = UUID.randomUUID().toString(); fireTestSuiteStart(suiteUid); fireTestCaseStart(suiteUid); ExecutorService service = Executors.newFixedThreadPool(threads); final List<Callable<Object>> tasks = new ArrayList<>(); for (int i = 0; i < threads; i++) { tasks.add(new Callable<Object>() { @Override public Object call() throws Exception { for (int i = 0; i < stepsCount; i++) { lifecycle.fire(new StepStartedEvent("test-step")); lifecycle.fire(new StepFinishedEvent()); } return ""; } }); } List<Future<Object>> futures = service.invokeAll(tasks); for (Future<Object> future : futures) { future.get(); } assertThat(lifecycle.getStepStorage().pollLast().getSteps(), hasSize(threads * stepsCount)); }
Source:
VersionedApiResource(String prefix, String version, String name){ if(version.contains(FWD_SLASH)) { int last = version.lastIndexOf(FWD_SLASH); this.apiGroupName = version.substring(0, last); version = version.substring(last + 1); } this.prefix = prefix; this.name = name; this.version = version; this.namespaced = false; }

Target:
VersionedApiResource(String prefix, String version, String name){ if(version == null) throw new IllegalArgumentException("version can not be null when creating a VersionedApiResource "); if(version.contains(FWD_SLASH)) { int last = version.lastIndexOf(FWD_SLASH); this.apiGroupName = version.substring(0, last); version = version.substring(last + 1); } this.prefix = prefix; this.name = name; this.version = version; this.namespaced = false; }
Source:
private boolean acquireLockAndWait() { if (context.getParentLock() != null) { final EngineLock requiredLock = buildLock(); return context.getParentLock().covers(requiredLock, getLockProperties().getScope()); } if (context.getLock() == null) { Map<String, Pair<String, String>> exclusiveLocks = getExclusiveLocks(); if (exclusiveLocks != null) { EngineLock lock = new EngineLock(exclusiveLocks, null); log.info("Before acquiring and wait lock '{}'", lock); getLockManager().acquireLockWait(lock); context.withLock(lock); log.info("Lock-wait acquired to object '{}'", lock); } } return true; }

Target:
private boolean acquireLockAndWait() { if (context.getParentLock() != null) { return context.getParentLock().covers(buildLock(), getLockProperties().getScope()); } if (context.getLock() == null) { Map<String, Pair<String, String>> exclusiveLocks = getExclusiveLocks(); if (exclusiveLocks != null) { EngineLock lock = new EngineLock(exclusiveLocks, null); log.info("Before acquiring and wait lock '{}'", lock); getLockManager().acquireLockWait(lock); context.withLock(lock); log.info("Lock-wait acquired to object '{}'", lock); } } return true; }
Source:
public int roomForItem(ItemIdentifier itemIdent, int count) { int room = 0; for (int i = 0; i < _drawer.getDrawerCount(); i++) { if (!_drawer.isDrawerEnabled(i)) continue; IDrawer drawer = _drawer.getDrawer(i); if (drawer == null) continue; ItemStack protoStack = itemIdent.makeNormalStack(1); if (drawer.canItemBeStored(protoStack)) { if (drawer.isEmpty()) { room += drawer.getMaxCapacity(protoStack); } else { room += drawer.getRemainingCapacity(); } } } return room; }

Target:
public int roomForItem(ItemIdentifier itemIdent, int count) { int room = 0; for (int i = 0; i < _drawer.getDrawerCount(); i++) { if (!_drawer.isDrawerEnabled(i)) continue; IDrawer drawer = _drawer.getDrawer(i); if (drawer == null) continue; ItemStack protoStack = itemIdent.makeNormalStack(1); if (drawer.canItemBeStored(protoStack)) { if (drawer.isEmpty()) { room += drawer.getMaxCapacity(protoStack); } else { room += drawer.getRemainingCapacity(); } } if (count != 0 && room >= count) return count; } return room; }
Source:
public static String makeGenericExceptionMessage(String operation, String projectId, String tableName) { return String.format( "Failed to perform operation. Operation='%s', projectId='%s', tableName='%s'", operation, projectId, tableName); }

Target:
static String makeGenericExceptionMessage(String operation, String projectId, String tableName) { return String.format( "Failed to perform operation. Operation='%s', projectId='%s', tableName='%s'", operation, projectId, tableName); }
Source:
public void testQuotingForSubSectionNames() { Config config = new Config(); config.setString("testsection", "testsubsection", "testname", "testvalue"); assertTrue(config.toText().contains("\"testsubsection\"")); config.clear(); config.setString("testsection", "#quotable", "testname", "testvalue"); assertTrue(config.toText().contains("\"#quotable\"")); assertFalse(config.toText().contains("\"\"#quotable\"\"")); config.clear(); config.setString("testsection", "with\"quote", "testname", "testvalue"); assertTrue(config.toText().contains("\"with\\\"quote\"")); assertFalse(config.toText().contains("\"\"with\\\"quote\"\"")); }

Target:
public void testQuotingForSubSectionNames() { String resultPattern = "[testsection \"{0}\"]\n\ttestname = testvalue\n"; String result; Config config = new Config(); config.setString("testsection", "testsubsection", "testname", "testvalue"); result = MessageFormat.format(resultPattern, "testsubsection"); assertEquals(result, config.toText()); config.clear(); config.setString("testsection", "#quotable", "testname", "testvalue"); result = MessageFormat.format(resultPattern, "#quotable"); assertEquals(result, config.toText()); config.clear(); config.setString("testsection", "with\"quote", "testname", "testvalue"); result = MessageFormat.format(resultPattern, "with\\\"quote"); assertEquals(result, config.toText()); }
Source:
private List<NameValuePair> createParamList() { Annotation[][] parameterAnnotations = javaMethod.getParameterAnnotations(); int count = parameterAnnotations.length - 1; List<NameValuePair> params = new ArrayList<NameValuePair>(count); QueryParams queryParams = javaMethod.getAnnotation(QueryParams.class); if (queryParams != null) { QueryParam[] annotations = queryParams.value(); for (QueryParam annotation : annotations) { params.add(addPair(annotation)); } } QueryParam queryParam = javaMethod.getAnnotation(QueryParam.class); if (queryParam != null) { params.add(addPair(queryParam)); } for (int i = 0; i < count; i++) { Object arg = args[i]; if (arg == null) continue; String name = RestAdapter.getName(parameterAnnotations[i], javaMethod, i); params.add(new BasicNameValuePair(name, String.valueOf(arg))); } return params; }

Target:
private List<NameValuePair> createParamList() { Annotation[][] parameterAnnotations = javaMethod.getParameterAnnotations(); int count = parameterAnnotations.length - 1; List<NameValuePair> params = new ArrayList<NameValuePair>(count); QueryParams queryParams = javaMethod.getAnnotation(QueryParams.class); if (queryParams != null) { QueryParam[] annotations = queryParams.value(); for (QueryParam annotation : annotations) { params.add(addPair(annotation)); } } QueryParam queryParam = javaMethod.getAnnotation(QueryParam.class); if (queryParam != null) { params.add(addPair(queryParam)); } for (int i = 0; i < count; i++) { Object arg = args[i]; if (arg == null) continue; String name = getName(parameterAnnotations[i], javaMethod, i); params.add(new BasicNameValuePair(name, String.valueOf(arg))); } return params; }
Source:
public void updateFromPageChanged(PageChangedEvent event) { IPage page = event.getPage(); if (!PageChangedEvent.EVENT_TYPE_SET_PAGE_OFFLINE.equals(event.getEventType()) && !PageChangedEvent.EVENT_TYPE_SET_PAGE_ONLINE.equals(event.getEventType())) { return; } try { if (event.getSource().equals(ApsEvent.LOCAL_EVENT)) { this.deleteMapping(page.getCode(), null); if (null != this.getPageManager().getOnlinePage(page.getCode())) { this.updatePageMapping(page); } } SeoChangedEvent seoEvent = new SeoChangedEvent(); seoEvent.setOperationCode(SeoChangedEvent.PAGE_CHANGED_EVENT); this.notifyEvent(seoEvent); this.getCacheWrapper().initCache(this.getSeoMappingDAO()); } catch (Throwable t) { _logger.error("Error updating mapping from page changed", t); } }

Target:
public void updateFromPageChanged(PageChangedEvent event) { IPage page = event.getPage(); if (!PageChangedEvent.EVENT_TYPE_SET_PAGE_OFFLINE.equals(event.getEventType()) && !PageChangedEvent.EVENT_TYPE_SET_PAGE_ONLINE.equals(event.getEventType())) { return; } if (!(page.getMetadata() instanceof SeoPageMetadata)) { return; } try { this.getSeoMappingDAO().deleteMappingForPage(page.getCode()); SeoPageMetadata seoMetadata = (SeoPageMetadata) page.getMetadata(); String friendlyCode = seoMetadata.getFriendlyCode(); if (!StringUtils.isEmpty(friendlyCode)) { FriendlyCodeVO vo = new FriendlyCodeVO(seoMetadata.getFriendlyCode(), page.getCode()); this.getSeoMappingDAO().updateMapping(vo); } SeoChangedEvent seoEvent = new SeoChangedEvent(); seoEvent.setOperationCode(SeoChangedEvent.PAGE_CHANGED_EVENT); this.notifyEvent(seoEvent); this.getCacheWrapper().initCache(this.getSeoMappingDAO()); } catch (Throwable t) { logger.error("Error updating mapping from page changed", t); } }
Source:
public <E> CompletableFuture<RemoteTraversal<?, E>> submitAsync(final Bytecode bytecode) throws RemoteConnectionException { try { final Iterator<OptionsStrategy> itty = IteratorUtils.map( IteratorUtils.filter(bytecode.getSourceInstructions().iterator(), s -> s.getOperator().equals(TraversalSource.Symbols.withStrategies) && s.getArguments()[0] instanceof OptionsStrategy), os -> (OptionsStrategy) os.getArguments()[0]); final RequestOptions.Builder builder = RequestOptions.build(); while (itty.hasNext()) { final OptionsStrategy optionsStrategy = itty.next(); if (optionsStrategy.getOptions().containsKey(PER_REQUEST_TIMEOUT)) builder.timeout((long) optionsStrategy.getOptions().get(PER_REQUEST_TIMEOUT)); else if (optionsStrategy.getOptions().containsKey(PER_REQUEST_BATCH_SIZE)) builder.batchSize((int) optionsStrategy.getOptions().get(PER_REQUEST_BATCH_SIZE)); } return client.submitAsync(bytecode, builder.create()).thenApply(rs -> new DriverRemoteTraversal<>(rs, client, attachElements, conf)); } catch (Exception ex) { throw new RemoteConnectionException(ex); } }

Target:
public <E> CompletableFuture<RemoteTraversal<?, E>> submitAsync(final Bytecode bytecode) throws RemoteConnectionException { try { return client.submitAsync(bytecode, getRequestOptions(bytecode)).thenApply(rs -> new DriverRemoteTraversal<>(rs, client, attachElements, conf)); } catch (Exception ex) { throw new RemoteConnectionException(ex); } }
Source:
public String getServerStatuses() { JSONObject root = new JSONObject(); JSONArray array = new JSONArray(); JSONObject obj; for (GerritServer server : PluginImpl.getInstance().getServers()) { String status; if (server.isPseudoMode()) { status = "na"; } else { if (server.isConnected()) { status ="up"; } else { status ="down"; } } obj = new JSONObject(); obj.put("name", server.getName()); obj.put("frontEndUrl", server.getConfig().getGerritFrontEndUrl()); obj.put("serverUrl", server.getUrlName()); obj.put("version", server.getGerritVersion()); obj.put("status", status); array.add(obj); } root.put("servers", array); return root.toString(); }

Target:
public JSONObject getServerStatuses() { JSONObject root = new JSONObject(); JSONArray array = new JSONArray(); JSONObject obj; for (GerritServer server : PluginImpl.getInstance().getServers()) { String status; if (server.isPseudoMode()) { status = "na"; } else { if (server.isConnected()) { status = "up"; } else { status = "down"; } } obj = new JSONObject(); obj.put("name", server.getName()); obj.put("frontEndUrl", server.getConfig().getGerritFrontEndUrl()); obj.put("serverUrl", server.getUrlName()); obj.put("version", server.getGerritVersion()); obj.put("status", status); obj.put("hasErrors", server.hasErrors()); obj.put("hasWarnings", server.hasWarnings()); array.add(obj); } root.put("servers", array); return root; }
Source:
public String getName() { if (alias != null ) { String key = "role." + alias.toLowerCase() +".name"; return BundleUtil.getStringFromPropertyFile(key,"BuiltInRoles" ); } else { return name; } }

Target:
public String getName() { if (alias != null ) { String key = "role." + alias.toLowerCase() +".name"; String _name = BundleUtil.getStringFromPropertyFile(key,"BuiltInRoles" ); if(_name == null) { return name; } else { return _name; } } else { return name; } }
Source:
List<IResultsEditorTab> getTabs() throws OseeCoreException { if (tabs == null) { tabs = getResultsEditorProvider().getResultsEditorTabs(); } return tabs; }

Target:
List<IResultsEditorTab> getTabs() throws OseeCoreException { if (tabs == null) { tabs = getResultsEditorProvider().getResultsEditorTabs(); if (tabs == null || tabs.isEmpty()) { tabs.add(new ResultsEditorHtmlTab( "Error", "Error", AHTML.simplePage("Error: No tabs were defined for \"" + getResultsEditorProvider().getEditorName() + "\""))); } } return tabs; }
Source:
public final void testIncorrectName() throws HaskellTypeError { new Ident("id").analyze(new Env(), new GenSet()); assertTrue("Invalid state reached: exception not raised.", false); }

Target:
public final void testIncorrectName() throws HaskellTypeError { new Ident("id").analyze(new Env(), new GenSet()); }
Source:
public void testRemoveSeenCorrectly2() throws Throwable { Object k = getKey(); cache(0).put(k, "v"); tm(0).begin(); cache(0).remove(k); assertNull(cache(0).get(k)); tm(0).rollback(); assertEquals(cache(0).get(k), "v"); }

Target:
public void testRemoveSeenCorrectly2() throws Throwable { Object k = getKey(); cache(0).put(k, "v"); tm(0).begin(); cache(0).remove(k); assertNull(cache(0).get(k)); tm(0).rollback(); assertEquals("v", cache(0).get(k)); }
Source:
public final Response toResponse(T exception) { String errorId = UUID.randomUUID().toString(); StatusType status = this.getStatus(exception); if (status.getFamily().equals(Response.Status.Family.CLIENT_ERROR)) { log.info("Error handling request {}", SafeArg.of("errorId", errorId), exception); } else { log.error("Error handling request {}", SafeArg.of("errorId", errorId), exception); } ResponseBuilder builder = Response.status(status); try { SerializableError error = SerializableError.builder() .errorCode(exception.getClass().getName()) .errorName("Refer to the server logs with this errorId: " + errorId) .putParameters("errorId", errorId) .build(); builder.type(MediaType.APPLICATION_JSON); String json = MAPPER.writeValueAsString(error); builder.entity(json); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to translate exception to json for request {}", SafeArg.of("errorId", errorId), e); builder = Response.status(status); builder.type(MediaType.TEXT_PLAIN); builder.entity(Objects.toString(exception.getMessage())); } return builder.build(); }

Target:
public final Response toResponse(T exception) { String errorInstanceId = UUID.randomUUID().toString(); StatusType status = this.getStatus(exception); if (status.getFamily().equals(Response.Status.Family.CLIENT_ERROR)) { log.info("Error handling request {}", SafeArg.of("errorInstanceId", errorInstanceId), exception); } else { log.error("Error handling request {}", SafeArg.of("errorInstanceId", errorInstanceId), exception); } ResponseBuilder builder = Response.status(status); try { SerializableError error = SerializableError.builder() .errorCode(exception.getClass().getName()) .errorName("Refer to the server logs with this errorInstanceId: " + errorInstanceId) .errorInstanceId(errorInstanceId) .build(); builder.type(MediaType.APPLICATION_JSON); String json = MAPPER.writeValueAsString(error); builder.entity(json); } catch (RuntimeException | JsonProcessingException e) { log.warn("Unable to translate exception to json for request {}", SafeArg.of("errorInstanceId", errorInstanceId), e); builder = Response.status(status); builder.type(MediaType.TEXT_PLAIN); builder.entity("Unable to translate exception to json. Refer to the server logs with this errorInstanceId: " + errorInstanceId); } return builder.build(); }
Source:
public void clearLeadingMasterMetrics() throws IOException { FileSystemTestUtils.createByteFile(mLocalAlluxioCluster.getClient(), "/file", WritePType.MUST_CACHE, 10); int errCode = mFsAdminShell.run("report", "metrics"); assertEquals("", mErrOutput.toString()); assertEquals(0, errCode); assertThat(mOutput.toString(), CoreMatchers.containsString( "Create File Operations 1")); errCode = mFsAdminShell.run("metrics", "clear"); assertEquals("", mErrOutput.toString()); assertEquals(0, errCode); mOutput.reset(); errCode = mFsAdminShell.run("report", "metrics"); assertEquals("", mErrOutput.toString()); assertEquals(0, errCode); assertThat(mOutput.toString(), CoreMatchers.containsString( "Create File Operations 0")); }

Target:
public void clearLeadingMasterMetrics() throws IOException { FileSystemTestUtils.createByteFile(mLocalAlluxioCluster.getClient(), "/file", WritePType.MUST_CACHE, 10); int errCode = mFsAdminShell.run("report", "metrics"); assertEquals("", mErrOutput.toString()); assertEquals(0, errCode); assertThat(mOutput.toString(), CoreMatchers.containsString( "Create File Operations 1")); errCode = mFsAdminShell.run("metrics", "clear", "--master"); assertEquals("", mErrOutput.toString()); assertEquals(0, errCode); mOutput.reset(); errCode = mFsAdminShell.run("report", "metrics"); assertEquals("", mErrOutput.toString()); assertEquals(0, errCode); assertThat(mOutput.toString(), CoreMatchers.containsString( "Create File Operations 0")); }
Source:
public void authenticateWithFailedProvider() throws SecurityException, SecurityProviderNotFoundException { when(provider.authenticate(authentication)).thenThrow(SecurityException.class); manager.addProvider(provider); expected.expect(SecurityException.class); manager.authenticate(authentication); verify(provider).authenticate(authentication); }

Target:
public void authenticateWithFailedProvider() throws SecurityException, SecurityProviderNotFoundException { when(provider.authenticate(authentication)).thenThrow(SecurityException.class); manager.addProvider(provider); expected.expect(SecurityException.class); try { manager.authenticate(authentication); } finally { verify(provider).authenticate(authentication); } }
Source:
private void parseZCallThresholds() { final String notApplicable = "NA"; try (Stream<String> stream = Files.lines(ZCALL_THRESHOLDS_FILE.toPath())) { stream.forEach(line -> { final String[] tokens = line.split("\t"); if ((!tokens[1].equals(notApplicable)) && (!tokens[2].equals(notApplicable))) { zCallThresholds.put(tokens[0], new String[]{tokens[1], tokens[2]}); } else { zCallThresholds.put(tokens[0], new String[]{DOT, DOT}); } }); } catch (IOException e) { throw new PicardException("Error parsing ZCall Thresholds File", e); } }

Target:
private void parseZCallThresholds() { final String notApplicable = "NA"; try (Stream<String> stream = Files.lines(ZCALL_THRESHOLDS_FILE.toPath())) { stream.forEach(line -> { final String[] tokens = line.split("\t"); if (tokens[1].equals(notApplicable) || tokens[2].equals(notApplicable)) { if (!tokens[1].equals(notApplicable) || !tokens[2].equals(notApplicable)) { throw new PicardException("Thresholds should either both exist or both not exist."); } zCallThresholds.put(tokens[0], new String[]{MISSING_VALUE_v4, MISSING_VALUE_v4}); } else { zCallThresholds.put(tokens[0], new String[]{tokens[1], tokens[2]}); } }); } catch (IOException e) { throw new PicardException("Error parsing ZCall Thresholds File", e); } }
Source:
public synchronized RequestFuture<Void> maybeLeaveGroup(String leaveReason) { RequestFuture<Void> future = null; if (isDynamicMember() && !coordinatorUnknown() && state != MemberState.UNJOINED && generation.hasMemberId()) { log.info("Member sending LeaveGroup request to coordinator due to {}", generation.memberId, coordinator, leaveReason); LeaveGroupRequest.Builder request = new LeaveGroupRequest.Builder( rebalanceConfig.groupId, Collections.singletonList(new MemberIdentity() .setMemberId(generation.memberId)) ); future = client.send(coordinator, request) .compose(new LeaveGroupResponseHandler()); client.pollNoWakeup(); } resetGeneration("consumer proactively leaving group", false); return future; }

Target:
public synchronized RequestFuture<Void> maybeLeaveGroup(String leaveReason) { RequestFuture<Void> future = null; if (isDynamicMember() && !coordinatorUnknown() && state != MemberState.UNJOINED && generation.hasMemberId()) { log.info("Member sending LeaveGroup request to coordinator due to {}", generation.memberId, coordinator, leaveReason); LeaveGroupRequest.Builder request = new LeaveGroupRequest.Builder( rebalanceConfig.groupId, Collections.singletonList(new MemberIdentity().setMemberId(generation.memberId)) ); future = client.send(coordinator, request).compose(new LeaveGroupResponseHandler()); client.pollNoWakeup(); } resetGenerationOnLeaveGroup(); return future; }
Source:
private void handleAlwaysOnNetworkRequest( NetworkRequest networkRequest, String settingName, int defaultValue) { final boolean enable = (Settings.Global.getInt( mContext.getContentResolver(), settingName, defaultValue) == 1); final boolean isEnabled = (mNetworkRequests.get(networkRequest) != null); if (enable == isEnabled) { return; } if (enable) { handleRegisterNetworkRequest(new NetworkRequestInfo( null, networkRequest, new Binder())); } else { handleReleaseNetworkRequest(networkRequest, Process.SYSTEM_UID); } }

Target:
private void handleAlwaysOnNetworkRequest( NetworkRequest networkRequest, String settingName, int defaultValue) { final boolean enable = toBool(Settings.Global.getInt( mContext.getContentResolver(), settingName, encodeBool(defaultValue))); final boolean isEnabled = (mNetworkRequests.get(networkRequest) != null); if (enable == isEnabled) { return; } if (enable) { handleRegisterNetworkRequest(new NetworkRequestInfo( null, networkRequest, new Binder())); } else { handleReleaseNetworkRequest(networkRequest, Process.SYSTEM_UID); } }
Source:
public void testMainDownloadWithNonExistentOutDir() throws Exception { val file = tmp.newFile(); val outDir = new File("/tmp/foo"); executeMain("download", "--manifest", file.getCanonicalPath(), "--output-dir", outDir.getCanonicalPath(), "--verify-connection", "false"); assertTrue(outDir.exists()); outDir.delete(); assertTrue(getExitCode() == 1); assertTrue(getOutput().contains(" is empty")); }

Target:
public void testMainDownloadWithNonExistentOutDir() throws Exception { val file = tmp.newFile(); val outDir = new File(tmp.getRoot(), "foo"); assertFalse(outDir.exists()); executeMain("download", "--manifest", file.getCanonicalPath(), "--output-dir", outDir.getCanonicalPath(), "--verify-connection", "false"); assertTrue(outDir.exists()); assertTrue(getExitCode() == 1); assertTrue(getOutput().contains(" is empty")); }
Source:
public synchronized long commit() { Thread currentThread = Thread.currentThread(); Thread storeThread = currentStoreThread.get(); if (currentThread != storeThread) { currentStoreThread.set(currentThread); try { store(); } finally { currentStoreThread.set(storeThread); } } return currentVersion; }

Target:
public long commit() { if(!storeLock.isHeldByCurrentThread() || currentStoreVersion < 0) { storeLock.lock(); try { store(); } finally { storeLock.unlock(); } } return currentVersion; }
Source:
public void addTask(TaskType type, long delay, Object object){ try { if (AppConfig.getInstance().isJsonEvents()){ new JsonRpcNotification().fireEvents(type, delay, object); }else{ TaskProcessor.getInstance().addTask(new TaskRequest(type, delay, object)); } }catch (Exception e){ log.error("wrapping task error {}", e.toString()); } }

Target:
public void addTask(TaskType type, long delay, Object object){ try { if (AppConfig.getInstance().isJsonEvents()){ new JsonRpcNotification().fireEvents(type, delay, object); }else{ TaskProcessor.getInstance().addTask(new TaskRequest(type, delay, object)); } }catch (Exception e){ log.error("wrapping task error {}", e.toString()); log.error("{}", Arrays.toString(e.getStackTrace())); } }
Source:
private boolean canGenerateTree(EntityRef rootEntity) { LogComponent logComponent = rootEntity.getComponent(LogComponent.class); RootComponent rootComponent = rootEntity.getComponent(RootComponent.class); TreeGrowthStage currentStage = rootComponent.growthStages.get(rootComponent.growthStage); Vector3i location = new Vector3i(logComponent.location).addY(1); int rootY = location.y; for(; location.y-rootY < currentStage.height-1; location.addY(1)) { if(!isValidBlock(location, rootEntity)) { return false; } } return true; }

Target:
private boolean canGenerateTree(EntityRef rootEntity) { LogComponent logComponent = rootEntity.getComponent(LogComponent.class); RootComponent rootComponent = rootEntity.getComponent(RootComponent.class); TreeGrowthStage currentStage = rootComponent.growthStages.get(rootComponent.growthStage); Vector3i location = new Vector3i(logComponent.location).addY(1); int rootY = location.y; while(location.y-rootY < currentStage.height-1) { if(!isValidBlock(location, rootEntity)) { return false; } location.addY(1); } return true; }
Source:
public void resourceChanged(IResourceChangeEvent event) { if (event.getType() == IResourceChangeEvent.POST_CHANGE) { state = true; } }

Target:
public void resourceChanged(IResourceChangeEvent event) { if (event.getType() == IResourceChangeEvent.POST_CHANGE) state = true; }
Source:
public void setContent(final String path, final String value) { try { diagramServices.transform(value, new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram diagram) { AbstractDMNDiagramEditor.this.open(diagram); } @Override public void onError(final ClientRuntimeError error) { AbstractDMNDiagramEditor.this.getEditor().onLoadError(error); } }); } catch (Exception e) { getEditor().showError(e.getMessage()); } }

Target:
public void setContent(final String path, final String value) { superOnClose(); diagramServices.transform(path, value, new ServiceCallback<Diagram>() { @Override public void onSuccess(final Diagram diagram) { openDiagramMethodProxy = VALID_DIAGRAM_PROXY; AbstractDMNDiagramEditor.this.open(diagram); } @Override public void onError(final ClientRuntimeError error) { openDiagramMethodProxy = INVALID_DIAGRAM_PROXY; AbstractDMNDiagramEditor.this.getEditor().onLoadError(error); } }); }
Source:
private void executeNextOperation() { switch (getParameters().getVmBackup().getPhase()) { case STARTING: lockDisks(); VmBackupInfo vmBackupInfo = startVmBackup(); if (vmBackupInfo != null && vmBackupInfo.getDisks() != null) { TransactionSupport.executeInNewTransaction(() -> { if (vmBackupInfo.getCheckpoint() != null) { vmCheckpointDao.updateCheckpointXml(getParameters().getVmBackup().getToCheckpointId(), vmBackupInfo.getCheckpoint()); } return null; }); storeBackupsUrls(vmBackupInfo.getDisks()); } else { setCommandStatus(CommandStatus.FAILED); } break; case READY: log.info("Ready to start image transfers using backup URLs"); break; case FINALIZING: finalizeVmBackup(); setCommandStatus(CommandStatus.SUCCEEDED); break; } }

Target:
private void executeNextOperation() { switch (getParameters().getVmBackup().getPhase()) { case STARTING: lockDisks(); VmBackupInfo vmBackupInfo = startVmBackup(); if (vmBackupInfo != null && vmBackupInfo.getDisks() != null) { if (vmBackupInfo.getCheckpoint() != null) { vmCheckpointDao.updateCheckpointXml(getParameters().getVmBackup().getToCheckpointId(), vmBackupInfo.getCheckpoint()); } storeBackupsUrls(vmBackupInfo.getDisks()); } else { setCommandStatus(CommandStatus.FAILED); } break; case READY: log.info("Ready to start image transfers using backup URLs"); break; case FINALIZING: finalizeVmBackup(); setCommandStatus(CommandStatus.SUCCEEDED); break; } }
Source:
public void withKeyScan(String pattern, int count, Consumer<RedisScanResult> f) { CursorBasedResult<String> result = null; do { if (result == null) { result = client.dyno_scan(count, pattern); } else { result = client.dyno_scan(result, count, pattern); } final List<String> results = result.getResult(); f.accept(() -> results); } while (!result.isComplete()); }

Target:
public void withKeyScan(String pattern, int count, Consumer<RedisScanResult> f) { CursorBasedResult<String> result = null; do { result = client.dyno_scan(result, count, pattern); final List<String> results = result.getResult(); f.accept(() -> results); } while (!result.isComplete()); }
Source:
private void packSmallString(String s) throws IOException { byte[] bytes = s.getBytes("UTF-8"); packRawStringHeader(bytes.length); writePayload(bytes); }

Target:
private void packSmallString(String s) throws IOException { byte[] bytes = s.getBytes(MessagePack.UTF8); packRawStringHeader(bytes.length); writePayload(bytes); }
Source:
public String toString() { String content = ""; for (Term term : contents) if (term != null) content += term + ",,"; if (content.length() > 1) content = content.substring(0, content.length() - 2); return "'amb(" + content + ")"; }

Target:
public String toString() { String content = ""; for (Term term : contents) if (term != null) content += term + ","; if (content.length() > 1) content = content.substring(0, content.length() - 1); return "'amb(" + content + ")"; }
Source:
private void findNewContact(BitBody body) { BitPoint startCell = body.aabb.xy.floorDivideBy(tileSize, tileSize).minus(gridOffset); int endX = (int) (startCell.x + Math.ceil(1.0 * body.aabb.width / tileSize)); int endY = (int) (startCell.y + Math.ceil(1.0 * body.aabb.height / tileSize)); for (int x = (int) startCell.x; x <= endX; x++) { if (!occupiedSpaces.containsKey(x)) { continue; } for (int y = (int) startCell.y; y <= endY; y++) { if (!occupiedSpaces.get(x).containsKey(y)) { continue; } for (BitBody otherBody : occupiedSpaces.get(x).get(y)) { BitRectangle insec = GeomUtils.intersection(body.aabb, otherBody.aabb); if (insec != null) { if (!contacts.get(body).contains(otherBody)) { contacts.get(body).add(otherBody); for (ContactListener listener : body.getContactListeners()) { listener.contactStarted(otherBody); } for (ContactListener listener : otherBody.getContactListeners()) { listener.contactStarted(body); } } } } } } }

Target:
private void findNewContact(BitBody body) { BitPoint startCell = body.aabb.xy.floorDivideBy(tileSize, tileSize).minus(gridOffset); int endX = (int) (startCell.x + Math.ceil(1.0 * body.aabb.width / tileSize)); int endY = (int) (startCell.y + Math.ceil(1.0 * body.aabb.height / tileSize)); for (int x = (int) startCell.x; x <= endX; x++) { if (!occupiedSpaces.containsKey(x)) { continue; } for (int y = (int) startCell.y; y <= endY; y++) { if (!occupiedSpaces.get(x).containsKey(y)) { continue; } for (BitBody otherBody : occupiedSpaces.get(x).get(y)) { if (otherBody.bodyType == BodyType.KINETIC) { checkForNewCollision(body, otherBody); } checkContact(body, otherBody); } } } }
Source:
public void setUp() throws Exception { testdir.ensureEmpty(); File testFile = testdir.getPathFile("file.txt").toFile(); try (OutputStream testOut = new BufferedOutputStream(new FileOutputStream(testFile))) { ByteArrayInputStream testIn = new ByteArrayInputStream(__content.getBytes("ISO8859_1")); IO.copy(testIn, testOut); } tester = new ServletTester("/context"); tester.getContext().setResourceBase(testdir.getPath().toString()); tester.getContext().addServlet(org.eclipse.jetty.servlet.DefaultServlet.class, "/"); GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setMinGzipSize(16); tester.getServer().insertHandler(gzipHandler); tester.start(); }

Target:
public void setUp() throws Exception { testdir.ensureEmpty(); File testFile = testdir.getPathFile("file.txt").toFile(); try (OutputStream testOut = new BufferedOutputStream(new FileOutputStream(testFile))) { ByteArrayInputStream testIn = new ByteArrayInputStream(__content.getBytes("ISO8859_1")); IO.copy(testIn, testOut); } tester = new ServletTester("/context"); tester.getContext().setResourceBase(testdir.getPath().toString()); tester.getContext().addServlet(org.eclipse.jetty.servlet.DefaultServlet.class, "/"); GzipHandler gzipHandler = new GzipHandler(); gzipHandler.setMinGzipSize(16); tester.getContext().insertHandler(gzipHandler); tester.start(); }
Source:
public Boolean call() throws NoSuchProjectException, OrmException { final ProjectControl projectControl = projectControlFactory.controlFor(projectName); boolean result = false; if (user.isAdministrator() || projectControl.isOwner()) { result = repoManager.deleteRepository(projectName.get()); for (final RefRight k : db.refRights().byProject(projectName)) { db.refRights().delete(Collections.singleton(k)); } for (final AccountProjectWatch a : db.accountProjectWatches().byProject( projectName)) { db.accountProjectWatches().delete(Collections.singleton(a)); } db.projects().deleteKeys(Collections.singleton(projectName)); replication.replicateProjectDeletion(projectName); projectCache.evictAll(); } if (!result) { log.error("Cannot delete " + projectName.get()); } return new Boolean(result); }

Target:
public Boolean call() throws NoSuchProjectException, OrmException { final ProjectControl projectControl = projectControlFactory.controlFor(projectName); boolean result = false; if (user.isAdministrator() || projectControl.isOwner()) { result = repoManager.deleteRepository(projectName.get()); for (final RefRight k : db.refRights().byProject(projectName)) { db.refRights().delete(Collections.singleton(k)); } for (final AccountProjectWatch a : db.accountProjectWatches().byProject( projectName)) { db.accountProjectWatches().delete(Collections.singleton(a)); } for (final Project j : db.projects().getChildren(projectName.get())) { j.setParent(null); db.projects().update(Collections.singleton(j)); projectCache.evict(j); } db.projects().deleteKeys(Collections.singleton(projectName)); replication.replicateProjectDeletion(projectName); projectCache.evict(projectControl.getProject()); } if (!result) { log.error("Cannot delete " + projectName.get()); } return new Boolean(result); }
Source:
GPUInfo(String index) { this.index = Preconditions.checkNotNull(index); }

Target:
GPUInfo(String index) { Preconditions.checkArgument(!StringUtils.isNullOrWhitespaceOnly(index)); this.index = index; }
Source:
public static String generateSaltOfLength(int length) { StringBuilder salt = new StringBuilder(); Random rnd = new Random(); while (salt.length() < length) { int index = (int) (rnd.nextFloat() * UPPERCASE_ALPHANUMERIC_CHARS.length()); salt.append(UPPERCASE_ALPHANUMERIC_CHARS.charAt(index)); } return salt.toString(); }

Target:
public static String generateSaltOfLength(int length) { StringBuilder salt = new StringBuilder(); Random rnd = new Random(); while (salt.length() < length) { int index = rnd.nextInt(UPPERCASE_ALPHANUMERIC_CHARS.length()); salt.append(UPPERCASE_ALPHANUMERIC_CHARS.charAt(index)); } return salt.toString(); }
Source:
private KeyValue createKeyValue(Namespace namespace, String key, Object value) { KeyValue keyvalue = new KeyValue(); keyvalue.setNamespace(namespace.toString()); keyvalue.setKey(key); keyvalue.setData(SerializationUtils.serialize(value)); keyvalue.setSessionId(namespace.getValues().get(0)); return keyvalue; }

Target:
private KeyValue createKeyValue(Namespace namespace, String key, Object value) { KeyValue keyvalue = new KeyValue(); keyvalue.setNamespace(namespace.toString()); keyvalue.setKey(key); keyvalue.setData(SerializationUtils.serialize(value)); keyvalue.setSessionId(sessionIdProvider.getSessionId()); return keyvalue; }
Source:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletResponse r = (HttpServletResponse) response; responses.set(r); chain.doFilter(request, response); responses.remove(); }

Target:
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { try { HttpServletResponse r = (HttpServletResponse) response; responses.set(r); chain.doFilter(request, response); } finally { responses.remove(); } }
Source:
public InferredType type() { if (is(Kind.AND, Kind.OR)) { return InferredTypes.or(leftOperand.type(), rightOperand.type()); } if (is(Kind.PLUS)) { if (leftOperand.type() == INT && rightOperand.type() == INT) { return INT; } if (leftOperand.type() == STR && rightOperand.type() == STR) { return STR; } } return InferredTypes.anyType(); }

Target:
public InferredType type() { if (is(Kind.AND, Kind.OR)) { return InferredTypes.or(leftOperand.type(), rightOperand.type()); } if (is(Kind.PLUS)) { if (leftOperand.type().equals(INT) && rightOperand.type().equals(INT)) { return INT; } if (leftOperand.type().equals(STR) && rightOperand.type().equals(STR)) { return STR; } } return InferredTypes.anyType(); }