auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { if (syntaxNode.is(Tree.Kind.DIVIDE_ASSIGNMENT, Tree.Kind.DIVIDE, Tree.Kind.REMAINDER_ASSIGNMENT, Tree.Kind.REMAINDER)) { ExpressionTree denominator; SymbolicValue denominatorSV; ProgramState programState = context.getState(); List<SymbolicValue> symbolicValues = programState.peekValues(2); if (syntaxNode.is(Tree.Kind.REMAINDER_ASSIGNMENT, Tree.Kind.DIVIDE_ASSIGNMENT)) { denominator = ((AssignmentExpressionTree) syntaxNode).expression(); denominatorSV = symbolicValues.get(1); } else { denominator = ((BinaryExpressionTree) syntaxNode).rightOperand(); denominatorSV = symbolicValues.get(0); } if (isZero(programState, denominatorSV)) { String operation = syntaxNode.is(Tree.Kind.REMAINDER, Tree.Kind.REMAINDER_ASSIGNMENT) ? "modulation" : "division"; String denominatorName = "this expression"; if (denominator.is(Tree.Kind.IDENTIFIER)) { denominatorName = "'" + ((IdentifierTree) denominator).name() + "'"; } context.reportIssue(denominator, this, "Make sure " + denominatorName + " can't be zero before doing this " + operation + "."); return null; } } PreStatementVisitor visitor = new PreStatementVisitor(context); syntaxNode.accept(visitor); return visitor.programState; }

Target:
public ProgramState checkPreStatement(CheckerContext context, Tree syntaxNode) { PreStatementVisitor visitor = new PreStatementVisitor(context); syntaxNode.accept(visitor); return visitor.programState; }
Source:
public VariantType getType() { if (this.alternate.equals(".")) { return VariantType.NO_ALTERNATE; } if (reference.length() == alternate.length()) { if (getLength() > 1) { return VariantType.MNV; } else { return VariantType.SNV; } } else if (getLength() <= SV_THRESHOLD) { return VariantType.INDEL; } else { return VariantType.SV; } }

Target:
public VariantType getType() { if (this.alternate.equals(".")) { return VariantType.NO_ALTERNATE; } else if (reference.length() == alternate.length()) { if (getLength() > 1) { return VariantType.MNV; } else { return VariantType.SNV; } } else if (getLength() <= SV_THRESHOLD) { return VariantType.INDEL; } else { return VariantType.SV; } }
Source:
public void run() { while (true) { int delay = PqsConfiguration.getReportingInterval(); phoenixGlobalMetricsCollection = PhoenixRuntime.getGlobalPhoenixClientMetrics(); this.pqsSink.writeGlobal(phoenixGlobalMetricsCollection); try { Thread.sleep(delay); } catch (InterruptedException e) { LOG.error(" Sleep thread interrupted for metrics collection "); } } }

Target:
public void run() { boolean run = true; reporter.start(); while (run) { phoenixGlobalMetricsCollection = PhoenixRuntime.getGlobalPhoenixClientMetrics(); this.pqsSink.writeGlobal(phoenixGlobalMetricsCollection); try { Thread.sleep(reportingInterval); } catch (InterruptedException e) { LOG.error(" Sleep thread interrupted for metrics collection. " + "So stopping global metrics collection. ",e); run = false; } } }
Source:
public void testOS() throws Exception { OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer(); adapter.setOptions("-F -n 99999999"); testGuts(adapter, "reader"); }

Target:
public void testOS() throws Exception { OSDelegatingFileTailingMessageProducer adapter = new OSDelegatingFileTailingMessageProducer(); adapter.setOptions(TAIL_OPTIONS_FOLLOW_NAME_MANY_LINES); testGuts(adapter, "reader"); }
Source:
public boolean isAllowed(HttpServletRequest request, Project project) { return checkAll( request, "plugin_framework_project_cache", project, new AuthorizationEntity.PluginDecisionPredicate() { @Override public boolean decision(IAuthorizationPlugin plugin) { return plugin.isAllowed(request, project); } }, new AuthorizationEntity.PluginSkippingPredicate() { @Override public boolean shouldSkip(AuthorizationEntity entity) { if (entity.forProjects().isEmpty() && entity.forGroups().isEmpty()) { return false; } if (entity.forProjects().contains(project.getName())) { return false; } return true; } }); }

Target:
public boolean isAllowed(HttpServletRequest request, Project project) { return checkAll( request, "plugin_framework_project_cache", project, new AuthorizationEntity.PluginDecisionPredicate() { @Override public boolean decision(IAuthorizationPlugin plugin) { return plugin.isAllowed(request, project); } }, new AuthorizationEntity.PluginSkippingPredicate() { @Override public boolean shouldSkip(AuthorizationEntity authEntity) { if (authEntity.forProjects().isEmpty() && authEntity.forGroups().isEmpty()) { return false; } if (authEntity.forProjects().contains(project.getName())) { return false; } return true; } }); }
Source:
public void createTask(String type, Task task) { Log.e("Create a new task", "Called"); if (type.equals(CREATE)) task = new Task(); if (type.equals(COMPLETE)){ task.setComplete(true); createTaskRequest(task, type); return; } if (type.equals(UNCOMPLETE)){ task.setComplete(false); createTaskRequest(task, type); return; } task.setTitle(mTitleField.getText().toString()); task.setDescription(mDescriptionField.getText().toString()); task.setAssignerId(mParentActivity.getUserId()); task.setDueDate(mDate); task.setAssigneeId(mUser.getId()); task.setMiniSiteId(mMiniSite.getId()); task.setComplete(false); Utility.hideKeyboard(mParentActivity, mLayout); createTaskRequest(task, type); }

Target:
public void createTask(String type, Task task) { if (type.equals(CREATE)) task = new Task(); if (type.equals(COMPLETE)){ task.setComplete(true); createTaskRequest(task, type); return; } if (type.equals(UNCOMPLETE)){ task.setComplete(false); createTaskRequest(task, type); return; } task.setTitle(mTitleField.getText().toString()); task.setDescription(mDescriptionField.getText().toString()); task.setAssignerId(mParentActivity.getUserId()); task.setDueDate(mDate); task.setAssigneeId(mUser.getId()); task.setMiniSiteId(mMiniSite.getId()); task.setComplete(false); Utility.hideKeyboard(mParentActivity, mLayout); createTaskRequest(task, type); }
Source:
public Message(Message message, String id) { _record = new SessionAwareZNRecord(message.getRecord(), id); initStat(); setMsgId(id); }

Target:
public Message(Message message, String id) { super(new SessionAwareZNRecord(message.getRecord(), id)); setMsgId(id); }
Source:
public void testGenerateSpectraS3GetBucketRequestPrototype() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); Map<String,Object> testMap = new HashMap<>(); final String responseType = StructHelper.getResponseTypeName("ListBucketResult"); final Request requestEntry = new Request( "GetBucketRequest", Classification.spectrads3, HttpVerb.GET, "\"/_rest_/\", bucket_name, NULL", null, null, RequestConverter.getParamList(responseType), true, false, responseType ); testMap.put("requestEntry", requestEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/RequestPrototype.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "ds3_error* get_bucket_request(const ds3_client* client, const ds3_request* request, const ds3_list_bucket_result_response** response);"; assertEquals(expectedOutput, output); }

Target:
public void testGenerateSpectraS3GetBucketRequestPrototype() throws IOException, TemplateModelException { final TestFileUtilsImpl fileUtils = new TestFileUtilsImpl(); final Map<String,Object> testMap = new HashMap<>(); final String responseType = StructHelper.getResponseTypeName("ListBucketResult"); final Request requestEntry = new Request( "GetBucketRequest", Classification.spectrads3, HttpVerb.GET, "\"/_rest_/\", bucket_name, NULL", null, null, RequestConverter.getParamList(responseType), true, false, responseType ); testMap.put("requestEntry", requestEntry); final CCodeGenerator codeGenerator = new CCodeGenerator(); codeGenerator.processTemplate(testMap, "header-templates/RequestPrototype.ftl", fileUtils.getOutputStream()); final ByteArrayOutputStream bstream = (ByteArrayOutputStream) fileUtils.getOutputStream(); final String output = new String(bstream.toByteArray()); final String expectedOutput = "ds3_error* get_bucket_request(const ds3_client* client, const ds3_request* request, const ds3_list_bucket_result_response** response);"; assertEquals(expectedOutput, output); }
Source:
protected void testAccessControl() throws Exception { FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session2InCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), }; verifyUnaccessibleWithoutLogin(submissionParams); verifyUnaccessibleForUnregisteredUsers(submissionParams); verifyUnaccessibleForStudents(submissionParams); verifyUnaccessibleForInstructorsOfOtherCourses(submissionParams); verifyUnaccessibleWithoutModifySessionPrivilege(submissionParams); verifyAccessibleForInstructorsOfTheSameCourse(submissionParams); FeedbackSessionsLogic.inst().deleteFeedbackSessionCascade(fs.getSessionName(), fs.getCourseId()); FeedbackSessionsLogic.inst().createFeedbackSession(fs); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); }

Target:
protected void testAccessControl() throws Exception { FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session2InCourse1"); String[] submissionParams = new String[] { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), }; verifyUnaccessibleWithoutLogin(submissionParams); verifyUnaccessibleForUnregisteredUsers(submissionParams); verifyUnaccessibleForStudents(submissionParams); verifyUnaccessibleForInstructorsOfOtherCourses(submissionParams); verifyUnaccessibleWithoutModifySessionPrivilege(submissionParams); verifyAccessibleForInstructorsOfTheSameCourse(submissionParams); verifyAccessibleForAdminToMasqueradeAsInstructor(submissionParams); }
Source:
private boolean draftIsNotEmpty() { if (mMessageContentView.getText().length() != 0) return true; if (!attachmentPresenter.createAttachmentList().isEmpty()) return true; if (mSubjectView.getText().length() != 0) return true; return false; }

Target:
private boolean draftIsNotEmpty() { if (messageContentView.getText().length() != 0) { return true; } if (!attachmentPresenter.createAttachmentList().isEmpty()) { return true; } if (subjectView.getText().length() != 0) { return true; } if (!recipientPresenter.getToAddresses().isEmpty() || !recipientPresenter.getCcAddresses().isEmpty() || !recipientPresenter.getBccAddresses().isEmpty()) { return true; } return false; }
Source:
protected void onResume() { String action = getIntent().getAction(); if (action == null || !action.equals("Already created")) { Intent intent = new Intent(this, AddBudgetActivity.class); startActivity(intent); finish(); } else { getIntent().setAction(null); } super.onResume(); }

Target:
protected void onResume() { super.onResume(); String action = getIntent().getAction(); if (action == null || !action.equals("Already created")) { Intent intent = new Intent(this, AddBudgetActivity.class); startActivity(intent); finish(); } else { getIntent().setAction(null); } }
Source:
public void flush(boolean sync) { List<BatchEntry> temp; if (sync) { flushTransactionLock.lock(); } bufferLock.lock(); try { lastFlush = System.currentTimeMillis(); if (batch == batchSize) { logger.trace("[{}] Batch empty, not flushing", name); return; } batch = batchSize; temp = buffer; buffer = new LinkedList<>(); } finally { bufferLock.unlock(); } try { flushTransactionLock.lock(); final long start = System.currentTimeMillis(); de.beginTransaction(); for (BatchEntry entry : temp) { de.addBatch(entry.getTableName(), entry.getEntityEntry()); } de.flush(); de.commit(); logger.trace("[{}] Batch flushed. Took ms, rows.", name, (System.currentTimeMillis() - start), temp.size()); } catch (Exception e) { logger.error(dev, "[{}] Error occurred while flushing.", name, e); onFlushFailure(temp.toArray(new BatchEntry[temp.size()])); } finally { try { if (de.isTransactionActive()) { de.rollback(); } } catch (Exception e) { logger.trace("[{}] Batch failed to check the flush transaction state", name); } flushTransactionLock.unlock(); } }

Target:
public void flush(boolean sync) { if (!sync) { flush(); } else { try { flushTransactionLock.lock(); flush(); } finally { flushTransactionLock.unlock(); } } }
Source:
public boolean isAnsiSupported() { if (forceAnsi) { return true; } else { return ansiEnabled && ansiSupported; } }

Target:
public boolean isAnsiSupported() { return forceAnsi || (ansiEnabled && ansiSupported); }
Source:
protected KieContainer getKieContainer(RegistryContext context, ReleaseId releaseId) { KieContainer kieContainer; if (releaseId != null) { KieServices kieServices = KieServices.Factory.get(); kieContainer = kieServices.newKieContainer(releaseId); } else { kieContainer = context.lookup(KieContainer.class); if (kieContainer == null) { throw new RuntimeException("ReleaseId was not specfied, nor was an existing KieContainer assigned to the Registry"); } } return kieContainer; }

Target:
protected KieContainer getKieContainer(RegistryContext context, ReleaseId releaseId) { KieContainer kieContainer; if (releaseId != null) { KieServices kieServices = KieServices.Factory.get(); kieContainer = kieServices.newKieContainer(releaseId); } else { kieContainer = context.lookup(KieContainer.class); if (kieContainer == null) { throw new RuntimeException("ReleaseId was not specified, nor was an existing KieContainer assigned to the Registry"); } } return kieContainer; }
Source:
public Long saveOrUpdate(PasswordHistoryDTO passwordHistoryDTO) { Assert.notNull(passwordHistoryDTO); PasswordHistoryEntity entity = modelMapper.map(passwordHistoryDTO, PasswordHistoryEntity.class); entity.setUserEntity(userRepository.findOne(passwordHistoryDTO.getUserId())); try { Long retId = passwordHistoryRepository.save(entity).getId(); if(passwordHistoryRepository.findByUserEntity(entity.getUserEntity()).size()>=5){ deleteOldestPassword(passwordHistoryDTO.getUserId()); } return retId; } catch (ConstraintViolationException | DataIntegrityViolationException ex) { log.error("Save to repository failed.", ex); String historyId = passwordHistoryDTO.getId().toString(); throw new DuplicateRecordException(historyId, "Duplication occurred when saving password history with ID: " + historyId, ex); } }

Target:
public Long saveOrUpdate(PasswordHistoryDTO passwordHistoryDTO) { Assert.notNull(passwordHistoryDTO); PasswordHistoryEntity entity = modelMapper.map(passwordHistoryDTO, PasswordHistoryEntity.class); entity.setUserEntity(userRepository.findOne(passwordHistoryDTO.getUserId())); try { Long retId = passwordHistoryRepository.save(entity).getId(); if(passwordHistoryRepository.findByUserEntity(entity.getUserEntity()).size()>=5){ deleteOldestPassword(passwordHistoryDTO.getUserId()); } return retId; } catch (ConstraintViolationException | DataIntegrityViolationException ex) { log.error("Save to repository failed.", ex); String userId = passwordHistoryDTO.getUserId().toString(); throw new DuplicateRecordException(userId, "Duplication occurred when saving password history for user with ID: " + userId, ex); } }
Source:
private void checkDelta(IMarkerDelta[] deltas) throws AssertionFailedError { assertEquals("wrong number of changes", attributeMap.size(), deltas.length); for (int i = 0; i < deltas.length; i++) { Map values = attributeMap.get(new Long(deltas[i].getId())); assertEquals("Changes different from expecations", deltas[i].getAttributes(), values); } }

Target:
private void checkDelta(IMarkerDelta[] deltas) throws AssertionFailedError { assertEquals("wrong number of changes", attributeMap.size(), deltas.length); for (int i = 0; i < deltas.length; i++) { Map<String, Object> values = attributeMap.get(new Long(deltas[i].getId())); assertEquals("Changes different from expecations", deltas[i].getAttributes(), values); } }
Source:
protected void configure() { bind(ConsistencyModel.class).toInstance(ConsistencyModel.STRICT); bind(BlobStore.class).to(GlacierBlobStore.class); bind(AsyncBlobStore.class).to(GlacierAsyncBlobStore.class); }

Target:
protected void configure() { bind(ConsistencyModel.class).toInstance(ConsistencyModel.EVENTUAL); bind(BlobStore.class).to(GlacierBlobStore.class); bind(AsyncBlobStore.class).to(GlacierAsyncBlobStore.class); }
Source:
public void test_dr1591_DeduceArrayFromInitializerList_a() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); NameCollector col = new NameCollector(); tu.accept(col); ICPPFunctionTemplate f = (ICPPFunctionTemplate) col.getName(1).resolveBinding(); assertEquals("f", col.getName(5).toString()); IBinding fCall = col.getName(5).resolveBinding(); assertTrue(fCall instanceof IFunction); IFunction f2 = (IFunction) fCall; assertTrue(f2 instanceof ICPPTemplateInstance); assertSame(f, ((ICPPTemplateInstance) f2).getTemplateDefinition()); }

Target:
public void test_dr1591_DeduceArrayFromInitializerList_a() throws Exception { IASTTranslationUnit tu = parse(getAboveComment(), CPP); NameCollector col = new NameCollector(); tu.accept(col); ICPPFunctionTemplate f = (ICPPFunctionTemplate) col.getName(1).resolveBinding(); assertEquals("f", col.getName(5).toString()); IBinding fCall = col.getName(5).resolveBinding(); assertInstance(fCall, IFunction.class); IFunction f2 = (IFunction) fCall; assertInstance(f2, ICPPTemplateInstance.class); assertSame(f, ((ICPPTemplateInstance) f2).getTemplateDefinition()); }
Source:
public void bufferReceived(Object connectionID, ActiveMQBuffer buffer) { super.bufferReceived(connectionID, buffer); try { Command command = (Command) wireFormat.unmarshal(buffer); boolean responseRequired = command.isResponseRequired(); int commandId = command.getCommandId(); if (command.getClass() != KeepAliveInfo.class) { Response response = null; try { setLastCommand(command); response = command.visit(commandProcessorInstance); } catch (Exception e) { e.printStackTrace(); if (responseRequired) { response = convertException(e); } } finally { setLastCommand(null); } if (response instanceof ExceptionResponse) { if (!responseRequired) { Throwable cause = ((ExceptionResponse) response).getException(); serviceException(cause); response = null; } } if (responseRequired) { if (response == null) { response = new Response(); response.setCorrelationId(command.getCommandId()); } } if (context != null) { if (context.isDontSendReponse()) { context.setDontSendReponse(false); response = null; } } if (response != null && !protocolManager.isStopping()) { response.setCorrelationId(commandId); dispatchSync(response); } } else { System.out.println(this + "====server received a keepalive: " + System.currentTimeMillis()); } } catch (Exception e) { ActiveMQServerLogger.LOGGER.debug(e); sendException(e); } }

Target:
public void bufferReceived(Object connectionID, ActiveMQBuffer buffer) { super.bufferReceived(connectionID, buffer); try { Command command = (Command) wireFormat.unmarshal(buffer); boolean responseRequired = command.isResponseRequired(); int commandId = command.getCommandId(); if (command.getClass() != KeepAliveInfo.class) { Response response = null; try { setLastCommand(command); response = command.visit(commandProcessorInstance); } catch (Exception e) { e.printStackTrace(); if (responseRequired) { response = convertException(e); } } finally { setLastCommand(null); } if (response instanceof ExceptionResponse) { if (!responseRequired) { Throwable cause = ((ExceptionResponse) response).getException(); serviceException(cause); response = null; } } if (responseRequired) { if (response == null) { response = new Response(); response.setCorrelationId(command.getCommandId()); } } if (context != null) { if (context.isDontSendReponse()) { context.setDontSendReponse(false); response = null; } } if (response != null && !protocolManager.isStopping()) { response.setCorrelationId(commandId); dispatchSync(response); } } } catch (Exception e) { ActiveMQServerLogger.LOGGER.debug(e); sendException(e); } }
Source:
public RegistryConfigs authForBuild() throws DockerException { final AuthorizationData accessToken; try { accessToken = getAccessToken(); } catch (IOException e) { log.warn("unable to get access token for Google Container Registry, " + "configuration for building image will not contain RegistryAuth for GCR", e); return RegistryConfigs.empty(); } final Map<String, RegistryAuth> configs = new HashMap<String, RegistryAuth>(1); configs.put(accessToken.getProxyEndpoint(), authForAuthorizationData(accessToken)); return RegistryConfigs.create(configs); }

Target:
public RegistryConfigs authForBuild() throws DockerException { final AuthorizationData accessToken; try { accessToken = getAccessToken(); } catch (IOException e) { log.warn("unable to get access token for AWS Elastic Container Registry, " + "configuration for building image will not contain RegistryAuth for ECR", e); return RegistryConfigs.empty(); } final Map<String, RegistryAuth> configs = new HashMap<String, RegistryAuth>(1); configs.put(accessToken.getProxyEndpoint(), authForAuthorizationData(accessToken)); return RegistryConfigs.create(configs); }
Source:
public HashMap<Integer, ItemStack> addItem(ItemStack... items) { HashMap<Integer, ItemStack> result = new HashMap<>(); for (int i = 0; i < items.length; ++i) { ItemStack item = items[i]; while (item.getAmount() > 0) { int available = firstAvailable(item); if (available == -1) { result.put(i, item); break; } else { ItemStack curItem = getItem(available); int fill = item.getAmount(); if (curItem == null) { ItemStack temp = item.clone(); fill = item.getAmount() >= getMaxStackSize() ? getMaxStackSize() : item.getAmount(); temp.setAmount(fill); setItem(available, temp); } else { fill = item.getAmount() + curItem.getAmount() >= curItem.getMaxStackSize() ? curItem.getMaxStackSize() : curItem.getAmount() + item.getAmount(); curItem.setAmount(fill); } item.setAmount(item.getAmount() - fill); } } } return result; }

Target:
public HashMap<Integer, ItemStack> addItem(ItemStack... items) { HashMap<Integer, ItemStack> result = new HashMap<>(); for (int i = 0; i < items.length; ++i) { ItemStack item = ItemStack.sanitize(items[i]); if (item == null) continue; while (item.getAmount() > 0) { int available = firstAvailable(item); if (available == -1) { result.put(i, item); break; } else { ItemStack curItem = getItem(available); int curAmount = curItem == null ? 0 : curItem.getAmount(); int add; if (curAmount + item.getAmount() >= item.getMaxStackSize()) { add = item.getMaxStackSize() - curAmount; } else { add = item.getAmount(); } ItemStack temp = new ItemStack(item.getType(), curAmount + add); setItem(available, temp); item.setAmount(item.getAmount() - add); } } } return result; }
Source:
private Iterator<Page> readPages() { checkState(writable, "Repeated reads are disallowed to prevent potential resource leaks"); writable = false; try { InputStream input = targetFile.newInputStream(); Closeable resources = closer.register(input); Iterator<Page> pages = PagesSerdeUtil.readPages(serde, new InputStreamSliceInput(input, BUFFER_SIZE)); return PrestoIterators.closeWhenExhausted(pages, resources); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to read spilled pages", e); } }

Target:
private Iterator<Page> readPages() { checkState(writable, "Repeated reads are disallowed to prevent potential resource leaks"); writable = false; try { InputStream input = closer.register(targetFile.newInputStream()); Iterator<Page> pages = PagesSerdeUtil.readPages(serde, new InputStreamSliceInput(input, BUFFER_SIZE)); return PrestoIterators.closeWhenExhausted(pages, input); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to read spilled pages", e); } }
Source:
private static SQLPatternPart makeInnerStreamModifierClausePattern(boolean captureTokens) { return SPF.oneOf( SPF.clause( SPF.token("export"),SPF.token("to"),SPF.token("target"), SPF.group(captureTokens, "targetName", SPF.databaseObjectName()) ), SPF.clause( SPF.token("partition"), SPF.token("on"), SPF.token("column"), SPF.group(captureTokens, "partitionColumnName", SPF.databaseObjectName()) ), SPF.clause( SPF.token("as"),SPF.token("topic"), SPF.optional( SPF.clause( SPF.token("profile"), SPF.group(captureTokens, "topicProfileName", SPF.databaseObjectName()) ) ), SPF.optional( SPF.clause( SPF.token("format"), SPF.group(captureTokens, "topicFormatName", SPF.databaseObjectName()) ) ), SPF.optional( SPF.clause( SPF.token("key-columns"), SPF.group(captureTokens, "topicKeyColumnNames", new SQLPatternPartElement("[\\w$]+(?:\\s*,\\s*[\\w$]+)*") ) ) ), SPF.optional( SPF.clause( SPF.token("allow"), SPF.group(captureTokens, "topicAllowedRoleNames", new SQLPatternPartElement("[\\w$]+(?:\\s*,\\s*[\\w$]+)*") ) ) ) ) ); }

Target:
private static SQLPatternPart makeInnerStreamModifierClausePattern(boolean captureTokens) { return SPF.oneOf( SPF.clause( SPF.token("export"),SPF.token("to"),SPF.token("target"), SPF.group(captureTokens, CAPTURE_EXPORT_TARGET, SPF.databaseObjectName()) ), SPF.clause( SPF.token("partition"), SPF.token("on"), SPF.token("column"), SPF.group(captureTokens, CAPTURE_STREAM_PARTITION_COLUMN, SPF.databaseObjectName()) ), SPF.clause( SPF.token("as"),SPF.token("topic"), SPF.optional( SPF.clause( SPF.token("profile"), SPF.group(captureTokens, CAPTURE_TOPIC_PROFILE, SPF.databaseObjectName()) ) ), SPF.optional( SPF.clause( SPF.token("format"), SPF.group(captureTokens, CAPTURE_TOPIC_FORMAT, SPF.databaseObjectName()) ) ), SPF.optional( SPF.clause( SPF.token("key-columns"), SPF.group(captureTokens, CAPTURE_TOPIC_KEY_COLUMNS, new SQLPatternPartElement("[\\w$]+(?:\\s*,\\s*[\\w$]+)*") ) ) ), SPF.optional( SPF.clause( SPF.token("allow"), SPF.group(captureTokens, CAPTURE_TOPIC_ALLOWED_ROLES, new SQLPatternPartElement("[\\w$]+(?:\\s*,\\s*[\\w$]+)*") ) ) ) ) ); }
Source:
private PasswordCredential getTenantAdminPasswordCredential(String tenantId) throws TException, ApplicationSettingsException { RegistryService.Client regClient = registryClientPool.getResource(); GatewayResourceProfile gwrp = regClient.getGatewayResourceProfile(tenantId); CredentialStoreService.Client csClient = csClientPool.getResource(); try { PasswordCredential TenantAdminPassword = csClient.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), gwrp.getGatewayID()); csClientPool.returnResource(csClient); registryClientPool.returnResource(regClient); return TenantAdminPassword; }catch (Exception e){ logger.error("Error while getting the tenant admin password", e); AiravataSystemException exception = new AiravataSystemException(); exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); exception.setMessage("Error while getting password credentials. More info : " + e.getMessage()); csClientPool.returnBrokenResource(csClient); registryClientPool.returnBrokenResource(regClient); throw exception; } }

Target:
private PasswordCredential getTenantAdminPasswordCredential(String tenantId) throws TException, ApplicationSettingsException { RegistryService.Client regClient = registryClientPool.getResource(); GatewayResourceProfile gwrp = regClient.getGatewayResourceProfile(tenantId); CredentialStoreService.Client csClient = csClientPool.getResource(); try { PasswordCredential TenantAdminPassword = csClient.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), gwrp.getGatewayID()); csClientPool.returnResource(csClient); registryClientPool.returnResource(regClient); return TenantAdminPassword; } catch (Exception e){ logger.error("Error while getting the tenant admin password for the tenant id "+tenantId+"", e); AiravataSystemException exception = new AiravataSystemException(); exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); exception.setMessage("Error while getting password credentials. More info : " + e.getMessage()); csClientPool.returnBrokenResource(csClient); registryClientPool.returnBrokenResource(regClient); throw exception; } }
Source:
private boolean parseInputToCheckIfHEX(String newText) { if (newText.length() == 0) { return false; } if (newText.length() != 9) { return false; } try { Color.parseColor(newText); return true; } catch (IllegalArgumentException e) { return false; } }

Target:
private int parseInputToCheckIfHEX(String newText) { if (newText.length() != 9 || !newText.substring(0, 1).equals("#")) { return NOT_A_HEX_VALUE; } try { return Color.parseColor(newText); } catch (IllegalArgumentException e) { return NOT_A_HEX_VALUE; } }
Source:
protected int doWork() { IOUtil.assertFilesAreReadable(INPUT); try { InfiniumNormalizationManifest infiniumNormalizationManifest = new InfiniumNormalizationManifest(ILLUMINA_NORMALIZATION_MANIFEST); InfiniumGTCFile gtcFileOne = new InfiniumGTCFile(new DataInputStream(new FileInputStream(INPUT.get(0))), infiniumNormalizationManifest); InfiniumGTCFile gtcFileTwo = new InfiniumGTCFile(new DataInputStream(new FileInputStream(INPUT.get(1))), infiniumNormalizationManifest); compareGTCFiles(gtcFileOne, gtcFileTwo); if (!errors.isEmpty()) { for (String error : errors) { log.error(error); } return 1; } } catch (IOException | IllegalAccessException | InvocationTargetException e) { throw new PicardException("File error: ", e); } return 0; }

Target:
protected int doWork() { IOUtil.assertFilesAreReadable(INPUT); InfiniumNormalizationManifest infiniumNormalizationManifest = new InfiniumNormalizationManifest(ILLUMINA_NORMALIZATION_MANIFEST); try (InfiniumGTCFile gtcFileOne = new InfiniumGTCFile(new DataInputStream(new FileInputStream(INPUT.get(0))), infiniumNormalizationManifest); InfiniumGTCFile gtcFileTwo = new InfiniumGTCFile(new DataInputStream(new FileInputStream(INPUT.get(1))), infiniumNormalizationManifest)) { compareGTCFiles(gtcFileOne, gtcFileTwo); if (!errors.isEmpty()) { for (String error : errors) { log.error(error); } return 1; } } catch (Exception e) { throw new PicardException("File error: ", e); } return 0; }
Source:
private static InputStream openFileOrUrlInputStream(String filenameOrUrl) throws DbException { try { URI uri = new URI(filenameOrUrl); if(uri.getScheme() == null) return openFileInputStream(filenameOrUrl); else if(uri.getScheme().equals("hdfs")) return openHDFSInputStream(uri); else return uri.toURL().openConnection().getInputStream(); } catch(IllegalArgumentException e) { return openFileInputStream(filenameOrUrl); } catch(URISyntaxException e) { return openFileInputStream(filenameOrUrl); } catch(MalformedURLException e) { return openFileInputStream(filenameOrUrl); } catch(IOException e) { throw new DbException(e); } }

Target:
private static InputStream openFileOrUrlInputStream(String filenameOrUrl) throws DbException { try { URI uri = new URI(filenameOrUrl); if (uri.getScheme() == null) { return openFileInputStream(filenameOrUrl); } else if (uri.getScheme().equals("hdfs")) { return openHdfsInputStream(uri); } else { return uri.toURL().openStream(); } } catch (IllegalArgumentException e) { return openFileInputStream(filenameOrUrl); } catch (URISyntaxException e) { return openFileInputStream(filenameOrUrl); } catch (MalformedURLException e) { return openFileInputStream(filenameOrUrl); } catch (IOException e) { throw new DbException(e); } }
Source:
protected EmbeddedCacheManager createCacheManager() throws Exception { Configuration c = getDefaultStandaloneConfig(true); c.fluent() .indexing() .indexLocalOnly(true) .addProperty("hibernate.search.default.directory_provider", "ram") .addProperty("hibernate.search.lucene_version", "LUCENE_CURRENT"); EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createCacheManager(c); Cache<Object, Object> cache = cacheManager.getCache(); transactionManager = cache.getAdvancedCache().getTransactionManager(); searchManager = Search.getSearchManager(cache); return cacheManager; }

Target:
protected EmbeddedCacheManager createCacheManager() throws Exception { ConfigurationBuilder cfg = getDefaultStandaloneCacheConfig(true); cfg .indexing() .indexLocalOnly(true) .addProperty("hibernate.search.default.directory_provider", "ram") .addProperty("hibernate.search.lucene_version", "LUCENE_CURRENT"); EmbeddedCacheManager cacheManager = TestCacheManagerFactory.createCacheManager(cfg); Cache<Object, Object> cache = cacheManager.getCache(); transactionManager = cache.getAdvancedCache().getTransactionManager(); searchManager = Search.getSearchManager(cache); return cacheManager; }
Source:
public void becomeUser( final String principalName, final IParameterProvider paramProvider ) { UserSession session = null; tenantedUserNameUtils = getTenantedUserNameUtils(); if ( tenantedUserNameUtils != null ) { session = new UserSession( principalName, null, false, paramProvider ); ITenant tenant = tenantedUserNameUtils.getTenant( principalName ); session.setAttribute( IPentahoSession.TENANT_ID_KEY, tenant.getId() ); session.setAuthenticated( tenant.getId(), principalName ); } else { session = new UserSession( principalName, null, false, paramProvider ); session.setAuthenticated( principalName ); } PentahoSessionHolder.setSession( session ); Authentication auth = createAuthentication( principalName ); PentahoSessionHolder.getSession().setAttribute( "roles", auth.getAuthorities() ); SecurityContextHolder.clearContext(); SecurityContextHolder.getContext().setAuthentication( auth ); PentahoSystem.sessionStartup( PentahoSessionHolder.getSession(), paramProvider ); }

Target:
public void becomeUser( final String principalName, final IParameterProvider paramProvider ) { UserSession session = null; tenantedUserNameUtils = getTenantedUserNameUtils(); if ( tenantedUserNameUtils != null ) { session = new UserSession( principalName, null, false, paramProvider ); ITenant tenant = tenantedUserNameUtils.getTenant( principalName ); session.setAttribute( IPentahoSession.TENANT_ID_KEY, tenant.getId() ); session.setAuthenticated( tenant.getId(), principalName ); } else { session = new UserSession( principalName, null, false, paramProvider ); session.setAuthenticated( principalName ); } PentahoSessionHolder.setSession( session ); Authentication auth = createAuthentication( principalName ); PentahoSessionHolder.getSession().setAttribute( IPentahoSession.SESSION_ROLES, auth.getAuthorities() ); SecurityContextHolder.clearContext(); SecurityContextHolder.getContext().setAuthentication( auth ); PentahoSystem.sessionStartup( PentahoSessionHolder.getSession(), paramProvider ); }
Source:
void sendMessage(final String message) { Preconditions.checkState(!closed); client.send(message); }

Target:
void sendMessage(final String message) { Preconditions.checkState(!closed); Preconditions.checkState(client.isOpen()); client.send(message); }
Source:
private RolesAllowedRequestFilter(HttpServletRequest request, HttpServletResponse response, String[] rolesAllowed, boolean permitAll) { this.request = request; this.response = response; this.rolesAllowed = rolesAllowed; this.securityContext = CDI.current().select(SecurityContext.class).get(); this.permitAll = permitAll; assert permitAll ^ rolesAllowed != null; }

Target:
private RolesAllowedRequestFilter(HttpServletRequest request, HttpServletResponse response, String[] rolesAllowed, boolean permitAll) { this.request = request; this.response = response; this.rolesAllowed = rolesAllowed; this.securityContext = CDI.current().select(SecurityContext.class).get(); this.permitAll = permitAll; assert permitAll == (rolesAllowed == null); }
Source:
static CassandraVersion fromEnvironment() { String version = System.getenv(CassandraEnvironment.CASSANDRA_VERSION); return Strings.isNullOrEmpty(version) ? new Cassandra22XVersion() : from(version); }

Target:
static CassandraVersion fromEnvironment() { String version = CassandraEnvironment.getVersion(); return from(version); }
Source:
public void testNoFrom() { assertQuery("SELECT 1 + 2, 3 + 4", "SELECT 1 + 2, 3 + 4"); }

Target:
public void testNoFrom() { assertQuery("SELECT 1 + 2, 3 + 4"); }
Source:
private Iterator<Page> readPages() { if (read) { throw new RuntimeException("Already read"); } read = true; writable = false; try { InputStream input = new FileInputStream(targetFileName.toFile()); memoryContext.setBytes(BUFFER_SIZE); Closeable resources = PrestoCloseables.combine(input, () -> memoryContext.setBytes(0)); closer.register(resources); Iterator<Page> pages = PagesSerdeUtil.readPages(serde, new InputStreamSliceInput(input, BUFFER_SIZE)); return PrestoIterators.closeWhenExhausted(pages, resources); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to read spilled pages", e); } }

Target:
private Iterator<Page> readPages() { checkState(writable, "Repeated reads are disallowed to prevent potential resource leaks"); writable = false; try { InputStream input = targetFile.newInputStream(); Closeable resources = closer.register(combineCloseables(input, () -> memoryContext.setBytes(0))); memoryContext.setBytes(BUFFER_SIZE); Iterator<Page> pages = PagesSerdeUtil.readPages(serde, new InputStreamSliceInput(input, BUFFER_SIZE)); return PrestoIterators.closeWhenExhausted(pages, resources); } catch (IOException e) { throw new PrestoException(GENERIC_INTERNAL_ERROR, "Failed to read spilled pages", e); } }
Source:
public void contextInitialized(ServletContextEvent event) { log.debug("Starting the OpenMRS webapp"); try { OpenmrsUtil.validateJavaVersion(); ServletContext servletContext = event.getServletContext(); loadConstants(servletContext); clearDWRFile(servletContext); setApplicationDataDirectory(servletContext); Properties props = getRuntimeProperties(); if (props != null) { setRuntimePropertiesFound(true); Context.setRuntimeProperties(props); String appDataRuntimeProperty = props .getProperty(OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY, null); if (StringUtils.hasLength(appDataRuntimeProperty)) { OpenmrsUtil.setApplicationDataDirectory(null); } log.info("Using runtime properties file: " + OpenmrsUtil.getRuntimePropertiesFilePathName(WebConstants.WEBAPP_NAME)); } Thread.currentThread().setContextClassLoader(OpenmrsClassLoader.getInstance()); if (!setupNeeded()) { copyCustomizationIntoWebapp(servletContext, props); XmlWebApplicationContext context = (XmlWebApplicationContext) createWebApplicationContext(servletContext); configureAndRefreshWebApplicationContext(context, servletContext); servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); WebDaemon.startOpenmrs(event.getServletContext()); } else { setupNeeded = true; } } catch (Exception e) { setErrorAtStartup(e); log.error(MarkerFactory.getMarker("FATAL"), "Failed to obtain JDBC connection", e); } }

Target:
public void contextInitialized(ServletContextEvent event) { log.debug("Starting the OpenMRS webapp"); try { OpenmrsUtil.validateJavaVersion(); ServletContext servletContext = event.getServletContext(); loadConstants(servletContext); clearDWRFile(servletContext); setApplicationDataDirectory(servletContext); Properties props = getRuntimeProperties(); if (props != null) { setRuntimePropertiesFound(true); Context.setRuntimeProperties(props); String appDataRuntimeProperty = props .getProperty(OpenmrsConstants.APPLICATION_DATA_DIRECTORY_RUNTIME_PROPERTY, null); if (StringUtils.hasLength(appDataRuntimeProperty)) { OpenmrsUtil.setApplicationDataDirectory(null); } Logger contextLog = Logger.getLogger(getClass()); contextLog.setLevel(Level.INFO); contextLog.info("Using runtime properties file: " + OpenmrsUtil.getRuntimePropertiesFilePathName(WebConstants.WEBAPP_NAME)); } Thread.currentThread().setContextClassLoader(OpenmrsClassLoader.getInstance()); if (!setupNeeded()) { copyCustomizationIntoWebapp(servletContext, props); XmlWebApplicationContext context = (XmlWebApplicationContext) createWebApplicationContext(servletContext); configureAndRefreshWebApplicationContext(context, servletContext); servletContext.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context); WebDaemon.startOpenmrs(event.getServletContext()); } else { setupNeeded = true; } } catch (Exception e) { setErrorAtStartup(e); log.error(MarkerFactory.getMarker("FATAL"), "Failed to obtain JDBC connection", e); } }
Source:
private void doBootstrapParentChannel(Callback<Channel> callback) { _parentChannelLifecycle.create(new TimeoutCallback<>(_scheduler, _creationTimeout, TimeUnit.MILLISECONDS, new Callback<Channel>() { @Override public void onError(Throwable error) { callback.onError(error); if (error instanceof ObjectCreationTimeoutException) { LOG.error(error.getMessage(), error); } } @Override public void onSuccess(Channel channel) { channel.attr(NettyChannelAttributes.INITIALIZATION_FUTURE).get().addListener(alpnFuture -> { if (alpnFuture.isSuccess()) { callback.onSuccess(channel); } else { callback.onError(alpnFuture.cause()); } }); } }, new ObjectCreationTimeoutException( "Exceeded creation timeout of " + _creationTimeout + "ms: for HTTP/2 parent channel, remote=" + _address))); }

Target:
private void doBootstrapParentChannel(Callback<Channel> callback) { _parentChannelLifecycle.create(new TimeoutCallback<>(_scheduler, _channelCreationTimeoutMs, TimeUnit.MILLISECONDS, new Callback<Channel>() { @Override public void onError(Throwable error) { callback.onError(error); if (error instanceof ObjectCreationTimeoutException) { LOG.error(error.getMessage(), error); } } @Override public void onSuccess(Channel channel) { channel.attr(NettyChannelAttributes.INITIALIZATION_FUTURE).get().addListener(alpnFuture -> { if (alpnFuture.isSuccess()) { callback.onSuccess(channel); } else { callback.onError(alpnFuture.cause()); } }); } }, new ObjectCreationTimeoutException( "Exceeded creation timeout of " + _channelCreationTimeoutMs + "ms: for HTTP/2 parent channel, remote=" + _address))); }
Source:
public void changeDeviceModel(@Identification final String organisationIdentification, final String manufacturer, final String modelCode, final String description) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.CHANGE_MANUFACTURER); final Manufacturer dbManufacturer = this.manufacturerRepository.findByManufacturerId(manufacturer); final DeviceModel changedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(dbManufacturer, modelCode); if (changedDeviceModel == null) { LOGGER.info("DeviceModel not found."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(Manufacturer.class, modelCode)); } else { changedDeviceModel.setDescription(description); this.deviceModelRepository.save(changedDeviceModel); } }

Target:
public void changeDeviceModel(@Identification final String organisationIdentification, final String manufacturer, final String modelCode, final String description) throws FunctionalException { final Organisation organisation = this.domainHelperService.findOrganisation(organisationIdentification); this.domainHelperService.isAllowed(organisation, PlatformFunction.CHANGE_MANUFACTURER); final Manufacturer dataseManufacturer = this.manufacturerRepository.findByManufacturerId(manufacturer); final DeviceModel changedDeviceModel = this.deviceModelRepository.findByManufacturerIdAndModelCode(dataseManufacturer, modelCode); if (changedDeviceModel == null) { LOGGER.info("DeviceModel not found."); throw new FunctionalException(FunctionalExceptionType.UNKNOWN_DEVICEMODEL, ComponentType.WS_CORE, new ExistingEntityException(Manufacturer.class, modelCode)); } else { changedDeviceModel.setDescription(description); this.deviceModelRepository.save(changedDeviceModel); } }
Source:
protected void startActions() { try { fServer = new LSPServer(); } catch (IOException e) { e.printStackTrace(); } }

Target:
protected void startActions() { try { fServer = new LSPServer(); } catch (IOException e) { getInstance().logError(e.getMessage()); } }
Source:
public void registerApollo(String apolloFlag) { if (apolloFlag != null && apolloFlag.equalsIgnoreCase("true")) { this.apolloEnabled = true; } else { this.apolloEnabled = false; } }

Target:
public void registerApollo(String apolloFlag) { this.apolloEnabled = "true".equalsIgnoreCase(apolloFlag); }
Source:
protected boolean canDoAction() { boolean returnValue = super.canDoAction(); if (returnValue && (getParameters().getSysPrepUserName() == null ^ getParameters().getSysPrepPassword() == null)) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM); returnValue = false; } if(getParameters().getDestinationVdsId() != null && !getCurrentUser().isAdmin()) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_RUN_ONCE_NOT_ADMIN_FOR_DESTINATION_VDS_PARAM); returnValue = false; } return returnValue; }

Target:
protected boolean canDoAction() { boolean returnValue = super.canDoAction(); if (returnValue && (getParameters().getSysPrepUserName() == null ^ getParameters().getSysPrepPassword() == null)) { addCanDoActionMessage(VdcBllMessages.VM_CANNOT_RUN_ONCE_WITH_ILLEGAL_SYSPREP_PARAM); returnValue = false; } return returnValue; }
Source:
private void fillCacheUntilEndOrFull(int rowIdx, PTFPartition p) throws HiveException { BoundaryCache cache = p.getBoundaryCache(); if (cache == null || p.size() <= 0) { return; } Map.Entry<Integer, Object> ceilingEntry = cache.getMaxEntry(); if (ceilingEntry != null) { rowIdx = ceilingEntry.getKey(); } Object rowVal = null; Object lastRowVal = null; while (rowIdx < p.size()) { rowVal = computeValue(p.getAt(rowIdx)); if (!isEqual(rowVal, lastRowVal)){ if (!cache.putIfNotFull(rowIdx, rowVal)){ break; } } lastRowVal = rowVal; ++rowIdx; } if (cache.putIfNotFull(rowIdx, null)) { cache.setComplete(true); } }

Target:
private void fillCacheUntilEndOrFull(int rowIdx, PTFPartition p) throws HiveException { BoundaryCache cache = p.getBoundaryCache(); if (cache == null || p.size() <= 0) { return; } Object rowVal = null; Map.Entry<Integer, Object> ceilingEntry = cache.getMaxEntry(); if (ceilingEntry != null) { rowIdx = ceilingEntry.getKey(); rowVal = ceilingEntry.getValue(); ++rowIdx; } Object lastRowVal = rowVal; while (rowIdx < p.size() && !cache.isFull()) { rowVal = computeValue(p.getAt(rowIdx)); if (!isEqual(rowVal, lastRowVal)){ cache.put(rowIdx, rowVal); } lastRowVal = rowVal; ++rowIdx; } if (cache.putIfNotFull(rowIdx, null)) { cache.setComplete(true); } }
Source:
public Set<Capability> getCapabilities(FileSystem fs, Path path) { if (logger.isDebugEnabled()) { logger.debug("Parquet file path: " + path.toUri().getPath()); } Reader orcReader = null; RecordReader recordReader = null; try { orcReader = OrcFile.createReader(fs, path); recordReader = orcReader.rows(null); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug(path.toUri().getPath() + " is not a ORC file."); logger.debug("Error in opening ORC file: " + e.getLocalizedMessage()); } return EnumSet.noneOf(Capability.class); } finally { if (recordReader != null) { try { recordReader.close(); } catch (IOException e) { logger.error(e); } } } return EnumSet.of(Capability.READ, Capability.SCHEMA); }

Target:
public Set<Capability> getCapabilities(FileSystem fs, Path path) { if (logger.isDebugEnabled()) { logger.debug("orc file path: " + path.toUri().getPath()); } Reader orcReader = null; RecordReader recordReader = null; try { orcReader = OrcFile.createReader(fs, path); recordReader = orcReader.rows(null); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug(path.toUri().getPath() + " is not a ORC file."); logger.debug("Error in opening ORC file: " + e.getLocalizedMessage()); } return EnumSet.noneOf(Capability.class); } finally { if (recordReader != null) { try { recordReader.close(); } catch (IOException e) { logger.error(e); } } } return EnumSet.of(Capability.READ, Capability.SCHEMA); }
Source:
public CompilationResponse compileSync(InternalNIOCompilationRequest req) { CompilationResponse res = compiler.compileSync(req); if (res.isSuccessful()) { return new DefaultCompilationResponse(Boolean.TRUE, LogUtils.getOutput(req.getInfo().getPrjPath().toAbsolutePath().toString(), req.getKieCliRequest().getLogFile(), req.getKieCliRequest().getRequestUUID())); } else { return new DefaultCompilationResponse(Boolean.FALSE, LogUtils.getOutput(req.getInfo().getPrjPath().toAbsolutePath().toString(), req.getKieCliRequest().getLogFile(), req.getKieCliRequest().getRequestUUID())); } }

Target:
public CompilationResponse compileSync(InternalNIOCompilationRequest req) { CompilationResponse res = compiler.compileSync(req); if (res.isSuccessful()) { return getDefaultCompilationResponse(Boolean.TRUE, req); } else { return getDefaultCompilationResponse(Boolean.FALSE, req); } }